Class: Vagrant::Lube::Action::VM::SetHostName
- Inherits:
-
Object
- Object
- Vagrant::Lube::Action::VM::SetHostName
- Defined in:
- lib/vagrant/lube/action/vm/set_host_name.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ SetHostName
constructor
A new instance of SetHostName.
Constructor Details
#initialize(app, env) ⇒ SetHostName
Returns a new instance of SetHostName.
7 8 9 |
# File 'lib/vagrant/lube/action/vm/set_host_name.rb', line 7 def initialize app, env @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/vagrant/lube/action/vm/set_host_name.rb', line 11 def call env if env[:vm].config.vm.host_name.nil? host = File.basename(env[:vm].env.root_path).gsub(/_/, '-') env[:vm].config.vm.host_name = "#{host}.vagrantup.com" end @app.call(env) end |