2016-08-03 00:46:43 -04:00
|
|
|
module RakeHelpers
|
2016-11-29 13:21:25 -05:00
|
|
|
def run_rake_task(task_name, *args)
|
2016-08-03 00:46:43 -04:00
|
|
|
Rake::Task[task_name].reenable
|
2016-11-29 13:21:25 -05:00
|
|
|
Rake.application.invoke_task("#{task_name}[#{args.join(',')}]")
|
2016-08-03 00:46:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def stub_warn_user_is_not_gitlab
|
2017-08-08 11:48:33 -04:00
|
|
|
allow(main_object).to receive(:warn_user_is_not_gitlab)
|
2016-08-03 00:46:43 -04:00
|
|
|
end
|
2017-05-25 19:46:54 -04:00
|
|
|
|
|
|
|
def silence_output
|
2017-08-08 11:48:33 -04:00
|
|
|
allow(main_object).to receive(:puts)
|
|
|
|
allow(main_object).to receive(:print)
|
|
|
|
end
|
|
|
|
|
2018-05-09 23:53:21 -04:00
|
|
|
def silence_progress_bar
|
|
|
|
allow_any_instance_of(ProgressBar::Output).to receive(:stream).and_return(double().as_null_object)
|
|
|
|
end
|
|
|
|
|
2017-08-08 11:48:33 -04:00
|
|
|
def main_object
|
|
|
|
@main_object ||= TOPLEVEL_BINDING.eval('self')
|
2017-05-25 19:46:54 -04:00
|
|
|
end
|
2016-08-03 00:46:43 -04:00
|
|
|
end
|