Class: VagrantPlugins::VagrantBosh::AssetUploader
- Inherits:
-
Object
- Object
- VagrantPlugins::VagrantBosh::AssetUploader
- Defined in:
- lib/vagrant-bosh/asset_uploader.rb
Instance Method Summary collapse
-
#initialize(communicator, assets_dir, ui) ⇒ AssetUploader
constructor
A new instance of AssetUploader.
- #sync(dst_path) ⇒ Object
- #upload_text(text, dst_path) ⇒ Object
Constructor Details
#initialize(communicator, assets_dir, ui) ⇒ AssetUploader
Returns a new instance of AssetUploader.
8 9 10 11 12 13 14 |
# File 'lib/vagrant-bosh/asset_uploader.rb', line 8 def initialize(communicator, assets_dir, ui) @c = communicator @assets_dir = assets_dir @ui = ui.for(:asset_uploader) @logger = Log4r::Logger.new("vagrant::provisioners::bosh::asset_uploader") end |
Instance Method Details
#sync(dst_path) ⇒ Object
16 17 18 19 20 |
# File 'lib/vagrant-bosh/asset_uploader.rb', line 16 def sync(dst_path) @ui.timed_msg(:upload, dst_path: dst_path) do upload_path(@assets_dir, dst_path) end end |
#upload_text(text, dst_path) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-bosh/asset_uploader.rb', line 22 def upload_text(text, dst_path) @ui.timed_msg(:upload, dst_path: dst_path) do begin f = Tempfile.new("asset-uploader-upload-text") f.write(text) f.flush upload_path(f.path, dst_path) ensure f.close if f end end end |