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
21 22 23 24 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 21 def bundle(*args) ::Avm::EacRubyBase1::Sources::Base::BundleCommand.new(self, %w[bundle] + args) .envvar_gemfile end |
#bundle_update ⇒ Avm::EacRubyBase1::Sources::BundleUpdate
27 28 29 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 27 def bundle_update ::Avm::EacRubyBase1::Sources::BundleUpdate.new(self) end |
#configured_gemfile_path ⇒ String
32 33 34 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 32 def configured_gemfile_path configuration_entry(CONFIGURED_GEMFILE_PATH_ENTRY_KEY).value end |
#default_gemfile_path ⇒ String
37 38 39 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 37 def default_gemfile_path DEFAULT_GEMFILE_PATH end |
#gemfile_lock_content ⇒ Bundler::LockfileParser
42 43 44 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 42 def gemfile_lock_content ::Bundler::LockfileParser.new(::Bundler.read_file(gemfile_lock_path)) end |
#gemfile_lock_gem_version(gem_name) ⇒ Object
46 47 48 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 46 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
51 52 53 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 51 def gemfile_lock_path gemfile_path.basename_sub { |b| "#{b}.lock" } end |
#gemfile_path ⇒ Pathname
56 57 58 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 56 def gemfile_path path.join(configured_gemfile_path || default_gemfile_path) end |
#gemfile_source ⇒ Addressable::URI
61 62 63 |
# File 'lib/avm/eac_ruby_base1/sources/base/bundler.rb', line 61 def gemfile_source GEMFILE_SOURCE_PARSER.parse!(gemfile_path.read) end |