'
-
- assert_no_rjs :replace, 'person_45', /person_46/
- end
-
- assert_raises(Test::Unit::AssertionFailedError) { assert_no_rjs :replace, 'person_45' }
- assert_raises(Test::Unit::AssertionFailedError) { assert_no_rjs :replace, 'person_45', /person_45/ }
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :replace, 'person_46' }
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :replace, 'person_45', 'bad stuff' }
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :replace, 'person_45', /not there/}
- end
-
- def test_replace_html
- get :replace_html
-
- assert_nothing_raised do
- # No content matching
- assert_rjs :replace_html, 'person_45'
- # String content matching
- assert_rjs :replace_html, 'person_45', 'This goes inside person_45'
- # Regexp content matching
- assert_rjs :replace_html, 'person_45', /goes inside/
-
- assert_no_rjs :replace_html, 'person_46'
-
- assert_no_rjs :replace_html, 'person_45', /doesn't go inside/
- end
-
- assert_raises(Test::Unit::AssertionFailedError) { assert_no_rjs :replace_html, 'person_45' }
- assert_raises(Test::Unit::AssertionFailedError) { assert_no_rjs :replace_html, 'person_45', /goes/ }
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :replace_html, 'person_46' }
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :replace_html, 'person_45', /gos inside/ }
- end
-
- def test_show
- get :show
- assert_nothing_raised do
- assert_rjs :show, "post_1", "post_2", "post_3"
- assert_no_rjs :show, 'post_4'
- end
-
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :show, 'post_4' }
- assert_raises(Test::Unit::AssertionFailedError) do
- assert_no_rjs :show, "post_1", "post_2", "post_3"
- end
- end
-
- def test_sortable
- get :sortable
- assert_nothing_raised do
- assert_rjs :sortable, 'sortable_item'
- assert_no_rjs :sortable, 'non-sortable-item'
- end
-
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :sortable, 'non-sortable-item' }
- assert_raises(Test::Unit::AssertionFailedError) { assert_no_rjs :sortable, 'sortable_item' }
- end
-
- def test_toggle
- get :toggle
- assert_nothing_raised do
- assert_rjs :toggle, "post_1", "post_2", "post_3"
- assert_no_rjs :toggle, 'post_4'
- end
-
- assert_raises(Test::Unit::AssertionFailedError) { assert_rjs :toggle, 'post_4' }
- assert_raises(Test::Unit::AssertionFailedError) do
- assert_no_rjs :toggle, "post_1", "post_2", "post_3"
- end
- end
-
- def test_visual_effect
- get :visual_effect
- assert_nothing_raised do
- assert_rjs :visual_effect, :highlight, "posts", :duration => '1.0'
- assert_no_rjs :visual_effect, :highlight, "lists"
- end
-
- assert_raises(Test::Unit::AssertionFailedError) do
- assert_rjs :visual_effect, :highlight, "lists"
- end
-
- assert_raises(Test::Unit::AssertionFailedError) do
- assert_no_rjs :visual_effect, :highlight, "posts", :duration => '1.0'
- end
- end
-
- # [] support
-
- def test_page_with_one_chained_method
- get :page_with_one_chained_method
- assert_nothing_raised do
- assert_rjs :page, 'some_id', :toggle
- assert_no_rjs :page, 'some_other_id', :toggle
- end
-
- assert_raises(Test::Unit::AssertionFailedError) do
- assert_rjs :page, 'some_other_id', :toggle
- assert_no_rjs :page, 'some_id', :toggle
- end
- end
-
- def test_page_with_assignment
- get :page_with_assignment
-
- assert_nothing_raised do
- assert_rjs :page, 'some_id', :style, :color=, 'red'
- assert_no_rjs :page, 'some_id', :color=, 'red'
- end
-
- assert_raises(Test::Unit::AssertionFailedError) do
- assert_no_rjs :page, 'some_id', :style, :color=, 'red'
- assert_rjs :page, 'some_other_id', :style, :color=, 'red'
- end
- end
-end
diff --git a/tracks/vendor/plugins/extra_validations/init.rb b/tracks/vendor/plugins/extra_validations/init.rb
deleted file mode 100644
index 17709ad4..00000000
--- a/tracks/vendor/plugins/extra_validations/init.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'extra_validations'
-ActiveRecord::Base.extend ExtraValidations
\ No newline at end of file
diff --git a/tracks/vendor/plugins/extra_validations/lib/extra_validations.rb b/tracks/vendor/plugins/extra_validations/lib/extra_validations.rb
deleted file mode 100644
index f5486e96..00000000
--- a/tracks/vendor/plugins/extra_validations/lib/extra_validations.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-module ExtraValidations
-
- # Validates the value of the specified attribute by checking for a forbidden string
- #
- # class Person < ActiveRecord::Base
- # validates_does_not_contain :first_name, :string => ','
- # end
- #
- # A string must be provided or else an exception will be raised.
- #
- # Configuration options:
- # * message - A custom error message (default is: "is invalid")
- # * string - The string to verify is not included (note: must be supplied!)
- # * on Specifies when this validation is active (default is :save, other options :create, :update)
- # * if - Specifies a method, proc or string to call to determine if the validation should
- # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The
- # method, proc or string should return or evaluate to a true or false value.
- def validates_does_not_contain(*attr_names)
- configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save, :string => nil }
- configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
-
- raise(ArgumentError, "A string must be supplied as the :string option of the configuration hash") unless configuration[:string].is_a?(String)
-
- validates_each(attr_names, configuration) do |record, attr_name, value|
- record.errors.add(attr_name, configuration[:message]) if value.to_s =~ Regexp.new(Regexp.escape(configuration[:string]))
- end
- end
-
-end
diff --git a/tracks/vendor/plugins/has_many_polymorphs/LICENSE b/tracks/vendor/plugins/has_many_polymorphs/LICENSE
deleted file mode 100644
index 90eec26b..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/LICENSE
+++ /dev/null
@@ -1,184 +0,0 @@
-Academic Free License (AFL) v. 3.0
-
-This Academic Free License (the "License") applies to any original work
-of authorship (the "Original Work") whose owner (the "Licensor") has
-placed the following licensing notice adjacent to the copyright notice
-for the Original Work:
-
-Licensed under the Academic Free License version 3.0
-
-1) Grant of Copyright License. Licensor grants You a worldwide,
-royalty-free, non-exclusive, sublicensable license, for the duration of
-the copyright, to do the following:
-
-a) to reproduce the Original Work in copies, either alone or as part of
-a collective work;
-
-b) to translate, adapt, alter, transform, modify, or arrange the
-Original Work, thereby creating derivative works ("Derivative Works")
-based upon the Original Work;
-
-c) to distribute or communicate copies of the Original Work and
-Derivative Works to the public, under any license of your choice that
-does not contradict the terms and conditions, including Licensor's
-reserved rights and remedies, in this Academic Free License;
-
-d) to perform the Original Work publicly; and
-
-e) to display the Original Work publicly.
-
-2) Grant of Patent License. Licensor grants You a worldwide,
-royalty-free, non-exclusive, sublicensable license, under patent claims
-owned or controlled by the Licensor that are embodied in the Original
-Work as furnished by the Licensor, for the duration of the patents, to
-make, use, sell, offer for sale, have made, and import the Original Work
-and Derivative Works.
-
-3) Grant of Source Code License. The term "Source Code" means the
-preferred form of the Original Work for making modifications to it and
-all available documentation describing how to modify the Original Work.
-Licensor agrees to provide a machine-readable copy of the Source Code of
-the Original Work along with each copy of the Original Work that
-Licensor distributes. Licensor reserves the right to satisfy this
-obligation by placing a machine-readable copy of the Source Code in an
-information repository reasonably calculated to permit inexpensive and
-convenient access by You for as long as Licensor continues to distribute
-the Original Work.
-
-4) Exclusions From License Grant. Neither the names of Licensor, nor the
-names of any contributors to the Original Work, nor any of their
-trademarks or service marks, may be used to endorse or promote products
-derived from this Original Work without express prior permission of the
-Licensor. Except as expressly stated herein, nothing in this License
-grants any license to Licensor's trademarks, copyrights, patents, trade
-secrets or any other intellectual property. No patent license is granted
-to make, use, sell, offer for sale, have made, or import embodiments of
-any patent claims other than the licensed claims defined in Section 2.
-No license is granted to the trademarks of Licensor even if such marks
-are included in the Original Work. Nothing in this License shall be
-interpreted to prohibit Licensor from licensing under terms different
-from this License any Original Work that Licensor otherwise would have a
-right to license.
-
-5) External Deployment. The term "External Deployment" means the use,
-distribution, or communication of the Original Work or Derivative Works
-in any way such that the Original Work or Derivative Works may be used
-by anyone other than You, whether those works are distributed or
-communicated to those persons or made available as an application
-intended for use over a network. As an express condition for the grants
-of license hereunder, You must treat any External Deployment by You of
-the Original Work or a Derivative Work as a distribution under section
-1(c).
-
-6) Attribution Rights. You must retain, in the Source Code of any
-Derivative Works that You create, all copyright, patent, or trademark
-notices from the Source Code of the Original Work, as well as any
-notices of licensing and any descriptive text identified therein as an
-"Attribution Notice." You must cause the Source Code for any Derivative
-Works that You create to carry a prominent Attribution Notice reasonably
-calculated to inform recipients that You have modified the Original
-Work.
-
-7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants
-that the copyright in and to the Original Work and the patent rights
-granted herein by Licensor are owned by the Licensor or are sublicensed
-to You under the terms of this License with the permission of the
-contributor(s) of those copyrights and patent rights. Except as
-expressly stated in the immediately preceding sentence, the Original
-Work is provided under this License on an "AS IS" BASIS and WITHOUT
-WARRANTY, either express or implied, including, without limitation, the
-warranties of non-infringement, merchantability or fitness for a
-particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
-WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential
-part of this License. No license to the Original Work is granted by this
-License except under this disclaimer.
-
-8) Limitation of Liability. Under no circumstances and under no legal
-theory, whether in tort (including negligence), contract, or otherwise,
-shall the Licensor be liable to anyone for any indirect, special,
-incidental, or consequential damages of any character arising as a
-result of this License or the use of the Original Work including,
-without limitation, damages for loss of goodwill, work stoppage,
-computer failure or malfunction, or any and all other commercial damages
-or losses. This limitation of liability shall not apply to the extent
-applicable law prohibits such limitation.
-
-9) Acceptance and Termination. If, at any time, You expressly assented
-to this License, that assent indicates your clear and irrevocable
-acceptance of this License and all of its terms and conditions. If You
-distribute or communicate copies of the Original Work or a Derivative
-Work, You must make a reasonable effort under the circumstances to
-obtain the express assent of recipients to the terms of this License.
-This License conditions your rights to undertake the activities listed
-in Section 1, including your right to create Derivative Works based upon
-the Original Work, and doing so without honoring these terms and
-conditions is prohibited by copyright law and international treaty.
-Nothing in this License is intended to affect copyright exceptions and
-limitations (including "fair use" or "fair dealing"). This License shall
-terminate immediately and You may no longer exercise any of the rights
-granted to You by this License upon your failure to honor the conditions
-in Section 1(c).
-
-10) Termination for Patent Action. This License shall terminate
-automatically and You may no longer exercise any of the rights granted
-to You by this License as of the date You commence an action, including
-a cross-claim or counterclaim, against Licensor or any licensee alleging
-that the Original Work infringes a patent. This termination provision
-shall not apply for an action alleging patent infringement by
-combinations of the Original Work with other software or hardware.
-
-11) Jurisdiction, Venue and Governing Law. Any action or suit relating
-to this License may be brought only in the courts of a jurisdiction
-wherein the Licensor resides or in which Licensor conducts its primary
-business, and under the laws of that jurisdiction excluding its
-conflict-of-law provisions. The application of the United Nations
-Convention on Contracts for the International Sale of Goods is expressly
-excluded. Any use of the Original Work outside the scope of this License
-or after its termination shall be subject to the requirements and
-penalties of copyright or patent law in the appropriate jurisdiction.
-This section shall survive the termination of this License.
-
-12) Attorneys' Fees. In any action to enforce the terms of this License
-or seeking damages relating thereto, the prevailing party shall be
-entitled to recover its costs and expenses, including, without
-limitation, reasonable attorneys' fees and costs incurred in connection
-with such action, including any appeal of such action. This section
-shall survive the termination of this License.
-
-13) Miscellaneous. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable.
-
-14) Definition of "You" in This License. "You" throughout this License,
-whether in upper or lower case, means an individual or a legal entity
-exercising rights under, and complying with all of the terms of, this
-License. For legal entities, "You" includes any entity that controls, is
-controlled by, or is under common control with you. For purposes of this
-definition, "control" means (i) the power, direct or indirect, to cause
-the direction or management of such entity, whether by contract or
-otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-15) Right to Use. You may use the Original Work in all ways not
-otherwise restricted or conditioned by this License or by law, and
-Licensor promises not to interfere with or be responsible for such uses
-by You.
-
-16) Modification of This License. This License is Copyright (c) 2005
-Lawrence Rosen. Permission is granted to copy, distribute, or
-communicate this License without modification. Nothing in this License
-permits You to modify this License as applied to the Original Work or to
-Derivative Works. However, You may modify the text of this License and
-copy, distribute or communicate your modified version (the "Modified
-License") and apply it to other original works of authorship subject to
-the following conditions: (i) You may not indicate in any way that your
-Modified License is the "Academic Free License" or "AFL" and you may not
-use those names in the name of your Modified License; (ii) You must
-replace the notice specified in the first paragraph above with the
-notice "Licensed under " or with a notice
-of your own that is not confusingly similar to the notice in this
-License; and (iii) You may not claim that your original works are open
-source software unless your Modified License has been approved by Open
-Source Initiative (OSI) and You comply with its license review and
-certification process.
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/README b/tracks/vendor/plugins/has_many_polymorphs/README
deleted file mode 100644
index 1cf509a6..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/README
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Self-referential, polymorphic has_many :through helper
-
-Copyright 2006 Evan Weaver (see the LICENSE file)
-
-"model :parent_class" may be required in some controllers or perhaps models in order for reloading to work properly, since the parent setup must be executed on the child every time the child class is reloaded.
-
-Usage and help:
-http://blog.evanweaver.com/articles/2006/06/02/has_many_polymorphs
-
-Also see the source code, although it's probably not going to be super helpful to you.
-
-Changelog:
-
-22. api change; prefix on methods is now singular when using :rename_individual_collections
-21. add configuration option to cache polymorphic classes in development mode
-20. collection methods (push, delete, clear) now on individual collections
-19.2. disjoint collection sides bugfix, don't raise on new records
-19.1. double classify bugfix
-19. large changes to properly support double polymorphism
-18.2. bugfix to make sure the type gets checked on doubly polymorphic parents
-18.1. bugfix for sqlite3 child attribute retrieval
-18. bugfix for instantiating attributes of namespaced models
-17.1. bugfix for double polymorphic relationships
-17. double polymorphic relationships (includes new API method)
-16. namespaced model support
-15. bugfix for postgres and mysql under 1.1.6; refactored tests (thanks hildofur); properly handles legacy table names set with set_table_name()
-14. sti support added (use the child class names, not the base class)
-13. bug regarding table names with underscores in SQL query fixed
-12.1. license change
-12. file_column bug fixed
-11. tests written; after_find and after_initialize now correctly called
-10. bugfix
-9. rollback
-8. SQL performance enhancements added
-7. rewrote singletons as full-fledged proxy class so that marshalling works (e.g. in the session)
-6. caching added
-5. fixed dependency reloading problem in development mode
-4. license change
-3. added :dependent support on the join table
-1-2. no changelog
-
-Known problems:
-
-1. Plugin's test fixtures do not load properly for non-edge postgres, invalidating the tests.
-2. quote_value() hack is stupid.
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/init.rb b/tracks/vendor/plugins/has_many_polymorphs/init.rb
deleted file mode 100644
index 55b471e4..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/init.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'has_many_polymorphs'
diff --git a/tracks/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb b/tracks/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb
deleted file mode 100644
index b11502cc..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb
+++ /dev/null
@@ -1,581 +0,0 @@
-
-# self-referential, polymorphic has_many :through plugin
-# http://blog.evanweaver.com/articles/2006/06/02/has_many_polymorphs
-# operates via magic dust, and courage
-
-if defined? Rails::Configuration
- class Rails::Configuration
- def has_many_polymorphs_cache_classes= *args
- ::ActiveRecord::Associations::ClassMethods.has_many_polymorphs_cache_classes = *args
- end
- end
-end
-
-module ActiveRecord
-
- if ENV['RAILS_ENV'] =~ /development|test/ and ENV['USER'] == 'eweaver'
- # enable this condition to get awesome association debugging
- # you will get a folder "generated_models" in the current dir containing valid Ruby files
- # explaining all ActiveRecord relationships set up by the plugin, as well as listing the
- # line in the plugin that made each particular macro call
- class << Base
- COLLECTION_METHODS = [:belongs_to, :has_many, :has_and_belongs_to_many, :has_one].each do |method_name|
- alias_method "original_#{method_name}".to_sym, method_name
- undef_method method_name
- end
-
- unless defined? GENERATED_CODE_DIR
- # automatic code generation for debugging... bitches
- GENERATED_CODE_DIR = "generated_models"
- system "rm -rf #{GENERATED_CODE_DIR}"
- Dir.mkdir GENERATED_CODE_DIR
-
- alias :original_method_missing :method_missing
- def method_missing(method_name, *args, &block)
- if COLLECTION_METHODS.include? method_name.to_sym
- Dir.chdir GENERATED_CODE_DIR do
- filename = "#{ActiveRecord::Associations::ClassMethods.demodulate(self.name.underscore)}.rb"
- contents = File.open(filename).read rescue "\nclass #{self.name}\n\nend\n"
- line = caller[1][/\:(\d+)\:/, 1]
- contents[-5..-5] = "\n #{method_name} #{args[0..-2].inspect[1..-2]},\n #{args[-1].inspect[1..-2].gsub(" :", "\n :").gsub("=>", " => ")}\n#{ block ? " #{block.inspect.sub(/\@.*\//, '@')}\n" : ""} # called from line #{line}\n\n"
- File.open(filename, "w") do |file|
- file.puts contents
- end
- end
- # doesn't handle blocks
- self.send("original_#{method_name}", *args, &block)
- else
- self.send(:original_method_missing, method_name, *args, &block)
- end
- end
- end
- end
-
- # and we want to track the reloader's shenanigans
- (::Dependencies.log_activity = true) rescue nil
- end
-
- module Associations
- module ClassMethods
- mattr_accessor :has_many_polymorphs_cache_classes
-
- def acts_as_double_polymorphic_join opts
- raise RuntimeError, "Couldn't understand #{opts.inspect} options in acts_as_double_polymorphic_join. Please only specify the two relationships and their member classes; there are no options to set. " unless opts.length == 2
-
- join_name = self.name.tableize.to_sym
- opts.each do |polymorphs, children|
- parent_hash_key = (opts.keys - [polymorphs]).first # parents are the entries in the _other_ children array
-
- begin
- parent_foreign_key = self.reflect_on_association(parent_hash_key.to_s.singularize.to_sym).primary_key_name
- rescue NoMethodError
- raise RuntimeError, "Couldn't find 'belongs_to' association for :#{parent_hash_key.to_s.singularize} in #{self.name}." unless parent_foreign_key
- end
-
- parents = opts[parent_hash_key]
- conflicts = (children & parents) # set intersection
- parents.each do |parent_name|
-
- parent_class = parent_name.to_s.classify.constantize
- reverse_polymorph = parent_hash_key.to_s.singularize
- polymorph = polymorphs.to_s.singularize
-
- parent_class.send(:has_many_polymorphs,
- polymorphs, {:double => true,
- :from => children,
- :as => parent_hash_key.to_s.singularize.to_sym,
- :through => join_name,
- :dependent => :destroy,
- :foreign_key => parent_foreign_key,
- :foreign_type_key => parent_foreign_key.to_s.sub(/_id$/, '_type'),
- :reverse_polymorph => reverse_polymorph,
- :conflicts => conflicts,
- :rename_individual_collections => false})
-
- if conflicts.include? parent_name
- # unify the alternate sides of the conflicting children
- (conflicts).each do |method_name|
- unless parent_class.instance_methods.include?(method_name)
- parent_class.send(:define_method, method_name) do
- (self.send("#{reverse_polymorph}_#{method_name}") +
- self.send("#{polymorph}_#{method_name}")).freeze
- end
- end
- end
-
- # unify the join model
- unless parent_class.instance_methods.include?(join_name)
- parent_class.send(:define_method, join_name) do
- (self.send("#{join_name}_as_#{reverse_polymorph}") +
- self.send("#{join_name}_as_#{polymorph}")).freeze
- end
- end
-
- end
- end
- end
- end
-
- def has_many_polymorphs(polymorphs, options, &block)
- options.assert_valid_keys(:from, :acts_as, :as, :through, :foreign_key, :dependent, :double,
- :rename_individual_collections, :foreign_type_key, :reverse_polymorph, :conflicts)
-
- # the way this deals with extra parameters to the associations could use some work
- options[:as] ||= options[:acts_as] ||= self.table_name.singularize.to_sym
-
- # foreign keys follow the table name, not the class name in Rails 2.0
- options[:foreign_key] ||= "#{options[:as].to_s}_id"
-
- # no conflicts by default
- options[:conflicts] ||= []
-
- # construct the join table name
- options[:through] ||= join_table((options[:as].to_s.pluralize or self.table_name), polymorphs)
- if options[:reverse_polymorph]
- options[:through_with_reverse_polymorph] = "#{options[:through]}_as_#{options[:reverse_polymorph]}".to_sym
- else
- options[:through_with_reverse_polymorph] = options[:through]
- end
-
- options[:join_class_name] ||= options[:through].to_s.classify
-
- # the class must have_many on the join_table
- opts = {:foreign_key => options[:foreign_key], :dependent => options[:dependent],
- :class_name => options[:join_class_name]}
- if options[:foreign_type_key]
- opts[:conditions] = "#{options[:foreign_type_key]} = #{quote_value self.base_class.name}"
- end
-
- has_many demodulate(options[:through_with_reverse_polymorph]), opts
-
- polymorph = polymorphs.to_s.singularize.to_sym
-
- # add the base_class method to the join_table so that STI will work transparently
- inject_before_save_into_join_table(options[:join_class_name], polymorph)
-
- # get some reusable info
- children, child_associations = {}, {}
- options[:from].each do |child_plural|
- children[child_plural] = child_plural.to_s.singularize.to_sym
- child_associations[child_plural] = (options[:rename_individual_collections] ? "#{polymorph}_#{child_plural}".to_sym : child_plural)
- end
-
- # get our models out of the reloadable lists, if requested
- if self.has_many_polymorphs_cache_classes
- klasses = [self.name, options[:join_class_name], *children.values.map{|x| x.to_s.classify}]
- klasses += basify_sti_classnames(klasses).keys.to_a.compact.uniq.map{|x| x.to_s.classify}
- klasses.uniq!
- klasses.each {|s| logger.debug "Ejecting #{s.inspect} from the autoload lists"}
- begin
- Dependencies.autoloaded_constants -= klasses
- Dependencies.explicitly_unloadable_constants -= klasses
- rescue NoMethodError
- raise "Rails 1.2.0 or later is required to set config.has_many_polymorphs_cache_classes = true"
- end
- end
-
- # auto-inject individually named associations for the children into the join model
- create_virtual_associations_for_join_to_individual_children(children, polymorph, options)
-
- # iterate through the polymorphic children, running the parent class's :has_many on each one
- create_has_many_through_associations_for_parent_to_children(children, child_associations, polymorphs, polymorph, options)
-
- # auto-inject the regular polymorphic associations into the child classes
- create_has_many_through_associations_for_children_to_parent(children, polymorph, options)
-
- create_general_collection_association_for_parent(polymorphs, polymorph, basify_sti_classnames(children), options, &block)
- end
-
- def self.demodulate(s)
- s.to_s.gsub('/', '_').to_sym
- end
-
- protected
-
- def demodulate(s)
- ActiveRecord::Associations::ClassMethods.demodulate(s)
- end
-
- def basify_sti_classnames(hash)
- # this blows
- result = {}
- hash.each do |plural, singular|
- klass = plural.to_s.classify.constantize
- if klass != klass.base_class
- result[klass.base_class.table_name.to_sym] = klass.base_class.table_name.singularize.to_sym
- else
- result[plural] = singular
- end
- end
- result
- end
-
- def inject_before_save_into_join_table(join_class_name, polymorph)
- sti_hook = "sti_class_rewrite"
- rewrite_procedure = %[
- self.send(:#{polymorph}_type=, self.#{polymorph}_type.constantize.base_class.name)
- ]
-
- # this also blows, and should be abstracted. alias_method_chain is not enough.
- join_class_name.constantize.class_eval %[
- unless instance_methods.include? "before_save_with_#{sti_hook}"
- if instance_methods.include? "before_save"
- alias_method :before_save_without_#{sti_hook}, :before_save
- def before_save_with_#{sti_hook}
- before_save_without_#{sti_hook}
- #{rewrite_procedure}
- end
- else
- def before_save_with_#{sti_hook}
- #{rewrite_procedure}
- end
- end
- alias_method :before_save, :before_save_with_#{sti_hook}
- end
- ]
-
- end
-
- def create_virtual_associations_for_join_to_individual_children(children, polymorph, options)
- children.each do |child_plural, child|
- options[:join_class_name].constantize.instance_eval do
-
- association_name = child.to_s
- association_name += "_as_#{polymorph}" if options[:conflicts].include?(child_plural)
- association = demodulate(association_name)
-
- opts = {:class_name => child.to_s.classify,
- :foreign_key => "#{polymorph}_id" }
-
- unless self.reflect_on_all_associations.map(&:name).include? association
- belongs_to association, opts
- end
-
- end
- end
- end
-
- def create_has_many_through_associations_for_children_to_parent(children, polymorph, options)
- children.each do |child_plural, child|
-
- if child == options[:as]
- raise RuntimeError, "You can't have a self-referential polymorphic has_many :through without renaming the non-polymorphic foreign key in the join model."
- end
-
- parent = self
- child.to_s.classify.constantize.instance_eval do
-
- # this shouldn't be called at all during doubles; there is no way to traverse to a
- # double polymorphic parent (XXX is that right?)
- unless options[:double] or options[:conflicts].include? self.name.tableize.to_sym
- begin
- require_dependency parent.name.underscore # XXX why is this here?
- rescue MissingSourceFile
- end
-
- # the join table
- through = demodulate(options[:through_with_reverse_polymorph]).to_s
- through += "_as_child" if parent == self
- through = through.to_sym
-
- has_many through, :as => polymorph,
- :class_name => options[:through].to_s.classify,
- :dependent => options[:dependent]
-
- association = options[:as].to_s.pluralize
- association += "_of_#{polymorph.to_s.pluralize}" if options[:rename_individual_collections] # XXX check this
-
- # the polymorphic parent association
- has_many association.to_sym, :through => through,
- :class_name => parent.name,
- :source => options[:as],
- :foreign_key => options[:foreign_key]
- end
-
- end
- end
- end
-
- def create_has_many_through_associations_for_parent_to_children(children, child_associations, polymorphs, polymorph, options)
- children.each do |child_plural, child|
- #puts ":source => #{child}"
- association = demodulate(child_associations[child_plural]).to_s
- source = demodulate(child).to_s
-
- if options[:conflicts].include? child_plural
- # XXX what?
- association = "#{polymorph}_#{association}" if options[:conflicts].include? self.name.tableize.to_sym
- source += "_as_#{polymorph}"
- end
-
- # activerecord is broken when you try to anonymously extend an association in a namespaced model,
- extension = self.class_eval %[
- module #{association.classify + "AssociationExtension"}
- def push *args
- proxy_owner.send(:#{polymorphs}).send(:push, *args).select{|x| x.is_a? #{child.to_s.classify}}
- end
- alias :<< :push
- def delete *args
- proxy_owner.send(:#{polymorphs}).send(:delete, *args)
- end
- def clear
- proxy_owner.send(:#{polymorphs}).send(:clear, #{child.to_s.classify})
- end
- self # required
- end]
-
- has_many association.to_sym, :through => demodulate(options[:through_with_reverse_polymorph]),
- :source => source.to_sym,
- :conditions => ["#{options[:join_class_name].constantize.table_name}.#{polymorph}_type = ?", child.to_s.classify.constantize.base_class.name],
- :extend => extension
-
- end
- end
-
- def create_general_collection_association_for_parent(collection_name, polymorph, children, options, &block)
- # we need to explicitly rename all the columns because we are fetching all the children objects at once.
- # if multiple objects have a 'title' column, for instance, there will be a collision and we will potentially
- # lose data. if we alias the fields and then break them up later, there are no collisions.
- join_model = options[:through].to_s.classify.constantize
-
- # figure out what fields we wanna grab
- select_fields = []
- children.each do |plural, singular|
- klass = plural.to_s.classify.constantize
- klass.columns.map(&:name).each do |name|
- select_fields << "#{klass.table_name}.#{name} as #{demodulate plural}_#{name}"
- end
- end
-
- # now get the join model fields
- join_model.columns.map(&:name).each do |name|
- select_fields << "#{join_model.table_name}.#{name} as #{join_model.table_name}_#{name}"
- end
-
- from_table = self.table_name
- left_joins = children.keys.map do |n|
- klass = n.to_s.classify.constantize
- "LEFT JOIN #{klass.table_name} ON #{join_model.table_name}.#{polymorph}_id = #{klass.table_name}.#{klass.primary_key} AND #{join_model.table_name}.#{polymorph}_type = '#{n.to_s.classify}'"
- end
-
- sql_query = 'SELECT ' + select_fields.join(', ') + " FROM #{join_model.table_name}" +
- "\nJOIN #{from_table} as polymorphic_parent ON #{join_model.table_name}.#{options[:foreign_key]} = polymorphic_parent.#{self.primary_key}\n" +
- left_joins.join("\n") + "\nWHERE "
-
- if options[:foreign_type_key]
- sql_query +="#{join_model.table_name}.#{options[:foreign_type_key]} = #{quote_value self.base_class.name} AND "
- end
-
- # for sqlite3 you have to reference the left-most table in WHERE clauses or rows with NULL
- # join results sometimes get silently dropped. it's stupid.
- sql_query += "#{join_model.table_name}.#{options[:foreign_key]} "
- #puts("Built collection property query:\n #{sql_query}")
-
- class_eval do
- attr_accessor "#{collection_name}_cache"
- cattr_accessor "#{collection_name}_options"
-
- define_method(collection_name) do
- if collection_name_cache = instance_variable_get("@#{collection_name}_cache")
- #puts("Cache hit on #{collection_name}")
- collection_name_cache
- else
- #puts("Cache miss on #{collection_name}")
- rows = connection.select_all("#{sql_query}" + (new_record? ? "IS NULL" : "= #{self.id}"))
- # this gives us a hash with keys for each object type
- objectified = objectify_polymorphic_array(rows, "#{join_model}", "#{polymorph}_type")
- # locally cache the different object types found
- # this doesn't work... yet.
- objectified.each do |key, array|
- instance_variable_set("@#{ActiveRecord::Associations::ClassMethods.demodulate(key)}", array)
- end
- proxy_object = HasManyPolymorphsProxyCollection.new(objectified[:all], self, send("#{collection_name}_options"))
- (class << proxy_object; self end).send(:class_eval, &block) if block_given?
- instance_variable_set("@#{collection_name}_cache", proxy_object)
- end
- end
-
- # in order not to break tests, see if we have been defined already
- unless instance_methods.include? "reload_with_#{collection_name}"
- define_method("reload_with_#{collection_name}") do
- send("reload_without_#{collection_name}")
- instance_variable_set("@#{collection_name}_cache", nil)
- self
- end
-
- alias_method "reload_without_#{collection_name}", :reload
- alias_method :reload, "reload_with_#{collection_name}"
- end
- end
-
- send("#{collection_name}_options=",
- options.merge(:collection_name => collection_name,
- :type_key => "#{polymorph}_type",
- :id_key => "#{polymorph}_id"))
-
-# puts("Defined the collection proxy.\n#{collection_name}\n")
- end
-
- def join_table(a, b)
- [a.to_s, b.to_s].sort.join("_").to_sym
- end
-
- unless self.respond_to? :quote_value
- # hack it in (very badly) for Rails 1.1.6 people
- def quote_value s
- "'#{s.inspect[1..-2]}'"
- end
- end
-
- end
-
- ################################################
-
- # decided to leave this alone unless it becomes clear that there is some benefit
- # in deriving from AssociationProxy
- #
- # the benefit would be custom finders on the collection, perhaps...
- class HasManyPolymorphsProxyCollection < Array
-
- alias :array_delete :delete
- alias :array_push :push
- alias :count :length
-
- def initialize(contents, parent, options)
- @parent = parent
- @options = options
- @join_class = options[:join_class_name].constantize
- return if contents.blank?
- super(contents)
- end
-
- def push(objs, args={})
- objs = [objs] unless objs.is_a? Array
-
- objs.each do |obj|
- data = {@options[:foreign_key] => @parent.id,
- @options[:type_key] => obj.class.base_class.to_s, @options[:id_key] => obj.id}
- data.merge!({@options[:foreign_type_key] => @parent.class.base_class.to_s}) if @options[:foreign_type_key] # for double polymorphs
- conditions_string = data.keys.map(&:to_s).push("").join(" = ? AND ")[0..-6]
- if @join_class.find(:first, :conditions => [conditions_string] + data.values).blank?
- @join_class.new(data).save!
- end
- end
-
- if args[:reload]
- reload
- else
- # we have to do this funky stuff instead of just array difference because +/.uniq returns a regular array,
- # which doesn't have our special methods and configuration anymore
- unless (difference = objs - collection).blank?
- @parent.send("#{@options[:collection_name]}_cache=".to_sym, collection.array_push(*difference))
- end
- end
-
- @parent.send(@options[:collection_name])
- end
-
- alias :<< :push
-
- def delete(objs, args={})
-
- if objs
- objs = [objs] unless objs.is_a? Array
- elsif args[:clear]
- objs = collection
- objs = objs.select{|obj| obj.is_a? args[:klass]} if args[:klass]
- else
- raise RuntimeError, "Invalid delete parameters (has_many_polymorphs)."
- end
-
- records = []
- objs.each do |obj|
- records += join_records.select do |record|
- record.send(@options[:type_key]) == obj.class.base_class.to_s and
- record.send(@options[:id_key]) == obj.id
- end
- end
-
- reload if args[:reload]
- unless records.blank?
- records.map(&:destroy)
- # XXX could be faster if we reversed the loops
- deleted_items = collection.select do |item|
- records.select {|join_record|
- join_record.send(@options[:type_key]) == item.class.base_class.name and
- join_record.send(@options[:id_key]) == item.id
- }.length > 0
- end
- # keep the cache fresh, while we're at it. see comment in .push
- deleted_items.each { |item| collection.array_delete(item) }
- @parent.send("#{@options[:collection_name]}_cache=", collection)
-
- return deleted_items unless deleted_items.empty?
- end
- nil
- end
-
- def clear(klass = nil)
- result = delete(nil, :clear => true, :klass => klass)
- return result if result
- collection
- end
-
- def reload
- # reset the cache, postponing reloading from the db until we really need it
- @parent.reload
- end
-
- private
- def join_records
- @parent.send(ActiveRecord::Associations::ClassMethods.demodulate(@options[:through]))
- end
-
- def collection
- @parent.send(@options[:collection_name])
- end
-
- end
- end
-
-
- class Base
- # turns an array of hashes (db rows) into a hash consisting of :all (array of everything) and
- # a hash key for each class type it finds, e.g. :posts and :comments
- private
- def objectify_polymorphic_array(array, join_model, type_field)
- join_model = join_model.constantize
- arrays_hash = {}
-
- array.each do |element|
- klass = element["#{join_model.table_name}_#{type_field}"].constantize
- association = ActiveRecord::Associations::ClassMethods.demodulate(klass.name.pluralize.underscore.downcase)
- hash = {}
-
-# puts "Class #{klass.inspect}"
-# puts "Association name: #{association.inspect}"
-
- element.each do |key, value|
-# puts "key #{key} - value #{value.inspect}"
- if key =~ /^#{association}_(.+)/
- hash[$1] = value
-# puts "#{$1.inspect} assigned #{value.inspect}"
- end
- end
-
- object = klass.instantiate(hash)
-
- arrays_hash[:all] ||= []
- arrays_hash[association] ||= []
- arrays_hash[:all] << object
- arrays_hash[association] << object
- end
-
- arrays_hash
- end
- end
-end
-
-#require 'ruby-debug'
-#Debugger.start
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/fish.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/fish.yml
deleted file mode 100644
index 713d9127..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/fish.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-swimmy:
- id: 1
- name: Swimmy
- speed: 10
-jaws:
- id: 2
- name: Jaws
- speed: 20
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/little_whale_pupils.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/little_whale_pupils.yml
deleted file mode 100644
index e69de29b..00000000
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/whales.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/whales.yml
deleted file mode 100644
index be296d47..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/aquatic/whales.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-shamu:
- id: 1
- name: Shamu
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/bow_wows.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/bow_wows.yml
deleted file mode 100644
index 81759008..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/bow_wows.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-rover:
- id: 1
- name: Rover
-spot:
- id: 2
- name: Spot
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/cats.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/cats.yml
deleted file mode 100644
index adf3ead7..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/cats.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-chloe:
- id: 1
- cat_type: Kitten
- name: Chloe
-alice:
- id: 2
- cat_type: Kitten
- name: Alice
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/eaters_foodstuffs.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/eaters_foodstuffs.yml
deleted file mode 100644
index e69de29b..00000000
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/frogs.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/frogs.yml
deleted file mode 100644
index 145700f4..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/frogs.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-froggy:
- id: 1
- name: Froggy
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/keep_your_enemies_close.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/keep_your_enemies_close.yml
deleted file mode 100644
index e69de29b..00000000
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/petfoods.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/petfoods.yml
deleted file mode 100644
index bb174ea8..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/petfoods.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-kibbles:
- the_petfood_primary_key: 1
- name: Kibbles
-bits:
- the_petfood_primary_key: 2
- name: Bits
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/wild_boars.yml b/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/wild_boars.yml
deleted file mode 100644
index 39f12b18..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/fixtures/wild_boars.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-puma:
- id: 1
- name: Puma
-jacrazy:
- id: 2
- name: Jacrazy
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/fish.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/fish.rb
deleted file mode 100644
index 21ca3afc..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/fish.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class Aquatic::Fish < ActiveRecord::Base
-# attr_accessor :after_find_test, :after_initialize_test
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/pupils_whale.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/pupils_whale.rb
deleted file mode 100644
index ae4cbc18..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/pupils_whale.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-
-class Aquatic::PupilsWhale < ActiveRecord::Base
- set_table_name "little_whale_pupils"
- belongs_to :whale, :class_name => "Aquatic::Whale", :foreign_key => "whale_id"
- belongs_to :aquatic_pupil, :polymorphic => true
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/whale.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/whale.rb
deleted file mode 100644
index 698ca6d4..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/aquatic/whale.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# see http://dev.rubyonrails.org/ticket/5935
-module Aquatic; end
-require 'aquatic/fish'
-require 'aquatic/pupils_whale'
-
-class Aquatic::Whale < ActiveRecord::Base
- has_many_polymorphs(:aquatic_pupils, :from => [:dogs, :"aquatic/fish"],
- :through => "aquatic/pupils_whales") do
- def blow; "result"; end
- end
-end
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/beautiful_fight_relationship.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/beautiful_fight_relationship.rb
deleted file mode 100644
index c1935b30..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/beautiful_fight_relationship.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-
-class BeautifulFightRelationship < ActiveRecord::Base
- set_table_name 'keep_your_enemies_close'
-
- belongs_to :enemy, :polymorphic => true
- belongs_to :protector, :polymorphic => true
- # polymorphic relationships with column names different from the relationship name
- # are not supported by Rails
-
- acts_as_double_polymorphic_join :enemies => [:dogs, :kittens, :frogs],
- :protectors => [:wild_boars, :kittens, :"aquatic/fish", :dogs]
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/cat.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/cat.rb
deleted file mode 100644
index 0c99ff08..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/cat.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class Cat < ActiveRecord::Base
- # STI base class
- self.inheritance_column = 'cat_type'
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/dog.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/dog.rb
deleted file mode 100644
index 6f2da737..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/dog.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Dog < ActiveRecord::Base
- attr_accessor :after_find_test, :after_initialize_test
-
- set_table_name "bow_wows"
-
- def after_find
- @after_find_test = true
-# puts "After find called on #{name}."
- end
-
- def after_initialize
- @after_initialize_test = true
- end
-
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/eaters_foodstuff.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/eaters_foodstuff.rb
deleted file mode 100644
index d904bb16..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/eaters_foodstuff.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-
-class EatersFoodstuff < ActiveRecord::Base
- belongs_to :foodstuff, :class_name => "Petfood", :foreign_key => "foodstuff_id"
- belongs_to :eater, :polymorphic => true
-
- def before_save
- self.some_attribute = 3
- end
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/frog.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/frog.rb
deleted file mode 100644
index 5a0f4658..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/frog.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class Frog < ActiveRecord::Base
-
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/kitten.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/kitten.rb
deleted file mode 100644
index 2a244c03..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/kitten.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class Kitten < Cat
-# has_many :eaters_parents, :dependent => true, :as => 'eater'
-end
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/petfood.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/petfood.rb
deleted file mode 100644
index fa8b0f91..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/petfood.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# see http://dev.rubyonrails.org/ticket/5935
-require 'eaters_foodstuff'
-require 'petfood'
-require 'cat'
-module Aquatic; end
-require 'aquatic/fish'
-require 'dog'
-require 'wild_boar'
-require 'kitten'
-require 'tabby'
-
-class Petfood < ActiveRecord::Base
- set_primary_key 'the_petfood_primary_key'
- has_many_polymorphs :eaters,
- :from => [:dogs, :petfoods, :wild_boars, :kittens,
- :tabbies, :"aquatic/fish"],
- :dependent => :destroy,
- :rename_individual_collections => true,
- :acts_as => :foodstuff,
- :foreign_key => "foodstuff_id"
-end
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/tabby.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/tabby.rb
deleted file mode 100644
index 3cd0f994..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/tabby.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class Tabby < Cat
-end
\ No newline at end of file
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/models/wild_boar.rb b/tracks/vendor/plugins/has_many_polymorphs/test/models/wild_boar.rb
deleted file mode 100644
index 27d36a53..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/models/wild_boar.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class WildBoar < ActiveRecord::Base
-end
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/schema.rb b/tracks/vendor/plugins/has_many_polymorphs/test/schema.rb
deleted file mode 100644
index 12123532..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/schema.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-ActiveRecord::Schema.define(:version => 0) do
- create_table :petfoods, :force => true, :primary_key => :the_petfood_primary_key do |t|
- t.column :name, :string
- end
-
- create_table :bow_wows, :force => true do |t|
- t.column :name, :string
- end
-
- create_table :cats, :force => true do |t|
- t.column :name, :string
- t.column :cat_type, :string
- end
-
- create_table :frogs, :force => true do |t|
- t.column :name, :string
- end
-
- create_table :wild_boars, :force => true do |t|
- t.column :name, :string
- end
-
- create_table :eaters_foodstuffs, :force => true do |t|
- t.column :foodstuff_id, :integer
- t.column :eater_id, :integer
- t.column :some_attribute, :integer, :default => 0
- t.column :eater_type, :string
- end
-
- create_table :fish, :force => true do |t|
- t.column :name, :string
- t.column :speed, :integer
- end
-
- create_table :whales, :force => true do |t|
- t.column :name, :string
- end
-
- create_table :little_whale_pupils, :force => true do |t|
- t.column :whale_id, :integer
- t.column :aquatic_pupil_id, :integer
- t.column :aquatic_pupil_type, :string
- end
-
- create_table :keep_your_enemies_close, :force => true do |t|
- t.column :enemy_id, :integer
- t.column :enemy_type, :string
- t.column :protector_id, :integer
- t.column :protector_type, :string
- end
-
-end
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/test_helper.rb b/tracks/vendor/plugins/has_many_polymorphs/test/test_helper.rb
deleted file mode 100644
index 712b6926..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/test_helper.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'pathname'
-# default test helper
-begin
- require File.dirname(__FILE__) + '/../../../../test/test_helper'
-rescue LoadError
- require '~/projects/miscellaneous/cookbook/test/test_helper'
-end
-
-Inflector.inflections {|i| i.irregular 'fish', 'fish' }
-
-# fixtures
-$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/")
-# models
-$LOAD_PATH.unshift("#{Pathname.new(__FILE__).dirname.to_s}/models")
-
-class Test::Unit::TestCase
- self.use_transactional_fixtures = true # must stay true for tests to run on postgres or sqlite3
- self.use_instantiated_fixtures = false
-end
-
-# test schema
-load(File.dirname(__FILE__) + "/schema.rb")
-
diff --git a/tracks/vendor/plugins/has_many_polymorphs/test/unit/polymorph_test.rb b/tracks/vendor/plugins/has_many_polymorphs/test/unit/polymorph_test.rb
deleted file mode 100644
index 750a9295..00000000
--- a/tracks/vendor/plugins/has_many_polymorphs/test/unit/polymorph_test.rb
+++ /dev/null
@@ -1,487 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class PolymorphTest < Test::Unit::TestCase
-
- fixtures :cats, :bow_wows, :frogs, :wild_boars, :eaters_foodstuffs, :petfoods,
- :"aquatic/fish", :"aquatic/whales", :"aquatic/little_whale_pupils",
- :keep_your_enemies_close
- require 'beautiful_fight_relationship'
-
- # to-do: finder queries on the collection
- # order-mask column on the join table for polymorphic order
- # rework load order so you could push and pop without ever loading the whole collection
- # so that limit works in a sane way
-
- def setup
- @kibbles = Petfood.find(1)
- @bits = Petfood.find(2)
- @shamu = Aquatic::Whale.find(1)
- @swimmy = Aquatic::Fish.find(1)
- @rover = Dog.find(1)
- @spot = Dog.find(2)
- @puma = WildBoar.find(1)
- @chloe = Kitten.find(1)
- @alice = Kitten.find(2)
- @froggy = Frog.find(1)
-
- @join_count = EatersFoodstuff.count
- @l = @kibbles.eaters.length
- @m = @bits.eaters.count
- end
-
- def test_all_relationship_validities
- # q = []
- # ObjectSpace.each_object(Class){|c| q << c if c.ancestors.include? ActiveRecord::Base }
- # q.each{|c| puts "#{c.name}.reflect_on_all_associations.map &:check_validity! "}
- Petfood.reflect_on_all_associations.map &:check_validity!
- Tabby.reflect_on_all_associations.map &:check_validity!
- Kitten.reflect_on_all_associations.map &:check_validity!
- Dog.reflect_on_all_associations.map &:check_validity!
- Aquatic::Fish.reflect_on_all_associations.map &:check_validity!
- EatersFoodstuff.reflect_on_all_associations.map &:check_validity!
- WildBoar.reflect_on_all_associations.map &:check_validity!
- Frog.reflect_on_all_associations.map &:check_validity!
- Aquatic::Whale.reflect_on_all_associations.map &:check_validity!
- Cat.reflect_on_all_associations.map &:check_validity!
- Aquatic::PupilsWhale.reflect_on_all_associations.map &:check_validity!
- BeautifulFightRelationship.reflect_on_all_associations.map &:check_validity!
- end
-
- def test_assignment
- assert @kibbles.eaters.blank?
- assert @kibbles.eaters.push(Cat.find_by_name('Chloe'))
- assert_equal @l += 1, @kibbles.eaters.count
-
- @kibbles.reload
- assert_equal @l, @kibbles.eaters.count
-
- end
-
- def test_duplicate_assignment
- # try to add a duplicate item
- @kibbles.eaters.push(@alice)
- assert @kibbles.eaters.include?(@alice)
- @kibbles.eaters.push(@alice)
- assert_equal @l + 1, @kibbles.eaters.count
- assert_equal @join_count + 1, EatersFoodstuff.count
-
- @kibbles.reload
- assert_equal @l + 1, @kibbles.eaters.count
- assert_equal @join_count + 1, EatersFoodstuff.count
- end
-
- def test_create_and_push
- assert @kibbles.eaters.push(@spot)
- assert_equal @l += 1, @kibbles.eaters.count
- assert @kibbles.eaters << @rover
- assert @kibbles.eaters << Kitten.create(:name => "Miranda")
- assert_equal @l += 2, @kibbles.eaters.length
-
- @kibbles.reload
- assert_equal @l, @kibbles.eaters.length
-
- # test that ids and new flags were set appropriately
- assert_not_nil @kibbles.eaters[0].id
- assert !@kibbles.eaters[1].new_record?
- end
-
- def test_reload
- assert @kibbles.reload
- assert @kibbles.eaters.reload
- end
-
- def test_add_join_record
- assert_equal Kitten, @chloe.class
- assert @join_record = EatersFoodstuff.new(:foodstuff_id => @bits.id, :eater_id => @chloe.id, :eater_type => @chloe.class.name )
- assert @join_record.save!
- assert @join_record.id
- assert_equal @join_count + 1, EatersFoodstuff.count
-
- # has the parent changed if we don't reload?
- assert_equal @m, @bits.eaters.count
-
- # if we do reload, is the new association there?
- # XXX no, because TestCase breaks reload. it works fine in the app.
-
- assert_equal Petfood, @bits.eaters.reload.class
- assert_equal @m + 1, @bits.eaters.count
- assert @bits.eaters.include?(@chloe)
-
-# puts "XXX #{EatersFoodstuff.count}"
-
- end
-
- def test_add_unsaved
- # add an unsaved item
- assert @bits.eaters << Kitten.new(:name => "Bridget")
- assert_nil Kitten.find_by_name("Bridget")
- assert_equal @m + 1, @bits.eaters.count
-
- assert @bits.save
- @bits.reload
- assert_equal @m + 1, @bits.eaters.count
-
- end
-
- def test_self_reference
- assert @kibbles.eaters << @bits
- assert_equal @l += 1, @kibbles.eaters.count
- assert @kibbles.eaters.include?(@bits)
- @kibbles.reload
- assert @kibbles.foodstuffs_of_eaters.blank?
-
- @bits.reload
- assert @bits.foodstuffs_of_eaters.include?(@kibbles)
- assert_equal [@kibbles], @bits.foodstuffs_of_eaters
- end
-
- def test_remove
- assert @kibbles.eaters << @chloe
- @kibbles.reload
- assert @kibbles.eaters.delete(@kibbles.eaters[0])
- assert_equal @l, @kibbles.eaters.count
- end
-
- def test_destroy
- assert @kibbles.eaters.push(@chloe)
- @kibbles.reload
- assert @kibbles.eaters.length > 0
- assert @kibbles.eaters[0].destroy
- @kibbles.reload
- assert_equal @l, @kibbles.eaters.count
- end
-
- def test_clear
- @kibbles.eaters << [@chloe, @spot, @rover]
- @kibbles.reload
- assert_equal 3, @kibbles.eaters.clear.size
- assert @kibbles.eaters.blank?
- @kibbles.reload
- assert @kibbles.eaters.blank?
- assert_equal 0, @kibbles.eaters.clear.size
- end
-
- def test_individual_collections
- assert @kibbles.eaters.push(@chloe)
- # check if individual collections work
- assert_equal @kibbles.eater_kittens.length, 1
- assert @kibbles.eater_dogs
- assert 1, @rover.eaters_foodstuffs.count
- end
-
- def test_invididual_collections_push
- assert_equal [@chloe], (@kibbles.eater_kittens << @chloe)
- @kibbles.reload
- assert @kibbles.eaters.include?(@chloe)
- assert @kibbles.eater_kittens.include?(@chloe)
- assert !@kibbles.eater_dogs.include?(@chloe)
- end
-
- def test_invididual_collections_delete
- @kibbles.eaters << [@chloe, @spot, @rover]
- @kibbles.reload
- assert_equal [@chloe], @kibbles.eater_kittens.delete(@chloe)
- assert @kibbles.eater_kittens.empty?
- assert !@kibbles.eater_kittens.delete(@chloe)
-
- @kibbles.reload
- assert @kibbles.eater_kittens.empty?
- assert @kibbles.eater_dogs.include?(@spot)
- end
-
- def test_invididual_collections_clear
- @kibbles.eaters << [@chloe, @spot, @rover]
- @kibbles.reload
- assert_equal [@chloe], @kibbles.eater_kittens.clear
- assert @kibbles.eater_kittens.empty?
- assert_equal 2, @kibbles.eaters.size
- @kibbles.reload
- assert @kibbles.eater_kittens.empty?
- assert_equal 2, @kibbles.eaters.size
- assert !@kibbles.eater_kittens.include?(@chloe)
- assert !@kibbles.eaters.include?(@chloe)
- end
-
- def test_childrens_individual_collections
- assert Cat.find_by_name('Chloe').eaters_foodstuffs
- assert @kibbles.eaters_foodstuffs
- end
-
- def test_self_referential_join_tables
- # check that the self-reference join tables go the right ways
- assert_equal @l, @kibbles.eaters_foodstuffs.count
- assert_equal @kibbles.eaters_foodstuffs.count, @kibbles.eaters_foodstuffs_as_child.count
- end
-
- def test_dependent
- assert @kibbles.eaters << @chloe
- @kibbles.reload
-
- # delete ourself and see if :dependent was obeyed
- dependent_rows = @kibbles.eaters_foodstuffs
- assert_equal dependent_rows.length, @kibbles.eaters.count
- @join_count = EatersFoodstuff.count
-
- @kibbles.destroy
- assert_equal @join_count - dependent_rows.length, EatersFoodstuff.count
- assert_equal 0, EatersFoodstuff.find(:all, :conditions => ['foodstuff_id = ?', 1] ).length
- end
-
- def test_normal_callbacks
- assert @rover.respond_to?(:after_initialize)
- assert @rover.respond_to?(:after_find)
-
- assert @rover.after_initialize_test
- assert @rover.after_find_test
- end
-
- def test_our_callbacks
- assert 0, @bits.eaters.count
- assert @bits.eaters.push(@rover)
- @bits.save
-
-# puts "Testing callbacks."
- @bits2 = Petfood.find_by_name("Bits")
- @bits.reload
-
- assert rover = @bits2.eaters.select { |x| x.name == "Rover" }[0]
- assert rover.after_initialize_test
- assert rover.after_find_test
-# puts "Done."
-
- end
-
- def test_number_of_join_records
- assert EatersFoodstuff.create(:foodstuff_id => 1, :eater_id => 1, :eater_type => "Cat")
- @join_count = EatersFoodstuff.count
- assert @join_count > 0
- end
-
- def test_number_of_regular_records
- dogs = Dog.count
- assert Dog.new(:name => "Auggie").save!
- assert dogs + 1, Dog.count
- end
-
- def test_attributes_come_through_when_child_has_underscore_in_table_name
- @join_record = EatersFoodstuff.new(:foodstuff_id => @bits.id, :eater_id => @puma.id, :eater_type => @puma.class.name)
- @join_record.save!
- @bits.eaters.reload
-
- assert_equal 'Puma', @puma.name
- assert_equal 'Puma', @bits.eaters.first.name
- end
-
- def test_before_save_on_join_table_is_not_clobbered_by_sti_base_class_fix
- assert @kibbles.eaters << @chloe
- assert_equal 3, @kibbles.eaters_foodstuffs.first.some_attribute
- end
-
- def test_creating_namespaced_relationship
- assert @shamu.aquatic_pupils.empty?
- @shamu.aquatic_pupils << @swimmy
- assert_equal 1, @shamu.aquatic_pupils.length
- @shamu.reload
- assert_equal 1, @shamu.aquatic_pupils.length
- end
-
-
- def test_namespaced_polymorphic_collection
- @shamu.aquatic_pupils << @swimmy
- assert @shamu.aquatic_pupils.include?(@swimmy)
- @shamu.reload
- assert @shamu.aquatic_pupils.include?(@swimmy)
-
- @shamu.aquatic_pupils << @spot
- assert @shamu.dogs.include?(@spot)
- assert @shamu.aquatic_pupils.include?(@swimmy)
- assert_equal @swimmy, @shamu.aquatic_fish.first
- assert_equal 10, @shamu.aquatic_fish.first.speed
- end
-
- def test_deleting_namespaced_relationship
- @shamu.aquatic_pupils << @swimmy
- @shamu.aquatic_pupils << @spot
-
- @shamu.reload
- @shamu.aquatic_pupils.delete @spot
- assert !@shamu.dogs.include?(@spot)
- assert !@shamu.aquatic_pupils.include?(@spot)
- assert_equal 1, @shamu.aquatic_pupils.length
- end
-
- def test_unrenamed_parent_of_namespaced_child
- @shamu.aquatic_pupils << @swimmy
- assert_equal [@shamu], @swimmy.whales
- end
-
- def test_empty_double_collections
- assert @puma.enemies.empty?
- assert @froggy.protectors.empty?
- assert @alice.enemies.empty?
- assert @spot.protectors.empty?
- assert @alice.beautiful_fight_relationships_as_enemy.empty?
- assert @alice.beautiful_fight_relationships_as_protector.empty?
- assert @alice.beautiful_fight_relationships.empty?
- end
-
- def test_double_collection_assignment
- @alice.enemies << @spot
- @alice.reload
- @spot.reload
- assert @spot.protectors.include?(@alice)
- assert @alice.enemies.include?(@spot)
- assert !@alice.protectors.include?(@alice)
- assert_equal 1, @alice.beautiful_fight_relationships_as_protector.size
- assert_equal 0, @alice.beautiful_fight_relationships_as_enemy.size
- assert_equal 1, @alice.beautiful_fight_relationships.size
-
- # self reference
- assert_equal 1, @alice.enemies.length
- @alice.enemies.push @alice
- assert @alice.enemies.include?(@alice)
- assert_equal 2, @alice.enemies.length
- @alice.reload
- assert_equal 2, @alice.beautiful_fight_relationships_as_protector.size
- assert_equal 1, @alice.beautiful_fight_relationships_as_enemy.size
- assert_equal 3, @alice.beautiful_fight_relationships.size
- end
-
- def test_double_collection_deletion
- @alice.enemies << @spot
- @alice.reload
- assert @alice.enemies.include?(@spot)
- @alice.enemies.delete(@spot)
- assert !@alice.enemies.include?(@spot)
- assert @alice.enemies.empty?
- @alice.reload
- assert !@alice.enemies.include?(@spot)
- assert @alice.enemies.empty?
- assert_equal 0, @alice.beautiful_fight_relationships.size
- end
-
- def test_double_collection_deletion_from_opposite_side
- @alice.protectors << @puma
- @alice.reload
- assert @alice.protectors.include?(@puma)
- @alice.protectors.delete(@puma)
- assert !@alice.protectors.include?(@puma)
- assert @alice.protectors.empty?
- @alice.reload
- assert !@alice.protectors.include?(@puma)
- assert @alice.protectors.empty?
- assert_equal 0, @alice.beautiful_fight_relationships.size
- end
-
- def test_individual_collections_created_for_double_relationship
- assert @alice.dogs.empty?
- @alice.enemies << @spot
-
- assert @alice.enemies.include?(@spot)
- assert !@alice.kittens.include?(@alice)
-
- assert !@alice.dogs.include?(@spot)
- @alice.reload
- assert @alice.dogs.include?(@spot)
- assert !WildBoar.find(@alice.id).dogs.include?(@spot) # make sure the parent type is checked
- end
-
- def test_individual_collections_created_for_double_relationship_from_opposite_side
- assert @alice.wild_boars.empty?
- @alice.protectors << @puma
-
- assert @alice.protectors.include?(@puma)
- assert !@alice.wild_boars.include?(@puma)
- @alice.reload
- assert @alice.wild_boars.include?(@puma)
-
- assert !Dog.find(@alice.id).wild_boars.include?(@puma) # make sure the parent type is checked
- end
-
- def test_self_referential_individual_collections_created_for_double_relationship
- @alice.enemies << @alice
- @alice.reload
- assert @alice.enemy_kittens.include?(@alice)
- assert @alice.protector_kittens.include?(@alice)
- assert @alice.kittens.include?(@alice)
- assert_equal 2, @alice.kittens.size
-
- @alice.enemies << (@chloe = Kitten.find_by_name('Chloe'))
- @alice.reload
- assert @alice.enemy_kittens.include?(@chloe)
- assert !@alice.protector_kittens.include?(@chloe)
- assert @alice.kittens.include?(@chloe)
- assert_equal 3, @alice.kittens.size
- end
-
- def test_child_of_polymorphic_join_can_reach_parent
- @alice.enemies << @spot
- @alice.reload
- assert @spot.protectors.include?(@alice)
- end
-
- def test_double_collection_deletion_from_child_polymorphic_join
- @alice.enemies << @spot
- @spot.protectors.delete(@alice)
- assert !@spot.protectors.include?(@alice)
- @alice.reload
- assert !@alice.enemies.include?(@spot)
- BeautifulFightRelationship.create(:protector_id => 2, :protector_type => "Dog", :enemy_id => @spot.id, :enemy_type => @spot.class.name)
- @alice.enemies << @spot
- @spot.protectors.delete(@alice)
- assert !@spot.protectors.include?(@alice)
- end
-
- def test_hmp_passed_block_manipulates_proxy_class
- assert_equal "result", @shamu.aquatic_pupils.blow
- assert_raises(NoMethodError) { @kibbles.eaters.blow }
- end
-
- def test_collection_query_on_unsaved_record
- assert Dog.new.enemies.empty?
- assert Dog.new.foodstuffs_of_eaters.empty?
- end
-
- def test_double_invididual_collections_push
- assert_equal [@chloe], (@spot.protector_kittens << @chloe)
- @spot.reload
- assert @spot.protectors.include?(@chloe)
- assert @spot.protector_kittens.include?(@chloe)
- assert !@spot.protector_dogs.include?(@chloe)
-
- assert_equal [@froggy], (@spot.frogs << @froggy)
- @spot.reload
- assert @spot.enemies.include?(@froggy)
- assert @spot.frogs.include?(@froggy)
- assert !@spot.enemy_dogs.include?(@froggy)
- end
-
- def test_double_invididual_collections_delete
- @spot.protectors << [@chloe, @puma]
- @spot.reload
- assert_equal [@chloe], @spot.protector_kittens.delete(@chloe)
- assert @spot.protector_kittens.empty?
- assert !@spot.protector_kittens.delete(@chloe)
-
- @spot.reload
- assert @spot.protector_kittens.empty?
- assert @spot.wild_boars.include?(@puma)
- end
-
- def test_double_invididual_collections_clear
- @spot.protectors << [@chloe, @puma, @alice]
- @spot.reload
- assert_equal [@chloe, @alice], @spot.protector_kittens.clear.sort_by(&:id)
- assert @spot.protector_kittens.empty?
- assert_equal 1, @spot.protectors.size
- @spot.reload
- assert @spot.protector_kittens.empty?
- assert_equal 1, @spot.protectors.size
- assert !@spot.protector_kittens.include?(@chloe)
- assert !@spot.protectors.include?(@chloe)
- assert !@spot.protector_kittens.include?(@alice)
- assert !@spot.protectors.include?(@alice)
- end
-
-
-end
diff --git a/tracks/vendor/plugins/memory_test_fix/README b/tracks/vendor/plugins/memory_test_fix/README
deleted file mode 100644
index 7972efdd..00000000
--- a/tracks/vendor/plugins/memory_test_fix/README
+++ /dev/null
@@ -1,35 +0,0 @@
-MemoryTestFix
-=============
-
-A simple fix to run tests with sqlite. From example at
-
-http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
-
-In your database.yml, use
-
- test:
- adapter: sqlite3
- database: ":memory:"
-
-It runs much faster!
-
-You can also adjust the verbosity of the output:
-
-test:
- adapter: sqlite3
- database: ":memory:"
- verbosity: silent
-
-== Authors
-
-Chris Roos
-
-Adapted by Geoffrey Grosenbach, http://nubyonrails.com
-
-Verbosity patch by Kakutani Shintaro
-
-== Changelog
-
-* Updated to look for either so it works with Rails 1.2 and also older versions
-* Updated to use ActiveRecord::ConnectionAdapters::SQLite3Adapter for Rails 1.2
-
diff --git a/tracks/vendor/plugins/memory_test_fix/Rakefile b/tracks/vendor/plugins/memory_test_fix/Rakefile
deleted file mode 100644
index 1ca2d969..00000000
--- a/tracks/vendor/plugins/memory_test_fix/Rakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the memory_test_fix plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the memory_test_fix plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'MemoryTestFix'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/tracks/vendor/plugins/memory_test_fix/about.yml b/tracks/vendor/plugins/memory_test_fix/about.yml
deleted file mode 100644
index d11ce0a9..00000000
--- a/tracks/vendor/plugins/memory_test_fix/about.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-author: Chris Roos
-summary: Makes SQLite3 memory tests possible by preloading the schema.
-homepage: http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
-plugin: http://topfunky.net/svn/plugins/memory_test_fix
-license: MIT
-version: 0.1
-rails_version: 1.1+
diff --git a/tracks/vendor/plugins/memory_test_fix/init.rb b/tracks/vendor/plugins/memory_test_fix/init.rb
deleted file mode 100644
index 838b8bb6..00000000
--- a/tracks/vendor/plugins/memory_test_fix/init.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-
-require 'memory_test_fix'
diff --git a/tracks/vendor/plugins/memory_test_fix/lib/memory_test_fix.rb b/tracks/vendor/plugins/memory_test_fix/lib/memory_test_fix.rb
deleted file mode 100644
index 05e17b8c..00000000
--- a/tracks/vendor/plugins/memory_test_fix/lib/memory_test_fix.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# Update: Looks for the SQLite and SQLite3 adapters for
-# compatibility with Rails 1.2.2 and also older versions.
-def in_memory_database?
- if ENV["RAILS_ENV"] == "test" and Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
- begin
- if ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter
- return true
- end
- rescue NameError => e
- if ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLiteAdapter
- return true
- end
- end
- end
- false
-end
-
-def verbosity
- Rails::Configuration.new.database_configuration['test']['verbosity']
-end
-
-def inform_using_in_memory
- puts "Creating sqlite :memory: database"
-end
-
-if in_memory_database?
- load_schema = lambda {
- #load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
- ActiveRecord::Migrator.up('db/migrate') # use migrations
- }
- case verbosity
- when "silent"
- silence_stream(STDOUT, &load_schema)
- when "quiet"
- inform_using_in_memory
- silence_stream(STDOUT, &load_schema)
- else
- inform_using_in_memory
- load_schema.call
- end
-end
diff --git a/tracks/vendor/plugins/selenium-on-rails/LICENSE-2.0.txt b/tracks/vendor/plugins/openid_consumer_plugin/LICENSE
similarity index 100%
rename from tracks/vendor/plugins/selenium-on-rails/LICENSE-2.0.txt
rename to tracks/vendor/plugins/openid_consumer_plugin/LICENSE
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/README b/tracks/vendor/plugins/openid_consumer_plugin/README
new file mode 100644
index 00000000..a5a01bfd
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/README
@@ -0,0 +1,22 @@
+OpenID Consumer
+===============
+
+Enable OpenID authentication and profile exchange from your application.
+
+PRE-REQUISITES
+--------------
+
+* JanRain's Yadis and OpenID 1.2 libraries in Ruby.
+ * These can be obtained using 'gem install ruby-openid'
+
+
+INSTALLATION
+------------
+
+To install you need to create a migration and add a controller.
+
+ ./script/generate open_id_migration add_open_id_tables
+ ./script/generate open_id_consumer_controller open_id
+
+This can be used well in conjunction with a login system such as ActsAsAuthenticated
+
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/Rakefile b/tracks/vendor/plugins/openid_consumer_plugin/Rakefile
new file mode 100644
index 00000000..79ede457
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/Rakefile
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the open_id_consumer plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the open_id_consumer plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'OpenIdConsumer'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/open_id_consumer_controller_generator.rb b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/open_id_consumer_controller_generator.rb
new file mode 100644
index 00000000..ad63aaaa
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/open_id_consumer_controller_generator.rb
@@ -0,0 +1,86 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class OpenIdConsumerControllerGenerator < Rails::Generator::NamedBase
+ attr_reader :controller_name,
+ :controller_class_path,
+ :controller_file_path,
+ :controller_class_nesting,
+ :controller_class_nesting_depth,
+ :controller_class_name,
+ :controller_singular_name,
+ :controller_plural_name
+ alias_method :controller_file_name, :controller_singular_name
+ alias_method :controller_table_name, :controller_plural_name
+
+ def initialize(runtime_args, runtime_options = {})
+ runtime_args << 'open_id' if runtime_args.empty?
+ super
+
+ # Take controller name from the next argument. Default to the pluralized model name.
+ @controller_name = args.shift
+ @controller_name ||= ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name
+
+ base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
+ @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name)
+
+ if @controller_class_nesting.empty?
+ @controller_class_name = @controller_class_name_without_nesting
+ else
+ @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
+ end
+ end
+
+ def manifest
+ record do |m|
+ # Check for class naming collisions.
+ m.class_collisions controller_class_path, "#{controller_class_name}Controller",
+ "#{controller_class_name}Helper"
+
+ # Controller, helper, views, and test directories.
+ m.directory File.join('app/controllers', controller_class_path)
+ m.directory File.join('app/helpers', controller_class_path)
+ m.directory File.join('app/views', controller_class_path, controller_file_name)
+ m.directory File.join('test/functional', controller_class_path)
+
+ m.template 'controller.rb',
+ File.join('app/controllers',
+ controller_class_path,
+ "#{controller_file_name}_controller.rb")
+
+ m.template 'functional_test.rb',
+ File.join('test/functional',
+ controller_class_path,
+ "#{controller_file_name}_controller_test.rb")
+
+ m.template 'helper.rb',
+ File.join('app/helpers',
+ controller_class_path,
+ "#{controller_file_name}_helper.rb")
+
+ # Controller templates
+ m.template "index.rhtml",
+ File.join('app/views', controller_class_path, controller_file_name, "index.rhtml")
+ end
+ end
+
+ protected
+ # Override with your own usage banner.
+ def banner
+ "Usage: #{$0} open_id_consumer_controller [open_id]"
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/controller.rb b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/controller.rb
new file mode 100644
index 00000000..50717e3d
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/controller.rb
@@ -0,0 +1,74 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class <%= controller_class_name %>Controller < ApplicationController
+ open_id_consumer :required => [:email, :nickname], :optional => [:fullname, :dob, :gender, :country]
+
+ def index
+ @title = 'Welcome'
+ end
+
+ def begin
+ # If the URL was unusable (either because of network conditions,
+ # a server error, or that the response returned was not an OpenID
+ # identity page), the library will return HTTP_FAILURE or PARSE_ERROR.
+ # Let the user know that the URL is unusable.
+ case open_id_response.status
+ when OpenID::SUCCESS
+ # The URL was a valid identity URL. Now we just need to send a redirect
+ # to the server using the redirect_url the library created for us.
+
+ # redirect to the server
+ redirect_to open_id_response.redirect_url((request.protocol + request.host_with_port + '/'), url_for(:action => 'complete'))
+ else
+ flash[:error] = "Unable to find openid server for #{params[:openid_url]}"
+ render :action => :index
+ end
+ end
+
+ def complete
+ case open_id_response.status
+ when OpenID::FAILURE
+ # In the case of failure, if info is non-nil, it is the
+ # URL that we were verifying. We include it in the error
+ # message to help the user figure out what happened.
+ if open_id_response.identity_url
+ flash[:message] = "Verification of #{open_id_response.identity_url} failed. "
+ else
+ flash[:message] = "Verification failed. "
+ end
+ flash[:message] += open_id_response.msg.to_s
+
+ when OpenID::SUCCESS
+ # Success means that the transaction completed without
+ # error. If info is nil, it means that the user cancelled
+ # the verification.
+ flash[:message] = "You have successfully verified #{open_id_response.identity_url} as your identity."
+ if open_id_fields.any?
+ flash[:message] << " With simple registration fields: "
+ open_id_fields.each {|k,v| flash[:message] << " #{k}: #{v}"}
+ end
+
+ when OpenID::CANCEL
+ flash[:message] = "Verification cancelled."
+
+ else
+ flash[:message] = "Unknown response status: #{open_id_response.status}"
+ end
+ redirect_to :action => 'index'
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/functional_test.rb b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/functional_test.rb
new file mode 100644
index 00000000..c787b010
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/functional_test.rb
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+require File.dirname(__FILE__) + '/../test_helper'
+require '<%= controller_file_name %>_controller'
+
+# Re-raise errors caught by the controller.
+class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end
+
+class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
+ def setup
+ @controller = <%= controller_class_name %>Controller.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ def test_truth
+ assert true
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/helper.rb b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/helper.rb
new file mode 100644
index 00000000..1c518a5c
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/helper.rb
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+module <%= controller_class_name %>Helper
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/index.rhtml b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/index.rhtml
new file mode 100644
index 00000000..4f7d22e0
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_consumer_controller/templates/index.rhtml
@@ -0,0 +1,32 @@
+<% # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+%>
+
+
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_migration/open_id_migration_generator.rb b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_migration/open_id_migration_generator.rb
new file mode 100644
index 00000000..f9cd2e99
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_migration/open_id_migration_generator.rb
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class OpenIdMigrationGenerator < Rails::Generator::NamedBase
+ def initialize(runtime_args, runtime_options = {})
+ runtime_args << 'add_open_id_tables' if runtime_args.empty?
+ super
+ end
+
+ def manifest
+ record do |m|
+ m.migration_template 'migration.rb', 'db/migrate'
+ end
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_migration/templates/migration.rb b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_migration/templates/migration.rb
new file mode 100644
index 00000000..d7569bd5
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/generators/open_id_migration/templates/migration.rb
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class <%= class_name %> < ActiveRecord::Migration
+ def self.up
+ create_table "open_id_associations", :force => true do |t|
+ t.column "server_url", :binary
+ t.column "handle", :string
+ t.column "secret", :binary
+ t.column "issued", :integer
+ t.column "lifetime", :integer
+ t.column "assoc_type", :string
+ end
+
+ create_table "open_id_nonces", :force => true do |t|
+ t.column "nonce", :string
+ t.column "created", :integer
+ end
+
+ create_table "open_id_settings", :force => true do |t|
+ t.column "setting", :string
+ t.column "value", :binary
+ end
+ end
+
+ def self.down
+ drop_table "open_id_associations"
+ drop_table "open_id_nonces"
+ drop_table "open_id_settings"
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/init.rb b/tracks/vendor/plugins/openid_consumer_plugin/init.rb
new file mode 100644
index 00000000..d3d8f53e
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/init.rb
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class << ActionController::Base
+ def open_id_consumer(options = {})
+ include OpenIdConsumer::ControllerMethods
+ self.open_id_consumer_options = options
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/install.rb b/tracks/vendor/plugins/openid_consumer_plugin/install.rb
new file mode 100644
index 00000000..ba7dcb48
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/install.rb
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+puts IO.read(File.join(File.dirname(__FILE__), 'README'))
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/active_record_open_id_store.rb b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/active_record_open_id_store.rb
new file mode 100644
index 00000000..9b7bfbe0
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/active_record_open_id_store.rb
@@ -0,0 +1,103 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+begin
+ require_gem "ruby-openid", ">= 1.0"
+rescue LoadError
+ require "openid"
+end
+
+module OpenIdConsumer
+ class ActiveRecordOpenIdStore < OpenID::Store
+ def get_auth_key
+ setting = Setting.find_by_setting 'auth_key'
+ if setting.nil?
+ auth_key = OpenID::Util.random_string(20)
+ setting = Setting.create :setting => 'auth_key', :value => auth_key
+ end
+ setting.value
+ end
+
+ def store_association(server_url, assoc)
+ remove_association(server_url, assoc.handle)
+ Association.create(:server_url => server_url,
+ :handle => assoc.handle,
+ :secret => assoc.secret,
+ :issued => assoc.issued,
+ :lifetime => assoc.lifetime,
+ :assoc_type => assoc.assoc_type)
+ end
+
+ def get_association(server_url, handle=nil)
+ assocs = handle.blank? ?
+ Association.find_all_by_server_url(server_url) :
+ Association.find_all_by_server_url_and_handle(server_url, handle)
+
+ assocs.reverse.each do |assoc|
+ a = assoc.from_record
+ if a.expired?
+ assoc.destroy
+ else
+ return a
+ end
+ end if assocs.any?
+
+ return nil
+ end
+
+ def remove_association(server_url, handle)
+ assoc = Association.find_by_server_url_and_handle(server_url, handle)
+ unless assoc.nil?
+ assoc.destroy
+ return true
+ end
+ false
+ end
+
+ def store_nonce(nonce)
+ use_nonce(nonce)
+ Nonce.create :nonce => nonce, :created => Time.now.to_i
+ end
+
+ def use_nonce(nonce)
+ nonce = Nonce.find_by_nonce(nonce)
+ return false if nonce.nil?
+
+ age = Time.now.to_i - nonce.created
+ nonce.destroy
+
+ age < 6.hours # max nonce age of 6 hours
+ end
+
+ def dumb?
+ false
+ end
+
+ # not part of the api, but useful
+ def gc
+ now = Time.now.to_i
+
+ # remove old nonces
+ nonces = Nonce.find(:all)
+ nonces.each {|n| n.destroy if now - n.created > 6.hours} unless nonces.nil?
+
+ # remove expired assocs
+ assocs = Association.find(:all)
+ assocs.each { |a| a.destroy if a.from_record.expired? } unless assocs.nil?
+ end
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/association.rb b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/association.rb
new file mode 100644
index 00000000..9d09ec47
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/association.rb
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+begin
+ require_gem "ruby-openid", ">= 1.0"
+rescue LoadError
+ require "openid"
+end
+
+module OpenIdConsumer
+ class Association < ActiveRecord::Base
+ set_table_name 'open_id_associations'
+ def from_record
+ OpenID::Association.new(handle, secret, issued, lifetime, assoc_type)
+ end
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/controller_methods.rb b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/controller_methods.rb
new file mode 100644
index 00000000..9a61aec9
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/controller_methods.rb
@@ -0,0 +1,69 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+begin
+ require_gem "ruby-openid", ">= 1.0"
+rescue LoadError
+ require "openid"
+end
+
+module OpenIdConsumer
+ module ControllerMethods
+ def self.included(controller)
+ controller.class_eval do
+ verify :method => :post, :only => :begin, :params => :openid_url, :redirect_to => { :action => 'index' },
+ :add_flash => { :error => "Enter an Identity URL to verify." }
+ verify :method => :get, :only => :complete, :redirect_to => { :action => 'index' }
+ before_filter :begin_open_id_auth, :only => :begin
+ before_filter :complete_open_id_auth, :only => :complete
+ attr_reader :open_id_response
+ attr_reader :open_id_fields
+ cattr_accessor :open_id_consumer_options
+ end
+ end
+
+ protected
+ def open_id_consumer
+ @open_id_consumer ||= OpenID::Consumer.new(
+ session[:openid_session] ||= {},
+ ActiveRecordOpenIdStore.new)
+ end
+
+ def begin_open_id_auth
+ @open_id_response = open_id_consumer.begin(params[:openid_url])
+ add_sreg_params!(@open_id_response) if @open_id_response.status == OpenID::SUCCESS
+ end
+
+ def complete_open_id_auth
+ @open_id_response = open_id_consumer.complete(params)
+ return unless open_id_response.status == OpenID::SUCCESS
+
+ @open_id_fields = open_id_response.extension_response('sreg')
+ logger.debug "***************** sreg params ***************"
+ logger.debug @open_id_fields.inspect
+ logger.debug "***************** sreg params ***************"
+ end
+
+ def add_sreg_params!(openid_response)
+ open_id_consumer_options.keys.inject({}) do |params, key|
+ value = open_id_consumer_options[key]
+ value = value.collect { |v| v.to_s.strip } * ',' if value.respond_to?(:collect)
+ openid_response.add_extension_arg('sreg', key.to_s, value.to_s)
+ end
+ end
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/nonce.rb b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/nonce.rb
new file mode 100644
index 00000000..67a7893d
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/nonce.rb
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+module OpenIdConsumer
+ class Nonce < ActiveRecord::Base
+ set_table_name 'open_id_nonces'
+ end
+end
diff --git a/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/setting.rb b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/setting.rb
new file mode 100644
index 00000000..6616dd6e
--- /dev/null
+++ b/tracks/vendor/plugins/openid_consumer_plugin/lib/open_id_consumer/setting.rb
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+module OpenIdConsumer
+ class Setting < ActiveRecord::Base
+ set_table_name 'open_id_settings'
+ end
+end
diff --git a/tracks/vendor/plugins/resource_feeder/README b/tracks/vendor/plugins/resource_feeder/README
deleted file mode 100644
index 5502be25..00000000
--- a/tracks/vendor/plugins/resource_feeder/README
+++ /dev/null
@@ -1,7 +0,0 @@
-ResourceFeeder
-==============
-
-Simple feeds for resources
-
-NOTE: This plugin depends on the latest version of simply_helpful, available here:
-http://dev.rubyonrails.org/svn/rails/plugins/simply_helpful/
diff --git a/tracks/vendor/plugins/resource_feeder/Rakefile b/tracks/vendor/plugins/resource_feeder/Rakefile
deleted file mode 100644
index 51fce7b3..00000000
--- a/tracks/vendor/plugins/resource_feeder/Rakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the resource_feed plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the resource_feed plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'ResourceFeed'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/tracks/vendor/plugins/resource_feeder/init.rb b/tracks/vendor/plugins/resource_feeder/init.rb
deleted file mode 100644
index 7b55d76f..00000000
--- a/tracks/vendor/plugins/resource_feeder/init.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'resource_feeder'
-ActionController::Base.send(:include, ResourceFeeder::Rss, ResourceFeeder::Atom)
\ No newline at end of file
diff --git a/tracks/vendor/plugins/resource_feeder/lib/resource_feeder.rb b/tracks/vendor/plugins/resource_feeder/lib/resource_feeder.rb
deleted file mode 100644
index b5003419..00000000
--- a/tracks/vendor/plugins/resource_feeder/lib/resource_feeder.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'resource_feeder/rss'
-require 'resource_feeder/atom'
diff --git a/tracks/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb b/tracks/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb
deleted file mode 100644
index d3b5a63c..00000000
--- a/tracks/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-module ResourceFeeder
- module Atom
- extend self
-
- def render_atom_feed_for(resources, options = {})
- render :text => atom_feed_for(resources, options), :content_type => Mime::ATOM
- end
-
- def atom_feed_for(resources, options = {})
- xml = Builder::XmlMarkup.new(:indent => 2)
-
- options[:feed] ||= {}
- options[:item] ||= {}
- options[:url_writer] ||= self
-
- if options[:class] || resources.first
- klass = options[:class] || resources.first.class
- new_record = klass.new
- else
- options[:feed] = { :title => "Empty", :link => "http://example.com" }
- end
-
- options[:feed][:title] ||= klass.name.pluralize
- options[:feed][:id] ||= "tag:#{request.host_with_port}:#{klass.name.pluralize}"
- options[:feed][:link] ||= SimplyHelpful::RecordIdentifier.polymorphic_url(new_record, options[:url_writer])
-
- options[:item][:title] ||= [ :title, :subject, :headline, :name ]
- options[:item][:description] ||= [ :description, :body, :content ]
- options[:item][:pub_date] ||= [ :updated_at, :updated_on, :created_at, :created_on ]
- options[:item][:author] ||= [ :author, :creator ]
-
- resource_link = lambda { |r| SimplyHelpful::RecordIdentifier.polymorphic_url(r, options[:url_writer]) }
-
- xml.instruct!
- xml.feed "xml:lang" => "en-US", "xmlns" => 'http://www.w3.org/2005/Atom' do
- xml.title(options[:feed][:title])
- xml.id(options[:feed][:id])
- xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:feed][:link])
- xml.link(:rel => 'self', :type => 'application/atom+xml', :href => options[:feed][:self]) if options[:feed][:self]
- xml.subtitle(options[:feed][:description]) if options[:feed][:description]
-
- for resource in resources
- published_at = call_or_read(options[:item][:pub_date], resource)
-
- xml.entry do
- xml.title(call_or_read(options[:item][:title], resource))
- xml.content(call_or_read(options[:item][:description], resource), :type => 'html')
- xml.id("tag:#{request.host_with_port},#{published_at.xmlschema}:#{call_or_read(options[:item][:guid] || options[:item][:link] || resource_link, resource)}")
- xml.published(published_at.xmlschema)
- xml.updated((resource.respond_to?(:updated_at) ? call_or_read(options[:item][:pub_date] || :updated_at, resource) : published_at).xmlschema)
- xml.link(:rel => 'alternate', :type => 'text/html', :href => call_or_read(options[:item][:link] || options[:item][:guid] || resource_link, resource))
-
- if author = call_or_read(options[:item][:author], resource)
- xml.author do
- xml.name()
- end
- end
- end
- end
- end
- end
-
- private
- def call_or_read(procedure_or_attributes, resource)
- case procedure_or_attributes
- when Array
- attributes = procedure_or_attributes
- resource.send(attributes.select { |a| resource.respond_to?(a) }.first)
- when Symbol
- attribute = procedure_or_attributes
- resource.send(attribute)
- when Proc
- procedure = procedure_or_attributes
- procedure.call(resource)
- end
- end
- end
-end
\ No newline at end of file
diff --git a/tracks/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb b/tracks/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb
deleted file mode 100644
index b66ec4a8..00000000
--- a/tracks/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-module ResourceFeeder
- module Rss
- extend self
-
- def render_rss_feed_for(resources, options = {})
- render :text => rss_feed_for(resources, options), :content_type => Mime::RSS
- end
-
- def rss_feed_for(resources, options = {})
- xml = Builder::XmlMarkup.new(:indent => 2)
-
- options[:feed] ||= {}
- options[:item] ||= {}
- options[:url_writer] ||= self
-
- if options[:class] || resources.first
- klass = options[:class] || resources.first.class
- new_record = klass.new
- else
- options[:feed] = { :title => "Empty", :link => "http://example.com" }
- end
- use_content_encoded = options[:item].has_key?(:content_encoded)
-
- options[:feed][:title] ||= klass.name.pluralize
- options[:feed][:link] ||= SimplyHelpful::RecordIdentifier.polymorphic_url(new_record, options[:url_writer])
- options[:feed][:language] ||= "en-us"
- options[:feed][:ttl] ||= "40"
-
- options[:item][:title] ||= [ :title, :subject, :headline, :name ]
- options[:item][:description] ||= [ :description, :body, :content ]
- options[:item][:pub_date] ||= [ :updated_at, :updated_on, :created_at, :created_on ]
-
- resource_link = lambda { |r| SimplyHelpful::RecordIdentifier.polymorphic_url(r, options[:url_writer]) }
-
- rss_root_attributes = { :version => 2.0 }
- rss_root_attributes.merge!("xmlns:content" => "http://purl.org/rss/1.0/modules/content/") if use_content_encoded
-
- xml.instruct!
-
- xml.rss(rss_root_attributes) do
- xml.channel do
- xml.title(options[:feed][:title])
- xml.link(options[:feed][:link])
- xml.description(options[:feed][:description]) if options[:feed][:description]
- xml.language(options[:feed][:language])
- xml.ttl(options[:feed][:ttl])
-
- for resource in resources
- xml.item do
- xml.title(call_or_read(options[:item][:title], resource))
- xml.description(call_or_read(options[:item][:description], resource))
- if use_content_encoded then
- xml.content(:encoded) { xml.cdata!(call_or_read(options[:item][:content_encoded], resource)) }
- end
- xml.pubDate(call_or_read(options[:item][:pub_date], resource).to_s(:rfc822))
- xml.guid(call_or_read(options[:item][:guid] || options[:item][:link] || resource_link, resource))
- xml.link(call_or_read(options[:item][:link] || options[:item][:guid] || resource_link, resource))
- end
- end
- end
- end
- end
-
- private
- def call_or_read(procedure_or_attributes, resource)
- case procedure_or_attributes
- when Array
- attributes = procedure_or_attributes
- resource.send(attributes.select { |a| resource.respond_to?(a) }.first)
- when Symbol
- attribute = procedure_or_attributes
- resource.send(attribute)
- when Proc
- procedure = procedure_or_attributes
- procedure.call(resource)
- end
- end
- end
-end
diff --git a/tracks/vendor/plugins/resource_feeder/test/atom_feed_test.rb b/tracks/vendor/plugins/resource_feeder/test/atom_feed_test.rb
deleted file mode 100644
index 3112da47..00000000
--- a/tracks/vendor/plugins/resource_feeder/test/atom_feed_test.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-class AtomFeedTest < Test::Unit::TestCase
- attr_reader :request
-
- def setup
- @request = OpenStruct.new
- @request.host_with_port = 'example.com'
- @records = Array.new(5).fill(Post.new)
- @records.each &:save
- end
-
- def test_default_atom_feed
- atom_feed_for @records
-
- assert_select 'feed' do
- assert_select '>title', 'Posts'
- assert_select '>id', "tag:#{request.host_with_port}:Posts"
- assert_select '>link' do
- assert_select "[rel='alternate']"
- assert_select "[type='text/html']"
- assert_select "[href='http://example.com/posts']"
- end
- assert_select 'entry', 5 do
- assert_select 'title', :text => 'feed title (title)'
- assert_select "content[type='html']", '<p>feed description (description)</p>'
- assert_select 'id', "tag:#{request.host_with_port},#{@records.first.created_at.xmlschema}:#{'http://example.com/posts/1'}"
- assert_select 'published', @records.first.created_at.xmlschema
- assert_select 'updated', @records.first.created_at.xmlschema
- assert_select 'link' do
- assert_select "[rel='alternate']"
- assert_select "[type='text/html']"
- assert_select "[href='http://example.com/posts/1']"
- end
- end
- end
- end
-
- def test_should_allow_custom_feed_options
- atom_feed_for @records, :feed => { :title => 'Custom Posts', :link => '/posts', :description => 'stuff', :self => '/posts.atom' }
-
- assert_select 'feed>title', 'Custom Posts'
- assert_select "feed>link[href='/posts']"
- assert_select 'feed>subtitle', 'stuff'
- assert_select 'feed>link' do
- assert_select "[rel='self']"
- assert_select "[type='application/atom+xml']"
- assert_select "[href='/posts.atom']"
- end
- end
-
- def test_should_allow_custom_item_attributes
- atom_feed_for @records, :item => { :title => :name, :description => :body, :pub_date => :create_date, :link => :id }
-
- assert_select 'entry', 5 do
- assert_select 'title', :text => 'feed title (name)'
- assert_select "content[type='html']", '<p>feed description (body)</p>'
- assert_select 'published', (@records.first.created_at - 5.minutes).xmlschema
- assert_select 'updated', (@records.first.created_at - 5.minutes).xmlschema
- assert_select 'id', "tag:#{request.host_with_port},#{(@records.first.created_at - 5.minutes).xmlschema}:1"
- assert_select 'link' do
- assert_select "[rel='alternate']"
- assert_select "[type='text/html']"
- assert_select "[href='1']"
- end
- end
- end
-
- def test_should_allow_custom_item_attribute_blocks
- atom_feed_for @records, :item => { :title => lambda { |r| r.name }, :description => lambda { |r| r.body }, :pub_date => lambda { |r| r.create_date },
- :link => lambda { |r| "/#{r.created_at.to_i}" }, :guid => lambda { |r| r.created_at.to_i } }
-
- assert_select 'entry', 5 do
- assert_select 'title', :text => 'feed title (name)'
- assert_select "content[type='html']", '<p>feed description (body)</p>'
- assert_select 'published', (@records.first.created_at - 5.minutes).xmlschema
- assert_select 'updated', (@records.first.created_at - 5.minutes).xmlschema
- assert_select 'id', /:\d+$/
- assert_select 'link' do
- assert_select "[rel='alternate']"
- assert_select "[type='text/html']"
- assert_select "[href=?]", /^\/\d+$/
- end
- end
- end
-end
diff --git a/tracks/vendor/plugins/resource_feeder/test/rss_feed_test.rb b/tracks/vendor/plugins/resource_feeder/test/rss_feed_test.rb
deleted file mode 100644
index 90525baf..00000000
--- a/tracks/vendor/plugins/resource_feeder/test/rss_feed_test.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-class RssFeedTest < Test::Unit::TestCase
- def setup
- @records = Array.new(5).fill(Post.new)
- @records.each &:save
- end
-
- def test_default_rss_feed
- rss_feed_for @records
-
- assert_select 'rss[version="2.0"]' do
- assert_select 'channel' do
- assert_select '>title', 'Posts'
- assert_select '>link', 'http://example.com/posts'
- assert_select 'language', 'en-us'
- assert_select 'ttl', '40'
- end
- assert_select 'item', 5 do
- assert_select 'title', :text => 'feed title (title)'
- assert_select 'description', '<p>feed description (description)</p>'
- %w(guid link).each do |node|
- assert_select node, 'http://example.com/posts/1'
- end
- assert_select 'pubDate', @records.first.created_at.to_s(:rfc822)
- end
- end
- end
-
- def test_should_allow_custom_feed_options
- rss_feed_for @records, :feed => { :title => 'Custom Posts', :link => '/posts', :description => 'stuff', :language => 'en-gb', :ttl => '80' }
-
- assert_select 'channel>title', 'Custom Posts'
- assert_select 'channel>link', '/posts'
- assert_select 'channel>description', 'stuff'
- assert_select 'channel>language', 'en-gb'
- assert_select 'channel>ttl', '80'
- end
-
- def test_should_allow_custom_item_attributes
- rss_feed_for @records, :item => { :title => :name, :description => :body, :pub_date => :create_date, :link => :id }
-
- assert_select 'item', 5 do
- assert_select 'title', :text => 'feed title (name)'
- assert_select 'description', '<p>feed description (body)</p>'
- assert_select 'pubDate', (@records.first.created_at - 5.minutes).to_s(:rfc822)
- assert_select 'link', '1'
- assert_select 'guid', '1'
- end
- end
-
- def test_should_allow_custom_item_attribute_blocks
- rss_feed_for @records, :item => { :title => lambda { |r| r.name }, :description => lambda { |r| r.body }, :pub_date => lambda { |r| r.create_date },
- :link => lambda { |r| "/#{r.created_at.to_i}" }, :guid => lambda { |r| r.created_at.to_i } }
-
- assert_select 'item', 5 do
- assert_select 'title', :text => 'feed title (name)'
- assert_select 'description', '<p>feed description (body)</p>'
- assert_select 'pubDate', (@records.first.created_at - 5.minutes).to_s(:rfc822)
- end
- end
-
- # note that assert_select isnt easily able to get elements that have xml namespaces (as it thinks they are
- # invalid html psuedo children), so we do some manual testing with the response body
- def test_should_allow_content_encoded_for_items
- rss_feed_for @records, :item => { :content_encoded => :full_html_body }
-
- html_content = "Here is some full content, with out any excerpts"
- assert_equal 5, @response.body.scan("").size
- assert_select 'item', 5 do
- assert_select 'description + *', " { :content_encoded => :full_html_body }
- assert_equal %[\n],
- @response.body.grep(/\n],
- @response.body.grep(/feed description (#{attr_name})"
- end
- end
-
- def full_html_body
- "Here is some full content, with out any excerpts"
- end
-
- def create_date
- @created_at - 5.minutes
- end
-end
-
-class Test::Unit::TestCase
- include ResourceFeeder::Rss, ResourceFeeder::Atom
-
- def render_feed(xml)
- @response = OpenStruct.new
- @response.headers = {'Content-Type' => 'text/xml'}
- @response.body = xml
- end
-
- def rss_feed_for_with_ostruct(resources, options = {})
- render_feed rss_feed_for_without_ostruct(resources, options)
- end
-
- def atom_feed_for_with_ostruct(resources, options = {})
- render_feed atom_feed_for_without_ostruct(resources, options)
- end
-
- alias_method_chain :rss_feed_for, :ostruct
- alias_method_chain :atom_feed_for, :ostruct
-
- def html_document
- @html_document ||= HTML::Document.new(@response.body, false, true)
- end
-
- def posts_url
- "http://example.com/posts"
- end
-
- def post_url(post)
- "http://example.com/posts/#{post.id}"
- end
-end
diff --git a/tracks/vendor/plugins/selenium-on-rails/README b/tracks/vendor/plugins/selenium-on-rails/README
deleted file mode 100644
index 75a43918..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/README
+++ /dev/null
@@ -1,192 +0,0 @@
-= Selenium on Rails
-
-== Overview
-
-Selenium on Rails provides an easy way to test Rails application with
-SeleniumCore[http://www.openqa.org/selenium-core/].
-
-This plugin does four things:
-1. The Selenium Core files don't have to pollute /public, they can stay in the Selenium gem or in /vendor/selenium.
-2. No need to create suite files, they are generated on the fly -- one suite per directory in /test/selenium (suites can be nested).
-3. Instead of writing the test cases in HTML you can use a number of better formats (see Formats).
-4. Loading of fixtures and wiping of session (/selenium/setup).
-
-== Installation
-
-1. Selenium Core needs to be available. It could either be installed as a gem (gem install selenium) or in /vendor/selenium/.
-2. Install Selenium on Rails: script/plugin install http://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails
-3. If RedCloth is available the Selenese test cases can use it for better markup.
-4. Run the Rakefile in the plugin's directory to run the tests in order to see that everything works. (If RedCloth isn't installed a few tests will fail since they assume RedCloth is installed.)
-5. Create a test case: script/generate selenium login
-6. Start the server: script/server -e test
-7. Point your browser to http://localhost:3000/selenium
-8. If everything works as expected you should see the Selenium test runner. The north east frame contains all your test cases (just one for now), and the north frame contains your test case.
-
-=== win32-open3
-
-win32-open3[http://raa.ruby-lang.org/project/win32-open3/] is needed if you're
-on Windows and want to run your tests as a Rake task
-(see test:acceptance), i.e. you don't have to install it but it's
-recommended.
-
-You can build it from source or install the binary:
-
-1. Download the latest version of win32-open3, open3-0.2.2.so[http://rubyforge.org/frs/download.php/8515/open3-0.2.2.so] at the time of this writing.
-2. Open up irb and run this snippet: require 'rbconfig'; include Config; puts CONFIG['sitearchdir']
-3. Create a win32 directory under the directory you got, e.g. c:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
-4. Rename the .so file to open3.so and put it in the win32 directory.
-5. Profit! (unless you get an error when doing require 'win32/open3')
-
-== Formats
-
-The test cases can be written in a number of formats. Which one you choose is a
-matter of taste. You can generate your test files by running
-script/generate selenium or by creating them manually in your
-/test/selenium directory.
-
-=== Selenese, .sel
-
-Selenese is the dumbest format (in a good way). You just write your commands
-delimited by | characters.
-
- |open|/selenium/setup|
- |open|/|
- |goBack|
-
-If you don't want to write Selenese tests by hand you can use
-SeleniumIDE[http://www.openqa.org/selenium-ide/] which has
-support[http://wiki.openqa.org/display/SIDE/SeleniumOnRails] for Selenese.
-
-SeleniumIDE makes it super easy to record test and edit them.
-
-=== RSelenese, .rsel
-
-RSelenese enable you to write your tests in Ruby.
-
- setup :fixtures => :all
- open '/'
- assert_title 'Home'
- ('a'..'z').each {|c| open :controller => 'user', :action => 'create', :name => c }
-
-See SeleniumOnRails::TestBuilder for available commands.
-
-=== HTML/RHTML
-
-You can write your tests in HTML/RHTML but that's mostly useful if you have
-existing tests you want to reuse.
-
-=== Partial test cases
-
-If you have some common actions you want to do in several test cases you can put
-them in a separate partial test case and include them in your other test cases.
-
-A partial test case is just like a normal test case besides that its filename
-has to start with _:
-
- #_login.rsel
- open '/login'
- type 'name', name
- type 'password', password
- click 'submit', :wait=>true
-
-To include a partial test case you write like this in a Selenese test case:
-
- |includePartial|login|name=John Doe|password=eoD nhoJ|
-
-in a RSelenese test case:
-
- include_partial 'login', :name => 'Jane Doe', :password => 'Jane Doe'.reverse
-
-and in a RHTML test case:
-
- <%= render :partial => 'login', :locals => {:name = 'Joe Schmo', :password => 'Joe Schmo'.reverse} %>
-
-== Configuration
-
-There are a number of settings available. You make them by renaming
-config.yml.example to config.yml and make your changes in that
-file.
-
-=== Environments
-
-Per default this plugin is only available in test environment. You can change
-this by setting environments, such as:
-
- #config.yml
- environments:
- - test
- - development
-
-== test:acceptance
-
-You can run all your Selenium tests as a Rake task.
-
-First, if you're on Windows, you have to make sure win32-open3 is installed.
-Then you have to configure which browsers you want to run, like this:
-
- #config.yml
- browsers:
- firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
- ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
-
-Now you're all set. First start a server:
-
- script/server -e test
-
-Then run the tests:
-
- rake test:acceptance
-
-Now it should work, otherwise let me know!
-
-=== Store results
-
-If you want to store the results from a test:acceptance you just need
-to set in which directory they should be stored:
-
- #config.yml
- result_dir: 'c:\result'
-
-So when you run rake test:acceptance the tables with the results will
-be stored as .html files in that directory.
-
-This can be useful especially for continous integration.
-
-== Todo
-
-=== Standalone mode
-
-More work is needed on test:acceptance on Windows to be able to start
-the server when needed.
-
-=== user_extension.js
-
-Selenium has support for user_extension.js which is a way to extend the
-functionality of Selenium Core. However there is currently no easy way to add
-such a file in Selenium on Rails.
-
-=== More setup/teardown support?
-
-Currently there is only support to load fixtures and to wipe the session in
-/selenium/setup. Is there a need for more kinds of setups or teardowns?
-
-=== More documentation
-
-
-== Not todo
-
-=== Editor
-
-Creating an editor for the test cases is currently considered out of scope for
-this plugin. SeleniumIDE[http://www.openqa.org/selenium-ide/] does such a good
-job and has support[http://wiki.openqa.org/display/SIDE/SeleniumOnRails] for
-the Selenese format.
-
-== Credits
-
-* Jon Tirsen, http://jutopia.tirsen.com -- initial inspiration[http://wiki.rubyonrails.com/rails/pages/SeleniumIntegration]
-* Eric Kidd, http://www.randomhacks.net -- contribution of RSelenese
-
-== Information
-
-For more information, check out the website[http://www.openqa.org/selenium-on-rails/].
diff --git a/tracks/vendor/plugins/selenium-on-rails/Rakefile b/tracks/vendor/plugins/selenium-on-rails/Rakefile
deleted file mode 100644
index fbd733d9..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/Rakefile
+++ /dev/null
@@ -1,27 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rdoc/rdoc'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the Selenium on Rails plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the Selenium on Rails plugin.'
-task :rdoc do
- rm_rf 'doc'
- RDoc::RDoc.new.document(%w(--line-numbers --inline-source --title SeleniumOnRails README lib))
-end
-
-begin
- require 'rcov/rcovtask'
- Rcov::RcovTask.new do |t|
- t.test_files = FileList['test/*_test.rb']
- end
-rescue LoadError #if rcov isn't available, ignore
-end
diff --git a/tracks/vendor/plugins/selenium-on-rails/config.yml b/tracks/vendor/plugins/selenium-on-rails/config.yml
deleted file mode 100644
index 17746296..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/config.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Rename this file to config.yml in order to configure the plugin
-
-#
-# General settings
-#
-
-environments:
- - test
-# - development # Uncomment this line to enable in development environment. N.B. your development database will likely be altered/destroyed/abducted
-
-#selenium_path: 'c:\selenium' #path to selenium installation. only needed when selenium isn't installed in /vendor/selenium or as a gem
-
-#
-# rake test:acceptance settings
-#
-
-browsers:
- firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
- ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
-
-#host: 'localhost'
-#port_start: 3000
-#port_end: 3005
-#max_browser_duration: 120
-#multi_window: false
-
-#result_dir: 'c:\result' # the directory where the results will be stored after a test:acceptance run
diff --git a/tracks/vendor/plugins/selenium-on-rails/config.yml.example b/tracks/vendor/plugins/selenium-on-rails/config.yml.example
deleted file mode 100644
index 17746296..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/config.yml.example
+++ /dev/null
@@ -1,27 +0,0 @@
-# Rename this file to config.yml in order to configure the plugin
-
-#
-# General settings
-#
-
-environments:
- - test
-# - development # Uncomment this line to enable in development environment. N.B. your development database will likely be altered/destroyed/abducted
-
-#selenium_path: 'c:\selenium' #path to selenium installation. only needed when selenium isn't installed in /vendor/selenium or as a gem
-
-#
-# rake test:acceptance settings
-#
-
-browsers:
- firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
- ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
-
-#host: 'localhost'
-#port_start: 3000
-#port_end: 3005
-#max_browser_duration: 120
-#multi_window: false
-
-#result_dir: 'c:\result' # the directory where the results will be stored after a test:acceptance run
diff --git a/tracks/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html b/tracks/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html
deleted file mode 100644
index c8bcc34d..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html
+++ /dev/null
@@ -1,265 +0,0 @@
-
-
-
-
-
- Class: SeleniumController
-
-
-
-
-
-
-
-
-
-
-
-Returns the path to the layout template. The path is relative in relation
-to the app/views/ directory since Rails doesn’t support absolute
-paths to layout templates.
-
- # File lib/selenium_on_rails/selenese.rb, line 11
-11: defrendertemplate, local_assigns
-12: name = (@view.assigns['page_title'] orlocal_assigns['page_title'])
-13: lines = template.strip.split"\n"
-14: html = ''
-15: html<<extract_comments(lines)
-16: html<<extract_commands(lines, name)
-17: html<<extract_comments(lines)
-18: raise'You cannot have comments in the middle of commands!'ifnext_linelines, :any
-19: html
-20: end
-
-Retrieves the message of a JavaScript alert generated during the previous
-action, or fail if there were no alerts.
-
-
-Getting an alert has the same effect as manually clicking OK. If an alert
-is generated but you do not get/verify it, the next Selenium action will
-fail.
-
-
-NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
-dialog.
-
-
-NOTE: Selenium does NOT support JavaScript alerts that are generated in a
-page’s onload() event handler. In this case a visible dialog
-WILL be generated and Selenium will hang until someone manually clicks OK.
-
-Retrieves the message of a JavaScript confirmation dialog generated during
-the previous action.
-
-
-By default, the confirm function will return true, having the same
-effect as manually clicking OK. This can be changed by prior execution of
-the choose_cancel_on_next_confirmation command. If a confirmation
-is generated but you do not get/verify it, the next Selenium action will
-fail.
-
-
-NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
-dialog.
-
-
-NOTE: Selenium does NOT support JavaScript confirmations that are generated
-in a page’s onload() event handler. In this case a visible
-dialog WILL be generated and Selenium will hang until you manually click
-OK.
-
-Determines whether the specified input element is editable, i.e.
-hasn’t been disabled. This method will fail if the specified element
-isn’t an input element.
-
-Gets the result of evaluating the specified JavaScript snippet. The snippet
-may have multiple lines, but only the result of the last line will be
-returned.
-
-
-Note that, by default, the snippet will run in the context of the
-"selenium" object itself, so this will refer to the
-Selenium object, and window will refer to the top-level runner
-test window, not the window of your application.
-
-
-If you need a reference to the window of your application, you can refer to
-this.browserbot.getCurrentWindow() and if you need to use a
-locator to refer to a single element in your application page, you can use
-this.page().findElement("foo") where
-"foo" is your locator.
-
-Retrieves the message of a JavaScript question prompt dialog generated
-during the previous action.
-
-
-Successful handling of the prompt requires prior execution of the
-answer_on_next_prompt command. If a prompt is generated but you do
-not get/verify it, the next Selenium action will fail.
-
-
-NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog.
-
-
-NOTE: Selenium does NOT support JavaScript prompts that are generated in a
-page’s onload() event handler. In this case a visible dialog
-WILL be generated and Selenium will hang until someone manually clicks OK.
-
- # File lib/selenium_on_rails/test_builder_accessors.rb, line 272
-272: defstore_selectedlocator, option_locator, variable_name
-273: raise'Not supported in Selenium Core at the moment'
-274: end
-
-Gets the text of an element. This works for any element that contains text.
-This command uses either the textContent (Mozilla-like browsers)
-or the innerText (IE-like browsers) of the element, which is the
-rendered text shown to the user.
-
-Gets the (whitespace-trimmed) value of an input field (or anything else
-with a value parameter). For checkbox/radio elements, the value will be
-"on" or "off" depending on whether the element is
-checked or not.
-
-Determines if the specified element is visible. An element can be rendered
-invisible by setting the CSS "visibility" property to
-"hidden", or the "display" property to
-"none", either for the element itself or one if its ancestors.
-This method will fail if the element is not present.
-
-By default, Selenium’s overridden window.confirm() function
-will return true, as if the user had manually clicked OK. After
-running this command, the next call to confirm() will return
-false, as if the user had clicked Cancel.
-
-Clicks on a link, button, checkbox or radio button. If the click action
-causes a new page to load (like a link usually does), call wait_for_page_to_load.
-
-Opens an URL in the test frame. This accepts both relative and absolute
-URLs. The open command waits for the page to load before
-proceeding, i.e. you don’t have to call wait_for_page_to_load.
-
-
-Note: The URL must be on the same domain as the runner HTML due to security
-restrictions in the browser (Same Origin Policy).
-
-Select an option from a drop-down using an option locator.
-
-
-Option locators provide different ways of specifying options of an HTML
-Select element (e.g. for selecting a specific option, or for asserting that
-the selected option satisfies a specification). There are several forms of
-Select Option Locator.
-
-
-
label=labelPattern matches options based on their labels, i.e. the visible
-text. (This is the default.)
-
-
- label=regexp:^[Oo]ther
-
-
-
value=valuePattern matches options based on their values.
-
-
- value=other
-
-
-
id=id matches options based on their ids.
-
-
- id=option1
-
-
-
index=index matches an option based on its index (offset from zero).
-
-
- index=2
-
-
-
-
-If no option locator prefix is provided, the default behaviour is to match
-on label.
-
-Selects a popup window; once a popup window has been selected, all commands
-go to that window. To select the main window again, use nil as the
-target.
-
-Tell Selenium on Rails to clear the session and load any fixtures. DO NOT
-CALL THIS AGAINST NON-TEST DATABASES. The supported options are
-:keep_session, :fixtures and :clear_tables
-
-Sets the value of an input field, as though you typed it in.
-
-
-Can also be used to set the value of combo boxes, check boxes, etc. In
-these cases, value should be the value of the option selected, not
-the visible text.
-
-Runs the specified JavaScript snippet repeatedly until it evaluates to
-true. The snippet may have multiple lines, but only the result of
-the last line will be considered.
-
-
-Note that, by default, the snippet will be run in the runner’s test
-window, not in the window of your application. To get the window of your
-application, you can use the JavaScript snippet
-selenium.browserbot.getCurrentWindow(), and then run your
-JavaScript in there.
-
-You can use this command instead of the and_wait suffixes,
-click_and_wait, select_and_wait, type_and_wait
-etc. (which are only available in the JS API).
-
-
-Selenium constantly keeps track of new pages loading, and sets a
-newPageLoaded flag when it first notices a page load. Running any
-other Selenium command after turns the flag to false. Hence, if
-you want to wait for a page to load, you must wait immediately after a
-Selenium command that caused a page-load.
-
If RedCloth is available the Selenese test cases can use it for better
-markup.
-
-
-
Run the Rakefile in the plugin’s directory to run the tests in order
-to see that everything works. (If RedCloth isn’t installed a few
-tests will fail since they assume RedCloth is installed.)
-
-
-
Create a test case: script/generate selenium login
-
-
If everything works as expected you should see the Selenium test runner.
-The north east frame contains all your test cases (just one for now), and
-the north frame contains your test case.
-
-
-
-
win32-open3
-
-win32-open3 is
-needed if you’re on Windows and want to run your tests as a Rake task
-(see test:acceptance), i.e. you don’t have to install it but
-it’s recommended.
-
-
-You can build it from source or install the binary:
-
-
-
Download the latest version of win32-open3, open3-0.2.2.so
-at the time of this writing.
-
-
-
Open up irb and run this snippet: require ‘rbconfig’;
-include Config; puts CONFIG[‘sitearchdir’]
-
-
-
Create a win32 directory under the directory you got, e.g.
-c:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
-
-
-
Rename the .so file to open3.so and put it in the win32
-directory.
-
-
-
Profit! (unless you get an error when doing require
-‘win32/open3‘)
-
-
-
-
Formats
-
-The test cases can be written in a number of formats. Which one you choose
-is a matter of taste. You can generate your test files by running
-script/generate selenium or by creating them manually in your
-/test/selenium directory.
-
-
Selenese, .sel
-
-Selenese is the dumbest format (in a good way). You just write your
-commands delimited by | characters.
-
-
- |open|/selenium/setup|
- |open|/|
- |goBack|
-
-
-If you don’t want to write Selenese tests by hand you can use SeleniumIDE which has support for
-Selenese.
-
-
-SeleniumIDE makes it super easy to record test and edit them.
-
-
RSelenese, .rsel
-
-RSelenese enable you to write your tests in Ruby.
-
-
- setup :fixtures => :all
- open '/'
- assert_title 'Home'
- ('a'..'z').each {|c| open :controller => 'user', :action => 'create', :name => c }
-
-You can write your tests in HTML/RHTML but that’s mostly useful if
-you have existing tests you want to reuse.
-
-
Partial test cases
-
-If you have some common actions you want to do in several test cases you
-can put them in a separate partial test case and include them in your other
-test cases.
-
-
-A partial test case is just like a normal test case besides that its
-filename has to start with _:
-
-
- #_login.rsel
- open '/login'
- type 'name', name
- type 'password', password
- click 'submit', :wait=>true
-
-
-To include a partial test case you write like this in a Selenese test case:
-
-There are a number of settings available. You make them by renaming
-config.yml.example to config.yml and make your changes in
-that file.
-
-
Environments
-
-Per default this plugin is only available in test environment. You can
-change this by setting environments, such as:
-
-
- #config.yml
- environments:
- - test
- - development
-
-
test:acceptance
-
-You can run all your Selenium tests as a Rake task.
-
-
-First, if you’re on Windows, you have to make sure win32-open3 is
-installed. Then you have to configure which browsers you want to run, like
-this:
-
-If you want to store the results from a test:acceptance you just
-need to set in which directory they should be stored:
-
-
- #config.yml
- result_dir: 'c:\result'
-
-
-So when you run rake test:acceptance the tables with the results
-will be stored as .html files in that directory.
-
-
-This can be useful especially for continous integration.
-
-
Todo
-
Standalone mode
-
-More work is needed on test:acceptance on Windows to be able to
-start the server when needed.
-
-
user_extension.js
-
-Selenium has support for user_extension.js which is a way to
-extend the functionality of Selenium Core. However there is currently no
-easy way to add such a file in Selenium on Rails.
-
-
More setup/teardown support?
-
-Currently there is only support to load fixtures and to wipe the session in
-/selenium/setup. Is there a need for more kinds of setups or
-teardowns?
-
-
More documentation
-
Not todo
-
Editor
-
-Creating an editor for the test cases is currently considered out of scope
-for this plugin. SeleniumIDE does such a good
-job and has support for
-the Selenese format.
-
It's often a good idea to start the test with opening /selenium/setup (see <%%= link_to 'here', :controller => 'selenium', :action => 'setup' %> for more info).
-
-
-
<%%= @page_title %>
-
open
/selenium/setup
-<%% for page in ['/', '/home'] -%>
-
open
<%%= page %>
-
assertTitle
Home
-<%% end -%>
-
-
-
More information about the commands is available here.
-
-
You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test.
diff --git a/tracks/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml b/tracks/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml
deleted file mode 100644
index 419eb368..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml
+++ /dev/null
@@ -1,14 +0,0 @@
-# It's often a good idea to start the test with 'setup'.
-# See /selenium/setup for more info.
-
-setup
-open '/'
-assert_title 'Home'
-
-# More information about the commands is available at:
-# http://release.openqa.org/selenium-core/nightly/reference.html
-# See also the RDoc for SeleniumOnRails::TestBuilder.
-#
-# Point the browser to <%= testcase_link %> to see
-# how this test is rendered, or to <%= suite_link %> to
-# run the suite.
diff --git a/tracks/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml b/tracks/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml
deleted file mode 100644
index f4ccb8a9..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml
+++ /dev/null
@@ -1,11 +0,0 @@
-It's often a good idea to start the test with opening /selenium/setup (see "here":/selenium/setup for more info).
-
-|open|/selenium/setup|
-|open|/|
-|assertTitle|Home|
-
-More information about the commands is available "here":http://release.openqa.org/selenium-core/nightly/reference.html.
-
-You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test. "RedCloth":http://www.whytheluckystiff.net/ruby/redcloth/ is used for formatting if installed.
-
-Point the browser to "<%= testcase_link %>":<%= testcase_link %> to see how this test is rendered, or to "<%= suite_link %>":<%= suite_link %> to run the suite.
diff --git a/tracks/vendor/plugins/selenium-on-rails/init.rb b/tracks/vendor/plugins/selenium-on-rails/init.rb
deleted file mode 100644
index 05d43a8c..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/init.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'selenium_on_rails_config'
-envs = SeleniumOnRailsConfig.get :environments
-
-if envs.include? RAILS_ENV
- #initialize the plugin
- $LOAD_PATH << File.dirname(__FILE__) + "/lib/controllers"
- require 'selenium_controller'
- require File.dirname(__FILE__) + '/routes'
-
-else
- #erase all traces
- $LOAD_PATH.delete lib_path
-
- #but help user figure out what to do
- unless RAILS_ENV == 'production' # don't pollute production
- require File.dirname(__FILE__) + '/switch_environment/init'
- end
-end
-
diff --git a/tracks/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb b/tracks/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb
deleted file mode 100644
index f6e328c8..00000000
--- a/tracks/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-require 'webrick/httputils'
-
-class SeleniumController < ActionController::Base
- include SeleniumOnRails::FixtureLoader
- include SeleniumOnRails::Renderer
-
- def setup
- unless params.has_key? :keep_session
- reset_session
- @session_wiped = true
- end
- @cleared_tables = clear_tables params[:clear_tables].to_s
- @loaded_fixtures = load_fixtures params[:fixtures].to_s
- render :file => view_path('setup.rhtml'), :layout => layout_path
- end
-
- def test_file
- params[:testname] = '' if params[:testname].to_s == 'TestSuite.html'
- filename = File.join selenium_tests_path, params[:testname]
- if File.directory? filename
- @suite_path = filename
- render :file => view_path('test_suite.rhtml'), :layout => layout_path
- elsif File.readable? filename
- render_test_case filename
- else
- if File.directory? selenium_tests_path
- render :text => 'Not found', :status => 404
- else
- render :text => "Did not find the Selenium tests path (#{selenium_tests_path}). Run script/generate selenium", :status => 404
- end
- end
- end
-
- def support_file
- if params[:filename].empty?
- redirect_to :filename => 'TestRunner.html', :test => 'tests'
- return
- end
-
- filename = File.join selenium_path, params[:filename]
- if File.file? filename
- type = WEBrick::HTTPUtils::DefaultMimeTypes[$1.downcase] if filename =~ /\.(\w+)$/
- type ||= 'text/html'
- send_file filename, :type => type, :disposition => 'inline', :stream => false
- else
- render :text => 'Not found', :status => 404
- end
- end
-
- def record
- dir = record_table
-
- @result = {'resultDir' => dir}
- for p in ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime']
- @result[p] = params[p]
- end
- File.open(log_path(params[:logFile] || 'default.yml'), 'w') {|f| YAML.dump(@result, f)}
-
- render :file => view_path('record.rhtml'), :layout => layout_path
- end
-
- def record_table
- return nil unless result_dir = SeleniumOnRailsConfig.get(:result_dir)
-
- cur_result_dir = File.join(result_dir, (params[:logFile] || "default").sub(/\.yml$/, ''))
- FileUtils.mkdir_p(cur_result_dir)
- File.open("#{cur_result_dir}/index.html", "wb") do |f|
- f.write <
-Selenium Test Result
-
-
-
-
-