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
Constants inherited from GemfileProcessor
GemfileProcessor::GEM_LINE_REGEX, GemfileProcessor::GEM_MATCH_FIELDS
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(data) ⇒ Object
- #skip_gem?(data) ⇒ Boolean
Methods inherited from GemfileProcessor
#call, #process_gems, #set_gem_version
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(data) ⇒ Object
23 24 25 26 27 |
# File 'lib/gemfile_locker/locker.rb', line 23 def process_gem(data) name = data[:name] locked = bundler_specs.find { |x| x.name == name } locked && set_gem_version(data, prepare_version(locked.version)) end |
#skip_gem?(data) ⇒ Boolean
29 30 31 |
# File 'lib/gemfile_locker/locker.rb', line 29 def skip_gem?(data) super || data[:version] && ![:force] end |