When I try to get a new piece of code working, it's often useful to have a standalone, isolated, working example demonstrating what I want to acheive. This repo is intended to address that. The base app will seem a little dull; it's basically a blank canvas. For each example, you want to check out the relevant branch. A list of the branches and their descriptions below:
Branch | Description |
---|---|
[base_ruby_environment] (spex_branches/base_ruby_environment.md) | A basic dev box for ruby development. No Rails dependencies. The box installs postgres and sqlite, as well as the ruby 2.1 dev package (can be configured) |
[base_rails_app] (spex_branches/base_rails_app.md) | A smoke test for a rails dev environment, and as close to the output from rails new ... as possible. Postgresql is used for Active record instead of SQlite and rubyracer is used as a JavaScript runtime |
[building_ruby_from_source] (spex_branches/building_ruby_from_source.md) | Showing how to compile Ruby from source as part of your Vagrant Box setup |
[rspec_guard] (spex_branches/rspec_guard.md) | Setting up Guard to to run your RSpec tests when files change |
[rspec_guard_spring] (spex_branches/rspec_guard_spring.md) | Setting up Spring with Rspec and Guard to run your tests faster |
[guard_growl] (spex_branches/guard_growl.md) | Setting up Growl to get notifications from your Virtual Machine |
[code_coverage] (spex_branches/code_coverage.md) | Getting code coverage setup on your app |
[duplicating_repo] (spex_branches/duplicating_repo.md) | A way to duplicate a rails app (e.g. one of these examples) into a new repo |
[continuous_integration] (spex_branches/continuous_integration.md) | Setting up rspec to output Ci friendly reports |
[image_upload] (spex_branches/image_upload.md) | A simple example of uploading images to the server using [CarrierWave] (https://github.com/carrierwaveuploader/carrierwave) |
[stripe_payments] (spex_branches/stripe_payments.md) | A simpe working example showing use of the [Stripe Payments API] (https://stripe.com/docs/api) |
- Install [Vagrant] (http://www.vagrantup.com/downloads.html)
- Install [VirtualBox] (https://www.virtualbox.org/wiki/Downloads)
- Install [Vagrant Triggers Plugin] (https://github.com/emyl/vagrant-triggers)
- Open a terminal window and cd to the 'ops' folder of this repo
- Type the following (you only need to do this on first run):
vagrant plugin install vagrant-vbguest
- Now type
vagrant up
and witness as a new machine gets downloaded and configured. The guest box is where your code will run when you're working with it.
std is not a tty
Guest addition do not match on this machine
In most cases it is ok that the windows systems driver installation fail
passing vesrion to postgresql server is deprecated...
When you are working like this, you now have a machine running all on its lonesome and isolated from any other stuff on your laptop. It is like running a whole new machine in a box though so it will consume disk space and RAM. You can shut it down / pause it just like a real machine. Here are some useful commands:
vagrant up
(re)starts the machine so you can work with the appvagrant suspend
This is like stopping the machine in time. Resuming work is super fast, and the box wont consume RAM or CPU, but will take up a big chunk of disk space (about 2GB) plus whatever was in RAMvagrant halt
This is like shutting the machine down. Takes longer to start thansuspend
but RAM isn't written to disk so it takes less spacevagrant destroy
This is like throwing the box out the window. You can always start afresh withvagrant up
but it will have to go through that initial install which might take a few minutes...