Class: Pik::Default

Inherits:
Command show all
Includes:
ScriptFileEditor
Defined in:
lib/pik/commands/default_command.rb

Instance Attribute Summary collapse

Attributes included from ScriptFileEditor

#script

Attributes inherited from Command

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

Instance Method Summary collapse

Methods included from ScriptFileEditor

#echo_ruby_version, #initialize, #set, #switch_gem_home_to, #switch_path_to

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

Instance Attribute Details

#verboseObject

Returns the value of attribute verbose.



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

def verbose
  @verbose
end

Instance Method Details

#command_optionsObject



22
23
24
25
26
27
28
29
# File 'lib/pik/commands/default_command.rb', line 22

def command_options
  super
  @options.on("--verbose", "-v",
     "Verbose output"
     ) do |value|
    @verbose = value
  end
end

#executeObject



12
13
14
15
16
17
18
19
20
# File 'lib/pik/commands/default_command.rb', line 12

def execute
  sys = WindowsEnv.system
  usr = WindowsEnv.user
  new_path = [sys['PATH'],usr['PATH']].compact.join(';')
  @script.set('PATH' => SearchPath.new(new_path) )
  @script.set('GEM_PATH' => usr['GEM_PATH'] || sys['GEM_PATH'] )
  @script.set('GEM_HOME' => usr['GEM_HOME'] || sys['GEM_HOME'] )
  echo_ruby_version(Which::Ruby.find(new_path)) if verbose
end