README.md in bib-vagrant-0.1.0 vs README.md in bib-vagrant-0.1.1

- old
+ new

@@ -1,30 +1,96 @@ # Bib::Vagrant [![Build Status](https://travis-ci.org/easybiblabs/bib-vagrant.png?branch=master)](https://travis-ci.org/easybiblabs/bib-vagrant) [![Coverage Status](https://coveralls.io/repos/easybiblabs/bib-vagrant/badge.png)](https://coveralls.io/r/easybiblabs/bib-vagrant) +This is a work in progress - and subject to [additions and changes](CONTRIBUTING.md). + +## Objective + + 1. Remove developer-specific settings from a project's `Vagrantfile`. + 2. Streamline setup/onboarding. + 3. Avoid stale settings all around. + ## Installation -Add this line to your application's Gemfile: +Install the plugin: - gem 'bib-vagrant' + $ vagrant plugin install bib-vagrant + +Do not use this command in a directory with a Vagrantfile which requires the plugin. Vagrant does _always_ include the Vagrantfile, and therefore will fail before installation because of the missing plugin. Just ```cd``` somewhere else and retry the command, maybe from your homedir? -And then execute: +## Usage +### Developer Settings +The config file with all developer specific settings is currently ```~/.config/easybib/vagrantdefault.yml```. If no such file exists, the plugin will create the file with default settings. - $ bundle +The content of this file can be retrieved using the plugin as an array, the the Vagrantfile-Example below for usage. -Or install it yourself as: +The current default settings and their respective usage in our Vagrantfiles are: - $ gem install bib-vagrant +``` -## Usage +#Use filesystem shares over nfs +nfs: false -TODO: Write usage instructions here +#Path to the cookbooks +cookbook_path: ~/Sites/easybib/cookbooks +#Chef Log Level +chef_log_level: debug + +#Additional JSON to be merged in the Chef JSON +additional_json: ! '{}' + +#Show Virtualbox GUI +gui: false +``` + +Additional parameters can be added to the file and used in the Vagrantfile - but you then have to make sure to use sensible fallback defaults in your Vagrantfile, since not every developer might have this setting in the .yml. + + +### Vagrantfile + +In your `Vagrantfile`: + +```ruby +Vagrant.require_plugin 'bib-vagrant' + +Vagrant.configure("2") do |config| + bibconfig = Bib::Vagrant::Config.new + vagrantconfig = bibconfig.get + + config.vm.define :db do |web_config| + + #... + + web_config.vm.provider :virtualbox do |vb| + vb.gui = vagrantconfig["gui"] + #... + end + + web_config.vm.synced_folder "./../", "/vagrant_data", :owner => "vagrant", :nfs => vagrantconfig["nfs"] + + web_config.vm.provision :chef_solo do |chef| + chef.cookbooks_path = vagrantconfig["cookbook_path"] + chef.add_recipe "something::here" + chef.log_level = vagrantconfig["chef_log_level"] + end + + end +``` + +The configuration is located in `~/.config/easybib/vagrantdefault.yml`: + +```yaml +--- +nfs: false +cookbook_path: ~/Documents/workspaces/easybib-cookbooks +chef_log_level: debug +additional_json: ! '{}' +gui: true +``` + ## Contributing -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request +See [Contributing](CONTRIBUTING.md) +