From 7adac51d6d75379f56ba5c420458d22be0a70c53 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sun, 18 Mar 2007 11:56:12 -0500 Subject: [PATCH] Sync with latest Instiki trunk. Changes: 1) Upgrade Rails to 1.2.3 2) Revert RedCloth to previous version (who %#$@ cares?) 3) Preserve the Rails Security fix to vendor/rails/actionpack/lib/action_controller/caching.rb from Revision 80. --- lib/redcloth.rb | 137 ++++++++---------- vendor/rails/actionmailer/CHANGELOG | 7 +- vendor/rails/actionmailer/Rakefile | 14 +- .../actionmailer/lib/action_mailer/version.rb | 2 +- vendor/rails/actionpack/CHANGELOG | 11 +- vendor/rails/actionpack/Rakefile | 16 +- .../actionpack/lib/action_controller/base.rb | 2 +- .../lib/action_controller/cgi_process.rb | 1 + .../lib/action_controller/routing.rb | 6 +- .../lib/action_controller/test_process.rb | 4 +- .../actionpack/lib/action_pack/version.rb | 2 +- .../test/controller/routing_test.rb | 11 ++ .../controller/session_management_test.rb | 11 ++ .../actionpack/test/controller/test_test.rb | 14 -- vendor/rails/actionwebservice/CHANGELOG | 5 + vendor/rails/actionwebservice/Rakefile | 18 +-- .../lib/action_web_service/version.rb | 2 +- vendor/rails/activerecord/CHANGELOG | 11 ++ vendor/rails/activerecord/Rakefile | 16 +- .../lib/active_record/associations.rb | 105 ++++++++------ .../has_many_through_association.rb | 12 +- .../activerecord/lib/active_record/base.rb | 17 +-- .../lib/active_record/fixtures.rb | 24 ++- .../lib/active_record/reflection.rb | 8 +- .../lib/active_record/vendor/mysql.rb | 12 +- .../activerecord/lib/active_record/version.rb | 2 +- .../test/associations/join_model_test.rb | 19 ++- .../test/fixtures/categories_ordered.yml | 2 +- .../test/fixtures/db_definitions/db2.drop.sql | 1 + .../test/fixtures/db_definitions/db2.sql | 5 + .../fixtures/db_definitions/firebird.drop.sql | 2 + .../test/fixtures/db_definitions/firebird.sql | 7 + .../db_definitions/frontbase.drop.sql | 1 + .../fixtures/db_definitions/frontbase.sql | 6 + .../fixtures/db_definitions/mysql.drop.sql | 1 + .../test/fixtures/db_definitions/mysql.sql | 6 + .../test/fixtures/db_definitions/openbase.sql | 8 + .../fixtures/db_definitions/oracle.drop.sql | 2 + .../test/fixtures/db_definitions/oracle.sql | 6 + .../db_definitions/postgresql.drop.sql | 1 + .../fixtures/db_definitions/postgresql.sql | 5 + .../fixtures/db_definitions/sqlite.drop.sql | 1 + .../test/fixtures/db_definitions/sqlite.sql | 5 + .../db_definitions/sqlserver.drop.sql | 1 + .../fixtures/db_definitions/sqlserver.sql | 5 + .../fixtures/db_definitions/sybase.drop.sql | 1 + .../test/fixtures/db_definitions/sybase.sql | 5 + .../rails/activerecord/test/fixtures/tag.rb | 2 + .../activerecord/test/fixtures/vertex.rb | 2 +- vendor/rails/activerecord/test/pk_test.rb | 25 +++- vendor/rails/activesupport/CHANGELOG | 12 +- vendor/rails/activesupport/Rakefile | 14 +- .../lib/active_support/core_ext/time.rb | 10 ++ .../core_ext/time/conversions.rb | 3 - .../lib/active_support/deprecation.rb | 5 +- .../lib/active_support/version.rb | 2 +- vendor/rails/railties/CHANGELOG | 9 ++ vendor/rails/railties/Rakefile | 27 ++-- vendor/rails/railties/environments/boot.rb | 4 +- vendor/rails/railties/lib/commands/console.rb | 2 +- vendor/rails/railties/lib/commands/plugin.rb | 11 +- .../lib/commands/process/inspector.rb | 4 +- .../railties/lib/commands/process/reaper.rb | 2 +- .../railties/lib/commands/process/spawner.rb | 4 +- vendor/rails/railties/lib/commands/server.rb | 2 +- vendor/rails/railties/lib/rails/version.rb | 2 +- .../applications/app/app_generator.rb | 2 +- vendor/rails/railties/lib/tasks/testing.rake | 19 ++- 68 files changed, 466 insertions(+), 257 deletions(-) diff --git a/lib/redcloth.rb b/lib/redcloth.rb index 1228af6e..03df12b3 100644 --- a/lib/redcloth.rb +++ b/lib/redcloth.rb @@ -166,7 +166,7 @@ class RedCloth < String - VERSION = '3.0.4' + VERSION = '3.0.3' DEFAULT_RULES = [:textile, :markdown] # @@ -193,18 +193,6 @@ class RedCloth < String # attr_accessor :hard_breaks - # Accessor for toggling lite mode. - # - # In lite mode, block-level rules are ignored. This means - # that tables, paragraphs, lists, and such aren't available. - # Only the inline markup for bold, italics, entities and so on. - # - # r = RedCloth.new( "And then? She *fell*!", [:lite_mode] ) - # r.to_html - # #=> "And then? She fell!" - # - attr_accessor :lite_mode - # # Accessor for toggling span caps. # @@ -231,7 +219,7 @@ class RedCloth < String # inline_textile_image:: Textile inline images # inline_textile_link:: Textile inline links # inline_textile_span:: Textile inline spans - # glyphs_textile:: Textile entities (such as em-dashes and smart quotes) + # inline_textile_glyphs:: Textile entities (such as em-dashes and smart quotes) # # == Markdown # @@ -272,7 +260,7 @@ class RedCloth < String @shelf = [] textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists, :block_textile_prefix, :inline_textile_image, :inline_textile_link, - :inline_textile_code, :inline_textile_span, :glyphs_textile] + :inline_textile_code, :inline_textile_glyphs, :inline_textile_span] markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule, :block_markdown_bq, :block_markdown_lists, :inline_markdown_reflink, :inline_markdown_link] @@ -290,16 +278,14 @@ class RedCloth < String # standard clean up incoming_entities text clean_white_space text + no_textile text # start processor @pre_list = [] rip_offtags text - no_textile text - hard_break text - unless @lite_mode - refs text - blocks text - end + hard_break text + refs text + blocks text inline text smooth_offtags text @@ -347,8 +333,6 @@ class RedCloth < String C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)" # PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' ) PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' ) - PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' ) - PUNCT_Q = Regexp::quote( '*-_+^~%' ) HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)' # Text markup tags, don't conflict with block tags @@ -358,6 +342,41 @@ class RedCloth < String 'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo' ] + # Elements to handle + GLYPHS = [ + # [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1’\2' ], # single closing + [ /([^\s\[{(>])\'/, '\1’' ], # single closing + [ /\'(?=\s|s\b|[#{PUNCT}])/, '’' ], # single closing + [ /\'/, '‘' ], # single opening + # [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing + [ /([^\s\[{(>])"/, '\1”' ], # double closing + [ /"(?=\s|[#{PUNCT}])/, '”' ], # double closing + [ /"/, '“' ], # double opening + [ /\b( )?\.{3}/, '\1…' ], # ellipsis + [ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '\1' ], # 3+ uppercase acronym + [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]{2,})([^\2\3', :no_span_caps ], # 3+ uppercase caps + [ /(\.\s)?\s?--\s?/, '\1—' ], # em dash + [ /\s->\s/, ' → ' ], # right arrow + [ /\s-\s/, ' – ' ], # en dash + [ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign + [ /\b ?[(\[]TM[\])]/i, '™' ], # trademark + [ /\b ?[(\[]R[\])]/i, '®' ], # registered + [ /\b ?[(\[]C[\])]/i, '©' ] # copyright + ] + + H_ALGN_VALS = { + '<' => 'left', + '=' => 'center', + '>' => 'right', + '<>' => 'justify' + } + + V_ALGN_VALS = { + '^' => 'top', + '-' => 'middle', + '~' => 'bottom' + } + QTAGS = [ ['**', 'b'], ['*', 'strong'], @@ -379,56 +398,19 @@ class RedCloth < String (#{rcq}) (#{C}) (?::(\S+?))? - (\S.*?\S|\S) + (.+?) #{rcq} (?=\W)/x else /(#{rcq}) (#{C}) - (?::(\S+))? - (\S.*?\S|\S) + (?::(\S+?))? + (.+?) #{rcq}/xm end [rc, ht, re, rtype] end - # Elements to handle - GLYPHS = [ - # [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1’\2' ], # single closing - [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1’' ], # single closing - [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '’' ], # single closing - [ /\'/, '‘' ], # single opening - [ //, '>' ], # greater-than - # [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing - [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1”' ], # double closing - [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '”' ], # double closing - [ /"/, '“' ], # double opening - [ /\b( )?\.{3}/, '\1…' ], # ellipsis - [ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '\1' ], # 3+ uppercase acronym - [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^\2\3', :no_span_caps ], # 3+ uppercase caps - [ /(\.\s)?\s?--\s?/, '\1—' ], # em dash - [ /\s->\s/, ' → ' ], # right arrow - [ /\s-\s/, ' – ' ], # en dash - [ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign - [ /\b ?[(\[]TM[\])]/i, '™' ], # trademark - [ /\b ?[(\[]R[\])]/i, '®' ], # registered - [ /\b ?[(\[]C[\])]/i, '©' ] # copyright - ] - - H_ALGN_VALS = { - '<' => 'left', - '=' => 'center', - '>' => 'right', - '<>' => 'justify' - } - - V_ALGN_VALS = { - '^' => 'top', - '-' => 'middle', - '~' => 'bottom' - } - # # Flexible HTML escaping # @@ -548,7 +530,7 @@ class RedCloth < String depth.pop end end - if depth.last and depth.last.length == tl.length + if depth.last.length == tl.length lines[line_id - 1] << '' end end @@ -595,7 +577,7 @@ class RedCloth < String end def hard_break( text ) - text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1
" ) if hard_breaks + text.gsub!( /(.)\n(?! *[#*\s|]|$)/, "\\1
" ) if hard_breaks end BLOCKS_GROUP_RE = /\n{2,}(?! )/m @@ -723,9 +705,9 @@ class RedCloth < String end end - MARKDOWN_RULE_RE = /^(#{ + MARKDOWN_RULE_RE = /^#{ ['*', '-', '_'].collect { |ch| '( ?' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' ) - })$/ + }$/ def block_markdown_rule( text ) text.gsub!( MARKDOWN_RULE_RE ) do |blk| @@ -737,6 +719,9 @@ class RedCloth < String def block_markdown_lists( text ) end + def inline_markdown_link( text ) + end + def inline_textile_span( text ) QTAGS.each do |qtag_rc, ht, qtag_re, rtype| text.gsub!( qtag_re ) do |m| @@ -918,12 +903,12 @@ class RedCloth < String def shelve( val ) @shelf << val - " :redsh##{ @shelf.length }:" + " <#{ @shelf.length }>" end def retrieve( text ) @shelf.each_with_index do |r, i| - text.gsub!( " :redsh##{ i + 1 }:", r ) + text.gsub!( " <#{ i + 1 }>", r ) end end @@ -980,7 +965,7 @@ class RedCloth < String HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m - def glyphs_textile( text, level = 0 ) + def inline_textile_glyphs( text, level = 0 ) if text !~ HASTAG_MATCH pgl text footnote_ref text @@ -996,11 +981,11 @@ class RedCloth < String codepre = 0 if codepre < 0 end elsif codepre.zero? - glyphs_textile( line, level + 1 ) + inline_textile_glyphs( line, level + 1 ) else htmlesc( line, :NoQuotes ) end - # p [level, codepre, line] + ## p [level, codepre, orig_line, line] line end @@ -1048,10 +1033,8 @@ class RedCloth < String end def inline( text ) - [/^inline_/, /^glyphs_/].each do |meth_re| - @rules.each do |rule_name| - method( rule_name ).call( text ) if rule_name.to_s.match( meth_re ) - end + @rules.each do |rule_name| + method( rule_name ).call( text ) if rule_name.to_s.match /^inline_/ end end @@ -1114,7 +1097,7 @@ class RedCloth < String q2 = ( q != '' ? q : '\s' ) if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i attrv = $1 - next if prop == 'src' and attrv =~ %r{^(?!http)\w+:} + next if prop == 'src' and attrv !~ /^http/ pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\"" break end diff --git a/vendor/rails/actionmailer/CHANGELOG b/vendor/rails/actionmailer/CHANGELOG index 0719e727..968f621a 100644 --- a/vendor/rails/actionmailer/CHANGELOG +++ b/vendor/rails/actionmailer/CHANGELOG @@ -1,4 +1,9 @@ -*1.13.2* (February 5th, 2007) +*1.3.3* (March 12th, 2007) + +* Depend on Action Pack 1.13.3 + + +*1.3.2* (February 5th, 2007) * Deprecate server_settings renaming it to smtp_settings, add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Koz] diff --git a/vendor/rails/actionmailer/Rakefile b/vendor/rails/actionmailer/Rakefile index 8773ce30..aac65b21 100755 --- a/vendor/rails/actionmailer/Rakefile +++ b/vendor/rails/actionmailer/Rakefile @@ -54,7 +54,7 @@ spec = Gem::Specification.new do |s| s.rubyforge_project = "actionmailer" s.homepage = "http://www.rubyonrails.org" - s.add_dependency('actionpack', '= 1.13.2' + PKG_BUILD) + s.add_dependency('actionpack', '= 1.13.3' + PKG_BUILD) s.has_rdoc = true s.requirements << 'none' @@ -85,11 +85,11 @@ end desc "Publish the release files to RubyForge." task :release => [ :package ] do - `rubyforge login` + require 'rubyforge' - for ext in %w( gem tgz zip ) - release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" - puts release_command - system(release_command) - end + packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" } + + rubyforge = RubyForge.new + rubyforge.login + rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) end \ No newline at end of file diff --git a/vendor/rails/actionmailer/lib/action_mailer/version.rb b/vendor/rails/actionmailer/lib/action_mailer/version.rb index 44d87158..03f075fb 100644 --- a/vendor/rails/actionmailer/lib/action_mailer/version.rb +++ b/vendor/rails/actionmailer/lib/action_mailer/version.rb @@ -2,7 +2,7 @@ module ActionMailer module VERSION #:nodoc: MAJOR = 1 MINOR = 3 - TINY = 2 + TINY = 3 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/actionpack/CHANGELOG b/vendor/rails/actionpack/CHANGELOG index 9480aecd..c298ff56 100644 --- a/vendor/rails/actionpack/CHANGELOG +++ b/vendor/rails/actionpack/CHANGELOG @@ -1,3 +1,12 @@ +*1.13.3* (March 12th, 2007) + +* Apply [5709] to stable. + +* session_enabled? works with session :off. #6680 [Catfish] + +* Performance: patch cgi/session to require digest/md5 once rather than per #create_new_id. [Stefan Kaes] + + *1.13.2* (February 5th, 2007) * Add much-needed html-scanner tests. Fixed CDATA parsing bug. [Rick] @@ -10,8 +19,6 @@ * Add singleton resources from trunk [Rick Olson] -* TestSession supports indifferent access so session['foo'] == session[:foo] in your tests. #7372 [julik, jean.helou] - * select :multiple => true suffixes the attribute name with [] unless already suffixed. #6977 [nik.kakelin, ben, julik] * Improve routes documentation. #7095 [zackchandler] diff --git a/vendor/rails/actionpack/Rakefile b/vendor/rails/actionpack/Rakefile index 4f5b47b6..4bca6b6d 100755 --- a/vendor/rails/actionpack/Rakefile +++ b/vendor/rails/actionpack/Rakefile @@ -75,7 +75,7 @@ spec = Gem::Specification.new do |s| s.has_rdoc = true s.requirements << 'none' - s.add_dependency('activesupport', '= 1.4.1' + PKG_BUILD) + s.add_dependency('activesupport', '= 1.4.2' + PKG_BUILD) s.require_path = 'lib' s.autorequire = 'action_controller' @@ -144,11 +144,11 @@ end desc "Publish the release files to RubyForge." task :release => [ :package ] do - `rubyforge login` + require 'rubyforge' - for ext in %w( gem tgz zip ) - release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" - puts release_command - system(release_command) - end -end + packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" } + + rubyforge = RubyForge.new + rubyforge.login + rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) +end \ No newline at end of file diff --git a/vendor/rails/actionpack/lib/action_controller/base.rb b/vendor/rails/actionpack/lib/action_controller/base.rb index 45d4cb18..a84d876e 100755 --- a/vendor/rails/actionpack/lib/action_controller/base.rb +++ b/vendor/rails/actionpack/lib/action_controller/base.rb @@ -539,7 +539,7 @@ module ActionController #:nodoc: end def session_enabled? - request.session_options[:disabled] != false + request.session_options && request.session_options[:disabled] != false end protected diff --git a/vendor/rails/actionpack/lib/action_controller/cgi_process.rb b/vendor/rails/actionpack/lib/action_controller/cgi_process.rb index 49c5680f..efb2c615 100644 --- a/vendor/rails/actionpack/lib/action_controller/cgi_process.rb +++ b/vendor/rails/actionpack/lib/action_controller/cgi_process.rb @@ -1,6 +1,7 @@ require 'action_controller/cgi_ext/cgi_ext' require 'action_controller/cgi_ext/cookie_performance_fix' require 'action_controller/cgi_ext/raw_post_data_fix' +require 'action_controller/cgi_ext/session_performance_fix' module ActionController #:nodoc: class Base diff --git a/vendor/rails/actionpack/lib/action_controller/routing.rb b/vendor/rails/actionpack/lib/action_controller/routing.rb index dee2e66e..b132a80c 100644 --- a/vendor/rails/actionpack/lib/action_controller/routing.rb +++ b/vendor/rails/actionpack/lib/action_controller/routing.rb @@ -344,10 +344,10 @@ module ActionController # the query string. (Never use keys from the recalled request when building the # query string.) - method_decl = "def generate(#{args})\npath, hash = generate_raw(options, hash, expire_on)\nappend_query_string(path, hash, extra_keys(hash, expire_on))\nend" + method_decl = "def generate(#{args})\npath, hash = generate_raw(options, hash, expire_on)\nappend_query_string(path, hash, extra_keys(options))\nend" instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})" - method_decl = "def generate_extras(#{args})\npath, hash = generate_raw(options, hash, expire_on)\n[path, extra_keys(hash, expire_on)]\nend" + method_decl = "def generate_extras(#{args})\npath, hash = generate_raw(options, hash, expire_on)\n[path, extra_keys(options)]\nend" instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})" raw_method end @@ -1238,7 +1238,7 @@ module ActionController # drop the leading '/' on the controller name options[:controller] = options[:controller][1..-1] if options[:controller] && options[:controller][0] == ?/ merged = recall.merge(options) - + if named_route path = named_route.generate(options, merged, expire_on) if path.nil? diff --git a/vendor/rails/actionpack/lib/action_controller/test_process.rb b/vendor/rails/actionpack/lib/action_controller/test_process.rb index 27daf17c..4011e6cf 100644 --- a/vendor/rails/actionpack/lib/action_controller/test_process.rb +++ b/vendor/rails/actionpack/lib/action_controller/test_process.rb @@ -288,11 +288,11 @@ module ActionController #:nodoc: end def [](key) - data[key.to_s] + data[key] end def []=(key, value) - data[key.to_s] = value + data[key] = value end def update diff --git a/vendor/rails/actionpack/lib/action_pack/version.rb b/vendor/rails/actionpack/lib/action_pack/version.rb index 176fda01..09eaef6e 100644 --- a/vendor/rails/actionpack/lib/action_pack/version.rb +++ b/vendor/rails/actionpack/lib/action_pack/version.rb @@ -2,7 +2,7 @@ module ActionPack #:nodoc: module VERSION #:nodoc: MAJOR = 1 MINOR = 13 - TINY = 2 + TINY = 3 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/actionpack/test/controller/routing_test.rb b/vendor/rails/actionpack/test/controller/routing_test.rb index c11b7711..5e5f2b09 100644 --- a/vendor/rails/actionpack/test/controller/routing_test.rb +++ b/vendor/rails/actionpack/test/controller/routing_test.rb @@ -1717,6 +1717,17 @@ class RouteSetTest < Test::Unit::TestCase ) end + def test_query_params_will_be_shown_when_recalled + set.draw do |map| + map.connect 'show_post/:parameter', :controller => 'post', :action => 'show' + map.connect ':controller/:action/:id' + end + assert_equal '/post/edit?parameter=1', set.generate( + {:action => 'edit', :parameter => 1}, + {:controller => 'post', :action => 'show', :parameter => 1} + ) + end + end class RoutingTest < Test::Unit::TestCase diff --git a/vendor/rails/actionpack/test/controller/session_management_test.rb b/vendor/rails/actionpack/test/controller/session_management_test.rb index 6e100c0c..63917565 100644 --- a/vendor/rails/actionpack/test/controller/session_management_test.rb +++ b/vendor/rails/actionpack/test/controller/session_management_test.rb @@ -142,4 +142,15 @@ class SessionManagementTest < Test::Unit::TestCase get :tell assert_equal "does not have cached associations", @response.body end + + def test_session_is_enabled + @controller = TestController.new + get :show + assert_nothing_raised do + assert_equal false, @controller.session_enabled? + end + + get :tell + assert @controller.session_enabled? + end end diff --git a/vendor/rails/actionpack/test/controller/test_test.rb b/vendor/rails/actionpack/test/controller/test_test.rb index 546a6c96..2b0086c5 100644 --- a/vendor/rails/actionpack/test/controller/test_test.rb +++ b/vendor/rails/actionpack/test/controller/test_test.rb @@ -8,12 +8,6 @@ class TestTest < Test::Unit::TestCase render :text => 'ignore me' end - def set_session - session['string'] = 'A wonder' - session[:symbol] = 'it works' - render :text => 'Success' - end - def render_raw_post raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank? render :text => request.raw_post @@ -117,14 +111,6 @@ HTML assert_equal '>value<', flash['test'] end - def test_process_with_session - process :set_session - assert_equal 'A wonder', session['string'], "A value stored in the session should be available by string key" - assert_equal 'A wonder', session[:string], "Test session hash should allow indifferent access" - assert_equal 'it works', session['symbol'], "Test session hash should allow indifferent access" - assert_equal 'it works', session[:symbol], "Test session hash should allow indifferent access" - end - def test_process_with_request_uri_with_no_params process :test_uri assert_equal "/test_test/test/test_uri", @response.body diff --git a/vendor/rails/actionwebservice/CHANGELOG b/vendor/rails/actionwebservice/CHANGELOG index 5fbff5d2..2c3463e6 100644 --- a/vendor/rails/actionwebservice/CHANGELOG +++ b/vendor/rails/actionwebservice/CHANGELOG @@ -1,3 +1,8 @@ +*1.2.3* (March 12th, 2007) + +* Depend on Action Pack 1.13.3 + + *1.2.2* (Feburary 4th, 2007) * Depend on Action Pack 1.13.2 diff --git a/vendor/rails/actionwebservice/Rakefile b/vendor/rails/actionwebservice/Rakefile index 62650f0e..fec9aae9 100644 --- a/vendor/rails/actionwebservice/Rakefile +++ b/vendor/rails/actionwebservice/Rakefile @@ -71,8 +71,8 @@ spec = Gem::Specification.new do |s| s.rubyforge_project = "aws" s.homepage = "http://www.rubyonrails.org" - s.add_dependency('actionpack', '= 1.13.2' + PKG_BUILD) - s.add_dependency('activerecord', '= 1.15.2' + PKG_BUILD) + s.add_dependency('actionpack', '= 1.13.3' + PKG_BUILD) + s.add_dependency('activerecord', '= 1.15.3' + PKG_BUILD) s.has_rdoc = true s.requirements << 'none' @@ -161,11 +161,11 @@ end desc "Publish the release files to RubyForge." task :release => [ :package ] do - `rubyforge login` + require 'rubyforge' - for ext in %w( gem tgz zip ) - release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" - puts release_command - system(release_command) - end -end + packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" } + + rubyforge = RubyForge.new + rubyforge.login + rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) +end \ No newline at end of file diff --git a/vendor/rails/actionwebservice/lib/action_web_service/version.rb b/vendor/rails/actionwebservice/lib/action_web_service/version.rb index 7358abe0..ebcb7eaa 100644 --- a/vendor/rails/actionwebservice/lib/action_web_service/version.rb +++ b/vendor/rails/actionwebservice/lib/action_web_service/version.rb @@ -2,7 +2,7 @@ module ActionWebService module VERSION #:nodoc: MAJOR = 1 MINOR = 2 - TINY = 2 + TINY = 3 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/activerecord/CHANGELOG b/vendor/rails/activerecord/CHANGELOG index 317470c7..221f588a 100644 --- a/vendor/rails/activerecord/CHANGELOG +++ b/vendor/rails/activerecord/CHANGELOG @@ -1,3 +1,14 @@ +*1.15.3* (March 12th, 2007) + +* Allow a polymorphic :source for has_many :through associations. Closes #7143 [protocool] + +* Consistently quote primary key column names. #7763 [toolmantim] + +* Fixtures: fix YAML ordered map support. #2665 [Manuel Holtgrewe, nfbuckley] + +* Fix has_many :through << with custom foreign keys. #6466, #7153 [naffis, Rich Collins] + + *1.15.2* (February 5th, 2007) * Pass a range in :conditions to use the SQL BETWEEN operator. #6974 [dcmanges] diff --git a/vendor/rails/activerecord/Rakefile b/vendor/rails/activerecord/Rakefile index 4e8ee99f..fb3c2c74 100755 --- a/vendor/rails/activerecord/Rakefile +++ b/vendor/rails/activerecord/Rakefile @@ -151,7 +151,7 @@ spec = Gem::Specification.new do |s| s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) } end - s.add_dependency('activesupport', '= 1.4.1' + PKG_BUILD) + s.add_dependency('activesupport', '= 1.4.2' + PKG_BUILD) s.files.delete "test/fixtures/fixture_database.sqlite" s.files.delete "test/fixtures/fixture_database_2.sqlite" @@ -216,11 +216,11 @@ end desc "Publish the release files to RubyForge." task :release => [ :package ] do - `rubyforge login` + require 'rubyforge' - for ext in %w( gem tgz zip ) - release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" - puts release_command - system(release_command) - end -end + packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" } + + rubyforge = RubyForge.new + rubyforge.login + rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) +end \ No newline at end of file diff --git a/vendor/rails/activerecord/lib/active_record/associations.rb b/vendor/rails/activerecord/lib/active_record/associations.rb index 29f813ed..354d3c3f 100755 --- a/vendor/rails/activerecord/lib/active_record/associations.rb +++ b/vendor/rails/activerecord/lib/active_record/associations.rb @@ -20,7 +20,13 @@ module ActiveRecord super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' on the polymorphic object '#{source_reflection.class_name}##{source_reflection.name}'.") end end - + + class HasManyThroughAssociationPointlessSourceTypeError < ActiveRecordError #:nodoc: + def initialize(owner_class_name, reflection, source_reflection) + super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' with a :source_type option if the '#{reflection.through_reflection.class_name}##{source_reflection.name}' is not polymorphic. Try removing :source_type on your association.") + end + end + class HasManyThroughSourceAssociationNotFoundError < ActiveRecordError #:nodoc: def initialize(reflection) through_reflection = reflection.through_reflection @@ -529,6 +535,8 @@ module ActiveRecord # * :source: Specifies the source association name used by has_many :through queries. Only use it if the name cannot be # inferred from the association. has_many :subscribers, :through => :subscriptions will look for either +:subscribers+ or # +:subscriber+ on +Subscription+, unless a +:source+ is given. + # * :source_type: Specifies type of the source association used by has_many :through queries where the source association + # is a polymorphic belongs_to. # * :uniq - if set to true, duplicates will be omitted from the collection. Useful in conjunction with :through. # # Option examples: @@ -1087,7 +1095,7 @@ module ActiveRecord :class_name, :table_name, :foreign_key, :exclusively_dependent, :dependent, :select, :conditions, :include, :order, :group, :limit, :offset, - :as, :through, :source, + :as, :through, :source, :source_type, :uniq, :finder_sql, :counter_sql, :before_add, :after_add, :before_remove, :after_remove, @@ -1491,57 +1499,65 @@ module ActiveRecord case when reflection.macro == :has_many && reflection.options[:through] through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : '' - if through_reflection.options[:as] # has_many :through against a polymorphic join - polymorphic_foreign_key = through_reflection.options[:as].to_s + '_id' - polymorphic_foreign_type = through_reflection.options[:as].to_s + '_type' - " LEFT OUTER JOIN %s ON (%s.%s = %s.%s AND %s.%s = %s) " % [ - table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), - aliased_join_table_name, polymorphic_foreign_key, - parent.aliased_table_name, parent.primary_key, - aliased_join_table_name, polymorphic_foreign_type, klass.quote_value(parent.active_record.base_class.name)] + - " LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [table_name_and_alias, - aliased_table_name, primary_key, aliased_join_table_name, options[:foreign_key] || reflection.klass.to_s.classify.foreign_key + jt_foreign_key = jt_as_extra = jt_source_extra = jt_sti_extra = nil + first_key = second_key = as_extra = nil + + if through_reflection.options[:as] # has_many :through against a polymorphic join + jt_foreign_key = through_reflection.options[:as].to_s + '_id' + jt_as_extra = " AND %s.%s = %s" % [ + aliased_join_table_name, reflection.active_record.connection.quote_column_name(through_reflection.options[:as].to_s + '_type'), + klass.quote_value(parent.active_record.base_class.name) ] else - if source_reflection.macro == :has_many && source_reflection.options[:as] - " LEFT OUTER JOIN %s ON %s.%s = %s.%s " % [ - table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), aliased_join_table_name, - through_reflection.primary_key_name, - parent.aliased_table_name, parent.primary_key] + - " LEFT OUTER JOIN %s ON %s.%s = %s.%s AND %s.%s = %s " % [ - table_name_and_alias, - aliased_table_name, "#{source_reflection.options[:as]}_id", - aliased_join_table_name, options[:foreign_key] || primary_key, - aliased_table_name, "#{source_reflection.options[:as]}_type", + jt_foreign_key = through_reflection.primary_key_name + end + + case source_reflection.macro + when :has_many + if source_reflection.options[:as] + first_key = "#{source_reflection.options[:as]}_id" + second_key = options[:foreign_key] || primary_key + as_extra = " AND %s.%s = %s" % [ + aliased_table_name, reflection.active_record.connection.quote_column_name("#{source_reflection.options[:as]}_type"), klass.quote_value(source_reflection.active_record.base_class.name) ] else - case source_reflection.macro - when :belongs_to - first_key = primary_key - second_key = source_reflection.options[:foreign_key] || klass.to_s.classify.foreign_key - extra = nil - when :has_many - first_key = through_reflection.klass.base_class.to_s.classify.foreign_key - second_key = options[:foreign_key] || primary_key - extra = through_reflection.klass.descends_from_active_record? ? nil : - " AND %s.%s = %s" % [ - aliased_join_table_name, - reflection.active_record.connection.quote_column_name(through_reflection.active_record.inheritance_column), - through_reflection.klass.quote_value(through_reflection.klass.name.demodulize)] - end - " LEFT OUTER JOIN %s ON (%s.%s = %s.%s%s) " % [ - table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), - aliased_join_table_name, through_reflection.primary_key_name, - parent.aliased_table_name, parent.primary_key, extra] + - " LEFT OUTER JOIN %s ON (%s.%s = %s.%s) " % [ - table_name_and_alias, - aliased_table_name, first_key, - aliased_join_table_name, second_key + first_key = through_reflection.klass.base_class.to_s.classify.foreign_key + second_key = options[:foreign_key] || primary_key + end + + unless through_reflection.klass.descends_from_active_record? + jt_sti_extra = " AND %s.%s = %s" % [ + aliased_join_table_name, + reflection.active_record.connection.quote_column_name(through_reflection.active_record.inheritance_column), + through_reflection.klass.quote_value(through_reflection.klass.name.demodulize)] + end + when :belongs_to + first_key = primary_key + if reflection.options[:source_type] + second_key = source_reflection.association_foreign_key + jt_source_extra = " AND %s.%s = %s" % [ + aliased_join_table_name, reflection.active_record.connection.quote_column_name(reflection.source_reflection.options[:foreign_type]), + klass.quote_value(reflection.options[:source_type]) ] + else + second_key = source_reflection.options[:foreign_key] || klass.to_s.classify.foreign_key end end + + " LEFT OUTER JOIN %s ON (%s.%s = %s.%s%s%s%s) " % [ + table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), + parent.aliased_table_name, reflection.active_record.connection.quote_column_name(parent.primary_key), + aliased_join_table_name, reflection.active_record.connection.quote_column_name(jt_foreign_key), + jt_as_extra, jt_source_extra, jt_sti_extra + ] + + " LEFT OUTER JOIN %s ON (%s.%s = %s.%s%s) " % [ + table_name_and_alias, + aliased_table_name, reflection.active_record.connection.quote_column_name(first_key), + aliased_join_table_name, reflection.active_record.connection.quote_column_name(second_key), + as_extra + ] when reflection.macro == :has_many && reflection.options[:as] " LEFT OUTER JOIN %s ON %s.%s = %s.%s AND %s.%s = %s" % [ @@ -1588,6 +1604,7 @@ module ActiveRecord end protected + def pluralize(table_name) ActiveRecord::Base.pluralize_table_names ? table_name.to_s.pluralize : table_name end diff --git a/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb b/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb index ce22496e..a8ad52be 100644 --- a/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -138,7 +138,11 @@ module ActiveRecord # Construct attributes for :through pointing to owner and associate. def construct_join_attributes(associate) - construct_owner_attributes(@reflection.through_reflection).merge(@reflection.source_reflection.association_foreign_key => associate.id) + returning construct_owner_attributes(@reflection.through_reflection).merge(@reflection.source_reflection.primary_key_name => associate.id) do |join_attributes| + if @reflection.options[:source_type] + join_attributes.merge!(@reflection.source_reflection.options[:foreign_type] => associate.class.base_class.name.to_s) + end + end end # Associate attributes pointing to owner, quoted. @@ -176,6 +180,12 @@ module ActiveRecord if @reflection.through_reflection.options[:as] || @reflection.source_reflection.macro == :belongs_to reflection_primary_key = @reflection.klass.primary_key source_primary_key = @reflection.source_reflection.primary_key_name + if @reflection.options[:source_type] + polymorphic_join = "AND %s.%s = %s" % [ + @reflection.through_reflection.table_name, "#{@reflection.source_reflection.options[:foreign_type]}", + @owner.class.quote_value(@reflection.options[:source_type]) + ] + end else reflection_primary_key = @reflection.source_reflection.primary_key_name source_primary_key = @reflection.klass.primary_key diff --git a/vendor/rails/activerecord/lib/active_record/base.rb b/vendor/rails/activerecord/lib/active_record/base.rb index 9698c5ae..258aa537 100755 --- a/vendor/rails/activerecord/lib/active_record/base.rb +++ b/vendor/rails/activerecord/lib/active_record/base.rb @@ -479,7 +479,7 @@ module ActiveRecord #:nodoc: # Deletes the record with the given +id+ without instantiating an object first. If an array of ids is provided, all of them # are deleted. def delete(id) - delete_all([ "#{primary_key} IN (?)", id ]) + delete_all([ "#{connection.quote_column_name(primary_key)} IN (?)", id ]) end # Destroys the record with the given +id+ by instantiating the object and calling #destroy (all the callbacks are the triggered). @@ -526,12 +526,12 @@ module ActiveRecord #:nodoc: # for looping over a collection where each element require a number of aggregate values. Like the DiscussionBoard # that needs to list both the number of posts and comments. def increment_counter(counter_name, id) - update_all "#{counter_name} = #{counter_name} + 1", "#{primary_key} = #{quote_value(id)}" + update_all "#{connection.quote_column_name(counter_name)} = #{connection.quote_column_name(counter_name)} + 1", "#{connection.quote_column_name(primary_key)} = #{quote_value(id)}" end # Works like increment_counter, but decrements instead. def decrement_counter(counter_name, id) - update_all "#{counter_name} = #{counter_name} - 1", "#{primary_key} = #{quote_value(id)}" + update_all "#{connection.quote_column_name(counter_name)} = #{connection.quote_column_name(counter_name)} - 1", "#{connection.quote_column_name(primary_key)} = #{quote_value(id)}" end @@ -1020,7 +1020,7 @@ module ActiveRecord #:nodoc: def find_one(id, options) conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions] - options.update :conditions => "#{table_name}.#{primary_key} = #{quote_value(id,columns_hash[primary_key])}#{conditions}" + options.update :conditions => "#{table_name}.#{connection.quote_column_name(primary_key)} = #{quote_value(id,columns_hash[primary_key])}#{conditions}" # Use find_every(options).first since the primary key condition # already ensures we have a single record. Using find_initial adds @@ -1035,7 +1035,7 @@ module ActiveRecord #:nodoc: def find_some(ids, options) conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions] ids_list = ids.map { |id| quote_value(id,columns_hash[primary_key]) }.join(',') - options.update :conditions => "#{table_name}.#{primary_key} IN (#{ids_list})#{conditions}" + options.update :conditions => "#{table_name}.#{connection.quote_column_name(primary_key)} IN (#{ids_list})#{conditions}" result = find_every(options) @@ -1052,10 +1052,9 @@ module ActiveRecord #:nodoc: def instantiate(record) object = if subclass_name = record[inheritance_column] - # No type given. if subclass_name.empty? + # No type given. allocate - else # Ignore type if no column is present since it was probably # pulled in from a sloppy join. @@ -1558,7 +1557,7 @@ module ActiveRecord #:nodoc: unless new_record? connection.delete <<-end_sql, "#{self.class.name} Destroy" DELETE FROM #{self.class.table_name} - WHERE #{self.class.primary_key} = #{quoted_id} + WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id} end_sql end @@ -1797,7 +1796,7 @@ module ActiveRecord #:nodoc: connection.update( "UPDATE #{self.class.table_name} " + "SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false))} " + - "WHERE #{self.class.primary_key} = #{quote_value(id)}", + "WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)}", "#{self.class.name} Update" ) end diff --git a/vendor/rails/activerecord/lib/active_record/fixtures.rb b/vendor/rails/activerecord/lib/active_record/fixtures.rb index 60e0f03a..4109d366 100755 --- a/vendor/rails/activerecord/lib/active_record/fixtures.rb +++ b/vendor/rails/activerecord/lib/active_record/fixtures.rb @@ -301,18 +301,30 @@ class Fixtures < YAML::Omap yaml_string << IO.read(subfixture_path) end yaml_string << IO.read(yaml_file_path) + begin yaml = YAML::load(erb_render(yaml_string)) rescue Exception=>boom raise Fixture::FormatError, "a YAML error occurred parsing #{yaml_file_path}. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html\nThe exact error was:\n #{boom.class}: #{boom}" - end + end + if yaml - yaml = yaml.value if yaml.respond_to?(:type_id) and yaml.respond_to?(:value) - yaml.each do |name, data| - unless data - raise Fixture::FormatError, "Bad data for #{@class_name} fixture named #{name} (nil)" + # If the file is an ordered map, extract its children. + yaml_value = + if yaml.respond_to?(:type_id) && yaml.respond_to?(:value) + yaml.value + else + [yaml] + end + + yaml_value.each do |fixture| + fixture.each do |name, data| + unless data + raise Fixture::FormatError, "Bad data for #{@class_name} fixture named #{name} (nil)" + end + + self[name] = Fixture.new(data, @class_name) end - self[name] = Fixture.new(data, @class_name) end end elsif File.file?(csv_file_path) diff --git a/vendor/rails/activerecord/lib/active_record/reflection.rb b/vendor/rails/activerecord/lib/active_record/reflection.rb index 81af6ec1..3d8e1b7d 100644 --- a/vendor/rails/activerecord/lib/active_record/reflection.rb +++ b/vendor/rails/activerecord/lib/active_record/reflection.rb @@ -186,8 +186,12 @@ module ActiveRecord if source_reflection.nil? raise HasManyThroughSourceAssociationNotFoundError.new(self) end + + if options[:source_type] && source_reflection.options[:polymorphic].nil? + raise HasManyThroughAssociationPointlessSourceTypeError.new(active_record.name, self, source_reflection) + end - if source_reflection.options[:polymorphic] + if source_reflection.options[:polymorphic] && options[:source_type].nil? raise HasManyThroughAssociationPolymorphicError.new(active_record.name, self, source_reflection) end @@ -205,7 +209,7 @@ module ActiveRecord if options[:class_name] options[:class_name] elsif through_reflection # get the class_name of the belongs_to association of the through reflection - source_reflection.class_name + options[:source_type] || source_reflection.class_name else class_name = name.to_s.camelize class_name = class_name.singularize if [ :has_many, :has_and_belongs_to_many ].include?(macro) diff --git a/vendor/rails/activerecord/lib/active_record/vendor/mysql.rb b/vendor/rails/activerecord/lib/active_record/vendor/mysql.rb index 0d8cc2ef..1c3294c7 100644 --- a/vendor/rails/activerecord/lib/active_record/vendor/mysql.rb +++ b/vendor/rails/activerecord/lib/active_record/vendor/mysql.rb @@ -563,9 +563,9 @@ class Mysql def scramble41(password, message) return 0x00.chr if password.nil? or password.empty? buf = [0x14] - s1 = Digest::SHA1.new(password).digest - s2 = Digest::SHA1.new(s1).digest - x = Digest::SHA1.new(message + s2).digest + s1 = Digest::SHA1.digest(password) + s2 = Digest::SHA1.digest(s1) + x = Digest::SHA1.digest(message + s2) (0..s1.length - 1).each {|i| buf.push(s1[i] ^ x[i])} buf.pack("C*") end @@ -1174,7 +1174,11 @@ class << Mysql def finalizer(net) proc { net.clear - net.write Mysql::COM_QUIT.chr + begin + net.write(Mysql::COM_QUIT.chr) + net.close + rescue # Ignore IOError if socket is already closed. + end } end diff --git a/vendor/rails/activerecord/lib/active_record/version.rb b/vendor/rails/activerecord/lib/active_record/version.rb index 686c6d88..4027561d 100644 --- a/vendor/rails/activerecord/lib/active_record/version.rb +++ b/vendor/rails/activerecord/lib/active_record/version.rb @@ -2,7 +2,7 @@ module ActiveRecord module VERSION #:nodoc: MAJOR = 1 MINOR = 15 - TINY = 2 + TINY = 3 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/activerecord/test/associations/join_model_test.rb b/vendor/rails/activerecord/test/associations/join_model_test.rb index 1124a0ac..a5e525c6 100644 --- a/vendor/rails/activerecord/test/associations/join_model_test.rb +++ b/vendor/rails/activerecord/test/associations/join_model_test.rb @@ -6,10 +6,12 @@ require 'fixtures/comment' require 'fixtures/author' require 'fixtures/category' require 'fixtures/categorization' +require 'fixtures/vertex' +require 'fixtures/edge' class AssociationsJoinModelTest < Test::Unit::TestCase self.use_transactional_fixtures = false - fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites + fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites, :vertices def test_has_many assert authors(:david).categories.include?(categories(:general)) @@ -298,6 +300,18 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert_equal [posts(:welcome), posts(:thinking)], tags(:general).taggings.find(:all, :include => :taggable) end end + + def test_has_many_polymorphic_with_source_type + assert_equal [posts(:welcome), posts(:thinking)], tags(:general).tagged_posts + end + + def test_eager_has_many_polymorphic_with_source_type + tag_with_include = Tag.find(tags(:general).id, :include => :tagged_posts) + desired = [posts(:welcome), posts(:thinking)] + assert_no_queries do + assert_equal desired, tag_with_include.tagged_posts + end + end def test_has_many_through_has_many_find_all assert_equal comments(:greetings), authors(:david).comments.find(:all, :order => 'comments.id').first @@ -414,6 +428,9 @@ class AssociationsJoinModelTest < Test::Unit::TestCase message = "Expected a Tagging in taggings collection, got #{wrong.class}.") assert_equal(count + 4, post_thinking.tags.size) assert_equal(count + 4, post_thinking.tags(true).size) + + # Raises if the wrong reflection name is used to set the Edge belongs_to + assert_nothing_raised { vertices(:vertex_1).sinks << vertices(:vertex_5) } end def test_adding_junk_to_has_many_through_should_raise_type_mismatch diff --git a/vendor/rails/activerecord/test/fixtures/categories_ordered.yml b/vendor/rails/activerecord/test/fixtures/categories_ordered.yml index 294a6368..2afc6cb5 100644 --- a/vendor/rails/activerecord/test/fixtures/categories_ordered.yml +++ b/vendor/rails/activerecord/test/fixtures/categories_ordered.yml @@ -1,4 +1,4 @@ ---- !omap +--- !!omap <% 100.times do |i| %> - fixture_no_<%= i %>: id: <%= i %> diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/db2.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/db2.drop.sql index 50cffe3b..9837def3 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/db2.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/db2.drop.sql @@ -29,3 +29,4 @@ DROP TABLE fk_test_has_fk; DROP TABLE keyboards; DROP TABLE legacy_things; DROP TABLE numeric_data; +DROP TABLE mixed_case_monkeys; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/db2.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/db2.sql index ee76fc4d..750e74a0 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/db2.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/db2.sql @@ -224,3 +224,8 @@ CREATE TABLE numeric_data ( my_house_population DECIMAL(2), decimal_number_with_default DECIMAL(3,2) DEFAULT 2.78 ); + +CREATE TABLE mixed_case_monkeys ( + monkeyID INT NOT NULL PRIMARY KEY, + fleaCount INT +); diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.drop.sql index 2e43243a..69aa0931 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.drop.sql @@ -30,6 +30,7 @@ DROP TABLE keyboards; DROP TABLE defaults; DROP TABLE legacy_things; DROP TABLE numeric_data; +DROP TABLE mixed_case_monkeys; DROP DOMAIN D_BOOLEAN; @@ -59,3 +60,4 @@ DROP GENERATOR keyboards_seq; DROP GENERATOR defaults_seq; DROP GENERATOR legacy_things_seq; DROP GENERATOR numeric_data_seq; +DROP GENERATOR mixed_case_monkeys_seq; \ No newline at end of file diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.sql index 8ca0bf62..779701c3 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.sql @@ -295,3 +295,10 @@ CREATE TABLE numeric_data ( ); CREATE GENERATOR numeric_data_seq; SET GENERATOR numeric_data_seq TO 10000; + +CREATE TABLE mixed_case_monkeys ( + "monkeyID" BIGINT NOT NULL, + "fleaCount" INTEGER +); +CREATE GENERATOR mixed_case_monkeys_seq; +SET GENERATOR mixed_case_monkeys_seq TO 10000; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.drop.sql index 5fc64f76..1c87fdf7 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.drop.sql @@ -29,3 +29,4 @@ DROP TABLE fk_test_has_pk CASCADE; DROP TABLE keyboards CASCADE; DROP TABLE legacy_things CASCADE; DROP TABLE numeric_data CASCADE; +DROP TABLE mixed_case_monkeys CASCADE; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.sql index e102f65a..798b0204 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.sql @@ -260,3 +260,9 @@ CREATE TABLE "numeric_data" ( primary key ("id") ); SET UNIQUE FOR numeric_data(id); + +CREATE TABLE mixed_case_monkeys ( + "monkeyID" integer DEFAULT unique, + "fleaCount" integer +); +SET UNIQUE FOR mixed_case_monkeys("monkeyID"); diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.drop.sql index cb6a870a..f269b3a3 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.drop.sql @@ -29,3 +29,4 @@ DROP TABLE fk_test_has_pk; DROP TABLE keyboards; DROP TABLE legacy_things; DROP TABLE numeric_data; +DROP TABLE mixed_case_monkeys; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.sql index 93b7fada..1781ee00 100755 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.sql @@ -226,3 +226,9 @@ CREATE TABLE `numeric_data` ( `my_house_population` decimal(2), `decimal_number_with_default` decimal(3,2) DEFAULT 2.78 ) TYPE=InnoDB; + +CREATE TABLE mixed_case_monkeys ( + `monkeyID` int(11) NOT NULL auto_increment, + `fleaCount` int(11), + PRIMARY KEY (`monkeyID`) +) TYPE=InnoDB; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.sql index c3da2efe..4f5d27e6 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.sql @@ -292,3 +292,11 @@ CREATE TABLE numeric_data ( go CREATE PRIMARY KEY numeric_data (id) go + +CREATE TABLE mixed_case_monkeys ( + monkeyID INTEGER NOT NULL DEFAULT _rowid, + fleaCount INTEGER +); +go +CREATE PRIMARY KEY mixed_case_monkeys (monkeyID) +go diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.drop.sql index 6fa01cdf..910b118e 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.drop.sql @@ -30,6 +30,7 @@ drop table fk_test_has_fk; drop table keyboards; drop table legacy_things; drop table numeric_data; +drop table mixed_case_monkeys; drop sequence accounts_seq; drop sequence funny_jokes_seq; @@ -61,3 +62,4 @@ drop sequence fk_test_has_fk_seq; drop sequence keyboards_seq; drop sequence legacy_things_seq; drop sequence numeric_data_seq; +drop sequence mixed_case_monkeys_seq; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.sql index 869c59fb..f84a86a6 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.sql @@ -317,3 +317,9 @@ CREATE TABLE numeric_data ( decimal_number_with_default decimal(3,2) DEFAULT 2.78 ); create sequence numeric_data_seq minvalue 10000; + +CREATE TABLE mixed_case_monkeys ( + "monkeyID" INTEGER NOT NULL PRIMARY KEY, + "fleaCount" INTEGER +); +create sequence mixed_case_monkeys_seq minvalue 10000; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.drop.sql index 4910b0ec..3afe6d39 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.drop.sql @@ -34,3 +34,4 @@ DROP TABLE keyboards; DROP TABLE legacy_things; DROP TABLE numeric_data; DROP TABLE column_data; +DROP TABLE mixed_case_monkeys; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.sql index b5412c74..71c35fbd 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.sql @@ -256,3 +256,8 @@ CREATE TABLE numeric_data ( my_house_population decimal(2), decimal_number_with_default decimal(3,2) default 2.78 ); + +CREATE TABLE mixed_case_monkeys ( + "monkeyID" INTEGER PRIMARY KEY, + "fleaCount" INTEGER +); diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.drop.sql index cb6a870a..f269b3a3 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.drop.sql @@ -29,3 +29,4 @@ DROP TABLE fk_test_has_pk; DROP TABLE keyboards; DROP TABLE legacy_things; DROP TABLE numeric_data; +DROP TABLE mixed_case_monkeys; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.sql index edf1e815..973639f1 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.sql @@ -208,3 +208,8 @@ CREATE TABLE 'numeric_data' ( 'my_house_population' DECIMAL(2), 'decimal_number_with_default' DECIMAL(3,2) DEFAULT 2.78 ); + +CREATE TABLE mixed_case_monkeys ( + 'monkeyID' INTEGER NOT NULL PRIMARY KEY, + 'fleaCount' INTEGER +); diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql index e8327f08..c415d223 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql @@ -31,3 +31,4 @@ DROP TABLE keyboards; DROP TABLE legacy_things; DROP TABLE numeric_data; DROP TABLE [order]; +DROP TABLE mixed_case_monkeys; diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.sql index 50e1938d..3cec4e4a 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.sql @@ -236,3 +236,8 @@ CREATE TABLE [order] ( texture varchar(255), flavor varchar(255) ); + +CREATE TABLE mixed_case_monkeys ( + [monkeyID] int NOT NULL IDENTITY(1, 1), + [fleaCount] int default NULL +); diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.drop.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.drop.sql index ebf2fc97..9d852216 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.drop.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.drop.sql @@ -29,5 +29,6 @@ DROP TABLE fk_test_has_pk DROP TABLE keyboards DROP TABLE legacy_things DROP TABLE numeric_data +DROP TABLE mixed_case_monkeys DROP TABLE schema_info go diff --git a/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.sql b/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.sql index 8544a415..6c42c660 100644 --- a/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.sql +++ b/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.sql @@ -210,4 +210,9 @@ CREATE TABLE numeric_data ( decimal_number_with_default numeric(3,2) DEFAULT 2.78 ) +CREATE TABLE mixed_case_monkeys ( + [monkeyID] numeric(9,0) IDENTITY PRIMARY KEY, + [fleaCount] numeric(9,0) +); + go diff --git a/vendor/rails/activerecord/test/fixtures/tag.rb b/vendor/rails/activerecord/test/fixtures/tag.rb index c12ec0c1..a581b381 100644 --- a/vendor/rails/activerecord/test/fixtures/tag.rb +++ b/vendor/rails/activerecord/test/fixtures/tag.rb @@ -2,4 +2,6 @@ class Tag < ActiveRecord::Base has_many :taggings has_many :taggables, :through => :taggings has_one :tagging + + has_many :tagged_posts, :through => :taggings, :source => :taggable, :source_type => 'Post' end \ No newline at end of file diff --git a/vendor/rails/activerecord/test/fixtures/vertex.rb b/vendor/rails/activerecord/test/fixtures/vertex.rb index f4c11144..48bb851e 100644 --- a/vendor/rails/activerecord/test/fixtures/vertex.rb +++ b/vendor/rails/activerecord/test/fixtures/vertex.rb @@ -1,7 +1,7 @@ # This class models a vertex in a directed graph. class Vertex < ActiveRecord::Base has_many :sink_edges, :class_name => 'Edge', :foreign_key => 'source_id' - has_many :sinks, :through => :sink_edges, :source => :sink + has_many :sinks, :through => :sink_edges has_and_belongs_to_many :sources, :class_name => 'Vertex', :join_table => 'edges', diff --git a/vendor/rails/activerecord/test/pk_test.rb b/vendor/rails/activerecord/test/pk_test.rb index 604b2635..5eaa6c47 100644 --- a/vendor/rails/activerecord/test/pk_test.rb +++ b/vendor/rails/activerecord/test/pk_test.rb @@ -4,9 +4,10 @@ require 'fixtures/reply' require 'fixtures/subscriber' require 'fixtures/movie' require 'fixtures/keyboard' +require 'fixtures/mixed_case_monkey' class PrimaryKeysTest < Test::Unit::TestCase - fixtures :topics, :subscribers, :movies + fixtures :topics, :subscribers, :movies, :mixed_case_monkeys def test_integer_key topic = Topic.find(1) @@ -78,4 +79,26 @@ class PrimaryKeysTest < Test::Unit::TestCase Topic.reset_primary_key assert_equal "id", Topic.primary_key end + + def test_delete_should_quote_pkey + assert_nothing_raised { MixedCaseMonkey.delete(1) } + end + def test_increment_counter_should_quote_pkey_and_quote_counter_columns + assert_nothing_raised { MixedCaseMonkey.increment_counter(:fleaCount, 1) } + end + def test_decrement_counter_should_quote_pkey_and_quote_counter_columns + assert_nothing_raised { MixedCaseMonkey.decrement_counter(:fleaCount, 1) } + end + def test_find_with_one_id_should_quote_pkey + assert_nothing_raised { MixedCaseMonkey.find(1) } + end + def test_find_with_multiple_ids_should_quote_pkey + assert_nothing_raised { MixedCaseMonkey.find([1,2]) } + end + def test_instance_update_should_quote_pkey + assert_nothing_raised { MixedCaseMonkey.find(1).save } + end + def test_instance_destry_should_quote_pkey + assert_nothing_raised { MixedCaseMonkey.find(1).destroy } + end end diff --git a/vendor/rails/activesupport/CHANGELOG b/vendor/rails/activesupport/CHANGELOG index c5d35ff0..a0f79489 100644 --- a/vendor/rails/activesupport/CHANGELOG +++ b/vendor/rails/activesupport/CHANGELOG @@ -1,8 +1,16 @@ +*1.4.2* (March 12th, 2007) + +* Ruby 1.8.6 and 1.9 define private Time#to_date and #to_datetime; make them +public for compatibility. [Jeremy Kemper] + +* Deprecation: warn on stderr if RAILS_DEFAULT_LOGGER isn't set yet. [Jeremy Kemper] + + *1.4.1* (February 5th, 2007) -* Optimize Class Inheritable Attributes so that unnecessary hashes are not created. [Bruce Perens] +* Optimize Class Inheritable Attributes so that unnecessary hashes are not created. Closes #7472 [Bruce Perens] -* Added :instance_writer option to #mattr_writer/accessor, #cattr_writer/accessor, and #class_inheritable_writer to skip the creation of the instance writer. [Rick] +* Added :instance_writer option to #mattr_writer/accessor, #cattr_writer/accessor, and #class_inheritable_writer to skip the creation of the instance writer. [Rick] * Full test coverage for Inflector. #7228 [Dan Kubb] diff --git a/vendor/rails/activesupport/Rakefile b/vendor/rails/activesupport/Rakefile index 84e93079..03997a35 100644 --- a/vendor/rails/activesupport/Rakefile +++ b/vendor/rails/activesupport/Rakefile @@ -72,11 +72,11 @@ end desc "Publish the release files to RubyForge." task :release => [ :package ] do - `rubyforge login` + require 'rubyforge' - for ext in %w( gem tgz zip ) - release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" - puts release_command - system(release_command) - end -end + packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" } + + rubyforge = RubyForge.new + rubyforge.login + rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) +end \ No newline at end of file diff --git a/vendor/rails/activesupport/lib/active_support/core_ext/time.rb b/vendor/rails/activesupport/lib/active_support/core_ext/time.rb index 9e3c7a03..1e1819f7 100644 --- a/vendor/rails/activesupport/lib/active_support/core_ext/time.rb +++ b/vendor/rails/activesupport/lib/active_support/core_ext/time.rb @@ -1,3 +1,13 @@ +require 'date' +require 'time' + +# Ruby 1.8-cvs and 1.9 define private Time#to_date +class Time + %w(to_date to_datetime).each do |method| + public method if private_instance_methods.include?(method) + end +end + require File.dirname(__FILE__) + '/time/calculations' require File.dirname(__FILE__) + '/time/conversions' diff --git a/vendor/rails/activesupport/lib/active_support/core_ext/time/conversions.rb b/vendor/rails/activesupport/lib/active_support/core_ext/time/conversions.rb index c141d082..a4bd77cb 100644 --- a/vendor/rails/activesupport/lib/active_support/core_ext/time/conversions.rb +++ b/vendor/rails/activesupport/lib/active_support/core_ext/time/conversions.rb @@ -1,6 +1,3 @@ -require 'date' -require 'time' - module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Time #:nodoc: diff --git a/vendor/rails/activesupport/lib/active_support/deprecation.rb b/vendor/rails/activesupport/lib/active_support/deprecation.rb index d2c61274..8499ad6e 100644 --- a/vendor/rails/activesupport/lib/active_support/deprecation.rb +++ b/vendor/rails/activesupport/lib/active_support/deprecation.rb @@ -13,8 +13,9 @@ module ActiveSupport $stderr.puts callstack.join("\n ") if debug }, 'development' => Proc.new { |message, callstack| - RAILS_DEFAULT_LOGGER.warn message - RAILS_DEFAULT_LOGGER.debug callstack.join("\n ") if debug + logger = defined?(::RAILS_DEFAULT_LOGGER) ? ::RAILS_DEFAULT_LOGGER : Logger.new($stderr) + logger.warn message + logger.debug callstack.join("\n ") if debug } } diff --git a/vendor/rails/activesupport/lib/active_support/version.rb b/vendor/rails/activesupport/lib/active_support/version.rb index 84c34c15..d254873f 100644 --- a/vendor/rails/activesupport/lib/active_support/version.rb +++ b/vendor/rails/activesupport/lib/active_support/version.rb @@ -2,7 +2,7 @@ module ActiveSupport module VERSION #:nodoc: MAJOR = 1 MINOR = 4 - TINY = 1 + TINY = 2 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/railties/CHANGELOG b/vendor/rails/railties/CHANGELOG index 3722f46f..1d2e1435 100644 --- a/vendor/rails/railties/CHANGELOG +++ b/vendor/rails/railties/CHANGELOG @@ -1,3 +1,12 @@ +*1.2.3* (March 12th, 2007) + +* Ruby 1.8.6 compatibility + +* Windows: include MinGW in RUBY_PLATFORM check. #2982 [okkez000@gmail.com, Kaspar Schiess] + +* Stop swallowing errors during rake test [Koz] + + *1.2.2* (February 5th, 2007) * Fix gem deprecation warnings, which also means depending on RubyGems 0.9.0+ [Chad Fowler] diff --git a/vendor/rails/railties/Rakefile b/vendor/rails/railties/Rakefile index 1d6d08ba..e2a9c90c 100644 --- a/vendor/rails/railties/Rakefile +++ b/vendor/rails/railties/Rakefile @@ -287,12 +287,12 @@ spec = Gem::Specification.new do |s| on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates. EOF - s.add_dependency('rake', '>= 0.7.1') - s.add_dependency('activesupport', '= 1.4.1' + PKG_BUILD) - s.add_dependency('activerecord', '= 1.15.2' + PKG_BUILD) - s.add_dependency('actionpack', '= 1.13.2' + PKG_BUILD) - s.add_dependency('actionmailer', '= 1.3.2' + PKG_BUILD) - s.add_dependency('actionwebservice', '= 1.2.2' + PKG_BUILD) + s.add_dependency('rake', '>= 0.7.2') + s.add_dependency('activesupport', '= 1.4.2' + PKG_BUILD) + s.add_dependency('activerecord', '= 1.15.3' + PKG_BUILD) + s.add_dependency('actionpack', '= 1.13.3' + PKG_BUILD) + s.add_dependency('actionmailer', '= 1.3.3' + PKG_BUILD) + s.add_dependency('actionwebservice', '= 1.2.3' + PKG_BUILD) s.rdoc_options << '--exclude' << '.' s.has_rdoc = false @@ -323,9 +323,12 @@ task :pgem => [:gem] do end desc "Publish the release files to RubyForge." -task :release => [ :gem ] do - `rubyforge login` - release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.gem" - puts release_command - system(release_command) -end +task :release => [ :package ] do + require 'rubyforge' + + packages = %w( gem ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" } + + rubyforge = RubyForge.new + rubyforge.login + rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) +end \ No newline at end of file diff --git a/vendor/rails/railties/environments/boot.rb b/vendor/rails/railties/environments/boot.rb index 1e2a6418..b7af0c35 100644 --- a/vendor/rails/railties/environments/boot.rb +++ b/vendor/rails/railties/environments/boot.rb @@ -3,7 +3,7 @@ unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') - unless RUBY_PLATFORM =~ /mswin32/ + unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end @@ -42,4 +42,4 @@ unless defined?(Rails::Initializer) end Rails::Initializer.run(:set_load_path) -end \ No newline at end of file +end diff --git a/vendor/rails/railties/lib/commands/console.rb b/vendor/rails/railties/lib/commands/console.rb index 8b35a8d2..79d065a4 100644 --- a/vendor/rails/railties/lib/commands/console.rb +++ b/vendor/rails/railties/lib/commands/console.rb @@ -1,4 +1,4 @@ -irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb' +irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' require 'optparse' options = { :sandbox => false, :irb => irb } diff --git a/vendor/rails/railties/lib/commands/plugin.rb b/vendor/rails/railties/lib/commands/plugin.rb index 48f22664..af231975 100644 --- a/vendor/rails/railties/lib/commands/plugin.rb +++ b/vendor/rails/railties/lib/commands/plugin.rb @@ -240,11 +240,12 @@ class Plugin def install_using_http(options = {}) root = rails_env.root mkdir_p "#{root}/vendor/plugins" - Dir.chdir "#{root}/vendor/plugins" - puts "fetching from '#{uri}'" if $verbose - fetcher = RecursiveHTTPFetcher.new(uri) - fetcher.quiet = true if options[:quiet] - fetcher.fetch + Dir.chdir "#{root}/vendor/plugins" do + puts "fetching from '#{uri}'" if $verbose + fetcher = RecursiveHTTPFetcher.new(uri) + fetcher.quiet = true if options[:quiet] + fetcher.fetch + end end def svn_command(cmd, options = {}) diff --git a/vendor/rails/railties/lib/commands/process/inspector.rb b/vendor/rails/railties/lib/commands/process/inspector.rb index 79e1cf9a..8a6437e7 100644 --- a/vendor/rails/railties/lib/commands/process/inspector.rb +++ b/vendor/rails/railties/lib/commands/process/inspector.rb @@ -1,6 +1,6 @@ require 'optparse' -if RUBY_PLATFORM =~ /mswin32/ then abort("Inspector is only for Unix") end +if RUBY_PLATFORM =~ /(:?mswin|mingw)/ then abort("Inspector is only for Unix") end OPTIONS = { :pid_path => File.expand_path(RAILS_ROOT + '/tmp/pids'), @@ -65,4 +65,4 @@ ARGV.options do |opts| opts.parse! end -Inspector.inspect(OPTIONS[:pid_path], OPTIONS[:pattern]) \ No newline at end of file +Inspector.inspect(OPTIONS[:pid_path], OPTIONS[:pattern]) diff --git a/vendor/rails/railties/lib/commands/process/reaper.rb b/vendor/rails/railties/lib/commands/process/reaper.rb index 4402b57f..95175d41 100644 --- a/vendor/rails/railties/lib/commands/process/reaper.rb +++ b/vendor/rails/railties/lib/commands/process/reaper.rb @@ -2,7 +2,7 @@ require 'optparse' require 'net/http' require 'uri' -if RUBY_PLATFORM =~ /mswin32/ then abort("Reaper is only for Unix") end +if RUBY_PLATFORM =~ /(:?mswin|mingw)/ then abort("Reaper is only for Unix") end class Killer class << self diff --git a/vendor/rails/railties/lib/commands/process/spawner.rb b/vendor/rails/railties/lib/commands/process/spawner.rb index c8ca1d04..0a34bd6e 100644 --- a/vendor/rails/railties/lib/commands/process/spawner.rb +++ b/vendor/rails/railties/lib/commands/process/spawner.rb @@ -92,7 +92,7 @@ server = case ARGV.first else if defined?(Mongrel) "mongrel" - elsif RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `spawn-fcgi -version` }.blank? && defined?(FCGI) + elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `spawn-fcgi -version` }.blank? && defined?(FCGI) "fcgi" end end @@ -206,4 +206,4 @@ if OPTIONS[:repeat] end else spawner_class.spawn_all -end \ No newline at end of file +end diff --git a/vendor/rails/railties/lib/commands/server.rb b/vendor/rails/railties/lib/commands/server.rb index 23ad9de3..f84db9c0 100644 --- a/vendor/rails/railties/lib/commands/server.rb +++ b/vendor/rails/railties/lib/commands/server.rb @@ -19,7 +19,7 @@ server = case ARGV.first else if defined?(Mongrel) "mongrel" - elsif RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI) + elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI) "lighttpd" else "webrick" diff --git a/vendor/rails/railties/lib/rails/version.rb b/vendor/rails/railties/lib/rails/version.rb index 6b760cad..b6bd4205 100644 --- a/vendor/rails/railties/lib/rails/version.rb +++ b/vendor/rails/railties/lib/rails/version.rb @@ -2,7 +2,7 @@ module Rails module VERSION #:nodoc: MAJOR = 1 MINOR = 2 - TINY = 2 + TINY = 3 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb index 584aa0cd..f6cb82f1 100644 --- a/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -109,7 +109,7 @@ class AppGenerator < Rails::Generator::Base end def mysql_socket_location - RUBY_PLATFORM =~ /mswin32/ ? MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } : nil + MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ end diff --git a/vendor/rails/railties/lib/tasks/testing.rake b/vendor/rails/railties/lib/tasks/testing.rake index 4f0292c8..51847115 100644 --- a/vendor/rails/railties/lib/tasks/testing.rake +++ b/vendor/rails/railties/lib/tasks/testing.rake @@ -30,7 +30,7 @@ end module Kernel def silence_stderr old_stderr = STDERR.dup - STDERR.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null') + STDERR.reopen(RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'NUL:' : '/dev/null') STDERR.sync = true yield ensure @@ -40,14 +40,17 @@ end desc 'Test all units and functionals' task :test do - Rake::Task["test:units"].invoke rescue got_error = true - Rake::Task["test:functionals"].invoke rescue got_error = true + exceptions = ["test:units", "test:functionals", "test:integration"].collect do |task| + begin + Rake::Task[task].invoke + nil + rescue => e + e + end + end.compact - if File.exist?("test/integration") - Rake::Task["test:integration"].invoke rescue got_error = true - end - - raise "Test failures" if got_error + exceptions.each {|e| puts e;puts e.backtrace } + raise "Test failures" unless exceptions.empty? end namespace :test do