Suggestions from Vagrant-core :)
mitchellh opened this issue · 3 comments
mitchellh commented
Hi,
Very cool plugin!! Here are some suggestions:
- Write a
vagrant_init.rb
, then you don't need therequire
in your Vagrantfile. Read more about this here: http://vagrantup.com/docs/extending/types.html - Instead of shelling out directly, use the
driver
method on theVirtualBox::VM
object. Specifically use theraw
method. Example:
vm.driver.raw("controlvm", "foo", "bar")
This will make sure that VBoxManage works on Windows and handles all subprocess IO for you.
- Instead of simply
puts
ing messages, use theui
object on the environment:
env.ui.info("HELLO!")
You get colors and your plugin will work even if Vagrant is not used from the CLI. :)
Mitchell
igorsobreira commented
Thanks for the suggestions Mitchell! I'll work on them :)
igorsobreira commented
@mitchellh the vm.driver.raw() method is protected. I found this vm.driver.execute_command() witch looks like a public API for .raw(). Is it correct?
mitchellh commented
Execute sounds right :)