Class: MultiRepo::Service::RubygemsStub
- Inherits:
-
Object
- Object
- MultiRepo::Service::RubygemsStub
- Defined in:
- lib/multi_repo/service/rubygems_stub.rb
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#owners ⇒ Object
readonly
Returns the value of attribute owners.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(repo, owners: [], dry_run: false, **_) ⇒ RubygemsStub
constructor
A new instance of RubygemsStub.
- #run ⇒ Object
Constructor Details
#initialize(repo, owners: [], dry_run: false, **_) ⇒ RubygemsStub
Returns a new instance of RubygemsStub.
5 6 7 8 9 |
# File 'lib/multi_repo/service/rubygems_stub.rb', line 5 def initialize(repo, owners: [], dry_run: false, **_) @repo = repo @owners = owners @dry_run = dry_run end |
Instance Attribute Details
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
3 4 5 |
# File 'lib/multi_repo/service/rubygems_stub.rb', line 3 def dry_run @dry_run end |
#owners ⇒ Object (readonly)
Returns the value of attribute owners.
3 4 5 |
# File 'lib/multi_repo/service/rubygems_stub.rb', line 3 def owners @owners end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
3 4 5 |
# File 'lib/multi_repo/service/rubygems_stub.rb', line 3 def repo @repo end |
Instance Method Details
#run ⇒ Object
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 37 38 |
# File 'lib/multi_repo/service/rubygems_stub.rb', line 11 def run if stub_exists? puts "A stub gem for #{repo.inspect} already exists." return end if gem_exists? puts "A gem for #{repo.inspect} already exists with the following versions:" puts " #{gem_versions}" puts loop do print "Would you still like to create a stub? (y/N) " answer = gets.chomp.downcase[0] || "n" break if answer == "y" return if answer == "n" end puts end Dir.mktmpdir do |dir| package = create_gem(dir) push_gem(package) owners.each do |o| set_gem_owner(o) end end end |