Class: VagrantPlugins::WinAzure::Action::SyncFolders
- Inherits:
-
Vagrant::Action::Builtin::SyncedFolders
- Object
- Vagrant::Action::Builtin::SyncedFolders
- VagrantPlugins::WinAzure::Action::SyncFolders
- Includes:
- Vagrant::Util::ScopedHashOverride
- Defined in:
- lib/vagrant-azure/action/sync_folders.rb
Overview
This middleware uses ‘rsync` to sync the folders
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ SyncFolders
constructor
A new instance of SyncFolders.
Constructor Details
#initialize(app, env) ⇒ SyncFolders
Returns a new instance of SyncFolders.
20 21 22 23 |
# File 'lib/vagrant-azure/action/sync_folders.rb', line 20 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_azure::action::sync_folders") end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vagrant-azure/action/sync_folders.rb', line 25 def call(env) if env[:machine].config.vm.guest != :windows super else @app.call(env) env[:machine].config.vm.synced_folders.each do |id, data| data = scoped_hash_override(data, :azure) # Ignore disabled shared folders next if data[:disabled] hostpath = File.(data[:hostpath], env[:root_path]) guestpath = data[:guestpath] env[:ui].info(I18n.t("vagrant_azure.copy_folder", :hostpath => hostpath, :guestpath => guestpath)) # Create the host path if it doesn't exist and option flag is set if data[:create] begin FileUtils::mkdir_p(hostpath) rescue => err raise Errors::MkdirError, :hostpath => hostpath, :err => err end end env[:machine].provider.driver.upload(hostpath, guestpath) end end end |