Class: Bones::App::UnfreezeCommand

Inherits:
Command show all
Defined in:
lib/bones/app/unfreeze_command.rb

Instance Attribute Summary

Attributes inherited from Command

#options

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



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bones/app/unfreeze_command.rb', line 26

def parse( args )
  std_opts = standard_options

  opts = OptionParser.new
  opts.banner = 'Usage: bones unfreeze [skeleton_name]'

  opts.separator ''
  opts.separator "  Removes the named skeleton from the '~/.mrbones/' folder. If a name is"
  opts.separator "  not given then the default skeleton is removed."

  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
  options[:name] = args.empty? ? 'data' : args.join('_')
  options[:output_dir] = File.join(mrbones_dir, name)
end

#run(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bones/app/unfreeze_command.rb', line 7

def run( args )
  parse args

  fm = FileManager.new(
    :source => repository || ::Bones.path('data'),
    :destination => output_dir,
    :stdout => @out,
    :stderr => @err,
    :verbose => verbose?
  )

  if fm.archive_destination
    @out.puts "Project skeleton #{name.inspect} has been unfrozen"
  else
    @out.puts "Project skeleton #{name.inspect} is not frozen " <<
              "(no action taken)"
  end
end