Method: Pik::Config#execute

Defined in:
lib/pik/commands/config_command.rb

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pik/commands/config_command.rb', line 10

def execute
  return list if @args.empty?
  item, value = @args.shift.downcase.split('=')
  case item
  when 'rubyopt'
    case value
    when 'on'  then set('RUBYOPT' => '-rubygems')
    when 'off' then set('RUBYOPT' => nil)
    end
  when 'gem_home'
    config[find_config_from_path][:gem_home] = if @args.include?('default') 
      Pathname(default_gem_home)
    else
      Pathname(value)
    end
  when 'downloads', 'download_dir'
    config.global[:download_dir] = Pathname.new(value)
  when 'installs', 'install_dir'
    config.global[:install_dir] = Pathname.new(value)
  when 'devkit', 'devkit_dir'
    config.global[:devkit] = Pathname.new(value)
  when 'list'
    list
  else
    puts "Unknown configuration option"
  end
end