Class: GemfileLocker::Locker
- Inherits:
-
GemfileProcessor
- Object
- GemfileProcessor
- GemfileLocker::Locker
- Defined in:
- lib/gemfile_locker/locker.rb
Constant Summary collapse
- SEGMENTS_COUNT =
{ major: 1, minor: 2, patch: 3, full: 100, }.freeze
Instance Attribute Summary collapse
-
#lockfile ⇒ Object
readonly
Returns the value of attribute lockfile.
Attributes inherited from GemfileProcessor
Instance Method Summary collapse
- #bundler_specs ⇒ Object
-
#initialize(lockfile, *args) ⇒ Locker
constructor
A new instance of Locker.
- #process_gem(gem_entry) ⇒ Object
- #skip_gem?(gem_entry) ⇒ Boolean
Methods inherited from GemfileProcessor
Constructor Details
#initialize(lockfile, *args) ⇒ Locker
Returns a new instance of Locker.
14 15 16 17 |
# File 'lib/gemfile_locker/locker.rb', line 14 def initialize(lockfile, *args) @lockfile = lockfile super(*args) end |
Instance Attribute Details
#lockfile ⇒ Object (readonly)
Returns the value of attribute lockfile.
12 13 14 |
# File 'lib/gemfile_locker/locker.rb', line 12 def lockfile @lockfile end |
Instance Method Details
#bundler_specs ⇒ Object
19 20 21 |
# File 'lib/gemfile_locker/locker.rb', line 19 def bundler_specs @bundler_specs ||= Bundler::LockfileParser.new(lockfile).specs end |
#process_gem(gem_entry) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/gemfile_locker/locker.rb', line 23 def process_gem(gem_entry) name = gem_entry.name spec = bundler_specs.find { |x| x.name == name } return unless spec gem_entry.lock(version: prepare_version(spec.version), git_ref: prepare_git_ref(spec)) end |
#skip_gem?(gem_entry) ⇒ Boolean
30 31 32 |
# File 'lib/gemfile_locker/locker.rb', line 30 def skip_gem?(gem_entry) super || gem_entry.locked? && ![:force] end |