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'
- GEMFILE_SOURCE_PARSER =
/^\s*source\s+['"]([^'"]+)['"]$/.to_parser do |m| ::Addressable::URI.parse(m[1]) end
Instance Method Summary collapse
- #bundle(*args) ⇒ Avm::EacRubyBase1::Sources::Base::BundleCommand
- #bundle_update ⇒ Avm::EacRubyBase1::Sources::BundleUpdate
- #configured_gemfile_path ⇒ String
- #default_gemfile_path ⇒ String
- #gemfile_lock_content ⇒ Bundler::LockfileParser
- #gemfile_lock_gem_version(gem_name) ⇒ Object
- #gemfile_lock_path ⇒ Pathname
- #gemfile_path ⇒ Pathname
- #gemfile_source ⇒ Addressable::URI
Instance Method Details
#bundle(*args) ⇒ Avm::EacRubyBase1::Sources::Base::BundleCommand
15 16 17 18 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 15 def bundle(*args) ::Avm::EacRubyBase1::Sources::Base::BundleCommand.new(self, %w[bundle] + args) .envvar_gemfile end |
#bundle_update ⇒ Avm::EacRubyBase1::Sources::BundleUpdate
21 22 23 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 21 def bundle_update ::Avm::EacRubyBase1::Sources::BundleUpdate.new(self) end |
#configured_gemfile_path ⇒ String
26 27 28 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 26 def configured_gemfile_path configuration_entry(CONFIGURED_GEMFILE_PATH_ENTRY_KEY).value end |
#default_gemfile_path ⇒ String
31 32 33 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 31 def default_gemfile_path DEFAULT_GEMFILE_PATH end |
#gemfile_lock_content ⇒ Bundler::LockfileParser
36 37 38 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 36 def gemfile_lock_content ::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path)) end |
#gemfile_lock_gem_version(gem_name) ⇒ Object
40 41 42 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 40 def gemfile_lock_gem_version(gem_name) gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version) end |
#gemfile_lock_path ⇒ Pathname
45 46 47 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 45 def gemfile_lock_path gemfile_path.basename_sub { |b| "#{b}.lock" } end |
#gemfile_path ⇒ Pathname
50 51 52 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 50 def gemfile_path path.join(configured_gemfile_path || default_gemfile_path) end |
#gemfile_source ⇒ Addressable::URI
55 56 57 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 55 def gemfile_source GEMFILE_SOURCE_PARSER.parse!(gemfile_path.read) end |