Class: EacRubyUtils::Gem

Inherits:
Object show all
Defined in:
lib/eac_ruby_utils/gem.rb,
lib/eac_ruby_utils/gem/test.rb,
lib/eac_ruby_utils/gem/test_all.rb,
lib/eac_ruby_utils/gem/rspec_test.rb,
lib/eac_ruby_utils/gem/minitest_test.rb

Defined Under Namespace

Classes: MinitestTest, RspecTest, Test, TestAll

Instance Method Summary collapse

Instance Method Details

#bundle(*args) ⇒ Object



19
20
21
22
23
# File 'lib/eac_ruby_utils/gem.rb', line 19

def bundle(*args)
  ::EacRubyUtils::Envs.local.command('bundle', *args)
                      .envvar('BUNDLE_GEMFILE', gemfile_path)
                      .chdir(root)
end

#gemfile_lock_contentObject



29
30
31
# File 'lib/eac_ruby_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_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

#to_sObject



15
16
17
# File 'lib/eac_ruby_utils/gem.rb', line 15

def to_s
  root.basename.to_s
end