igorsobreira/vagrant-screenshot

Suggestions from Vagrant-core :)

mitchellh opened this issue · 3 comments

Hi,

Very cool plugin!! Here are some suggestions:

  1. Write a vagrant_init.rb, then you don't need the require in your Vagrantfile. Read more about this here: http://vagrantup.com/docs/extending/types.html
  2. Instead of shelling out directly, use the driver method on the VirtualBox::VM object. Specifically use the raw method. Example:
vm.driver.raw("controlvm", "foo", "bar")

This will make sure that VBoxManage works on Windows and handles all subprocess IO for you.

  1. Instead of simply putsing messages, use the ui 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

Thanks for the suggestions Mitchell! I'll work on them :)

@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?

Execute sounds right :)