Stok Footage

Continually experimenting with new ideas and techniques — Reconstructing, Developing, Modernising.

Getting Back on the Rails

I have had a few months break away from doing software development, and the time has firmed up some of my prejudices about the type of people attracted to various technologies. So without further ado it’s time to plunge into Michael Hartl’s Ruby on Rails Tutorial, and see if I can get my development environment humming again.

So the plan is to spend about an hour a day going through it and seeing what I can learn about the new rails and the new ruby.

For my initial set-up I’m using rbenv and ruby-build to give me control over ruby versions – I have used rvm very successfully in the past, and want to try something new. As there aren’t gemsets I need to resort to a little trickery inspired by a stackoverflow answer.

My ~/.rbenv/default-gems contains:

1
2
3
bundler
pry
pry-plus

My ~/.gemrc contains:

1
2
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri

So to create a new bundler-ready rails project I need to do something like this to make sure rails is installed per-project, and not in my rbenv’s ruby’s “global” environment:

1
2
3
4
5
6
7
8
9
10
11
12
project_name=test-project
ruby_version=2.0.0-p195
rails_version=4.0.0rc1

mkdir $project_name
cd $project_name
rbenv local $ruby_version
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'rails', '$rails_version'" >> Gemfile
bundle install --path vendor/bundle
bundle exec rails new . -f --skip-bundle
bundle install

This has been bundled up into a simple bash script in ~/bin/nrp (new rails project…)

Let’s see how this goes…

Leave a Reply

Your email address will not be published. Required fields are marked *