Module: PDK::Util::Bundler
- Defined in:
- lib/pdk/util/bundler.rb
Defined Under Namespace
Classes: BundleHelper
Class Method Summary collapse
- .already_bundled?(gemfile) ⇒ Boolean
- .ensure_binstubs!(*gems) ⇒ Object
- .ensure_bundle! ⇒ Object
- .mark_as_bundled!(gemfile) ⇒ Object
Class Method Details
.already_bundled?(gemfile) ⇒ Boolean
39 40 41 |
# File 'lib/pdk/util/bundler.rb', line 39 def self.already_bundled?(gemfile) !(@bundled ||= {})[gemfile].nil? end |
.ensure_binstubs!(*gems) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/pdk/util/bundler.rb', line 47 def self.ensure_binstubs!(*gems) bundle = BundleHelper.new unless bundle.binstubs!(gems) # rubocop:disable Style/GuardClause raise PDK::CLI::FatalError, _('Unable to install requested binstubs.') end end |
.ensure_bundle! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pdk/util/bundler.rb', line 11 def self.ensure_bundle! bundle = BundleHelper.new if already_bundled?(bundle.gemfile) PDK.logger.debug(_('Bundle has already been installed, skipping run')) return end unless bundle.gemfile? PDK.logger.debug(_("No Gemfile found in '%{cwd}', skipping bundler management") % { cwd: Dir.pwd }) return end unless bundle.locked? unless bundle.lock! raise PDK::CLI::FatalError, _('Unable to resolve Gemfile dependencies.') end end unless bundle.installed? unless bundle.install! raise PDK::CLI::FatalError, _('Unable to install missing Gemfile dependencies.') end end mark_as_bundled!(bundle.gemfile) end |
.mark_as_bundled!(gemfile) ⇒ Object
43 44 45 |
# File 'lib/pdk/util/bundler.rb', line 43 def self.mark_as_bundled!(gemfile) (@bundled ||= {})[gemfile] = true end |