You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/05/27 21:52:09 UTC

svn commit: r660666 - in /ode/sandbox/singleshot: ./ app/controllers/ config/ config/environments/ config/initializers/

Author: assaf
Date: Tue May 27 12:52:05 2008
New Revision: 660666

URL: http://svn.apache.org/viewvc?rev=660666&view=rev
Log:
Updated configuration files (yes, they do exist!) to take advantage of new Rails 2.1 features.

Added:
    ode/sandbox/singleshot/config/apache.conf   (with props)
    ode/sandbox/singleshot/config/initializers/mime_types.rb
    ode/sandbox/singleshot/config/initializers/new_rails_defaults.rb
Modified:
    ode/sandbox/singleshot/Rakefile
    ode/sandbox/singleshot/app/controllers/application.rb
    ode/sandbox/singleshot/config/database.yml
    ode/sandbox/singleshot/config/environment.rb
    ode/sandbox/singleshot/config/environments/development.rb
    ode/sandbox/singleshot/config/environments/production.rb
    ode/sandbox/singleshot/config/environments/test.rb
    ode/sandbox/singleshot/config/lighttpd.conf
    ode/sandbox/singleshot/config/routes.rb

Modified: ode/sandbox/singleshot/Rakefile
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/Rakefile?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/Rakefile (original)
+++ ode/sandbox/singleshot/Rakefile Tue May 27 12:52:05 2008
@@ -17,6 +17,9 @@
 # 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.
 
+# 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 'rake'
@@ -24,6 +27,7 @@
 require 'rake/rdoctask'
 
 require 'tasks/rails'
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
 
-
+desc 'Run this task first to setup your test/development environment'
 task 'setup'=>['gems:install', 'db:populate']

Modified: ode/sandbox/singleshot/app/controllers/application.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/application.rb?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/application.rb (original)
+++ ode/sandbox/singleshot/app/controllers/application.rb Tue May 27 12:52:05 2008
@@ -5,6 +5,15 @@
 
   helper :all # include all helpers, all the time
 
+  # See ActionController::RequestForgeryProtection for details
+  # Uncomment the :secret if you're not using the cookie session store
+  protect_from_forgery # :secret => '{secret}}'
+
+  # See ActionController::Base for details 
+  # Uncomment this to filter the contents of submitted sensitive data parameters
+  # from your application log (in this case, all fields with names like "password"). 
+  filter_parameter_logging :password
+
 
   # --- Authentication ---
 

Added: ode/sandbox/singleshot/config/apache.conf
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/apache.conf?rev=660666&view=auto
==============================================================================
--- ode/sandbox/singleshot/config/apache.conf (added)
+++ ode/sandbox/singleshot/config/apache.conf Tue May 27 12:52:05 2008
@@ -0,0 +1,40 @@
+# General Apache options
+AddHandler fastcgi-script .fcgi
+AddHandler cgi-script .cgi
+Options +FollowSymLinks +ExecCGI
+
+# If you don't want Rails to look in certain directories,
+# use the following rewrite rules so that Apache won't rewrite certain requests
+# 
+# Example:
+#   RewriteCond %{REQUEST_URI} ^/notrails.*
+#   RewriteRule .* - [L]
+
+# Redirect all requests not available on the filesystem to Rails
+# By default the cgi dispatcher is used which is very slow
+# 
+# For better performance replace the dispatcher with the fastcgi one
+#
+# Example:
+#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+RewriteEngine On
+
+# If your Rails application is accessed via an Alias directive,
+# then you MUST also set the RewriteBase in this htaccess file.
+#
+# Example:
+#   Alias /myrailsapp /path/to/myrailsapp/public
+#   RewriteBase /myrailsapp
+
+RewriteRule ^$ index.html [QSA]
+RewriteRule ^([^.]+)$ $1.html [QSA]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
+
+# In case Rails experiences terminal errors
+# Instead of displaying this message you can supply a file here which will be rendered instead
+# 
+# Example:
+#   ErrorDocument 500 /500.html
+
+ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"

Propchange: ode/sandbox/singleshot/config/apache.conf
------------------------------------------------------------------------------
    svn:executable = *

Modified: ode/sandbox/singleshot/config/database.yml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/database.yml?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/database.yml (original)
+++ ode/sandbox/singleshot/config/database.yml Tue May 27 12:52:05 2008
@@ -1,16 +1,5 @@
-# MySQL (default setup).  Versions 4.1 and 5.0 are recommended.
-#
-# Install the MySQL driver:
-#   gem install mysql
-# On MacOS X:
-#   gem install mysql -- --include=/usr/local/lib
-# On Windows:
-#   gem install mysql
-#       Choose the win32 build.
-#       Install MySQL and put its /bin directory on your path.
-#
-# And be sure to use new-style password hashing:
-#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
+# SQLite version 3.x
+#   gem install sqlite3-ruby (not necessary on OS X Leopard)
 development:
   adapter: sqlite3
   database: db/development.sqlite3
@@ -24,9 +13,27 @@
   database: db/test.sqlite3
   timeout: 5000
 
+# MySQL.  Versions 4.1 and 5.0 are recommended.
+#
+# Install the MySQL driver:
+#   gem install mysql
+# On Mac OS X:
+#   sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
+# On Mac OS X Leopard:
+#   sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
+#       This sets the ARCHFLAGS environment variable to your native architecture
+# On Windows:
+#   gem install mysql
+#       Choose the win32 build.
+#       Install MySQL and put its /bin directory on your path.
+#
+# And be sure to use new-style password hashing:
+#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
 production:
   adapter: mysql
-  database: singleshot
-  username: singleshot
-  password: singleshot
-  socket: /var/lib/mysql/mysql.sock
+  encoding: utf8
+  database: singleshot_production
+  username: root
+  password: 
+  #socket: /var/lib/mysql/mysql.sock
+  host: localhost

Modified: ode/sandbox/singleshot/config/environment.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environment.rb?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environment.rb (original)
+++ ode/sandbox/singleshot/config/environment.rb Tue May 27 12:52:05 2008
@@ -5,19 +5,31 @@
 # ENV['RAILS_ENV'] ||= 'production'
 
 # Specifies gem version of Rails to use when vendor/rails is not present
-# RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.1.0' 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
-
-  # Skip frameworks you're not going to use (only works if using vendor/rails)
-  # config.frameworks -= [ :active_resource, :action_mailer ]
+  # 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.
+  # See Rails::Configuration for more options.
 
-  # Only load the plugins named here, by default all plugins in vendor/plugins are loaded
-  # config.plugins = %W( exception_notification ssl_requirement )
+  # Skip frameworks you're not going to use. To use Rails without a database
+  # you must remove the Active Record framework.
+  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
+
+  # Specify gems that this application depends on. 
+  # They can then be installed with rake gem:install on new installations.
+  # config.gem "bj"
+  # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
+  # config.gem "aws-s3", :lib => "aws/s3"
+
+  # Only load the plugins named here, in the order given. By default, all plugins 
+  # in vendor/plugins are loaded in alphabetical order.
+  # :all can be used as a placeholder for all plugins not explicitly named
+  # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
   config.plugins = [:all]
 
   # Add additional load paths for your own custom dirs
@@ -27,32 +39,36 @@
   # (by default production uses :info, the others :debug)
   # config.log_level = :debug
 
+  # Make Time.zone default to the specified zone, and make ActiveRecord store time values
+  # in the database in UTC, and return them converted to the specified local zone.
+  # Run `rake -D time` for a list of tasks for finding time zone names. Uncomment to use default local time.
+  config.time_zone = 'UTC'
+
   # 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.
   config.action_controller.session = {
-    :session_key => '_single_shot_session',
-    # NOTE: This is publicly accessible, change before deploying!
-    # Use rake secret to generate a new crypto random value.
+    :session_key => '_singleshot_session',
+    # NOTE: This secret is not so secret, it shows up in the source distribution.
+    # Change to something else before deploying in production!
+    # Use rake secret to generate a new crypto-strong secrent.
     :secret      => '01d45defc4a9585c2e0a9d6bb1d10ff3488fa2ffef1fd439ad03894cc2ae4e5025bdc6487972679b97a7ac79bd385ee07b36c7952f7882d35bdc9bc60aa584bf'
   }
 
-  # Use the database for sessions instead of the file system
+  # 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')
   # config.action_controller.session_store = :active_record_store
 
   # 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
+  # config.active_record.schema_format = :sql
 
   # Activate observers that should always be running
   # config.active_record.observers = :cacher, :garbage_collector
 
-  # Make Active Record use UTC-base instead of local time
-  #config.active_record.default_timezone = :utc
-
-  # See Rails::Configuration for more options
-
-  # Application configuration should go into files in config/initializers
-  # -- all .rb files in that directory is automatically loaded
+  # Make ActiveRecord only save the attributes that have changed since the record was loaded.
+  # config.active_record.partial_updates = true
 end

Modified: ode/sandbox/singleshot/config/environments/development.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environments/development.rb?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environments/development.rb (original)
+++ ode/sandbox/singleshot/config/environments/development.rb Tue May 27 12:52:05 2008
@@ -10,8 +10,8 @@
 
 # Show full error reports and disable caching
 config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching             = false
 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
@@ -21,6 +21,9 @@
 # These Gems are used for development.
 config.gem 'annotate-models', :lib=>'annotate_models'
 config.gem 'rspec', :lib=>'spec',                     :version=>'~> 1.1.3'
-config.gem 'sqlite3-ruby', :lib=>'sqlite3',           :version=>'~>1.2'
+# Faker: Used to populate development database with fake data.
 config.gem 'faker',                                   :version=>'~>0.3'
+# SQLite3: Development and test databases use SQLite3 by default.
+config.gem 'sqlite3-ruby', :lib=>'sqlite3',           :version=>'~>1.2'
+# Thin: Not essential, but development scripts (e.g. rake run) are hard wired to use Thin.
 config.gem 'thin',                                    :version=>'~>0.8'

Modified: ode/sandbox/singleshot/config/environments/production.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environments/production.rb?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environments/production.rb (original)
+++ ode/sandbox/singleshot/config/environments/production.rb Tue May 27 12:52:05 2008
@@ -10,6 +10,10 @@
 # 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
+
+# Use a different cache store in production
+# config.cache_store = :mem_cache_store
 
 # Enable serving of images, stylesheets, and javascripts from an asset server
 # config.action_controller.asset_host                  = "http://assets.example.com"

Modified: ode/sandbox/singleshot/config/environments/test.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environments/test.rb?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environments/test.rb (original)
+++ ode/sandbox/singleshot/config/environments/test.rb Tue May 27 12:52:05 2008
@@ -13,7 +13,10 @@
 config.action_controller.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
+
 # 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
\ No newline at end of file
+config.action_mailer.delivery_method = :test

Added: ode/sandbox/singleshot/config/initializers/mime_types.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/initializers/mime_types.rb?rev=660666&view=auto
==============================================================================
--- ode/sandbox/singleshot/config/initializers/mime_types.rb (added)
+++ ode/sandbox/singleshot/config/initializers/mime_types.rb Tue May 27 12:52:05 2008
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone

Added: ode/sandbox/singleshot/config/initializers/new_rails_defaults.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/initializers/new_rails_defaults.rb?rev=660666&view=auto
==============================================================================
--- ode/sandbox/singleshot/config/initializers/new_rails_defaults.rb (added)
+++ ode/sandbox/singleshot/config/initializers/new_rails_defaults.rb Tue May 27 12:52:05 2008
@@ -0,0 +1,15 @@
+# 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.
+
+# Include ActiveRecord 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
+
+# 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
\ No newline at end of file

Modified: ode/sandbox/singleshot/config/lighttpd.conf
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/lighttpd.conf?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/lighttpd.conf (original)
+++ ode/sandbox/singleshot/config/lighttpd.conf Tue May 27 12:52:05 2008
@@ -28,7 +28,7 @@
 # *need* to execute a second request while the first is still pending.
 fastcgi.server      = ( ".fcgi" => ( "localhost" => (
   "min-procs"       => 1, 
-  "max-procs"       => 5,
+  "max-procs"       => 1,
   "socket"          => CWD + "/tmp/sockets/fcgi.socket",
   "bin-path"        => CWD + "/public/dispatch.fcgi",
   "bin-environment" => ( "RAILS_ENV" => "development" )

Modified: ode/sandbox/singleshot/config/routes.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/routes.rb?rev=660666&r1=660665&r2=660666&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/routes.rb (original)
+++ ode/sandbox/singleshot/config/routes.rb Tue May 27 12:52:05 2008
@@ -5,34 +5,47 @@
     :has_one=>[ 'owner' ]
   map.resources 'activities'
   map.day_activity 'activity/:year/:month/:day', :controller=>'activities', :action=>'show', :year =>/\d{4}/, :month=>/\d{1,2}/, :day=>/\d{1,2}/
-  map.root :controller=>'tasks'
+  map.root :tasks
   map.resource 'sandwich'
-  #map.connect ':controller/:action/:id'
-  
-
-  # Authentication resource (create/destroy).
 
+  
   # The priority is based upon order of creation: first created -> highest priority.
 
   # Sample of regular route:
-  # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
+  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
   # Keep in mind you can assign values other than :controller and :action
 
   # Sample of named route:
-  # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
+  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
   # This route can be invoked with purchase_url(:id => product.id)
 
   # Sample resource route (maps HTTP verbs to controller actions automatically):
-  # map.resources :products
+  #   map.resources :products
 
   # Sample resource route with options:
-  # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
+  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
 
   # Sample resource route with sub-resources:
-  # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
+  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
+  
+  # Sample resource route with more complex sub-resources
+  #   map.resources :products do |products|
+  #     products.resources :comments
+  #     products.resources :sales, :collection => { :recent => :get }
+  #   end
+
+  # Sample resource route within a namespace:
+  #   map.namespace :admin do |admin|
+  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
+  #     admin.resources :products
+  #   end
 
   # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
   # map.root :controller => "welcome"
 
+  # See how all your routes lay out with "rake routes"
+
   # Install the default routes as the lowest priority.
+  map.connect ':controller/:action/:id'
+  map.connect ':controller/:action/:id.:format'
 end