Created
October 18, 2012 12:01
-
-
Save jalada/3911374 to your computer and use it in GitHub Desktop.
Rails 3 Template
This file contains hidden or 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
#!/usr/bin/env ruby | |
require('open-uri') | |
# Add new gems. | |
gem("haml-rails") | |
gem("thin-rails") | |
gem("bootstrap-sass") | |
gem("app-config", :git => "git://github.com/newsinternational/app-config.git") | |
# No coffeescript. | |
comment_lines("Gemfile", /coffee-rails/) | |
# Fix for foreman in development. | |
insert_into_file("config/environments/development.rb", "$stdout.sync = true", :after => "\nend\n") | |
# Convert created HTML layout to HAML. | |
remove_file("app/views/layouts/application.html.erb") | |
create_file("app/views/layouts/application.html.haml") do | |
<<EOF | |
!!! | |
%html | |
%head | |
%title My Rails 3 Application. | |
= stylesheet_link_tag "application", :media => "all" | |
= javascript_include_tag "application" | |
= csrf_meta_tags | |
%body | |
= yield | |
EOF | |
end | |
# Add a CSS file to import bootstrap | |
create_file("app/assets/stylesheets/root.css.sass") do | |
'@import "bootstrap"' | |
end | |
# Add a Procfile for foreman | |
create_file("Procfile") do | |
"web: script/rails server -p $PORT" | |
end | |
# Add an empty config.yml file for app-config | |
create_file("config/config.yml") do | |
<<EOF | |
defaults: &defaults | |
development: | |
<<: *defaults | |
production: | |
<<: *defaults | |
EOF | |
end | |
# Add Underscore as a Javascript asset. | |
vendor("assets/javascripts/underscore.js") do | |
open('http://underscorejs.org/underscore.js').read | |
end | |
insert_into_file("app/assets/javascripts/application.js", "//= require underscore\n", :after => "//= require jquery_ujs\n") | |
# Remove the standard public/index.html. | |
remove_file("public/index.html") | |
# Who thought this was a good idea anyway? | |
remove_file("app/assets/images/rails.png") | |
# Finally: set up Git repo. | |
git :init | |
git :add => "." | |
git :commit => "-m 'Initial commit'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use it like: