Class: Tumbler::Gem
- Inherits:
-
Object
- Object
- Tumbler::Gem
- Defined in:
- lib/tumbler/gem.rb
Constant Summary
Constants included from Informer
Instance Attribute Summary
Attributes included from Runner
Instance Method Summary collapse
- #base ⇒ Object
- #build ⇒ Object
- #built_gem_base ⇒ Object
- #built_gem_path ⇒ Object
-
#initialize(manager) ⇒ Gem
constructor
A new instance of Gem.
- #install ⇒ Object
- #push ⇒ Object
- #spec_path ⇒ Object
Methods included from Informer
Methods included from Runner
Constructor Details
#initialize(manager) ⇒ Gem
Returns a new instance of Gem.
6 7 8 |
# File 'lib/tumbler/gem.rb', line 6 def initialize(manager) @manager = manager end |
Instance Method Details
#base ⇒ Object
10 11 12 |
# File 'lib/tumbler/gem.rb', line 10 def base @manager.base end |
#build ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/tumbler/gem.rb', line 40 def build inform "Building #{built_gem_path}" do sh("bundle exec gem build #{spec_path}") Dir.chdir(base) { FileUtils.mkdir_p('pkg') FileUtils.mv(built_gem_base, 'pkg') } end end |
#built_gem_base ⇒ Object
14 15 16 |
# File 'lib/tumbler/gem.rb', line 14 def built_gem_base "#{@manager.name}-#{@manager.version.to_s}.gem" end |
#built_gem_path ⇒ Object
18 19 20 |
# File 'lib/tumbler/gem.rb', line 18 def built_gem_path File.join('pkg', built_gem_base) end |
#install ⇒ Object
29 30 31 32 33 34 |
# File 'lib/tumbler/gem.rb', line 29 def install build inform "Installing #{built_gem_path}" do exec("gem install #{built_gem_path}") end end |
#push ⇒ Object
22 23 24 25 26 27 |
# File 'lib/tumbler/gem.rb', line 22 def push build inform "Pushing #{built_gem_path}" do sh("gem push #{built_gem_path}") end end |
#spec_path ⇒ Object
36 37 38 |
# File 'lib/tumbler/gem.rb', line 36 def spec_path "#{@manager.name}.gemspec" end |