Created
November 24, 2010 19:30
-
-
Save alex-kononovich/714233 to your computer and use it in GitHub Desktop.
an template for rails 3 application which uses jquery, haml, compass
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
# remove unused files | |
remove_file "README" | |
remove_file "public/index.html" | |
remove_file "public/images/rails.png" | |
remove_file "app/views/layouts/application.html.erb" | |
remove_file "public/javascripts/controls.js" | |
remove_file "public/javascripts/dragdrop.js" | |
remove_file "public/javascripts/effects.js" | |
remove_file "public/javascripts/prototype.js" | |
remove_file "public/javascripts/rails.js" | |
# Downloading latest jQuery.min | |
get "http://code.jquery.com/jquery-latest.min.js", "public/javascripts/jquery.js" | |
# Downloading latest jQuery drivers | |
get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js" | |
# Overriding default expansion | |
initializer 'jquery.rb', <<-CODE | |
# Switch the javascript_include_tag :defaults to | |
# use jQuery instead of the default prototype helpers. | |
# Also setup a :jquery expansion, just for good measure. | |
# Written by: Logan Leger, [email protected] | |
# http://github.com/lleger/Rails-3-jQuery | |
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery => ['jquery', 'rails'] | |
ActiveSupport.on_load(:action_view) do | |
ActiveSupport.on_load(:after_initialize) do | |
ActionView::Helpers::AssetTagHelper::register_javascript_expansion :defaults => ['jquery', 'rails'] | |
end | |
end | |
CODE | |
# main layout | |
create_file 'app/views/layouts/application.html.haml', <<-CODE | |
!!!doctype | |
%html | |
%head | |
%title= h(yield(:title) || "Untitled") | |
= stylesheet_link_tag 'screen.css', :media => 'screen, projection' | |
= stylesheet_link_tag 'print.css', :media => 'print' | |
/[if lt IE 8] | |
= stylesheet_link_tag 'ie.css', :media => 'screen, projection' | |
= javascript_include_tag :defaults | |
= csrf_meta_tag | |
%body | |
= yield | |
CODE | |
gem 'haml-rails' | |
gem 'compass' | |
run 'bundle install' | |
run 'compass init rails . --css-dir=public/stylesheets --sass-dir=app/stylesheets --using blueprint/semantic -x sass' | |
# fix compass stuff | |
remove_file 'app/stylesheets/ie.sass' | |
remove_file 'app/stylesheets/print.sass' | |
remove_file 'app/stylesheets/screen.sass' | |
remove_file 'app/stylesheets/partials/_base.sass' | |
remove_file 'app/stylesheets/partials/_form.sass' | |
remove_file 'app/stylesheets/partials/_page.sass' | |
remove_file 'app/stylesheets/partials/_two_col.sass' | |
create_file 'app/stylesheets/ie.sass', <<-CODE | |
@import blueprint | |
body | |
+blueprint-ie(true) | |
CODE | |
create_file 'app/stylesheets/screen.sass', <<-CODE | |
@import partials/base | |
CODE | |
create_file 'app/stylesheets/partials/_base.sass', <<-CODE | |
@import blueprint | |
@import blueprint/reset | |
@import blueprint/typography | |
@import compass/layout | |
body | |
+blueprint-typography(true) | |
$blueprint-grid-columns : 24 | |
$blueprint-container-size : 950px | |
$blueprint-grid-margin : 10px | |
$blueprint-grid-width: ($blueprint-container-size + $blueprint-grid-margin) / $blueprint-grid-columns - $blueprint-grid-margin | |
CODE | |
# home page | |
generate :controller, "welcome", "index" | |
route "root :to => 'welcome#index'" | |
# Set up git repository | |
git :init | |
git :add => '.' | |
git :commit => "-a -m 'Initial commit'" | |
# navigate | |
run "mate ." | |
run "rails s" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment