From bfd5b29a9a9cfae4db335cf34d5ee6ca7d6b4655 Mon Sep 17 00:00:00 2001 From: Alan Bradburne Date: Thu, 9 Feb 2012 23:26:47 +0000 Subject: [PATCH] Upgrade to Rails 3.2 and move some of the assets to the asset pipeline directories --- .gitignore | 8 + Gemfile | 3 +- Gemfile.lock | 165 +++++++++-------- app/assets/javascripts/application.js | 9 + app/assets/stylesheets/application.css | 7 + {public => app/assets}/stylesheets/custom.css | 0 app/views/layouts/application.html.erb | 7 +- config/application.rb | 17 +- config/environments/development.rb | 14 +- config/environments/production.rb | 15 ++ config/environments/test.rb | 7 + public/images/rails.png | Bin 6646 -> 0 bytes public/javascripts/application.js | 2 - public/javascripts/rails.js | 175 ------------------ public/stylesheets/.gitkeep | 0 15 files changed, 169 insertions(+), 260 deletions(-) create mode 100644 .gitignore create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/application.css rename {public => app/assets}/stylesheets/custom.css (100%) delete mode 100644 public/images/rails.png delete mode 100644 public/javascripts/application.js delete mode 100644 public/javascripts/rails.js delete mode 100644 public/stylesheets/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97e8767 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +log/*.log +tmp/**/* +tmp/restart.txt +config/database.yml +.DS_Store +db/*.sqlite3 +.bundle +.bundle/* \ No newline at end of file diff --git a/Gemfile b/Gemfile index d3da094..3a76010 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,9 @@ source 'http://rubygems.org' -gem 'rails', '3.0.4' +gem 'rails', '3.2.1' gem 'mysql2' gem 'authlogic' +gem 'jquery-rails' # Bundle gems for the local environment. Make sure to # put test-only gems in this group so their generators diff --git a/Gemfile.lock b/Gemfile.lock index fc51b62..50c8e89 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,90 +1,108 @@ GEM remote: http://rubygems.org/ specs: - ZenTest (4.5.0) - abstract (1.0.0) - actionmailer (3.0.4) - actionpack (= 3.0.4) - mail (~> 2.2.15) - actionpack (3.0.4) - activemodel (= 3.0.4) - activesupport (= 3.0.4) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.4) - rack (~> 1.2.1) - rack-mount (~> 0.6.13) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.4) - activesupport (= 3.0.4) - builder (~> 2.1.2) - i18n (~> 0.4) - activerecord (3.0.4) - activemodel (= 3.0.4) - activesupport (= 3.0.4) - arel (~> 2.0.2) - tzinfo (~> 0.3.23) - activeresource (3.0.4) - activemodel (= 3.0.4) - activesupport (= 3.0.4) - activesupport (3.0.4) + ZenTest (4.6.2) + actionmailer (3.2.1) + actionpack (= 3.2.1) + mail (~> 2.4.0) + actionpack (3.2.1) + activemodel (= 3.2.1) + activesupport (= 3.2.1) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.1) + rack-test (~> 0.6.1) + sprockets (~> 2.1.2) + activemodel (3.2.1) + activesupport (= 3.2.1) + builder (~> 3.0.0) + activerecord (3.2.1) + activemodel (= 3.2.1) + activesupport (= 3.2.1) + arel (~> 3.0.0) + tzinfo (~> 0.3.29) + activeresource (3.2.1) + activemodel (= 3.2.1) + activesupport (= 3.2.1) + activesupport (3.2.1) + i18n (~> 0.6) + multi_json (~> 1.0) annotate (2.4.0) - arel (2.0.9) - authlogic (2.1.6) - activesupport + arel (3.0.0) + authlogic (3.1.0) + activerecord (>= 3.0.7) + activerecord (>= 3.0.7) autotest (4.4.6) ZenTest (>= 4.4.1) - builder (2.1.2) - diff-lcs (1.1.2) - erubis (2.6.6) - abstract (>= 1.0.0) - i18n (0.5.0) - mail (2.2.15) - activesupport (>= 2.3.6) + builder (3.0.0) + diff-lcs (1.1.3) + erubis (2.7.0) + hike (1.2.1) + i18n (0.6.0) + journey (1.0.1) + jquery-rails (2.0.0) + railties (>= 3.2.0.beta, < 5.0) + thor (~> 0.14) + json (1.6.5) + mail (2.4.1) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.16) - mysql2 (0.2.7) - nokogiri (1.4.4) - polyglot (0.3.1) - rack (1.2.2) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-test (0.5.7) + mime-types (1.17.2) + multi_json (1.0.4) + mysql2 (0.3.11) + nokogiri (1.5.0) + polyglot (0.3.3) + rack (1.4.1) + rack-cache (1.1) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) rack (>= 1.0) - rails (3.0.4) - actionmailer (= 3.0.4) - actionpack (= 3.0.4) - activerecord (= 3.0.4) - activeresource (= 3.0.4) - activesupport (= 3.0.4) + rails (3.2.1) + actionmailer (= 3.2.1) + actionpack (= 3.2.1) + activerecord (= 3.2.1) + activeresource (= 3.2.1) + activesupport (= 3.2.1) bundler (~> 1.0) - railties (= 3.0.4) - railties (3.0.4) - actionpack (= 3.0.4) - activesupport (= 3.0.4) + railties (= 3.2.1) + railties (3.2.1) + actionpack (= 3.2.1) + activesupport (= 3.2.1) + rack-ssl (~> 1.3.2) rake (>= 0.8.7) - thor (~> 0.14.4) - rake (0.8.7) - rspec (2.5.0) - rspec-core (~> 2.5.0) - rspec-expectations (~> 2.5.0) - rspec-mocks (~> 2.5.0) - rspec-core (2.5.1) - rspec-expectations (2.5.0) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2.2) + rdoc (3.12) + json (~> 1.4) + rspec (2.8.0) + rspec-core (~> 2.8.0) + rspec-expectations (~> 2.8.0) + rspec-mocks (~> 2.8.0) + rspec-core (2.8.0) + rspec-expectations (2.8.0) diff-lcs (~> 1.1.2) - rspec-mocks (2.5.0) - rspec-rails (2.5.0) - actionpack (~> 3.0) - activesupport (~> 3.0) - railties (~> 3.0) - rspec (~> 2.5.0) + rspec-mocks (2.8.0) + rspec-rails (2.8.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.8.0) + sprockets (2.1.2) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) thor (0.14.6) - treetop (1.4.9) + tilt (1.3.3) + treetop (1.4.10) + polyglot polyglot (>= 0.3.1) - tzinfo (0.3.25) + tzinfo (0.3.31) webrat (0.7.3) nokogiri (>= 1.2.0) rack (>= 1.0) @@ -97,8 +115,9 @@ DEPENDENCIES annotate authlogic autotest + jquery-rails mysql2 - rails (= 3.0.4) + rails (= 3.2.1) rspec (>= 2.0.0.beta.20) rspec-rails (>= 2.0.0.beta.20) webrat diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..13d9269 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..fc25b57 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,7 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. 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 . +*/ \ No newline at end of file diff --git a/public/stylesheets/custom.css b/app/assets/stylesheets/custom.css similarity index 100% rename from public/stylesheets/custom.css rename to app/assets/stylesheets/custom.css diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ecfe167..c6d20f8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,10 +2,9 @@ <%= @title.nil? ? (@menu.nil? ? t(:application_name) : @menu.capitalize + ' - ' + t(:application_name)) : @title + ' - ' + t(:application_name) %> - <%= stylesheet_link_tag :all %> - - <%= csrf_meta_tag %> - + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tag %>
diff --git a/config/application.rb b/config/application.rb index ae2d478..cc909aa 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,9 +2,12 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' -# If you have a Gemfile, require the gems listed there, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) if defined?(Bundler) +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + # Bundler.require *Rails.groups(:assets => %w(development test)) + # If you want your assets lazily compiled in production, use this line + Bundler.require(:default, :assets, Rails.env) +end module Thingspeak class Application < Rails::Application @@ -13,7 +16,7 @@ module Thingspeak # -- all .rb files in that directory are automatically loaded. # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) + config.autoload_paths += %W(#{config.root}/lib) # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. @@ -38,5 +41,11 @@ module Thingspeak # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] + + # 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 diff --git a/config/environments/development.rb b/config/environments/development.rb index 4d2a397..a2d2c25 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -11,7 +11,6 @@ Thingspeak::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_view.debug_rjs = true config.action_controller.perform_caching = false # Don't care if the mailer can't send @@ -22,5 +21,18 @@ Thingspeak::Application.configure do # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index c257e2e..0ff6c1a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -46,4 +46,19 @@ Thingspeak::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to Rails.root.join("public/assets") + # config.assets.manifest = YOUR_PATH + + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :scss end diff --git a/config/environments/test.rb b/config/environments/test.rb index c582f11..8ccb53b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -32,4 +32,11 @@ Thingspeak::Application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr + + # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets + config.assets.allow_debugging = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" end diff --git a/public/images/rails.png b/public/images/rails.png deleted file mode 100644 index d5edc04e65f555e3ba4dcdaad39dc352e75b575e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6646 zcmVpVcQya!6@Dsmj@#jv7C*qh zIhOJ6_K0n?*d`*T7TDuW-}m`9Kz3~>+7`DUkbAraU%yi+R{N~~XA2B%zt-4=tLimUer9!2M~N{G5bftFij_O&)a zsHnOppFIzebQ`RA0$!yUM-lg#*o@_O2wf422iLnM6cU(ktYU8#;*G!QGhIy9+ZfzKjLuZo%@a z-i@9A`X%J{^;2q&ZHY3C(B%gqCPW!8{9C0PMcNZccefK){s|V5-xxtHQc@uf>XqhD z7#N^siWqetgq29aX>G^olMf=bbRF6@Y(}zYxw6o!9WBdG1unP}<(V;zKlcR2p86fq zYjaqB^;Ycq>Wy@5T1xOzG3tucG3e%nPvajaN{CrFbnzv^9&K3$NrDm*eQe4`BGQ2bI;dFEwyt>hK%X!L6)82aOZp zsrGcJ#7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l4>@%2nl zS)mDikfmokO4q2A)hRVZBq2-5q&XC>%HOLkOYxZ66(s86?=0s4z5xbiOV)}L-&6b)h6(~CIaR#JNw~46+WBiU7IhB zq!NuR4!TsYnyBg>@G=Ib*cMq^k<}AMpCeYEf&dzfiGI-wOQ7hb+nA zkN7_){y&c3xC0 AQ~&?~ diff --git a/public/javascripts/application.js b/public/javascripts/application.js deleted file mode 100644 index fe45776..0000000 --- a/public/javascripts/application.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/public/javascripts/rails.js b/public/javascripts/rails.js deleted file mode 100644 index 4283ed8..0000000 --- a/public/javascripts/rails.js +++ /dev/null @@ -1,175 +0,0 @@ -(function() { - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - function isEventSupported(eventName) { - var el = document.createElement('div'); - eventName = 'on' + eventName; - var isSupported = (eventName in el); - if (!isSupported) { - el.setAttribute(eventName, 'return;'); - isSupported = typeof el[eventName] == 'function'; - } - el = null; - return isSupported; - } - - function isForm(element) { - return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM' - } - - function isInput(element) { - if (Object.isElement(element)) { - var name = element.nodeName.toUpperCase() - return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA' - } - else return false - } - - var submitBubbles = isEventSupported('submit'), - changeBubbles = isEventSupported('change') - - if (!submitBubbles || !changeBubbles) { - // augment the Event.Handler class to observe custom events when needed - Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap( - function(init, element, eventName, selector, callback) { - init(element, eventName, selector, callback) - // is the handler being attached to an element that doesn't support this event? - if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) || - (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) { - // "submit" => "emulated:submit" - this.eventName = 'emulated:' + this.eventName - } - } - ) - } - - if (!submitBubbles) { - // discover forms on the page by observing focus events which always bubble - document.on('focusin', 'form', function(focusEvent, form) { - // special handler for the real "submit" event (one-time operation) - if (!form.retrieve('emulated:submit')) { - form.on('submit', function(submitEvent) { - var emulated = form.fire('emulated:submit', submitEvent, true) - // if custom event received preventDefault, cancel the real one too - if (emulated.returnValue === false) submitEvent.preventDefault() - }) - form.store('emulated:submit', true) - } - }) - } - - if (!changeBubbles) { - // discover form inputs on the page - document.on('focusin', 'input, select, texarea', function(focusEvent, input) { - // special handler for real "change" events - if (!input.retrieve('emulated:change')) { - input.on('change', function(changeEvent) { - input.fire('emulated:change', changeEvent, true) - }) - input.store('emulated:change', true) - } - }) - } - - function handleRemote(element) { - var method, url, params; - - var event = element.fire("ajax:before"); - if (event.stopped) return false; - - if (element.tagName.toLowerCase() === 'form') { - method = element.readAttribute('method') || 'post'; - url = element.readAttribute('action'); - params = element.serialize(); - } else { - method = element.readAttribute('data-method') || 'get'; - url = element.readAttribute('href'); - params = {}; - } - - new Ajax.Request(url, { - method: method, - parameters: params, - evalScripts: true, - - onComplete: function(request) { element.fire("ajax:complete", request); }, - onSuccess: function(request) { element.fire("ajax:success", request); }, - onFailure: function(request) { element.fire("ajax:failure", request); } - }); - - element.fire("ajax:after"); - } - - function handleMethod(element) { - var method = element.readAttribute('data-method'), - url = element.readAttribute('href'), - csrf_param = $$('meta[name=csrf-param]')[0], - csrf_token = $$('meta[name=csrf-token]')[0]; - - var form = new Element('form', { method: "POST", action: url, style: "display: none;" }); - element.parentNode.insert(form); - - if (method !== 'post') { - var field = new Element('input', { type: 'hidden', name: '_method', value: method }); - form.insert(field); - } - - if (csrf_param) { - var param = csrf_param.readAttribute('content'), - token = csrf_token.readAttribute('content'), - field = new Element('input', { type: 'hidden', name: param, value: token }); - form.insert(field); - } - - form.submit(); - } - - - document.on("click", "*[data-confirm]", function(event, element) { - var message = element.readAttribute('data-confirm'); - if (!confirm(message)) event.stop(); - }); - - document.on("click", "a[data-remote]", function(event, element) { - if (event.stopped) return; - handleRemote(element); - event.stop(); - }); - - document.on("click", "a[data-method]", function(event, element) { - if (event.stopped) return; - handleMethod(element); - event.stop(); - }); - - document.on("submit", function(event) { - var element = event.findElement(), - message = element.readAttribute('data-confirm'); - if (message && !confirm(message)) { - event.stop(); - return false; - } - - var inputs = element.select("input[type=submit][data-disable-with]"); - inputs.each(function(input) { - input.disabled = true; - input.writeAttribute('data-original-value', input.value); - input.value = input.readAttribute('data-disable-with'); - }); - - var element = event.findElement("form[data-remote]"); - if (element) { - handleRemote(element); - event.stop(); - } - }); - - document.on("ajax:after", "form", function(event, element) { - var inputs = element.select("input[type=submit][disabled=true][data-disable-with]"); - inputs.each(function(input) { - input.value = input.readAttribute('data-original-value'); - input.removeAttribute('data-original-value'); - input.disabled = false; - }); - }); -})(); diff --git a/public/stylesheets/.gitkeep b/public/stylesheets/.gitkeep deleted file mode 100644 index e69de29..0000000