Skip to content

Instantly share code, notes, and snippets.

@domwom
Created May 9, 2009 21:54
Show Gist options
  • Save domwom/109413 to your computer and use it in GitHub Desktop.
Save domwom/109413 to your computer and use it in GitHub Desktop.
rails_templates
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
gitignoreItems = %w(
.DS_Store
log/*.log
tmp/**/*
config/deploy.rb
config/database.yml
db/*.sqlite3
Capfile
)
# Set up git repository
git :init
# Download JQuery
if yes?("Download Jquery-1.3.2 to public/javascript? (y/N)")
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js"
run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
end
# depify Project
if yes?("Do you want to use Capistrano?")
if yes?("On top of that, do you want to use deprec?")
run 'depify .'
else
run 'capify .'
end
run "cp config/deploy.rb config/deploy.rb.example" #Copy ignored deploy.rb to example
gitignoreItems << "Capfile" << "config/deploy.rb"
end
# Copy ignored database.yml to example
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', gitignoreItems.join("\n")
# Install submoduled plugins
if yes?("Do you want to use RSpec? (y/n)")
plugin "rspec", :git => "git://github.com/dchelimsky/rspec.git", :submodule => true
plugin "rspec-rails", :git => "git://github.com/dchelimsky/rspec-rails.git", :submodule => true
generate :rspec
end
if yes?("Do you want to use Cucumber? (y/n)")
plugin "cucumber",:git => "git://github.com/aslakhellesoy/cucumber.git", :submodule => true
generate :cucumber
end
if yes?("Do you want to use Webrat? (y/n)")
plugin "webrat",:git => "git://github.com/brynary/webrat.git", :submodule => true
end
if yes?("Do you want to use Mocha? (y/n)")
plugin "mocha", :git => "git://github.com/floehopper/mocha.git", :submodule => true
end
if yes?("Do you want to use restful-authentication? (y/n)")
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
end
# Initialize submodules
git :submodule => "init"
# Commit all work so far to the repository
git :add => '.'
git :commit => "-a -m 'Initial Rails import.'"
# Success!
puts "SUCCESS!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment