Class: Bones::App::Unfreeze

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

Constant Summary

Constants inherited from Command

Command::DEFAULT_SKELETON

Constants included from Colors

Colors::COLORS

Instance Attribute Summary

Attributes inherited from Command

#config, #stderr, #stdout

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#in_directory, inherited, #initialize, #mrbones_dir, #name, #output_dir, #repository, #skeleton_dir, #standard_options, standard_options, #verbose?

Methods included from Colors

#colorize, #colorize?

Constructor Details

This class inherits a constructor from Bones::App::Command

Class Method Details

.initialize_unfreezeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bones/app/unfreeze.rb', line 5

def self.initialize_unfreeze
  synopsis 'bones unfreeze [skeleton_name]'

  summary 'remove a skeleton from ~/.mrbones/'

  description <<-__
Removes the named skeleton from the '~/.mrbones/' folder. If a name is
not given then the default skeleton is removed.
  __

  option(standard_options[:verbose])
  option(standard_options[:colorize])
end

Instance Method Details

#parse(args) ⇒ Object



36
37
38
39
40
41
# File 'lib/bones/app/unfreeze.rb', line 36

def parse( args )
  opts = super args
  config[:name] = args.empty? ? DEFAULT_SKELETON : args.join('_')
  config[:output_dir] = File.join(mrbones_dir, name)
  opts
end

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bones/app/unfreeze.rb', line 19

def run
  fm = FileManager.new(
    :source => repository || ::Bones.path(DEFAULT_SKELETON),
    :destination => output_dir,
    :stdout => stdout,
    :stderr => stderr,
    :verbose => verbose?
  )

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