Skip to content

Instantly share code, notes, and snippets.

@jnewland
Forked from peterc/gist:33337
Created April 11, 2009 12:24
Show Gist options
  • Save jnewland/93545 to your computer and use it in GitHub Desktop.
Save jnewland/93545 to your computer and use it in GitHub Desktop.
# rails foo_name -m http://gist.github.com/93545.txt
# rake rails:template LOCATION=http://gist.github.com/93545.txt
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
# Set up git repository
git :init
git :add => '.'
# Copy database.yml for distribution use
run "cp config/database.yml config/database.yml.example"
# Set up .gitignore files
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
file '.gitignore', <<-END
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
END
# Install submoduled plugins
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git', :submodule => true
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git', :submodule => true
plugin 'cucumber',
:git => "git://github.com/aslakhellesoy/cucumber.git", :submodule => true
plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git', :submodule => true
plugin 'open_id_authentication', :git => 'git://github.com/rails/open_id_authentication.git', :submodule => true
plugin 'role_requirement', :git => 'git://github.com/timcharper/role_requirement.git', :submodule => true
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
plugin 'acts_as_taggable_redux', :git => 'git://github.com/geemus/acts_as_taggable_redux.git', :submodule => true
plugin 'aasm', :git => 'git://github.com/rubyist/aasm.git', :submodule => true
plugin 'mile_marker', :git => "git://github.com/thoughtbot/mile_marker.git", :submodule => true
# Install all gems
gem 'RedCloth', :lib => 'redcloth', :version => '~> 3.0.4'
gem 'mislav-will_paginate', :version => '~> 2.2.3', :lib => 'will_paginate', :source => 'http://gems.github.com'
gem 'ruby-openid', :lib => 'openid'
gem 'sqlite3-ruby', :lib => 'sqlite3'
gem 'hpricot', :source => 'http://code.whytheluckystiff.net'
gem 'term-ansicolor', :lib => false
gem 'treetop', :lib => false
gem 'diff-lcs', :lib => false
gem 'nokogiri', :lib => false
gem 'builder', :lib => false
rake('gems:install', :sudo => true)
# Set up sessions, RSpec, user model, OpenID, etc, and run migrations
rake('db:sessions:create')
generate('cucumber')
generate("authenticated", "user session")
generate("roles", "Role User")
generate("rspec")
rake('acts_as_taggable:db:create')
rake('open_id_authentication:db:create')
rake('db:migrate')
initializer 'errors.rb',
%q{# Example:
# begin
# some http call
# rescue *HTTP_ERRORS => error
# notify_hoptoad error
# end
HTTP_ERRORS = [Timeout::Error,
Errno::EINVAL,
Errno::ECONNRESET,
EOFError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net::ProtocolError]
SMTP_SERVER_ERRORS = [TimeoutError,
IOError,
Net::SMTPUnknownError,
Net::SMTPServerBusy,
Net::SMTPAuthenticationError]
SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
Net::SMTPSyntaxError]
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
}
initializer 'requires.rb',
%q{require 'redcloth'
Dir[File.join(RAILS_ROOT, 'lib', 'extensions', '*.rb')].each do |f|
require f
end
Dir[File.join(RAILS_ROOT, 'lib', '*.rb')].each do |f|
require f
end
}
# Initialize submodules
git :submodule => "init"
# Commit all work so far to the repository
git :add => '.'
git :commit => "-a -m 'Initial commit'"
# Success!
puts "SUCCESS!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment