Class: EacRubyGemsUtils::Gem
- Inherits:
-
Object
- Object
- EacRubyGemsUtils::Gem
- Defined in:
- lib/eac_ruby_gems_utils/gem.rb,
lib/eac_ruby_gems_utils/gem/command.rb
Defined Under Namespace
Classes: Command
Constant Summary collapse
- GEMSPEC_EXTNAME =
'.gemspec'
Instance Method Summary collapse
- #bundle(*args) ⇒ Object
- #gemfile_lock_content ⇒ Object
- #gemfile_lock_gem_version(gem_name) ⇒ Object
- #name ⇒ Object
- #name_by_gemspec ⇒ Object
- #name_by_path ⇒ Object
- #rake(*args) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#bundle(*args) ⇒ Object
21 22 23 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 21 def bundle(*args) ::EacRubyGemsUtils::Gem::Command.new(self, %w[bundle] + args).envvar_gemfile end |
#gemfile_lock_content ⇒ Object
29 30 31 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 29 def gemfile_lock_content ::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path)) end |
#gemfile_lock_gem_version(gem_name) ⇒ Object
25 26 27 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 25 def gemfile_lock_gem_version(gem_name) gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version) end |
#name ⇒ Object
33 34 35 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 33 def name name_by_gemspec || name_by_path end |
#name_by_gemspec ⇒ Object
37 38 39 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 37 def name_by_gemspec gemspec_path.if_present { |v| v.basename(GEMSPEC_EXTNAME).to_path } end |
#name_by_path ⇒ Object
41 42 43 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 41 def name_by_path root.basename.to_s end |
#rake(*args) ⇒ Object
45 46 47 48 49 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 45 def rake(*args) raise "File \"#{rakefile_path}\" does not exist" unless rakefile_path.exist? bundle('exec', 'rake', '--rakefile', rakefile_path, *args) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/eac_ruby_gems_utils/gem.rb', line 17 def to_s name end |