Class: VagrantPlugins::MountCommand::Action::Command
- Inherits:
-
Object
- Object
- VagrantPlugins::MountCommand::Action::Command
- Defined in:
- lib/vagrant-mountcommand/action.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Command
constructor
A new instance of Command.
- #mount_command ⇒ Object
- #mount_commands ⇒ Object
Constructor Details
#initialize(app, env) ⇒ Command
Returns a new instance of Command.
5 6 7 8 |
# File 'lib/vagrant-mountcommand/action.rb', line 5 def initialize(app, env) @app = app @env = env end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-mountcommand/action.rb', line 10 def call(env) @app.call(env) @env = env @machine = env[:machine] # Setup a sentinel to check whether the machine has already been provisioned. sentinel = env[:machine].data_dir.join("action_provision") run_mount_commands = true if sentinel.file? = sentinel.open('rb').read if Integer() + 180 > Time.now.to_i run_mount_commands = false end end if run_mount_commands and !mount_commands.empty? mount_command end end |
#mount_command ⇒ Object
35 36 37 38 39 |
# File 'lib/vagrant-mountcommand/action.rb', line 35 def mount_command mount_commands.each do |command| @machine.communicate.sudo(command) end end |
#mount_commands ⇒ Object
31 32 33 |
# File 'lib/vagrant-mountcommand/action.rb', line 31 def mount_commands @machine.config.mount_commands.commands end |