Skip to content

Commit

Permalink
Enable assets-pipeline with compass-rails.
Browse files Browse the repository at this point in the history
  • Loading branch information
kentaro committed Jun 9, 2012
1 parent 5f3a25b commit a34665d
Show file tree
Hide file tree
Showing 69 changed files with 96 additions and 232 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ config/webistrano_config.rb
.DS_Store .DS_Store
.rake_tasks~ .rake_tasks~
public/stylesheets/*.css public/stylesheets/*.css
vendor/bundler vendor/bundler
.sass-cache/
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source 'http://rubygems.org'


gem 'rails', '3.2.5' gem 'rails', '3.2.5'


gem 'jquery-rails'
gem 'prototype-rails' gem 'prototype-rails'
gem 'exception_notification' gem 'exception_notification'


Expand All @@ -11,7 +12,6 @@ gem 'syntax', '1.0.0'
gem 'version_fu', :github => 'jmckible/version_fu' gem 'version_fu', :github => 'jmckible/version_fu'
gem 'devise' gem 'devise'
gem 'devise-encryptable' gem 'devise-encryptable'
gem 'compass'
gem 'haml' gem 'haml'


group :development do group :development do
Expand All @@ -28,3 +28,9 @@ end
group :production do group :production do
gem 'mysql' gem 'mysql'
end end

group :assets do
gem 'compass'
gem 'compass-rails'
gem 'sass-rails'
end
12 changes: 12 additions & 0 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ GEM
chunky_png (~> 1.2) chunky_png (~> 1.2)
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)
compass-rails (1.0.2)
compass (>= 0.12.0, < 0.14)
devise (2.1.0) devise (2.1.0)
bcrypt-ruby (~> 3.0) bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.7) orm_adapter (~> 0.0.7)
Expand All @@ -69,6 +71,9 @@ GEM
hike (1.2.1) hike (1.2.1)
i18n (0.6.0) i18n (0.6.0)
journey (1.0.3) journey (1.0.3)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.3) json (1.7.3)
mail (2.4.4) mail (2.4.4)
i18n (>= 0.4.0) i18n (>= 0.4.0)
Expand Down Expand Up @@ -118,6 +123,10 @@ GEM
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
sass (3.1.19) sass (3.1.19)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.1.3) sprockets (2.1.3)
hike (~> 1.2) hike (~> 1.2)
rack (~> 1.0) rack (~> 1.0)
Expand All @@ -142,16 +151,19 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
capistrano capistrano
compass compass
compass-rails
devise devise
devise-encryptable devise-encryptable
exception_notification exception_notification
factory_girl_rails factory_girl_rails
haml haml
jquery-rails
mocha mocha
mysql mysql
open4 (= 0.9.3) open4 (= 0.9.3)
prototype-rails prototype-rails
rails (= 3.2.5) rails (= 3.2.5)
sass-rails
sqlite3-ruby sqlite3-ruby
syntax (= 1.0.0) syntax (= 1.0.0)
test-unit (= 2.0.9) test-unit (= 2.0.9)
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,22 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_self
//= require_tree .


$(function(){ $(function(){

// ============ // ============
// = Menu Box = // = Menu Box =
// ============ // ============
Expand All @@ -9,30 +25,30 @@ $(function(){
, open , open
, closed , closed
; ;

menu_box = $(this).closest('.menu_box'); menu_box = $(this).closest('.menu_box');
open = $('.menu_box_body .open, .menu_box_arrow .open', menu_box); open = $('.menu_box_body .open, .menu_box_arrow .open', menu_box);
closed = $('.menu_box_body .closed, .menu_box_arrow .closed', menu_box); closed = $('.menu_box_body .closed, .menu_box_arrow .closed', menu_box);

open.hide(); open.hide();
closed.show(); closed.show();
}); });

$('.menu_box .menu_box_arrow .closed, .menu_box .menu_box_body .closed').click(function(){ $('.menu_box .menu_box_arrow .closed, .menu_box .menu_box_body .closed').click(function(){
var menu_box var menu_box
, open , open
, closed , closed
; ;

menu_box = $(this).closest('.menu_box'); menu_box = $(this).closest('.menu_box');
open = $('.menu_box_body .open, .menu_box_arrow .open', menu_box); open = $('.menu_box_body .open, .menu_box_arrow .open', menu_box);
closed = $('.menu_box_body .closed, .menu_box_arrow .closed', menu_box); closed = $('.menu_box_body .closed, .menu_box_arrow .closed', menu_box);

open.show(); open.show();
closed.hide(); closed.hide();
}); });


// ==================================== // ====================================
// = Override deployment lock trigger = // = Override deployment lock trigger =
// ==================================== // ====================================
Expand All @@ -43,8 +59,8 @@ $(function(){
$('deployment_override_locking').val(0); $('deployment_override_locking').val(0);
} }
}); });


// ==================== // ====================
// = Effective Config = // = Effective Config =
// ==================== // ====================
Expand All @@ -53,65 +69,65 @@ $(function(){
$('#h_e_c, #effective_config').show(); $('#h_e_c, #effective_config').show();
$('#s_e_c').hide(); $('#s_e_c').hide();
}); });

$('#h_e_c').click(function(e){ $('#h_e_c').click(function(e){
e.preventDefault(); e.preventDefault();
$('#h_e_c, #effective_config').hide(); $('#h_e_c, #effective_config').hide();
$('#s_e_c').show(); $('#s_e_c').show();
}); });


// ==================================== // ====================================
// = En/disable role specifier inputs = // = En/disable role specifier inputs =
// ==================================== // ====================================
$('#role_name').change(function(){ $('#role_name').change(function(){
var name var name
, custom_name , custom_name
; ;

name = $('#role_name'); name = $('#role_name');
custom_name = $('#role_custom_name'); custom_name = $('#role_custom_name');

if(name.val() == ''){ if(name.val() == ''){
custom_name.removeAttr("disabled"); custom_name.removeAttr("disabled");
} else { } else {
custom_name.attr("disabled","disabled"); custom_name.attr("disabled","disabled");
} }
}); });

$('#role_custom_name').change(function(){ $('#role_custom_name').change(function(){
var name var name
, custom_name , custom_name
; ;

name = $('#role_name'); name = $('#role_name');
custom_name = $('#role_custom_name'); custom_name = $('#role_custom_name');

if(custom_name.val() == ''){ if(custom_name.val() == ''){
name.removeAttr("disabled"); name.removeAttr("disabled");
} else { } else {
name.attr("disabled","disabled"); name.attr("disabled","disabled");
} }
}); });

$('#role_name').change(); $('#role_name').change();


// ========================= // =========================
// = Project Template Info = // = Project Template Info =
// ========================= // =========================
$('#project_template').change(function(){ $('#project_template').change(function(){
var selection var selection
; ;

selection = $('#project_template').val(); selection = $('#project_template').val();

$('.template_info').hide(); $('.template_info').hide();
$('#'+selection+'_desc').show(); $('#'+selection+'_desc').show();
}); });

$('#project_template').change(); $('#project_template').change();

}); });




Expand All @@ -121,16 +137,16 @@ function open_menu(dom_id){
// arrow images // arrow images
$(dom_id + "_arrow_right").hide(); $(dom_id + "_arrow_right").hide();
$(dom_id + "_arrow_down").show(); $(dom_id + "_arrow_down").show();

// stages // stages
$(dom_id + "_stages").show(); $(dom_id + "_stages").show();
} }


function close_menu(dom_id){ function close_menu(dom_id){
// arrow images // arrow images
$(dom_id + "_arrow_right").show(); $(dom_id + "_arrow_right").show();
$(dom_id + "_arrow_down").hide(); $(dom_id + "_arrow_down").hide();

// stages // stages
$(dom_id + "_stages").hide(); $(dom_id + "_stages").hide();
} }
13 changes: 13 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "compass";

$margin: 25px; $margin: 25px;
$menu_width: 170px; $menu_width: 170px;
$red: #A40008; $red: #A40008;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */ * <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */


@import "compass/reset"; @import "compass/reset";
@import "compass";
@import "base";
8 changes: 2 additions & 6 deletions app/views/layouts/application.html.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
<title>Peritor Webistrano - <%= @page_title %></title> <title>Peritor Webistrano - <%= @page_title %></title>
<link rel="shortcut icon" href="/favicon.ico" /> <link rel="shortcut icon" href="/favicon.ico" />


<%= javascript_include_tag 'jquery.min', 'application' %> <%= javascript_include_tag 'application' %>
<%= stylesheet_link_tag 'screen.css', :media => 'screen, projection' %> <%= stylesheet_link_tag 'application' %>
<%= stylesheet_link_tag 'print.css', :media => 'print' %>
<!--[if IE]>
<%= stylesheet_link_tag 'ie.css', :media => 'screen, projection' %>
<![endif]-->
<%= yield :page_scripts %> <%= yield :page_scripts %>
</head> </head>
Expand Down
11 changes: 7 additions & 4 deletions config/application.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@


# If you have a Gemfile, require the gems listed there, including any gems # If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler) Bundler.require(:default, :assets, Rails.env) if defined?(Bundler)


module Webistrano module Webistrano
class Application < Rails::Application class Application < Rails::Application


# Make Active Record use UTC-base instead of local time # Make Active Record use UTC-base instead of local time
config.time_zone = 'UTC' config.time_zone = 'UTC'
config.encoding = "utf-8" config.encoding = "utf-8"
Expand All @@ -24,6 +22,11 @@ class Application < Rails::Application
config.secret_token = WebistranoConfig[:session_secret] config.secret_token = WebistranoConfig[:session_secret]
end end


# Enable the asset pipeline
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end end
end end


Expand All @@ -37,4 +40,4 @@ class Application < Rails::Application
# set default time_zone to UTC # set default time_zone to UTC
# TODO - is this needed? -- fd # TODO - is this needed? -- fd
ENV['TZ'] = 'UTC' ENV['TZ'] = 'UTC'
Time.zone = 'UTC' Time.zone = 'UTC'
10 changes: 0 additions & 10 deletions config/compass.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,2 @@
# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here. # Require any additional compass plugins here.
project_type = :rails project_type = :rails
project_path = Compass::AppIntegration::Rails.root
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/stylesheets"
images_dir = "public/images"
sass_dir = "app/stylesheets"
environment = Compass::AppIntegration::Rails.env
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
7 changes: 6 additions & 1 deletion config/environments/development.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@


# Only use best-standards-support built into browsers # Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin config.action_dispatch.best_standards_support = :builtin
end


# Do not compress assets
config.assets.compress = false

# Expands the lines which load the assets
config.assets.debug = true
end
3 changes: 0 additions & 3 deletions config/initializers/compass.rb

This file was deleted.

Loading

0 comments on commit a34665d

Please sign in to comment.