Class: Gem::BuildTask
- Inherits:
-
Anvil::Task
- Object
- Anvil::Task
- Gem::BuildTask
- Defined in:
- lib/tasks/gem/build_task.rb
Instance Attribute Summary collapse
-
#gemspec_file ⇒ Object
readonly
Returns the value of attribute gemspec_file.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #build_gem(gemspec_file) ⇒ Object
- #extract_gem_file(output) ⇒ Object
-
#initialize(gemspec_file, options = {}) ⇒ BuildTask
constructor
A new instance of BuildTask.
- #install? ⇒ Boolean
- #task ⇒ Object
Constructor Details
#initialize(gemspec_file, options = {}) ⇒ BuildTask
Returns a new instance of BuildTask.
18 19 20 21 |
# File 'lib/tasks/gem/build_task.rb', line 18 def initialize(gemspec_file, = {}) @gemspec_file = gemspec_file @options = end |
Instance Attribute Details
#gemspec_file ⇒ Object (readonly)
Returns the value of attribute gemspec_file.
16 17 18 |
# File 'lib/tasks/gem/build_task.rb', line 16 def gemspec_file @gemspec_file end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/tasks/gem/build_task.rb', line 16 def @options end |
Instance Method Details
#build_gem(gemspec_file) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/tasks/gem/build_task.rb', line 34 def build_gem(gemspec_file) rubygems_output = Anvil::Rubygems.build(gemspec_file) gem_file = extract_gem_file(rubygems_output) FileUtils.mkdir_p('pkg') FileUtils.move(gem_file, 'pkg') File.("pkg/#{gem_file}") end |
#extract_gem_file(output) ⇒ Object
44 45 46 |
# File 'lib/tasks/gem/build_task.rb', line 44 def extract_gem_file(output) output.match(/File: (.*)$/)[1] end |
#install? ⇒ Boolean
48 49 50 |
# File 'lib/tasks/gem/build_task.rb', line 48 def install? .fetch(:install, true) end |