Sha256: 9b548ab60699deab96490ca5822555ed321877414260140d0d02605bcc97bac9
Contents?: true
Size: 1.68 KB
Versions: 21
Compression:
Stored size: 1.68 KB
Contents
module Vagrant class Action module VM class ShareFolders def initialize(app, env) @app = app @env = env end def call(env) @env = env create_metadata @app.call(env) mount_shared_folders end # This method returns an actual list of VirtualBox shared # folders to create and their proper path. def shared_folders @env.env.config.vm.shared_folders.inject({}) do |acc, data| key, value = data next acc if value[:disabled] # This to prevent overwriting the actual shared folders data value = value.dup acc[key] = value acc end end def create_metadata @env.ui.info I18n.t("vagrant.actions.vm.share_folders.creating") shared_folders.each do |name, data| folder = VirtualBox::SharedFolder.new folder.name = name folder.host_path = File.expand_path(data[:hostpath], @env.env.root_path) @env["vm"].vm.shared_folders << folder end @env["vm"].vm.save end def mount_shared_folders @env.ui.info I18n.t("vagrant.actions.vm.share_folders.mounting") @env["vm"].ssh.execute do |ssh| shared_folders.each do |name, data| @env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry", :name => name, :guest_path => data[:guestpath])) @env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath]) end end end end end end end
Version data entries
21 entries across 21 versions & 2 rubygems