Module: Avm::EacRubyBase1::Sources::Base::Bundler

Defined in:
lib/avm/eac_ruby_base1/sources/base/bundler.rb

Constant Summary collapse

CONFIGURED_GEMFILE_PATH_ENTRY_KEY =
'ruby.gemfile_path'
DEFAULT_GEMFILE_PATH =
'Gemfile'

Instance Method Summary collapse

Instance Method Details

#bundle(*args) ⇒ Avm::EacRubyBase1::Sources::Base::BundleCommand



17
18
19
20
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 17

def bundle(*args)
  ::Avm::EacRubyBase1::Sources::Base::BundleCommand.new(self, %w[bundle] + args)
    .envvar_gemfile
end

#bundle_updateAvm::EacRubyBase1::Sources::BundleUpdate



23
24
25
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 23

def bundle_update
  ::Avm::EacRubyBase1::Sources::BundleUpdate.new(self)
end

#configured_gemfile_pathString

Returns:

  • (String)


28
29
30
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 28

def configured_gemfile_path
  configuration_entry(CONFIGURED_GEMFILE_PATH_ENTRY_KEY).value
end

#default_gemfile_pathString

Returns:

  • (String)


33
34
35
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 33

def default_gemfile_path
  DEFAULT_GEMFILE_PATH
end

#gemfile_lock_contentBundler::LockfileParser

Returns:

  • (Bundler::LockfileParser)


38
39
40
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 38

def gemfile_lock_content
  ::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path))
end

#gemfile_lock_gem_version(gem_name) ⇒ Object



42
43
44
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 42

def gemfile_lock_gem_version(gem_name)
  gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version)
end

#gemfile_lock_pathPathname

Returns:

  • (Pathname)


47
48
49
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 47

def gemfile_lock_path
  gemfile_path.basename_sub { |b| "#{b}.lock" }
end

#gemfile_pathPathname

Returns:

  • (Pathname)


52
53
54
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 52

def gemfile_path
  path.join(configured_gemfile_path || default_gemfile_path)
end