Class: BundleSafeUpdate::LockfileParser
- Inherits:
-
Object
- Object
- BundleSafeUpdate::LockfileParser
- Defined in:
- lib/bundle_safe_update/lockfile_parser.rb
Constant Summary collapse
- LOCKFILE_NAME =
'Gemfile.lock'- GEM_SECTION_START =
/^GEM$/- SECTION_HEADER =
/^[A-Z]+$/- REMOTE_LINE =
/^\s+remote:\s+(.+)$/- GEM_LINE =
/^\s{4}(\S+)\s+\(/
Instance Method Summary collapse
- #gem_sources ⇒ Object
-
#initialize(lockfile_path: nil) ⇒ LockfileParser
constructor
A new instance of LockfileParser.
- #source_for(gem_name) ⇒ Object
Constructor Details
#initialize(lockfile_path: nil) ⇒ LockfileParser
Returns a new instance of LockfileParser.
11 12 13 |
# File 'lib/bundle_safe_update/lockfile_parser.rb', line 11 def initialize(lockfile_path: nil) @lockfile_path = lockfile_path || File.join(Dir.pwd, LOCKFILE_NAME) end |
Instance Method Details
#gem_sources ⇒ Object
15 16 17 18 19 |
# File 'lib/bundle_safe_update/lockfile_parser.rb', line 15 def gem_sources return @gem_sources if defined?(@gem_sources) @gem_sources = parse_lockfile end |
#source_for(gem_name) ⇒ Object
21 22 23 |
# File 'lib/bundle_safe_update/lockfile_parser.rb', line 21 def source_for(gem_name) gem_sources[gem_name] end |