Sha256: 3c93a404a195d3661b70e8061e6f7e5f82c05eb51d5c79b2ecd54686686bda0e
Contents?: true
Size: 1.76 KB
Versions: 8
Compression:
Stored size: 1.76 KB
Contents
require 'log4r' module VagrantPlugins module Parallels module Action class SaneDefaults def initialize(app, env) @logger = Log4r::Logger.new('vagrant_parallels::action::sanedefaults') @app = app end def call(env) # Set the env on an instance variable so we can access it in # helpers. @env = env settings = default_settings @app.call(env) if settings.empty? @env[:ui].info I18n.t('vagrant_parallels.actions.vm.sane_defaults.setting') default_settings.each do |setting, value| @env[:machine].provider.driver.execute_prlctl( 'set', @env[:machine].id, "--#{setting.to_s.gsub('_','-')}", value) end @app.call(env) end private def default_settings settings = { tools_autoupdate: 'no', startup_view: 'same', on_shutdown: 'close', on_window_close: 'keep-running', auto_share_camera: 'off', smart_guard: 'off', longer_battery_life: 'on' } return settings if @env[:machine].provider.pd_version_satisfies?('< 10.1.2') settings.merge!( shared_cloud: 'off', shared_profile: 'off', smart_mount: 'off', sh_app_guest_to_host: 'off', sh_app_host_to_guest: 'off', time_sync: 'off' ) return settings if @env[:machine].provider.pd_version_satisfies?('< 11') settings.merge!( startup_view: 'headless', time_sync: 'on', disable_timezone_sync: 'on', shf_host_defined: 'off' ) settings end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems