Upgrade to Rails 3.1.0.beta1

This commit is contained in:
Erik Michaels-Ober 2011-05-05 19:38:25 -07:00
parent f9ec0215e4
commit 33b36c97e8
34 changed files with 166 additions and 90 deletions

10
Gemfile
View File

@ -1,13 +1,21 @@
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'rails' gem 'rails', '3.1.0.beta1'
gem 'geokit' gem 'geokit'
gem 'devise' gem 'devise'
# Asset template engines
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
group :development do group :development do
gem 'pg' gem 'pg'
end end
group :test do group :test do
gem 'turn', :require => false
gem 'sqlite3' gem 'sqlite3'
end end

View File

@ -1,77 +1,107 @@
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
abstract (1.0.0) actionmailer (3.1.0.beta1)
actionmailer (3.0.7) actionpack (= 3.1.0.beta1)
actionpack (= 3.0.7) mail (~> 2.3.0)
mail (~> 2.2.15) actionpack (3.1.0.beta1)
actionpack (3.0.7) activemodel (= 3.1.0.beta1)
activemodel (= 3.0.7) activesupport (= 3.1.0.beta1)
activesupport (= 3.0.7) builder (~> 3.0.0)
builder (~> 2.1.2) erubis (~> 2.7.0)
erubis (~> 2.6.6) i18n (~> 0.6.0beta1)
i18n (~> 0.5.0) rack (~> 1.3.0.beta)
rack (~> 1.2.1) rack-cache (~> 1.0.1)
rack-mount (~> 0.6.14) rack-mount (~> 0.7.2)
rack-test (~> 0.5.7) rack-test (~> 0.6.0)
tzinfo (~> 0.3.23) sprockets (~> 2.0.0.beta.2)
activemodel (3.0.7) tzinfo (~> 0.3.27)
activesupport (= 3.0.7) activemodel (3.1.0.beta1)
builder (~> 2.1.2) activesupport (= 3.1.0.beta1)
i18n (~> 0.5.0) bcrypt-ruby (~> 2.1.4)
activerecord (3.0.7) builder (~> 3.0.0)
activemodel (= 3.0.7) i18n (~> 0.6.0beta1)
activesupport (= 3.0.7) activerecord (3.1.0.beta1)
arel (~> 2.0.2) activemodel (= 3.1.0.beta1)
tzinfo (~> 0.3.23) activesupport (= 3.1.0.beta1)
activeresource (3.0.7) arel (~> 2.1.0)
activemodel (= 3.0.7) tzinfo (~> 0.3.27)
activesupport (= 3.0.7) activeresource (3.1.0.beta1)
activesupport (3.0.7) activemodel (= 3.1.0.beta1)
arel (2.0.9) activesupport (= 3.1.0.beta1)
activesupport (3.1.0.beta1)
multi_json (~> 1.0)
ansi (1.2.5)
arel (2.1.0)
bcrypt-ruby (2.1.4) bcrypt-ruby (2.1.4)
builder (2.1.2) builder (3.0.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.0)
devise (1.3.4) devise (1.3.4)
bcrypt-ruby (~> 2.1.2) bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3) orm_adapter (~> 0.0.3)
warden (~> 1.0.3) warden (~> 1.0.3)
erubis (2.6.6) erubis (2.7.0)
abstract (>= 1.0.0) execjs (0.3.2)
multi_json (~> 1.0)
geokit (1.5.0) geokit (1.5.0)
i18n (0.5.0) hike (1.0.0)
mail (2.2.19) i18n (0.6.0beta1)
activesupport (>= 2.3.6) jquery-rails (1.0)
rails (~> 3.0)
thor (~> 0.14)
json (1.5.1)
mail (2.3.0)
i18n (>= 0.4.0) i18n (>= 0.4.0)
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
mime-types (1.16) mime-types (1.16)
multi_json (1.0.1)
orm_adapter (0.0.4) orm_adapter (0.0.4)
pg (0.11.0) pg (0.11.0)
polyglot (0.3.1) polyglot (0.3.1)
rack (1.2.2) rack (1.3.0.beta)
rack-mount (0.6.14) rack-cache (1.0.1)
rack (>= 0.4)
rack-mount (0.7.2)
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (0.5.7) rack-ssl (1.3.2)
rack
rack-test (0.6.0)
rack (>= 1.0) rack (>= 1.0)
rails (3.0.7) rails (3.1.0.beta1)
actionmailer (= 3.0.7) actionmailer (= 3.1.0.beta1)
actionpack (= 3.0.7) actionpack (= 3.1.0.beta1)
activerecord (= 3.0.7) activerecord (= 3.1.0.beta1)
activeresource (= 3.0.7) activeresource (= 3.1.0.beta1)
activesupport (= 3.0.7) activesupport (= 3.1.0.beta1)
bundler (~> 1.0) bundler (~> 1.0)
railties (= 3.0.7) railties (= 3.1.0.beta1)
railties (3.0.7) railties (3.1.0.beta1)
actionpack (= 3.0.7) actionpack (= 3.1.0.beta1)
activesupport (= 3.0.7) activesupport (= 3.1.0.beta1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (~> 0.14.4) thor (~> 0.14.6)
rake (0.8.7) rake (0.8.7)
sass (3.1.1)
sprockets (2.0.0.beta.2)
hike (~> 1.0)
rack (~> 1.0)
tilt (~> 1.0)
sqlite3 (1.3.3) sqlite3 (1.3.3)
thor (0.14.6) thor (0.14.6)
tilt (1.3)
treetop (1.4.9) treetop (1.4.9)
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
turn (0.8.2)
ansi (>= 1.2.2)
tzinfo (0.3.27) tzinfo (0.3.27)
uglifier (0.5.1)
execjs
json
warden (1.0.4) warden (1.0.4)
rack (>= 1.0) rack (>= 1.0)
@ -79,8 +109,13 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
coffee-script
devise devise
geokit geokit
jquery-rails
pg pg
rails rails (= 3.1.0.beta1)
sass
sqlite3 sqlite3
turn
uglifier

View File

@ -1,7 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake, # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__) require File.expand_path('../config/application', __FILE__)
require 'rake'
AdoptAHydrant::Application.load_tasks AdoptAHydrant::Application.load_tasks

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -20,7 +20,7 @@ $(function() {
new google.maps.Point(0, 0), new google.maps.Point(0, 0),
new google.maps.Point(13.0, 18.0) new google.maps.Point(13.0, 18.0)
); );
var shadow = new google.maps.MarkerImage('/images/markers/shadow.png', var shadow = new google.maps.MarkerImage('/assets/markers/shadow.png',
new google.maps.Size(46.0, 37.0), new google.maps.Size(46.0, 37.0),
new google.maps.Point(0, 0), new google.maps.Point(0, 0),
new google.maps.Point(13.0, 18.0) new google.maps.Point(13.0, 18.0)
@ -84,7 +84,6 @@ $(function() {
$('#address').removeClass('error', 500); $('#address').removeClass('error', 500);
var i = -1; var i = -1;
$(data).each(function(index, hydrant) { $(data).each(function(index, hydrant) {
hydrant = hydrant.hydrant;
if($.inArray(hydrant.id, hydrantIds) == -1) { if($.inArray(hydrant.id, hydrantIds) == -1) {
i += 1; i += 1;
} else { } else {
@ -93,7 +92,7 @@ $(function() {
} }
setTimeout(function() { setTimeout(function() {
point = new google.maps.LatLng(hydrant.lat, hydrant.lng); point = new google.maps.LatLng(hydrant.lat, hydrant.lng);
color = '/images/markers/' + (hydrant.user_id ? 'green' : 'red') + '.png'; color = '/assets/markers/' + (hydrant.user_id ? 'green' : 'red') + '.png';
addMarker(hydrant.id, point, color); addMarker(hydrant.id, point, color);
}, i * 100); }, i * 100);
}); });
@ -424,7 +423,7 @@ $(function() {
success: function(data) { success: function(data) {
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
image = new google.maps.MarkerImage('/images/markers/green.png', image = new google.maps.MarkerImage('/assets/markers/green.png',
new google.maps.Size(27.0, 37.0), new google.maps.Size(27.0, 37.0),
new google.maps.Point(0, 0), new google.maps.Point(0, 0),
new google.maps.Point(13.0, 18.0) new google.maps.Point(13.0, 18.0)
@ -475,7 +474,7 @@ $(function() {
}, },
success: function(data) { success: function(data) {
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
image = new google.maps.MarkerImage('/images/markers/red.png', image = new google.maps.MarkerImage('/assets/markers/red.png',
new google.maps.Size(27.0, 37.0), new google.maps.Size(27.0, 37.0),
new google.maps.Point(0, 0), new google.maps.Point(0, 0),
new google.maps.Point(13.0, 18.0) new google.maps.Point(13.0, 18.0)
@ -527,7 +526,7 @@ $(function() {
}, },
success: function(data) { success: function(data) {
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
image = new google.maps.MarkerImage('/images/markers/red.png', image = new google.maps.MarkerImage('/assets/markers/red.png',
new google.maps.Size(27.0, 37.0), new google.maps.Size(27.0, 37.0),
new google.maps.Point(0, 0), new google.maps.Point(0, 0),
new google.maps.Point(13.0, 18.0) new google.maps.Point(13.0, 18.0)

View File

@ -1,8 +1,10 @@
class AddressesController < ApplicationController class AddressesController < ApplicationController
respond_to :json
def show def show
@address = Address.find_lat_lng("#{params[:address]}, #{params[:city_state]}") @address = Address.find_lat_lng("#{params[:address]}, #{params[:city_state]}")
unless @address.blank? unless @address.blank?
render(:json => @address) respond_with @address
else else
render(:json => {"errors" => {"address" => ["Could not find address."]}}) render(:json => {"errors" => {"address" => ["Could not find address."]}})
end end

View File

@ -1,4 +1,6 @@
class HydrantsController < ApplicationController class HydrantsController < ApplicationController
respond_to :json, :only => [:list, :update]
def show def show
@hydrant = Hydrant.find_by_id(params[:hydrant_id]) @hydrant = Hydrant.find_by_id(params[:hydrant_id])
if @hydrant.adopted? if @hydrant.adopted?
@ -19,7 +21,7 @@ class HydrantsController < ApplicationController
def list def list
@hydrants = Hydrant.find_closest(params[:lat], params[:lng]) @hydrants = Hydrant.find_closest(params[:lat], params[:lng])
unless @hydrants.blank? unless @hydrants.blank?
render(:json => @hydrants) respond_with @hydrants
else else
render(:json => {"errors" => {"address" => ["Could not find address."]}}) render(:json => {"errors" => {"address" => ["Could not find address."]}})
end end
@ -28,7 +30,7 @@ class HydrantsController < ApplicationController
def update def update
@hydrant = Hydrant.find(params[:id]) @hydrant = Hydrant.find(params[:id])
if @hydrant.update_attributes(params[:hydrant]) if @hydrant.update_attributes(params[:hydrant])
render(:json => @hydrant) respond_with @hydrant
else else
render(:json => {"errors" => @hydrant.errors}) render(:json => {"errors" => @hydrant.errors})
end end

View File

@ -1,4 +1,6 @@
class UsersController < Devise::RegistrationsController class UsersController < Devise::RegistrationsController
respond_to :json, :only => [:create]
def edit def edit
render("edit", :layout => "info_window") render("edit", :layout => "info_window")
end end
@ -21,7 +23,7 @@ class UsersController < Devise::RegistrationsController
else else
expire_session_data_after_sign_in! expire_session_data_after_sign_in!
end end
render(:json => resource) respond_with resource
else else
clean_up_passwords(resource) clean_up_passwords(resource)
render(:json => {"errors" => resource.errors}) render(:json => {"errors" => resource.errors})

0
app/models/.gitkeep Normal file
View File

View File

@ -7,7 +7,7 @@
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" %> <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" %>
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" %> <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" %>
<%= javascript_include_tag "https://github.com/scottschiller/Snowstorm/raw/master/snowstorm-min.js" %> <%= javascript_include_tag "https://github.com/scottschiller/Snowstorm/raw/master/snowstorm-min.js" %>
<%= javascript_include_tag :all %> <%= javascript_include_tag "main" %>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
</head> </head>

View File

@ -1,5 +1,5 @@
<div id="loader" style="display: none;"> <div id="loader" style="display: none;">
<img src="/images/ajax-loader.gif" /> <%= image_tag "ajax-loader.gif" %>
</div> </div>
<div id="info_window"> <div id="info_window">
<%= yield %> <%= yield %>

View File

@ -30,13 +30,24 @@ module AdoptAHydrant
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
# Please note that JavaScript expansions are *ignored altogether* if the asset
# pipeline is enabled (see config.assets.enabled below). Put your defaults in
# app/assets/javascripts/application.js in that case.
#
# JavaScript files you want as :defaults (application.js is always included). # JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails) # config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs)
# Configure the default encoding used in templates for Ruby 1.9. # Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8" config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password] config.filter_parameters += [:password]
# Enable IdentityMap for Active Record, to disable set to false or remove the line below.
config.active_record.identity_map = true
# Enable the asset pipeline
config.assets.enabled = true
end end
end end

View File

@ -3,7 +3,7 @@ AdoptAHydrant::Application.configure do
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes. # since you don't have to restart the web server when you make code changes.
config.cache_classes = false config.cache_classes = false
# Log error messages when you accidentally call methods on nil. # Log error messages when you accidentally call methods on nil.
@ -11,18 +11,15 @@ AdoptAHydrant::Application.configure do
# Show full error reports and disable caching # Show full error reports and disable caching
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
# Print deprecation notices to the Rails logger # Print deprecation notices to the Rails logger
config.active_support.deprecation = :log config.active_support.deprecation = :log
# 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
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
end end

View File

@ -1,7 +1,6 @@
AdoptAHydrant::Application.configure do AdoptAHydrant::Application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests # Code is not reloaded between requests
config.cache_classes = true config.cache_classes = true
@ -9,14 +8,19 @@ AdoptAHydrant::Application.configure do
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress both stylesheets and JavaScripts
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :scss
# Specifies the header that your server uses for sending files # Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile" # (comment out if your front-end server doesn't support this)
config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
# For nginx: # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # config.force_ssl = true
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info) # See everything in the log (default is :info)
# config.log_level = :debug # config.log_level = :debug
@ -27,15 +31,15 @@ AdoptAHydrant::Application.configure do
# Use a different cache store in production # Use a different cache store in production
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server # Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored # Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {:host => 'adoptahydrant.org'}
# Enable threaded mode # Enable threaded mode
# config.threadsafe! # config.threadsafe!
@ -46,6 +50,5 @@ AdoptAHydrant::Application.configure do
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
end end

View File

@ -7,7 +7,11 @@ AdoptAHydrant::Application.configure do
# and recreated between test runs. Don't rely on the data there! # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = true
# Log error messages when you accidentally call methods on nil. # Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true config.whiny_nils = true
# Show full error reports and disable caching # Show full error reports and disable caching
@ -24,6 +28,7 @@ AdoptAHydrant::Application.configure do
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
# Use SQL instead of Active Record's schema dumper when creating the test database. # Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper, # This is necessary if your schema can't be completely dumped by the schema dumper,
@ -32,6 +37,4 @@ AdoptAHydrant::Application.configure do
# Print deprecation notices to the stderr # Print deprecation notices to the stderr
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
config.action_mailer.default_url_options = {:host => 'adoptahydrant.com'}
end end

View File

@ -0,0 +1,12 @@
# Be sure to restart your server when you modify this file.
#
# This file contains the settings for ActionController::ParametersWrapper
# which will be enabled by default in the upcoming version of Ruby on Rails.
# Enable parameter wrapping for JSON. You can disable this by set :format to empty array.
ActionController::Base.wrap_parameters :format => [:json]
# Disable root element in JSON by default.
if defined?(ActiveRecord)
ActiveRecord::Base.include_root_in_json = false
end

View File

@ -1,5 +1,5 @@
# Sample localization file for English. Add more files in this directory for other locales. # Sample localization file for English. Add more files in this directory for other locales.
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en: en:
hello: "Hello world" hello: "Hello world"

0
log/.gitkeep Normal file
View File

View File

@ -1,3 +1,5 @@
User-Agent: * # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
Disallow: / #
Allow: /$ # To ban all spiders from the entire site uncomment the next two lines:
# User-Agent: *
# Disallow: /

0
test/fixtures/.gitkeep vendored Normal file
View File

0
test/functional/.gitkeep Normal file
View File

View File

0
test/unit/.gitkeep Normal file
View File

0
vendor/assets/stylesheets/.gitkeep vendored Normal file
View File