Class: BunBun::CLI::StorageUpload
- Inherits:
-
StorageCommand
- Object
- Command
- StorageCommand
- BunBun::CLI::StorageUpload
- Defined in:
- lib/bunbun/cli/storage_upload.rb
Instance Attribute Summary
Attributes inherited from StorageCommand
#storage_access_key, #storage_host, #storage_zone
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
argument_count, argument_names, option, #option_parser, options
Instance Method Details
#call(path, file) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bunbun/cli/storage_upload.rb', line 7 def call(path, file) unless path.end_with?('/') raise BunBun::CLI::Error, 'path must end with a trailing slash' end super content_type = `file -b --mime-type #{Shellwords.escape(file)}`.chomp File.open(file, 'rb') do |io| client.upload(path + File.basename(file), io, content_type: content_type) end end |