Sha256: 811530237ba804dae60ddab76ceb12b2364009127f5c603874e4273619f0eade

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

module VagrantPlugins
module CORL
class BaseAction

  #-----------------------------------------------------------------------------
  # Constructor / Destructor

  def initialize(app, env)
    @app     = app
    @env     = env[:machine].env

    @network = nil
    @node    = nil
    @vm      = nil

    if @corl_config_loaded = ::CORL.vagrant_config_loaded?
      if @network = ::CORL::Vagrant::Config.load_network(env[:root_path])
        @vm   = env[:machine]
        @node = network.node(:vagrant, @vm.name) if @vm
      end
    end

    unless ::CORL::Vagrant.command
      # Hackish solution to ensure our code has access to Vagrant machines.
      # This serves as a Vagrant VM manager.
      ::CORL::Vagrant.command = Command::Launcher.new([], @env)
    end
  end

  #-----------------------------------------------------------------------------
  # Property accessor / modifiers

  attr_reader :network, :node, :vm

  #-----------------------------------------------------------------------------
  # Action execution

  def call(env)
    yield if block_given? && @corl_config_loaded && @network && @node
  end
end
end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
corl-0.5.18 lib/core/vagrant/action.rb
corl-0.5.17 lib/core/vagrant/action.rb
corl-0.5.16 lib/core/vagrant/action.rb
corl-0.5.15 lib/core/vagrant/action.rb
corl-0.5.14 lib/core/vagrant/action.rb
corl-0.5.13 lib/core/vagrant/action.rb
corl-0.5.12 lib/core/vagrant/action.rb
corl-0.5.11 lib/core/vagrant/action.rb
corl-0.5.10 lib/core/vagrant/action.rb
corl-0.5.9 lib/core/vagrant/action.rb
corl-0.5.8 lib/core/vagrant/action.rb
corl-0.5.7 lib/core/vagrant/action.rb