README.md in vagrant-exec-0.1.0 vs README.md in vagrant-exec-0.2.0

- old
+ new

@@ -1,12 +1,10 @@ -vagrant-exec +vagrant-exec [![Gem Version](https://badge.fury.io/rb/vagrant-exec.png)](http://badge.fury.io/rb/vagrant-exec) =============== Vagrant plugin to execute commands within the context of VM synced directory. -[![Gem Version](https://badge.fury.io/rb/vagrant-exec.png)](http://badge.fury.io/rb/vagrant-exec) - Description ----------- You will probably use the plugin if you don't want to SSH into the box to execute commands simply because your machine environment is already configured (e.g. I use ZSH and TextMate bundles to run specs/features). @@ -35,26 +33,64 @@ config.vm.box = 'precise32' config.exec.folder = '/custom' end ``` +```shell +➜ vagrant exec pwd +# is the same as +➜ vagrant ssh -c "cd /custom && bundle exec pwd' +``` + You can also enable bundler to prepend each command with `bundle exec` (note, that it won't be done for commands like `bundle install`). ```ruby Vagrant.configure('2') do |config| config.vm.box = 'precise32' config.exec.bundler = true end ``` +```shell +➜ vagrant exec pwd +# is the same as +➜ vagrant ssh -c "cd /vagrant && bundle exec pwd' + +➜ vagrant exec bundle install +# is the same as +➜ vagrant ssh -c "cd /vagrant && bundle install' +``` + +You can also add environment variables to be exported before. + +```ruby +Vagrant.configure('2') do |config| + config.vm.box = 'precise32' + config.exec.env['RAILS_ENV'] = 'test' + config.exec.env['RAILS_ROOT'] = '/vagrant' +end +``` + +```shell +➜ vagrant exec pwd +# is the same as +➜ vagrant ssh -c "cd /vagrant && export RAILS_ENV=test && export RAILS_ROOT=/vagrant && pwd' +``` + Acceptance tests ---------------- Before running features, you'll need to bootstrap box. ```shell ➜ bundle exec rake features:bootstrap ➜ bundle exec rake features:run +``` + +After you're done, remove Vagrant box. + +```shell +➜ bundle exec rake features:cleanup ``` Note on Patches/Pull Requests -----------------------------