lib/pups/file_command.rb in pups-1.1.1 vs lib/pups/file_command.rb in pups-1.2.0
- old
+ new
@@ -4,14 +4,14 @@
class FileCommand < Pups::Command
attr_accessor :path, :contents, :params, :type, :chmod, :chown
def self.from_hash(hash, params)
command = new
- command.path = hash['path']
- command.contents = hash['contents']
- command.chmod = hash['chmod']
- command.chown = hash['chown']
+ command.path = hash["path"]
+ command.contents = hash["contents"]
+ command.chmod = hash["chmod"]
+ command.chown = hash["chown"]
command.params = params
command
end
@@ -24,12 +24,10 @@
def run
path = interpolate_params(@path)
`mkdir -p #{File.dirname(path)}`
- File.open(path, 'w') do |f|
- f.write(interpolate_params(contents))
- end
+ File.open(path, "w") { |f| f.write(interpolate_params(contents)) }
`chmod #{@chmod} #{path}` if @chmod
`chown #{@chown} #{path}` if @chown
Pups.log.info("File > #{path} chmod: #{@chmod} chown: #{@chown}")
end
end