Skip to content

Instantly share code, notes, and snippets.

@davidrichards
Forked from paulmars/template.rb
Created May 25, 2011 18:20
Show Gist options
  • Save davidrichards/991544 to your computer and use it in GitHub Desktop.
Save davidrichards/991544 to your computer and use it in GitHub Desktop.

Revisions

  1. David Richards revised this gist Sep 28, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@
    g.stylesheets false
    g.template_engine :haml
    g.test_framework :rspec, :fixture => true, :views => false
    g.fixture_replacement :factory_girl, :dir => "spec/support/factories"
    g.fixture_replacement :factory_girl, :dir => "spec/factories"
    end
    # Global Sass Option
  2. David Richards revised this gist Sep 26, 2011. 1 changed file with 92 additions and 13 deletions.
    105 changes: 92 additions & 13 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,20 @@
    ## Rails App Template
    ## Updated for Rails 3.0.7
    ## Created on 10/23/10
    ## Updated on 5/25/11 to simplify for my own use
    ## Useful for Rails 3.0.x and Ruby 1.9.2
    ## Run using $ rails new [appname] -JT -m tpl-basicapp.rb

    ## Gems
    # ========
    # = Gems =
    # ========

    # pre-install spork, dydram and elastic_searchable
    run "gem install spork -v 0.9.0.rc --pre"
    run "gem install dydra elastic_searchable"

    # Warden and Devise for security
    gem 'warden', '1.0.5'
    gem 'devise', '1.4.4'
    # gem 'warden', '1.0.5'
    # gem 'devise', '1.4.4'
    gem 'warden'
    gem 'devise'

    # HAML and SASS for Templating
    gem 'sass'
    @@ -18,24 +24,41 @@
    # Barista for CoffeeScript
    gem 'barista'

    # Because I'm addicted to the debugger:
    gem "ruby-debug19"

    # Testing
    gem "rspec-rails", ">= 2.5.0", :group => [:test]
    gem "factory_girl_rails", :group => [:test]
    gem "spork", ">= 0.9.0.rc", :group => [:test]
    gem "spork", :group => [:test]
    gem "jasmine", :group => [:test]
    gem "faker", :group => [:test]
    gem "redgreen", :group => [:test]
    gem "autotest", :group => [:test]
    gem "autotest-fsevent", :group => [:test]
    gem "autotest-growl", :group => [:test]

    # development
    # Development
    gem 'rails3-generators', '0.17.4', :group => [:development]

    # Test and Development
    gem "jasmine-headless-webkit", :group => [:test, :development]
    gem "guard", :group => [:test, :development]
    gem "guard-coffeescript", :group => [:test, :development]
    gem "guard-jasmine-headless-webkit", :group => [:test, :development]
    gem 'growl_notify', :group => [:test, :development]
    gem 'rb-fsevent', :require => false, :group => [:test, :development]

    # all
    gem "jammit"

    ## Generators
    inject_into_file 'Gemfile', :after => %q[gem "jammit"] do
    %q{
    gem "dydra"
    gem "elastic_searchable"
    }
    end

    ## Generators
    inject_into_file('config/application.rb', :after => "config.filter_parameters += [:password]") do
    %q{
    config.generators do |g|
    @@ -66,15 +89,15 @@
    get "login", :to => "devise/sessions#new"
    get "logout", :to => "devise/sessions#destroy"
    end
    resources :welcome
    ROUTES
    route routes

    # Clear the default index
    remove_file "public/index.html"
    remove_file "public/images/rails.png"
    # Make a blank application javascript file
    remove_file "public/javascripts/application.js"
    create_file "app/coffeescripts/application.coffee"
    # Make the SASS directory and base file
    empty_directory "app/stylesheets"
    default_style = <<-LAYOUT
    @@ -135,6 +158,62 @@
    empty_directory "app/coffeescripts/routers"
    empty_directory "app/coffeescripts/views"

    ## welcome router
    welcome_router = <<-WELCOME
    window.App.Routers.Welcome = Backbone.Router.extend
    routes:
    "": "index"
    index: ->
    new window.App.Views.Welcome()
    WELCOME
    create_file "app/coffeescripts/routers/Welcome.coffee", welcome_router

    ## welcome view
    welcome_view = <<-WELCOME
    window.App.Views.Index = Backbone.View.extend
    el: '#content'
    initialize: ->
    _.bindAll this, 'render'
    @render()
    render: ->
    $(@el).html JST['welcome/index']()
    @
    WELCOME
    create_file "app/coffeescripts/views/welcome/Index.coffee", welcome_view

    ## welcome template
    welcome_template = <<-WELCOME
    Welcome to this new application. We are so proud of this application. Look around and see what you can find. Soon, this page will be replaced with work that is worthwhile and exciting. In the meantime, welcome, welcome, welcome.
    WELCOME
    create_file "app/views/welcome/index.jst.haml", welcome_template

    ## application.js
    application_js = <<-JS
    window.App =
    Models: {}
    Routers: {}
    Collections: {}
    Views:
    Welcome: {}
    init: ->
    new window.App.Routers.Welcome()
    Backbone.history.start()
    $(->
    window.App.init()
    )
    JS

    remove_file "public/javascripts/application.js"
    create_file "app/coffeescripts/application.coffee", application_js

    # Javascript Assets
    get "http://documentcloud.github.com/underscore/underscore-min.js", "public/javascripts/vendor/underscore-min.js"
    get "http://documentcloud.github.com/backbone/backbone-min.js", "public/javascripts/vendor/backbone-min.js"
  3. David Richards revised this gist Sep 3, 2011. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,9 @@
    gem 'haml'
    gem 'haml-rails'

    # Barista for CoffeeScript
    gem 'barista'

    # Testing
    gem "rspec-rails", ">= 2.5.0", :group => [:test]
    gem "factory_girl_rails", :group => [:test]
    @@ -50,11 +53,11 @@
    # Latest jQuery UJS
    # get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/vendor/rails.js"
    # HACK: Since the get method hates https and redirects
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    create_file "public/javascripts/vendor/rails.js", jquery
    # jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    # create_file "public/javascripts/vendor/rails.js", jquery

    # Replace the blank one with jQuery served via Google CDN
    gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'
    # gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'

    ## Devise routes
    routes = <<-ROUTES
    @@ -71,7 +74,7 @@
    remove_file "public/images/rails.png"
    # Make a blank application javascript file
    remove_file "public/javascripts/application.js"
    create_file "app/coffeescripts/application.js"
    create_file "app/coffeescripts/application.coffee"
    # Make the SASS directory and base file
    empty_directory "app/stylesheets"
    default_style = <<-LAYOUT
    @@ -136,7 +139,7 @@
    get "http://documentcloud.github.com/underscore/underscore-min.js", "public/javascripts/vendor/underscore-min.js"
    get "http://documentcloud.github.com/backbone/backbone-min.js", "public/javascripts/vendor/backbone-min.js"
    # HACK again
    haml_js = open("https://github.com/creationix/haml-js/blob/master/lib/haml.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    haml_js = open("https://raw.github.com/creationix/haml-js/master/lib/haml.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    create_file "public/javascripts/vendor/haml.js", haml_js

    ## Jammit assets
  4. David Richards revised this gist Sep 3, 2011. 1 changed file with 14 additions and 15 deletions.
    29 changes: 14 additions & 15 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -56,20 +56,6 @@
    # Replace the blank one with jQuery served via Google CDN
    gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'

    # Run all the generators
    generate "rspec:install"
    generate "devise:install"
    generate "devise:views"
    generate "devise User"

    # Setup a basic Welcome Controller as the default route
    generate "controller Welcome index"
    inject_into_file('config/routes.rb', :after => %[root :to => "welcome#index"]) do
    %q{
    root :to => "welcome#index"
    }
    end

    ## Devise routes
    routes = <<-ROUTES
    devise_scope :user do
    @@ -180,7 +166,6 @@
    create_file "config/assets.yml", assets

    ## Git

    gitignore = <<-END
    .bundle
    .DS_Store
    @@ -198,5 +183,19 @@
    run "bundle install"
    run "rake db:migrate"

    # Run all the generators
    generate "rspec:install"
    generate "devise:install"
    generate "devise:views"
    generate "devise User"

    # Setup a basic Welcome Controller as the default route
    generate "controller Welcome index"
    inject_into_file('config/routes.rb', :after => %[root :to => "welcome#index"]) do
    %q{
    root :to => "welcome#index"
    }
    end

    git :init
    git :add => "."
  5. David Richards revised this gist Sep 3, 2011. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@
    ## Gems

    # Warden and Devise for security
    gem 'warden', '1.0.4'
    gem 'devise', '1.3.0'
    gem 'warden', '1.0.5'
    gem 'devise', '1.4.4'

    # HAML and SASS for Templating
    gem 'sass'
    @@ -149,8 +149,9 @@
    # Javascript Assets
    get "http://documentcloud.github.com/underscore/underscore-min.js", "public/javascripts/vendor/underscore-min.js"
    get "http://documentcloud.github.com/backbone/backbone-min.js", "public/javascripts/vendor/backbone-min.js"
    get "https://github.com/creationix/haml-js/blob/master/lib/haml.js",
    "public/javascripts/vendor/haml.js"
    # HACK again
    haml_js = open("https://github.com/creationix/haml-js/blob/master/lib/haml.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    create_file "public/javascripts/vendor/haml.js", haml_js

    ## Jammit assets
    assets = <<-ASSETS
  6. David Richards revised this gist Sep 3, 2011. 1 changed file with 37 additions and 82 deletions.
    119 changes: 37 additions & 82 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -48,10 +48,10 @@
    end

    # Latest jQuery UJS
    # get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
    # get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/vendor/rails.js"
    # HACK: Since the get method hates https and redirects
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    create_file "public/javascripts/rails.js", jquery
    create_file "public/javascripts/vendor/rails.js", jquery

    # Replace the blank one with jQuery served via Google CDN
    gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'
    @@ -80,55 +80,12 @@
    ROUTES
    route routes

    ## Login files
    # signin = <<-SIGNIN
    # <h2>Login</h2>
    #
    # <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    # <%= f.inputs do %>
    # <%= f.input :email, :as => :email %>
    # <%= f.input :password, :as => :password %>
    # <% if devise_mapping.rememberable? -%>
    # <%= f.input :remember_me, :as => :boolean %>
    # <% end -%>
    # <% end %>
    # <%= f.buttons do %>
    # <%= f.commit_button "Login" %>
    # <% end %>
    # <% end %>
    #
    # <%= render :partial => "devise/shared/links" %>
    # SIGNIN
    #
    # remove_file "app/views/devise/sessions/new.html.erb"
    # create_file "app/views/devise/sessions/new.html.erb", signin

    # signup = <<-SIGNUP
    # <h2>Signup</h2>
    #
    # <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    # <%= devise_error_messages! %>
    # <%= f.inputs do %>
    # <%= f.input :email, :as => :email %>
    # <%= f.input :password, :as => :password %>
    # <% end %>
    # <%= f.buttons do %>
    # <%= f.commit_button "Signup" %>
    # <% end %>
    # <% end %>
    #
    # <%= render :partial => "devise/shared/links" %>
    # SIGNUP
    #
    # remove_file "app/views/devise/registrations/new.html.erb"
    # create_file "app/views/devise/registrations/new.html.erb", signup

    # Clear the default index
    remove_file "public/index.html"
    remove_file "public/images/rails.png"
    # Make a blank application javascript file
    remove_file "public/javascripts/application.js"
    create_file "public/javascripts/application.js"
    create_file "app/coffeescripts/application.js"
    # Make the SASS directory and base file
    empty_directory "app/stylesheets"
    default_style = <<-LAYOUT
    @@ -156,69 +113,66 @@
    ## Layout

    layout = <<-LAYOUT
    !!!
    %html
    !!! 5
    %html{:lang => "en"}
    %head
    %title #{app_name.humanize}
    = stylesheet_link_tag :all
    = javascript_include_tag :defaults
    = csrf_meta_tag
    %body#doc
    .hd
    %ol.login-bar.horizontal-list
    - if !user_signed_in?
    %li= link_to "Login", login_url
    %li= link_to "Signup", signup_url
    - else
    %li= current_user.email
    %li= link_to "Logout", logout_url
    %h1 #{app_name.humanize}
    .bd
    %meta{:charset => "utf-8"}/
    %title Stella
    /[if IE]
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    = include_stylesheets :app, :media => 'all'
    = include_javascripts :app
    - unless Jammit.package_assets
    = javascript_tag(Jammit.packager.pack_templates(:templates_js))
    = csrf_meta_tag
    %body
    - yield_body = yield(:body)
    - if yield_body.blank?
    = yield
    .ft
    - else
    = yield_body
    %footer
    LAYOUT
    remove_file "app/views/layouts/application.html.erb"
    create_file "app/views/layouts/application.html.haml", layout

    ## Backbone Directory Structure
    empty_directory "public/javascripts/vendor"
    empty_directory "public/javascripts/models"
    empty_directory "public/javascripts/collections"
    empty_directory "public/javascripts/controllers"
    empty_directory "public/javascripts/views"
    empty_directory "app/coffeescripts/models"
    empty_directory "app/coffeescripts/collections"
    empty_directory "app/coffeescripts/routers"
    empty_directory "app/coffeescripts/views"

    # Javascript Assets
    get "http://documentcloud.github.com/underscore/underscore-min.js", "public/javascripts/vendor/underscore-min.js"
    get "http://documentcloud.github.com/backbone/backbone-min.js", "public/javascripts/vendor/backbone-min.js"
    get "https://github.com/creationix/haml-js/blob/master/lib/haml.js",
    "public/javascripts/vendor/haml.js"

    ## Jammit assets
    assets = <<-ASSETS
    package_assets: off
    template_function: _.template
    template_extension: jst.haml
    template_function: Haml
    javascripts:
    app:
    # - public/javascripts/vendor/excanvas.js
    - public/javascripts/vendor/jquery.min.js
    - public/javascripts/vendor/jquery-ui.min.js
    # - public/javascripts/vendor/jquery.jsPlumb-1.2.5-all-min.js
    - public/javascripts/vendor/jquery.js
    - public/javascripts/vendor/underscore-min.js
    - public/javascripts/vendor/backbone-min.js
    - public/javascripts/vendor/autoresize.jquery.js
    - public/javascripts/application.js
    - public/javascripts/vendor/jquery.dotimeout.js
    # - public/javascripts/models/Node.js
    - public/javascripts/vendor/haml.js
    - public/javascripts/models/*.js
    - public/javascripts/**/*.js
    - app/views/**/*.jst
    - app/views/**/*.jst.haml
    templates_js:
    - app/views/**/*.jst
    - app/views/**/*.jst.haml
    stylesheets:
    app:
    - public/stylesheets/reset.css
    - public/stylesheets/mixins.css
    - public/stylesheets/*.css
    - public/stylesheets/style.css
    ASSETS

    remove_file "config/assets.yml"
    @@ -233,6 +187,7 @@
    log/*.log
    tmp/**/*
    public/stylesheets/*
    .rvmrc
    END

    # Re-Make gitignore
  7. David Richards revised this gist May 25, 2011. 1 changed file with 45 additions and 42 deletions.
    87 changes: 45 additions & 42 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -81,47 +81,47 @@
    route routes

    ## Login files
    signin = <<-SIGNIN
    <h2>Login</h2>
    <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <%= f.inputs do %>
    <%= f.input :email, :as => :email %>
    <%= f.input :password, :as => :password %>
    <% if devise_mapping.rememberable? -%>
    <%= f.input :remember_me, :as => :boolean %>
    <% end -%>
    <% end %>
    <%= f.buttons do %>
    <%= f.commit_button "Login" %>
    <% end %>
    <% end %>
    <%= render :partial => "devise/shared/links" %>
    SIGNIN

    remove_file "app/views/devise/sessions/new.html.erb"
    create_file "app/views/devise/sessions/new.html.erb", signin

    signup = <<-SIGNUP
    <h2>Signup</h2>
    <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    <%= devise_error_messages! %>
    <%= f.inputs do %>
    <%= f.input :email, :as => :email %>
    <%= f.input :password, :as => :password %>
    <% end %>
    <%= f.buttons do %>
    <%= f.commit_button "Signup" %>
    <% end %>
    <% end %>
    <%= render :partial => "devise/shared/links" %>
    SIGNUP

    remove_file "app/views/devise/registrations/new.html.erb"
    create_file "app/views/devise/registrations/new.html.erb", signup
    # signin = <<-SIGNIN
    # <h2>Login</h2>
    #
    # <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    # <%= f.inputs do %>
    # <%= f.input :email, :as => :email %>
    # <%= f.input :password, :as => :password %>
    # <% if devise_mapping.rememberable? -%>
    # <%= f.input :remember_me, :as => :boolean %>
    # <% end -%>
    # <% end %>
    # <%= f.buttons do %>
    # <%= f.commit_button "Login" %>
    # <% end %>
    # <% end %>
    #
    # <%= render :partial => "devise/shared/links" %>
    # SIGNIN
    #
    # remove_file "app/views/devise/sessions/new.html.erb"
    # create_file "app/views/devise/sessions/new.html.erb", signin

    # signup = <<-SIGNUP
    # <h2>Signup</h2>
    #
    # <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    # <%= devise_error_messages! %>
    # <%= f.inputs do %>
    # <%= f.input :email, :as => :email %>
    # <%= f.input :password, :as => :password %>
    # <% end %>
    # <%= f.buttons do %>
    # <%= f.commit_button "Signup" %>
    # <% end %>
    # <% end %>
    #
    # <%= render :partial => "devise/shared/links" %>
    # SIGNUP
    #
    # remove_file "app/views/devise/registrations/new.html.erb"
    # create_file "app/views/devise/registrations/new.html.erb", signup

    # Clear the default index
    remove_file "public/index.html"
    @@ -170,7 +170,7 @@
    %li= link_to "Login", login_url
    %li= link_to "Signup", signup_url
    - else
    %li= current_user.name
    %li= current_user.email
    %li= link_to "Logout", logout_url
    %h1 #{app_name.humanize}
    .bd
    @@ -221,6 +221,9 @@
    ASSETS

    remove_file "config/assets.yml"
    create_file "config/assets.yml", assets

    ## Git

    gitignore = <<-END
  8. David Richards revised this gist May 25, 2011. 1 changed file with 50 additions and 3 deletions.
    53 changes: 50 additions & 3 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,6 @@
    ## Created on 10/23/10
    ## Updated on 5/25/11 to simplify for my own use
    ## Run using $ rails new [appname] -JT -m tpl-basicapp.rb
    ## WIP: give me a few hours before using this (5/25/11 12:00 Pacific)

    ## Gems

    @@ -30,7 +29,7 @@
    gem 'rails3-generators', '0.17.4', :group => [:development]

    # all
    gem 'sqlite3'
    gem "jammit"

    ## Generators

    @@ -63,6 +62,14 @@
    generate "devise:views"
    generate "devise User"

    # Setup a basic Welcome Controller as the default route
    generate "controller Welcome index"
    inject_into_file('config/routes.rb', :after => %[root :to => "welcome#index"]) do
    %q{
    root :to => "welcome#index"
    }
    end

    ## Devise routes
    routes = <<-ROUTES
    devise_scope :user do
    @@ -153,7 +160,6 @@
    %html
    %head
    %title #{app_name.humanize}
    = stylesheet_link_tag "http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css"
    = stylesheet_link_tag :all
    = javascript_include_tag :defaults
    = csrf_meta_tag
    @@ -174,6 +180,47 @@
    remove_file "app/views/layouts/application.html.erb"
    create_file "app/views/layouts/application.html.haml", layout

    ## Backbone Directory Structure
    empty_directory "public/javascripts/vendor"
    empty_directory "public/javascripts/models"
    empty_directory "public/javascripts/collections"
    empty_directory "public/javascripts/controllers"
    empty_directory "public/javascripts/views"

    # Javascript Assets
    get "http://documentcloud.github.com/underscore/underscore-min.js", "public/javascripts/vendor/underscore-min.js"
    get "http://documentcloud.github.com/backbone/backbone-min.js", "public/javascripts/vendor/backbone-min.js"

    ## Jammit assets
    assets = <<-ASSETS
    package_assets: off
    template_function: _.template
    javascripts:
    app:
    # - public/javascripts/vendor/excanvas.js
    - public/javascripts/vendor/jquery.min.js
    - public/javascripts/vendor/jquery-ui.min.js
    # - public/javascripts/vendor/jquery.jsPlumb-1.2.5-all-min.js
    - public/javascripts/vendor/underscore-min.js
    - public/javascripts/vendor/backbone-min.js
    - public/javascripts/vendor/autoresize.jquery.js
    - public/javascripts/application.js
    - public/javascripts/vendor/jquery.dotimeout.js
    # - public/javascripts/models/Node.js
    - public/javascripts/models/*.js
    - public/javascripts/**/*.js
    - app/views/**/*.jst
    templates_js:
    - app/views/**/*.jst
    stylesheets:
    app:
    - public/stylesheets/reset.css
    - public/stylesheets/mixins.css
    - public/stylesheets/*.css
    ASSETS

    ## Git

    gitignore = <<-END
  9. David Richards revised this gist May 25, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@
    ## Created on 10/23/10
    ## Updated on 5/25/11 to simplify for my own use
    ## Run using $ rails new [appname] -JT -m tpl-basicapp.rb
    ## WIP: give me a few hours before using this (5/25/11 12:00 Pacific)

    ## Gems

  10. David Richards revised this gist May 25, 2011. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -17,8 +17,6 @@

    # Testing
    gem "rspec-rails", ">= 2.5.0", :group => [:test]
    gem "cucumber-rails", ">= 0.4.1", :group => [:test]
    gem "capybara", :group => [:test]
    gem "factory_girl_rails", :group => [:test]
    gem "spork", ">= 0.9.0.rc", :group => [:test]
    gem "jasmine", :group => [:test]
    @@ -52,7 +50,7 @@
    # Latest jQuery UJS
    # get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
    # HACK: Since the get method hates https and redirects
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js").read
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
    create_file "public/javascripts/rails.js", jquery

    # Replace the blank one with jQuery served via Google CDN
  11. David Richards renamed this gist May 25, 2011. 1 changed file with 16 additions and 21 deletions.
    37 changes: 16 additions & 21 deletions tpl-cukeapp.rb → tpl-basicapp.rb
    Original file line number Diff line number Diff line change
    @@ -1,40 +1,37 @@
    ## Rails App Template
    ## Updated for Rails 3.0.7
    ## Created on 10/23/10
    ## Updated on 5/7/11
    ## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb
    ## Updated on 5/25/11 to simplify for my own use
    ## Run using $ rails new [appname] -JT -m tpl-basicapp.rb

    ## Gems

    # Warden and Devise for security
    gem 'warden', '1.0.4'
    gem 'devise', '1.3.0'

    # Extra Plugins
    gem 'formtastic', '1.2.3'
    gem 'escape_utils'

    # HAML and SASS for Templating
    gem 'sass'
    gem 'haml'
    gem 'haml-rails'

    # Cucumber and Friends
    gem "rspec-rails", ">= 2.5.0", :group => [:test, :cucumber]
    gem "cucumber-rails", ">= 0.4.1", :group => [:test, :cucumber]
    gem "capybara", :group => [:test, :cucumber]
    gem "database_cleaner", :group => [:test, :cucumber]
    gem "factory_girl_rails", :group => [:test, :cucumber]
    gem "launchy", ">= 0.3.7", :group => [:test, :cucumber]
    gem "spork", ">= 0.8.4", :group => [:test, :cucumber]
    # Testing
    gem "rspec-rails", ">= 2.5.0", :group => [:test]
    gem "cucumber-rails", ">= 0.4.1", :group => [:test]
    gem "capybara", :group => [:test]
    gem "factory_girl_rails", :group => [:test]
    gem "spork", ">= 0.9.0.rc", :group => [:test]
    gem "jasmine", :group => [:test]
    gem "faker", :group => [:test]
    gem "redgreen", :group => [:test]
    gem "autotest-fsevent", :group => [:test]
    gem "autotest-growl", :group => [:test]

    # development
    gem 'auto_tagger', '0.2.3', :group => [:development]
    gem 'rails3-generators', '0.17.4', :group => [:development]

    # all
    gem 'mysql2', '0.2.6'
    gem 'json_pure', '1.4.6'
    gem 'sqlite3'

    ## Generators

    @@ -63,11 +60,9 @@

    # Run all the generators
    generate "rspec:install"
    generate "cucumber:install --capybara --rspec --spork"
    generate "devise:install"
    generate "devise:views"
    generate "devise User"
    generate "formtastic:install"

    ## Devise routes
    routes = <<-ROUTES
    @@ -83,7 +78,7 @@
    signin = <<-SIGNIN
    <h2>Login</h2>
    <%= semantic_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <%= f.inputs do %>
    <%= f.input :email, :as => :email %>
    <%= f.input :password, :as => :password %>
    @@ -105,7 +100,7 @@
    signup = <<-SIGNUP
    <h2>Signup</h2>
    <%= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    <%= devise_error_messages! %>
    <%= f.inputs do %>
    <%= f.input :email, :as => :email %>
  12. @paulmars paulmars revised this gist May 8, 2011. 1 changed file with 93 additions and 12 deletions.
    105 changes: 93 additions & 12 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@

    ## Generators

    inject_into_file('config/application.rb', :after => "config.i18n.default_locale = :de") do
    inject_into_file('config/application.rb', :after => "config.filter_parameters += [:password]") do
    %q{
    config.generators do |g|
    g.stylesheets false
    @@ -64,20 +64,93 @@
    # Run all the generators
    generate "rspec:install"
    generate "cucumber:install --capybara --rspec --spork"
    generate "formtastic:install"
    generate "devise:install"
    generate "devise:views"
    generate "devise User"
    generate "formtastic:install"

    ## Files
    ## Devise routes
    routes = <<-ROUTES
    devise_scope :user do
    get "signup", :to => "devise/registrations#new"
    get "login", :to => "devise/sessions#new"
    get "logout", :to => "devise/sessions#destroy"
    end
    ROUTES
    route routes

    ## Login files
    signin = <<-SIGNIN
    <h2>Login</h2>
    <%= semantic_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <%= f.inputs do %>
    <%= f.input :email, :as => :email %>
    <%= f.input :password, :as => :password %>
    <% if devise_mapping.rememberable? -%>
    <%= f.input :remember_me, :as => :boolean %>
    <% end -%>
    <% end %>
    <%= f.buttons do %>
    <%= f.commit_button "Login" %>
    <% end %>
    <% end %>
    <%= render :partial => "devise/shared/links" %>
    SIGNIN

    remove_file "app/views/devise/sessions/new.html.erb"
    create_file "app/views/devise/sessions/new.html.erb", signin

    signup = <<-SIGNUP
    <h2>Signup</h2>
    <%= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    <%= devise_error_messages! %>
    <%= f.inputs do %>
    <%= f.input :email, :as => :email %>
    <%= f.input :password, :as => :password %>
    <% end %>
    <%= f.buttons do %>
    <%= f.commit_button "Signup" %>
    <% end %>
    <% end %>
    <%= render :partial => "devise/shared/links" %>
    SIGNUP

    remove_file "app/views/devise/registrations/new.html.erb"
    create_file "app/views/devise/registrations/new.html.erb", signup

    # Clear the default index
    remove_file "public/index.html"
    remove_file "public/images/rails.png"
    # Make a blank application javascript file
    remove_file "public/javascripts/application.js"
    create_file "public/javascripts/application.js"
    # Make the SASS directory and base file
    empty_directory "app/stylsheets"
    create_file "app/stylesheets/application.scss"
    empty_directory "app/stylesheets"
    default_style = <<-LAYOUT
    body
    text-align: left
    font-size: 12px
    a, a:hover, a:visited
    color: blue
    .horizontal-list li
    display: inline
    .horizontal-list li a
    padding: 0.1em
    #hd h1
    font-size: 1.5em
    .login-bar
    float: right
    LAYOUT
    create_file "app/stylesheets/application.sass", default_style

    ## Layout

    @@ -86,13 +159,24 @@
    %html
    %head
    %title #{app_name.humanize}
    = stylesheet_link_tag "http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css"
    = stylesheet_link_tag :all
    = javascript_include_tag :defaults
    = csrf_meta_tag
    %body
    = yield
    %body#doc
    .hd
    %ol.login-bar.horizontal-list
    - if !user_signed_in?
    %li= link_to "Login", login_url
    %li= link_to "Signup", signup_url
    - else
    %li= current_user.name
    %li= link_to "Logout", logout_url
    %h1 #{app_name.humanize}
    .bd
    = yield
    .ft
    LAYOUT

    remove_file "app/views/layouts/application.html.erb"
    create_file "app/views/layouts/application.html.haml", layout

    @@ -111,11 +195,8 @@
    remove_file ".gitignore"
    create_file ".gitignore", gitignore

    # Setup Factory_Girl
    empty_directory 'spec/support'
    create_file 'spec/support/factories.rb'

    run "bundle install"
    run "rake db:migrate"

    git :init
    git :add => "."
  13. @paulmars paulmars revised this gist May 8, 2011. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Rails App Template
    ## Updated for Rails 3.0.1
    ## Updated for Rails 3.0.7
    ## Created on 10/23/10
    ## Updated on 11/4/10
    ## Updated on 5/7/11
    ## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb

    ## Gems
    @@ -28,15 +28,23 @@
    gem "launchy", ">= 0.3.7", :group => [:test, :cucumber]
    gem "spork", ">= 0.8.4", :group => [:test, :cucumber]

    # development
    gem 'auto_tagger', '0.2.3', :group => [:development]
    gem 'rails3-generators', '0.17.4', :group => [:development]

    # all
    gem 'mysql2', '0.2.6'
    gem 'json_pure', '1.4.6'

    ## Generators

    inject_into_file('config/application.rb', :after => "config.i18n.default_locale = :de") do
    %q{
    # Generator Settings
    config.generators do |g|
    g.stylesheets false
    g.template_engine :haml
    g.test_framework :rspec, :fixture => false, :views => false
    g.test_framework :rspec, :fixture => true, :views => false
    g.fixture_replacement :factory_girl, :dir => "spec/support/factories"
    end
    # Global Sass Option
  14. @paulmars paulmars revised this gist May 8, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@
    gem 'escape_utils'

    # HAML and SASS for Templating
    gem 'sass'
    gem 'haml'
    gem 'haml-rails'

  15. @paulmars paulmars revised this gist May 8, 2011. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -8,19 +8,19 @@

    # Warden and Devise for security
    gem 'warden', '1.0.4'
    gem 'devise', '1.1.3'
    gem 'devise', '1.3.0'

    # Extra Plugins
    gem 'formtastic', '~> 1.1.0'
    gem 'formtastic', '1.2.3'
    gem 'escape_utils'

    # HAML and SASS for Templating
    gem 'haml'
    gem 'haml-rails'

    # Cucumber and Friends
    gem "rspec-rails", ">= 2.0.1", :group => [:test, :cucumber]
    gem "cucumber-rails", ">= 0.3.2", :group => [:test, :cucumber]
    gem "rspec-rails", ">= 2.5.0", :group => [:test, :cucumber]
    gem "cucumber-rails", ">= 0.4.1", :group => [:test, :cucumber]
    gem "capybara", :group => [:test, :cucumber]
    gem "database_cleaner", :group => [:test, :cucumber]
    gem "factory_girl_rails", :group => [:test, :cucumber]
  16. @paulmars paulmars revised this gist May 8, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    ## Gems

    # Warden and Devise for security
    gem 'warden', '0.10.7'
    gem 'warden', '1.0.4'
    gem 'devise', '1.1.3'

    # Extra Plugins
  17. @martinisoft martinisoft revised this gist Nov 4, 2010. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,6 @@
    config.generators do |g|
    g.template_engine :haml
    g.test_framework :rspec, :fixture => false, :views => false
    g.fixture_replacement :factory_girl, :dir => "spec/support/factories"
    end
    # Global Sass Option
  18. @martinisoft martinisoft revised this gist Nov 4, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@
    # Latest jQuery UJS
    # get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
    # HACK: Since the get method hates https and redirects
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js")
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js").read
    create_file "public/javascripts/rails.js", jquery

    # Replace the blank one with jQuery served via Google CDN
  19. @martinisoft martinisoft revised this gist Nov 4, 2010. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,10 @@
    end

    # Latest jQuery UJS
    get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
    # get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
    # HACK: Since the get method hates https and redirects
    jquery = open("https://github.com/rails/jquery-ujs/raw/master/src/rails.js")
    create_file "public/javascripts/rails.js", jquery

    # Replace the blank one with jQuery served via Google CDN
    gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'
  20. @martinisoft martinisoft revised this gist Nov 4, 2010. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Rails App Template
    ## Updated for Rails 3.0.1
    ## Created on 10/23/10
    ## Updated on 10/24/10
    ## Updated on 11/4/10
    ## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb

    ## Gems
    @@ -45,7 +45,7 @@
    end

    # Latest jQuery UJS
    get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
    get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"

    # Replace the blank one with jQuery served via Google CDN
    gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'
  21. @martinisoft martinisoft revised this gist Nov 4, 2010. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -44,9 +44,6 @@
    }
    end

    # Clear the Javascripts
    run "rm public/javascripts/*.js"

    # Latest jQuery UJS
    get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"

    @@ -65,6 +62,7 @@
    # Clear the default index
    remove_file "public/index.html"
    # Make a blank application javascript file
    remove_file "public/javascripts/application.js"
    create_file "public/javascripts/application.js"
    # Make the SASS directory and base file
    empty_directory "app/stylsheets"
  22. @martinisoft martinisoft revised this gist Nov 4, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@
    create_file "public/javascripts/application.js"
    # Make the SASS directory and base file
    empty_directory "app/stylsheets"
    create_file "app/stylesheets/application.scss
    create_file "app/stylesheets/application.scss"

    ## Layout

  23. @martinisoft martinisoft revised this gist Oct 24, 2010. 1 changed file with 19 additions and 9 deletions.
    28 changes: 19 additions & 9 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Rails App Template
    ## Updated for Rails 3.0.1
    ## Created on 10/23/10
    ## Updated on 10/23/10
    ## Updated on 10/24/10
    ## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb

    ## Gems
    @@ -29,20 +29,20 @@

    ## Generators

    generators = <<-GENERATORS
    config.i18n.default_locale = :de
    inject_into_file('config/application.rb', :after => "config.i18n.default_locale = :de") do
    %q{
    # Generator Settings
    config.generators do |g|
    g.template_engine :haml
    g.test_framework :rspec
    g.test_framework :rspec, :fixture => false, :views => false
    g.fixture_replacement :factory_girl, :dir => "spec/support/factories"
    end
    # Global Sass Option
    Sass::Plugin.options[:template_location] = { 'app/stylesheets' => 'public/stylesheets' }
    GENERATORS

    gsub_file 'config/application.rb', 'config.i18n.default_locale = :de', generators
    }
    end

    # Clear the Javascripts
    run "rm public/javascripts/*.js"
    @@ -62,8 +62,13 @@

    ## Files

    run "rm public/index.html"
    # Clear the default index
    remove_file "public/index.html"
    # Make a blank application javascript file
    create_file "public/javascripts/application.js"
    # Make the SASS directory and base file
    empty_directory "app/stylsheets"
    create_file "app/stylesheets/application.scss
    ## Layout
    @@ -93,9 +98,14 @@
    public/stylesheets/*
    END
    # Re-Make gitignore
    remove_file ".gitignore"
    create_file ".gitignore", gitignore
    # Setup Factory_Girl
    empty_directory 'spec/support'
    create_file 'spec/support/factories.rb'
    run "bundle install"
    git :init
  24. @martinisoft martinisoft created this gist Oct 24, 2010.
    102 changes: 102 additions & 0 deletions tpl-cukeapp.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,102 @@
    ## Rails App Template
    ## Updated for Rails 3.0.1
    ## Created on 10/23/10
    ## Updated on 10/23/10
    ## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb

    ## Gems

    # Warden and Devise for security
    gem 'warden', '0.10.7'
    gem 'devise', '1.1.3'

    # Extra Plugins
    gem 'formtastic', '~> 1.1.0'
    gem 'escape_utils'

    # HAML and SASS for Templating
    gem 'haml'
    gem 'haml-rails'

    # Cucumber and Friends
    gem "rspec-rails", ">= 2.0.1", :group => [:test, :cucumber]
    gem "cucumber-rails", ">= 0.3.2", :group => [:test, :cucumber]
    gem "capybara", :group => [:test, :cucumber]
    gem "database_cleaner", :group => [:test, :cucumber]
    gem "factory_girl_rails", :group => [:test, :cucumber]
    gem "launchy", ">= 0.3.7", :group => [:test, :cucumber]
    gem "spork", ">= 0.8.4", :group => [:test, :cucumber]

    ## Generators

    generators = <<-GENERATORS
    config.i18n.default_locale = :de
    # Generator Settings
    config.generators do |g|
    g.template_engine :haml
    g.test_framework :rspec
    end
    # Global Sass Option
    Sass::Plugin.options[:template_location] = { 'app/stylesheets' => 'public/stylesheets' }
    GENERATORS

    gsub_file 'config/application.rb', 'config.i18n.default_locale = :de', generators

    # Clear the Javascripts
    run "rm public/javascripts/*.js"

    # Latest jQuery UJS
    get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"

    # Replace the blank one with jQuery served via Google CDN
    gsub_file 'config/application.rb', 'config.action_view.javascript_expansions[:defaults] = %w()', 'config.action_view.javascript_expansions[:defaults] = %w(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js rails.js)'

    # Run all the generators
    generate "rspec:install"
    generate "cucumber:install --capybara --rspec --spork"
    generate "formtastic:install"
    generate "devise:install"
    generate "devise User"

    ## Files

    run "rm public/index.html"
    create_file "public/javascripts/application.js"

    ## Layout

    layout = <<-LAYOUT
    !!!
    %html
    %head
    %title #{app_name.humanize}
    = stylesheet_link_tag :all
    = javascript_include_tag :defaults
    = csrf_meta_tag
    %body
    = yield
    LAYOUT

    remove_file "app/views/layouts/application.html.erb"
    create_file "app/views/layouts/application.html.haml", layout

    ## Git

    gitignore = <<-END
    .bundle
    .DS_Store
    db/*.sqlite3
    log/*.log
    tmp/**/*
    public/stylesheets/*
    END

    remove_file ".gitignore"
    create_file ".gitignore", gitignore

    run "bundle install"

    git :init
    git :add => "."