From a12d4f62752f546f57421244e370e79965706ffb Mon Sep 17 00:00:00 2001 From: Date: Wed, 16 Aug 2006 17:21:25 -0400 Subject: [PATCH] Upgrade to Rails 1.1. --- README | 40 +- Rakefile | 4 +- config/boot.rb | 41 +- config/environment.rb | 30 +- config/environments/development.rb | 8 +- config/environments/production.rb | 5 +- config/environments/test.rb | 4 +- config/routes.rb | 7 +- public/500.html | 2 +- public/images/rails.png | Bin 0 -> 1787 bytes public/javascripts/application.js | 2 + public/javascripts/controls.js | 156 ++++- public/javascripts/dragdrop.js | 778 ++++++++++++++++++------- public/javascripts/effects.js | 890 ++++++++++++++--------------- public/javascripts/prototype.js | 522 +++++++++++++---- script/about | 2 +- script/breakpointer | 4 +- script/console | 4 +- script/destroy | 2 +- script/generate | 4 +- script/performance/benchmarker | 2 +- script/performance/profiler | 2 +- script/plugin | 2 +- script/process/reaper | 2 +- script/process/spawner | 2 +- script/runner | 2 +- script/server | 4 +- vendor/rails | 2 +- 28 files changed, 1660 insertions(+), 863 deletions(-) create mode 100644 public/images/rails.png create mode 100644 public/javascripts/application.js diff --git a/README b/README index cd9d0ff..7d8965e 100644 --- a/README +++ b/README @@ -27,12 +27,32 @@ link:files/vendor/rails/actionpack/README.html. == Getting started -1. Run the WEBrick servlet: ruby script/server (run with --help for options) - ...or if you have lighttpd installed: ruby script/lighttpd (it's faster) -2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!" -3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen +1. Start the web server: ruby script/server (run with --help for options) +2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!" +3. Follow the guidelines to start developing your application +== Web servers + +Rails uses the built-in web server in Ruby called WEBrick by default, so you don't +have to install or configure anything to play around. + +If you have lighttpd installed, though, it'll be used instead when running script/server. +It's considerably faster than WEBrick and suited for production use, but requires additional +installation and currently only works well on OS X/Unix (Windows users are encouraged +to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from +http://www.lighttpd.net. + +If you want something that's halfway between WEBrick and lighttpd, we heartily recommend +Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that +also works very well with Windows. See more at http://mongrel.rubyforge.org/. + +But of course its also possible to run Rails with the premiere open source web server Apache. +To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want +to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid. + +See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI. + == Example for Apache conf @@ -102,7 +122,10 @@ You can interact with the domain model by starting the console through script/co Here you'll have all parts of the application configured, just like it is when the application is running. You can inspect domain models, change values, and save to the database. Starting the script without arguments will launch it in the development environment. -Passing an argument will specify a different environment, like console production. +Passing an argument will specify a different environment, like script/console production. + +To reload your controllers and models after launching the console run reload! + == Description of contents @@ -128,12 +151,19 @@ app/views app/helpers Holds view helpers that should be named like weblog_helper.rb. +app/apis + Holds API classes for web services. + config Configuration files for the Rails environment, the routing map, the database, and other dependencies. components Self-contained mini-applications that can bundle together controllers, models, and views. +db + Contains the database schema in schema.rb. db/migrate contains all + the sequence of Migrations for your schema. + lib Application specific libraries. Basically, any kind of custom code that doesn't belong under controllers, models, or helpers. This directory is in the load path. diff --git a/Rakefile b/Rakefile index cffd19f..3bb0e85 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,5 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/switchtower.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.join(File.dirname(__FILE__), 'config', 'boot')) @@ -7,4 +7,4 @@ require 'rake' require 'rake/testtask' require 'rake/rdoctask' -require 'tasks/rails' \ No newline at end of file +require 'tasks/rails' diff --git a/config/boot.rb b/config/boot.rb index 96aa96b..9a094cb 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,17 +1,44 @@ +# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb + unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') + unless RUBY_PLATFORM =~ /mswin32/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end + RAILS_ROOT = root_path end -if File.directory?("#{RAILS_ROOT}/vendor/rails") - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" -else - require 'rubygems' - require 'initializer' -end +unless defined?(Rails::Initializer) + if File.directory?("#{RAILS_ROOT}/vendor/rails") + require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" + else + require 'rubygems' + + environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join + environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/ + rails_gem_version = $1 + + if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version + rails_gem = Gem.cache.search('rails', "=#{version}").first + + if rails_gem + require_gem "rails", "=#{version}" + require rails_gem.full_gem_path + '/lib/initializer' + else + STDERR.puts %(Cannot find gem for Rails =#{version}: + Install the missing gem with 'gem install -v=#{version} rails', or + change environment.rb to define RAILS_GEM_VERSION with your desired version. + ) + exit 1 + end + else + require_gem "rails" + require 'initializer' + end + end -Rails::Initializer.run(:set_load_path) + Rails::Initializer.run(:set_load_path) +end \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb index a0ed78e..34a2d87 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,14 +1,19 @@ # Be sure to restart your web server when you modify this file. -# Uncomment below to force Rails into production mode -# (Use only when you can't set environment variables through your web/app server) +# Uncomment below to force Rails into production mode when +# you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' +# Specifies gem version of Rails to use when vendor/rails is not present +RAILS_GEM_VERSION = '1.1.6' + # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| - # Skip frameworks you're not going to use + # Settings in config/environments/* take precedence those specified here + + # Skip frameworks you're not going to use (only works if using vendor/rails) # config.frameworks -= [ :action_web_service, :action_mailer ] # Add additional load paths for your own custom dirs @@ -19,12 +24,13 @@ Rails::Initializer.run do |config| # config.log_level = :debug # Use the database for sessions instead of the file system - # (create the session table with 'rake create_sessions_table') + # (create the session table with 'rake db:sessions:create') # config.action_controller.session_store = :active_record_store - # Enable page/fragment caching by setting a file-based store - # (remember to create the caching directory and make it readable to the application) - # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache" + # 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 # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector @@ -32,10 +38,6 @@ Rails::Initializer.run do |config| # Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc - # Use Active Record's schema dumper instead of SQL when creating the test database - # (enables use of different database adapters for development and test environments) - # config.active_record.schema_format = :ruby - # See Rails::Configuration for more options end @@ -49,7 +51,7 @@ end # end # Include your application configuration below - -require 'uniq_token' -require 'randarray' +require 'uniq_token' +require 'randarray' require 'rubyvote' + diff --git a/config/environments/development.rb b/config/environments/development.rb index a151c3b..0589aa9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,12 @@ +# 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 +config.cache_classes = false # Log error messages when you accidentally call methods on nil. -config.whiny_nils = true +config.whiny_nils = true # Enable the breakpoint server that script/breakpointer connects to config.breakpoint_server = true @@ -12,6 +14,8 @@ config.breakpoint_server = 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_extensions = false +config.action_view.debug_rjs = true # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/production.rb b/config/environments/production.rb index f2b9ed6..5a4e2b1 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,10 +1,11 @@ +# 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 # Use a different logger for distributed setups -# config.logger = SyslogLogger.new - +# config.logger = SyslogLogger.new # Full error reports are disabled and caching is turned on config.action_controller.consider_all_requests_local = false diff --git a/config/environments/test.rb b/config/environments/test.rb index 3609f90..f0689b9 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# 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 @@ -5,7 +7,7 @@ config.cache_classes = true # 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 config.action_controller.consider_all_requests_local = true diff --git a/config/routes.rb b/config/routes.rb index c9beb55..ed0625d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,14 @@ ActionController::Routing::Routes.draw do |map| - # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. - # Here's a sample route: + # Sample of regular route: # 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' + # This route can be invoked with purchase_url(:id => product.id) + # You can have the root of your site routed by hooking up '' # -- just remember to delete public/index.html. map.connect '', :controller => "site" diff --git a/public/500.html b/public/500.html index a1001a0..ab95f74 100644 --- a/public/500.html +++ b/public/500.html @@ -2,7 +2,7 @@ "http://www.w3.org/TR/html4/loose.dtd"> -

Application error (Apache)

+

Application error

Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html

\ No newline at end of file diff --git a/public/images/rails.png b/public/images/rails.png new file mode 100644 index 0000000000000000000000000000000000000000..b8441f182e06974083cf08f0acaf0e2fd612bd40 GIT binary patch literal 1787 zcmVCLdthj)A!BBmWB&y|X`RY;f`BJ<_ju%@N||NoLFD~mQl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*ehIPBwKBQU)YKE8F0lR!Sm?sE4Xk-sj&E$|A-9n dP56HS1^^A-61FoN)nxzx002ovPDHLkV1kw_Sd9Px literal 0 HcmV?d00001 diff --git a/public/javascripts/application.js b/public/javascripts/application.js new file mode 100644 index 0000000..fe45776 --- /dev/null +++ b/public/javascripts/application.js @@ -0,0 +1,2 @@ +// Place your application-specific JavaScript functions and classes here +// This file is automatically included by javascript_include_tag :defaults diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js index 6da5885..de0261e 100644 --- a/public/javascripts/controls.js +++ b/public/javascripts/controls.js @@ -80,7 +80,10 @@ Autocompleter.Base.prototype = { show: function() { if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && (Element.getStyle(this.update, 'position')=='absolute')) { + if(!this.iefix && + (navigator.appVersion.indexOf('MSIE')>0) && + (navigator.userAgent.indexOf('Opera')<0) && + (Element.getStyle(this.update, 'position')=='absolute')) { new Insertion.After(this.update, '