Class: StrongVersions::Dependencies
- Inherits:
-
Object
- Object
- StrongVersions::Dependencies
- Defined in:
- lib/strong_versions/dependencies.rb
Instance Method Summary collapse
-
#initialize(dependencies) ⇒ Dependencies
constructor
A new instance of Dependencies.
- #validate(options = {}) ⇒ Object
- #validate!(options = {}) ⇒ Object
Constructor Details
#initialize(dependencies) ⇒ Dependencies
Returns a new instance of Dependencies.
5 6 7 8 9 10 11 |
# File 'lib/strong_versions/dependencies.rb', line 5 def initialize(dependencies) @dependencies = dependencies.map do |raw_dependency| Dependency.new(raw_dependency) end @invalid_gems = [] @terminal = Terminal.new end |
Instance Method Details
#validate(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/strong_versions/dependencies.rb', line 27 def validate( = {}) unsafe_autocorrect_error if [:auto_correct] @dependencies.each do |dependency| next if .fetch(:except, []).include?(dependency.name) next if dependency.valid? @invalid_gems.push(dependency) unless dependency.valid? end @invalid_gems.empty? end |
#validate!(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/strong_versions/dependencies.rb', line 13 def validate!( = {}) auto_correct = .delete(:auto_correct) { false } if validate() summary return true end return update_gemfile if auto_correct raise_or_warn(.fetch(:on_failure, 'raise')) summary false end |