Class: Shutwork::Command::Base
- Inherits:
-
Object
- Object
- Shutwork::Command::Base
- Extended by:
- Forwardable
- Includes:
- Display
- Defined in:
- lib/shutwork/command/base.rb
Instance Method Summary collapse
- #download_file(url, dst, at = nil) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Methods included from Display
#display_account, #display_file, #display_message, #display_room, #format_datetime, #format_filesize, #to_filesize_human
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
16 17 18 |
# File 'lib/shutwork/command/base.rb', line 16 def initialize @shell = Thor::Shell::Color.new end |
Instance Method Details
#download_file(url, dst, at = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shutwork/command/base.rb', line 20 def download_file url, dst, at = nil FileUtils.mkdir_p dst.dirname open(url) do |i| open(dst, 'wb') do |o| o.write i.read end if at File.utime at, at, dst end end end |