Skip to content
Browse files

Don't get clever with comparing hashes (doesn't work for deep compari…

…sons, apparently)

I was adding the TorqueSpec::Daemon to a services block that already
had one, but the write check was failing to detect that it was changed
from the original. There's no real value from not always writing, I
don't think.
  • Loading branch information...
1 parent 84ea07f commit d914c43013ee3aa31e27823f80d3da9c5125261b @jcrossley3 jcrossley3 committed
Showing with 4 additions and 8 deletions.
  1. +4 −8 lib/torquespec/deployment_descriptor.rb
View
12 lib/torquespec/deployment_descriptor.rb
@@ -39,9 +39,8 @@ def stringify_keys(x)
end
def verify( path )
- original = YAML.load_file( path )
- if original.is_a? Hash
- yaml = original.dup
+ yaml = YAML.load_file( path )
+ if yaml.is_a? Hash
if @daemonify
yaml['application'] ||= {}
yaml['application']['root'] ||= TorqueSpec.app_root
@@ -53,11 +52,8 @@ def verify( path )
end
yaml['ruby'] ||= {}
yaml['ruby']['version'] ||= RUBY_VERSION[0,3]
- # yaml['ruby']['compile_mode'] ||= 'off'
- if original != yaml
- File.open( path, 'w' ) do |file|
- YAML.dump( yaml, file )
- end
+ File.open( path, 'w' ) do |file|
+ YAML.dump( yaml, file )
end
end
path

0 comments on commit d914c43

Please sign in to comment.
Something went wrong with that request. Please try again.