diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f99983..cac47f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,11 +28,12 @@ fsnotify uses build tags to compile different code on Linux, BSD, OS X, and Wind Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on. -To make cross-platform testing easier, we are providing a Vagrantfile for Linux and BSD. +To make cross-platform testing easier, we've created a Vagrantfile for Linux and BSD. * Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) -* Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time) -* Once setup, you can run the test suite on a given OS with a single command `vagrant ssh bsd -c 'go test ./...'`. +* Setup [Vagrant Gopher](https://github.com/gophertown/vagrant-gopher) in your `src` folder. +* Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password) +* Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd howeyc/fsnotify; go test ./...'`. * When you're done, you will want to halt or destroy the vagrant boxes. Notice: fsnotify file system events won't work on shared folders. The tests get around this limitation by using a tmp directory, but it is something to be aware of when logging in with `vagrant ssh linux` to do some manual testing. diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 25f747f..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,82 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. -VAGRANTFILE_API_VERSION = "2" - -INSTALL = { - "linux" => "apt-get update -qq; apt-get install -qq -y git mercurial bzr curl", - "bsd" => "pkg_add -r git mercurial" -} - -GO_ARCHIVES = { - "precise32" => "go1.1.2.linux-386.tar.gz", - "freebsd32" => "go1.1.2.freebsd-386.tar.gz" -} - -# shell script to bootstrap Go -def bootstrap(os, version) - install = INSTALL[os] - archive = GO_ARCHIVES[version] - - <<-SCRIPT - #{install} - - if ! [ -f /home/vagrant/#{archive} ]; then - response=$(curl -O# https://go.googlecode.com/files/#{archive}) - fi - tar -C /usr/local -xzf #{archive} - - echo 'export GOPATH=$HOME/go' >> /home/vagrant/.profile - echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> /home/vagrant/.profile - echo 'cd $GOPATH/#{project_path}' >> /home/vagrant/.profile - - su -l vagrant -c "go get -d -v ./..." - - echo "\nRun: vagrant ssh #{os} -c 'go test ./...'" - SCRIPT -end - -# partition the path on the last /src/ element -def partition_path(path_to_project = File.dirname(__FILE__)) - path_elements = path_to_project.split(File::SEPARATOR) - last_src = path_elements.rindex("src") - raise "/src/ not found in #{path_to_project}" if last_src.nil? - [File.join(path_elements.take(last_src)), File.join(path_elements.drop(last_src))] -end - -# host operating system path to the last /src/ -def src_path - partition_path[0] -end - -# path to the project -def project_path - partition_path[1] -end - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - - config.vm.define "linux" do |linux| - linux.vm.box = "precise32" - linux.vm.box_url = "http://files.vagrantup.com/precise32.box" - linux.vm.synced_folder src_path, "/home/vagrant/go" - linux.vm.provision :shell, :inline => bootstrap("linux", "precise32") - end - - # Pete Cheslock's BSD box - # https://gist.github.com/petecheslock/d7394ff93ce783c311c7 - # This box only supports NFS for synced/shared folders: - # * which is unsupported on Windows hosts - # * and requires a private host-only network - # * and will prompt for the administrator password of the host - config.vm.define "bsd" do |bsd| - bsd.vm.box = "freebsd32" - bsd.vm.box_url = "http://dyn-vm.s3.amazonaws.com/vagrant/dyn-virtualbox-freebsd-9.1-i386.box" - bsd.vm.synced_folder ".", "/vagrant", :disabled => true - bsd.vm.synced_folder src_path, "/home/vagrant/go", :nfs => true - bsd.vm.network :private_network, :ip => '10.1.10.5' - bsd.vm.provision :shell, :inline => bootstrap("bsd", "freebsd32") - end - -end