Class: Busser::Command::Deserialize
- Inherits:
-
Thor::BaseGroup
- Object
- Thor::Group
- Thor::BaseGroup
- Busser::Command::Deserialize
- Defined in:
- lib/busser/command/deserialize.rb
Overview
Deserialize command.
Instance Method Summary collapse
Methods included from UI
banner, die, fatal, handle_command, info, run!, run_ruby_script!, status, warn
Methods included from Helpers
chef_apply, install_gem, root_path, suite_path, vendor_path
Instance Method Details
#perform ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/busser/command/deserialize.rb', line 40 def perform file = File.([:destination]) contents = Base64.decode64(STDIN.read) FileUtils.mkdir_p(File.dirname(file)) File.open(file, "wb") { |f| f.write(contents) } FileUtils.chmod(Integer([:perms]), file) if Digest::MD5.hexdigest(contents) != [:md5sum] abort "Streamed file #{file} does not match source file md5" end end |