Update to rails 3

This commit is contained in:
Tom Hughes 2010-09-01 11:02:58 +01:00
parent 9ff70a861a
commit c9fa49c994
41 changed files with 4214 additions and 2461 deletions

25
Gemfile Normal file
View file

@ -0,0 +1,25 @@
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'pg'
gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml'
gem 'rmagick', :require => 'RMagick'
gem 'oauth', '>= 0.4.3'
gem 'oauth-plugin', '>= 0.3.14'
gem 'httpclient'
gem 'SystemTimer', '>= 1.1.3', :require => 'system_timer'
gem 'sanitize'
# Should only load if memcache is in use
gem 'memcached'
# Should only load if we're not in database offline mode
gem 'composite_primary_keys', '>= 3.0.0.0'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development, :test do
gem 'timecop'
end

View file

@ -1,10 +1,7 @@
# 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.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
OpenStreetMap::Application.load_tasks

View file

@ -1,7 +1,7 @@
# Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
protect_from_forgery
if STATUS == :database_readonly or STATUS == :database_offline
session :off

View file

@ -111,8 +111,6 @@ class DiaryEntryController < ApplicationController
end
def rss
request.format = :rss
if params[:display_name]
user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })

View file

@ -2,6 +2,7 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
<%= javascript_strings %>
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'rails' %>
<%= javascript_include_tag 'site' %>
<%= javascript_include_tag 'menu' %>
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
@ -16,5 +17,6 @@
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
<%= style_rules %>
<%= yield :head %>
<%= csrf_meta_tag %>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
</head>

4
config.ru Normal file
View file

@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run OpenStreetMap::Application

49
config/application.rb Normal file
View file

@ -0,0 +1,49 @@
require File.expand_path('../boot', __FILE__)
require File.expand_path('../preinitializer', __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)
module OpenStreetMap
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- 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}/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.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
config.active_record.observers = :spam_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# 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,
# like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
end
end

View file

@ -1,110 +1,13 @@
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
require 'rubygems'
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
defined? Rails::Initializer
end
def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end
def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end
class Boot
def run
load_initializer
Rails::Initializer.run(:set_load_path)
end
end
class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::GemDependency.add_frozen_gem_path
end
end
class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require 'initializer'
end
def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end
def load_rubygems
min_version = '1.3.1'
require 'rubygems'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end
def parse_gem_version(text)
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end
private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end
# All that for this:
Rails.boot!
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)

View file

@ -1,59 +1,5 @@
# Be sure to restart your server when you modify this file
# Load the rails application
require File.expand_path('../application', __FILE__)
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
# Specify gems that this application depends on and have them installed with rake gems:install
unless STATUS == :database_offline
config.gem 'composite_primary_keys', :version => '2.2.2'
end
config.gem 'libxml-ruby', :version => '>= 2.0.5', :lib => 'libxml'
config.gem 'rmagick', :lib => 'RMagick'
config.gem 'oauth', :version => '>= 0.4.3'
config.gem 'oauth-plugin', :version => '0.3.14'
config.gem 'httpclient'
config.gem 'SystemTimer', :version => '>= 1.1.3', :lib => 'system_timer'
config.gem 'sanitize'
config.gem 'i18n', :version => '>= 0.5.0'
if defined?(MEMCACHE_SERVERS)
config.gem 'memcached'
end
# 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
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
if STATUS == :database_offline
config.frameworks -= [ :active_record ]
config.eager_load_paths = []
end
# Activate observers that should always be running
config.active_record.observers = :spam_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
config.time_zone = 'UTC'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
# 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,
# like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
end
# Initialize the rails application
OpenStreetMap::Application.initialize!

View file

@ -1,17 +1,26 @@
# Settings specified here will take precedence over those in config/environment.rb
OpenStreetMap::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# 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.
config.cache_classes = false
# In the development environment your application's code is reloaded on
# 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.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# 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
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

View file

@ -1,36 +1,57 @@
# Settings specified here will take precedence over those in config/environment.rb
OpenStreetMap::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# Use a different log path in production
if defined?(LOG_PATH)
config.log_path = LOG_PATH
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# 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)
# config.log_level = :debug
# Use a different log path in production
if defined?(LOG_PATH)
config.log_path = LOG_PATH
end
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
if defined?(MEMCACHE_SERVERS)
MEMCACHE = Memcached::Rails.new(MEMCACHE_SERVERS, :binary_protocol => true)
config.cache_store = :mem_cache_store, MEMCACHE
end
# 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
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
if defined?(MEMCACHE_SERVERS)
MEMCACHE = Memcached::Rails.new(MEMCACHE_SERVERS, :binary_protocol => true)
config.cache_store = :mem_cache_store, MEMCACHE
end
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!

View file

@ -1,26 +1,30 @@
# Settings specified here will take precedence over those in config/environment.rb
OpenStreetMap::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_view.cache_template_loading = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Tell ActionMailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Load timecop to help with testing time dependent code
config.gem 'timecop'
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end

View file

@ -1,3 +0,0 @@
# Stop action controller from automatically parsing XML in request bodies
ActionController::Base.param_parsers.delete Mime::XML

View file

@ -0,0 +1,2 @@
# Stop rails from automatically parsing XML in request bodies
Rails.configuration.middleware.delete ActionDispatch::ParamsParser

View file

@ -3,5 +3,5 @@
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View file

@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'

View file

@ -1,21 +0,0 @@
# Be sure to restart your server when you modify this file.
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
# Store the full class name (including module namespace) in STI type column.
ActiveRecord::Base.store_full_sti_class = true
end
ActionController::Routing.generate_best_match = false
# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
# if you're including raw json in an HTML page.
ActiveSupport.escape_html_entities_in_json = false

View file

@ -2,6 +2,6 @@
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
ActionController::Base.cookie_verifier_secret = '67881c9e6670d9b55b43885ea8eab34e32865ce436bdbde73e1967a11a26674906736de0aa1a0d24edf8ebcb653e1735413e6fd24e1201338e397d4a2392c614';
OpenStreetMap::Application.config.secret_token = '67881c9e6670d9b55b43885ea8eab34e32865ce436bdbde73e1967a11a26674906736de0aa1a0d24edf8ebcb653e1735413e6fd24e1201338e397d4a2392c614'

View file

@ -1,17 +1,8 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
ActionController::Base.session = {
:key => '_osm_session',
:secret => 'd886369b1e709c61d1f9fcb07384a2b96373c83c01bfc98c6611a9fe2b6d0b14215bb360a0154265cccadde5489513f2f9b8d9e7b384a11924f772d2872c2a1f'
}
OpenStreetMap::Application.config.session_store :cookie_store, :key => '_osm_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
unless STATUS == :database_offline or STATUS == :database_readonly
ActionController::Base.session_store = :sql_session_store
end
# OpenStreetMap::Application.config.session_store :active_record_store

View file

@ -1,9 +1,8 @@
# Work out which session store adapter to use
environment = Rails.configuration.environment
adapter = Rails.configuration.database_configuration[environment]["adapter"]
adapter = Rails.configuration.database_configuration[Rails.env]["adapter"]
session_class = adapter + "_session"
# Configure SqlSessionStore
unless STATUS == :database_offline
unless STATUS == :database_offline
SqlSessionStore.session_class = session_class.camelize.constantize
end

View file

@ -1,6 +1,6 @@
require 'yaml'
config = YAML.load_file("#{RAILS_ROOT}/config/application.yml")
config = YAML.load_file(File.expand_path("../application.yml", __FILE__))
env = ENV['RAILS_ENV'] || 'development'
ENV.each do |key,value|

View file

@ -1,232 +1,233 @@
ActionController::Routing::Routes.draw do |map|
OpenStreetMap::Application.routes.draw do
# API
map.connect "api/capabilities", :controller => 'api', :action => 'capabilities'
map.connect "api/#{API_VERSION}/capabilities", :controller => 'api', :action => 'capabilities'
match 'api/capabilities' => 'api#capabilities'
match 'api/0.6/capabilities' => 'api#capabilities'
map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
map.connect "api/#{API_VERSION}/changeset/:id/upload", :controller => 'changeset', :action => 'upload', :id => /\d+/
map.changeset_download "api/#{API_VERSION}/changeset/:id/download", :controller => 'changeset', :action => 'download', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id/expand_bbox", :controller => 'changeset', :action => 'expand_bbox', :id => /\d+/
map.changeset_read "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close', :id =>/\d+/
map.connect "api/#{API_VERSION}/changesets", :controller => 'changeset', :action => 'query'
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
map.connect "api/#{API_VERSION}/node/:id/ways", :controller => 'way', :action => 'ways_for_node', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/relations", :controller => 'relation', :action => 'relations_for_node', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/:version", :controller => 'old_node', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/nodes", :controller => 'node', :action => 'nodes', :id => nil
map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/full", :controller => 'way', :action => 'full', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/relations", :controller => 'relation', :action => 'relations_for_way', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/:version", :controller => 'old_way', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/ways", :controller => 'way', :action => 'ways', :id => nil
match 'api/0.6/changeset/create' => 'changeset#create'
match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :id => /\d+/
match 'api/0.6/changeset/:id/download' => 'changeset#download', :as => :changeset_download, :id => /\d+/
match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :id => /\d+/
match 'api/0.6/changeset/:id' => 'changeset#read', :as => :changeset_read, :via => :get, :id => /\d+/
match 'api/0.6/changeset/:id' => 'changeset#update', :via => :put, :id => /\d+/
match 'api/0.6/changeset/:id/close' => 'changeset#close', :id => /\d+/
match 'api/0.6/changesets' => 'changeset#query', :id => nil
map.connect "api/#{API_VERSION}/relation/create", :controller => 'relation', :action => 'create'
map.connect "api/#{API_VERSION}/relation/:id/relations", :controller => 'relation', :action => 'relations_for_relation', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/history", :controller => 'old_relation', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/full", :controller => 'relation', :action => 'full', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/:version", :controller => 'old_relation', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/relations", :controller => 'relation', :action => 'relations', :id => nil
match 'api/0.6/node/create' => 'node#create'
match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :id => /\d+/
match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :id => /\d+/
match 'api/0.6/node/:id/history' => 'old_node#history', :id => /\d+/
match 'api/0.6/node/:id/:version' => 'old_node#version', :version => /\d+/, :id => /\d+/
match 'api/0.6/node/:id' => 'node#read', :via => :get, :id => /\d+/
match 'api/0.6/node/:id' => 'node#update', :via => :put, :id => /\d+/
match 'api/0.6/node/:id' => 'node#delete', :via => :delete, :id => /\d+/
match 'api/0.6/nodes' => 'node#nodes', :id => nil
map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
map.connect "api/#{API_VERSION}/trackpoints", :controller => 'api', :action => 'trackpoints'
match 'api/0.6/way/create' => 'way#create'
match 'api/0.6/way/:id/history' => 'old_way#history', :id => /\d+/
match 'api/0.6/way/:id/full' => 'way#full', :id => /\d+/
match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :id => /\d+/
match 'api/0.6/way/:id/:version' => 'old_way#version', :version => /\d+/, :id => /\d+/
match 'api/0.6/way/:id' => 'way#read', :via => :get, :id => /\d+/
match 'api/0.6/way/:id' => 'way#update', :via => :put, :id => /\d+/
match 'api/0.6/way/:id' => 'way#delete', :via => :delete, :id => /\d+/
match 'api/0.6/ways' => 'way#ways', :id => nil
map.connect "api/#{API_VERSION}/changes", :controller => 'api', :action => 'changes'
map.connect "api/#{API_VERSION}/search", :controller => 'search', :action => 'search_all'
map.connect "api/#{API_VERSION}/ways/search", :controller => 'search', :action => 'search_ways'
map.connect "api/#{API_VERSION}/relations/search", :controller => 'search', :action => 'search_relations'
map.connect "api/#{API_VERSION}/nodes/search", :controller => 'search', :action => 'search_nodes'
map.connect "api/#{API_VERSION}/user/details", :controller => 'user', :action => 'api_details'
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'read', :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'read_one', :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'update', :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'update_one', :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'delete_one', :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/user/gpx_files", :controller => 'user', :action => 'api_gpx_files'
map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/gpx/:id/details", :controller => 'trace', :action => 'api_read', :id => /\d+/
map.connect "api/#{API_VERSION}/gpx/:id/data", :controller => 'trace', :action => 'api_data', :id => /\d+/
map.connect "api/#{API_VERSION}/gpx/:id/data.:format", :controller => 'trace', :action => 'api_data', :id => /\d+/
match 'api/0.6/relation/create' => 'relation#create'
match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :id => /\d+/
match 'api/0.6/relation/:id/history' => 'old_relation#history', :id => /\d+/
match 'api/0.6/relation/:id/full' => 'relation#full', :id => /\d+/
match 'api/0.6/relation/:id/:version' => 'old_relation#version', :version => /\d+/, :id => /\d+/
match 'api/0.6/relation/:id' => 'relation#read', :via => :get, :id => /\d+/
match 'api/0.6/relation/:id' => 'relation#update', :via => :put, :id => /\d+/
match 'api/0.6/relation/:id' => 'relation#delete', :via => :delete, :id => /\d+/
match 'api/0.6/relations' => 'relation#relations'
match 'api/0.6/map' => 'api#map'
match 'api/0.6/trackpoints' => 'api#trackpoints'
match 'api/0.6/changes' => 'api#changes'
match 'api/0.6/search' => 'search#search_all'
match 'api/0.6/ways/search' => 'search#search_ways'
match 'api/0.6/relations/search' => 'search#search_relations'
match 'api/0.6/nodes/search' => 'search#search_nodes'
match 'api/0.6/user/details' => 'user#api_details'
match 'api/0.6/user/preferences' => 'user_preference#read', :via => :get
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#read_one', :via => :get
match 'api/0.6/user/preferences' => 'user_preference#update', :via => :put
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#update_one', :via => :put
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#delete_one', :via => :delete
match 'api/0.6/user/gpx_files' => 'user#api_gpx_files'
match 'api/0.6/gpx/create' => 'trace#api_create'
match 'api/0.6/gpx/:id' => 'trace#api_read', :via => :get, :id => /\d+/
match 'api/0.6/gpx/:id' => 'trace#api_update', :via => :put, :id => /\d+/
match 'api/0.6/gpx/:id' => 'trace#api_delete', :via => :delete, :id => /\d+/
match 'api/0.6/gpx/:id/details' => 'trace#api_read', :id => /\d+/
match 'api/0.6/gpx/:id/data' => 'trace#api_data'
match 'api/0.6/gpx/:id/data.:format' => 'trace#api_data'
# AMF (ActionScript) API
map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
match 'api/0.6/amf/read' => 'amf#amf_read'
match 'api/0.6/amf/write' => 'amf#amf_write'
match 'api/0.6/swf/trackpoints' => 'swf#trackpoints'
# Data browsing
map.connect '/browse/start', :controller => 'browse', :action => 'start'
map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
map.connect '/browse/node/:id', :controller => 'browse', :action => 'node', :id => /\d+/
map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/
map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
map.changeset '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
map.connect '/user/:display_name/edits/feed', :controller => 'changeset', :action => 'list', :format =>:atom
map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list'
map.connect '/browse/changesets/feed', :controller => 'changeset', :action => 'list', :format => :atom
map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
map.connect '/browse', :controller => 'changeset', :action => 'list'
match '/browse/start' => 'browse#start'
match '/browse/way/:id' => 'browse#way', :id => /\d+/
match '/browse/way/:id/history' => 'browse#way_history', :id => /\d+/
match '/browse/node/:id' => 'browse#node', :id => /\d+/
match '/browse/node/:id/history' => 'browse#node_history', :id => /\d+/
match '/browse/relation/:id' => 'browse#relation', :id => /\d+/
match '/browse/relation/:id/history' => 'browse#relation_history', :id => /\d+/
match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
match '/user/:display_name/edits' => 'changeset#list'
match '/user/:display_name/edits/feed' => 'changeset#list', :format => :atom
match '/browse/changesets' => 'changeset#list'
match '/browse/changesets/feed' => 'changeset#list', :format => :atom
match '/browse' => 'changeset#list'
# web site
map.root :controller => 'site', :action => 'index'
map.connect '/', :controller => 'site', :action => 'index'
map.connect '/edit', :controller => 'site', :action => 'edit'
map.connect '/copyright', :controller => 'site', :action => 'copyright'
map.connect '/copyright/:copyright_locale', :controller => 'site', :action => 'copyright'
map.connect '/history', :controller => 'changeset', :action => 'list'
map.connect '/history/feed', :controller => 'changeset', :action => 'list', :format => :atom
map.connect '/export', :controller => 'site', :action => 'export'
map.connect '/login', :controller => 'user', :action => 'login'
map.connect '/logout', :controller => 'user', :action => 'logout'
map.connect '/offline', :controller => 'site', :action => 'offline'
map.connect '/key', :controller => 'site', :action => 'key'
map.connect '/user/new', :controller => 'user', :action => 'new'
map.connect '/user/terms', :controller => 'user', :action => 'terms'
map.connect '/user/save', :controller => 'user', :action => 'save'
map.connect '/user/:display_name/confirm/resend', :controller => 'user', :action => 'confirm_resend'
map.connect '/user/:display_name/confirm', :controller => 'user', :action => 'confirm'
map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
map.connect '/user/confirm-email', :controller => 'user', :action => 'confirm_email'
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
map.connect '/user/suspended', :controller => 'user', :action => 'suspended'
match '/' => 'site#index'
match '/edit' => 'site#edit'
match '/copyright' => 'site#copyright'
match '/copyright/:copyright_locale' => 'site#copyright'
match '/history' => 'changeset#list'
match '/history/feed' => 'changeset#list', :format => :atom
match '/export' => 'site#export'
match '/login' => 'user#login'
match '/logout' => 'user#logout'
match '/offline' => 'site#offline'
match '/key' => 'site#key'
match '/user/new' => 'user#new'
match '/user/terms' => 'user#terms'
match '/user/save' => 'user#save'
match '/user/:display_name/confirm/resend' => 'user#confirm_resend'
match '/user/:display_name/confirm' => 'user#confirm'
match '/user/confirm' => 'user#confirm'
match '/user/confirm-email' => 'user#confirm_email'
match '/user/go_public' => 'user#go_public'
match '/user/reset-password' => 'user#reset_password'
match '/user/forgot-password' => 'user#lost_password'
match '/user/suspended' => 'user#suspended'
map.connect '/index.html', :controller => 'site', :action => 'index'
map.connect '/edit.html', :controller => 'site', :action => 'edit'
map.connect '/export.html', :controller => 'site', :action => 'export'
map.connect '/login.html', :controller => 'user', :action => 'login'
map.connect '/logout.html', :controller => 'user', :action => 'logout'
map.connect '/create-account.html', :controller => 'user', :action => 'new'
map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password'
match '/index.html' => 'site#index'
match '/edit.html' => 'site#edit'
match '/export.html' => 'site#export'
match '/login.html' => 'user#login'
match '/logout.html' => 'user#logout'
match '/create-account.html' => 'user#new'
match '/forgot-password.html' => 'user#lost_password'
# permalink
map.connect '/go/:code', :controller => 'site', :action => 'permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
match '/go/:code' => 'site#permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
# traces
map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
map.connect '/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
map.connect '/traces', :controller => 'trace', :action => 'list'
map.connect '/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
map.connect '/trace/create', :controller => 'trace', :action => 'create'
map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
map.connect '/trace/:id/data.:format', :controller => 'trace', :action => 'data'
map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
# traces
match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list'
match '/user/:display_name/traces/tag/:tag' => 'trace#list'
match '/user/:display_name/traces/page/:page' => 'trace#list'
match '/user/:display_name/traces' => 'trace#list'
match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss'
match '/user/:display_name/traces/rss' => 'trace#georss'
match '/user/:display_name/traces/:id' => 'trace#view'
match '/user/:display_name/traces/:id/picture' => 'trace#picture'
match '/user/:display_name/traces/:id/icon' => 'trace#icon'
match '/traces/tag/:tag/page/:page' => 'trace#list'
match '/traces/tag/:tag' => 'trace#list'
match '/traces/page/:page' => 'trace#list'
match '/traces' => 'trace#list'
match '/traces/tag/:tag/rss' => 'trace#georss'
match '/traces/rss' => 'trace#georss'
match '/traces/mine/tag/:tag/page/:page' => 'trace#mine'
match '/traces/mine/tag/:tag' => 'trace#mine'
match '/traces/mine/page/:page' => 'trace#mine'
match '/traces/mine' => 'trace#mine'
match '/trace/create' => 'trace#create'
match '/trace/:id/data' => 'trace#data'
match '/trace/:id/data.:format' => 'trace#data'
match '/trace/:id/edit' => 'trace#edit'
match '/trace/:id/delete' => 'trace#delete'
# diary pages
map.connect '/diary/new', :controller => 'diary_entry', :action => 'new'
map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
map.connect '/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/user/:display_name/diary/:id', :controller => 'diary_entry', :action => 'view', :id => /\d+/
map.connect '/user/:display_name/diary/:id/newcomment', :controller => 'diary_entry', :action => 'comment', :id => /\d+/
map.connect '/user/:display_name/diary/:id/edit', :controller => 'diary_entry', :action => 'edit', :id => /\d+/
map.connect '/user/:display_name/diary/:id/hide', :controller => 'diary_entry', :action => 'hide', :id => /\d+/
map.connect '/user/:display_name/diary/:id/hidecomment/:comment', :controller => 'diary_entry', :action => 'hidecomment', :id => /\d+/, :comment => /\d+/
match '/diary/new' => 'diary_entry#new'
match '/user/:display_name/diary/rss' => 'diary_entry#rss', :format => :rss
match '/diary/:language/rss' => 'diary_entry#rss', :format => :rss
match '/diary/rss' => 'diary_entry#rss', :format => :rss
match '/user/:display_name/diary' => 'diary_entry#list'
match '/diary/:language' => 'diary_entry#list'
match '/diary' => 'diary_entry#list'
match '/user/:display_name/diary/:id' => 'diary_entry#view', :id => /\d+/
match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :id => /\d+/
match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :id => /\d+/
match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :id => /\d+/
match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :id => /\d+/, :comment => /\d+/
# user pages
map.connect '/user/:display_name', :controller => 'user', :action => 'view'
map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
map.connect '/user/:display_name/set_status', :controller => 'user', :action => 'set_status'
map.connect '/user/:display_name/delete', :controller => 'user', :action => 'delete'
match '/user/:display_name' => 'user#view'
match '/user/:display_name/make_friend' => 'user#make_friend'
match '/user/:display_name/remove_friend' => 'user#remove_friend'
match '/user/:display_name/account' => 'user#account'
match '/user/:display_name/set_status' => 'user#set_status'
match '/user/:display_name/delete' => 'user#delete'
# user lists
map.connect '/users', :controller => 'user', :action => 'list'
map.connect '/users/:status', :controller => 'user', :action => 'list'
match '/users' => 'user#list'
match '/users/:status' => 'user#list'
# test pages
map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
match '/test/populate/:table/:from/:count' => 'test#populate'
match '/test/populate/:table/:count' => 'test#populate', :from => 1
# geocoder
map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
map.connect '/geocoder/search_latlon', :controller => 'geocoder', :action => 'search_latlon'
map.connect '/geocoder/search_us_postcode', :controller => 'geocoder', :action => 'search_us_postcode'
map.connect '/geocoder/search_uk_postcode', :controller => 'geocoder', :action => 'search_uk_postcode'
map.connect '/geocoder/search_ca_postcode', :controller => 'geocoder', :action => 'search_ca_postcode'
map.connect '/geocoder/search_osm_namefinder', :controller => 'geocoder', :action => 'search_osm_namefinder'
map.connect '/geocoder/search_osm_nominatim', :controller => 'geocoder', :action => 'search_osm_nominatim'
map.connect '/geocoder/search_geonames', :controller => 'geocoder', :action => 'search_geonames'
map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
map.connect '/geocoder/description_osm_namefinder', :controller => 'geocoder', :action => 'description_osm_namefinder'
map.connect '/geocoder/description_osm_nominatim', :controller => 'geocoder', :action => 'description_osm_nominatim'
map.connect '/geocoder/description_geonames', :controller => 'geocoder', :action => 'description_geonames'
match '/geocoder/search' => 'geocoder#search'
match '/geocoder/search_latlon' => 'geocoder#search_latlon'
match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode'
match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode'
match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode'
match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder'
match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim'
match '/geocoder/search_geonames' => 'geocoder#search_geonames'
match '/geocoder/description' => 'geocoder#description'
match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder'
match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim'
match '/geocoder/description_geonames' => 'geocoder#description_geonames'
# export
map.connect '/export/start', :controller => 'export', :action => 'start'
map.connect '/export/finish', :controller => 'export', :action => 'finish'
match '/export/start' => 'export#start'
match '/export/finish' => 'export#finish'
# messages
map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox'
map.connect '/user/:display_name/outbox', :controller => 'message', :action => 'outbox'
map.connect '/message/new/:display_name', :controller => 'message', :action => 'new'
map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
map.connect '/message/delete/:message_id', :controller => 'message', :action => 'delete'
match '/user/:display_name/inbox' => 'message#inbox'
match '/user/:display_name/outbox' => 'message#outbox'
match '/message/new/:display_name' => 'message#new'
match '/message/read/:message_id' => 'message#read'
match '/message/mark/:message_id' => 'message#mark'
match '/message/reply/:message_id' => 'message#reply'
match '/message/delete/:message_id' => 'message#delete'
# oauth admin pages (i.e: for setting up new clients, etc...)
map.resources :oauth_clients, :path_prefix => '/user/:display_name'
map.connect '/oauth/revoke', :controller => 'oauth', :action => 'revoke'
map.authorize '/oauth/authorize', :controller => 'oauth', :action => 'oauthorize'
map.request_token '/oauth/request_token', :controller => 'oauth', :action => 'request_token'
map.access_token '/oauth/access_token', :controller => 'oauth', :action => 'access_token'
map.test_request '/oauth/test_request', :controller => 'oauth', :action => 'test_request'
scope "/user/:display_name" do
resources :oauth_clients
end
match '/oauth/revoke' => 'oauth#revoke'
match '/oauth/authorize' => 'oauth#oauthorize', :as => :authorize
match '/oauth/request_token' => 'oauth#request_token', :as => :request_token
match '/oauth/access_token' => 'oauth#access_token', :as => :access_token
match '/oauth/test_request' => 'oauth#test_request', :as => :test_request
# roles and banning pages
map.connect '/user/:display_name/role/:role/grant', :controller => 'user_roles', :action => 'grant'
map.connect '/user/:display_name/role/:role/revoke', :controller => 'user_roles', :action => 'revoke'
map.connect '/user/:display_name/blocks', :controller => 'user_blocks', :action => 'blocks_on'
map.connect '/user/:display_name/blocks_by', :controller => 'user_blocks', :action => 'blocks_by'
map.connect '/blocks/new/:display_name', :controller => 'user_blocks', :action => 'new'
map.resources :user_blocks, :as => 'blocks'
map.connect '/blocks/:id/revoke', :controller => 'user_blocks', :action => 'revoke'
match '/user/:display_name/role/:role/grant' => 'user_roles#grant'
match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke'
match '/user/:display_name/blocks' => 'user_blocks#blocks_on'
match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by'
match '/blocks/new/:display_name' => 'user_blocks#new'
resources :user_blocks
match '/blocks/:id/revoke' => 'user_blocks#revoke'
# fall through
map.connect ':controller/:id/:action'
map.connect ':controller/:action'
match ':controller/:id/:action' => '#index'
match ':controller/:action' => '#index'
end

7
db/seeds.rb Normal file
View file

@ -0,0 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)

View file

@ -1,6 +1,8 @@
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
// Contributors:
// Richard Livsey
// Rahul Bhargava

View file

@ -1,5 +1,6 @@
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@ -311,7 +312,7 @@ var Draggable = Class.create({
tag_name=='TEXTAREA')) return;
var pointer = [Event.pointerX(event), Event.pointerY(event)];
var pos = Position.cumulativeOffset(this.element);
var pos = this.element.cumulativeOffset();
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
Draggables.activate(this);
@ -454,7 +455,7 @@ var Draggable = Class.create({
},
draw: function(point) {
var pos = Position.cumulativeOffset(this.element);
var pos = this.element.cumulativeOffset();
if(this.options.ghosting) {
var r = Position.realOffset(this.element);
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
@ -730,7 +731,7 @@ var Sortable = {
}
// keep reference
this.sortables[element.id] = options;
this.sortables[element.identify()] = options;
// for onupdate
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
@ -825,7 +826,7 @@ var Sortable = {
hide().addClassName('dropmarker').setStyle({position:'absolute'});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
}
var offsets = Position.cumulativeOffset(dropon);
var offsets = dropon.cumulativeOffset();
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
if(position=='after')

View file

@ -1,4 +1,6 @@
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
// Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/)
@ -145,14 +147,13 @@ var Effect = {
'blind': ['BlindDown','BlindUp'],
'appear': ['Appear','Fade']
},
toggle: function(element, effect) {
toggle: function(element, effect, options) {
element = $(element);
effect = (effect || 'appear').toLowerCase();
var options = Object.extend({
effect = (effect || 'appear').toLowerCase();
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
}, arguments[2] || { });
Effect[element.visible() ?
Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
}, options || {}));
}
};
@ -228,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
Effect.Base = Class.create({
position: null,
start: function(options) {
function codeForEvent(options,eventName){
return (
(options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
(options[eventName] ? 'this.options.'+eventName+'(this);' : '')
);
}
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
this.currentFrame = 0;

File diff suppressed because it is too large Load diff

175
public/javascripts/rails.js Normal file
View file

@ -0,0 +1,175 @@
(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;
});
});
})();

View file

@ -1,4 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/console'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/dbconsole'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/destroy'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/generate'

0
script/locale/merge-from-translatewiki Normal file → Executable file
View file

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../../config/boot', __FILE__)
require 'commands/performance/benchmarker'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../../config/boot', __FILE__)
require 'commands/performance/profiler'

6
script/rails Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/runner'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/server'

View file

@ -0,0 +1,9 @@
require 'test_helper'
require 'rails/performance_test_help'
# Profiling results for each test method are written to tmp/performance.
class BrowsingTest < ActionDispatch::PerformanceTest
def test_homepage
get '/'
end
end

View file

@ -1,6 +1,6 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
load 'composite_primary_keys/fixtures.rb'
# This monkey patch is to make tests where a rack module alters
@ -41,28 +41,6 @@ module ActionController
end
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
# between every test method. Fewer database queries means faster tests.
#
# Read Mike Clark's excellent walkthrough at
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
#
# Every Active Record database supports transactions except MyISAM tables
# in MySQL. Turn off transactional fixtures in this case; however, if you
# don't care one way or the other, switching from MyISAM to InnoDB tables
# is recommended.
self.use_transactional_fixtures = false
# Instantiated fixtures are slow, but give you @david where otherwise you
# would need people(:david). If you don't want to migrate your existing
# test cases which use the @david style and don't mind the speed hit (each
# instantiated fixtures translates to a database query per test method),
# then set this back to true.
self.use_instantiated_fixtures = false
# Load standard fixtures needed to test API methods
def self.api_fixtures
#print "setting up the api_fixtures"