Skip to content

Instantly share code, notes, and snippets.

@semanticart
Created October 14, 2010 22:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save semanticart/627198 to your computer and use it in GitHub Desktop.
Save semanticart/627198 to your computer and use it in GitHub Desktop.
a rails 3 template app that gives you a few nifty items
# usage: rails new APP_NAME -m http://gist.github.com/627198.txt -TJ
# the -T drops test-unit and the -J drops prototype
gem "pg"
gem "omniauth"
gem "paperclip"
gem "haml"
gem "sass"
gem "compass"
gem "rspec-rails", :git => "git://github.com/rspec/rspec-rails.git"
gem "rspec", :git => "git://github.com/rspec/rspec.git"
gem "rspec-core", :git => "git://github.com/rspec/rspec-core.git"
gem "rspec-expectations", :git => "git://github.com/rspec/rspec-expectations.git"
gem "rspec-mocks", :git => "git://github.com/rspec/rspec-mocks.git"
gem "cucumber"
gem "cucumber-rails"
gem "capybara"
gem 'factory_girl'
# compass setup - admittedly this is largely cargo culted from some heroku
# apps I've done and may not be 100% necessary. YMMV, feel free to comment
# and/or fork to correct :)
initializer 'compass.rb', <<-CODE
Compass.add_project_configuration(File.join(RAILS_ROOT, "config", "compass.config"))
Compass.configuration.environment = RAILS_ENV.to_sym
Compass.configure_sass_plugin!
CODE
file 'config/compass.config', <<-CODE
project_type = :rails
project_path = RAILS_ROOT if defined?(RAILS_ROOT)
# Set this to the root of your project when deployed:
http_path = "/"
images_dir = "public/images"
javascripts_dir = "public/javascripts"
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
http_images_path = "/images"
http_stylesheets_path = "/stylesheets"
http_javascripts_path = "/javascripts"
css_dir = "public/stylesheets"
sass_dir = "app/stylesheets"
CODE
run 'mkdir app/stylesheets'
# application layout
file 'app/views/layouts/application.html.haml', <<-CODE
!!! 5
%html{:lang => 'en'}
%head
%meta{:charset => 'UTF-8'}
%title Some Title Goes Here
= stylesheet_link_tag 'main', :media => 'screen'
= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'
= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js'
= javascript_include_tag 'application'
%body
=yield
CODE
# install gems and generate our test stuff
run "bundle install"
run "rails generate rspec:install"
run "rails generate cucumber:install --rspec --capybara"
# remove unnecessary files
run 'rm README'
run 'touch README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/images/rails.png'
run 'rm app/views/layouts/application.html.erb'
# git-ify
git :init
git :add => "."
git :commit => "-a -m 'Initial commit'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment