Class: Pik::Config
- Includes:
- ConfigFileEditor
- Defined in:
- lib/pik/commands/config_command.rb
Instance Attribute Summary collapse
-
#global ⇒ Object
Returns the value of attribute global.
Attributes inherited from Command
#config, #debug, #options, #output, #version
Instance Method Summary collapse
Methods included from ConfigFileEditor
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
#global ⇒ Object
Returns the value of attribute global.
8 9 10 |
# File 'lib/pik/commands/config_command.rb', line 8 def global @global end |
Instance Method Details
#command_options ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/pik/commands/config_command.rb', line 64 def super sep =<<SEP If no options are given, the current and global configuration is displayed. Configuration options are: rubyopt on = -rubygems, off = blank gem_home Location of current version's GEM_HOME env. var. downloads Location where 'pik install' will download new versions installs Location where 'pik install' will install new versions SEP .separator sep end |
#execute ⇒ Object
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 |
#list ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pik/commands/config_command.rb', line 38 def list version = find_config_from_path puts "** CURRENT CONFIGURATION **" puts puts version + ' *' config[version].each{|k,v| puts " %s: %s" % [k, v]} puts puts "** GLOBAL CONFIGURATION **" puts cfg = stringify(config.global.dup) puts cfg.to_yaml.gsub(/"/, '') end |