Sha256: a1afe01ff75de509a81b04e121f3d02e2eba13f83337040b21ad33a07429a6da

Contents?: true

Size: 1002 Bytes

Versions: 4

Compression:

Stored size: 1002 Bytes

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
  end
  
  #-----------------------------------------------------------------------------
  # Property accessor / modifiers
  
  attr_reader :network, :node, :vm
  
  #-----------------------------------------------------------------------------
  # Action execution
  
  def call(env)
    # 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
      yield if block_given? && @node 
    end
  end
end    
end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
corl-0.4.20 lib/core/vagrant/action.rb
corl-0.4.19 lib/core/vagrant/action.rb
corl-0.4.18 lib/core/vagrant/action.rb
corl-0.4.17 lib/core/vagrant/action.rb