summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-09-12 10:00:26 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-09-12 10:00:26 -0700
commit996379d5e73ad97f3b762cc66a9153887ac66186 (patch)
tree328f8a83784a40bfaf179c896429942b4a951144
parentf73df93a517c35719e3ba76a1311cb8daf8437e7 (diff)
downloadchef-996379d5e73ad97f3b762cc66a9153887ac66186.tar.gz
update some comments for current thoughts
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index 4b73f47ed3..4810728524 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -311,18 +311,19 @@ class Chef
#
# This MUST have 'equality' semantics -- the exact thing matches the exact thing.
#
- # The current_version should probably be dropped out of the method signature, it should
- # always be the first argument.
- #
# The name is not just bad, but i find it completely misleading, consider:
#
# target_version_already_installed?(current_version, new_version)
# target_version_already_installed?(current_version, candidate_version)
#
- # which of those is the 'target_version'? i'd say the new_version and i'm confused when
+ # Which of those is the 'target_version'? I'd say the new_version and I'm confused when
# i see it called with the candidate_version.
#
- # `current_version_equals?(version)` would be a better name
+ # `version_equals?(v1, v2)` would be a better name.
+ #
+ # Note that most likely we need a spaceship operator on versions that subclasses can implement
+ # and we should have `version_compare(v1, v2)` that returns `v1 <=> v2`.
+ #
def target_version_already_installed?(current_version, target_version)
return false unless current_version && target_version
current_version == target_version
@@ -333,10 +334,8 @@ class Chef
#
# Subclasses MAY override this to provide fuzzy matching on the resource ('>=' and '~>' stuff)
#
- # This should only ever be offered the same arguments (so they should most likely be
- # removed from the method signature).
+ # `version_satisfied_by?(version, constraint)` might be a better name to make this generic.
#
- # `new_version_satisfied?()` might be a better name
def version_requirement_satisfied?(current_version, new_version)
target_version_already_installed?(current_version, new_version)
end