Created
September 21, 2010 23:08
-
-
Save adammaddox/590763 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
#example run: rails new app_name -m https://gist.github.com/raw/590763/5e862027c3fb796d1dd0ebd8f67542c6c8b25c79/rails3_template.rb --database=mysql | |
#gems | |
gem 'rails3-generators' | |
gem "haml-rails" | |
gem 'hoptoad_notifier' | |
gem 'json' | |
gem 'simple_form' | |
#image storage | |
gem 'paperclip' | |
gem 'aws-s3' | |
#search | |
gem 'thinking-sphinx', | |
:require => 'thinking_sphinx', | |
:git => "git://github.com/freelancing-god/thinking-sphinx.git", | |
:branch => "rails3" | |
# auth | |
gem 'authlogic', :git => "git://github.com/binarylogic/authlogic.git" | |
#deploy | |
gem 'capistrano' | |
#test | |
gem 'factory_girl', :group => :test | |
gem 'webmock', :group => :test | |
gem 'shoulda', :group => :test | |
gem 'mocha', :group => :test | |
#generators | |
generators = <<-GENERATORS | |
config.generators do |g| | |
g.stylesheets false | |
g.test_framework :shoulda | |
g.fixture_replacement :factory_girl | |
g.template_engine :haml | |
end | |
GENERATORS | |
application generators | |
#remove prototype (or use -J, this is easier for the absent minded) | |
inside('public/javascripts') do | |
FileUtils.rm_rf %w(controls.js dragdrop.js effects.js prototype.js rails.js) | |
end | |
#fetch jquery | |
get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "public/javascripts/jquery.js" | |
get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js", "public/javascripts/jquery-ui.js" | |
get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js" | |
gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(jquery.js jquery-ui.js rails.js)' | |
#sass config, move too app/stylesheets | |
run 'mkdir app/stylesheets' | |
create_file 'app/stylesheets/application.sass' | |
initializer 'sass.rb', <<-CODE | |
Sass::Plugin.options[:template_location] = File.join(Rails.root.to_s, 'app/stylesheets') | |
Sass::Plugin.options[:css_location] = File.join(Rails.root.to_s, 'public/stylesheets') | |
Sass::Plugin.options[:always_update] = true | |
Sass::Plugin.options[:style] = Rails.env == "production" ? :compressed : :nested | |
CODE | |
#dev mailer setup | |
initializer 'mail.rb', <<-CODE | |
ActionMailer::Base.smtp_settings = { | |
:address => "localhost", | |
:port => 1025, | |
:domain => "#{app_name}.com" | |
} | |
CODE | |
#test setup | |
test_helper = <<-TEST_HELPER | |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
require File.expand_path(File.dirname(__FILE__) + "/factories") | |
require 'rails/test_help' | |
require "authlogic/test_case" | |
class ActiveSupport::TestCase | |
self.use_transactional_fixtures = true | |
self.use_instantiated_fixtures = false | |
end | |
def sign_in(user) | |
@controller.stubs(:current_user).returns(user) | |
end | |
def sign_out | |
@controller.stubs(:current_user).returns(nil) | |
end | |
TEST_HELPER | |
remove_file "test/test_helper.rb" | |
create_file "test/test_helper.rb", test_helper | |
create_file "test/factories.rb" | |
#layout | |
layout = <<-CODE | |
!!! | |
%html | |
%head | |
%title #{app_name.humanize} | |
= stylesheet_link_tag :all | |
= javascript_include_tag :defaults | |
= csrf_meta_tag | |
%body | |
= yield | |
CODE | |
remove_file "app/views/layouts/application.html.erb" | |
create_file "app/views/layouts/application.html.haml", layout | |
#remove index` | |
run "rm public/index.html" | |
#setup cap | |
run 'capify .' | |
#bundle | |
run 'bundle' | |
#git | |
gitignore = <<-CODE | |
.DS_Store | |
log/*.log | |
log/*.pid | |
tmp | |
config/database.yml | |
db/*.sqlite3 | |
rerun.txt | |
public/system | |
db/sphinx | |
config/development.sphinx.conf | |
CODE | |
remove_file ".gitignore" | |
create_file ".gitignore", gitignore | |
create_file "log/.gitkeep" | |
create_file "tmp/.gitkeep" | |
git :init | |
git :add => "." | |
git :commit => "-m 'template generated app'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment