Skip to content

Instantly share code, notes, and snippets.

@elmariofredo
Created June 5, 2010 21:11
Show Gist options
  • Save elmariofredo/427005 to your computer and use it in GitHub Desktop.
Save elmariofredo/427005 to your computer and use it in GitHub Desktop.
# Rails 3 bootstrap
# run with
# git clone git://gist.github.com/427005.git && bash "427005/Rails 3 Bootstrap.sh" && rm -rf 427005
# Setup gems
cat > Gemfile <<EOF
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
# Haml and Sass - templating engines
# > http://github.com/nex3/haml
gem "haml"
# MySQL API module for Ruby
# > http://rubygems.org/gems/mysql
gem "mysql"
# A collection of useful Rails generator scripts for scaffolding, layout files, authentication, and more.
# > http://github.com/ryanb/nifty-generators
gem "nifty-generators"
# A set of Rails 3 responders to dry up your application
# > http://github.com/plataformatec/responders
gem "responders"
# Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
# > http://github.com/plataformatec/simple_form
gem "simple_form"
group :development do
# Rails 3 compatible generators for DataMapper, Haml, Factory-girl, Authlogic, Mongomapper, Shoulda, Formtastic and SimpleForm
# > http://github.com/indirect/rails3-generators
gem "rails3-generators"
end
group :test do
# Shoulda - Making tests easy on the fingers and eyes
# > http://github.com/thoughtbot/shoulda
gem "shoulda"
# factory_girl - Fixtures replacement
# > http://github.com/thoughtbot/factory_girl
gem "factory_girl"
end
EOF
bundle install
rails generate responders:install
rails generate simple_form:install
# Install jQuery
curl -L http://code.jquery.com/jquery-latest.min.js > public/javascripts/jquery.js
curl -L http://github.com/rails/jquery-ujs/raw/master/src/rails.js > public/javascripts/rails.js
cd public/javascripts
rm -rf controls.js dragdrop.js effects.js prototype.js rails.js
cd ../..
cat > config/initializers/jquery.rb <<EOF
# Switch the javascript_include_tag :defaults to use jQuery instead of
# the default prototype helpers.
# Credits: http://webtech.union.rpi.edu/blog/2010/02/21/jquery-and-rails-3/
# $RAILS_ROOT/config/initializers/jquery.rb
if ActionView::Helpers::AssetTagHelper.const_defined?(:JAVASCRIPT_DEFAULT_SOURCES)
ActionView::Helpers::AssetTagHelper.send(:remove_const, "JAVASCRIPT_DEFAULT_SOURCES")
end
ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery', 'rails']
ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
EOF
# Install HAML
#haml --rails .
# Cleanup+gitinit
rm public/index.html
rm public/images/rails.png
git init
git commit -a -m "create basic rails application"
git add .
echo """
Don't forget configure your generators
config.generators do |g|
g.template_engine :haml
g.stylesheets false
g.test_framework :shoulda
g.fallbacks[ :shoulda ] = :test_unit
g.ficture_replacement :factory_girl
end
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment