Sha256: b8db92aa62589981a7a8b0bc2c44aede5d1d56e60ebfabce18b29532cb148288

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 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?
      # 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)
      
      if @network = ::CORL::Vagrant::Config.load_network(env[:root_path])
        @vm   = env[:machine]
        @node = network.node(:vagrant, @vm.name) if @vm
      end
    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

16 entries across 16 versions & 1 rubygems

Version Path
corl-0.5.6 lib/core/vagrant/action.rb
corl-0.5.5 lib/core/vagrant/action.rb
corl-0.5.4 lib/core/vagrant/action.rb
corl-0.5.3 lib/core/vagrant/action.rb
corl-0.5.2 lib/core/vagrant/action.rb
corl-0.5.1 lib/core/vagrant/action.rb
corl-0.5.0 lib/core/vagrant/action.rb
corl-0.4.29 lib/core/vagrant/action.rb
corl-0.4.28 lib/core/vagrant/action.rb
corl-0.4.27 lib/core/vagrant/action.rb
corl-0.4.26 lib/core/vagrant/action.rb
corl-0.4.25 lib/core/vagrant/action.rb
corl-0.4.24 lib/core/vagrant/action.rb
corl-0.4.23 lib/core/vagrant/action.rb
corl-0.4.22 lib/core/vagrant/action.rb
corl-0.4.21 lib/core/vagrant/action.rb