Skip to content

Instantly share code, notes, and snippets.

@UserAd
Created October 14, 2009 10:07
Show Gist options
  • Save UserAd/209948 to your computer and use it in GitHub Desktop.
Save UserAd/209948 to your computer and use it in GitHub Desktop.
# newgit.rb
# from Joao Vitor
# Creates a new rails application using git
# Initializes the git based on the sake task published on
# http://gist.github.com/6750
# task 'git:rails:new_app', :needs => [ 'rails:rm_tmp_dirs', 'git:hold_empty_dirs' ]
# rails:rm_tmp_dirs
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
run("rmdir ./#{f}")
end
# git:hold_empty_dirs
run("find . \\( -type d -empty \\) -and \\( -not -regex ./\\.git.* \\) -exec touch {}/.gitignore \\;")
# git:rails:new_app
git :init
initializer '.gitignore', <<-CODE
log/\\*.log
log/\\*.pid
db/\\*.db
db/\\*.sqlite3
db/schema.rb
tmp/\\*\\*/\\*
.DS_Store
doc/
config/database.yml
CODE
run "rm public/index.html"
run "cp config/database.yml config/database.yml.sample"
#add plugins as submodules
plugin 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git', :submodule => true
plugin 'acl9', :git => 'git://github.com/be9/acl9.git', :submodule => true
plugin 'simple_captcha', :git => 'git://github.com/UserAd/simple_captcha.git', :submodule => true
plugin 'acts_as_commentable', :git => 'git://github.com/UserAd/acts_as_commentable.git', :submodule => true
plugin 'acts_as_rateable', :git => 'git://github.com/UserAd/acts_as_rateable.git', :submodule => true
plugin 'formtastic', :git => 'git://github.com/justinfrench/formtastic.git', :submodule => true
plugin 'jrails', :git => 'git://github.com/aaronchi/jrails.git', :submodule => true
plugin 'xilence', :git => 'git://github.com/inem/xilence.git', :submodule => true
plugin 'thinking-sphinx', :git => 'git://github.com/freelancing-god/thinking-sphinx.git', :submodule => true
plugin 'permalink_fu', :git => 'git://github.com/technoweenie/permalink_fu.git', :submodule => true
plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :submodule => true
plugin 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :submodule => true
#Setup plugins
rake "simple_captcha:setup"
rake "jrails:js:install"
rake "jrails:js:scrub"
#Git stuff
git :add => "."
git :commit => "-a -m 'Setting up a new rails app. Copy config/database.yml.sample to config/database.yml and customize.'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment