Class: Pik::Default

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

Instance Attribute Summary collapse

Attributes included from BatchFileEditor

#batch

Attributes inherited from Command

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

Instance Method Summary collapse

Methods included from BatchFileEditor

#close, #echo_ruby_version, #echo_running_with_ruby_version, #initialize, #set, #switch_gem_home_to, #switch_path_to, #update_gem_batch

Methods inherited from Command

#actual_gem_home, #add_sigint_handler, aka, choose_from, clean_gem_batch, #close, cmd_name, #cmd_name, #create, #current_gem_bin_path, #current_version?, #default_gem_home, #delete_old_pik_batches, description, #editors, #find_config_from_path, #get_gem_home, #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(';')
  @batch.set('PATH' => new_path )
  @batch.set('GEM_PATH' => usr['GEM_PATH'] || sys['GEM_PATH'] )
  @batch.set('GEM_HOME' => usr['GEM_HOME'] || sys['GEM_HOME'] )
  echo_ruby_version(Which::Ruby.find(new_path)) if verbose
end