Class: Vagrant::Action::VM::DefaultName
- Inherits:
-
Object
- Object
- Vagrant::Action::VM::DefaultName
- Defined in:
- lib/vagrant/action/vm/default_name.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ DefaultName
constructor
A new instance of DefaultName.
Constructor Details
#initialize(app, env) ⇒ DefaultName
Returns a new instance of DefaultName.
7 8 9 10 |
# File 'lib/vagrant/action/vm/default_name.rb', line 7 def initialize(app, env) @logger = Log4r::Logger.new("vagrant::action::vm::defaultname") @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/vagrant/action/vm/default_name.rb', line 12 def call(env) @logger.info("Setting the default name of the VM") name = env[:root_path].basename.to_s + "_#{Time.now.to_i}" env[:vm].driver.set_name(name) @app.call(env) end |