Class: Gemkeeper::GemBuilder
- Inherits:
-
Object
- Object
- Gemkeeper::GemBuilder
- Defined in:
- lib/gemkeeper/gem_builder.rb
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#repo_path ⇒ Object
readonly
Returns the value of attribute repo_path.
Instance Method Summary collapse
- #build ⇒ Object
- #gem_name ⇒ Object
-
#initialize(repo_path, output_dir = nil) ⇒ GemBuilder
constructor
A new instance of GemBuilder.
Constructor Details
#initialize(repo_path, output_dir = nil) ⇒ GemBuilder
Returns a new instance of GemBuilder.
10 11 12 13 |
# File 'lib/gemkeeper/gem_builder.rb', line 10 def initialize(repo_path, output_dir = nil) @repo_path = repo_path @output_dir = output_dir end |
Instance Attribute Details
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
8 9 10 |
# File 'lib/gemkeeper/gem_builder.rb', line 8 def output_dir @output_dir end |
#repo_path ⇒ Object (readonly)
Returns the value of attribute repo_path.
8 9 10 |
# File 'lib/gemkeeper/gem_builder.rb', line 8 def repo_path @repo_path end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gemkeeper/gem_builder.rb', line 15 def build gemspec_path = find_gemspec raise GemspecNotFoundError, "No gemspec found in #{@repo_path}" unless gemspec_path Dir.chdir(@repo_path) do gem_file = run_gem_build(gemspec_path) gem_path = File.join(@repo_path, gem_file) if @output_dir FileUtils.mkdir_p(@output_dir) dest_path = File.join(@output_dir, gem_file) FileUtils.mv(gem_path, dest_path) dest_path else gem_path end end end |
#gem_name ⇒ Object
34 35 36 37 38 39 |
# File 'lib/gemkeeper/gem_builder.rb', line 34 def gem_name gemspec_path = find_gemspec return nil unless gemspec_path File.basename(gemspec_path, ".gemspec") end |