lib/kapost/bootstrapper.rb in kapost-bootstrapper-1.0.1 vs lib/kapost/bootstrapper.rb in kapost-bootstrapper-1.0.2

- old
+ new

@@ -89,11 +89,20 @@ status.success? end def right_version?(command, expected_version) version, status = cli.capture2e "#{command} --version" - status.success? && version.include?(expected_version) && version + if expected_version[0] == '^' + next_major = (expected_version[1].to_i + 1).to_s + Gem::Version.new(version) >= Gem::Version.new(expected_version[1..-1]) && Gem::Version.new(version) < Gem::Version.new(next_major) + elsif expected_version[0] == "=" + Gem::Version.new(version) == Gem::Version.new(expected_version[1..-1]) + else + local_version = Semantic::Version.new(version) + local_version.satisfies?(expected_version) + end end + def say(message) if block_given? # If we're given a block print a label with a success indicator printer.print message.to_s