Class: PostPushCli
- Inherits:
-
Thor
- Object
- Thor
- PostPushCli
- Defined in:
- lib/post_push_cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
5 6 7 |
# File 'lib/post_push_cli.rb', line 5 def self.exit_on_failure? true end |
Instance Method Details
#status ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/post_push_cli.rb', line 41 def status load_rails_env! unless [:new] puts "Finished tasks:" puts completed_tasks.join "\n" end puts unless [:new] || [:done] unless [:done] puts "Pending tasks:" puts runnable_tasks.join "\n" end puts end |
#work ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/post_push_cli.rb', line 10 def work load_rails_env! succeeded = [] failed = [] runnable_tasks.each do |task| puts "Running task #{task}..." puts job = RakeTaskRunner.exec(task) if job.status task_complete!(task) succeeded << task "Successfully ran #{task}" else "Error in: #{task}" failed << task end puts "-" * 56 puts end "#{succeeded.size} tasks succeeded" "Errors occured in #{failed.size} tasks:\n#{failed.join("\n")}" if failed.any? raise "Some tasks failed" if failed.any? end |