Skip to content

Instantly share code, notes, and snippets.

@jhenry
Created September 16, 2009 03:01
Show Gist options
  • Save jhenry/187839 to your computer and use it in GitHub Desktop.
Save jhenry/187839 to your computer and use it in GitHub Desktop.
rails template with testing harnesses, jquery, etc
# Clear out stuff we won't use
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
run "rm -rf test/"
# Create the readme file
run "echo TODO: Explain yourself! > README.markdown"
# Get latest jQuery and jQuery UI
# TODO figure out best way to pull latest stable jQuery libs
# Create the gitignore
file ".gitignore", <<-END
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
END
run "cp config/database.yml config/example_database.yml"
# In case of sudo, break glass
SUDO_CMD = yes?("Does gem installation require sudo on your system? (yes/no)") ? "true" : "false"
# Setup the testing harnesses
gem "rspec", :lib => false, :environment => :test
gem "cucumber", :lib => false, :environment => :test
gem "webrat", :lib => false, :environment => :test
gem "rspec-rails", :lib => false, :environment => :test
gem "thoughtbot-factory_girl", :lib => "factory_girl", :source => "http://gems.github.com", :environment => :test
# Setup some other gems
gem "haml"
gem "binarylogic-searchlogic", :lib => 'searchlogic', :source => 'http://gems.github.com'
gem "stringex"
rake "gems:install", :sudo => SUDO_CMD
# Generate haml plugin, and a default layout
run 'haml --rails .'
file 'app/views/layouts/application.html.haml', <<-HAML
!!!
%html
%head
%meta{ :content => "text/html; charset=utf-8", "http-equiv" => "content-type" }
%title The New Hotness
%script{:src => "http://www.google.com/jsapi", :type => "text/
javascript"}
%script
google.load("jquery");
google.load("jqueryui");
%body
= yield
HAML
# Generate test harness
generate (:cucumber)
generate (:rspec)
# TODO: set up webrat matchers in rspec
# Pre-Game factory_girl
run 'touch spec/factories.rb'
# TODO: this needs to be appended to environment.rb,
# instead of landing inside of Initializer.run
environment 'Haml::Template.options[:format] = :html5'
# Create cucumber.yml
run "echo default: features -r features -t ~ignore > cucumber.yml"
git :init
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