Class: HashiCorp::VagrantVMwareDesktop::Action::Compatibility

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/compatibility.rb

Overview

This modifies the env with some compatibility layers for prior versions of Vagrant.

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ Compatibility

Returns a new instance of Compatibility.



12
13
14
# File 'lib/vagrant-vmware-desktop/action/compatibility.rb', line 12

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/vagrant-vmware-desktop/action/compatibility.rb', line 16

def call(env)
  return @app.call(env) if env[:_vmware_compatibility]

  if Vagrant::VERSION < "1.5.0"
    if env[:ui]
      # Create the new UI methods
      ui = env[:ui]
      def ui.detail(*args)
        self.info(*args)
      end

      def ui.output(*args)
        self.info(*args)
      end
    end
  end

  env[:_vmware_compatibility] = true
  @app.call(env)
end