Class: Stickler::Client::Unyank
Instance Attribute Summary
#argv, #sources
Class Method Summary
collapse
Instance Method Summary
collapse
config, #initialize, #remote_repo_for
Class Method Details
.banner ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'lib/stickler/client/unyank.rb', line 4
def self.banner
<<-_
Restore a yanked gem to the gemserver's index.
Usage: stickler unyank [options] --gem-version x.y.z gem
Options:
_
end
|
Instance Method Details
#parse(argv) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/stickler/client/unyank.rb', line 23
def parse( argv )
gem_name = nil
opts = super( argv ) do |p,o|
raise Trollop::CommandlineError, "At least one gem is required to unyank" if p.leftovers.empty?
gem_name = p.leftovers.shift
end
opts[:gem_name] = gem_name
return opts
end
|
#parser ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/stickler/client/unyank.rb', line 14
def parser
unless @parser then
@parser = super
@parser.opt( :gem_version, "The version of the gem to unyank (required)", :type => :string, :required => true )
@parser.opt( :platform, "The platform of the gem to unyank", :type => :string, :default => ::Gem::Platform::RUBY )
end
return @parser
end
|
#run ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/stickler/client/unyank.rb', line 33
def run
opts = parse( self.argv )
repo = remote_repo_for( opts )
spec = Stickler::SpecLite.new( opts[:gem_name], opts[:gem_version], opts[:platform] )
$stdout.write "Unyanking gem #{spec.full_name} from #{repo.uri} : "
$stdout.flush
if spec = repo.unyank( spec ) then
$stdout.puts "OK"
else
$stdout.puts "FAILURE"
end
rescue Stickler::Repository::Error => e
$stdout.puts "ERROR: #{e.message}"
end
|