lib/drg/tasks/active_pinner.rb in drg-0.9.4 vs lib/drg/tasks/active_pinner.rb in drg-0.9.5

- old
+ new

@@ -21,14 +21,11 @@ load_versions gems gems.each &method(:update) end end log %Q(Done) - if gemfile.saved_lines.any? - gemfile.write - log %Q(You may want run `bundle update`) - end + gemfile.write if gemfile.saved_lines.any? end # @note calls #latest_minor_version and #latest_patch_version def update(gem_name) spec = ::Bundler.locked_gems.specs.find { |spec| spec.name == gem_name } @@ -55,23 +52,24 @@ # @param [String] name of the gem # @param [String] current_version of the gem def latest_minor_version(name, current_version) new_versions(name, current_version).select { |version| segments = version.scan(/\d+/) - major_version = segments[0].to_i - minor_version = segments[1].to_i - minor_version > current_version.segments[1] && major_version == current_version.segments[0] + major = segments[0].to_i + minor = segments[1].to_i + minor > current_version.segments[1] && major == current_version.segments[0] }.first end # @param [String] name of the gem # @param [String] current_version of the gem def latest_patch_version(name, current_version) new_versions(name, current_version).select { |version| segments = version.scan(/\d+/) - patch_version = segments[-1].to_i - minor_version = segments[1].to_i - patch_version > current_version.segments[-1] && minor_version == current_version.segments[1] + major = segments[0].to_i + patch = segments[-1].to_i + minor = segments[1].to_i + patch > current_version.segments[-1] && minor == current_version.segments[1] && major == current_version.segments[0] }.first end # @param [String] name of the gem # @param [String] current_version of the gem