diff --git a/.gitignore b/.gitignore index 7d8cb014..2d30b632 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ Gemfile.lock *.swp /coverage/ +/.vagrant/ +/dump.rdb diff --git a/.vagrant-provision-as-vagrant.sh b/.vagrant-provision-as-vagrant.sh new file mode 100755 index 00000000..e9cd7b1c --- /dev/null +++ b/.vagrant-provision-as-vagrant.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e +set -x + +ln -svf /vagrant/.vagrant-skel/bashrc ~/.bashrc +ln -svf /vagrant/.vagrant-skel/bash_profile ~/.bash_profile + +source ~/.bashrc + +set +x +curl -L https://get.rvm.io | bash -s stable --ruby=2.0.0 --auto-dotfiles + +source ~/.rvm/scripts/rvm +gem install --no-ri --no-rdoc bundler foreman diff --git a/.vagrant-provision.sh b/.vagrant-provision.sh new file mode 100755 index 00000000..e31e860a --- /dev/null +++ b/.vagrant-provision.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +umask 022 + +set -e +set -x + +apt-get update -yq +apt-get install --no-install-suggests -yq python-software-properties +add-apt-repository -y ppa:chris-lea/redis-server +apt-get update -yq +apt-get install --no-install-suggests -yq \ + build-essential \ + byobu \ + curl \ + git \ + make \ + redis-server \ + screen + +su - vagrant -c /vagrant/.vagrant-provision-as-vagrant.sh diff --git a/.vagrant-skel/bash_profile b/.vagrant-skel/bash_profile new file mode 100755 index 00000000..59d9e4ea --- /dev/null +++ b/.vagrant-skel/bash_profile @@ -0,0 +1,7 @@ +#!bash + +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* + +if [[ "$PS1" ]] ; then + cd /vagrant +fi diff --git a/.vagrant-skel/bashrc b/.vagrant-skel/bashrc new file mode 100755 index 00000000..20d0742d --- /dev/null +++ b/.vagrant-skel/bashrc @@ -0,0 +1,7 @@ +#!bash + +export LANG='en_US.UTF-8' +export LANGUAGE='en_US.UTF-8' +export LC_ALL='en_US.UTF-8' + +export PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting diff --git a/README.md b/README.md index 97da4e3d..e82a21ab 100644 --- a/README.md +++ b/README.md @@ -571,6 +571,33 @@ of the code looking very similar to resque, particularly in resque-web and the views. I wanted it to be similar enough that someone familiar with resque could easily work on resque-scheduler. +### Development + +Working on resque-scheduler requires the following: + +* A relatively modern Ruby interpreter (MRI 1.9+ is what's tested) +* bundler + +The development setup looks like this, which is roughly the same thing +that happens on Travis CI: + +``` bash +# Install everything +bundle install + +# Make sure tests are green before you change stuff +bundle exec rake +# Change stuff +# Repeat +``` + +If you have [vagrant](http://www.vagrantup.com) installed, there is a +development box available that requires no plugins or external +provisioners: + +``` bash +vagrant up +``` ### Contributing diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 00000000..8d8ca06d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,14 @@ +# vim:filetype=ruby + +Vagrant.configure('2') do |config| + config.vm.hostname = 'resque-scheduler' + config.vm.box = 'precise64' + config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/precise/' << + 'current/precise-server-cloudimg-amd64-vagrant-disk1.box' + + config.vm.network :private_network, ip: '33.33.33.10', auto_correct: true + config.vm.network :forwarded_port, guest: 5678, host: 15678, + auto_correct: true + + config.vm.provision :shell, path: '.vagrant-provision.sh' +end