Class: Bones::App::UpdateCommand
- Defined in:
- lib/bones/app/update_command.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
#copy_tasks, #initialize, #mrbones_dir, #name, #output_dir, #repository, #skeleton_dir, #standard_options, #verbose?, #with_tasks?
Constructor Details
This class inherits a constructor from Bones::App::Command
Instance Method Details
#parse(args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bones/app/update_command.rb', line 17 def parse( args ) std_opts = opts = OptionParser.new opts. = 'Usage: bones update <directory>' opts.separator '' opts.separator ' Copy the Mr Bones rake tasks into the project directory' opts.separator '' opts.separator ' Common Options:' opts.on_tail( '-h', '--help', 'show this message' ) { @out.puts opts exit } # parse the command line arguments opts.parse! args [:output_dir] = args.empty? ? nil : args.join('_') if output_dir.nil? @out.puts opts exit 1 end end |
#run(args) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/bones/app/update_command.rb', line 7 def run( args ) parse args raise "'#{output_dir}' does not exist" unless test(?e, output_dir) copy_tasks(File.join(output_dir, 'tasks')) msg = "Updated tasks in directory '#{output_dir}'" @out.puts msg end |