Class: Vagrant::Action::VM::Provision
- Inherits:
-
Object
- Object
- Vagrant::Action::VM::Provision
- Defined in:
- lib/vagrant/action/vm/provision.rb
Instance Attribute Summary collapse
-
#provisioners ⇒ Object
readonly
Returns the value of attribute provisioners.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Provision
constructor
A new instance of Provision.
- #load_provisioners ⇒ Object
- #provisioning_enabled? ⇒ Boolean
Constructor Details
#initialize(app, env) ⇒ Provision
Returns a new instance of Provision.
7 8 9 10 11 12 13 14 |
# File 'lib/vagrant/action/vm/provision.rb', line 7 def initialize(app, env) @app = app @env = env @env["provision.enabled"] = true if !@env.has_key?("provision.enabled") @provisioners = [] load_provisioners if provisioning_enabled? end |
Instance Attribute Details
#provisioners ⇒ Object (readonly)
Returns the value of attribute provisioners.
5 6 7 |
# File 'lib/vagrant/action/vm/provision.rb', line 5 def provisioners @provisioners end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/vagrant/action/vm/provision.rb', line 16 def call(env) @app.call(env) @provisioners.each do |instance| @env.ui.info I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => instance.class) instance.provision! end end |
#load_provisioners ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/vagrant/action/vm/provision.rb', line 29 def load_provisioners @env["config"].vm.provisioners.each do |provisioner| @env.ui.info I18n.t("vagrant.actions.vm.provision.enabled", :provisioner => provisioner.shortcut) instance = provisioner.provisioner.new(@env, provisioner.config) instance.prepare @provisioners << instance end end |
#provisioning_enabled? ⇒ Boolean
25 26 27 |
# File 'lib/vagrant/action/vm/provision.rb', line 25 def provisioning_enabled? !@env["config"].vm.provisioners.empty? && @env["provision.enabled"] end |