Class: NeetoCompliance::GemVersionVerifier
- Inherits:
-
Object
- Object
- NeetoCompliance::GemVersionVerifier
- Defined in:
- lib/neeto_compliance/verifiers/gem_version_verifier.rb
Instance Attribute Summary collapse
-
#current_version ⇒ Object
readonly
Returns the value of attribute current_version.
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#latest_version ⇒ Object
readonly
Returns the value of attribute latest_version.
Instance Method Summary collapse
- #app_name ⇒ Object
- #equal_app_and_gem_name? ⇒ Boolean
- #gem_not_installed? ⇒ Boolean
-
#initialize(current_version, latest_version, gem_name) ⇒ GemVersionVerifier
constructor
A new instance of GemVersionVerifier.
- #latest_version_installed? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(current_version, latest_version, gem_name) ⇒ GemVersionVerifier
Returns a new instance of GemVersionVerifier.
7 8 9 10 11 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 7 def initialize(current_version, latest_version, gem_name) @latest_version = latest_version @current_version = current_version @gem_name = gem_name end |
Instance Attribute Details
#current_version ⇒ Object (readonly)
Returns the value of attribute current_version.
5 6 7 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 5 def current_version @current_version end |
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
5 6 7 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 5 def gem_name @gem_name end |
#latest_version ⇒ Object (readonly)
Returns the value of attribute latest_version.
5 6 7 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 5 def latest_version @latest_version end |
Instance Method Details
#app_name ⇒ Object
29 30 31 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 29 def app_name @_app_name ||= `git config --get remote.origin.url`.split("/").last.strip.split(".git").first end |
#equal_app_and_gem_name? ⇒ Boolean
21 22 23 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 21 def equal_app_and_gem_name? app_name == gem_name end |
#gem_not_installed? ⇒ Boolean
13 14 15 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 13 def gem_not_installed? current_version.nil? end |
#latest_version_installed? ⇒ Boolean
17 18 19 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 17 def latest_version_installed? current_version == latest_version end |
#valid? ⇒ Boolean
25 26 27 |
# File 'lib/neeto_compliance/verifiers/gem_version_verifier.rb', line 25 def valid? equal_app_and_gem_name? || gem_not_installed? || latest_version_installed? end |