Skip to content

Instantly share code, notes, and snippets.

@xslim
Created June 28, 2011 19:05
Show Gist options
  • Save xslim/1051920 to your computer and use it in GitHub Desktop.
Save xslim/1051920 to your computer and use it in GitHub Desktop.
Rails 3 App Template with JQuery, Mongoid, Compass, HAML & Barista
# rails new NAME -OJ -m https://gist.github.com/raw/903515/rails-template.rb
remove_file 'README'
remove_file 'public/index.html'
remove_file 'public/images/rails.png'
prepend_file 'config/boot.rb' do <<-RB
begin
require 'yaml'
YAML::ENGINE.yamler = 'syck'
rescue Exception => e
puts e.to_s
end
RB
end
git :init
git :add => "."
git :commit => "-a -m 'initial commit'"
# JQuery
get 'http://html5shiv.googlecode.com/svn/trunk/html5.js', 'public/javascripts/html5.js'
gem 'jquery-rails'
run 'sudo bundle'
if yes?('Use Jquery UI?')
generate 'jquery:install --ui'
else
generate 'jquery:install'
end
git :add => "."
git :commit => "-a -m 'added jquery'"
# Gems
if yes?('Use Compass & HAML?')
%w(haml compass).map { |g| gem g }
run 'sudo bundle'
sass_dir = "app/stylesheets"
css_dir = "public/stylesheets"
run "compass init rails . --using blueprint/semantic --css-dir=#{css_dir} --sass-dir=#{sass_dir}"
git :add => "."
git :commit => "-a -m 'added compass'"
end
if yes?('Use Barista for CoffeeScript?')
%w(json barista).map { |g| gem g }
run 'sudo bundle'
generate 'barista:install'
git :add => "."
git :commit => "-a -m 'added barista'"
end
# MongoID
if yes?('Use Mongoid?')
%w(mongoid bson_ext).map { |g| gem g }
run 'sudo bundle'
generate 'mongoid:config'
gsub_file 'config/mongoid.yml', /\s*allow_dynamic_fields: true/, ''
gsub_file 'config/mongoid.yml', /\s*raise_not_found_error: true/, ''
git :add => "."
git :commit => "-a -m 'added mongoid'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment