lib/keep_up/bundle.rb in keep_up-0.10.0 vs lib/keep_up/bundle.rb in keep_up-0.10.1
- old
+ new
@@ -35,20 +35,20 @@
def update_gemfile_contents(update)
update = find_specification_update(dependencies, update)
return unless update
- update_specification_contents(update, "Gemfile", GemfileFilter)
+ update if update_specification_contents(update, "Gemfile", GemfileFilter)
end
def update_gemspec_contents(update)
return unless gemspec_name
update = find_specification_update(dependencies, update)
return unless update
- update_specification_contents(update, gemspec_name, GemspecFilter)
+ update if update_specification_contents(update, gemspec_name, GemspecFilter)
end
# Update lockfile and return resulting spec, or false in case of failure
def update_lockfile(update)
update_name = update.name
@@ -109,10 +109,17 @@
current_dependency.generalize_specification(update)
end
def update_specification_contents(update, file, filter)
- File.write file, filter.apply(File.read(file), update)
+ contents = File.read(file)
+ updated_contents = filter.apply(contents, update)
+ if contents == updated_contents
+ false
+ else
+ File.write file, updated_contents
+ true
+ end
end
def gemspec_name
@gemspec_name ||= Dir.glob("*.gemspec").first
end