Class: Pik::Tags

Inherits:
Command show all
Defined in:
lib/pik/commands/tag_command.rb

Instance Attribute Summary

Attributes inherited from Command

#config, #options, #output, #version

Instance Method Summary collapse

Methods inherited from Command

#add_sigint_handler, aka, choose_from, clean_gem_batch, #close, cmd_name, #command_options, #create, #current_gem_bin_path, #current_version?, #default_gem_home, #delete_old_pik_batches, description, #editors, #find_config_from_path, #get_version, hl, inherited, #initialize, it, names, summary

Constructor Details

This class inherits a constructor from Pik::Command

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pik/commands/tag_command.rb', line 7

def execute
  config.global[:tags] ||= Hash.new{|h,k| h[k] = [] }
  @tag_config = config.dup
  @tag_config.clear
  tags = @args.shift.split(',')
  tags.each do |tag|
    versions = config.global[:tags][tag]
    raise "Tag '#{tag}' unknown" unless versions
    versions.each{|version| @tag_config[version] = config[version] }
  end
  command = Commands.find(@args.shift)
  raise "The command '#{args.join(' ')}' is unknown." unless command
  
  cmd = command.new(@args, @tag_config)
  cmd.execute
  
rescue QuitError
  puts "\nQuitting..."
rescue => e
  puts "\nThere was an error"
  puts " Error: #{e.message}\n\n"
  puts e.backtrace.map{|m| "  in: #{m}" }
ensure
  cmd.close if cmd
end

#parse_optionsObject



33
34
# File 'lib/pik/commands/tag_command.rb', line 33

def parse_options
end