Created
August 31, 2011 03:45
-
-
Save joshmvandercom/1182770 to your computer and use it in GitHub Desktop.
Most of the stuff u needz
This file contains hidden or 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
| ## Rails App Template | |
| ## Updated for Rails 3.0.7 | |
| ## Run using $ rails new [appname] -JT -m josh-template.rb | |
| ## | |
| ## Gems | |
| gem 'mysql' | |
| gem 'sass' | |
| gem 'haml' | |
| gem 'haml-rails' | |
| gem 'warden' | |
| gem 'devise' | |
| # all | |
| gem 'delayed_job' | |
| gem 'paperclip' | |
| gem 'omniauth' | |
| gem 'barista' | |
| gem 'aws-s3' | |
| # Testing | |
| gem "cucumber" | |
| gem "cucumber-rails" | |
| gem "rspec-rails" | |
| gem "factory_girl_rails" | |
| gem "jasmine" | |
| gem "faker" | |
| gem "capybara" | |
| # development | |
| gem "nifty-generators", :git => 'https://github.com/joshmattvander/nifty-generators' | |
| run "bundle install" | |
| ## Generators | |
| inject_into_file('config/application.rb', :after => "config.filter_parameters += [:password]") do | |
| %q{ | |
| config.generators do |g| | |
| g.stylesheets false | |
| g.template_engine :haml | |
| g.test_framework :rspec, :fixture => true, :views => false | |
| g.fixture_replacement :factory_girl, :dir => "spec/support/factories" | |
| end | |
| } | |
| end | |
| # 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", :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 | |
| 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" | |
| generate "barista:install" | |
| # Setup a basic Welcome Controller as the default route | |
| generate "controller Welcome index" | |
| generate "controller Users account complete" | |
| generate "controller Static about" | |
| inject_into_file('config/routes.rb', :after => %[root :to => "welcome#index"]) do | |
| %q{ | |
| root :to => "welcome#index" | |
| } | |
| end | |
| ## Devise routes | |
| ## User Routes | |
| routes = <<-ROUTES | |
| devise_for :users, :controllers => { :sessions => 'devise/sessions' }, :skip => [:sessions] do | |
| get 'login' => 'devise/sessions#new', :as => :new_user_session | |
| post 'login' => 'devise/sessions#create', :as => :user_session | |
| get 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session | |
| get 'signup' => 'devise/registrations#new', :as => :new_user_registration | |
| end | |
| resource :users do | |
| collection do | |
| get :account | |
| get :complete | |
| end | |
| end | |
| 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 "public/javascripts/application.js" | |
| # Make the SASS directory and base file | |
| empty_directory "app/stylesheets/sass" | |
| master_style = <<-MASTER | |
| @import _reset.sass | |
| @import _utils.sass | |
| @import _defaults.sass | |
| @import _960.sass | |
| MASTER | |
| default_style = <<-LAYOUT | |
| //Dimensions | |
| $body_width: 960px | |
| $br: 5px | |
| // Colors | |
| $bg: #f4f4ee | |
| $black: #333 | |
| $blue: #3ea9f5 | |
| $red: #d81b1b | |
| $light_grey: #eee | |
| $grey: #ddd | |
| $dark_grey: #999 | |
| $link_color: $blue | |
| $link_hover_color: lighten($link_color, 10%) | |
| body | |
| font-family: Helvetica, Arial, sans-serif | |
| font-size: 12px | |
| line-height: 1.7em | |
| background: white | |
| color: $black | |
| strong, b | |
| font-weight: bold | |
| em, i | |
| font-style: italic | |
| p, ol | |
| margin-bottom: 16px | |
| ol | |
| margin-left: 2em | |
| h1, h2 | |
| font-weight: bold | |
| display: block | |
| &.striped | |
| border-bottom: 1px solid $light_grey | |
| margin-bottom: 16px | |
| padding-bottom: 16px | |
| h1 | |
| font-size: 24px | |
| display: block | |
| margin-bottom: 16px | |
| h2 | |
| font-size: 18px | |
| display: block | |
| margin-bottom: 16px | |
| h3 | |
| font-size: 14px | |
| display: block | |
| font-weight: bold | |
| margin-bottom: 16px | |
| h4 | |
| font-size: 12px | |
| display: block | |
| font-weight: bold | |
| a, a:active, a:visited | |
| color: $link_color | |
| text-decoration: none | |
| a:hover | |
| color: $link_hover_color | |
| LAYOUT | |
| utils_style = <<-UTILS | |
| =has-layout | |
| // This makes ie6 get layout | |
| display: inline-block | |
| // and this puts it back to block | |
| & | |
| display: block | |
| =box-gradient($top, $bottom) | |
| background-image: unquote("-moz-linear-gradient(top, #{$top}, #{$bottom})") | |
| background-image: unquote("-webkit-gradient(linear,left top,left bottom,color-stop(0, #{$top}),color-stop(1, #{$bottom}))") | |
| -ms-filter: unquote("progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$top}', EndColorStr='#{$bottom}')") | |
| =border-radius($radius: $default_border_radius) | |
| border-radius: $radius | |
| -moz-border-radius: $radius | |
| -webkit-border-radius: $radius | |
| =border-corner-radius($vert, $horz, $radius: $default_border_radius) | |
| border-#{$vert}-#{$horz}-radius: $radius | |
| -moz-border-radius-#{$vert}#{$horz}: $radius | |
| -webkit-border-#{$vert}-#{$horz}-radius: $radius | |
| =border-top-left-radius($radius: $default_border_radius) | |
| +border-corner-radius(top, left, $radius) | |
| =border-top-right-radius($radius: $default_border_radius) | |
| +border-corner-radius(top, right, $radius) | |
| =border-bottom-left-radius($radius: $default_border_radius) | |
| +border-corner-radius(bottom, left, $radius) | |
| =border-bottom-right-radius($radius: $default_border_radius) | |
| +border-corner-radius(bottom, right, $radius) | |
| // Round top corners by amount. | |
| =border-top-radius($radius: $default_border_radius) | |
| +border-top-left-radius($radius) | |
| +border-top-right-radius($radius) | |
| // Round right corners by amount. | |
| =border-right-radius($radius: $default_border_radius) | |
| +border-top-right-radius($radius) | |
| +border-bottom-right-radius($radius) | |
| // Round bottom corners by amount. | |
| =border-bottom-radius($radius: $default_border_radius) | |
| +border-bottom-left-radius($radius) | |
| +border-bottom-right-radius($radius) | |
| // Round left corners by amount. | |
| =border-left-radius($radius: $default_border_radius) | |
| +border-top-left-radius($radius) | |
| +border-bottom-left-radius($radius) | |
| =box-shadow($horizontal_offset: 10px, $vertical_offset: 10px, $blur_radius: 5px, $box_color: black) | |
| -webkit-box-shadow: $horizontal_offset $vertical_offset $blur_radius $box_color | |
| -moz-box-shadow: $horizontal_offset $vertical_offset $blur_radius $box_color | |
| box-shadow: $horizontal_offset $vertical_offset $blur_radius $box_color | |
| =css-arrow($width) | |
| display: -moz-inline-box | |
| display: inline-block | |
| width: 0 | |
| height: 0 | |
| font-size: 1em | |
| line-height: 0 | |
| border-style: dashed | |
| border-color: transparent | |
| border-width: $width | |
| vertical-align: middle | |
| =right-arrow($color, $width: 5px) | |
| +css-arrow($width) | |
| border-right-width: 0 | |
| border-left-style: solid | |
| border-left-color: $color | |
| =left-arrow($color, $width: 5px) | |
| +css-arrow($width) | |
| border-left-width: 0 | |
| border-right-style: solid | |
| border-right-color: $color | |
| =bottom-arrow($color, $width: 5px) | |
| +css-arrow($width) | |
| border-bottom-width: 0 | |
| border-top-style: solid | |
| border-top-color: $color | |
| =top-arrow($color, $width: 5px) | |
| +css-arrow($width) | |
| border-top-width: 0 | |
| border-bottom-style: solid | |
| border-bottom-color: $color | |
| =clearafter | |
| &:after | |
| content: " " | |
| display: block | |
| height: 0 | |
| clear: both | |
| overflow: hidden | |
| visibility: hidden | |
| +has-layout | |
| =clearfix | |
| +clearafter | |
| .clearfix, .clearafter | |
| +clearafter | |
| .clear | |
| clear: both | |
| // from http://github.com/ericam/compass-susy-plugin/blob/master/sass/susy/_utils.sass | |
| // brings IE in line with inline-block display | |
| // - using hacks if called automatically because !hacks == true | |
| // - or without if you call it from ie.sass | |
| =ie-inline-block | |
| #display: inline | |
| // fixes alignment against native input/button on ie6 | |
| #vertical-align: auto | |
| =inline-block | |
| display: -moz-inline-box | |
| -moz-box-orient: vertical | |
| display: inline-block | |
| vertical-align: middle | |
| +ie-inline-block | |
| .first | |
| margin-top: 0 | |
| .last | |
| margin-bottom: 0 | |
| .end | |
| margin-right: 0 | |
| .beginning | |
| margin-left: 0 | |
| =link-image | |
| display: block | |
| outline: none | |
| text-indent: -5000px | |
| UTILS | |
| reset_style = <<-RESET | |
| // reset.sass | |
| // Generated 10/1/2007 | |
| // yong joseph bakos | |
| // This is a sassified version of Eric Meyer's reset.css | |
| // http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/ | |
| // | |
| html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td | |
| margin: 0 | |
| padding: 0 | |
| border: 0 | |
| outline: 0 | |
| font-weight: inherit | |
| font-style: inherit | |
| font-size: 100% | |
| font-family: inherit | |
| vertical-align: baseline | |
| *:focus | |
| outline: 10 | |
| body | |
| line-height: 1 | |
| color: black | |
| background: white | |
| ul | |
| list-style: none | |
| table | |
| border-collapse: separate | |
| border-spacing: 0 | |
| caption, th, td | |
| text-align: left | |
| font-weight: normal | |
| blockquote:before, blockquote:after, q:before, q:after | |
| content: "" | |
| blockquote, q | |
| quotes: "" "" | |
| header, footer, nav | |
| display: block | |
| RESET | |
| forms_style = <<-FORMS | |
| .fieldset | |
| +clearfix | |
| form.striped | |
| .fieldset | |
| border-bottom: 1px solid $light_grey | |
| padding-bottom: 10px | |
| margin-bottom: 10px | |
| .split-form | |
| width: 454px | |
| margin-right: 10px | |
| float: left | |
| input.hint | |
| color: #666 | |
| .form-row | |
| +inline-block | |
| position: relative | |
| &.block | |
| display: block | |
| label | |
| display: block | |
| color: #666 | |
| margin: 0 0 5px | |
| font-weight: bold | |
| text-shadow: 1px 1px 0 #fff | |
| span | |
| font-weight: normal | |
| text-transform: lowercase !important | |
| font-size: 11px | |
| .field-wrap | |
| background: #f4f4eb | |
| padding: 5px | |
| +inline-block | |
| +border-radius(5px) | |
| margin-bottom: 20px | |
| input, select, textarea | |
| +border-radius(3px) | |
| +box-shadow(1px, 1px, 0, #fff) | |
| color: #333 | |
| background: #fff | |
| border: 1px solid #e8e8df | |
| padding: 10px | |
| width: 320px | |
| font-size: 14px | |
| font-family: Arial Black | |
| &:focus | |
| outline: none | |
| border: 1px solid #aaa | |
| .field-error | |
| input | |
| border-color: #e48282 | |
| .field-wrap.date | |
| select | |
| width: 160px | |
| .error-message | |
| color: darken(#e48282, 10%) | |
| font-weight: bold | |
| display: block | |
| padding: 3px | |
| margin-top: 3px | |
| background: lighten(#f4f4eb, 2%) | |
| border: 1px solid $light_grey | |
| +border-radius(5px) | |
| .arrow | |
| display: none | |
| input[type=checkbox], #user_remember_me | |
| float: left | |
| margin-right: 10px | |
| =button($color) | |
| background: $color | |
| +box-gradient(lighten($color, 10%), $color) | |
| +border-radius(5px) | |
| -webkit-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.2) | |
| -moz-box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.2) | |
| box-shadow: inset 0px 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.2) | |
| padding: 10px 15px | |
| border: 1px solid darken($color, 10%) | |
| color: #fff | |
| text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3) | |
| font-weight: bold | |
| cursor: pointer | |
| text-decoration: none | |
| &:hover | |
| color: #eee | |
| +box-gradient(lighten($color, 15%), $color) | |
| &:active | |
| -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.2) | |
| -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.2) | |
| box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.2) | |
| .button | |
| +button(#33a0de) | |
| .button-green | |
| +button(#75c65c) | |
| .button-red | |
| +button(#d83c3c) | |
| .form-block-top, .form-block-bottom | |
| border: 1px solid #ddd | |
| padding: 20px | |
| .form-block-top | |
| +border-top-radius(5px) | |
| border-bottom: none | |
| .form-block-bottom | |
| +border-bottom-radius(5px) | |
| background: #f6f6f6 | |
| FORMS | |
| n60_style = <<-N60 | |
| //// | |
| // Grid >> Global | |
| .grid-1, .grid-2, .grid-3, .grid-4, .grid-5, .grid-6, .grid-7, .grid-8, .grid-9, .grid-10, .grid-11, .grid-12, .grid-13, .grid-14, .grid-15, .grid-16 | |
| display: inline | |
| float: left | |
| position: relative | |
| margin-left: 10px | |
| margin-right: 10px | |
| //// | |
| // Grid >> Children (Alpha ~ First, Omega ~ Last) | |
| .alpha | |
| margin-left: 0 | |
| .omega | |
| margin-right: 0 | |
| //// | |
| // Container >> 16 Columns | |
| .container-16 | |
| +clearfix | |
| margin-left: auto | |
| margin-right: auto | |
| width: 960px | |
| // Grid >> 16 Columns | |
| .grid-1 | |
| width: 40px | |
| .grid-2 | |
| width: 100px | |
| .grid-3 | |
| width: 160px | |
| .grid-4 | |
| width: 220px | |
| .grid-5 | |
| width: 280px | |
| .grid-6 | |
| width: 340px | |
| .grid-7 | |
| width: 400px | |
| .grid-8 | |
| width: 460px | |
| .grid-9 | |
| width: 520px | |
| .grid-10 | |
| width: 580px | |
| .grid-11 | |
| width: 640px | |
| .grid-12 | |
| width: 700px | |
| .grid-13 | |
| width: 760px | |
| .grid-14 | |
| width: 820px | |
| .grid-15 | |
| width: 880px | |
| .grid-16 | |
| width: 940px | |
| // Prefix Extra Space >> 16 Columns | |
| .prefix-1 | |
| padding-left: 60px | |
| .prefix-2 | |
| padding-left: 120px | |
| .prefix-3 | |
| padding-left: 180px | |
| .prefix-4 | |
| padding-left: 240px | |
| .prefix-5 | |
| padding-left: 300px | |
| .prefix-6 | |
| padding-left: 360px | |
| .prefix-7 | |
| padding-left: 420px | |
| .prefix-8 | |
| padding-left: 480px | |
| .prefix-9 | |
| padding-left: 540px | |
| .prefix-10 | |
| padding-left: 600px | |
| .prefix-11 | |
| padding-left: 660px | |
| .prefix-12 | |
| padding-left: 720px | |
| .prefix-13 | |
| padding-left: 780px | |
| .prefix-14 | |
| padding-left: 840px | |
| .prefix-15 | |
| padding-left: 900px | |
| // Suffix Extra Space >> 16 Columns | |
| .suffix-1 | |
| padding-right: 60px | |
| .suffix-2 | |
| padding-right: 120px | |
| .suffix-3 | |
| padding-right: 180px | |
| .suffix-4 | |
| padding-right: 240px | |
| .suffix-5 | |
| padding-right: 300px | |
| .suffix-6 | |
| padding-right: 360px | |
| .suffix-7 | |
| padding-right: 420px | |
| .suffix-8 | |
| padding-right: 480px | |
| .suffix-9 | |
| padding-right: 540px | |
| .suffix-10 | |
| padding-right: 600px | |
| .suffix-11 | |
| padding-right: 660px | |
| .suffix-12 | |
| padding-right: 720px | |
| .suffix-13 | |
| padding-right: 780px | |
| .suffix-14 | |
| padding-right: 840px | |
| .suffix-15 | |
| padding-right: 900px | |
| // Push Extra Space >> 16 Columns | |
| .push-1 | |
| left: 60px | |
| .push-2 | |
| left: 120px | |
| .push-3 | |
| left: 180px | |
| .push-4 | |
| left: 240px | |
| .push-5 | |
| left: 300px | |
| .push-6 | |
| left: 360px | |
| .push-7 | |
| left: 420px | |
| .push-8 | |
| left: 480px | |
| .push-9 | |
| left: 540px | |
| .push-10 | |
| left: 600px | |
| .push-11 | |
| left: 660px | |
| .push-12 | |
| left: 720px | |
| .push-13 | |
| left: 780px | |
| .push-14 | |
| left: 840px | |
| .push-15 | |
| left: 900px | |
| // Pull Extra Space >> 16 Columns | |
| .pull-1 | |
| left: -60px | |
| .pull-2 | |
| left: -120px | |
| .pull-3 | |
| left: -180px | |
| .pull-4 | |
| left: -240px | |
| .pull-5 | |
| left: -300px | |
| .pull-6 | |
| left: -360px | |
| .pull-7 | |
| left: -420px | |
| .pull-8 | |
| left: -480px | |
| .pull-9 | |
| left: -540px | |
| .pull-10 | |
| left: -600px | |
| .pull-11 | |
| left: -660px | |
| .pull-12 | |
| left: -720px | |
| .pull-13 | |
| left: -780px | |
| .pull-14 | |
| left: -840px | |
| .pull-15 | |
| left: -900px | |
| //// | |
| // Container >> 12 Columns | |
| .container-12 | |
| +clearfix | |
| margin-left: auto | |
| margin-right: auto | |
| width: 960px | |
| // Grid >> 12 Columns | |
| .grid-1 | |
| width: 60px | |
| .grid-2 | |
| width: 140px | |
| .grid-3 | |
| width: 220px | |
| .grid-4 | |
| width: 300px | |
| .grid-5 | |
| width: 380px | |
| .grid-6 | |
| width: 460px | |
| .grid-7 | |
| width: 540px | |
| .grid-8 | |
| width: 620px | |
| .grid-9 | |
| width: 700px | |
| .grid-10 | |
| width: 780px | |
| .grid-11 | |
| width: 860px | |
| .grid-12 | |
| width: 940px | |
| // Prefix Extra Space >> 12 Columns | |
| .prefix-1 | |
| padding-left: 80px | |
| .prefix-2 | |
| padding-left: 160px | |
| .prefix-3 | |
| padding-left: 240px | |
| .prefix-4 | |
| padding-left: 320px | |
| .prefix-5 | |
| padding-left: 400px | |
| .prefix-6 | |
| padding-left: 480px | |
| .prefix-7 | |
| padding-left: 560px | |
| .prefix-8 | |
| padding-left: 640px | |
| .prefix-9 | |
| padding-left: 720px | |
| .prefix-10 | |
| padding-left: 800px | |
| .prefix-11 | |
| padding-left: 880px | |
| // Suffix Extra Space >> 12 Columns | |
| .suffix-1 | |
| padding-right: 80px | |
| .suffix-2 | |
| padding-right: 160px | |
| .suffix-3 | |
| padding-right: 240px | |
| .suffix-4 | |
| padding-right: 320px | |
| .suffix-5 | |
| padding-right: 400px | |
| .suffix-6 | |
| padding-right: 480px | |
| .suffix-7 | |
| padding-right: 560px | |
| .suffix-8 | |
| padding-right: 640px | |
| .suffix-9 | |
| padding-right: 720px | |
| .suffix-10 | |
| padding-right: 800px | |
| .suffix-11 | |
| padding-right: 880px | |
| // Push Extra Space >> 12 Columns | |
| .push-1 | |
| left: 80px | |
| .push-2 | |
| left: 160px | |
| .push-3 | |
| left: 240px | |
| .push-4 | |
| left: 320px | |
| .push-5 | |
| left: 400px | |
| .push-6 | |
| left: 480px | |
| .push-7 | |
| left: 560px | |
| .push-8 | |
| left: 640px | |
| .push-9 | |
| left: 720px | |
| .push-10 | |
| left: 800px | |
| .push-11 | |
| left: 880px | |
| // Pull Extra Space >> 12 Columns | |
| .pull-1 | |
| left: -80px | |
| .pull-2 | |
| left: -160px | |
| .pull-3 | |
| left: -240px | |
| .pull-4 | |
| left: -320px | |
| .pull-5 | |
| left: -400px | |
| .pull-6 | |
| left: -480px | |
| .pull-7 | |
| left: -560px | |
| .pull-8 | |
| left: -640px | |
| .pull-9 | |
| left: -720px | |
| .pull-10 | |
| left: -800px | |
| .pull-11 | |
| left: -880px | |
| N60 | |
| create_file "public/stylesheets/sass/master.sass", master_style | |
| create_file "public/stylesheets/sass/_reset.sass", reset_style | |
| create_file "public/stylesheets/sass/_defaults.sass", default_style | |
| create_file "public/stylesheets/sass/_960.sass", n60_style | |
| create_file "public/stylesheets/sass/_forms.sass", forms_style | |
| ## Layout | |
| layout = <<-LAYOUT | |
| - meta = yield(:meta) | |
| !!! | |
| %html | |
| %head | |
| %title= content_for?(:title) ? yield(:title) : CONFIG[:name] | |
| = stylesheet_link_tag "master.css" | |
| = yield(:stylesheets) | |
| - if !yield(:styles).blank? | |
| %style{:media => "screen", :type => "text/css"} | |
| = yield(:styles) | |
| = csrf_meta_tag | |
| = yield(:head) | |
| %body{:class => yield(:body_class)} | |
| #wrapper | |
| = render :partial => "shared/header" | |
| #main.centered | |
| = render :partial => "shared/flash", :object => flash | |
| = yield | |
| = content_tag(:div, yield(:sidebar), :id => 'sidebar') if yield(:sidebar) | |
| %div{:style => "clear:both;"} | |
| = render :partial => "shared/footer" | |
| #dialog.jqmWindow= yield(:dialog) | |
| = javascript_include_tag :defaults | |
| = yield(:scripts) | |
| %script{:charset => "utf-8", :type => "text/javascript"} | |
| = yield(:inline_js) | |
| LAYOUT | |
| header = <<-HEADER | |
| %header | |
| .container-12 | |
| .top-links | |
| = link_to 'Blog', '##' | |
| - if user_signed_in? | |
| = link_to 'Account', '##' | |
| = link_to 'Logout', destroy_user_session_path, :style => 'margin-right:0;' | |
| - else | |
| = link_to 'Login', new_user_session_path | |
| = link_to 'Sign up', new_user_registration_path, :class => 'button button-green button-flat', :style => 'color:white; margin-right:0;' | |
| HEADER | |
| flash = <<-FLASH | |
| - flash.each do |name, msg| | |
| = content_tag :div, msg, :id => "flash", :class => name | |
| FLASH | |
| footer = <<-FOOTER | |
| %footer | |
| .container-12 | |
| .grid-6 | |
| = link_to 'About', '##' | |
| %span.pipe | |
| | | |
| = link_to 'Contact', '##' | |
| FOOTER | |
| remove_file "app/views/layouts/application.html.erb" | |
| create_file "app/views/layouts/application.html.haml", layout | |
| empty_directory "app/views/shared" | |
| create_file "app/views/layouts/header.html.haml", header | |
| create_file "app/views/layouts/flash.html.haml", flash | |
| create_file "app/views/layouts/footer.html.haml", footer | |
| ## Coffeescript | |
| application_coffee = <<-APP_COFFEE | |
| (($) -> | |
| $(document).ready -> | |
| $("input").focus(-> | |
| $(this).parents(".field-wrap").addClass "lit" | |
| $(this).parents(".field-wrap").prev('label').css 'color' : 'black' | |
| ).blur -> | |
| $(this).parents(".field-wrap").removeClass "lit" | |
| $(this).parents(".field-wrap").prev('label').css 'color' : '#666' | |
| ) jQuery | |
| APP_COFFEE | |
| remove_file "public/javascripts/application.js" | |
| empty_directory "app/coffeescripts" | |
| create_file "app/coffeescripts/application.coffee", application_coffee | |
| ## 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/underscore-min.js" | |
| get "http://documentcloud.github.com/backbone/backbone-min.js", "public/javascripts/backbone-min.js" | |
| # Config File | |
| config_yml = <<-CONFIG_YML | |
| development: | |
| domain: | |
| secure_domain: | |
| secure_protocol: | |
| name: | |
| beta: | |
| test: | |
| domain: | |
| secure_domain: | |
| secure_protocol: | |
| name: | |
| beta: | |
| production: | |
| domain: .com | |
| secure_domain: | |
| secure_protocol: | |
| name: | |
| beta: | |
| CONFIG_YML | |
| s3_yml = <<-S3_YML | |
| development: | |
| bucket: | |
| access_key_id: | |
| secret_access_key: | |
| test: | |
| bucket: | |
| access_key_id: | |
| secret_access_key: | |
| production: | |
| bucket: | |
| access_key_id: | |
| secret_access_key: | |
| S3_YML | |
| facebook_yml = <<-FACEBOOK_YML | |
| development: | |
| token: | |
| secret: | |
| site: | |
| production: | |
| token: | |
| secret: | |
| site: | |
| test: | |
| token: | |
| secret: | |
| site: | |
| FACEBOOK_YML | |
| create_file "config/config.yml.default", config_yml | |
| create_file "config/s3.yml.default", s3_yml | |
| create_file "config/facebook.yml.default", facebook_yml | |
| # Form Initializer | |
| form_init = <<-FORM_INIT | |
| ActionView::Base.field_error_proc = Proc.new do |html_tag, instance_tag| | |
| include ActionView::Helpers | |
| if html_tag =~ /type="hidden"/ || html_tag =~ /<label/ | |
| html_tag | |
| else | |
| content_tag(:span, html_tag) + content_tag(:span, content_tag(:span, '', :class => 'arrow') + [instance_tag.error_message].flatten.first.sub(/^\\^/, ''), :class => 'error-message') | |
| end | |
| end | |
| FORM_INIT | |
| create_file "config/initializers/custom_form_errors.rb", form_init | |
| ## Git | |
| gitignore = <<-END | |
| .bundle | |
| .DS_Store | |
| db/*.sqlite3 | |
| log/*.log | |
| tmp/**/* | |
| public/stylesheets/* | |
| config/*.yml | |
| END | |
| # Re-Make gitignore | |
| remove_file ".gitignore" | |
| create_file ".gitignore", gitignore | |
| run "rake db:migrate" | |
| git :init | |
| git :add => "." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment