Created
February 5, 2012 13:48
-
-
Save mikespokefire/1745667 to your computer and use it in GitHub Desktop.
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
source_paths << File.join(File.dirname(File.expand_path(__FILE__)), "rails-template") | |
remove_file "README.rdoc" | |
remove_file "public/index.html" | |
## | |
# Setup rbenv | |
create_file ".rbenv-version", "1.9.3-p0" | |
## | |
# Gems | |
append_file "Gemfile", %q{ | |
gem "simple_form", "~> 2.0.0.rc" | |
gem "draper" | |
gem "cells" | |
group :development do | |
gem "foreman" | |
end | |
group :test do | |
gem "factory_girl_rails" | |
gem "database_cleaner" | |
gem "rspec-rails" | |
gem "fuubar" | |
gem "spinach-rails" | |
gem "guard" | |
gem "guard-rspec" | |
gem "guard-spinach" | |
end | |
} | |
## | |
# Bundle it up | |
run "bundle install --path vendor/bundle" | |
## | |
# Now its generator time | |
# foreman | |
create_file "Procfile", "web: rails server -p $PORT" | |
# Spinach | |
create_file "features/support/env.rb", <<-SPINACH | |
ENV["RAILS_ENV"] ||= 'test'§ | |
require_relative("../../config/environment") | |
require 'spinach-rails' | |
require 'rspec' | |
require 'database_cleaner' | |
DatabaseCleaner.strategy = :truncation | |
Spinach.hooks.before_scenario do | |
DatabaseCleaner.start | |
end | |
Spinach.hooks.after_scenario do | |
DatabaseCleaner.clean | |
end | |
SPINACH | |
# RSpec | |
create_file ".rspec", <<-RSPEC | |
--format Fuubar | |
--colour | |
RSPEC | |
generate "rspec:install --skip" | |
# Guard | |
create_file "Guardfile", <<-GUARDFILE | |
guard 'rspec', :version => 2, :cli => "--format Fuubar" do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) do |m| | |
"spec/lib/\#{m[1]}_spec.rb" | |
end | |
watch('spec/spec_helper.rb') { "spec" } | |
# Rails | |
watch(%r{^app/(.+)\.rb$}) do |m| | |
"spec/\#{m[1]}_spec.rb" | |
end | |
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } | |
end | |
guard 'spinach' do | |
watch(%r|^features/(.*)\.feature|) | |
watch(%r|^features/steps/(.*)([^/]+)\.rb|) do |m| | |
"features/\#{m[1]}\#{m[2]}.feature" | |
end | |
end | |
GUARDFILE | |
# Draper | |
generate "draper:install" | |
# Simple Form | |
generate "simple_form:install --bootstrap" | |
# Home page | |
generate "controller Home index --no-test-framework --no-assets --no-helper" | |
remove_file "config/routes.rb" | |
create_file "config/routes.rb", <<-ROUTES | |
#{app_name.camelize}::Application.routes.draw do | |
root :to => "home#index" | |
end | |
ROUTES | |
# Twitter bootstrap | |
copy_file "bootstrap/stylesheets/bootstrap.css.scss", "vendor/assets/stylesheets/bootstrap.css.scss" | |
copy_file "bootstrap/javascripts/bootstrap.js", "vendor/assets/javascripts/bootstrap.js" | |
copy_file "bootstrap/images/glyphicons-halflings-white.png", "vendor/assets/images/glyphicons-halflings-white.png" | |
copy_file "bootstrap/images/glyphicons-halflings.png", "vendor/assets/images/glyphicons-halflings.png" | |
## | |
# Get your git on | |
append_file '.gitignore', %q{ | |
# Ignore vendor/bundle | |
/vendor/bundle | |
} | |
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