Class: Pik::List

Inherits:
Command show all
Defined in:
lib/pik/commands/list_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, 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

Constructor Details

This class inherits a constructor from Pik::Command

Instance Attribute Details

#remoteObject (readonly)

Returns the value of attribute remote.



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

def remote
  @remote
end

#verboseObject (readonly)

Returns the value of attribute verbose.



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

def verbose
  @verbose
end

Instance Method Details

#executeObject



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

def execute 
  if remote
    remote_list
  else
    list
  end
end

#listObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pik/commands/list_command.rb', line 22

def list
  current_path = Which::Ruby.find
  config.sort.each do |name, conf|
    name += ' *' if current_path == conf[:path]
    puts name
    if verbose
      conf.each{|k,v| puts "     %s: %s" % [k, v]} 
      puts
    end
  end
end

#remote_listObject



18
19
20
# File 'lib/pik/commands/list_command.rb', line 18

def remote_list
  puts Implementations.list.to_yaml
end