Class: Vagrant::Notify::Action::NotifyProvisioningStatus
- Inherits:
-
Object
- Object
- Vagrant::Notify::Action::NotifyProvisioningStatus
- Defined in:
- lib/vagrant-notify/action/notify_provisioning_status.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ NotifyProvisioningStatus
constructor
A new instance of NotifyProvisioningStatus.
- #notify_provision_messages(env) ⇒ Object
Constructor Details
#initialize(app, env) ⇒ NotifyProvisioningStatus
Returns a new instance of NotifyProvisioningStatus.
5 6 7 |
# File 'lib/vagrant-notify/action/notify_provisioning_status.rb', line 5 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vagrant-notify/action/notify_provisioning_status.rb', line 9 def call(env) = (env) unless env[:machine].config.notify.enable == false system([:start]) unless env[:machine].config.notify.enable == false begin @app.call(env) rescue => msg system("notify-send '[#{env[:machine].name}] \"#{env[:provisioner_name]}\" provision failed!'") unless env[:machine].config.notify.enable == false env[:machine].ui.error("#{msg}") else system([:end]) unless env[:machine].config.notify.enable == false end end |
#notify_provision_messages(env) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-notify/action/notify_provisioning_status.rb', line 23 def (env) = Hash.new if env[:provisioner_name].to_s == 'shell' and env[:provisioner].config.name [:start] = "notify-send '[#{env[:machine].name}] Provisioning with \"#{env[:provisioner_name]} (#{env[:provisioner].config.name})\"...'" [:end] = "notify-send '[#{env[:machine].name}] Finished provisioning with \"#{env[:provisioner_name]} (#{env[:provisioner].config.name})\"'" else [:start] = "notify-send '[#{env[:machine].name}] Provisioning with \"#{env[:provisioner_name]}\"...'" [:end] = "notify-send '[#{env[:machine].name}] Finished provisioning with \"#{env[:provisioner_name]}\"'" end return end |