Class: Pik::Implode

Inherits:
Command show all
Defined in:
lib/pik/commands/implode_command.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#config, #debug, #options, #output, #version

Instance Method Summary collapse

Methods inherited from Command

#actual_gem_home, #add_sigint_handler, aka, choose_from, #close, cmd_name, #cmd_name, #create, #current_gem_bin_path, #current_version?, #default_gem_home, #delete_old_pik_script, description, #editors, #find_config_from_path, #gem_path, #get_version, hl, inherited, #initialize, it, names, #parse_options, #pik_version, #sh, summary

Constructor Details

This class inherits a constructor from Pik::Command

Instance Attribute Details

#forceObject (readonly)

Returns the value of attribute force.



8
9
10
# File 'lib/pik/commands/implode_command.rb', line 8

def force
  @force
end

Instance Method Details

#command_optionsObject



18
19
20
21
22
23
# File 'lib/pik/commands/implode_command.rb', line 18

def command_options
  super  
  options.on("--force", "-f", "Force") do |value|
    @force = value
  end 
end

#executeObject



10
11
12
13
14
15
16
# File 'lib/pik/commands/implode_command.rb', line 10

def execute
  msg =  "Are you sure you want pik to implode? "
  msg << "This will remove '#{PIK_HOME.to_ruby}'."
  if @force || @hl.agree(msg){|answer| answer.default = 'yes' }
    PIK_HOME.rmtree
  end
end