Top Level Namespace
Defined Under Namespace
Modules: Chake
Instance Method Summary collapse
Instance Method Details
#encrypted_for(node) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/chake.rb', line 55 def encrypted_for(node) Dir.glob("**/files/{default,host-#{node}}/*.{asc,gpg}").inject({}) do |hash, key| hash[key] = key.sub(/\.(asc|gpg)$/, '') hash end end |
#if_files_changed(node, group_name, files) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/chake.rb', line 62 def if_files_changed(node, group_name, files) if files.empty? return end hash = IO.popen(['sha1sum', *files]).read hash_file = File.join('.tmp', node + '.' + group_name + '.sha1sum') if !File.exists?(hash_file) || File.read(hash_file) != hash yield end File.open(hash_file, 'w') do |f| f.write(hash) end end |