Created
August 10, 2010 04:59
-
-
Save mhayes/516708 to your computer and use it in GitHub Desktop.
Rails3 application template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#base_template.rb | |
#sets up basic rails3 application structure with jquery-ujs | |
#remove index page | |
run "rm public/index.html" | |
@jquery_link = "http://code.jquery.com/jquery-1.4.1.min.js" | |
@jquery_ujs_link = "http://github.com/rails/jquery-ujs/raw/master/src/rails.js" | |
#setup Gemfile | |
gem 'devise', '>=1.1.1' | |
gem 'cancan', '>=1.3.2' | |
gem 'nifty-generators' | |
gem 'pg', :group => :production | |
#setup git repo | |
git :init | |
git :add => "." | |
git :commit => "-m 'initial commit'" | |
#migrate db | |
rake "db:migrate" | |
#install bundle | |
run "bundle install" | |
#create home#index page, set as :root | |
generate :controller, "home index" | |
route "root :to => 'home#index'" | |
git :add => "." | |
git :commit => "-m 'added home controller'" | |
#remove default javascript libraries (perhaps this can be done elsewhere???) | |
inside "public/javascripts" do | |
%w(controls dragdrop effects prototype rails).each {|l| run "rm #{l}.js"} | |
end | |
#install jquery, jquery-ujs | |
get @jquery_link, "public/javascripts/jquery.js" | |
get @jquery_ujs_link, "public/javascripts/rails.js" | |
initializer "jquery.rb", <<-CODE | |
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :defaults => ["jquery", "rails"] | |
CODE | |
git :add => "." | |
git :commit => "-m 'added jquery-ujs'" | |
#run nifty-generators nifty:layout | |
run "rm app/views/layouts/application.html.erb" | |
generate "nifty:layout" | |
git :add => "." | |
git :commit => "-m 'setup default styles with nifty:layout'" | |
#run devise setup, create user | |
generate "devise:install" | |
inject_into_file "config/environments/development.rb", :after => "config.active_support.deprecation = :log\n" do | |
" config.action_mailer.default_url_options = { :host => 'localhost:3000' }\n" | |
end | |
git :add => "." | |
git :commit => "-m 'setup devise'" | |
#setup user model | |
generate :devise, "user" | |
rake "db:migrate" | |
git :add => "." | |
git :commit => "-m 'setup devise user model'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment