Class: RepoManager::TaskAction
- Inherits:
-
AppAction
- Object
- BaseAction
- AppAction
- RepoManager::TaskAction
- Defined in:
- lib/repo_manager/actions/task_action.rb
Overview
Invoke external tasks, normally Thor tasks
Instance Attribute Summary
Attributes inherited from BaseAction
#args, #configuration, #exit_code, #option_parser, #options, #output, #template
CLI actions collapse
- #help ⇒ Object
-
#parse_options ⇒ Object
Add action specific options.
- #process ⇒ Object
Methods inherited from AppAction
Methods inherited from BaseAction
#after_execute, #asset_options, #asset_type, #assets, #before_execute, #execute, #initialize, #items, #overwrite_output?, #render, #write_to_output
Constructor Details
This class inherits a constructor from RepoManager::BaseAction
Instance Method Details
#help ⇒ Object
75 76 77 |
# File 'lib/repo_manager/actions/task_action.rb', line 75 def help super(:comment_starting_with => "Invoke", :located_in_file => __FILE__) end |
#parse_options ⇒ Object
Add action specific options
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/repo_manager/actions/task_action.rb', line 33 def super(:raise_on_invalid_option => false, :parse_base_options => false) do |opts| opts.on("-T", "--tasks", "List tasks") do |t| [:tasks] = t end opts.on("--bare", "List task names for CLI completion, implies '--tasks'") do |b| [:bare] = b [:tasks] = true if b end end end |
#process ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/repo_manager/actions/task_action.rb', line 48 def process # Thor actions can include toxic side effects, # keep the namespace clean until needed require 'repo_manager/tasks/task_manager' task_manager = RepoManager::TaskManager.new(configuration) if [:tasks] if [:bare] task_manager. else task_manager.list_tasks end return 0 end raise "task name required" if args.empty? target = args.shift if target == "help" target = args.shift task_manager.task_help(target) else task_manager.invoke(target, args) end end |