Created
June 15, 2011 14:25
-
-
Save ericgj/1027215 to your computer and use it in GitHub Desktop.
rails app template for RbMU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# rails new myapp --template=path/to/this/file.rb -J | |
appname = File.expand_path(Dir.new('.')).split('/').last | |
#--------------- Gem setup | |
# Note this is mostly copied from puzzlenode | |
# | |
file 'Gemfile', <<_____ | |
source 'http://rubygems.org' | |
gem 'rails', '~> 3.0.8' | |
gem 'pg' | |
gem 'haml' | |
gem 'slim' | |
gem 'omniauth', '~> 0.2.5' | |
gem 'compass', '~> 0.11.3' | |
# test environment gems | |
# | |
group :test do | |
gem 'test-unit' | |
gem "capybara", "~> 0.4.1.1" | |
gem "factory_girl_rails" | |
gem 'test_notifier', '~> 0.3.6' | |
end | |
_____ | |
#--------------- Database | |
file 'config/database.yml.example', %Q{ | |
development: | |
adapter: postgresql | |
database: #{appname}-devel | |
username: root | |
host: localhost | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. | |
test: | |
adapter: postgresql | |
database: #{appname}-test | |
username: root | |
host: localhost | |
min_messages: error | |
production: | |
adapter: postgresql | |
database: #{appname}-production | |
username: root | |
host: localhost | |
min_messages: error | |
} | |
run 'rm config/database.yml' | |
append_file '.gitignore', 'config/database.yml' | |
#--------------- Auth | |
file 'config/omniauth.yml.example', <<_____ | |
# https://github.com/account/applications | |
github: | |
client: <CLIENT> | |
secret: <SECRET> | |
_____ | |
append_file '.gitignore', 'config/omniauth.yml' | |
initializer 'omniauth.rb', %q{ | |
keys = YAML.load_file("#{Rails.root}/config/omniauth.yml") | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :github, keys['github']['client'], keys['github']['secret'] | |
end | |
} | |
#--------------- CSS | |
#--------------- Javascript | |
run "curl -L http://code.jquery.com/jquery-1.6.1.min.js > public/javascripts/jquery.js" | |
run "curl -L http://github.com/rails/jquery-ujs/raw/master/src/rails.js > public/javascripts/rails.js" | |
#--------------- default file deletion | |
run 'rm public/index.html' | |
run 'rm public/images/rails.png' | |
initializer 'secret_token.rb.example', %Q{ | |
# Be sure to restart your server when you modify this file. | |
# Your secret key for verifying the integrity of signed cookies. | |
# If you change this key, all old signed cookies will become invalid! | |
# Make sure the secret is at least 30 characters and all random, | |
# no regular words or you'll be exposed to dictionary attacks. | |
#{appname.titleize}::Application.config.secret_token = '<RUN `rake secret` TO GENERATE A TOKEN>' | |
} | |
append_file '.gitignore', 'secret_token.rb' | |
#--------------- bundle install | |
run 'bundle install' | |
#--------------- after bundler actions | |
run 'compass init rails . --syntax sass' | |
file 'config/compass.rb', <<_____ | |
# This configuration file works with both the Compass command line tool and within Rails. | |
# Require any additional compass plugins here. | |
project_type = :rails | |
project_path = Compass::AppIntegration::Rails.root | |
# Set this to the root of your project when deployed: | |
http_path = "/" | |
css_dir = "public/stylesheets/compiled" | |
sass_dir = "app/stylesheets" | |
environment = Compass::AppIntegration::Rails.env | |
# To enable relative paths to assets via compass helper functions. Uncomment: | |
# relative_assets = true | |
preferred_syntax = :sass | |
_____ | |
initializer 'compass.rb', <<_____ | |
require 'compass' | |
require 'compass/app_integration/rails' | |
Compass::AppIntegration::Rails.initialize! | |
_____ | |
#--------------- git commit | |
git :init | |
git :add => '.' | |
git :commit => "-a -m 'Initial commit, application generated from #{__FILE__}'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment