Class: KeepUp::Bundle
- Inherits:
-
Object
- Object
- KeepUp::Bundle
- Defined in:
- lib/keep_up/bundle.rb
Overview
A Gemfile with its current set of locked dependencies.
Constant Summary collapse
- OUTDATED_MATCHER =
/([^ ]*) \(newest ([^,]*), installed ([^,]*)(?:, requested (.*))?\)/- UPDATE_MATCHER =
/(?:Using|Installing|Fetching) ([^ ]*) ([^ ]*)(?: \(was (.*)\))?/
Instance Method Summary collapse
- #check? ⇒ Boolean
-
#initialize(runner:, local:) ⇒ Bundle
constructor
A new instance of Bundle.
- #outdated_dependencies ⇒ Object
- #update_dependency(dependency) ⇒ Object
Constructor Details
#initialize(runner:, local:) ⇒ Bundle
Returns a new instance of Bundle.
15 16 17 18 |
# File 'lib/keep_up/bundle.rb', line 15 def initialize(runner:, local:) @runner = runner @local = local end |
Instance Method Details
#check? ⇒ Boolean
31 32 33 34 |
# File 'lib/keep_up/bundle.rb', line 31 def check? _, status = @runner.run2 "bundle check" status == 0 end |
#outdated_dependencies ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/keep_up/bundle.rb', line 20 def outdated_dependencies @outdated_dependencies ||= begin command = "bundle outdated --parseable#{" --local" if @local}" lines = run_filtered command, OUTDATED_MATCHER lines.map do |name, newest, version, requirement| build_dependency(name, newest, version, requirement) end end end |
#update_dependency(dependency) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/keep_up/bundle.rb', line 36 def update_dependency(dependency) specification = updated_specification_for(dependency) spec_update = find_specification_update(specification) spec_result = update_gemspec_contents(spec_update) || update_gemfile_contents(spec_update) lock_result = update_lockfile(specification, dependency.locked_version) [spec_result, lock_result] end |