Skip to content

Instantly share code, notes, and snippets.

@azisaka
Created October 18, 2010 04:01
Show Gist options
  • Save azisaka/631684 to your computer and use it in GitHub Desktop.
Save azisaka/631684 to your computer and use it in GitHub Desktop.
My Rails 3 template for basic projects
gem 'autotest', :group => :test
gem 'capybara', :group => :test
gem 'cucumber', :group => :test
gem 'cucumber-rails', :group => :test
gem 'database_cleaner', :group => :test
gem 'factory_girl', :group => :test
gem 'haml'
gem 'haml-rails'
gem 'jammit'
gem 'jquery-rails'
gem 'launchy', :group => :test
gem 'rr', :group => :test
gem 'rspec-rails', :group => :test
gem 'ruby-debug', :group => :test
run 'bundle install'
remove_file 'README'
remove_file 'app/views/layouts/application.html.erb'
remove_file 'doc/README_FOR_APP'
remove_file 'public/index.html'
remove_file 'public/favicon.ico'
remove_file 'public/images/rails.png'
run 'rm -rf public/javascripts/*'
remove_dir 'test'
remove_dir 'vendor'
create_file 'README'
empty_directory 'public/stylesheets/sass'
create_file 'public/stylesheets/sass/application.sass'
create_file 'public/javascripts/application.js' do
%q{var App = {
init: function() {
}
};
$(function() {
App.init();
});
}
end
create_file 'config/assets.yml' do
%q{
embed_assets: on
javascripts:
base:
- public/javascripts/jquery.js
- public/javascripts/rails.js
- public/javascripts/application.js
stylesheets:
base:
- public/stylesheets/application.css
}
end
inject_into_file('config/application.rb', :after => "class Application < Rails::Application") do
%q{
config.generators do |g|
g.test_framework :rspec, :fixture => false, :views => false
g.fixture_replacement :factory_girl, :dir => "spec/support/factories"
end
}
end
create_file 'app/views/layouts/application.html.haml' do
%q{!!!
%html
%head
%title Title
= include_stylesheets :base
= include_javascripts :base
= csrf_meta_tag
%body
= yield
}
end
generate('rspec:install')
generate('cucumber:install', '--rspec --capybara')
generate('jquery:install')
remove_file 'public/javascripts/jquery.min.js'
remove_file 'spec/spec_helper.rb'
create_file 'spec/spec_helper.rb' do
%q{ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.mock_with :rr
end
}
end
empty_directory 'spec/support'
create_file 'spec/support/factories.rb'
append_file '.gitignore', 'config/database.yml'
git :init
git :add => '.'
git :commit => '-am "Ready to go!"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment