Class: Bundler::GemHelper
- Inherits:
-
Object
- Object
- Bundler::GemHelper
- Defined in:
- ext/gem_rake.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#spec_path ⇒ Object
readonly
Returns the value of attribute spec_path.
Class Method Summary collapse
Instance Method Summary collapse
- #build_gem ⇒ Object
-
#initialize(base, name = nil) ⇒ GemHelper
constructor
A new instance of GemHelper.
- #install ⇒ Object
- #install_gem ⇒ Object
- #push_gem ⇒ Object
Constructor Details
#initialize(base, name = nil) ⇒ GemHelper
Returns a new instance of GemHelper.
11 12 13 14 15 |
# File 'ext/gem_rake.rb', line 11 def initialize(base, name = nil) @base = base @name = name || interpolate_name @spec_path = File.join(@base, "#{@name}.gemspec") end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9 10 11 |
# File 'ext/gem_rake.rb', line 9 def base @base end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'ext/gem_rake.rb', line 9 def name @name end |
#spec_path ⇒ Object (readonly)
Returns the value of attribute spec_path.
9 10 11 |
# File 'ext/gem_rake.rb', line 9 def spec_path @spec_path end |
Class Method Details
Instance Method Details
#build_gem ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'ext/gem_rake.rb', line 34 def build_gem file_name = nil sh("gem build #{spec_path}") { file_name = File.basename(built_gem_path) FileUtils.mkdir_p(File.join(base, 'pkg')) FileUtils.mv(built_gem_path, 'pkg') } File.join(base, 'pkg', file_name) end |
#install ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'ext/gem_rake.rb', line 17 def install desc 'Build your gem into the pkg directory' task 'build' do build_gem end desc 'Install your gem into the pkg directory' task 'install' do install_gem end desc 'Push your gem to rubygems' task 'push' do push_gem end end |
#install_gem ⇒ Object
44 45 46 47 |
# File 'ext/gem_rake.rb', line 44 def install_gem built_gem_path = build_gem sh("gem install #{built_gem_path}") end |
#push_gem ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'ext/gem_rake.rb', line 49 def push_gem guard_clean guard_already_tagged tag_version { git_push rubygem_push(build_gem) } end |