Skip to content

Instantly share code, notes, and snippets.

@jcf
Created January 2, 2010 22:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jcf/267699 to your computer and use it in GitHub Desktop.
Save jcf/267699 to your computer and use it in GitHub Desktop.
Rails template with RSpec, jQuery, Compass (HAML/SASS) and more.
git :init
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 'exception_notifier',
:git => 'git://github.com/rails/exception_notification.git',
:submodule => true
plugin 'open_id_authentication',
:git => 'git://github.com/rails/open_id_authentication.git',
:submodule => true
plugin 'jammit',
:git => 'git://github.com/jcf/jammit.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 'quietbacktrace',
:git => 'git://github.com/thoughtbot/quietbacktrace.git',
:submodule => true
git :submodule => 'init'
generate('rspec')
gem 'ruby-openid'
gem 'rubyist-aasm'
gem 'will-paginate'
run 'rm README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/robots.txt'
run 'rm public/images/rails.png'
run 'rm public/javascripts/*.js'
run 'touch public/javascripts/application.js'
run 'curl -L http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js > public/javascripts/lib/jquery-1.3.2.js'
run 'compass --rails -f blueprint --sass-dir app/stylesheets --css-dir public/stylesheets -q .'
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', <<-PLAIN
.DS_Store
config/database.yml
coverage/*
db/*.sqlite3
log/*.log
tmp/**/*
PLAIN
file '.autotest', <<-RUBY
require 'autotest/growl'
require 'autotest/fsevent'
Autotest::Growl::show_modified_files = true
Autotest.add_hook :initialize do |autotest|
%w( .git .svn .hg .DS_Store ._* log ).map do |exception|
autotest.add_exception(exception)
end
end
RUBY
file 'app/helpers/application_helper.rb', <<-RUBY
module ApplicationHelper
def render_flash
flash_to_render = [:success, :failure, :notice]
flash.select { |type, _| flash_to_render.include?(type) }.map do |type, content|
content_tag(:div, content, :class => "flash \#{type}")
end.join
end
end
RUBY
file 'app/views/layouts/application.html.haml', <<-HAML
%html
%head
%title Application Title
%link{ :rel => 'icon', :href => 'http://www.gravatar.com/avatar/18c2795810ee15d41956e7f4cc5f3338?s=16' }
= stylesheet_link_tag 'screen.css', :media => 'screen, projection'
= stylesheet_link_tag 'print.css', :media => 'print'
/[if IE]
= stylesheet_link_tag 'ie.css', :media => 'screen, projection'
%body.bp
#content
= render_flash
= yield
HAML
file 'config/assets.yml', <<-YAML
package_assets: on
embed_images: off
package_path: packaged
compressor_options:
line_break: 0
javascripts:
global:
- public/javascripts/lib/jquery-1.3.2.js
- public/javascripts/application.js
YAML
append_file 'spec/spec_helper.rb', <<-EOS.gsub(/^ /, '')
# When running specs in TextMate, provide an rputs method to cleanly print objects into HTML display
# From http://talklikeaduck.denhaven2.com/2009/09/23/rspec-textmate-pro-tip
module Kernel
if ENV.keys.find {|env_var| env_var.start_with?("TM_")}
def rputs(*args)
puts( *["<pre>", args.collect {|a| CGI.escapeHTML(a.to_s)}, "</pre>"])
end
else
alias_method :rputs, :puts
end
end
EOS
git :add => '.'
git :commit => "-a -m 'Initial commit'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment