From 3b43d1801e99407c244445dfaf3bcdb6a06ef57b Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 13:50:18 -0300 Subject: Added arel as a submodule. This is temporary and will make development/testing easier. --- .gitmodules | 3 +++ arel | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 arel diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..7184520aa2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "arel"] + path = arel + url = git@github.com:miloops/arel.git diff --git a/arel b/arel new file mode 160000 index 0000000000..7978b69948 --- /dev/null +++ b/arel @@ -0,0 +1 @@ +Subproject commit 7978b69948c4fe38911932766d45026467f45e52 -- cgit v1.2.3 From fdcd81970e1db2343de7d722e3c5548c6c1f27cd Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 13:54:00 -0300 Subject: Require Arel --- activerecord/lib/active_record.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 500a90d6cb..f5a7829a73 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -21,6 +21,8 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ + + begin require 'active_support' rescue LoadError @@ -32,6 +34,9 @@ rescue LoadError end require 'active_support/core/all' +$:.unshift(File.dirname(__FILE__) + '/../../arel/lib') +require 'arel' + module ActiveRecord # TODO: Review explicit loads to see if they will automatically be handled by the initilizer. def self.load_all! -- cgit v1.2.3 From a934bbbb28f93bae3793f6d53676f729065c7b4f Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 13:54:38 -0300 Subject: Removed blank lines --- activerecord/lib/active_record.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index f5a7829a73..da2a528fd2 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -21,8 +21,6 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ - - begin require 'active_support' rescue LoadError -- cgit v1.2.3 From 0d9f1da9554f89e6f515485c0c9aceaec12b3d01 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 13:55:02 -0300 Subject: Arel updated --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index 7978b69948..318cf575eb 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 7978b69948c4fe38911932766d45026467f45e52 +Subproject commit 318cf575eb2b7cf42cb133b3f24cd1aa5fa5e155 -- cgit v1.2.3 From d8f99c36bae411dfde28ed18537db7671a57ceb9 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 13:55:42 -0300 Subject: Added Arel integration to migration's version update table --- activerecord/lib/active_record/migration.rb | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 657acd6dc0..8cb5febbb6 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -103,7 +103,7 @@ module ActiveRecord # # The Rails package has several tools to help create and apply migrations. # - # To generate a new migration, you can use + # To generate a new migration, you can use # script/generate migration MyNewMigration # # where MyNewMigration is the name of your migration. The generator will @@ -121,16 +121,16 @@ module ActiveRecord # def self.up # add_column :tablenames, :fieldname, :string # end - # + # # def self.down # remove_column :tablenames, :fieldname # end # end - # + # # To run migrations against the currently configured database, use # rake db:migrate. This will update the database by running all of the # pending migrations, creating the schema_migrations table - # (see "About the schema_migrations table" section below) if missing. It will also + # (see "About the schema_migrations table" section below) if missing. It will also # invoke the db:schema:dump task, which will update your db/schema.rb file # to match the structure of your database. # @@ -240,7 +240,7 @@ module ActiveRecord # lower than the current schema version: when migrating up, those # never-applied "interleaved" migrations will be automatically applied, and # when migrating down, never-applied "interleaved" migrations will be skipped. - # + # # == Timestamped Migrations # # By default, Rails generates migrations that look like: @@ -253,7 +253,7 @@ module ActiveRecord # off by setting: # # config.active_record.timestamped_migrations = false - # + # # In environment.rb. # class Migration @@ -389,9 +389,9 @@ module ActiveRecord def rollback(migrations_path, steps=1) migrator = self.new(:down, migrations_path) start_index = migrator.migrations.index(migrator.current_migration) - + return unless start_index - + finish = migrator.migrations[start_index + steps] down(migrations_path, finish ? finish.version : 0) end @@ -403,7 +403,7 @@ module ActiveRecord def down(migrations_path, target_version = nil) self.new(:down, migrations_path, target_version).migrate end - + def run(direction, migrations_path, target_version) self.new(direction, migrations_path, target_version).run end @@ -434,17 +434,17 @@ module ActiveRecord def initialize(direction, migrations_path, target_version = nil) raise StandardError.new("This database does not yet support migrations") unless Base.connection.supports_migrations? Base.connection.initialize_schema_migrations_table - @direction, @migrations_path, @target_version = direction, migrations_path, target_version + @direction, @migrations_path, @target_version = direction, migrations_path, target_version end def current_version migrated.last || 0 end - + def current_migration migrations.detect { |m| m.version == current_version } end - + def run target = migrations.detect { |m| m.version == @target_version } raise UnknownMigrationVersionError.new(@target_version) if target.nil? @@ -461,14 +461,14 @@ module ActiveRecord if target.nil? && !@target_version.nil? && @target_version > 0 raise UnknownMigrationVersionError.new(@target_version) end - + start = up? ? 0 : (migrations.index(current) || 0) finish = migrations.index(target) || migrations.size - 1 runnable = migrations[start..finish] - + # skip the last migration if we're headed down, but not ALL the way down runnable.pop if down? && !target.nil? - + runnable.each do |migration| Base.logger.info "Migrating to #{migration.name} (#{migration.version})" @@ -496,28 +496,28 @@ module ActiveRecord def migrations @migrations ||= begin files = Dir["#{@migrations_path}/[0-9]*_*.rb"] - + migrations = files.inject([]) do |klasses, file| version, name = file.scan(/([0-9]+)_([_a-z0-9]*).rb/).first - + raise IllegalMigrationNameError.new(file) unless version version = version.to_i - + if klasses.detect { |m| m.version == version } - raise DuplicateMigrationVersionError.new(version) + raise DuplicateMigrationVersionError.new(version) end if klasses.detect { |m| m.name == name.camelize } - raise DuplicateMigrationNameError.new(name.camelize) + raise DuplicateMigrationNameError.new(name.camelize) end - + klasses << returning(MigrationProxy.new) do |migration| migration.name = name.camelize migration.version = version migration.filename = file end end - + migrations = migrations.sort_by(&:version) down? ? migrations.reverse : migrations end @@ -534,15 +534,15 @@ module ActiveRecord private def record_version_state_after_migrating(version) - sm_table = self.class.schema_migrations_table_name + table = Arel(self.class.schema_migrations_table_name) @migrated_versions ||= [] if down? @migrated_versions.delete(version.to_i) - Base.connection.update("DELETE FROM #{sm_table} WHERE version = '#{version}'") + table.where(table["version"].eq(version)).delete else @migrated_versions.push(version.to_i).sort! - Base.connection.insert("INSERT INTO #{sm_table} (version) VALUES ('#{version}')") + table.insert table["version"] => version end end -- cgit v1.2.3 From 7958308ef66aece2d24ab1b884f4facb4751da70 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 18:54:04 -0300 Subject: More progress on migrations. Arel updated. --- activerecord/lib/active_record/migration.rb | 3 ++- arel | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 8cb5febbb6..c8db31700b 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -413,7 +413,8 @@ module ActiveRecord end def get_all_versions - Base.connection.select_values("SELECT version FROM #{schema_migrations_table_name}").map(&:to_i).sort + table = Arel(schema_migrations_table_name) + table.project(table['version']).select_values.map(&:to_i).sort end def current_version diff --git a/arel b/arel index 318cf575eb..a454d45403 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 318cf575eb2b7cf42cb133b3f24cd1aa5fa5e155 +Subproject commit a454d45403cd0b8a24b05b7ff37021e307905825 -- cgit v1.2.3 From e428c75d2b67c6a7bd5f5e7e1719cdece84d497f Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 23 Apr 2009 18:59:35 -0300 Subject: Remove connection method definition, since it's called just once. --- activerecord/lib/active_record/migration.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index c8db31700b..aa9e9e8fdd 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -338,10 +338,6 @@ module ActiveRecord self.verbose = save end - def connection - ActiveRecord::Base.connection - end - def method_missing(method, *arguments, &block) arg_list = arguments.map(&:inspect) * ', ' @@ -349,7 +345,7 @@ module ActiveRecord unless arguments.empty? || method == :execute arguments[0] = Migrator.proper_table_name(arguments.first) end - connection.send(method, *arguments, &block) + Base.connection.send(method, *arguments, &block) end end end -- cgit v1.2.3 From c0f66b764e4a45764d64c6f047f13ec92b074c03 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 24 Apr 2009 17:26:34 -0300 Subject: Added ruby-debug --- activerecord/test/cases/helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 1ec52ac24d..2f9145a874 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -15,6 +15,9 @@ require 'connection' require 'cases/repair_helper' +# TODO remove the debugger +require 'ruby-debug' + # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true -- cgit v1.2.3 From 345e686d83c54fec6cb53cf77dea62d640a31954 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 24 Apr 2009 17:27:05 -0300 Subject: Changed locking to use Arel. Arel updated --- .../lib/active_record/locking/optimistic.rb | 33 +++++++++++++--------- arel | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 7fa7e267d8..ab0f5fc58d 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,14 +89,19 @@ module ActiveRecord attribute_names.uniq! begin - affected_rows = connection.update(<<-end_sql, "#{self.class.name} Update with optimistic locking") - UPDATE #{self.class.quoted_table_name} - SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false, false, attribute_names))} - WHERE #{self.class.primary_key} = #{quote_value(id)} - AND #{self.class.quoted_locking_column} = #{quote_value(previous_value)} - end_sql - - unless affected_rows == 1 + table = Arel(self.class.table_name) + affected_rows = table.where( + table[self.class.primary_key].eq(quoted_id).and( + table[self.class.locking_column].eq(quote_value(previous_value)) + ) + ) + + attributes = {} + attributes_with_quotes(false, false, attribute_names).map { |k,v| + attributes.merge!(table[k] => v) + } + + unless affected_rows.update(attributes) == 1 raise ActiveRecord::StaleObjectError, "Attempted to update a stale object" end @@ -116,12 +121,12 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - affected_rows = connection.delete( - "DELETE FROM #{self.class.quoted_table_name} " + - "WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id} " + - "AND #{self.class.quoted_locking_column} = #{quote_value(previous_value)}", - "#{self.class.name} Destroy" - ) + table = Arel(self.class.table_name, connection) + affected_rows = table.where( + table[self.class.primary_key].eq(quoted_id).and( + table[self.class.locking_column].eq(quote_value(previous_value)) + ) + ).delete unless affected_rows == 1 raise ActiveRecord::StaleObjectError, "Attempted to delete a stale object" diff --git a/arel b/arel index a454d45403..1b1fc880bf 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit a454d45403cd0b8a24b05b7ff37021e307905825 +Subproject commit 1b1fc880bf7129a422901417bd6b9fede292aa7e -- cgit v1.2.3 From 0e113a040d934958ce3805ce6cda73c655def444 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 24 Apr 2009 17:32:16 -0300 Subject: Refactored locking update --- activerecord/lib/active_record/locking/optimistic.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index ab0f5fc58d..1251e9f013 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -90,18 +90,20 @@ module ActiveRecord begin table = Arel(self.class.table_name) - affected_rows = table.where( - table[self.class.primary_key].eq(quoted_id).and( - table[self.class.locking_column].eq(quote_value(previous_value)) - ) - ) attributes = {} attributes_with_quotes(false, false, attribute_names).map { |k,v| attributes.merge!(table[k] => v) } - unless affected_rows.update(attributes) == 1 + affected_rows = table.where( + table[self.class.primary_key].eq(quoted_id).and( + table[self.class.locking_column].eq(quote_value(previous_value)) + ) + ).update(attributes) + + + unless affected_rows == 1 raise ActiveRecord::StaleObjectError, "Attempted to update a stale object" end @@ -121,7 +123,7 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - table = Arel(self.class.table_name, connection) + table = Arel(self.class.table_name) affected_rows = table.where( table[self.class.primary_key].eq(quoted_id).and( table[self.class.locking_column].eq(quote_value(previous_value)) -- cgit v1.2.3 From 090539604b7685d838302c1773520622d87bd3d7 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 24 Apr 2009 21:48:45 -0300 Subject: construct_finder_sql now use Arel --- activerecord/lib/active_record/base.rb | 107 +++++++++++++++++---- .../connection_adapters/mysql_adapter.rb | 2 +- activerecord/lib/active_record/test_case.rb | 2 +- .../associations/inner_join_association_test.rb | 2 +- activerecord/test/cases/method_scoping_test.rb | 2 +- arel | 2 +- 6 files changed, 91 insertions(+), 26 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 97c36a675d..8bf92de6d4 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -390,7 +390,7 @@ module ActiveRecord #:nodoc: # So it's possible to assign a logger to the class through Base.logger= which will then be used by all # instances in the current object space. class Base - ## + ## # :singleton-method: # Accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then passed # on to any new database connections made and which can be retrieved on both a class and instance level by calling +logger+. @@ -424,11 +424,11 @@ module ActiveRecord #:nodoc: # as a Hash. # # For example, the following database.yml... - # + # # development: # adapter: sqlite3 # database: db/development.sqlite3 - # + # # production: # adapter: sqlite3 # database: db/production.sqlite3 @@ -1351,7 +1351,7 @@ module ActiveRecord #:nodoc: def self_and_descendants_from_active_record#nodoc: klass = self classes = [klass] - while klass != klass.base_class + while klass != klass.base_class classes << klass = klass.superclass end classes @@ -1385,7 +1385,7 @@ module ActiveRecord #:nodoc: def human_name(options = {}) defaults = self_and_descendants_from_active_record.map do |klass| :"#{klass.name.underscore}" - end + end defaults << self.name.humanize I18n.translate(defaults.shift, {:scope => [:activerecord, :models], :count => 1, :default => defaults}.merge(options)) end @@ -1689,20 +1689,85 @@ module ActiveRecord #:nodoc: def construct_finder_sql(options) scope = scope(:find) - sql = "SELECT #{options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))} " - sql << "FROM #{options[:from] || (scope && scope[:from]) || quoted_table_name} " - add_joins!(sql, options[:joins], scope) - add_conditions!(sql, options[:conditions], scope) + # TODO add lock to Arel + Arel(table_name). + join(construct_join(options[:joins], scope)). + where(construct_conditions(options[:conditions], scope)). + project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope)). + take(construct_limit(options, scope)). + skip(construct_offset(options, scope) + ).to_sql + end - add_group!(sql, options[:group], options[:having], scope) - add_order!(sql, options[:order], scope) - add_limit!(sql, options, scope) - add_lock!(sql, options, scope) + def construct_join(joins, scope = :auto) + scope = scope(:find) if :auto == scope + merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins]) + case merged_joins + when Symbol, Hash, Array + if array_of_strings?(merged_joins) + merged_joins.join(' ') + " " + else + join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, merged_joins, nil) + " #{join_dependency.join_associations.collect { |assoc| assoc.association_join }.join} " + end + when String + " #{merged_joins} " + end + end + + def construct_group(group, having, scope = :auto) + sql = '' + if group + sql << group.to_s + sql << " HAVING #{sanitize_sql_for_conditions(having)}" if having + else + scope = scope(:find) if :auto == scope + if scope && (scoped_group = scope[:group]) + sql << scoped_group.to_s + sql << " HAVING #{sanitize_sql_for_conditions(scope[:having])}" if scope[:having] + end + end + sql + end + def construct_order(order, scope = :auto) + sql = '' + scope = scope(:find) if :auto == scope + scoped_order = scope[:order] if scope + if order + sql << order.to_s + if scoped_order && scoped_order != order + sql << ", #{scoped_order}" + end + else + sql << scoped_order.to_s if scoped_order + end sql end + def construct_limit(options, scope = :auto) + scope = scope(:find) if :auto == scope + options[:limit] ||= scope[:limit] if scope + options[:limit] + end + + def construct_offset(options, scope = :auto) + scope = scope(:find) if :auto == scope + options[:offset] ||= scope[:offset] if scope + options[:offset] + end + + def construct_conditions(conditions, scope = :auto) + scope = scope(:find) if :auto == scope + conditions = [conditions] + conditions << scope[:conditions] if scope + conditions << type_condition if finder_needs_type_condition? + merge_conditions(*conditions) + end + # Merges includes so that the result is a valid +include+ def merge_includes(first, second) (safe_to_array(first) + safe_to_array(second)).uniq @@ -1958,7 +2023,7 @@ module ActiveRecord #:nodoc: attributes = construct_attributes_from_arguments( # attributes = construct_attributes_from_arguments( [:#{attribute_names.join(',:')}], args # [:user_name, :password], args ) # ) - # + # scoped(:conditions => attributes) # scoped(:conditions => attributes) end # end }, __FILE__, __LINE__ @@ -2478,7 +2543,7 @@ module ActiveRecord #:nodoc: # name # end # end - # + # # user = User.find_by_name('Phusion') # user_path(user) # => "/users/Phusion" def to_param @@ -2533,12 +2598,12 @@ module ActiveRecord #:nodoc: # If +perform_validation+ is true validations run. If any of them fail # the action is cancelled and +save+ returns +false+. If the flag is # false validations are bypassed altogether. See - # ActiveRecord::Validations for more information. + # ActiveRecord::Validations for more information. # # There's a series of callbacks associated with +save+. If any of the # before_* callbacks return +false+ the action is cancelled and # +save+ returns +false+. See ActiveRecord::Callbacks for further - # details. + # details. def save create_or_update end @@ -2550,12 +2615,12 @@ module ActiveRecord #:nodoc: # # With save! validations always run. If any of them fail # ActiveRecord::RecordInvalid gets raised. See ActiveRecord::Validations - # for more information. + # for more information. # # There's a series of callbacks associated with save!. If any of # the before_* callbacks return +false+ the action is cancelled # and save! raises ActiveRecord::RecordNotSaved. See - # ActiveRecord::Callbacks for further details. + # ActiveRecord::Callbacks for further details. def save! create_or_update || raise(RecordNotSaved) end @@ -2726,12 +2791,12 @@ module ActiveRecord #:nodoc: # class User < ActiveRecord::Base # attr_protected :is_admin # end - # + # # user = User.new # user.attributes = { :username => 'Phusion', :is_admin => true } # user.username # => "Phusion" # user.is_admin? # => false - # + # # user.send(:attributes=, { :username => 'Phusion', :is_admin => true }, false) # user.is_admin? # => true def attributes=(new_attributes, guard_protected_attributes = true) diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 9300df28ee..8d8df7dece 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -211,7 +211,7 @@ module ActiveRecord def supports_migrations? #:nodoc: true end - + def supports_savepoints? #:nodoc: true end diff --git a/activerecord/lib/active_record/test_case.rb b/activerecord/lib/active_record/test_case.rb index 8c6abaaccb..b790eb4343 100644 --- a/activerecord/lib/active_record/test_case.rb +++ b/activerecord/lib/active_record/test_case.rb @@ -20,7 +20,7 @@ module ActiveRecord patterns_to_match.each do |pattern| failed_patterns << pattern unless $queries_executed.any?{ |sql| pattern === sql } end - assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map(&:inspect).join(', ')} not found." + assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map(&:inspect).join(', ')} not found in #{$queries_executed}" end def assert_queries(num = 1) diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb index 7141531740..5f08c40005 100644 --- a/activerecord/test/cases/associations/inner_join_association_test.rb +++ b/activerecord/test/cases/associations/inner_join_association_test.rb @@ -26,7 +26,7 @@ class InnerJoinAssociationTest < ActiveRecord::TestCase def test_construct_finder_sql_applies_association_conditions sql = Author.send(:construct_finder_sql, :joins => :categories_like_general, :conditions => "TERMINATING_MARKER") - assert_match /INNER JOIN .?categories.? ON.*AND.*.?General.?.*TERMINATING_MARKER/, sql + assert_match /INNER JOIN .?categories.? ON.*AND.*.?General.?(.|\n)*TERMINATING_MARKER/, sql end def test_construct_finder_sql_applies_aliases_tables_on_association_conditions diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb index 2165d2f7e8..4edf7558f7 100644 --- a/activerecord/test/cases/method_scoping_test.rb +++ b/activerecord/test/cases/method_scoping_test.rb @@ -379,7 +379,7 @@ class NestedScopingTest < ActiveRecord::TestCase poor_jamis = developers(:poor_jamis) Developer.with_scope(:find => { :conditions => "salary < 100000" }) do Developer.with_scope(:find => { :offset => 1, :order => 'id asc' }) do - assert_sql /ORDER BY id asc / do + assert_sql /ORDER BY id asc/ do assert_equal(poor_jamis, Developer.find(:first, :order => 'id asc')) end end diff --git a/arel b/arel index 1b1fc880bf..45646ec54c 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 1b1fc880bf7129a422901417bd6b9fede292aa7e +Subproject commit 45646ec54c4c4a3c7340b79deea9e3cf76554f0b -- cgit v1.2.3 From 19d2ff83db5232a816dee201800baf3924705b31 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 29 Apr 2009 19:39:53 -0300 Subject: Calculations now use Arel to construct the query. Implemented other methods in AR::Base with Arel support. --- activerecord/lib/active_record/associations.rb | 28 +-- activerecord/lib/active_record/base.rb | 31 ++-- activerecord/lib/active_record/calculations.rb | 197 +++++++++------------ activerecord/lib/active_record/test_case.rb | 2 +- .../has_many_through_associations_test.rb | 44 ++--- activerecord/test/cases/calculations_test.rb | 2 +- activerecord/test/cases/inheritance_test.rb | 4 +- activerecord/test/cases/named_scope_test.rb | 2 +- arel | 2 +- 9 files changed, 150 insertions(+), 162 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 2115878e32..2dd1197192 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -510,14 +510,14 @@ module ActiveRecord # # Since only one table is loaded at a time, conditions or orders cannot reference tables other than the main one. If this is the case # Active Record falls back to the previously used LEFT OUTER JOIN based strategy. For example - # + # # Post.find(:all, :include => [ :author, :comments ], :conditions => ['comments.approved = ?', true]) # # will result in a single SQL query with joins along the lines of: LEFT OUTER JOIN comments ON comments.post_id = posts.id and # LEFT OUTER JOIN authors ON authors.id = posts.author_id. Note that using conditions like this can have unintended consequences. # In the above example posts with no approved comments are not returned at all, because the conditions apply to the SQL statement as a whole # and not just to the association. You must disambiguate column references for this fallback to happen, for example - # :order => "author.name DESC" will work but :order => "name DESC" will not. + # :order => "author.name DESC" will work but :order => "name DESC" will not. # # If you do want eagerload only some members of an association it is usually more natural to :include an association # which has conditions defined on it: @@ -551,10 +551,10 @@ module ActiveRecord # # Address.find(:all, :include => :addressable) # - # will execute one query to load the addresses and load the addressables with one query per addressable type. + # will execute one query to load the addresses and load the addressables with one query per addressable type. # For example if all the addressables are either of class Person or Company then a total of 3 queries will be executed. The list of # addressable types to load is determined on the back of the addresses loaded. This is not supported if Active Record has to fallback - # to the previous implementation of eager loading and will raise ActiveRecord::EagerLoadPolymorphicError. The reason is that the parent + # to the previous implementation of eager loading and will raise ActiveRecord::EagerLoadPolymorphicError. The reason is that the parent # model's type is a column value so its corresponding table name cannot be put in the +FROM+/+JOIN+ clauses of that query. # # == Table Aliasing @@ -869,7 +869,7 @@ module ActiveRecord # but not include the joined columns. Do not forget to include the primary and foreign keys, otherwise it will raise an error. # [:through] # Specifies a Join Model through which to perform the query. Options for :class_name and :foreign_key - # are ignored, as the association uses the source reflection. You can only use a :through query through a + # are ignored, as the association uses the source reflection. You can only use a :through query through a # has_one or belongs_to association on the join model. # [:source] # Specifies the source association name used by has_one :through queries. Only use it if the name cannot be @@ -1123,8 +1123,8 @@ module ActiveRecord # the association will use "project_id" as the default :association_foreign_key. # [:conditions] # Specify the conditions that the associated object must meet in order to be included as a +WHERE+ - # SQL fragment, such as authorized = 1. Record creations from the association are scoped if a hash is used. - # has_many :posts, :conditions => {:published => true} will create published posts with @blog.posts.create + # SQL fragment, such as authorized = 1. Record creations from the association are scoped if a hash is used. + # has_many :posts, :conditions => {:published => true} will create published posts with @blog.posts.create # or @blog.posts.build. # [:order] # Specify the order in which the associated objects are returned as an ORDER BY SQL fragment, @@ -1335,12 +1335,12 @@ module ActiveRecord "#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name}) && #{reflection.class_name}.respond_to?(:attr_readonly)" ) end - + def add_touch_callbacks(reflection, touch_attribute) method_name = "belongs_to_touch_after_save_or_destroy_for_#{reflection.name}".to_sym define_method(method_name) do association = send(reflection.name) - + if touch_attribute == true association.touch unless association.nil? else @@ -1552,7 +1552,7 @@ module ActiveRecord options[:extend] = create_extension_modules(association_id, extension, options[:extend]) reflection = create_reflection(:has_and_belongs_to_many, association_id, options, self) - + if reflection.association_foreign_key == reflection.primary_key_name raise HasAndBelongsToManyAssociationForeignKeyNeeded.new(reflection) end @@ -1607,6 +1607,14 @@ module ActiveRecord end end + def construct_limited_ids_condition(where, options, join_dependency) + unless (id_list = select_limited_ids_list(options, join_dependency)).empty? + "#{where.blank? ? 'WHERE ' : ' AND '} #{connection.quote_table_name table_name}.#{primary_key} IN (#{id_list}) " + else + throw :invalid_query + end + end + def select_limited_ids_list(options, join_dependency) pk = columns_hash[primary_key] diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8bf92de6d4..8882a00dd5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -904,9 +904,7 @@ module ActiveRecord #:nodoc: # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent # associations or call your before_* or +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) - sql = "DELETE FROM #{quoted_table_name} " - add_conditions!(sql, conditions, scope(:find)) - connection.delete(sql, "#{name} Delete all") + Arel(table_name).where(construct_conditions(conditions, scope(:find))).delete end # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part. @@ -1687,19 +1685,27 @@ module ActiveRecord #:nodoc: end end - def construct_finder_sql(options) + def arel_table(table) + Arel(table) + end + + def construct_finder_arel(options) scope = scope(:find) # TODO add lock to Arel - Arel(table_name). - join(construct_join(options[:joins], scope)). - where(construct_conditions(options[:conditions], scope)). + arel_table(options[:from] || table_name). + join(options[:merged_joins] || construct_join(options[:joins], scope)). + where(options[:merged_conditions] || construct_conditions(options[:conditions], scope)). project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). group(construct_group(options[:group], options[:having], scope)). order(construct_order(options[:order], scope)). take(construct_limit(options, scope)). skip(construct_offset(options, scope) - ).to_sql + ) + end + + def construct_finder_sql(options) + construct_finder_arel(options).to_sql end def construct_join(joins, scope = :auto) @@ -1715,6 +1721,8 @@ module ActiveRecord #:nodoc: end when String " #{merged_joins} " + else + "" end end @@ -2644,11 +2652,8 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - connection.delete( - "DELETE FROM #{self.class.quoted_table_name} " + - "WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}", - "#{self.class.name} Destroy" - ) + table = Arel(self.class.table_name) + table.where(table[self.class.primary_key].eq(quoted_id)).delete end freeze diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index f077818d3b..9dbfcdf175 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -54,7 +54,7 @@ module ActiveRecord # # Person.average('age') # => 35.8 def average(column_name, options = {}) - calculate(:avg, column_name, options) + calculate(:average, column_name, options) end # Calculates the minimum value on a given column. The value is returned @@ -63,7 +63,7 @@ module ActiveRecord # # Person.minimum('age') # => 7 def minimum(column_name, options = {}) - calculate(:min, column_name, options) + calculate(:minimum, column_name, options) end # Calculates the maximum value on a given column. The value is returned @@ -72,7 +72,7 @@ module ActiveRecord # # Person.maximum('age') # => 93 def maximum(column_name, options = {}) - calculate(:max, column_name, options) + calculate(:maximum, column_name, options) end # Calculates the sum of values on a given column. The value is returned @@ -124,19 +124,96 @@ module ActiveRecord # Person.sum("2 * age") def calculate(operation, column_name, options = {}) validate_calculation_options(operation, options) - column_name = options[:select] if options[:select] - column_name = '*' if column_name == :all - column = column_for column_name + + scope = scope(:find) + + merged_includes = merge_includes(scope ? scope[:include] : [], options[:include]) + joins = construct_join(options[:joins], scope) + + if merged_includes.any? + join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, joins) + joins << join_dependency.join_associations.collect{|join| join.association_join }.join + end + + if operation == :count + if merged_includes.any? + distinct = true + column_name = options[:select] || primary_key + end + + distinct = nil if column_name.to_s =~ /\s*DISTINCT\s+/i + distinct ||= options[:distinct] + else + distinct = nil + end + catch :invalid_query do + conditions = construct_conditions(options[:conditions], scope) + conditions << construct_limited_ids_condition(conditions, options, join_dependency) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + if options[:group] - return execute_grouped_calculation(operation, column_name, column, options) + return execute_grouped_calculation(operation, column_name, options.merge(:merged_conditions => conditions, :merged_joins => joins, :distinct => distinct)) else - return execute_simple_calculation(operation, column_name, column, options) + return execute_simple_calculation(operation, column_name, options.merge(:merged_conditions => conditions, :merged_joins => joins, :distinct => distinct)) end end 0 end + def execute_simple_calculation(operation, column_name, options) #:nodoc: + table = options[:from] || table_name + value = if operation == :count + if column_name == :all && options[:select].blank? + column_name = "*" + elsif !options[:select].blank? + column_name = options[:select] + end + construct_finder_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).count(options[:distinct]))).select_value + else + construct_finder_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).send(operation))).select_value + end + + type_cast_calculated_value(value, column_for(column_name), operation) + end + + def execute_grouped_calculation(operation, column_name, options) #:nodoc: + group_attr = options[:group].to_s + association = reflect_on_association(group_attr.to_sym) + associated = association && association.macro == :belongs_to # only count belongs_to associations + group_field = associated ? association.primary_key_name : group_attr + group_alias = column_alias_for(group_field) + group_column = column_for group_field + + options[:group] = connection.adapter_name == 'FrontBase' ? group_alias : group_field + + aggregate_alias = column_alias_for(operation, column_name) + if operation == :count && column_name == :all + options[:select] = "COUNT(*) AS count_all, #{group_field} AS #{group_alias}" + else + arel_column = Arel::Attribute.new(Arel(table_name), column_name).send(operation) + options[:select] = "#{arel_column.as(aggregate_alias).to_sql}, #{group_field} AS #{group_alias}" + end + + + sql = construct_finder_arel(options) + + calculated_data = connection.select_all(sql.to_sql) + + if association + key_ids = calculated_data.collect { |row| row[group_alias] } + key_records = association.klass.base_class.find(key_ids) + key_records = key_records.inject({}) { |hsh, r| hsh.merge(r.id => r) } + end + + calculated_data.inject(ActiveSupport::OrderedHash.new) do |all, row| + key = type_cast_calculated_value(row[group_alias], group_column) + key = key_records[key] if associated + value = row[aggregate_alias] + all[key] = type_cast_calculated_value(value, column_for(column_name), operation) + all + end + end + protected def construct_count_options_from_args(*args) options = {} @@ -167,108 +244,6 @@ module ActiveRecord [column_name || :all, options] end - def construct_calculation_sql(operation, column_name, options) #:nodoc: - operation = operation.to_s.downcase - options = options.symbolize_keys - - scope = scope(:find) - merged_includes = merge_includes(scope ? scope[:include] : [], options[:include]) - aggregate_alias = column_alias_for(operation, column_name) - column_name = "#{connection.quote_table_name(table_name)}.#{column_name}" if column_names.include?(column_name.to_s) - - if operation == 'count' - if merged_includes.any? - options[:distinct] = true - column_name = options[:select] || [connection.quote_table_name(table_name), primary_key] * '.' - end - - if options[:distinct] - use_workaround = !connection.supports_count_distinct? - end - end - - if options[:distinct] && column_name.to_s !~ /\s*DISTINCT\s+/i - distinct = 'DISTINCT ' - end - sql = "SELECT #{operation}(#{distinct}#{column_name}) AS #{aggregate_alias}" - - # A (slower) workaround if we're using a backend, like sqlite, that doesn't support COUNT DISTINCT. - sql = "SELECT COUNT(*) AS #{aggregate_alias}" if use_workaround - - sql << ", #{options[:group_field]} AS #{options[:group_alias]}" if options[:group] - if options[:from] - sql << " FROM #{options[:from]} " - else - sql << " FROM (SELECT #{distinct}#{column_name}" if use_workaround - sql << " FROM #{connection.quote_table_name(table_name)} " - end - - joins = "" - add_joins!(joins, options[:joins], scope) - - if merged_includes.any? - join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, joins) - sql << join_dependency.join_associations.collect{|join| join.association_join }.join - end - - sql << joins unless joins.blank? - - add_conditions!(sql, options[:conditions], scope) - add_limited_ids_condition!(sql, options, join_dependency) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - - if options[:group] - group_key = connection.adapter_name == 'FrontBase' ? :group_alias : :group_field - sql << " GROUP BY #{options[group_key]} " - end - - if options[:group] && options[:having] - having = sanitize_sql_for_conditions(options[:having]) - - # FrontBase requires identifiers in the HAVING clause and chokes on function calls - if connection.adapter_name == 'FrontBase' - having.downcase! - having.gsub!(/#{operation}\s*\(\s*#{column_name}\s*\)/, aggregate_alias) - end - - sql << " HAVING #{having} " - end - - sql << " ORDER BY #{options[:order]} " if options[:order] - add_limit!(sql, options, scope) - sql << ") #{aggregate_alias}_subquery" if use_workaround - sql - end - - def execute_simple_calculation(operation, column_name, column, options) #:nodoc: - value = connection.select_value(construct_calculation_sql(operation, column_name, options)) - type_cast_calculated_value(value, column, operation) - end - - def execute_grouped_calculation(operation, column_name, column, options) #:nodoc: - group_attr = options[:group].to_s - association = reflect_on_association(group_attr.to_sym) - associated = association && association.macro == :belongs_to # only count belongs_to associations - group_field = associated ? association.primary_key_name : group_attr - group_alias = column_alias_for(group_field) - group_column = column_for group_field - sql = construct_calculation_sql(operation, column_name, options.merge(:group_field => group_field, :group_alias => group_alias)) - calculated_data = connection.select_all(sql) - aggregate_alias = column_alias_for(operation, column_name) - - if association - key_ids = calculated_data.collect { |row| row[group_alias] } - key_records = association.klass.base_class.find(key_ids) - key_records = key_records.inject({}) { |hsh, r| hsh.merge(r.id => r) } - end - - calculated_data.inject(ActiveSupport::OrderedHash.new) do |all, row| - key = type_cast_calculated_value(row[group_alias], group_column) - key = key_records[key] if associated - value = row[aggregate_alias] - all[key] = type_cast_calculated_value(value, column, operation) - all - end - end private def validate_calculation_options(operation, options = {}) @@ -304,7 +279,7 @@ module ActiveRecord case operation when 'count' then value.to_i when 'sum' then type_cast_using_column(value || '0', column) - when 'avg' then value && (value.is_a?(Fixnum) ? value.to_f : value).to_d + when 'average' then value && (value.is_a?(Fixnum) ? value.to_f : value).to_d else type_cast_using_column(value, column) end end diff --git a/activerecord/lib/active_record/test_case.rb b/activerecord/lib/active_record/test_case.rb index b790eb4343..2dfe2c09ea 100644 --- a/activerecord/lib/active_record/test_case.rb +++ b/activerecord/lib/active_record/test_case.rb @@ -20,7 +20,7 @@ module ActiveRecord patterns_to_match.each do |pattern| failed_patterns << pattern unless $queries_executed.any?{ |sql| pattern === sql } end - assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map(&:inspect).join(', ')} not found in #{$queries_executed}" + assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map(&:inspect).join(', ')} not found.#{$queries_executed.size == 0 ? '' : "\nQueries:\n#{$queries_executed.join("\n")}"}" end def assert_queries(num = 1) diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 97efca7891..b075db24e7 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -23,49 +23,49 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert_queries(1) do posts(:thinking).people << people(:david) end - + assert_queries(1) do assert posts(:thinking).people.include?(people(:david)) end - + assert posts(:thinking).reload.people(true).include?(people(:david)) end def test_associating_new assert_queries(1) { posts(:thinking) } new_person = nil # so block binding catches it - + assert_queries(0) do new_person = Person.new :first_name => 'bob' end - + # Associating new records always saves them # Thus, 1 query for the new person record, 1 query for the new join table record assert_queries(2) do posts(:thinking).people << new_person end - + assert_queries(1) do assert posts(:thinking).people.include?(new_person) end - + assert posts(:thinking).reload.people(true).include?(new_person) end def test_associate_new_by_building assert_queries(1) { posts(:thinking) } - + assert_queries(0) do posts(:thinking).people.build(:first_name=>"Bob") posts(:thinking).people.new(:first_name=>"Ted") end - + # Should only need to load the association once assert_queries(1) do assert posts(:thinking).people.collect(&:first_name).include?("Bob") assert posts(:thinking).people.collect(&:first_name).include?("Ted") end - + # 2 queries for each new record (1 to save the record itself, 1 for the join model) # * 2 new records = 4 # + 1 query to save the actual post = 5 @@ -73,22 +73,22 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase posts(:thinking).body += '-changed' posts(:thinking).save end - + assert posts(:thinking).reload.people(true).collect(&:first_name).include?("Bob") assert posts(:thinking).reload.people(true).collect(&:first_name).include?("Ted") end def test_delete_association assert_queries(2){posts(:welcome);people(:michael); } - + assert_queries(1) do posts(:welcome).people.delete(people(:michael)) end - + assert_queries(1) do assert posts(:welcome).people.empty? end - + assert posts(:welcome).reload.people(true).empty? end @@ -112,36 +112,36 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase def test_replace_association assert_queries(4){posts(:welcome);people(:david);people(:michael); posts(:welcome).people(true)} - + # 1 query to delete the existing reader (michael) # 1 query to associate the new reader (david) assert_queries(2) do posts(:welcome).people = [people(:david)] end - + assert_queries(0){ assert posts(:welcome).people.include?(people(:david)) assert !posts(:welcome).people.include?(people(:michael)) } - + assert posts(:welcome).reload.people(true).include?(people(:david)) assert !posts(:welcome).reload.people(true).include?(people(:michael)) end def test_associate_with_create assert_queries(1) { posts(:thinking) } - + # 1 query for the new record, 1 for the join table record # No need to update the actual collection yet! assert_queries(2) do posts(:thinking).people.create(:first_name=>"Jeb") end - + # *Now* we actually need the collection so it's loaded assert_queries(1) do assert posts(:thinking).people.collect(&:first_name).include?("Jeb") end - + assert posts(:thinking).reload.people(true).collect(&:first_name).include?("Jeb") end @@ -159,15 +159,15 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase def test_clear_associations assert_queries(2) { posts(:welcome);posts(:welcome).people(true) } - + assert_queries(1) do posts(:welcome).people.clear end - + assert_queries(0) do assert posts(:welcome).people.empty? end - + assert posts(:welcome).reload.people(true).empty? end diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 56dcdea110..622e3f3a1c 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -25,7 +25,7 @@ class CalculationsTest < ActiveRecord::TestCase def test_should_return_nil_as_average assert_nil NumericData.average(:bank_balance) end - + def test_type_cast_calculated_value_should_convert_db_averages_of_fixnum_class_to_decimal assert_equal 0, NumericData.send(:type_cast_calculated_value, 0, nil, 'avg') assert_equal 53.0, NumericData.send(:type_cast_calculated_value, 53, nil, 'avg') diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index eae5a60829..1943af2b9c 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -30,7 +30,7 @@ class InheritanceTest < ActiveRecord::TestCase ensure ActiveRecord::Base.store_full_sti_class = old end - + def test_should_store_full_class_name_with_store_full_sti_class_option_enabled old = ActiveRecord::Base.store_full_sti_class ActiveRecord::Base.store_full_sti_class = true @@ -39,7 +39,7 @@ class InheritanceTest < ActiveRecord::TestCase ensure ActiveRecord::Base.store_full_sti_class = old end - + def test_different_namespace_subclass_should_load_correctly_with_store_full_sti_class_option old = ActiveRecord::Base.store_full_sti_class ActiveRecord::Base.store_full_sti_class = true diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index ae6a54a5bd..4929f09812 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -338,7 +338,7 @@ class NamedScopeTest < ActiveRecord::TestCase end end -class DynamicScopeMatchTest < ActiveRecord::TestCase +class DynamicScopeMatchTest < ActiveRecord::TestCase def test_scoped_by_no_match assert_nil ActiveRecord::DynamicScopeMatch.match("not_scoped_at_all") end diff --git a/arel b/arel index 45646ec54c..b4b73d9520 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 45646ec54c4c4a3c7340b79deea9e3cf76554f0b +Subproject commit b4b73d9520a2ff27021b530ccd3dcd96973ce5fe -- cgit v1.2.3 From 5b61168aafb28b9d4dcbe7651d6a5a63cdb68b32 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 30 Apr 2009 13:21:13 -0300 Subject: Added arel_attributes_values methods, refactored locking and AR#update to use this method --- activerecord/lib/active_record/base.rb | 32 ++++++++++++++++------ .../lib/active_record/locking/optimistic.rb | 9 +----- arel | 2 +- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8882a00dd5..5807d62f2a 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1077,7 +1077,7 @@ module ActiveRecord #:nodoc: # Returns an array of all the attributes that have been specified as readonly. def readonly_attributes - read_inheritable_attribute(:attr_readonly) + read_inheritable_attribute(:attr_readonly) || [] end # If you have an attribute that needs to be saved to the database as an object, and retrieved as the same object, @@ -2946,14 +2946,9 @@ module ActiveRecord #:nodoc: # Updates the associated record with values matching those of the instance attributes. # Returns the number of affected rows. def update(attribute_names = @attributes.keys) - quoted_attributes = attributes_with_quotes(false, false, attribute_names) - return 0 if quoted_attributes.empty? - connection.update( - "UPDATE #{self.class.quoted_table_name} " + - "SET #{quoted_comma_pair_list(connection, quoted_attributes)} " + - "WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)}", - "#{self.class.name} Update" - ) + attributes_with_values = arel_attributes_values(false, false, attribute_names) + return 0 if attributes_with_values.empty? + table.where(table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes @@ -3063,6 +3058,25 @@ module ActiveRecord #:nodoc: include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) end + def table + @arel_table ||= Arel(self.class.table_name) + end + + def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) + attrs = {} + connection = self.class.connection + attribute_names.each do |name| + if (column = column_for_attribute(name)) && (include_primary_key || !column.primary) + value = read_attribute(name) + + if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name)) + attrs[table[name]] = value + end + end + end + attrs + end + # Quote strings appropriately for SQL statements. def quote_value(value, column = nil) self.class.connection.quote(value, column) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 1251e9f013..bb28444b07 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,18 +89,11 @@ module ActiveRecord attribute_names.uniq! begin - table = Arel(self.class.table_name) - - attributes = {} - attributes_with_quotes(false, false, attribute_names).map { |k,v| - attributes.merge!(table[k] => v) - } - affected_rows = table.where( table[self.class.primary_key].eq(quoted_id).and( table[self.class.locking_column].eq(quote_value(previous_value)) ) - ).update(attributes) + ).update(arel_attributes_values(false, false, attribute_names)) unless affected_rows == 1 diff --git a/arel b/arel index b4b73d9520..092c2be685 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit b4b73d9520a2ff27021b530ccd3dcd96973ce5fe +Subproject commit 092c2be685e8e359c161144ce58addac6caa5c44 -- cgit v1.2.3 From ca0530a53f6b019b0f5eb9a8c5c8b0081cd20d12 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 30 Apr 2009 13:47:51 -0300 Subject: exists? method now uses ARel --- activerecord/lib/active_record/base.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 5807d62f2a..26c11e2dda 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -688,14 +688,9 @@ module ActiveRecord #:nodoc: # Person.exists?(['name LIKE ?', "%#{query}%"]) # Person.exists? def exists?(id_or_conditions = {}) - connection.select_all( - construct_finder_sql( - :select => "#{quoted_table_name}.#{primary_key}", - :conditions => expand_id_conditions(id_or_conditions), - :limit => 1 - ), - "#{name} Exists" - ).size > 0 + construct_finder_arel({ + :conditions =>expand_id_conditions(id_or_conditions) + }).project(arel_table[primary_key]).take(1).count > 0 end # Creates an object (or multiple objects) and saves it to the database, if validations pass. @@ -1685,8 +1680,8 @@ module ActiveRecord #:nodoc: end end - def arel_table(table) - Arel(table) + def arel_table(table = table_name) + @arel_table = Arel(table) end def construct_finder_arel(options) -- cgit v1.2.3 From 64c9a40137e96710f93afe1bda907b3e9f7b3013 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 30 Apr 2009 20:31:32 -0700 Subject: Make ruby-debug optional --- activerecord/test/cases/helper.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 2f9145a874..2b623ea703 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -15,8 +15,11 @@ require 'connection' require 'cases/repair_helper' -# TODO remove the debugger -require 'ruby-debug' +# Expose the debugger if available +begin + require 'ruby-debug' +rescue LoadError +end # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true -- cgit v1.2.3 From 59b58dfa8915921798cc26142457607bc7085eb9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 30 Apr 2009 20:31:47 -0700 Subject: Use public submodule url --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 7184520aa2..30755285a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "arel"] path = arel - url = git@github.com:miloops/arel.git + url = git://github.com/miloops/arel.git -- cgit v1.2.3 From 4bb6f77059a34ea7c8575523397032b4cc67e00a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 30 Apr 2009 20:32:19 -0700 Subject: Work around count returning string (bug) --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 26c11e2dda..4c23d2f8e2 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -690,7 +690,7 @@ module ActiveRecord #:nodoc: def exists?(id_or_conditions = {}) construct_finder_arel({ :conditions =>expand_id_conditions(id_or_conditions) - }).project(arel_table[primary_key]).take(1).count > 0 + }).project(arel_table[primary_key]).take(1).count.to_i > 0 end # Creates an object (or multiple objects) and saves it to the database, if validations pass. -- cgit v1.2.3 From 509c389bf8093d7995a52470c27c221adc972796 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 30 Apr 2009 20:33:50 -0700 Subject: Explicitly require builder for to_xml --- activerecord/lib/active_record/validations.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index d2d12b80c9..e6b61e0b35 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -1,3 +1,5 @@ +require 'builder' + module ActiveRecord # Raised by save! and create! when the record is invalid. Use the # +record+ method to retrieve the record which did not validate. -- cgit v1.2.3 From 7a7382b2136cea1124d466a1d9093c89a0851d31 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 30 Apr 2009 21:02:11 -0700 Subject: Selectively require rake sshpublisher so full gem isn't required --- activerecord/Rakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/activerecord/Rakefile b/activerecord/Rakefile index b50008c971..5905c67e29 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -4,7 +4,6 @@ require 'rake/testtask' require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' -require 'rake/contrib/sshpublisher' require File.join(File.dirname(__FILE__), 'lib', 'active_record', 'version') require File.expand_path(File.dirname(__FILE__)) + "/test/config" @@ -231,12 +230,14 @@ end desc "Publish the beta gem" task :pgem => [:package] do + require 'rake/contrib/sshpublisher' Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'` end desc "Publish the API documentation" task :pdoc => [:rdoc] do + require 'rake/contrib/sshpublisher' Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/ar", "doc").upload end -- cgit v1.2.3 From 9f36431f58c406312d0b0317543b7f69107e61e9 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Sat, 2 May 2009 03:15:19 -0300 Subject: Updated ARel --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index 092c2be685..f44853a5aa 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 092c2be685e8e359c161144ce58addac6caa5c44 +Subproject commit f44853a5aa7f4481d99a3af4585f3a51272bc7f7 -- cgit v1.2.3 From c9896884a46eb96508fc3e0d2a10be47eb195826 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Sat, 2 May 2009 03:40:31 -0300 Subject: Removed ARel table assignment --- activerecord/lib/active_record/locking/optimistic.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index bb28444b07..f66458cc8c 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -116,7 +116,6 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - table = Arel(self.class.table_name) affected_rows = table.where( table[self.class.primary_key].eq(quoted_id).and( table[self.class.locking_column].eq(quote_value(previous_value)) -- cgit v1.2.3 From 3fd467e9ed7f3a8d408ab2cb0782a5b13bb3f629 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Sat, 2 May 2009 04:02:09 -0300 Subject: Refactor to use arel_table method, and also use the same method name for instance and class methods. --- activerecord/lib/active_record/base.rb | 11 +++++------ activerecord/lib/active_record/calculations.rb | 16 +++++++--------- activerecord/lib/active_record/locking/optimistic.rb | 12 ++++++------ 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4c23d2f8e2..b1ae2fbe78 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -899,7 +899,7 @@ module ActiveRecord #:nodoc: # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent # associations or call your before_* or +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) - Arel(table_name).where(construct_conditions(conditions, scope(:find))).delete + arel_table.where(construct_conditions(conditions, scope(:find))).delete end # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part. @@ -2647,8 +2647,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - table = Arel(self.class.table_name) - table.where(table[self.class.primary_key].eq(quoted_id)).delete + arel_table.where(arel_table[self.class.primary_key].eq(id)).delete end freeze @@ -2943,7 +2942,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - table.where(table[self.class.primary_key].eq(id)).update(attributes_with_values) + arel_table.where(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes @@ -3053,7 +3052,7 @@ module ActiveRecord #:nodoc: include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) end - def table + def arel_table @arel_table ||= Arel(self.class.table_name) end @@ -3065,7 +3064,7 @@ module ActiveRecord #:nodoc: value = read_attribute(name) if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name)) - attrs[table[name]] = value + attrs[arel_table[name]] = value end end end diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 9dbfcdf175..6bd2163dc2 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -124,6 +124,7 @@ module ActiveRecord # Person.sum("2 * age") def calculate(operation, column_name, options = {}) validate_calculation_options(operation, options) + operation = operation.to_s.downcase scope = scope(:find) @@ -135,7 +136,7 @@ module ActiveRecord joins << join_dependency.join_associations.collect{|join| join.association_join }.join end - if operation == :count + if operation == "count" if merged_includes.any? distinct = true column_name = options[:select] || primary_key @@ -162,7 +163,7 @@ module ActiveRecord def execute_simple_calculation(operation, column_name, options) #:nodoc: table = options[:from] || table_name - value = if operation == :count + value = if operation == 'count' if column_name == :all && options[:select].blank? column_name = "*" elsif !options[:select].blank? @@ -187,17 +188,15 @@ module ActiveRecord options[:group] = connection.adapter_name == 'FrontBase' ? group_alias : group_field aggregate_alias = column_alias_for(operation, column_name) - if operation == :count && column_name == :all + + if operation == 'count' && column_name == :all options[:select] = "COUNT(*) AS count_all, #{group_field} AS #{group_alias}" else - arel_column = Arel::Attribute.new(Arel(table_name), column_name).send(operation) + arel_column = Arel::Attribute.new(arel_table, column_name).send(operation) options[:select] = "#{arel_column.as(aggregate_alias).to_sql}, #{group_field} AS #{group_alias}" end - - sql = construct_finder_arel(options) - - calculated_data = connection.select_all(sql.to_sql) + calculated_data = connection.select_all(construct_finder_sql(options)) if association key_ids = calculated_data.collect { |row| row[group_alias] } @@ -275,7 +274,6 @@ module ActiveRecord end def type_cast_calculated_value(value, column, operation = nil) - operation = operation.to_s.downcase case operation when 'count' then value.to_i when 'sum' then type_cast_using_column(value || '0', column) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index f66458cc8c..a4f5dd8516 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,9 +89,9 @@ module ActiveRecord attribute_names.uniq! begin - affected_rows = table.where( - table[self.class.primary_key].eq(quoted_id).and( - table[self.class.locking_column].eq(quote_value(previous_value)) + affected_rows = arel_table.where( + arel_table[self.class.primary_key].eq(quoted_id).and( + arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) ).update(arel_attributes_values(false, false, attribute_names)) @@ -116,9 +116,9 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - affected_rows = table.where( - table[self.class.primary_key].eq(quoted_id).and( - table[self.class.locking_column].eq(quote_value(previous_value)) + affected_rows = arel_table.where( + arel_table[self.class.primary_key].eq(quoted_id).and( + arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) ).delete -- cgit v1.2.3 From d522b7ccf61a71b4c66ddf39368513d1fd9cd577 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Sat, 2 May 2009 12:59:49 -0300 Subject: Revert "Work around count returning string (bug)" This reverts commit 4bb6f77059a34ea7c8575523397032b4cc67e00a. --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index b1ae2fbe78..3b693b5f17 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -690,7 +690,7 @@ module ActiveRecord #:nodoc: def exists?(id_or_conditions = {}) construct_finder_arel({ :conditions =>expand_id_conditions(id_or_conditions) - }).project(arel_table[primary_key]).take(1).count.to_i > 0 + }).project(arel_table[primary_key]).take(1).count > 0 end # Creates an object (or multiple objects) and saves it to the database, if validations pass. -- cgit v1.2.3 From d19d4d2f20d87289eaeaa8df807d635ce72f3799 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 4 May 2009 21:53:29 -0300 Subject: Fixes to have all test passing on PostgreSQL. Calculations now use construct_calculation_arel, making construct_finder_arel less hackish. Updated ARel to support PostgreSQL. --- activerecord/lib/active_record/base.rb | 17 ++++++---------- activerecord/lib/active_record/calculations.rb | 28 ++++++++++++++++++++------ arel | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3b693b5f17..bdfb0f45aa 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -688,9 +688,9 @@ module ActiveRecord #:nodoc: # Person.exists?(['name LIKE ?', "%#{query}%"]) # Person.exists? def exists?(id_or_conditions = {}) - construct_finder_arel({ - :conditions =>expand_id_conditions(id_or_conditions) - }).project(arel_table[primary_key]).take(1).count > 0 + connection.select_all(construct_finder_arel({ + :conditions => expand_id_conditions(id_or_conditions) + }).project(arel_table[primary_key]).take(1).to_sql).size > 0 end # Creates an object (or multiple objects) and saves it to the database, if validations pass. @@ -1688,9 +1688,9 @@ module ActiveRecord #:nodoc: scope = scope(:find) # TODO add lock to Arel - arel_table(options[:from] || table_name). - join(options[:merged_joins] || construct_join(options[:joins], scope)). - where(options[:merged_conditions] || construct_conditions(options[:conditions], scope)). + arel_table(table_name). + join(construct_join(options[:joins], scope)). + where(construct_conditions(options[:conditions], scope)). project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). group(construct_group(options[:group], options[:having], scope)). order(construct_order(options[:order], scope)). @@ -1704,7 +1704,6 @@ module ActiveRecord #:nodoc: end def construct_join(joins, scope = :auto) - scope = scope(:find) if :auto == scope merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins]) case merged_joins when Symbol, Hash, Array @@ -1738,7 +1737,6 @@ module ActiveRecord #:nodoc: def construct_order(order, scope = :auto) sql = '' - scope = scope(:find) if :auto == scope scoped_order = scope[:order] if scope if order sql << order.to_s @@ -1752,19 +1750,16 @@ module ActiveRecord #:nodoc: end def construct_limit(options, scope = :auto) - scope = scope(:find) if :auto == scope options[:limit] ||= scope[:limit] if scope options[:limit] end def construct_offset(options, scope = :auto) - scope = scope(:find) if :auto == scope options[:offset] ||= scope[:offset] if scope options[:offset] end def construct_conditions(conditions, scope = :auto) - scope = scope(:find) if :auto == scope conditions = [conditions] conditions << scope[:conditions] if scope conditions << type_condition if finder_needs_type_condition? diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 6bd2163dc2..c941be2837 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -153,9 +153,9 @@ module ActiveRecord conditions << construct_limited_ids_condition(conditions, options, join_dependency) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) if options[:group] - return execute_grouped_calculation(operation, column_name, options.merge(:merged_conditions => conditions, :merged_joins => joins, :distinct => distinct)) + return execute_grouped_calculation(operation, column_name, options.merge(:conditions => conditions, :joins => joins, :distinct => distinct)) else - return execute_simple_calculation(operation, column_name, options.merge(:merged_conditions => conditions, :merged_joins => joins, :distinct => distinct)) + return execute_simple_calculation(operation, column_name, options.merge(:conditions => conditions, :joins => joins, :distinct => distinct)) end end 0 @@ -163,15 +163,16 @@ module ActiveRecord def execute_simple_calculation(operation, column_name, options) #:nodoc: table = options[:from] || table_name + value = if operation == 'count' if column_name == :all && options[:select].blank? column_name = "*" elsif !options[:select].blank? column_name = options[:select] end - construct_finder_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).count(options[:distinct]))).select_value + construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).count(options[:distinct]))).select_value else - construct_finder_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).send(operation))).select_value + construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).send(operation))).select_value end type_cast_calculated_value(value, column_for(column_name), operation) @@ -196,7 +197,7 @@ module ActiveRecord options[:select] = "#{arel_column.as(aggregate_alias).to_sql}, #{group_field} AS #{group_alias}" end - calculated_data = connection.select_all(construct_finder_sql(options)) + calculated_data = connection.select_all(construct_calculation_arel(options).to_sql) if association key_ids = calculated_data.collect { |row| row[group_alias] } @@ -213,7 +214,22 @@ module ActiveRecord end end - protected + protected + + def construct_calculation_arel(options) + scope = scope(:find) + + arel_table(options[:from] || table_name). + join(options[:joins]). + where(options[:conditions]). + project(options[:select]). + group(construct_group(options[:group], options[:having], scope)). + order(options[:order].to_s). + take(construct_limit(options, scope)). + skip(construct_offset(options, scope) + ) + end + def construct_count_options_from_args(*args) options = {} column_name = :all diff --git a/arel b/arel index f44853a5aa..de843c8651 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit f44853a5aa7f4481d99a3af4585f3a51272bc7f7 +Subproject commit de843c86518e4ac871d4bb5b0873bb6c184ac304 -- cgit v1.2.3 From 8885b2d6c1855742600d0afdb9dfc002acb62e5e Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 6 May 2009 14:16:03 -0300 Subject: Refactor to calculations. Migration's versions are string not integer. ARel submodule updated. --- activerecord/lib/active_record/calculations.rb | 17 ++++++++--------- .../connection_adapters/postgresql_adapter.rb | 20 ++++++++++---------- activerecord/lib/active_record/migration.rb | 10 +++++----- arel | 2 +- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index c941be2837..9d04686a5f 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -170,12 +170,12 @@ module ActiveRecord elsif !options[:select].blank? column_name = options[:select] end - construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).count(options[:distinct]))).select_value + construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).count(options[:distinct]))) else - construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).send(operation))).select_value + construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).send(operation))) end - type_cast_calculated_value(value, column_for(column_name), operation) + type_cast_calculated_value(connection.select_value(value.to_sql), column_for(column_name), operation) end def execute_grouped_calculation(operation, column_name, options) #:nodoc: @@ -190,12 +190,11 @@ module ActiveRecord aggregate_alias = column_alias_for(operation, column_name) - if operation == 'count' && column_name == :all - options[:select] = "COUNT(*) AS count_all, #{group_field} AS #{group_alias}" - else - arel_column = Arel::Attribute.new(arel_table, column_name).send(operation) - options[:select] = "#{arel_column.as(aggregate_alias).to_sql}, #{group_field} AS #{group_alias}" - end + options[:select] = (operation == 'count' && column_name == :all) ? + "COUNT(*) AS count_all" : + Arel::Attribute.new(arel_table, column_name).send(operation).as(aggregate_alias).to_sql + + options[:select] << ", #{group_field} AS #{group_alias}" calculated_data = connection.select_all(construct_calculation_arel(options).to_sql) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 4961793866..12b2c4a4d1 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -67,7 +67,7 @@ module ActiveRecord # depending on the server specifics super end - + # Maps PostgreSQL-specific data types to logical Rails types. def simplified_type(field_type) case field_type @@ -102,7 +102,7 @@ module ActiveRecord :string # Arrays when /^\D+\[\]$/ - :string + :string # Object identifier types when /^oid$/ :integer @@ -111,7 +111,7 @@ module ActiveRecord super end end - + # Extracts the value from a PostgreSQL column default definition. def self.extract_value_from_default(default) case default @@ -272,7 +272,7 @@ module ActiveRecord def supports_ddl_transactions? true end - + def supports_savepoints? true end @@ -551,7 +551,7 @@ module ActiveRecord def rollback_db_transaction execute "ROLLBACK" end - + if defined?(PGconn::PQTRANS_IDLE) # The ruby-pg driver supports inspecting the transaction status, # while the ruby-postgres driver does not. @@ -896,18 +896,18 @@ module ActiveRecord sql = "DISTINCT ON (#{columns}) #{columns}, " sql << order_columns * ', ' end - + # Returns an ORDER BY clause for the passed order option. - # + # # PostgreSQL does not allow arbitrary ordering when using DISTINCT ON, so we work around this # by wrapping the +sql+ string as a sub-select and ordering in that query. def add_order_by_for_association_limiting!(sql, options) #:nodoc: return sql if options[:order].blank? - + order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?) order.map! { |s| 'DESC' if s =~ /\bdesc$/i } order = order.zip((0...order.size).to_a).map { |s,i| "id_list.alias_#{i} #{s}" }.join(', ') - + sql.replace "SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}" end @@ -1020,7 +1020,7 @@ module ActiveRecord if res.ftype(cell_index) == MONEY_COLUMN_TYPE_OID # Because money output is formatted according to the locale, there are two # cases to consider (note the decimal separators): - # (1) $12,345,678.12 + # (1) $12,345,678.12 # (2) $12.345.678,12 case column = row[cell_index] when /^-?\D+[\d,]+\.\d{2}$/ # (1) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index aa9e9e8fdd..ce02fe019f 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -410,7 +410,7 @@ module ActiveRecord def get_all_versions table = Arel(schema_migrations_table_name) - table.project(table['version']).select_values.map(&:to_i).sort + Base.connection.select_values(table.project(table['version']).to_sql).map(&:to_i).sort end def current_version @@ -535,11 +535,11 @@ module ActiveRecord @migrated_versions ||= [] if down? - @migrated_versions.delete(version.to_i) - table.where(table["version"].eq(version)).delete + @migrated_versions.delete(version) + table.where(table["version"].eq(version.to_s)).delete else - @migrated_versions.push(version.to_i).sort! - table.insert table["version"] => version + @migrated_versions.push(version).sort! + table.insert table["version"] => version.to_s end end diff --git a/arel b/arel index de843c8651..a7dea38204 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit de843c86518e4ac871d4bb5b0873bb6c184ac304 +Subproject commit a7dea38204f3c40e4d0c3f29ebe17af818659697 -- cgit v1.2.3 From 522711952bf315bc52353e941183237a41f61b23 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 2 Jun 2009 11:40:01 -0300 Subject: Refactors to work with latest Arel implementation. --- activerecord/lib/active_record/base.rb | 12 ++++++++---- activerecord/lib/active_record/calculations.rb | 19 +++++++++---------- .../abstract/database_statements.rb | 4 ++-- .../connection_adapters/mysql_adapter.rb | 1 + .../connection_adapters/postgresql_adapter.rb | 1 + .../connection_adapters/sqlite_adapter.rb | 5 +++-- activerecord/lib/active_record/migration.rb | 4 ++-- arel | 2 +- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 56f3bd9faa..81969d11c5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -909,7 +909,11 @@ module ActiveRecord #:nodoc: # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent # associations or call your before_* or +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) - arel_table.where(construct_conditions(conditions, scope(:find))).delete + if conditions + arel_table.where(Arel::SqlLiteral.new(construct_conditions(conditions, scope(:find)))).delete + else + arel_table.delete + end end # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part. @@ -1691,7 +1695,7 @@ module ActiveRecord #:nodoc: end def arel_table(table = table_name) - @arel_table = Arel(table) + @arel_table = Arel::Table.new(table, ActiveRecord::Base.connection) end def construct_finder_arel(options) @@ -3058,7 +3062,7 @@ module ActiveRecord #:nodoc: end def arel_table - @arel_table ||= Arel(self.class.table_name) + @arel_table ||= Arel::Table.new(self.class.table_name, ActiveRecord::Base.connection) end def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) @@ -3069,7 +3073,7 @@ module ActiveRecord #:nodoc: value = read_attribute(name) if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name)) - attrs[arel_table[name]] = value + attrs[arel_table[name]] = value.is_a?(Hash) ? value.to_yaml : value end end end diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 98f9450662..8b8fb37d2d 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -161,19 +161,18 @@ module ActiveRecord end def execute_simple_calculation(operation, column_name, options) #:nodoc: - table = options[:from] || table_name - - value = if operation == 'count' - if column_name == :all && options[:select].blank? - column_name = "*" - elsif !options[:select].blank? - column_name = options[:select] - end - construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).count(options[:distinct]))) + column = if column_names.include?(column_name.to_s) + Arel::Attribute.new(arel_table(options[:from] || table_name), + options[:select] || column_name) else - construct_calculation_arel(options.merge(:select => Arel::Attribute.new(Arel(table), column_name).send(operation))) + Arel::SqlLiteral.new(options[:select] || + (column_name == :all ? "*" : column_name.to_s)) end + value = construct_calculation_arel(options.merge( + :select => operation == 'count' ? column.count(options[:distinct]) : column.send(operation) + )) + type_cast_calculated_value(connection.select_value(value.to_sql), column_for(column_name), operation) end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 08601da00a..ce04a8109d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -53,7 +53,7 @@ module ActiveRecord def delete(sql, name = nil) delete_sql(sql, name) end - + # Checks whether there is currently no transaction active. This is done # by querying the database driver, and does not use the transaction # house-keeping information recorded by #increment_open_transactions and @@ -170,7 +170,7 @@ module ActiveRecord end end end - + # Begins the transaction (and turns off auto-committing). def begin_db_transaction() end diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 0aae97a6a9..6d28e01544 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -331,6 +331,7 @@ module ActiveRecord super sql, name id_value || @connection.insert_id end + alias :create :insert_sql def update_sql(sql, name = nil) #:nodoc: super diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 4b2ddac634..763db3900d 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -486,6 +486,7 @@ module ActiveRecord end end end + alias :create :insert # create a 2D array representing the result set def result_as_array(res) #:nodoc: diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index c9d0c9574f..cabb63bfaf 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -109,7 +109,7 @@ module ActiveRecord def supports_add_column? sqlite_version >= '3.1.6' end - + def disconnect! super @connection.close rescue nil @@ -181,6 +181,7 @@ module ActiveRecord def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) #:nodoc: super || @connection.last_insert_row_id end + alias :create :insert_sql def select_rows(sql, name = nil) execute(sql, name).map do |row| @@ -355,7 +356,7 @@ module ActiveRecord (options[:rename][column.name] || options[:rename][column.name.to_sym] || column.name) : column.name - + @definition.column(column_name, column.type, :limit => column.limit, :default => column.default, :null => column.null) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 557ab07abf..b069736778 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -409,7 +409,7 @@ module ActiveRecord end def get_all_versions - table = Arel(schema_migrations_table_name) + table = Arel::Table.new(schema_migrations_table_name, Base.connection) Base.connection.select_values(table.project(table['version']).to_sql).map(&:to_i).sort end @@ -531,7 +531,7 @@ module ActiveRecord private def record_version_state_after_migrating(version) - table = Arel(self.class.schema_migrations_table_name) + table = Arel::Table.new(self.class.schema_migrations_table_name, Base.connection) @migrated_versions ||= [] if down? diff --git a/arel b/arel index 4b8526dddd..c55226bac0 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 4b8526dddd6a906a1879ec786401070b3545d7f4 +Subproject commit c55226bac0cfac67081b01860baa61f3acbb2ca9 -- cgit v1.2.3 From bbe51a1b9de7d3d825533dfee28968fed22acc0d Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 2 Jun 2009 12:27:26 -0300 Subject: No need to specify the engine now that it is in active_record.rb --- activerecord/lib/active_record/migration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index b069736778..55512ab447 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -409,7 +409,7 @@ module ActiveRecord end def get_all_versions - table = Arel::Table.new(schema_migrations_table_name, Base.connection) + table = Arel::Table.new(schema_migrations_table_name) Base.connection.select_values(table.project(table['version']).to_sql).map(&:to_i).sort end @@ -531,7 +531,7 @@ module ActiveRecord private def record_version_state_after_migrating(version) - table = Arel::Table.new(self.class.schema_migrations_table_name, Base.connection) + table = Arel::Table.new(self.class.schema_migrations_table_name) @migrated_versions ||= [] if down? -- cgit v1.2.3 From 2474fbb4d60f7431af34886f0dccecfe037c565f Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 2 Jun 2009 12:29:09 -0300 Subject: Set ActiveRecord as Arel engine on load. --- activerecord/lib/active_record.rb | 1 + activerecord/lib/active_record/base.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 05afd20f23..81fe921fd8 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -77,4 +77,5 @@ module ActiveRecord end end +Arel::Table.engine = Arel::Sql::Engine.new(ActiveRecord::Base) I18n.load_path << File.dirname(__FILE__) + '/active_record/locale/en.yml' diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 81969d11c5..adc7f5335d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1695,7 +1695,7 @@ module ActiveRecord #:nodoc: end def arel_table(table = table_name) - @arel_table = Arel::Table.new(table, ActiveRecord::Base.connection) + @arel_table = Arel::Table.new(table) end def construct_finder_arel(options) @@ -3062,7 +3062,7 @@ module ActiveRecord #:nodoc: end def arel_table - @arel_table ||= Arel::Table.new(self.class.table_name, ActiveRecord::Base.connection) + @arel_table = Arel::Table.new(self.class.table_name) end def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) -- cgit v1.2.3 From 5255a81b808c2c947d58df979e6436b1fe1d8157 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 2 Jun 2009 12:33:51 -0300 Subject: Updated Arel submodule --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index c55226bac0..324f265c1d 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit c55226bac0cfac67081b01860baa61f3acbb2ca9 +Subproject commit 324f265c1de98212f59f42c287d441b85b2350b7 -- cgit v1.2.3 From 8c3b8323f57d366fc308e773b286a1847552b0a3 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 16:36:05 -0300 Subject: Use ARel in SQL generation through associations --- activerecord/lib/active_record/associations.rb | 26 +++++++++++++--------- .../associations/has_many_through_association.rb | 8 +++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index a74e9b76dc..4ed0cb70e9 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1590,19 +1590,23 @@ module ActiveRecord def construct_finder_sql_with_included_associations(options, join_dependency) scope = scope(:find) - sql = "SELECT #{column_aliases(join_dependency)} FROM #{(scope && scope[:from]) || options[:from] || quoted_table_name} " - sql << join_dependency.join_associations.collect{|join| join.association_join }.join - add_joins!(sql, options[:joins], scope) - add_conditions!(sql, options[:conditions], scope) - add_limited_ids_condition!(sql, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + joins = join_dependency.join_associations.collect{|join| join.association_join }.join + joins << construct_join(options[:joins], scope) - add_group!(sql, options[:group], options[:having], scope) - add_order!(sql, options[:order], scope) - add_limit!(sql, options, scope) if using_limitable_reflections?(join_dependency.reflections) - add_lock!(sql, options, scope) + conditions = construct_conditions(options[:conditions], scope) || '' + conditions << construct_limited_ids_condition(conditions, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - return sanitize_sql(sql) + arel = arel_table((scope && scope[:from]) || options[:from] || table_name). + join(joins). + where(conditions). + project(column_aliases(join_dependency)). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope)) + + arel = arel.take(construct_limit(options, scope)) if using_limitable_reflections?(join_dependency.reflections) + + return sanitize_sql(arel.to_sql) end def add_limited_ids_condition!(sql, options, join_dependency) @@ -1615,7 +1619,7 @@ module ActiveRecord def construct_limited_ids_condition(where, options, join_dependency) unless (id_list = select_limited_ids_list(options, join_dependency)).empty? - "#{where.blank? ? 'WHERE ' : ' AND '} #{connection.quote_table_name table_name}.#{primary_key} IN (#{id_list}) " + "#{where.blank? ? '' : ' AND '} #{connection.quote_table_name table_name}.#{primary_key} IN (#{id_list}) " else throw :invalid_query end diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index e8dbae9011..51fb75e1f5 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -32,7 +32,7 @@ module ActiveRecord return @target.size if loaded? return count end - + protected def target_reflection_has_associated_record? if @reflection.through_reflection.macro == :belongs_to && @owner[@reflection.through_reflection.primary_key_name].blank? @@ -48,7 +48,7 @@ module ActiveRecord options[:joins] = construct_joins(options[:joins]) options[:include] = @reflection.source_reflection.options[:include] if options[:include].nil? end - + def insert_record(record, force = true, validate = true) if record.new_record? if force @@ -131,7 +131,7 @@ module ActiveRecord end def construct_from - @reflection.quoted_table_name + @reflection.table_name end def construct_select(custom_select = nil) @@ -239,7 +239,7 @@ module ActiveRecord interpolate_sql(sanitize_sql(conditions)) end end - + def build_sti_condition @reflection.through_reflection.klass.send(:type_condition) end -- cgit v1.2.3 From 7be3e3ba0547587313d87bccb788a8466a62628a Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 17:31:26 -0300 Subject: Use ARel in SQL generation through associations --- activerecord/lib/active_record/base.rb | 38 +++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index adc7f5335d..f0f70e0636 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -839,26 +839,44 @@ module ActiveRecord #:nodoc: # # Update all books that match our conditions, but limit it to 5 ordered by date # Book.update_all "author = 'David'", "title LIKE '%Rails%'", :order => 'created_at', :limit => 5 def update_all(updates, conditions = nil, options = {}) - sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " + # sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " - scope = scope(:find) + # scope = scope(:find) + + # select_sql = "" + # add_conditions!(select_sql, conditions, scope) + + # if options.has_key?(:limit) || (scope && scope[:limit]) + # # Only take order from scope if limit is also provided by scope, this + # # is useful for updating a has_many association with a limit. + # add_order!(select_sql, options[:order], scope) - select_sql = "" - add_conditions!(select_sql, conditions, scope) + # add_limit!(select_sql, options, scope) + # sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) + # else + # add_order!(select_sql, options[:order], nil) + # sql.concat(select_sql) + # end + + # connection.update(sql, "#{name} Update") + scope = scope(:find) + arel = arel_table + arel = arel.where(Arel::SqlLiteral.new(construct_conditions(conditions, scope))) if conditions || scope if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - add_order!(select_sql, options[:order], scope) + arel = arel.order(construct_order(options[:order], scope)) - add_limit!(select_sql, options, scope) - sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) + arel = arel.take(construct_limit(options, scope)) + #arel = arel.where(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) + #sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) else - add_order!(select_sql, options[:order], nil) - sql.concat(select_sql) + arel = arel.order(construct_order(options[:order], nil)) + #sql.concat(select_sql) end - connection.update(sql, "#{name} Update") + arel.update(sanitize_sql_for_assignment(updates)) end # Destroys the records matching +conditions+ by instantiating each -- cgit v1.2.3 From 0587462050ff6f58b277246501d504e6780b481e Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 17:32:20 -0300 Subject: Revert "Use ARel in SQL generation through associations" This reverts commit 7be3e3ba0547587313d87bccb788a8466a62628a. --- activerecord/lib/active_record/base.rb | 38 +++++++++------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index f0f70e0636..adc7f5335d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -839,44 +839,26 @@ module ActiveRecord #:nodoc: # # Update all books that match our conditions, but limit it to 5 ordered by date # Book.update_all "author = 'David'", "title LIKE '%Rails%'", :order => 'created_at', :limit => 5 def update_all(updates, conditions = nil, options = {}) - # sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " + sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " - # scope = scope(:find) - - # select_sql = "" - # add_conditions!(select_sql, conditions, scope) - - # if options.has_key?(:limit) || (scope && scope[:limit]) - # # Only take order from scope if limit is also provided by scope, this - # # is useful for updating a has_many association with a limit. - # add_order!(select_sql, options[:order], scope) - - # add_limit!(select_sql, options, scope) - # sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) - # else - # add_order!(select_sql, options[:order], nil) - # sql.concat(select_sql) - # end - - # connection.update(sql, "#{name} Update") scope = scope(:find) - arel = arel_table - arel = arel.where(Arel::SqlLiteral.new(construct_conditions(conditions, scope))) if conditions || scope + select_sql = "" + add_conditions!(select_sql, conditions, scope) + if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - arel = arel.order(construct_order(options[:order], scope)) + add_order!(select_sql, options[:order], scope) - arel = arel.take(construct_limit(options, scope)) - #arel = arel.where(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) - #sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) + add_limit!(select_sql, options, scope) + sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) else - arel = arel.order(construct_order(options[:order], nil)) - #sql.concat(select_sql) + add_order!(select_sql, options[:order], nil) + sql.concat(select_sql) end - arel.update(sanitize_sql_for_assignment(updates)) + connection.update(sql, "#{name} Update") end # Destroys the records matching +conditions+ by instantiating each -- cgit v1.2.3 From 71528c29215d74bd030ce5381aac37e8624bd506 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 19:36:45 -0300 Subject: Initial update_all migration --- activerecord/lib/active_record/base.rb | 38 +++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index adc7f5335d..4a07fbc1e1 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -839,26 +839,44 @@ module ActiveRecord #:nodoc: # # Update all books that match our conditions, but limit it to 5 ordered by date # Book.update_all "author = 'David'", "title LIKE '%Rails%'", :order => 'created_at', :limit => 5 def update_all(updates, conditions = nil, options = {}) - sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " + # sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " + # scope = scope(:find) + + # select_sql = "" + # add_conditions!(select_sql, conditions, scope) + + # if options.has_key?(:limit) || (scope && scope[:limit]) + # # Only take order from scope if limit is also provided by scope, this + # # is useful for updating a has_many association with a limit. + # add_order!(select_sql, options[:order], scope) + + # add_limit!(select_sql, options, scope) + # sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) + # else + # add_order!(select_sql, options[:order], nil) + # sql.concat(select_sql) + # end + # p sql + + # connection.update(sql, "#{name} Update") scope = scope(:find) - select_sql = "" - add_conditions!(select_sql, conditions, scope) + arel = arel_table + + if conditions = construct_conditions(conditions, scope) + arel = arel.where(Arel::SqlLiteral.new(conditions)) + end if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - add_order!(select_sql, options[:order], scope) - - add_limit!(select_sql, options, scope) - sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) + arel = arel.order(construct_order(options[:order], scope)).take(construct_limit(options, scope)) else - add_order!(select_sql, options[:order], nil) - sql.concat(select_sql) + arel = arel.order(construct_order(options[:order], nil)) end - connection.update(sql, "#{name} Update") + arel.update(sanitize_sql_for_assignment(updates)) end # Destroys the records matching +conditions+ by instantiating each -- cgit v1.2.3 From af9f9dd02c5539df0f05cb92e0799dc9e0bc8d46 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 19:46:35 -0300 Subject: Use array of orders instead of string concatenation --- activerecord/lib/active_record/base.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index adc7f5335d..df0cce4bf3 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1750,17 +1750,15 @@ module ActiveRecord #:nodoc: end def construct_order(order, scope = :auto) - sql = '' + orders = [] scoped_order = scope[:order] if scope if order - sql << order.to_s - if scoped_order && scoped_order != order - sql << ", #{scoped_order}" - end + orders << order + orders << scoped_order if scoped_order && scoped_order != order else - sql << scoped_order.to_s if scoped_order + orders << scoped_order if scoped_order end - sql + orders end def construct_limit(options, scope = :auto) -- cgit v1.2.3 From d7b98b3ca855418f88a9e979d32c1710040b3038 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 10 Jun 2009 19:54:08 -0300 Subject: Arel updated --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index 324f265c1d..3e6ad6e583 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 324f265c1de98212f59f42c287d441b85b2350b7 +Subproject commit 3e6ad6e5838d20c946d7a286cb34be12aae177ff -- cgit v1.2.3 From 3e4452c73f6f7ce2ff197b75d375f66f4a250a03 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 17 Jun 2009 15:10:57 -0300 Subject: Forget about auto scope, it's always explicit. --- activerecord/lib/active_record/base.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3f2b56d0c4..e04ec54913 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1736,7 +1736,7 @@ module ActiveRecord #:nodoc: construct_finder_arel(options).to_sql end - def construct_join(joins, scope = :auto) + def construct_join(joins, scope) merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins]) case merged_joins when Symbol, Hash, Array @@ -1753,13 +1753,12 @@ module ActiveRecord #:nodoc: end end - def construct_group(group, having, scope = :auto) + def construct_group(group, having, scope) sql = '' if group sql << group.to_s sql << " HAVING #{sanitize_sql_for_conditions(having)}" if having else - scope = scope(:find) if :auto == scope if scope && (scoped_group = scope[:group]) sql << scoped_group.to_s sql << " HAVING #{sanitize_sql_for_conditions(scope[:having])}" if scope[:having] @@ -1768,7 +1767,7 @@ module ActiveRecord #:nodoc: sql end - def construct_order(order, scope = :auto) + def construct_order(order, scope) orders = [] scoped_order = scope[:order] if scope if order @@ -1780,17 +1779,17 @@ module ActiveRecord #:nodoc: orders end - def construct_limit(options, scope = :auto) + def construct_limit(options, scope) options[:limit] ||= scope[:limit] if scope options[:limit] end - def construct_offset(options, scope = :auto) + def construct_offset(options, scope) options[:offset] ||= scope[:offset] if scope options[:offset] end - def construct_conditions(conditions, scope = :auto) + def construct_conditions(conditions, scope) conditions = [conditions] conditions << scope[:conditions] if scope conditions << type_condition if finder_needs_type_condition? -- cgit v1.2.3 From d587cf37947fe9a58c03eed3372717789b5349f4 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 23 Jun 2009 17:19:51 -0300 Subject: Removed old commented code --- activerecord/lib/active_record/base.rb | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index e04ec54913..32c339b338 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -840,27 +840,6 @@ module ActiveRecord #:nodoc: # # Update all books that match our conditions, but limit it to 5 ordered by date # Book.update_all "author = 'David'", "title LIKE '%Rails%'", :order => 'created_at', :limit => 5 def update_all(updates, conditions = nil, options = {}) - # sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} " - - # scope = scope(:find) - - # select_sql = "" - # add_conditions!(select_sql, conditions, scope) - - # if options.has_key?(:limit) || (scope && scope[:limit]) - # # Only take order from scope if limit is also provided by scope, this - # # is useful for updating a has_many association with a limit. - # add_order!(select_sql, options[:order], scope) - - # add_limit!(select_sql, options, scope) - # sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key))) - # else - # add_order!(select_sql, options[:order], nil) - # sql.concat(select_sql) - # end - # p sql - - # connection.update(sql, "#{name} Update") scope = scope(:find) arel = arel_table -- cgit v1.2.3 From bc899fd3a37fae7e0024e8f0439f204818aeafd7 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 23 Jun 2009 17:20:42 -0300 Subject: Arel updated. All tests passing for SQLite3 and PostgreSQL. --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index 3e6ad6e583..ae0c58fed1 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 3e6ad6e5838d20c946d7a286cb34be12aae177ff +Subproject commit ae0c58fed1cd3aca1edd75a249fa99bc9571a8a3 -- cgit v1.2.3 From 02a723f7b5f30b00fc77bc85162598f707c7b682 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 23 Jun 2009 17:38:31 -0300 Subject: Arel now buils SQL queries for associations. Removed old code and updated Arel version to support this. --- activerecord/lib/active_record/associations.rb | 53 +++------------------- .../abstract/schema_statements.rb | 6 --- .../connection_adapters/postgresql_adapter.rb | 14 ------ arel | 2 +- 4 files changed, 7 insertions(+), 68 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 29f58a04e6..97fdd9b1ba 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1604,14 +1604,6 @@ module ActiveRecord return sanitize_sql(arel.to_sql) end - def add_limited_ids_condition!(sql, options, join_dependency) - unless (id_list = select_limited_ids_list(options, join_dependency)).empty? - sql << "#{condition_word(sql)} #{connection.quote_table_name table_name}.#{primary_key} IN (#{id_list}) " - else - throw :invalid_query - end - end - def construct_limited_ids_condition(where, options, join_dependency) unless (id_list = select_limited_ids_list(options, join_dependency)).empty? "#{where.blank? ? '' : ' AND '} #{connection.quote_table_name table_name}.#{primary_key} IN (#{id_list}) " @@ -1630,47 +1622,18 @@ module ActiveRecord end def construct_finder_sql_for_association_limiting(options, join_dependency) - scope = scope(:find) - # Only join tables referenced in order or conditions since this is particularly slow on the pre-query. tables_from_conditions = conditions_tables(options) tables_from_order = order_tables(options) all_tables = tables_from_conditions + tables_from_order - distinct_join_associations = all_tables.uniq.map{|table| + options[:joins] = all_tables.uniq.map {|table| join_dependency.joins_for_table_name(table) - }.flatten.compact.uniq - - order = options[:order] - if scoped_order = (scope && scope[:order]) - order = order ? "#{order}, #{scoped_order}" : scoped_order - end - - is_distinct = !options[:joins].blank? || include_eager_conditions?(options, tables_from_conditions) || include_eager_order?(options, tables_from_order) - sql = "SELECT " - if is_distinct - sql << connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", order) - else - sql << primary_key - end - sql << " FROM #{connection.quote_table_name table_name} " + }.flatten.compact.uniq.collect { |assoc| assoc.association_join }.join - if is_distinct - sql << distinct_join_associations.collect { |assoc| assoc.association_join }.join - add_joins!(sql, options[:joins], scope) - end - - add_conditions!(sql, options[:conditions], scope) - add_group!(sql, options[:group], options[:having], scope) - - if order && is_distinct - connection.add_order_by_for_association_limiting!(sql, :order => order) - else - add_order!(sql, options[:order], scope) - end - - add_limit!(sql, options, scope) - - return sanitize_sql(sql) + construct_finder_sql(options.merge( + :select => connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(",")) + ) + ) end def tables_in_string(string) @@ -1774,10 +1737,6 @@ module ActiveRecord end end - def condition_word(sql) - sql =~ /where/i ? " AND " : "WHERE " - end - def create_extension_modules(association_id, block_extension, extensions) if block_extension extension_module_name = "#{self.to_s.demodulize}#{association_id.to_s.camelize}AssociationExtension" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index ff63ea3a2e..2f01a303e5 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -403,12 +403,6 @@ module ActiveRecord "DISTINCT #{columns}" end - # ORDER BY clause for the passed order option. - # PostgreSQL overrides this due to its stricter standards compliance. - def add_order_by_for_association_limiting!(sql, options) - sql << " ORDER BY #{options[:order]}" - end - # Adds timestamps (created_at and updated_at) columns to the named table. # ===== Examples # add_timestamps(:suppliers) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 90a90a0a9b..6b230787c3 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -911,20 +911,6 @@ module ActiveRecord sql << order_columns * ', ' end - # Returns an ORDER BY clause for the passed order option. - # - # PostgreSQL does not allow arbitrary ordering when using DISTINCT ON, so we work around this - # by wrapping the +sql+ string as a sub-select and ordering in that query. - def add_order_by_for_association_limiting!(sql, options) #:nodoc: - return sql if options[:order].blank? - - order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?) - order.map! { |s| 'DESC' if s =~ /\bdesc$/i } - order = order.zip((0...order.size).to_a).map { |s,i| "id_list.alias_#{i} #{s}" }.join(', ') - - sql.replace "SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}" - end - protected # Returns the version of the connected PostgreSQL version. def postgresql_version diff --git a/arel b/arel index ae0c58fed1..a9486193c8 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit ae0c58fed1cd3aca1edd75a249fa99bc9571a8a3 +Subproject commit a9486193c8c6250d56bfb0258be50025f7f62f5e -- cgit v1.2.3 From 4864f92ee34e840307d968fa8b04972b6d786fe8 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 23 Jun 2009 17:57:31 -0300 Subject: Removed unused methods. --- activerecord/lib/active_record/base.rb | 68 +--------------------- .../abstract/database_statements.rb | 27 --------- .../connection_adapters/mysql_adapter.rb | 12 ---- activerecord/test/cases/adapter_test.rb | 21 ------- 4 files changed, 1 insertion(+), 127 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 32c339b338..cc601b0d11 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1812,44 +1812,6 @@ module ActiveRecord #:nodoc: o.is_a?(Array) && o.all?{|obj| obj.is_a?(String)} end - def add_order!(sql, order, scope = :auto) - scope = scope(:find) if :auto == scope - scoped_order = scope[:order] if scope - if order - sql << " ORDER BY #{order}" - if scoped_order && scoped_order != order - sql << ", #{scoped_order}" - end - else - sql << " ORDER BY #{scoped_order}" if scoped_order - end - end - - def add_group!(sql, group, having, scope = :auto) - if group - sql << " GROUP BY #{group}" - sql << " HAVING #{sanitize_sql_for_conditions(having)}" if having - else - scope = scope(:find) if :auto == scope - if scope && (scoped_group = scope[:group]) - sql << " GROUP BY #{scoped_group}" - sql << " HAVING #{sanitize_sql_for_conditions(scope[:having])}" if scope[:having] - end - end - end - - # The optional scope argument is for the current :find scope. - def add_limit!(sql, options, scope = :auto) - scope = scope(:find) if :auto == scope - - if scope - options[:limit] ||= scope[:limit] - options[:offset] ||= scope[:offset] - end - - connection.add_limit_offset!(sql, options) - end - # The optional scope argument is for the current :find scope. # The :lock option has precedence over a scoped :lock. def add_lock!(sql, options, scope = :auto) @@ -1858,38 +1820,10 @@ module ActiveRecord #:nodoc: connection.add_lock!(sql, options) end - # The optional scope argument is for the current :find scope. - def add_joins!(sql, joins, scope = :auto) - scope = scope(:find) if :auto == scope - merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins]) - case merged_joins - when Symbol, Hash, Array - if array_of_strings?(merged_joins) - sql << merged_joins.join(' ') + " " - else - join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, merged_joins, nil) - sql << " #{join_dependency.join_associations.collect { |assoc| assoc.association_join }.join} " - end - when String - sql << " #{merged_joins} " - end - end - - # Adds a sanitized version of +conditions+ to the +sql+ string. Note that the passed-in +sql+ string is changed. - # The optional scope argument is for the current :find scope. - def add_conditions!(sql, conditions, scope = :auto) - scope = scope(:find) if :auto == scope - conditions = [conditions] - conditions << scope[:conditions] if scope - conditions << type_condition if finder_needs_type_condition? - merged_conditions = merge_conditions(*conditions) - sql << "WHERE #{merged_conditions} " unless merged_conditions.blank? - end - def type_condition(table_alias=nil) quoted_table_alias = self.connection.quote_table_name(table_alias || table_name) quoted_inheritance_column = connection.quote_column_name(inheritance_column) - type_condition = subclasses.inject("#{quoted_table_alias}.#{quoted_inheritance_column} = '#{sti_name}' ") do |condition, subclass| + type_condition = subclasses.inject("#{quoted_table_alias}.#{quoted_inheritance_column} = '#{sti_name}' " ) do |condition, subclass| condition << "OR #{quoted_table_alias}.#{quoted_inheritance_column} = '#{subclass.sti_name}' " end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index ce04a8109d..26bf04f449 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -181,33 +181,6 @@ module ActiveRecord # done if the transaction block raises an exception or returns false. def rollback_db_transaction() end - # Alias for add_limit_offset!. - def add_limit!(sql, options) - add_limit_offset!(sql, options) if options - end - - # Appends +LIMIT+ and +OFFSET+ options to an SQL statement, or some SQL - # fragment that has the same semantics as LIMIT and OFFSET. - # - # +options+ must be a Hash which contains a +:limit+ option (required) - # and an +:offset+ option (optional). - # - # This method *modifies* the +sql+ parameter. - # - # ===== Examples - # add_limit_offset!('SELECT * FROM suppliers', {:limit => 10, :offset => 50}) - # generates - # SELECT * FROM suppliers LIMIT 10 OFFSET 50 - def add_limit_offset!(sql, options) - if limit = options[:limit] - sql << " LIMIT #{sanitize_limit(limit)}" - if offset = options[:offset] - sql << " OFFSET #{offset.to_i}" - end - end - sql - end - # Appends a locking clause to an SQL statement. # This method *modifies* the +sql+ parameter. # # SELECT * FROM suppliers FOR UPDATE diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 6d28e01544..cee93dcac2 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -368,18 +368,6 @@ module ActiveRecord execute("RELEASE SAVEPOINT #{current_savepoint_name}") end - def add_limit_offset!(sql, options) #:nodoc: - if limit = options[:limit] - limit = sanitize_limit(limit) - unless offset = options[:offset] - sql << " LIMIT #{limit}" - else - sql << " LIMIT #{offset.to_i}, #{limit}" - end - end - end - - # SCHEMA STATEMENTS ======================================== def structure_dump #:nodoc: diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 04770646b2..544daf8f60 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -109,25 +109,4 @@ class AdapterTest < ActiveRecord::TestCase end end end - - def test_add_limit_offset_should_sanitize_sql_injection_for_limit_without_comas - sql_inject = "1 select * from schema" - assert_equal " LIMIT 1", @connection.add_limit_offset!("", :limit=>sql_inject) - if current_adapter?(:MysqlAdapter) - assert_equal " LIMIT 7, 1", @connection.add_limit_offset!("", :limit=>sql_inject, :offset=>7) - else - assert_equal " LIMIT 1 OFFSET 7", @connection.add_limit_offset!("", :limit=>sql_inject, :offset=>7) - end - end - - def test_add_limit_offset_should_sanitize_sql_injection_for_limit_with_comas - sql_inject = "1, 7 procedure help()" - if current_adapter?(:MysqlAdapter) - assert_equal " LIMIT 1,7", @connection.add_limit_offset!("", :limit=>sql_inject) - assert_equal " LIMIT 7, 1", @connection.add_limit_offset!("", :limit=> '1 ; DROP TABLE USERS', :offset=>7) - else - assert_equal " LIMIT 1,7", @connection.add_limit_offset!("", :limit=>sql_inject) - assert_equal " LIMIT 1,7 OFFSET 7", @connection.add_limit_offset!("", :limit=>sql_inject, :offset=>7) - end - end end -- cgit v1.2.3 From 3b27a4856f9a1a4d8f4e6d80343fcd5a80c40b35 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 23 Jun 2009 19:40:57 -0300 Subject: Refactoring: Calculations now use construct_finder_sql instead they own method. --- activerecord/lib/active_record/base.rb | 10 ++++------ activerecord/lib/active_record/calculations.rb | 23 ++++------------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2453d38aca..c7fc1fa124 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1696,11 +1696,9 @@ module ActiveRecord #:nodoc: @arel_table = Arel::Table.new(table) end - def construct_finder_arel(options) - scope = scope(:find) - + def construct_finder_arel(options, scope = scope(:find)) # TODO add lock to Arel - arel_table(table_name). + arel_table(options[:from] || table_name). join(construct_join(options[:joins], scope)). where(construct_conditions(options[:conditions], scope)). project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). @@ -1711,8 +1709,8 @@ module ActiveRecord #:nodoc: ) end - def construct_finder_sql(options) - construct_finder_arel(options).to_sql + def construct_finder_sql(options, scope = scope(:find)) + construct_finder_arel(options, scope).to_sql end def construct_join(joins, scope) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 15ca5e14a2..5c7247b9c0 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -169,11 +169,11 @@ module ActiveRecord (column_name == :all ? "*" : column_name.to_s)) end - value = construct_calculation_arel(options.merge( + value = construct_finder_sql(options.merge( :select => operation == 'count' ? column.count(options[:distinct]) : column.send(operation) - )) + ), nil) - type_cast_calculated_value(connection.select_value(value.to_sql), column_for(column_name), operation) + type_cast_calculated_value(connection.select_value(value), column_for(column_name), operation) end def execute_grouped_calculation(operation, column_name, options) #:nodoc: @@ -194,7 +194,7 @@ module ActiveRecord options[:select] << ", #{group_field} AS #{group_alias}" - calculated_data = connection.select_all(construct_calculation_arel(options).to_sql) + calculated_data = connection.select_all(construct_finder_sql(options, nil)) if association key_ids = calculated_data.collect { |row| row[group_alias] } @@ -212,21 +212,6 @@ module ActiveRecord end protected - - def construct_calculation_arel(options) - scope = scope(:find) - - arel_table(options[:from] || table_name). - join(options[:joins]). - where(options[:conditions]). - project(options[:select]). - group(construct_group(options[:group], options[:having], scope)). - order(options[:order].to_s). - take(construct_limit(options, scope)). - skip(construct_offset(options, scope) - ) - end - def construct_count_options_from_args(*args) options = {} column_name = :all -- cgit v1.2.3 From 0002fd4ab6604d8c8e6171da9b7e4764e279ec9d Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 23 Jun 2009 19:47:55 -0300 Subject: Updated Arel submodule. --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index a9486193c8..97811698ab 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit a9486193c8c6250d56bfb0258be50025f7f62f5e +Subproject commit 97811698ab0e68b33fbf3067c3764e385dd75d53 -- cgit v1.2.3 From 0f5785c99799b70919e18df3ef1cb43761979f5d Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 1 Jul 2009 16:16:11 -0300 Subject: Small refactor to update_all. --- activerecord/lib/active_record/base.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 56ed851d6a..e8793c3d2d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -867,12 +867,12 @@ module ActiveRecord #:nodoc: arel = arel.where(Arel::SqlLiteral.new(conditions)) end - if options.has_key?(:limit) || (scope && scope[:limit]) + arel = if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - arel = arel.order(construct_order(options[:order], scope)).take(construct_limit(options, scope)) + arel.order(construct_order(options[:order], scope)).take(construct_limit(options, scope)) else - arel = arel.order(construct_order(options[:order], nil)) + arel.order(construct_order(options[:order], nil)) end arel.update(sanitize_sql_for_assignment(updates)) -- cgit v1.2.3 From 260c847817bbc3ad990609b7e41f787e1d2940ea Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 1 Jul 2009 20:34:26 -0300 Subject: Create is now powered by Arel. Removed methods that are no longer used. --- activerecord/lib/active_record/base.rb | 29 +++++++++++----------- .../abstract/database_statements.rb | 4 +-- .../connection_adapters/sqlite_adapter.rb | 4 +-- arel | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index e8793c3d2d..1f96e6dcc5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2907,18 +2907,13 @@ module ActiveRecord #:nodoc: self.id = connection.next_sequence_value(self.class.sequence_name) end - quoted_attributes = attributes_with_quotes - - statement = if quoted_attributes.empty? - connection.empty_insert_statement(self.class.table_name) + new_id = if arel_attributes_values.empty? + arel_table.insert connection.empty_insert_statement_value else - "INSERT INTO #{self.class.quoted_table_name} " + - "(#{quoted_column_names.join(', ')}) " + - "VALUES(#{quoted_attributes.values.join(', ')})" + arel_table.insert arel_attributes_values end - self.id = connection.insert(statement, "#{self.class.name} Create", - self.class.primary_key, self.id, self.class.sequence_name) + self.id ||= new_id @new_record = false id @@ -2987,6 +2982,10 @@ module ActiveRecord #:nodoc: default end + def arel_table + @arel_table = Arel::Table.new(self.class.table_name) + end + # Returns a copy of the attributes hash where all the values have been safely quoted for use in # an SQL statement. def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) @@ -3007,10 +3006,8 @@ module ActiveRecord #:nodoc: include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) end - def arel_table - @arel_table = Arel::Table.new(self.class.table_name) - end - + # Returns a copy of the attributes hash where all the values have been safely quoted for use in + # an Arel insert/update method. def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) attrs = {} connection = self.class.connection @@ -3019,7 +3016,11 @@ module ActiveRecord #:nodoc: value = read_attribute(name) if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name)) - attrs[arel_table[name]] = value.is_a?(Hash) ? value.to_yaml : value + # We need explicit to_yaml because quote() does not properly convert Time/Date fields to YAML. + if value && self.class.serialized_attributes.has_key?(name) && (value.acts_like?(:date) || value.acts_like?(:time)) + value = value.to_yaml + end + attrs[arel_table[name]] = (value.is_a?(Hash) || value.is_a?(Array)) ? value.to_yaml : value end end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 26bf04f449..be89873632 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -208,8 +208,8 @@ module ActiveRecord execute "INSERT INTO #{quote_table_name(table_name)} (#{fixture.key_list}) VALUES (#{fixture.value_list})", 'Fixture Insert' end - def empty_insert_statement(table_name) - "INSERT INTO #{quote_table_name(table_name)} VALUES(DEFAULT)" + def empty_insert_statement_value + "VALUES(DEFAULT)" end def case_sensitive_equality_operator diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 8cbe08cd77..16a976a8c7 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -308,8 +308,8 @@ module ActiveRecord alter_table(table_name, :rename => {column_name.to_s => new_column_name.to_s}) end - def empty_insert_statement(table_name) - "INSERT INTO #{table_name} VALUES(NULL)" + def empty_insert_statement_value + "VALUES(NULL)" end protected diff --git a/arel b/arel index 97811698ab..808b9e90a3 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 97811698ab0e68b33fbf3067c3764e385dd75d53 +Subproject commit 808b9e90a38c6c19e109da8eb5f2a264fd780d9a -- cgit v1.2.3 From f4a23567e2612fc72ff3655a9169ed032610fc84 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 16 Jul 2009 13:35:07 -0300 Subject: Added ActiveRecord::Base#(where|join|project|group|order|take|skip) methods. --- activerecord/lib/active_record/associations.rb | 16 ++--- activerecord/lib/active_record/base.rb | 83 ++++++++++++++++---------- 2 files changed, 59 insertions(+), 40 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 31d3a89b9d..a4228e2a2a 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1599,16 +1599,16 @@ module ActiveRecord conditions = construct_conditions(options[:conditions], scope) || '' conditions << construct_limited_ids_condition(conditions, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - arel = arel_table((scope && scope[:from]) || options[:from] || table_name). - join(joins). - where(conditions). - project(column_aliases(join_dependency)). - group(construct_group(options[:group], options[:having], scope)). - order(construct_order(options[:order], scope)) + arel_table((scope && scope[:from]) || options[:from]) + join(joins) + where(conditions) + project(column_aliases(join_dependency)) + group(construct_group(options[:group], options[:having], scope)) + order(construct_order(options[:order], scope)) - arel = arel.take(construct_limit(options, scope)) if using_limitable_reflections?(join_dependency.reflections) + take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) - return sanitize_sql(arel.to_sql) + return sanitize_sql(arel_relation.to_sql) end def construct_limited_ids_condition(where, options, join_dependency) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index bb6869c6ce..400884264f 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -861,21 +861,22 @@ module ActiveRecord #:nodoc: def update_all(updates, conditions = nil, options = {}) scope = scope(:find) - arel = arel_table + arel_table if conditions = construct_conditions(conditions, scope) - arel = arel.where(Arel::SqlLiteral.new(conditions)) + where(Arel::SqlLiteral.new(conditions)) end - arel = if options.has_key?(:limit) || (scope && scope[:limit]) + if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - arel.order(construct_order(options[:order], scope)).take(construct_limit(options, scope)) + order(construct_order(options[:order], scope)) + take(construct_limit(options[:limit], scope)) else - arel.order(construct_order(options[:order], nil)) + order(construct_order(options[:order], nil)) end - arel.update(sanitize_sql_for_assignment(updates)) + arel_relation.update(sanitize_sql_for_assignment(updates)) end # Destroys the records matching +conditions+ by instantiating each @@ -1532,6 +1533,30 @@ module ActiveRecord #:nodoc: "(#{segments.join(') AND (')})" unless segments.empty? end + + def arel_table(table = nil) + table = table_name if table.blank? + self.arel_relation = Arel::Table.new(table) + end + + def arel_relation + Thread.current[:"#{self}_arel_relation"] ||= Arel::Table.new(table_name) + end + + def arel_relation=(relation) + Thread.current[:"#{self}_arel_relation"] = relation + end + + CLAUSES_METHODS = ["where", "join", "project", "group", "order", "take", "skip"].freeze + + for clause in CLAUSES_METHODS + class_eval %{ + def #{clause}(_#{clause}) + self.arel_relation = self.arel_relation.#{clause}(_#{clause}) if _#{clause} + end + } + end + private def find_initial(options) options.update(:limit => 1) @@ -1711,21 +1736,17 @@ module ActiveRecord #:nodoc: end end - def arel_table(table = table_name) - @arel_table = Arel::Table.new(table) - end - def construct_finder_arel(options, scope = scope(:find)) # TODO add lock to Arel - arel_table(options[:from] || table_name). - join(construct_join(options[:joins], scope)). - where(construct_conditions(options[:conditions], scope)). - project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). - group(construct_group(options[:group], options[:having], scope)). - order(construct_order(options[:order], scope)). - take(construct_limit(options, scope)). - skip(construct_offset(options, scope) - ) + arel_table(options[:from]) + join(construct_join(options[:joins], scope)) + where(construct_conditions(options[:conditions], scope)) + project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))) + group(construct_group(options[:group], options[:having], scope)) + order(construct_order(options[:order], scope)) + take(construct_limit(options[:limit], scope)) + skip(construct_offset(options[:offset], scope)) + arel_relation end def construct_finder_sql(options, scope = scope(:find)) @@ -1754,11 +1775,9 @@ module ActiveRecord #:nodoc: if group sql << group.to_s sql << " HAVING #{sanitize_sql_for_conditions(having)}" if having - else - if scope && (scoped_group = scope[:group]) - sql << scoped_group.to_s - sql << " HAVING #{sanitize_sql_for_conditions(scope[:having])}" if scope[:having] - end + elsif scope && (scoped_group = scope[:group]) + sql << scoped_group.to_s + sql << " HAVING #{sanitize_sql_for_conditions(scope[:having])}" if scope[:having] end sql end @@ -1769,20 +1788,20 @@ module ActiveRecord #:nodoc: if order orders << order orders << scoped_order if scoped_order && scoped_order != order - else - orders << scoped_order if scoped_order + elsif scoped_order + orders << scoped_order end orders end - def construct_limit(options, scope) - options[:limit] ||= scope[:limit] if scope - options[:limit] + def construct_limit(limit, scope) + limit ||= scope[:limit] if scope + limit end - def construct_offset(options, scope) - options[:offset] ||= scope[:offset] if scope - options[:offset] + def construct_offset(offset, scope) + offset ||= scope[:offset] if scope + offset end def construct_conditions(conditions, scope) -- cgit v1.2.3 From 046c22c8c171591fc15594f797b5aac676f3485d Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 20 Jul 2009 16:53:48 -0300 Subject: Removed legacy test. --- activerecord/test/cases/associations_test.rb | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 056a29438a..e429c1d157 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -65,25 +65,6 @@ class AssociationsTest < ActiveRecord::TestCase assert_equal 1, firm.clients(true).size, "New firm should have reloaded clients count" end - def test_storing_in_pstore - require "tmpdir" - store_filename = File.join(Dir.tmpdir, "ar-pstore-association-test") - File.delete(store_filename) if File.exist?(store_filename) - require "pstore" - apple = Firm.create("name" => "Apple") - natural = Client.new("name" => "Natural Company") - apple.clients << natural - - db = PStore.new(store_filename) - db.transaction do - db["apple"] = apple - end - - db = PStore.new(store_filename) - db.transaction do - assert_equal "Natural Company", db["apple"].clients.first.name - end - end end class AssociationProxyTest < ActiveRecord::TestCase -- cgit v1.2.3 From b326faef0936e5a845d1f6eb9ed2200babfd05f8 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 20 Jul 2009 16:56:15 -0300 Subject: Performance boost for AR#create --- activerecord/lib/active_record/base.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 400884264f..60bd38e74c 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2933,10 +2933,12 @@ module ActiveRecord #:nodoc: self.id = connection.next_sequence_value(self.class.sequence_name) end - new_id = if arel_attributes_values.empty? + attributes_values = arel_attributes_values + + new_id = if attributes_values.empty? arel_table.insert connection.empty_insert_statement_value else - arel_table.insert arel_attributes_values + arel_table.insert attributes_values end self.id ||= new_id @@ -3036,7 +3038,6 @@ module ActiveRecord #:nodoc: # an Arel insert/update method. def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) attrs = {} - connection = self.class.connection attribute_names.each do |name| if (column = column_for_attribute(name)) && (include_primary_key || !column.primary) value = read_attribute(name) -- cgit v1.2.3 From 0e0866e0565bd530ee265b9298accff4185f7022 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 21 Jul 2009 20:21:03 -0300 Subject: Introduced ActiveRecord::Relation, a layer between an ARel relation and an AR relation --- activerecord/lib/active_record.rb | 1 + activerecord/lib/active_record/associations.rb | 17 ++++---- activerecord/lib/active_record/base.rb | 56 +++++++++----------------- activerecord/lib/active_record/relation.rb | 39 ++++++++++++++++++ activerecord/test/cases/base_test.rb | 2 +- activerecord/test/cases/finder_test.rb | 4 +- activerecord/test/cases/method_scoping_test.rb | 4 +- activerecord/test/cases/named_scope_test.rb | 8 ++-- 8 files changed, 77 insertions(+), 54 deletions(-) create mode 100644 activerecord/lib/active_record/relation.rb diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 3b8b9826fe..009071e1d4 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -52,6 +52,7 @@ module ActiveRecord autoload :Associations, 'active_record/associations' autoload :AttributeMethods, 'active_record/attribute_methods' autoload :AutosaveAssociation, 'active_record/autosave_association' + autoload :Relation, 'active_record/relation' autoload :Base, 'active_record/base' autoload :Batches, 'active_record/batches' autoload :Calculations, 'active_record/calculations' diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 47f97718eb..a0aeff68b6 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1602,16 +1602,17 @@ module ActiveRecord conditions = construct_conditions(options[:conditions], scope) || '' conditions << construct_limited_ids_condition(conditions, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - arel_table((scope && scope[:from]) || options[:from]) - join(joins) - where(conditions) - project(column_aliases(join_dependency)) - group(construct_group(options[:group], options[:having], scope)) - order(construct_order(options[:order], scope)) + relation = arel_table((scope && scope[:from]) || options[:from]). + join(joins). + where(conditions). + project(column_aliases(join_dependency)). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope) + ) - take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) + relation = relation.take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) - return sanitize_sql(arel_relation.to_sql) + return sanitize_sql(relation.to_sql) end def construct_limited_ids_condition(where, options, join_dependency) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 85f7cbfad2..718f7ea37b 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -663,7 +663,8 @@ module ActiveRecord #:nodoc: # This is an alias for find(:all). You can pass in all the same arguments to this method as you can # to find(:all) def all(*args) - find(:all, *args) + relation = arel_table + construct_finder_arel(*args) end # Executes a custom SQL query against your database and returns all the results. The results will @@ -861,22 +862,21 @@ module ActiveRecord #:nodoc: def update_all(updates, conditions = nil, options = {}) scope = scope(:find) - arel_table + relation = arel_table.relation if conditions = construct_conditions(conditions, scope) - where(Arel::SqlLiteral.new(conditions)) + relation = relation.where(Arel::SqlLiteral.new(conditions)) end if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - order(construct_order(options[:order], scope)) - take(construct_limit(options[:limit], scope)) + relation = relation.order(construct_order(options[:order], scope)).take(construct_limit(options[:limit], scope)) else - order(construct_order(options[:order], nil)) + relation = relation.order(construct_order(options[:order], nil)) end - arel_relation.update(sanitize_sql_for_assignment(updates)) + relation.update(sanitize_sql_for_assignment(updates)) end # Destroys the records matching +conditions+ by instantiating each @@ -1536,25 +1536,7 @@ module ActiveRecord #:nodoc: def arel_table(table = nil) table = table_name if table.blank? - self.arel_relation = Arel::Table.new(table) - end - - def arel_relation - Thread.current[:"#{self}_arel_relation"] ||= Arel::Table.new(table_name) - end - - def arel_relation=(relation) - Thread.current[:"#{self}_arel_relation"] = relation - end - - CLAUSES_METHODS = ["where", "join", "project", "group", "order", "take", "skip"].freeze - - for clause in CLAUSES_METHODS - class_eval %{ - def #{clause}(_#{clause}) - self.arel_relation = self.arel_relation.#{clause}(_#{clause}) if _#{clause} - end - } + Relation.new(self, table) end private @@ -1736,21 +1718,21 @@ module ActiveRecord #:nodoc: end end - def construct_finder_arel(options, scope = scope(:find)) + def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - arel_table(options[:from]) - join(construct_join(options[:joins], scope)) - where(construct_conditions(options[:conditions], scope)) - project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))) - group(construct_group(options[:group], options[:having], scope)) - order(construct_order(options[:order], scope)) - take(construct_limit(options[:limit], scope)) - skip(construct_offset(options[:offset], scope)) - arel_relation + arel_table(options[:from]). + join(construct_join(options[:joins], scope)). + where(construct_conditions(options[:conditions], scope)). + project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope)). + take(construct_limit(options[:limit], scope)). + skip(construct_offset(options[:offset], scope) + ) end def construct_finder_sql(options, scope = scope(:find)) - construct_finder_arel(options, scope).to_sql + construct_finder_arel(options, scope).relation.to_sql end def construct_join(joins, scope) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb new file mode 100644 index 0000000000..36e8d98298 --- /dev/null +++ b/activerecord/lib/active_record/relation.rb @@ -0,0 +1,39 @@ +module ActiveRecord + class Relation + delegate :delete, :to_sql, :to => :relation + CLAUSES_METHODS = ["where", "join", "project", "group", "order", "take", "skip"].freeze + attr_reader :relation, :klass + + def initialize(klass, table = nil) + @klass = klass + @relation = Arel::Table.new(table || @klass.table_name) + end + + def to_a + @klass.find_by_sql(@relation.to_sql) + end + + def first + @relation = @relation.take(1) + to_a.first + end + + for clause in CLAUSES_METHODS + class_eval %{ + def #{clause}(_#{clause}) + @relation = @relation.#{clause}(_#{clause}) if _#{clause} + self + end + } + end + + private + def method_missing(method, *args, &block) + if @relation.respond_to?(method) + @relation.send(method, *args, &block) + elsif Array.instance_methods.include?(method.to_s) + to_a.send(method, *args, &block) + end + end + end +end diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index e47f898485..3143ec2850 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1784,7 +1784,7 @@ class BasicsTest < ActiveRecord::TestCase end def test_all_with_conditions - assert_equal Developer.find(:all, :order => 'id desc'), Developer.all(:order => 'id desc') + assert_equal Developer.find(:all, :order => 'id desc'), Developer.all.order('id desc').to_a end def test_find_ordered_last diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index d8f5695a0f..f8c8d3648a 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1072,10 +1072,10 @@ class FinderTest < ActiveRecord::TestCase end def test_finder_with_scoped_from - all_topics = Topic.all + all_topics = Topic.find(:all) Topic.with_scope(:find => { :from => 'fake_topics' }) do - assert_equal all_topics, Topic.all(:from => 'topics') + assert_equal all_topics, Topic.all(:from => 'topics').to_a end end diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb index bea5c5fb76..d4e63ce2fd 100644 --- a/activerecord/test/cases/method_scoping_test.rb +++ b/activerecord/test/cases/method_scoping_test.rb @@ -592,12 +592,12 @@ class DefaultScopingTest < ActiveRecord::TestCase end def test_default_scope_with_conditions_string - assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.all.map(&:id).sort + assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.all.to_a.map(&:id).sort assert_equal nil, DeveloperCalledDavid.create!.name end def test_default_scope_with_conditions_hash - assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.map(&:id).sort + assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort assert_equal 'Jamis', DeveloperCalledJamis.create!.name end diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index 92fe48cb5a..10daff5d65 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -344,14 +344,14 @@ class NamedScopeTest < ActiveRecord::TestCase def test_chaining_should_use_latest_conditions_when_searching # Normal hash conditions - assert_equal Topic.all(:conditions => {:approved => true}), Topic.rejected.approved.all - assert_equal Topic.all(:conditions => {:approved => false}), Topic.approved.rejected.all + assert_equal Topic.all(:conditions => {:approved => true}).to_a, Topic.rejected.approved.all.to_a + assert_equal Topic.all(:conditions => {:approved => false}).to_a, Topic.approved.rejected.all.to_a # Nested hash conditions with same keys - assert_equal [posts(:sti_comments)], Post.with_special_comments.with_very_special_comments.all + assert_equal [posts(:sti_comments)], Post.with_special_comments.with_very_special_comments.all.to_a # Nested hash conditions with different keys - assert_equal [posts(:sti_comments)], Post.with_special_comments.with_post(4).all.uniq + assert_equal [posts(:sti_comments)], Post.with_special_comments.with_post(4).all.to_a.uniq end def test_methods_invoked_within_scopes_should_respect_scope -- cgit v1.2.3 From 5123a2359b964ba31c93296a36c9899564b537a8 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 21 Jul 2009 20:28:35 -0300 Subject: Removed unused local variable. --- activerecord/lib/active_record/base.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 718f7ea37b..2375211577 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -663,7 +663,6 @@ module ActiveRecord #:nodoc: # This is an alias for find(:all). You can pass in all the same arguments to this method as you can # to find(:all) def all(*args) - relation = arel_table construct_finder_arel(*args) end -- cgit v1.2.3 From ca1e62f14219da3990bb354d4a363dbe6fa13435 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 21 Jul 2009 23:01:26 -0300 Subject: Performance: cache/reload arel relation when possible to speed up things. --- activerecord/lib/active_record/base.rb | 9 +++++---- activerecord/lib/active_record/locking/optimistic.rb | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2375211577..7a34e345a2 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2602,7 +2602,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - arel_table.where(arel_table[self.class.primary_key].eq(id)).delete + arel_table(true).where(arel_table[self.class.primary_key].eq(id)).delete end freeze @@ -2904,7 +2904,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - arel_table.where(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) + arel_table(true).where(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes @@ -2991,8 +2991,9 @@ module ActiveRecord #:nodoc: default end - def arel_table - @arel_table = Arel::Table.new(self.class.table_name) + def arel_table(reload = nil) + @arel_table = Relation.new(self, self.class.table_name) if reload || @arel_table.nil? + @arel_table end # Returns a copy of the attributes hash where all the values have been safely quoted for use in diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index bc22c2a511..4e833ec871 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,7 +89,7 @@ module ActiveRecord attribute_names.uniq! begin - affected_rows = arel_table.where( + affected_rows = arel_table(true).where( arel_table[self.class.primary_key].eq(quoted_id).and( arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) @@ -116,7 +116,7 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - affected_rows = arel_table.where( + affected_rows = arel_table(true).where( arel_table[self.class.primary_key].eq(quoted_id).and( arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) -- cgit v1.2.3 From c1cbf02e3170f1004daf4a146cbc41176c2458d3 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 31 Jul 2009 16:08:22 -0300 Subject: Added ActiveRecord::Relation tests. Allow Relation to accept conditional hashes and arrays like #find does. --- activerecord/lib/active_record/base.rb | 8 ++- activerecord/lib/active_record/relation.rb | 15 +++++- activerecord/test/cases/relations_test.rb | 78 ++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 activerecord/test/cases/relations_test.rb diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 7a34e345a2..9a3a02870a 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -663,7 +663,11 @@ module ActiveRecord #:nodoc: # This is an alias for find(:all). You can pass in all the same arguments to this method as you can # to find(:all) def all(*args) - construct_finder_arel(*args) + if args.empty? && !scoped?(:find) + arel_table + else + construct_finder_arel(*args) + end end # Executes a custom SQL query against your database and returns all the results. The results will @@ -2992,7 +2996,7 @@ module ActiveRecord #:nodoc: end def arel_table(reload = nil) - @arel_table = Relation.new(self, self.class.table_name) if reload || @arel_table.nil? + @arel_table = Relation.new(self.class, self.class.table_name) if reload || @arel_table.nil? @arel_table end diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 36e8d98298..1c3a1dc53b 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,7 +1,7 @@ module ActiveRecord class Relation delegate :delete, :to_sql, :to => :relation - CLAUSES_METHODS = ["where", "join", "project", "group", "order", "take", "skip"].freeze + CLAUSES_METHODS = ["project", "group", "order", "take", "skip"].freeze attr_reader :relation, :klass def initialize(klass, table = nil) @@ -27,6 +27,19 @@ module ActiveRecord } end + def join(joins) + @relation = @relation.join(@klass.send(:construct_join, joins, nil)) if !joins.blank? + self + end + + def where(conditions) + if !conditions.blank? + conditions = @klass.send(:merge_conditions, conditions) if [String, Hash, Array].include?(conditions.class) + @relation = @relation.where(conditions) + end + self + end + private def method_missing(method, *args, &block) if @relation.respond_to?(method) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb new file mode 100644 index 0000000000..c095d9455e --- /dev/null +++ b/activerecord/test/cases/relations_test.rb @@ -0,0 +1,78 @@ +require "cases/helper" +require 'models/post' +require 'models/topic' +require 'models/reply' +require 'models/author' +require 'models/entrant' +require 'models/developer' +require 'models/company' + +class RealtionTest < ActiveRecord::TestCase + fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts + + def test_finding_with_conditions + authors = Author.all.where("name = 'David'") + + assert_equal Author.find(:all, :conditions => "name = 'David'"), authors.to_a + end + + def test_finding_with_order + topics = Topic.all.order('id') + assert_equal 4, topics.size + assert_equal topics(:first).title, topics.first.title + end + + def test_finding_with_order_and_take + entrants = Entrant.all.order("id ASC").take(2).to_a + + assert_equal(2, entrants.size) + assert_equal(entrants(:first).name, entrants.first.name) + end + + def test_finding_with_order_limit_and_offset + entrants = Entrant.all.order("id ASC").take(2).skip(1) + + assert_equal(2, entrants.size) + assert_equal(entrants(:second).name, entrants.first.name) + + entrants = Entrant.all.order("id ASC").take(2).skip(2) + assert_equal(1, entrants.size) + assert_equal(entrants(:third).name, entrants.first.name) + end + + def test_finding_with_group + developers = Developer.all.group("salary").project("salary").to_a + assert_equal 4, developers.size + assert_equal 4, developers.map(&:salary).uniq.size + end + + def test_finding_with_hash_conditions_on_joined_table + firms = DependentFirm.all.join(:account).where({:name => 'RailsCore', :accounts => { :credit_limit => 55..60 }}).to_a + assert_equal 1, firms.size + assert_equal companies(:rails_core), firms.first + end + + def test_find_all_with_join + developers_on_project_one = Developer.all.join('LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id').where('project_id=1').to_a + + assert_equal 3, developers_on_project_one.length + developer_names = developers_on_project_one.map { |d| d.name } + assert developer_names.include?('David') + assert developer_names.include?('Jamis') + end + + def test_find_on_hash_conditions + assert_equal Topic.find(:all, :conditions => {:approved => false}), Topic.all.where({ :approved => false }).to_a + end + + def test_joins_with_string_array + person_with_reader_and_post = Post.all.join([ + "INNER JOIN categorizations ON categorizations.post_id = posts.id", + "INNER JOIN categories ON categories.id = categorizations.category_id AND categories.type = 'SpecialCategory'" + ] + ).to_a + assert_equal 1, person_with_reader_and_post.size + end + +end + -- cgit v1.2.3 From 31c83534d61cad2203ae57087442caedb4dbf22a Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 3 Aug 2009 13:59:34 -0300 Subject: Don't use local vars before testing its conditional. --- activerecord/lib/active_record/base.rb | 12 ++++++------ .../cases/associations/eager_load_nested_include_test.rb | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2b50333682..2f1f6175af 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1068,7 +1068,7 @@ module ActiveRecord #:nodoc: # If the access logic of your application is richer you can use Hash#except # or Hash#slice to sanitize the hash of parameters before they are # passed to Active Record. - # + # # For example, it could be the case that the list of protected attributes # for a given model depends on the role of the user: # @@ -1116,7 +1116,7 @@ module ActiveRecord #:nodoc: # If the access logic of your application is richer you can use Hash#except # or Hash#slice to sanitize the hash of parameters before they are # passed to Active Record. - # + # # For example, it could be the case that the list of accessible attributes # for a given model depends on the role of the user: # @@ -2968,14 +2968,14 @@ module ActiveRecord #:nodoc: attrs = {} attribute_names.each do |name| if (column = column_for_attribute(name)) && (include_primary_key || !column.primary) - value = read_attribute(name) if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name)) - # We need explicit to_yaml because quote() does not properly convert Time/Date fields to YAML. - if value && self.class.serialized_attributes.has_key?(name) && (value.acts_like?(:date) || value.acts_like?(:time)) + value = read_attribute(name) + + if value && ((self.class.serialized_attributes.has_key?(name) && (value.acts_like?(:date) || value.acts_like?(:time))) || value.is_a?(Hash) || value.is_a?(Array)) value = value.to_yaml end - attrs[arel_table[name]] = (value.is_a?(Hash) || value.is_a?(Array)) ? value.to_yaml : value + attrs[arel_table[name]] = value end end end diff --git a/activerecord/test/cases/associations/eager_load_nested_include_test.rb b/activerecord/test/cases/associations/eager_load_nested_include_test.rb index f313a75233..e8db6d5dab 100644 --- a/activerecord/test/cases/associations/eager_load_nested_include_test.rb +++ b/activerecord/test/cases/associations/eager_load_nested_include_test.rb @@ -72,10 +72,8 @@ class EagerLoadPolyAssocsTest < ActiveRecord::TestCase ShapeExpression, NonPolyOne, NonPolyTwo].each do |c| c.delete_all end - end - def generate_test_object_graphs 1.upto(NUM_SIMPLE_OBJS) do [Circle, Square, Triangle, NonPolyOne, NonPolyTwo].map(&:create!) -- cgit v1.2.3 From f8eb4434d61fc1585c9b88dbb2d9159ea1f5b2fa Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 3 Aug 2009 14:15:47 -0300 Subject: Added collection iteration to AR::Relation. --- activerecord/lib/active_record/relation.rb | 4 ++++ activerecord/test/cases/relations_test.rb | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 1c3a1dc53b..f89baa1a74 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -13,6 +13,10 @@ module ActiveRecord @klass.find_by_sql(@relation.to_sql) end + def each(&block) + to_a.each(&block) + end + def first @relation = @relation.take(1) to_a.first diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index c095d9455e..ac3a80afb7 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -73,6 +73,5 @@ class RealtionTest < ActiveRecord::TestCase ).to_a assert_equal 1, person_with_reader_and_post.size end - end -- cgit v1.2.3 From 945ef58533e93d0abbf7ccdb3768e8654cbe6370 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 7 Aug 2009 13:16:34 -0300 Subject: More work on removing plain SQL from associations and use ARel instead. --- activerecord/lib/active_record/associations.rb | 39 +++++++++++----------- activerecord/lib/active_record/calculations.rb | 31 +++++++++++------ .../has_and_belongs_to_many_associations_test.rb | 8 ++--- 3 files changed, 43 insertions(+), 35 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 60da632b3b..7c445f5618 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1662,40 +1662,39 @@ module ActiveRecord def construct_finder_sql_with_included_associations(options, join_dependency) scope = scope(:find) + relation = arel_table((scope && scope[:from]) || options[:from]) + joins = join_dependency.join_associations.collect{|join| join.association_join }.join joins << construct_join(options[:joins], scope) + relation.join(joins) - conditions = construct_conditions(options[:conditions], scope) || '' - conditions << construct_limited_ids_condition(conditions, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - - relation = arel_table((scope && scope[:from]) || options[:from]). - join(joins). - where(conditions). - project(column_aliases(join_dependency)). - group(construct_group(options[:group], options[:having], scope)). - order(construct_order(options[:order], scope) - ) + relation.where(construct_conditions(options[:conditions], scope)) + relation.where(construct_arel_limited_ids_condition(options, join_dependency)) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - relation = relation.take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) + relation.project(column_aliases(join_dependency)) + relation.group(construct_group(options[:group], options[:having], scope)) + relation.order(construct_order(options[:order], scope)) + relation.take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) - return sanitize_sql(relation.to_sql) + sanitize_sql(relation.to_sql) end - def construct_limited_ids_condition(where, options, join_dependency) - unless (id_list = select_limited_ids_list(options, join_dependency)).empty? - "#{where.blank? ? '' : ' AND '} #{connection.quote_table_name table_name}.#{primary_key} IN (#{id_list}) " - else + def construct_arel_limited_ids_condition(options, join_dependency) + if (ids_array = select_limited_ids_array(options, join_dependency)).empty? throw :invalid_query + else + Arel::In.new( + Arel::SqlLiteral.new("#{connection.quote_table_name table_name}.#{primary_key}"), + ids_array + ) end end - def select_limited_ids_list(options, join_dependency) - pk = columns_hash[primary_key] - + def select_limited_ids_array(options, join_dependency) connection.select_all( construct_finder_sql_for_association_limiting(options, join_dependency), "#{name} Load IDs For Limited Eager Loading" - ).collect { |row| connection.quote(row[primary_key], pk) }.join(", ") + ).collect { |row| row[primary_key] } end def construct_finder_sql_for_association_limiting(options, join_dependency) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 5c7247b9c0..3c75200f82 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -148,19 +148,27 @@ module ActiveRecord end catch :invalid_query do - conditions = construct_conditions(options[:conditions], scope) - conditions << construct_limited_ids_condition(conditions, options, join_dependency) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + relation = arel_table((scope && scope[:from]) || options[:from]) + + relation.join(joins) + + relation.where(construct_conditions(options[:conditions], scope)) + relation.where(construct_arel_limited_ids_condition(options, join_dependency)) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + + relation.order(construct_order(options[:order], scope)) + relation.take(options[:limit]) + relation.skip(options[:offset]) if options[:group] - return execute_grouped_calculation(operation, column_name, options.merge(:conditions => conditions, :joins => joins, :distinct => distinct)) + return execute_grouped_calculation(operation, column_name, options, relation) else - return execute_simple_calculation(operation, column_name, options.merge(:conditions => conditions, :joins => joins, :distinct => distinct)) + return execute_simple_calculation(operation, column_name, options.merge(:distinct => distinct), relation) end end 0 end - def execute_simple_calculation(operation, column_name, options) #:nodoc: + def execute_simple_calculation(operation, column_name, options, relation) #:nodoc: column = if column_names.include?(column_name.to_s) Arel::Attribute.new(arel_table(options[:from] || table_name), options[:select] || column_name) @@ -169,14 +177,12 @@ module ActiveRecord (column_name == :all ? "*" : column_name.to_s)) end - value = construct_finder_sql(options.merge( - :select => operation == 'count' ? column.count(options[:distinct]) : column.send(operation) - ), nil) + relation.project(operation == 'count' ? column.count(options[:distinct]) : column.send(operation)) - type_cast_calculated_value(connection.select_value(value), column_for(column_name), operation) + type_cast_calculated_value(connection.select_value(relation.to_sql), column_for(column_name), operation) end - def execute_grouped_calculation(operation, column_name, options) #:nodoc: + def execute_grouped_calculation(operation, column_name, options, relation) #:nodoc: group_attr = options[:group].to_s association = reflect_on_association(group_attr.to_sym) associated = association && association.macro == :belongs_to # only count belongs_to associations @@ -194,7 +200,10 @@ module ActiveRecord options[:select] << ", #{group_field} AS #{group_alias}" - calculated_data = connection.select_all(construct_finder_sql(options, nil)) + relation.project(options[:select]) + relation.group(construct_group(options[:group], options[:having], nil)) + + calculated_data = connection.select_all(relation.to_sql) if association key_ids = calculated_data.collect { |row| row[group_alias] } diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index 14b96caaae..9c915ab010 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -730,7 +730,7 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase assert_equal [projects(:active_record), projects(:action_controller)].map(&:id).sort, developer.project_ids.sort end - def test_select_limited_ids_list + def test_select_limited_ids_array # Set timestamps Developer.transaction do Developer.find(:all, :order => 'id').each_with_index do |record, i| @@ -740,9 +740,9 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase join_base = ActiveRecord::Associations::ClassMethods::JoinDependency::JoinBase.new(Project) join_dep = ActiveRecord::Associations::ClassMethods::JoinDependency.new(join_base, :developers, nil) - projects = Project.send(:select_limited_ids_list, {:order => 'developers.created_at'}, join_dep) + projects = Project.send(:select_limited_ids_array, {:order => 'developers.created_at'}, join_dep) assert !projects.include?("'"), projects - assert_equal %w(1 2), projects.scan(/\d/).sort + assert_equal ["1", "2"], projects.sort end def test_scoped_find_on_through_association_doesnt_return_read_only_records @@ -768,7 +768,7 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase assert_equal developer, project.developers.find(:first) assert_equal project, developer.projects.find(:first) end - + def test_self_referential_habtm_without_foreign_key_set_should_raise_exception assert_raise(ActiveRecord::HasAndBelongsToManyAssociationForeignKeyNeeded) { Member.class_eval do -- cgit v1.2.3 From 6b5fab9300c3e5f2852409ad589d2166373787e7 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 7 Aug 2009 14:33:35 -0300 Subject: Don't scope order in calculations.' --- activerecord/lib/active_record/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 3c75200f82..43e4529575 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -155,7 +155,7 @@ module ActiveRecord relation.where(construct_conditions(options[:conditions], scope)) relation.where(construct_arel_limited_ids_condition(options, join_dependency)) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - relation.order(construct_order(options[:order], scope)) + relation.order(options[:order]) relation.take(options[:limit]) relation.skip(options[:offset]) -- cgit v1.2.3 From d469ad8a49779b3f3d6711989bb334534e94f099 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 7 Aug 2009 16:41:58 -0300 Subject: Removed useless OR. --- activerecord/lib/active_record/associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 7c445f5618..46378edb93 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2184,7 +2184,7 @@ module ActiveRecord ] else "" - end || '' + end join << %(AND %s) % [ klass.send(:type_condition, aliased_table_name)] unless klass.descends_from_active_record? -- cgit v1.2.3 From ae9e1e9f6d08bbd5f5c1512b72d495168e9fa5e5 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 7 Aug 2009 17:55:36 -0300 Subject: Removed unused methods. --- activerecord/lib/active_record/associations.rb | 126 +++++++++++-------------- 1 file changed, 56 insertions(+), 70 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 46378edb93..aeca74ef4a 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1639,19 +1639,6 @@ module ActiveRecord reflection end - def reflect_on_included_associations(associations) - [ associations ].flatten.collect { |association| reflect_on_association(association.to_s.intern) } - end - - def guard_against_unlimitable_reflections(reflections, options) - if (options[:offset] || options[:limit]) && !using_limitable_reflections?(reflections) - raise( - ConfigurationError, - "You can not use offset and limit together with has_many or has_and_belongs_to_many associations" - ) - end - end - def select_all_rows(options, join_dependency) connection.select_all( construct_finder_sql_with_included_associations(options, join_dependency), @@ -2083,25 +2070,24 @@ module ActiveRecord options[:association_foreign_key] || klass.to_s.foreign_key ] when :has_many, :has_one - case - when reflection.options[:through] - through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : '' - - jt_foreign_key = jt_as_extra = jt_source_extra = jt_sti_extra = nil - first_key = second_key = as_extra = nil - - if through_reflection.options[:as] # has_many :through against a polymorphic join - jt_foreign_key = through_reflection.options[:as].to_s + '_id' - jt_as_extra = " AND %s.%s = %s" % [ - connection.quote_table_name(aliased_join_table_name), - connection.quote_column_name(through_reflection.options[:as].to_s + '_type'), - klass.quote_value(parent.active_record.base_class.name) - ] - else - jt_foreign_key = through_reflection.primary_key_name - end - - case source_reflection.macro + if reflection.options[:through] + through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : '' + + jt_foreign_key = jt_as_extra = jt_source_extra = jt_sti_extra = nil + first_key = second_key = as_extra = nil + + if through_reflection.options[:as] # has_many :through against a polymorphic join + jt_foreign_key = through_reflection.options[:as].to_s + '_id' + jt_as_extra = " AND %s.%s = %s" % [ + connection.quote_table_name(aliased_join_table_name), + connection.quote_column_name(through_reflection.options[:as].to_s + '_type'), + klass.quote_value(parent.active_record.base_class.name) + ] + else + jt_foreign_key = through_reflection.primary_key_name + end + + case source_reflection.macro when :has_many if source_reflection.options[:as] first_key = "#{source_reflection.options[:as]}_id" @@ -2134,45 +2120,45 @@ module ActiveRecord else second_key = source_reflection.primary_key_name end - end - - " #{join_type} %s ON (%s.%s = %s.%s%s%s%s) " % [ - table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), - connection.quote_table_name(parent.aliased_table_name), - connection.quote_column_name(parent.primary_key), - connection.quote_table_name(aliased_join_table_name), - connection.quote_column_name(jt_foreign_key), - jt_as_extra, jt_source_extra, jt_sti_extra - ] + - " #{join_type} %s ON (%s.%s = %s.%s%s) " % [ - table_name_and_alias, - connection.quote_table_name(aliased_table_name), - connection.quote_column_name(first_key), - connection.quote_table_name(aliased_join_table_name), - connection.quote_column_name(second_key), - as_extra - ] + end + + " #{join_type} %s ON (%s.%s = %s.%s%s%s%s) " % [ + table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), + connection.quote_table_name(parent.aliased_table_name), + connection.quote_column_name(parent.primary_key), + connection.quote_table_name(aliased_join_table_name), + connection.quote_column_name(jt_foreign_key), + jt_as_extra, jt_source_extra, jt_sti_extra + ] + + " #{join_type} %s ON (%s.%s = %s.%s%s) " % [ + table_name_and_alias, + connection.quote_table_name(aliased_table_name), + connection.quote_column_name(first_key), + connection.quote_table_name(aliased_join_table_name), + connection.quote_column_name(second_key), + as_extra + ] - when reflection.options[:as] && [:has_many, :has_one].include?(reflection.macro) - " #{join_type} %s ON %s.%s = %s.%s AND %s.%s = %s" % [ - table_name_and_alias, - connection.quote_table_name(aliased_table_name), - "#{reflection.options[:as]}_id", - connection.quote_table_name(parent.aliased_table_name), - parent.primary_key, - connection.quote_table_name(aliased_table_name), - "#{reflection.options[:as]}_type", - klass.quote_value(parent.active_record.base_class.name) - ] - else - foreign_key = options[:foreign_key] || reflection.active_record.name.foreign_key - " #{join_type} %s ON %s.%s = %s.%s " % [ - table_name_and_alias, - aliased_table_name, - foreign_key, - parent.aliased_table_name, - reflection.options[:primary_key] || parent.primary_key - ] + elsif reflection.options[:as] && [:has_many, :has_one].include?(reflection.macro) + " #{join_type} %s ON %s.%s = %s.%s AND %s.%s = %s" % [ + table_name_and_alias, + connection.quote_table_name(aliased_table_name), + "#{reflection.options[:as]}_id", + connection.quote_table_name(parent.aliased_table_name), + parent.primary_key, + connection.quote_table_name(aliased_table_name), + "#{reflection.options[:as]}_type", + klass.quote_value(parent.active_record.base_class.name) + ] + else + foreign_key = options[:foreign_key] || reflection.active_record.name.foreign_key + " #{join_type} %s ON %s.%s = %s.%s " % [ + table_name_and_alias, + aliased_table_name, + foreign_key, + parent.aliased_table_name, + reflection.options[:primary_key] || parent.primary_key + ] end when :belongs_to " #{join_type} %s ON %s.%s = %s.%s " % [ -- cgit v1.2.3 From 9ac01fad193b27e517ea772e0d1e13e06f4ddf34 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 14 Aug 2009 12:33:05 -0300 Subject: Use ARel's joins when building a query for finding records with included associations. --- activerecord/lib/active_record/associations.rb | 106 ++++++++++++++----------- activerecord/lib/active_record/base.rb | 21 +++-- activerecord/lib/active_record/calculations.rb | 23 ++---- activerecord/lib/active_record/relation.rb | 12 ++- arel | 2 +- 5 files changed, 89 insertions(+), 75 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index baad8fc5fd..e4cd515f15 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1673,14 +1673,20 @@ module ActiveRecord ) end - def construct_finder_sql_with_included_associations(options, join_dependency) + def construct_finder_arel_with_included_associations(options, join_dependency) scope = scope(:find) relation = arel_table((scope && scope[:from]) || options[:from]) - joins = join_dependency.join_associations.collect{|join| join.association_join }.join - joins << construct_join(options[:joins], scope) - relation.join(joins) + for association in join_dependency.join_associations + if association.relation.is_a?(Array) + relation.join(association.relation.first, association.join_type).on(association.association_join.first) + relation.join(association.relation.last, association.join_type).on(association.association_join.last) + else + relation.join(association.relation, association.join_type).on(association.association_join) + end + end + relation.join(construct_join(options[:joins], scope)) relation.where(construct_conditions(options[:conditions], scope)) relation.where(construct_arel_limited_ids_condition(options, join_dependency)) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) @@ -1690,7 +1696,11 @@ module ActiveRecord relation.order(construct_order(options[:order], scope)) relation.take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) - sanitize_sql(relation.to_sql) + relation + end + + def construct_finder_sql_with_included_associations(options, join_dependency) + sanitize_sql(construct_finder_arel_with_included_associations(options, join_dependency).to_sql) end def construct_arel_limited_ids_condition(options, join_dependency) @@ -1716,9 +1726,15 @@ module ActiveRecord relation = arel_table(options[:from]) - joins = join_dependency.join_associations.collect{|join| join.association_join }.join - joins << construct_join(options[:joins], scope) - relation.join(joins) + for association in join_dependency.join_associations + if association.relation.is_a?(Array) + relation.join(association.relation.first, association.join_type).on(association.association_join.first) + relation.join(association.relation.last, association.join_type).on(association.association_join.last) + else + relation.join(association.relation, association.join_type).on(association.association_join) + end + end + relation.join(construct_join(options[:joins], scope)) relation.where(construct_conditions(options[:conditions], scope)) relation.project(connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(","))) @@ -1907,12 +1923,6 @@ module ActiveRecord end end - def join_for_table_name(table_name) - join = (@joins.select{|j|j.aliased_table_name == table_name.gsub(/^\"(.*)\"$/){$1} }.first) rescue nil - return join unless join.nil? - @joins.select{|j|j.is_a?(JoinAssociation) && j.aliased_join_table_name == table_name.gsub(/^\"(.*)\"$/){$1} }.first rescue nil - end - def joins_for_table_name(table_name) join = join_for_table_name(table_name) result = nil @@ -2088,19 +2098,18 @@ module ActiveRecord connection = reflection.active_record.connection join = case reflection.macro when :has_and_belongs_to_many - " #{join_type} %s ON %s.%s = %s.%s " % [ - table_alias_for(options[:join_table], aliased_join_table_name), + ["%s.%s = %s.%s " % [ connection.quote_table_name(aliased_join_table_name), options[:foreign_key] || reflection.active_record.to_s.foreign_key, connection.quote_table_name(parent.aliased_table_name), - reflection.active_record.primary_key] + - " #{join_type} %s ON %s.%s = %s.%s " % [ - table_name_and_alias, + reflection.active_record.primary_key], + "%s.%s = %s.%s " % [ connection.quote_table_name(aliased_table_name), klass.primary_key, connection.quote_table_name(aliased_join_table_name), options[:association_foreign_key] || klass.to_s.foreign_key ] + ] when :has_many, :has_one if reflection.options[:through] through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : '' @@ -2154,26 +2163,22 @@ module ActiveRecord end end - " #{join_type} %s ON (%s.%s = %s.%s%s%s%s) " % [ - table_alias_for(through_reflection.klass.table_name, aliased_join_table_name), + ["(%s.%s = %s.%s%s%s%s) " % [ connection.quote_table_name(parent.aliased_table_name), connection.quote_column_name(parent.primary_key), connection.quote_table_name(aliased_join_table_name), connection.quote_column_name(jt_foreign_key), - jt_as_extra, jt_source_extra, jt_sti_extra - ] + - " #{join_type} %s ON (%s.%s = %s.%s%s) " % [ - table_name_and_alias, + jt_as_extra, jt_source_extra, jt_sti_extra], + "(%s.%s = %s.%s%s) " % [ connection.quote_table_name(aliased_table_name), connection.quote_column_name(first_key), connection.quote_table_name(aliased_join_table_name), connection.quote_column_name(second_key), - as_extra + as_extra] ] elsif reflection.options[:as] && [:has_many, :has_one].include?(reflection.macro) - " #{join_type} %s ON %s.%s = %s.%s AND %s.%s = %s" % [ - table_name_and_alias, + "%s.%s = %s.%s AND %s.%s = %s" % [ connection.quote_table_name(aliased_table_name), "#{reflection.options[:as]}_id", connection.quote_table_name(parent.aliased_table_name), @@ -2184,8 +2189,7 @@ module ActiveRecord ] else foreign_key = options[:foreign_key] || reflection.active_record.name.foreign_key - " #{join_type} %s ON %s.%s = %s.%s " % [ - table_name_and_alias, + "%s.%s = %s.%s " % [ aliased_table_name, foreign_key, parent.aliased_table_name, @@ -2193,13 +2197,12 @@ module ActiveRecord ] end when :belongs_to - " #{join_type} %s ON %s.%s = %s.%s " % [ - table_name_and_alias, - connection.quote_table_name(aliased_table_name), - reflection.klass.primary_key, - connection.quote_table_name(parent.aliased_table_name), - options[:foreign_key] || reflection.primary_key_name - ] + "%s.%s = %s.%s " % [ + connection.quote_table_name(aliased_table_name), + reflection.klass.primary_key, + connection.quote_table_name(parent.aliased_table_name), + options[:foreign_key] || reflection.primary_key_name + ] else "" end @@ -2213,6 +2216,20 @@ module ActiveRecord join end + def relation + if reflection.macro == :has_and_belongs_to_many + [Arel::Table.new(table_alias_for(options[:join_table], aliased_join_table_name)), Arel::Table.new(table_name_and_alias)] + elsif reflection.options[:through] + [Arel::Table.new(table_alias_for(through_reflection.klass.table_name, aliased_join_table_name)), Arel::Table.new(table_name_and_alias)] + else + Arel::Table.new(table_name_and_alias) + end + end + + def join_type + Arel::OuterJoin + end + protected def aliased_table_name_for(name, suffix = nil) @@ -2238,7 +2255,7 @@ module ActiveRecord end def table_alias_for(table_name, table_alias) - "#{reflection.active_record.connection.quote_table_name(table_name)} #{table_alias if table_name != table_alias}".strip + "#{table_name} #{table_alias if table_name != table_alias}".strip end def table_name_and_alias @@ -2248,11 +2265,6 @@ module ActiveRecord def interpolate_sql(sql) instance_eval("%@#{sql.gsub('@', '\@')}@") end - - private - def join_type - "LEFT OUTER JOIN" - end end end @@ -2263,13 +2275,11 @@ module ActiveRecord end class InnerJoinAssociation < JoinAssociation - private - def join_type - "INNER JOIN" - end + def join_type + Arel::InnerJoin + end end end - end end end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index e1f4461965..a6832b47ef 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1741,8 +1741,7 @@ module ActiveRecord #:nodoc: if array_of_strings?(merged_joins) merged_joins.join(' ') + " " else - join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, merged_joins, nil) - " #{join_dependency.join_associations.collect { |assoc| assoc.association_join }.join} " + build_association_joins(merged_joins) end when String " #{merged_joins} " @@ -1801,10 +1800,7 @@ module ActiveRecord #:nodoc: if joins.any?{|j| j.is_a?(String) || array_of_strings?(j) } joins = joins.collect do |join| join = [join] if join.is_a?(String) - unless array_of_strings?(join) - join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, join, nil) - join = join_dependency.join_associations.collect { |assoc| assoc.association_join } - end + join = build_association_joins(join) unless array_of_strings?(join) join end joins.flatten.map{|j| j.strip}.uniq @@ -1813,6 +1809,19 @@ module ActiveRecord #:nodoc: end end + def build_association_joins(joins) + join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, joins, nil) + relation = arel_table + join_dependency.join_associations.map { |association| + if association.relation.is_a?(Array) + [Arel::InnerJoin.new(relation, association.relation.first, association.association_join.first).joins(relation), + Arel::InnerJoin.new(relation, association.relation.last, association.association_join.last).joins(relation)].join() + else + Arel::InnerJoin.new(relation, association.relation, association.association_join).joins(relation) + end + }.join(" ") + end + # Object#to_a is deprecated, though it does have the desired behavior def safe_to_array(o) case o diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 6a5f2222a2..ab501dac33 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -128,12 +128,6 @@ module ActiveRecord scope = scope(:find) merged_includes = merge_includes(scope ? scope[:include] : [], options[:include]) - joins = construct_join(options[:joins], scope) - - if merged_includes.any? - join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, joins) - joins << join_dependency.join_associations.collect{|join| join.association_join }.join - end if operation == "count" if merged_includes.any? @@ -148,17 +142,12 @@ module ActiveRecord end catch :invalid_query do - relation = arel_table((scope && scope[:from]) || options[:from]) - - relation.join(joins) - - relation.where(construct_conditions(options[:conditions], scope)) - relation.where(construct_arel_limited_ids_condition(options, join_dependency)) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - - relation.order(options[:order]) - relation.take(options[:limit]) - relation.skip(options[:offset]) - + relation = if merged_includes.any? + join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) + construct_finder_arel_with_included_associations(options, join_dependency) + else + construct_finder_arel(options) + end if options[:group] return execute_grouped_calculation(operation, column_name, options, relation) else diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index f89baa1a74..456de73250 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,7 +1,7 @@ module ActiveRecord class Relation delegate :delete, :to_sql, :to => :relation - CLAUSES_METHODS = ["project", "group", "order", "take", "skip"].freeze + CLAUSES_METHODS = ["project", "group", "order", "take", "skip", "on"].freeze attr_reader :relation, :klass def initialize(klass, table = nil) @@ -31,8 +31,14 @@ module ActiveRecord } end - def join(joins) - @relation = @relation.join(@klass.send(:construct_join, joins, nil)) if !joins.blank? + def join(joins, join_type = nil) + if !joins.blank? + if [String, Hash, Array, Symbol].include?(joins.class) + @relation = @relation.join(@klass.send(:construct_join, joins, nil)) + else + @relation = @relation.join(joins, join_type) + end + end self end diff --git a/arel b/arel index 808b9e90a3..3d747a56b7 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 808b9e90a38c6c19e109da8eb5f2a264fd780d9a +Subproject commit 3d747a56b76ae97645dd265cc75e73e5f7827193 -- cgit v1.2.3 From 796ec652ade1bfbf074fc1cfd2cd2e7794f494bc Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 14 Aug 2009 15:59:55 -0300 Subject: Don't use regular rinder on calculations since scoping order blows PostreSQL. --- activerecord/lib/active_record/calculations.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index ab501dac33..658101d8ee 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -146,7 +146,13 @@ module ActiveRecord join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) construct_finder_arel_with_included_associations(options, join_dependency) else - construct_finder_arel(options) + arel_table(options[:from]). + join(construct_join(options[:joins], scope)). + where(construct_conditions(options[:conditions], scope)). + group(construct_group(options[:group], options[:having], scope)). + order(options[:order]). + take(options[:limit]). + skip(options[:offset]) end if options[:group] return execute_grouped_calculation(operation, column_name, options, relation) -- cgit v1.2.3 From 770fca10fba68fa14308f33e923493e6f63bfa35 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Sun, 16 Aug 2009 17:27:45 -0300 Subject: Remove group when building the relation, it will be added later if options[:group] is given. --- activerecord/lib/active_record/calculations.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 658101d8ee..82a171c6ad 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -149,7 +149,6 @@ module ActiveRecord arel_table(options[:from]). join(construct_join(options[:joins], scope)). where(construct_conditions(options[:conditions], scope)). - group(construct_group(options[:group], options[:having], scope)). order(options[:order]). take(options[:limit]). skip(options[:offset]) -- cgit v1.2.3 From c923409630a92d1a935699c1427702c822601165 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 17 Aug 2009 20:17:40 -0300 Subject: Clean up relation joins when finding records with included associations. --- activerecord/lib/active_record/associations.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index e4cd515f15..406f08e247 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1679,12 +1679,7 @@ module ActiveRecord relation = arel_table((scope && scope[:from]) || options[:from]) for association in join_dependency.join_associations - if association.relation.is_a?(Array) - relation.join(association.relation.first, association.join_type).on(association.association_join.first) - relation.join(association.relation.last, association.join_type).on(association.association_join.last) - else - relation.join(association.relation, association.join_type).on(association.association_join) - end + relation = association.join_relation(relation) end relation.join(construct_join(options[:joins], scope)) @@ -1727,12 +1722,7 @@ module ActiveRecord relation = arel_table(options[:from]) for association in join_dependency.join_associations - if association.relation.is_a?(Array) - relation.join(association.relation.first, association.join_type).on(association.association_join.first) - relation.join(association.relation.last, association.join_type).on(association.association_join.last) - else - relation.join(association.relation, association.join_type).on(association.association_join) - end + relation = association.join_relation(relation) end relation.join(construct_join(options[:joins], scope)) @@ -2230,6 +2220,16 @@ module ActiveRecord Arel::OuterJoin end + def join_relation(joining_relation, join = nil) + if relation.is_a?(Array) + joining_relation.join(relation.first, join_type).on(association_join.first) + joining_relation.join(relation.last, join_type).on(association_join.last) + else + joining_relation.join(relation, join_type).on(association_join) + end + joining_relation + end + protected def aliased_table_name_for(name, suffix = nil) -- cgit v1.2.3 From 79e951ca9bc875da9e4a19adeff3634f0b5b7b76 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 07:50:11 -0300 Subject: Use finder options as relation method names to provide more familiar naming. Use bang methods convention in methods that alter the relation. --- activerecord/lib/active_record/associations.rb | 34 +++++++++++----------- activerecord/lib/active_record/base.rb | 31 ++++++++++---------- activerecord/lib/active_record/calculations.rb | 18 ++++++------ activerecord/lib/active_record/relation.rb | 32 +++++++++++++++----- activerecord/test/cases/associations/eager_test.rb | 10 +++---- activerecord/test/cases/base_test.rb | 2 +- activerecord/test/cases/relations_test.rb | 22 +++++++------- 7 files changed, 81 insertions(+), 68 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 406f08e247..d0322280d9 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1681,15 +1681,15 @@ module ActiveRecord for association in join_dependency.join_associations relation = association.join_relation(relation) end - relation.join(construct_join(options[:joins], scope)) - relation.where(construct_conditions(options[:conditions], scope)) - relation.where(construct_arel_limited_ids_condition(options, join_dependency)) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + relation.joins!(construct_join(options[:joins], scope)). + select!(column_aliases(join_dependency)). + group!(construct_group(options[:group], options[:having], scope)). + order!(construct_order(options[:order], scope)). + conditions!(construct_conditions(options[:conditions], scope)) - relation.project(column_aliases(join_dependency)) - relation.group(construct_group(options[:group], options[:having], scope)) - relation.order(construct_order(options[:order], scope)) - relation.take(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) + relation.conditions!(construct_arel_limited_ids_condition(options, join_dependency)) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + relation.limit!(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) relation end @@ -1724,15 +1724,15 @@ module ActiveRecord for association in join_dependency.join_associations relation = association.join_relation(relation) end - relation.join(construct_join(options[:joins], scope)) - relation.where(construct_conditions(options[:conditions], scope)) - relation.project(connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(","))) + relation.joins!(construct_join(options[:joins], scope)). + conditions!(construct_conditions(options[:conditions], scope)). + group!(construct_group(options[:group], options[:having], scope)). + order!(construct_order(options[:order], scope)). + limit!(construct_limit(options[:limit], scope)). + offset!(construct_limit(options[:offset], scope)) - relation.group(construct_group(options[:group], options[:having], scope)) - relation.order(construct_order(options[:order], scope)) - relation.take(construct_limit(options[:limit], scope)) - relation.skip(construct_limit(options[:offset], scope)) + relation.select!(connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(","))) sanitize_sql(relation.to_sql) end @@ -2222,10 +2222,10 @@ module ActiveRecord def join_relation(joining_relation, join = nil) if relation.is_a?(Array) - joining_relation.join(relation.first, join_type).on(association_join.first) - joining_relation.join(relation.last, join_type).on(association_join.last) + joining_relation.joins!(relation.first, join_type).on!(association_join.first) + joining_relation.joins!(relation.last, join_type).on!(association_join.last) else - joining_relation.join(relation, join_type).on(association_join) + joining_relation.joins!(relation, join_type).on!(association_join) end joining_relation end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index a6832b47ef..2b79788b89 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -866,18 +866,18 @@ module ActiveRecord #:nodoc: def update_all(updates, conditions = nil, options = {}) scope = scope(:find) - relation = arel_table.relation + relation = arel_table if conditions = construct_conditions(conditions, scope) - relation = relation.where(Arel::SqlLiteral.new(conditions)) + relation.conditions!(Arel::SqlLiteral.new(conditions)) end if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - relation = relation.order(construct_order(options[:order], scope)).take(construct_limit(options[:limit], scope)) + relation.order!(construct_order(options[:order], scope)).limit!(construct_limit(options[:limit], scope)) else - relation = relation.order(construct_order(options[:order], nil)) + relation.order!(options[:order]) end relation.update(sanitize_sql_for_assignment(updates)) @@ -932,7 +932,7 @@ module ActiveRecord #:nodoc: # associations or call your before_* or +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) if conditions - arel_table.where(Arel::SqlLiteral.new(construct_conditions(conditions, scope(:find)))).delete + arel_table.conditions!(Arel::SqlLiteral.new(construct_conditions(conditions, scope(:find)))).delete else arel_table.delete end @@ -1719,15 +1719,14 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - arel_table(options[:from]). - join(construct_join(options[:joins], scope)). - where(construct_conditions(options[:conditions], scope)). - project(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). - group(construct_group(options[:group], options[:having], scope)). - order(construct_order(options[:order], scope)). - take(construct_limit(options[:limit], scope)). - skip(construct_offset(options[:offset], scope) - ) + relation = arel_table(options[:from]). + joins!(construct_join(options[:joins], scope)). + conditions!(construct_conditions(options[:conditions], scope)). + select!(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). + group!(construct_group(options[:group], options[:having], scope)). + order!(construct_order(options[:order], scope)). + limit!(construct_limit(options[:limit], scope)). + offset!(construct_offset(options[:offset], scope)) end def construct_finder_sql(options, scope = scope(:find)) @@ -2570,7 +2569,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - arel_table(true).where(arel_table[self.class.primary_key].eq(id)).delete + arel_table(true).conditions!(arel_table[self.class.primary_key].eq(id)).delete end @destroyed = true @@ -2865,7 +2864,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - arel_table(true).where(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) + arel_table(true).conditions!(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 82a171c6ad..cd2fbe9b79 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -146,12 +146,12 @@ module ActiveRecord join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) construct_finder_arel_with_included_associations(options, join_dependency) else - arel_table(options[:from]). - join(construct_join(options[:joins], scope)). - where(construct_conditions(options[:conditions], scope)). - order(options[:order]). - take(options[:limit]). - skip(options[:offset]) + relation = arel_table(options[:from]). + joins!(construct_join(options[:joins], scope)). + conditions!(construct_conditions(options[:conditions], scope)). + order!(options[:order]). + limit!(options[:limit]). + offset!(options[:offset]) end if options[:group] return execute_grouped_calculation(operation, column_name, options, relation) @@ -171,7 +171,7 @@ module ActiveRecord (column_name == :all ? "*" : column_name.to_s)) end - relation.project(operation == 'count' ? column.count(options[:distinct]) : column.send(operation)) + relation.select!(operation == 'count' ? column.count(options[:distinct]) : column.send(operation)) type_cast_calculated_value(connection.select_value(relation.to_sql), column_for(column_name), operation) end @@ -194,8 +194,8 @@ module ActiveRecord options[:select] << ", #{group_field} AS #{group_alias}" - relation.project(options[:select]) - relation.group(construct_group(options[:group], options[:having], nil)) + relation.select!(options[:select]) + relation.group!(construct_group(options[:group], options[:having], nil)) calculated_data = connection.select_all(relation.to_sql) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 456de73250..bbbb1da210 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,7 +1,7 @@ module ActiveRecord class Relation delegate :delete, :to_sql, :to => :relation - CLAUSES_METHODS = ["project", "group", "order", "take", "skip", "on"].freeze + CLAUSES_METHODS = ["project", "where", "group", "order", "take", "skip", "on"].freeze attr_reader :relation, :klass def initialize(klass, table = nil) @@ -24,25 +24,41 @@ module ActiveRecord for clause in CLAUSES_METHODS class_eval %{ - def #{clause}(_#{clause}) + def #{clause}!(_#{clause}) @relation = @relation.#{clause}(_#{clause}) if _#{clause} self end } end - def join(joins, join_type = nil) - if !joins.blank? - if [String, Hash, Array, Symbol].include?(joins.class) - @relation = @relation.join(@klass.send(:construct_join, joins, nil)) + + def select!(selection) + @relation = @relation.project(selection) if selection + self + end + + def limit!(limit) + @relation = @relation.take(limit) if limit + self + end + + def offset!(offset) + @relation = @relation.skip(offset) if offset + self + end + + def joins!(join, join_type = nil) + if !join.blank? + if [String, Hash, Array, Symbol].include?(join.class) + @relation = @relation.join(@klass.send(:construct_join, join, nil)) else - @relation = @relation.join(joins, join_type) + @relation = @relation.join(join, join_type) end end self end - def where(conditions) + def conditions!(conditions) if !conditions.blank? conditions = @klass.send(:merge_conditions, conditions) if [String, Hash, Array].include?(conditions.class) @relation = @relation.where(conditions) diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 811ebfbe3f..d5a4d9007b 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -301,13 +301,13 @@ class EagerAssociationTest < ActiveRecord::TestCase subscriber =Subscriber.find(subscribers(:second).id, :include => :subscriptions) assert_equal subscriptions, subscriber.subscriptions.sort_by(&:id) end - + def test_eager_load_has_many_through_with_string_keys books = books(:awdr, :rfr) subscriber = Subscriber.find(subscribers(:second).id, :include => :books) assert_equal books, subscriber.books.sort_by(&:id) end - + def test_eager_load_belongs_to_with_string_keys subscriber = subscribers(:second) subscription = Subscription.find(subscriptions(:webster_awdr).id, :include => :subscriber) @@ -434,7 +434,7 @@ class EagerAssociationTest < ActiveRecord::TestCase author_posts_without_comments = author.posts.select { |post| post.comments.blank? } assert_equal author_posts_without_comments.size, author.posts.count(:all, :include => :comments, :conditions => 'comments.id is null') end - + def test_eager_count_performed_on_a_has_many_through_association_with_multi_table_conditional person = people(:michael) person_posts_without_comments = person.posts.select { |post| post.comments.blank? } @@ -823,7 +823,7 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal expected, firm.clients_using_primary_key end end - + def test_preload_has_one_using_primary_key expected = Firm.find(:first).account_using_primary_key firm = Firm.find :first, :include => :account_using_primary_key @@ -839,5 +839,5 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal expected, firm.account_using_primary_key end end - + end diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index df15c1a797..b4f29f939a 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1893,7 +1893,7 @@ class BasicsTest < ActiveRecord::TestCase end def test_all_with_conditions - assert_equal Developer.find(:all, :order => 'id desc'), Developer.all.order('id desc').to_a + assert_equal Developer.find(:all, :order => 'id desc'), Developer.all.order!('id desc').to_a end def test_find_ordered_last diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index ac3a80afb7..663f54b5a1 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -11,49 +11,47 @@ class RealtionTest < ActiveRecord::TestCase fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts def test_finding_with_conditions - authors = Author.all.where("name = 'David'") - - assert_equal Author.find(:all, :conditions => "name = 'David'"), authors.to_a + assert_equal Author.find(:all, :conditions => "name = 'David'"), Author.all.conditions!("name = 'David'").to_a end def test_finding_with_order - topics = Topic.all.order('id') + topics = Topic.all.order!('id') assert_equal 4, topics.size assert_equal topics(:first).title, topics.first.title end def test_finding_with_order_and_take - entrants = Entrant.all.order("id ASC").take(2).to_a + entrants = Entrant.all.order!("id ASC").limit!(2).to_a assert_equal(2, entrants.size) assert_equal(entrants(:first).name, entrants.first.name) end def test_finding_with_order_limit_and_offset - entrants = Entrant.all.order("id ASC").take(2).skip(1) + entrants = Entrant.all.order!("id ASC").limit!(2).offset!(1) assert_equal(2, entrants.size) assert_equal(entrants(:second).name, entrants.first.name) - entrants = Entrant.all.order("id ASC").take(2).skip(2) + entrants = Entrant.all.order!("id ASC").limit!(2).offset!(2) assert_equal(1, entrants.size) assert_equal(entrants(:third).name, entrants.first.name) end def test_finding_with_group - developers = Developer.all.group("salary").project("salary").to_a + developers = Developer.all.group!("salary").select!("salary").to_a assert_equal 4, developers.size assert_equal 4, developers.map(&:salary).uniq.size end def test_finding_with_hash_conditions_on_joined_table - firms = DependentFirm.all.join(:account).where({:name => 'RailsCore', :accounts => { :credit_limit => 55..60 }}).to_a + firms = DependentFirm.all.joins!(:account).conditions!({:name => 'RailsCore', :accounts => { :credit_limit => 55..60 }}).to_a assert_equal 1, firms.size assert_equal companies(:rails_core), firms.first end def test_find_all_with_join - developers_on_project_one = Developer.all.join('LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id').where('project_id=1').to_a + developers_on_project_one = Developer.all.joins!('LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id').conditions!('project_id=1').to_a assert_equal 3, developers_on_project_one.length developer_names = developers_on_project_one.map { |d| d.name } @@ -62,11 +60,11 @@ class RealtionTest < ActiveRecord::TestCase end def test_find_on_hash_conditions - assert_equal Topic.find(:all, :conditions => {:approved => false}), Topic.all.where({ :approved => false }).to_a + assert_equal Topic.find(:all, :conditions => {:approved => false}), Topic.all.conditions!({ :approved => false }).to_a end def test_joins_with_string_array - person_with_reader_and_post = Post.all.join([ + person_with_reader_and_post = Post.all.joins!([ "INNER JOIN categorizations ON categorizations.post_id = posts.id", "INNER JOIN categories ON categories.id = categorizations.category_id AND categories.type = 'SpecialCategory'" ] -- cgit v1.2.3 From 08f6af2d5357b82b59f968aa5e926f6c6fd1e2ff Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 08:12:35 -0300 Subject: Fix typo in test classname. --- activerecord/test/cases/relations_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 663f54b5a1..e8b222f876 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -7,7 +7,7 @@ require 'models/entrant' require 'models/developer' require 'models/company' -class RealtionTest < ActiveRecord::TestCase +class RelationTest < ActiveRecord::TestCase fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts def test_finding_with_conditions -- cgit v1.2.3 From fa8f5c2667fa82feab66aa102993ab4f123d42bc Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 08:18:24 -0300 Subject: Relation#joins! should know what to join instead of delegating to construct_join. --- activerecord/lib/active_record/relation.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index bbbb1da210..0d43c53d10 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,7 +1,7 @@ module ActiveRecord class Relation delegate :delete, :to_sql, :to => :relation - CLAUSES_METHODS = ["project", "where", "group", "order", "take", "skip", "on"].freeze + CLAUSES_METHODS = ["group", "order", "on"].freeze attr_reader :relation, :klass def initialize(klass, table = nil) @@ -31,7 +31,6 @@ module ActiveRecord } end - def select!(selection) @relation = @relation.project(selection) if selection self @@ -47,12 +46,19 @@ module ActiveRecord self end - def joins!(join, join_type = nil) - if !join.blank? - if [String, Hash, Array, Symbol].include?(join.class) - @relation = @relation.join(@klass.send(:construct_join, join, nil)) + def joins!(joins, join_type = nil) + if !joins.blank? + @relation = case joins + when String + @relation.join(joins) + when Hash, Array, Symbol + if @klass.send(:array_of_strings?, joins) + @relation.join(joins.join(' ')) + else + @relation.join(@klass.send(:build_association_joins, joins)) + end else - @relation = @relation.join(join, join_type) + @relation.join(joins, join_type) end end self -- cgit v1.2.3 From ac03bc91dbee36233e061eb624f7781a49ab6fcf Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 08:27:37 -0300 Subject: Use explicit method definition instead of metaprogramming. --- activerecord/lib/active_record/relation.rb | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 0d43c53d10..9c7ba881fc 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,7 +1,6 @@ module ActiveRecord class Relation - delegate :delete, :to_sql, :to => :relation - CLAUSES_METHODS = ["group", "order", "on"].freeze + delegate :to_sql, :to => :relation attr_reader :relation, :klass def initialize(klass, table = nil) @@ -22,20 +21,26 @@ module ActiveRecord to_a.first end - for clause in CLAUSES_METHODS - class_eval %{ - def #{clause}!(_#{clause}) - @relation = @relation.#{clause}(_#{clause}) if _#{clause} - self - end - } - end - def select!(selection) @relation = @relation.project(selection) if selection self end + def on!(on) + @relation = @relation.on(on) if on + self + end + + def order!(order) + @relation = @relation.order(order) if order + self + end + + def group!(group) + @relation = @relation.group(group) if group + self + end + def limit!(limit) @relation = @relation.take(limit) if limit self -- cgit v1.2.3 From 66fbcc1de646129a3fc7415aa2f8416ef78d8cbb Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 14:10:03 -0300 Subject: Use immutable relation objects to generate queries. --- activerecord/lib/active_record/associations.rb | 37 +++++++------- activerecord/lib/active_record/base.rb | 34 ++++++------ activerecord/lib/active_record/calculations.rb | 15 +++--- activerecord/lib/active_record/relation.rb | 71 ++++++++++++-------------- activerecord/test/cases/base_test.rb | 2 +- activerecord/test/cases/relations_test.rb | 20 ++++---- 6 files changed, 87 insertions(+), 92 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index d0322280d9..c0741bb572 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1682,14 +1682,14 @@ module ActiveRecord relation = association.join_relation(relation) end - relation.joins!(construct_join(options[:joins], scope)). - select!(column_aliases(join_dependency)). - group!(construct_group(options[:group], options[:having], scope)). - order!(construct_order(options[:order], scope)). - conditions!(construct_conditions(options[:conditions], scope)) + relation = relation.joins(construct_join(options[:joins], scope)). + select(column_aliases(join_dependency)). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope)). + conditions(construct_conditions(options[:conditions], scope)) - relation.conditions!(construct_arel_limited_ids_condition(options, join_dependency)) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - relation.limit!(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) + relation = relation.conditions(construct_arel_limited_ids_condition(options, join_dependency)) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) + relation = relation.limit(construct_limit(options[:limit], scope)) if using_limitable_reflections?(join_dependency.reflections) relation end @@ -1725,14 +1725,13 @@ module ActiveRecord relation = association.join_relation(relation) end - relation.joins!(construct_join(options[:joins], scope)). - conditions!(construct_conditions(options[:conditions], scope)). - group!(construct_group(options[:group], options[:having], scope)). - order!(construct_order(options[:order], scope)). - limit!(construct_limit(options[:limit], scope)). - offset!(construct_limit(options[:offset], scope)) - - relation.select!(connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(","))) + relation = relation.joins(construct_join(options[:joins], scope)). + conditions(construct_conditions(options[:conditions], scope)). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope)). + limit(construct_limit(options[:limit], scope)). + offset(construct_limit(options[:offset], scope)). + select(connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(","))) sanitize_sql(relation.to_sql) end @@ -2222,12 +2221,12 @@ module ActiveRecord def join_relation(joining_relation, join = nil) if relation.is_a?(Array) - joining_relation.joins!(relation.first, join_type).on!(association_join.first) - joining_relation.joins!(relation.last, join_type).on!(association_join.last) + joining_relation. + joins(relation.first, join_type).on(association_join.first). + joins(relation.last, join_type).on(association_join.last) else - joining_relation.joins!(relation, join_type).on!(association_join) + joining_relation.joins(relation, join_type).on(association_join) end - joining_relation end protected diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2b79788b89..b23ce53d43 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -869,15 +869,15 @@ module ActiveRecord #:nodoc: relation = arel_table if conditions = construct_conditions(conditions, scope) - relation.conditions!(Arel::SqlLiteral.new(conditions)) + relation = relation.conditions(Arel::SqlLiteral.new(conditions)) end - if options.has_key?(:limit) || (scope && scope[:limit]) + relation = if options.has_key?(:limit) || (scope && scope[:limit]) # Only take order from scope if limit is also provided by scope, this # is useful for updating a has_many association with a limit. - relation.order!(construct_order(options[:order], scope)).limit!(construct_limit(options[:limit], scope)) + relation.order(construct_order(options[:order], scope)).limit(construct_limit(options[:limit], scope)) else - relation.order!(options[:order]) + relation.order(options[:order]) end relation.update(sanitize_sql_for_assignment(updates)) @@ -932,7 +932,7 @@ module ActiveRecord #:nodoc: # associations or call your before_* or +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) if conditions - arel_table.conditions!(Arel::SqlLiteral.new(construct_conditions(conditions, scope(:find)))).delete + arel_table.conditions(Arel::SqlLiteral.new(construct_conditions(conditions, scope(:find)))).delete else arel_table.delete end @@ -1535,7 +1535,7 @@ module ActiveRecord #:nodoc: def arel_table(table = nil) table = table_name if table.blank? - Relation.new(self, table) + Relation.new(self, Arel::Table.new(table)) end private @@ -1720,13 +1720,13 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel relation = arel_table(options[:from]). - joins!(construct_join(options[:joins], scope)). - conditions!(construct_conditions(options[:conditions], scope)). - select!(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). - group!(construct_group(options[:group], options[:having], scope)). - order!(construct_order(options[:order], scope)). - limit!(construct_limit(options[:limit], scope)). - offset!(construct_offset(options[:offset], scope)) + joins(construct_join(options[:joins], scope)). + conditions(construct_conditions(options[:conditions], scope)). + select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). + group(construct_group(options[:group], options[:having], scope)). + order(construct_order(options[:order], scope)). + limit(construct_limit(options[:limit], scope)). + offset(construct_offset(options[:offset], scope)) end def construct_finder_sql(options, scope = scope(:find)) @@ -1810,7 +1810,7 @@ module ActiveRecord #:nodoc: def build_association_joins(joins) join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, joins, nil) - relation = arel_table + relation = arel_table.relation join_dependency.join_associations.map { |association| if association.relation.is_a?(Array) [Arel::InnerJoin.new(relation, association.relation.first, association.association_join.first).joins(relation), @@ -2569,7 +2569,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - arel_table(true).conditions!(arel_table[self.class.primary_key].eq(id)).delete + arel_table(true).conditions(arel_table[self.class.primary_key].eq(id)).delete end @destroyed = true @@ -2864,7 +2864,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - arel_table(true).conditions!(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) + arel_table(true).conditions(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes @@ -2952,7 +2952,7 @@ module ActiveRecord #:nodoc: end def arel_table(reload = nil) - @arel_table = Relation.new(self.class, self.class.table_name) if reload || @arel_table.nil? + @arel_table = Relation.new(self.class, Arel::Table.new(self.class.table_name)) if reload || @arel_table.nil? @arel_table end diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index cd2fbe9b79..40242333e5 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -147,11 +147,11 @@ module ActiveRecord construct_finder_arel_with_included_associations(options, join_dependency) else relation = arel_table(options[:from]). - joins!(construct_join(options[:joins], scope)). - conditions!(construct_conditions(options[:conditions], scope)). - order!(options[:order]). - limit!(options[:limit]). - offset!(options[:offset]) + joins(construct_join(options[:joins], scope)). + conditions(construct_conditions(options[:conditions], scope)). + order(options[:order]). + limit(options[:limit]). + offset(options[:offset]) end if options[:group] return execute_grouped_calculation(operation, column_name, options, relation) @@ -171,7 +171,7 @@ module ActiveRecord (column_name == :all ? "*" : column_name.to_s)) end - relation.select!(operation == 'count' ? column.count(options[:distinct]) : column.send(operation)) + relation = relation.select(operation == 'count' ? column.count(options[:distinct]) : column.send(operation)) type_cast_calculated_value(connection.select_value(relation.to_sql), column_for(column_name), operation) end @@ -194,8 +194,7 @@ module ActiveRecord options[:select] << ", #{group_field} AS #{group_alias}" - relation.select!(options[:select]) - relation.group!(construct_group(options[:group], options[:having], nil)) + relation = relation.select(options[:select]).group(construct_group(options[:group], options[:having], nil)) calculated_data = connection.select_all(relation.to_sql) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 9c7ba881fc..bba0d0844d 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -3,9 +3,9 @@ module ActiveRecord delegate :to_sql, :to => :relation attr_reader :relation, :klass - def initialize(klass, table = nil) + def initialize(klass, relation) @klass = klass - @relation = Arel::Table.new(table || @klass.table_name) + @relation = relation end def to_a @@ -21,60 +21,57 @@ module ActiveRecord to_a.first end - def select!(selection) - @relation = @relation.project(selection) if selection - self + def select(selects) + Relation.new(@klass, @relation.project(selects)) end - def on!(on) - @relation = @relation.on(on) if on - self + def group(groups) + Relation.new(@klass, @relation.group(groups)) end - def order!(order) - @relation = @relation.order(order) if order - self + def order(orders) + Relation.new(@klass, @relation.order(orders)) end - def group!(group) - @relation = @relation.group(group) if group - self + def limit(limits) + Relation.new(@klass, @relation.take(limits)) end - def limit!(limit) - @relation = @relation.take(limit) if limit - self + def offset(offsets) + Relation.new(@klass, @relation.skip(offsets)) end - def offset!(offset) - @relation = @relation.skip(offset) if offset - self + def on(join) + Relation.new(@klass, @relation.on(join)) end - def joins!(joins, join_type = nil) - if !joins.blank? - @relation = case joins - when String - @relation.join(joins) - when Hash, Array, Symbol - if @klass.send(:array_of_strings?, joins) - @relation.join(joins.join(' ')) + def joins(join, join_type = nil) + if join.blank? + self + else + join = case join + when String + @relation.join(join) + when Hash, Array, Symbol + if @klass.send(:array_of_strings?, join) + @relation.join(join.join(' ')) + else + @relation.join(@klass.send(:build_association_joins, join)) + end else - @relation.join(@klass.send(:build_association_joins, joins)) - end - else - @relation.join(joins, join_type) + @relation.join(join, join_type) end + Relation.new(@klass, join) end - self end - def conditions!(conditions) - if !conditions.blank? + def conditions(conditions) + if conditions.blank? + self + else conditions = @klass.send(:merge_conditions, conditions) if [String, Hash, Array].include?(conditions.class) - @relation = @relation.where(conditions) + Relation.new(@klass, @relation.where(conditions)) end - self end private diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index b4f29f939a..df15c1a797 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1893,7 +1893,7 @@ class BasicsTest < ActiveRecord::TestCase end def test_all_with_conditions - assert_equal Developer.find(:all, :order => 'id desc'), Developer.all.order!('id desc').to_a + assert_equal Developer.find(:all, :order => 'id desc'), Developer.all.order('id desc').to_a end def test_find_ordered_last diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index e8b222f876..b017570b45 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -11,47 +11,47 @@ class RelationTest < ActiveRecord::TestCase fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts def test_finding_with_conditions - assert_equal Author.find(:all, :conditions => "name = 'David'"), Author.all.conditions!("name = 'David'").to_a + assert_equal Author.find(:all, :conditions => "name = 'David'"), Author.all.conditions("name = 'David'").to_a end def test_finding_with_order - topics = Topic.all.order!('id') + topics = Topic.all.order('id') assert_equal 4, topics.size assert_equal topics(:first).title, topics.first.title end def test_finding_with_order_and_take - entrants = Entrant.all.order!("id ASC").limit!(2).to_a + entrants = Entrant.all.order("id ASC").limit(2).to_a assert_equal(2, entrants.size) assert_equal(entrants(:first).name, entrants.first.name) end def test_finding_with_order_limit_and_offset - entrants = Entrant.all.order!("id ASC").limit!(2).offset!(1) + entrants = Entrant.all.order("id ASC").limit(2).offset(1) assert_equal(2, entrants.size) assert_equal(entrants(:second).name, entrants.first.name) - entrants = Entrant.all.order!("id ASC").limit!(2).offset!(2) + entrants = Entrant.all.order("id ASC").limit(2).offset(2) assert_equal(1, entrants.size) assert_equal(entrants(:third).name, entrants.first.name) end def test_finding_with_group - developers = Developer.all.group!("salary").select!("salary").to_a + developers = Developer.all.group("salary").select("salary").to_a assert_equal 4, developers.size assert_equal 4, developers.map(&:salary).uniq.size end def test_finding_with_hash_conditions_on_joined_table - firms = DependentFirm.all.joins!(:account).conditions!({:name => 'RailsCore', :accounts => { :credit_limit => 55..60 }}).to_a + firms = DependentFirm.all.joins(:account).conditions({:name => 'RailsCore', :accounts => { :credit_limit => 55..60 }}).to_a assert_equal 1, firms.size assert_equal companies(:rails_core), firms.first end def test_find_all_with_join - developers_on_project_one = Developer.all.joins!('LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id').conditions!('project_id=1').to_a + developers_on_project_one = Developer.all.joins('LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id').conditions('project_id=1').to_a assert_equal 3, developers_on_project_one.length developer_names = developers_on_project_one.map { |d| d.name } @@ -60,11 +60,11 @@ class RelationTest < ActiveRecord::TestCase end def test_find_on_hash_conditions - assert_equal Topic.find(:all, :conditions => {:approved => false}), Topic.all.conditions!({ :approved => false }).to_a + assert_equal Topic.find(:all, :conditions => {:approved => false}), Topic.all.conditions({ :approved => false }).to_a end def test_joins_with_string_array - person_with_reader_and_post = Post.all.joins!([ + person_with_reader_and_post = Post.all.joins([ "INNER JOIN categorizations ON categorizations.post_id = posts.id", "INNER JOIN categories ON categories.id = categorizations.category_id AND categories.type = 'SpecialCategory'" ] -- cgit v1.2.3 From 60926db9e06a7890409926211dffe773aff4a57d Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 14:22:38 -0300 Subject: Inline initializer setup. --- activerecord/lib/active_record/relation.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index bba0d0844d..84cd739781 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -4,8 +4,7 @@ module ActiveRecord attr_reader :relation, :klass def initialize(klass, relation) - @klass = klass - @relation = relation + @klass, @relation = klass, relation end def to_a -- cgit v1.2.3 From 0d6997b6e3f25d87b08b4aacaa2140609d5cc19c Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 14:49:11 -0300 Subject: Cache #arel_able when possible. --- activerecord/lib/active_record/base.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index b23ce53d43..3bbe23865f 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1533,9 +1533,12 @@ module ActiveRecord #:nodoc: end - def arel_table(table = nil) + def arel_table(table = nil, reload = nil) table = table_name if table.blank? - Relation.new(self, Arel::Table.new(table)) + if reload || @arel_table.nil? || @arel_table.name != table + @arel_table = Relation.new(self, Arel::Table.new(table)) + end + @arel_table end private -- cgit v1.2.3 From fefb4c78ac8f37ea0b14cbb0c008f305a1bbd36f Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 16:28:04 -0300 Subject: Cache arel_table when possible, use class method arel_table instead instance method. --- activerecord/lib/active_record/base.rb | 17 +++++++---------- activerecord/lib/active_record/locking/optimistic.rb | 8 ++++++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3bbe23865f..c74d8c6190 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2572,7 +2572,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - arel_table(true).conditions(arel_table[self.class.primary_key].eq(id)).delete + self.class.arel_table(self.class.table_name, true).conditions(self.class.arel_table[self.class.primary_key].eq(id)).delete end @destroyed = true @@ -2867,7 +2867,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - arel_table(true).conditions(arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) + self.class.arel_table(self.class.table_name, true).conditions(self.class.arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes @@ -2877,12 +2877,14 @@ module ActiveRecord #:nodoc: self.id = connection.next_sequence_value(self.class.sequence_name) end + # Reload ARel relation cached table + self.class.arel_table(self.class.table_name, true) attributes_values = arel_attributes_values new_id = if attributes_values.empty? - arel_table.insert connection.empty_insert_statement_value + self.class.arel_table.insert connection.empty_insert_statement_value else - arel_table.insert attributes_values + self.class.arel_table.insert attributes_values end self.id ||= new_id @@ -2954,11 +2956,6 @@ module ActiveRecord #:nodoc: default end - def arel_table(reload = nil) - @arel_table = Relation.new(self.class, Arel::Table.new(self.class.table_name)) if reload || @arel_table.nil? - @arel_table - end - # Returns a copy of the attributes hash where all the values have been safely quoted for use in # an SQL statement. def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) @@ -2992,7 +2989,7 @@ module ActiveRecord #:nodoc: if value && ((self.class.serialized_attributes.has_key?(name) && (value.acts_like?(:date) || value.acts_like?(:time))) || value.is_a?(Hash) || value.is_a?(Array)) value = value.to_yaml end - attrs[arel_table[name]] = value + attrs[self.class.arel_table[name]] = value end end end diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 4e833ec871..c8cd79a2b0 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,7 +89,9 @@ module ActiveRecord attribute_names.uniq! begin - affected_rows = arel_table(true).where( + arel_table = self.class.arel_table(self.class.table_name) + + affected_rows = arel_table.where( arel_table[self.class.primary_key].eq(quoted_id).and( arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) @@ -116,7 +118,9 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - affected_rows = arel_table(true).where( + arel_table = self.class.arel_table(self.class.table_name) + + affected_rows = arel_table.where( arel_table[self.class.primary_key].eq(quoted_id).and( arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) -- cgit v1.2.3 From 74ed123e082a9b2b160ddecc2eb141f1678c600a Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 16:35:33 -0300 Subject: Override respond_to? in ActiveRecord::Relation to go with method_missing. --- activerecord/lib/active_record/relation.rb | 8 ++++++++ activerecord/test/cases/relations_test.rb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 84cd739781..b69a12bc7b 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -73,6 +73,14 @@ module ActiveRecord end end + def respond_to?(method) + if @relation.respond_to?(method) || Array.instance_methods.include?(method.to_s) + true + else + super + end + end + private def method_missing(method, *args, &block) if @relation.respond_to?(method) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index b017570b45..6a39aa6e40 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -71,5 +71,13 @@ class RelationTest < ActiveRecord::TestCase ).to_a assert_equal 1, person_with_reader_and_post.size end + + def test_relation_responds_to_delegated_methods + relation = Topic.all + + ["map", "uniq", "sort", "insert", "delete", "update"].each do |method| + assert relation.respond_to?(method) + end + end end -- cgit v1.2.3 From 0abba2813be52cc8f8ff2544f8a3b18b5083be53 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 19:38:03 -0300 Subject: Call to_sql method on ActiveRecord::Relation instance not it's relation attribute.' --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c74d8c6190..4636a8b338 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1733,7 +1733,7 @@ module ActiveRecord #:nodoc: end def construct_finder_sql(options, scope = scope(:find)) - construct_finder_arel(options, scope).relation.to_sql + construct_finder_arel(options, scope).to_sql end def construct_join(joins, scope) -- cgit v1.2.3 From c1f833dff47eb5c0a74eb80f011597c7130bc8d7 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 19:38:34 -0300 Subject: habtm delete method integrated with ARel. --- .../associations/has_and_belongs_to_many_association.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index d91c555dad..a1aac3ead5 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -34,7 +34,7 @@ module ActiveRecord options[:readonly] = finding_with_ambiguous_select?(options[:select] || @reflection.options[:select]) options[:select] ||= (@reflection.options[:select] || '*') end - + def count_records load_target.size end @@ -85,9 +85,10 @@ module ActiveRecord if sql = @reflection.options[:delete_sql] records.each { |record| @owner.connection.delete(interpolate_sql(sql, record)) } else - ids = quoted_record_ids(records) - sql = "DELETE FROM #{@owner.connection.quote_table_name @reflection.options[:join_table]} WHERE #{@reflection.primary_key_name} = #{owner_quoted_id} AND #{@reflection.association_foreign_key} IN (#{ids})" - @owner.connection.delete(sql) + relation = arel_table(@reflection.options[:join_table]) + relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). + and(Arel::In.new(relation[@reflection.association_foreign_key], records.map(&:id))) + ).delete end end -- cgit v1.2.3 From d5476b466f086921c71cb1caf6b9773cbdb5b4e3 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 19:51:41 -0300 Subject: habtm insertion with ARel integration. --- .../associations/has_and_belongs_to_many_association.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index a1aac3ead5..da1fbfe0b7 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -56,26 +56,23 @@ module ActiveRecord if @reflection.options[:insert_sql] @owner.connection.insert(interpolate_sql(@reflection.options[:insert_sql], record)) else + relation = arel_table(@reflection.options[:join_table]) attributes = columns.inject({}) do |attrs, column| case column.name.to_s when @reflection.primary_key_name.to_s - attrs[column.name] = owner_quoted_id + attrs[relation[column.name]] = owner_quoted_id when @reflection.association_foreign_key.to_s - attrs[column.name] = record.quoted_id + attrs[relation[column.name]] = record.quoted_id else if record.has_attribute?(column.name) value = @owner.send(:quote_value, record[column.name], column) - attrs[column.name] = value unless value.nil? + attrs[relation[column.name]] = value unless value.nil? end end attrs end - sql = - "INSERT INTO #{@owner.connection.quote_table_name @reflection.options[:join_table]} (#{@owner.send(:quoted_column_names, attributes).join(', ')}) " + - "VALUES (#{attributes.values.join(', ')})" - - @owner.connection.insert(sql) + relation.insert(attributes) end return true -- cgit v1.2.3 From a7178773d2f57454b55b20577091c00327565b67 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 19:53:21 -0300 Subject: Remove now unused quote_table_name, ARel does that quoting now. --- activerecord/lib/active_record/base.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4636a8b338..1698f33da0 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -3103,13 +3103,6 @@ module ActiveRecord #:nodoc: hash.inject([]) { |list, pair| list << "#{pair.first} = #{pair.last}" }.join(", ") end - def quoted_column_names(attributes = attributes_with_quotes) - connection = self.class.connection - attributes.keys.collect do |column_name| - connection.quote_column_name(column_name) - end - end - def self.quoted_table_name self.connection.quote_table_name(self.table_name) end -- cgit v1.2.3 From a09215ee968250963256a39936a4136aeb1b65f6 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 20:02:14 -0300 Subject: has_many nullify associations keys using ARel. --- .../active_record/associations/has_many_association.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 73d3c23cd3..29ba84ee37 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -40,11 +40,11 @@ module ActiveRecord # we are certain the current target is an empty array. This is a # documented side-effect of the method that may avoid an extra SELECT. @target ||= [] and loaded if count == 0 - + if @reflection.options[:limit] count = [ @reflection.options[:limit], count ].min end - + return count end @@ -69,11 +69,11 @@ module ActiveRecord when :delete_all @reflection.klass.delete(records.map { |record| record.id }) else - ids = quoted_record_ids(records) - @reflection.klass.update_all( - "#{@reflection.primary_key_name} = NULL", - "#{@reflection.primary_key_name} = #{owner_quoted_id} AND #{@reflection.klass.primary_key} IN (#{ids})" - ) + relation = arel_table(@reflection.table_name) + relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). + and(Arel::In.new(relation[@reflection.klass.primary_key], records.map(&:id))) + ).update(relation[@reflection.primary_key_name] => nil) + @owner.class.update_counters(@owner.id, cached_counter_attribute_name => -records.size) if has_cached_counter? end end @@ -88,11 +88,11 @@ module ActiveRecord @finder_sql = interpolate_sql(@reflection.options[:finder_sql]) when @reflection.options[:as] - @finder_sql = + @finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_id = #{owner_quoted_id} AND " + "#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}" @finder_sql << " AND (#{conditions})" if conditions - + else @finder_sql = "#{@reflection.quoted_table_name}.#{@reflection.primary_key_name} = #{owner_quoted_id}" @finder_sql << " AND (#{conditions})" if conditions -- cgit v1.2.3 From c36cfa7568cd51718d149107696e779d3282da45 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 18 Aug 2009 20:03:32 -0300 Subject: Remove unused quoted_record_ids, now ARel does this using ARel::In. --- activerecord/lib/active_record/associations/association_proxy.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index e36b04ea95..75218c01d2 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -156,15 +156,6 @@ module ActiveRecord @reflection.options[:dependent] end - # Returns a string with the IDs of +records+ joined with a comma, quoted - # if needed. The result is ready to be inserted into a SQL IN clause. - # - # quoted_record_ids(records) # => "23,56,58,67" - # - def quoted_record_ids(records) - records.map { |record| record.quoted_id }.join(',') - end - def interpolate_sql(sql, record = nil) @owner.send(:interpolate_sql, sql, record) end -- cgit v1.2.3 From 2048556a14c28f9814f9c6ad44a08084afec1afe Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 19 Aug 2009 11:09:12 -0300 Subject: Remove whitespace. --- activerecord/lib/active_record/associations.rb | 1 + activerecord/lib/active_record/associations/belongs_to_association.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index c0741bb572..547df9c684 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2085,6 +2085,7 @@ module ActiveRecord def association_join connection = reflection.active_record.connection + join = case reflection.macro when :has_and_belongs_to_many ["%s.%s = %s.%s " % [ diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 628033c87a..d2f2267e5c 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -36,11 +36,11 @@ module ActiveRecord loaded record end - + def updated? @updated end - + private def find_target find_method = if @reflection.options[:primary_key] -- cgit v1.2.3 From 3e1ef198e086deb4f212523ce2338a027f0e4155 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 19 Aug 2009 16:08:54 -0300 Subject: Remove useless InnerJoinDependency, inner joins are performed through Arel::InnerJoin. --- activerecord/lib/active_record/associations.rb | 25 ++++--------------------- activerecord/lib/active_record/base.rb | 2 +- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 547df9c684..4e31f943bc 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1787,7 +1787,7 @@ module ActiveRecord if array_of_strings?(merged_joins) tables_in_string(merged_joins.join(' ')) else - join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, merged_joins, nil) + join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_joins, nil) join_dependency.join_associations.collect {|join_association| [join_association.aliased_join_table_name, join_association.aliased_table_name]}.flatten.compact end else @@ -2216,17 +2216,13 @@ module ActiveRecord end end - def join_type - Arel::OuterJoin - end - def join_relation(joining_relation, join = nil) if relation.is_a?(Array) joining_relation. - joins(relation.first, join_type).on(association_join.first). - joins(relation.last, join_type).on(association_join.last) + joins(relation.first, Arel::OuterJoin).on(association_join.first). + joins(relation.last, Arel::OuterJoin).on(association_join.last) else - joining_relation.joins(relation, join_type).on(association_join) + joining_relation.joins(relation, Arel::OuterJoin).on(association_join) end end @@ -2267,19 +2263,6 @@ module ActiveRecord end end end - - class InnerJoinDependency < JoinDependency # :nodoc: - protected - def build_join_association(reflection, parent) - InnerJoinAssociation.new(reflection, self, parent) - end - - class InnerJoinAssociation < JoinAssociation - def join_type - Arel::InnerJoin - end - end - end end end end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 1698f33da0..dc439ff92e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1812,7 +1812,7 @@ module ActiveRecord #:nodoc: end def build_association_joins(joins) - join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, joins, nil) + join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, joins, nil) relation = arel_table.relation join_dependency.join_associations.map { |association| if association.relation.is_a?(Array) -- cgit v1.2.3 From ccf5f2c4a20a9a275dd86f251fa026eee7f344c5 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 19 Aug 2009 16:17:16 -0300 Subject: Remove old method and comment. --- activerecord/lib/active_record/associations.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 4e31f943bc..4c07e6be07 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1912,19 +1912,6 @@ module ActiveRecord end end - def joins_for_table_name(table_name) - join = join_for_table_name(table_name) - result = nil - if join && join.is_a?(JoinAssociation) - result = [join] - if join.parent && join.parent.is_a?(JoinAssociation) - result = joins_for_table_name(join.parent.aliased_table_name) + - result - end - end - result - end - protected def build(associations, parent = nil) parent ||= @joins.last @@ -1948,7 +1935,6 @@ module ActiveRecord end end - # overridden in InnerJoinDependency subclass def build_join_association(reflection, parent) JoinAssociation.new(reflection, self, parent) end -- cgit v1.2.3 From b32474020c4ec2f2b9c78bd580466c494eac6eb3 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 19 Aug 2009 16:29:26 -0300 Subject: Don't sanitize_sql where it doesn't make sense. --- activerecord/lib/active_record/associations.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 4c07e6be07..1f1ae93bb6 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1695,7 +1695,7 @@ module ActiveRecord end def construct_finder_sql_with_included_associations(options, join_dependency) - sanitize_sql(construct_finder_arel_with_included_associations(options, join_dependency).to_sql) + construct_finder_arel_with_included_associations(options, join_dependency).to_sql end def construct_arel_limited_ids_condition(options, join_dependency) @@ -1733,7 +1733,7 @@ module ActiveRecord offset(construct_limit(options[:offset], scope)). select(connection.distinct("#{connection.quote_table_name table_name}.#{primary_key}", construct_order(options[:order], scope(:find)).join(","))) - sanitize_sql(relation.to_sql) + relation.to_sql end def tables_in_string(string) -- cgit v1.2.3 From 54fcbb881d1d707d65d38cd30f50049023448832 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 19 Aug 2009 17:45:13 -0300 Subject: Make sure join association methods are called once. --- activerecord/lib/active_record/associations.rb | 19 ++++++++++--------- activerecord/lib/active_record/base.rb | 8 ++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 1f1ae93bb6..068943c454 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2059,6 +2059,7 @@ module ActiveRecord @aliased_prefix = "t#{ join_dependency.joins.size }" @parent_table_name = parent.active_record.table_name @aliased_table_name = aliased_table_name_for(table_name) + @join = nil if reflection.macro == :has_and_belongs_to_many @aliased_join_table_name = aliased_table_name_for(reflection.options[:join_table], "_join") @@ -2070,9 +2071,9 @@ module ActiveRecord end def association_join + return @join if @join connection = reflection.active_record.connection - - join = case reflection.macro + @join = case reflection.macro when :has_and_belongs_to_many ["%s.%s = %s.%s " % [ connection.quote_table_name(aliased_join_table_name), @@ -2182,14 +2183,14 @@ module ActiveRecord else "" end - join << %(AND %s) % [ + @join << %(AND %s) % [ klass.send(:type_condition, aliased_table_name)] unless klass.descends_from_active_record? [through_reflection, reflection].each do |ref| - join << "AND #{interpolate_sql(sanitize_sql(ref.options[:conditions], aliased_table_name))} " if ref && ref.options[:conditions] + @join << "AND #{interpolate_sql(sanitize_sql(ref.options[:conditions], aliased_table_name))} " if ref && ref.options[:conditions] end - join + @join end def relation @@ -2203,12 +2204,12 @@ module ActiveRecord end def join_relation(joining_relation, join = nil) - if relation.is_a?(Array) + if (relations = relation).is_a?(Array) joining_relation. - joins(relation.first, Arel::OuterJoin).on(association_join.first). - joins(relation.last, Arel::OuterJoin).on(association_join.last) + joins(relations.first, Arel::OuterJoin).on(association_join.first). + joins(relations.last, Arel::OuterJoin).on(association_join.last) else - joining_relation.joins(relation, Arel::OuterJoin).on(association_join) + joining_relation.joins(relations, Arel::OuterJoin).on(association_join) end end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index dc439ff92e..b0286f7409 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1815,11 +1815,11 @@ module ActiveRecord #:nodoc: join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, joins, nil) relation = arel_table.relation join_dependency.join_associations.map { |association| - if association.relation.is_a?(Array) - [Arel::InnerJoin.new(relation, association.relation.first, association.association_join.first).joins(relation), - Arel::InnerJoin.new(relation, association.relation.last, association.association_join.last).joins(relation)].join() + if (association_relation = association.relation).is_a?(Array) + [Arel::InnerJoin.new(relation, association_relation.first, association.association_join.first).joins(relation), + Arel::InnerJoin.new(relation, association_relation.last, association.association_join.last).joins(relation)].join() else - Arel::InnerJoin.new(relation, association.relation, association.association_join).joins(relation) + Arel::InnerJoin.new(relation, association_relation, association.association_join).joins(relation) end }.join(" ") end -- cgit v1.2.3 From a60334fdc5d4f612bd2dd70e38d1e57481cd5910 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 19 Aug 2009 19:36:06 -0300 Subject: Remove useless conditionals/local var. --- activerecord/lib/active_record/associations.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 068943c454..b363cceccb 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2089,8 +2089,6 @@ module ActiveRecord ] when :has_many, :has_one if reflection.options[:through] - through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : '' - jt_foreign_key = jt_as_extra = jt_source_extra = jt_sti_extra = nil first_key = second_key = as_extra = nil @@ -2154,7 +2152,7 @@ module ActiveRecord as_extra] ] - elsif reflection.options[:as] && [:has_many, :has_one].include?(reflection.macro) + elsif reflection.options[:as] "%s.%s = %s.%s AND %s.%s = %s" % [ connection.quote_table_name(aliased_table_name), "#{reflection.options[:as]}_id", @@ -2180,8 +2178,6 @@ module ActiveRecord connection.quote_table_name(parent.aliased_table_name), options[:foreign_key] || reflection.primary_key_name ] - else - "" end @join << %(AND %s) % [ klass.send(:type_condition, aliased_table_name)] unless klass.descends_from_active_record? -- cgit v1.2.3 From 0c6aed0a09e3a4f8cdf2b277f3144f715c0e30fb Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 20 Aug 2009 18:58:12 -0300 Subject: Add bench script for ActiveRecord. Ignore log file and temporary cache sql files. --- .gitignore | 2 + activerecord/scripts/performance.rb | 229 ++++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100644 activerecord/scripts/performance.rb diff --git a/.gitignore b/.gitignore index 43c4d7b124..17c77cc23e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ debug.log +performance.log doc/rdoc activeresource/doc activerecord/doc @@ -7,6 +8,7 @@ actionmailer/doc activesupport/doc activeresource/pkg activerecord/pkg +activerecord/scripts/tmp actionpack/pkg activemodel/test/fixtures/fixture_database.sqlite3 actionmailer/pkg diff --git a/activerecord/scripts/performance.rb b/activerecord/scripts/performance.rb new file mode 100644 index 0000000000..fb84543685 --- /dev/null +++ b/activerecord/scripts/performance.rb @@ -0,0 +1,229 @@ +#!/usr/bin/env ruby -KU + +$:.unshift(File.dirname(__FILE__) + '/../lib') + +require 'ftools' +require 'rubygems' + +gem 'addressable', '~>2.0' +gem 'faker', '~>0.3.1' +gem 'rbench', '~>0.2.3' + +require 'active_record' +require 'logger' +require 'active_support' +require 'addressable/uri' +require 'faker' +require 'rbench' + +socket_file = Pathname.glob(%w[ + /opt/local/var/run/mysql5/mysqld.sock + tmp/mysqld.sock + /tmp/mysqld.sock + tmp/mysql.sock + /tmp/mysql.sock + /var/mysql/mysql.sock + /var/run/mysqld/mysqld.sock +]).find { |path| path.socket? } + +configuration_options = { + :adapter => 'mysql', + :username => 'rails', + :password => '', + :database => 'activerecord_unittest', +} + +configuration_options[:socket] = socket_file unless socket_file.nil? + +if configuration_options[:adapter] + sqlfile = File.join(File.dirname(__FILE__), 'tmp', 'performance.sql') + mysql_bin = %w[ mysql mysql5 ].select { |bin| `which #{bin}`.length > 0 } + mysqldump_bin = %w[ mysqldump mysqldump5 ].select { |bin| `which #{bin}`.length > 0 } +end + +ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), 'performance.log')) +ActiveRecord::Base.logger.level = 0 + +ActiveRecord::Base.establish_connection(configuration_options) + +class Exhibit < ActiveRecord::Base #:nodoc: + belongs_to :user +end + +class User < ActiveRecord::Base #:nodoc: + has_many :exhibits +end + +ActiveRecord::Migration.create_table :users, :force => true do |t| + t.string :name, :email + t.datetime :created_on +end + +ActiveRecord::Migration.create_table :exhibits, :force => true do |t| + t.string :name + t.integer :user_id + t.text :notes + t.datetime :created_on +end + +Exhibit.find_by_sql('SELECT 1') + +def touch_attributes(*exhibits) + exhibits.flatten.each do |exhibit| + exhibit.id + exhibit.name + exhibit.created_on + end +end + +def touch_relationships(*exhibits) + exhibits.flatten.each do |exhibit| + exhibit.id + exhibit.name + exhibit.created_on + exhibit.user + end +end + +c = configuration_options + +if sqlfile && File.exists?(sqlfile) + puts "Found data-file. Importing from #{sqlfile}" + `#{mysql_bin} -u #{c[:username]} #{"-p#{c[:password]}" unless c[:password].blank?} #{c[:database]} < #{sqlfile}` +else + puts 'Generating data for benchmarking...' + + # pre-compute the insert statements and fake data compilation, + # so the benchmarks below show the actual runtime for the execute + # method, minus the setup steps + + # Using the same paragraph for all exhibits because it is very slow + # to generate unique paragraphs for all exhibits. + notes = Faker::Lorem.paragraphs.join($/) + today = Date.today + + puts 'Inserting 10,000 users and exhibits...' + 10_000.times do + user = User.create( + :created_on => today, + :name => Faker::Name.name, + :email => Faker::Internet.email + ) + + Exhibit.create( + :created_on => today, + :name => Faker::Company.name, + :user => user, + :notes => notes + ) + end + + if sqlfile + answer = nil + until answer && answer[/^$|y|yes|n|no/] + print('Would you like to dump data into tmp/performance.sql (for faster setup)? [Yn]'); + STDOUT.flush + answer = gets + end + + if answer[/^$|y|yes/] + File.makedirs(File.dirname(sqlfile)) + `#{mysqldump_bin} -u #{c[:username]} #{"-p#{c[:password]}" unless c[:password].blank?} #{c[:database]} exhibits users > #{sqlfile}` + puts "File saved\n" + end + end +end + +TIMES = ENV.key?('x') ? ENV['x'].to_i : 10_000 + +puts 'You can specify how many times you want to run the benchmarks with rake:perf x=(number)' +puts 'Some tasks will be run 10 and 1000 times less than (number)' +puts "Benchmarks will now run #{TIMES} times" +# Inform about slow benchmark +# answer = nil +# until answer && answer[/^$|y|yes|n|no/] +# print("A slow benchmark exposing problems with SEL is newly added. It takes approx. 20s\n"); +# print("you have scheduled it to run #{TIMES / 100} times.\nWould you still include the particular benchmark? [Yn]") +# STDOUT.flush +# answer = gets +# end +# run_rel_bench = answer[/^$|y|yes/] ? true : false + + +RBench.run(TIMES) do + + column :times + column :ar + + report 'Model#id', (TIMES * 100).ceil do + ar_obj = Exhibit.find(1) + + ar { ar_obj.id } + end + + report 'Model.new (instantiation)' do + ar { Exhibit.new } + end + + report 'Model.new (setting attributes)' do + attrs = { :name => 'sam' } + ar { Exhibit.new(attrs) } + end + + report 'Model.get specific (not cached)' do + ActiveRecord::Base.uncached { ar { touch_attributes(Exhibit.find(1)) } } + end + + report 'Model.get specific (cached)' do + ActiveRecord::Base.cache { ar { touch_attributes(Exhibit.find(1)) } } + end + + report 'Model.first' do + ar { touch_attributes(Exhibit.first) } + end + + report 'Model.all limit(100)', (TIMES / 10).ceil do + ar { touch_attributes(Exhibit.find(:all, :limit => 100)) } + end + + report 'Model.all limit(100) with relationship', (TIMES / 10).ceil do + ar { touch_relationships(Exhibit.find(:all, :limit => 100, :include => [ :user ])) } + end + + report 'Model.all limit(10,000)', (TIMES / 1000).ceil do + ar { touch_attributes(Exhibit.find(:all, :limit => 10_000)) } + end + + exhibit = { + :name => Faker::Company.name, + :notes => Faker::Lorem.paragraphs.join($/), + :created_on => Date.today + } + + report 'Model.create' do + ar { Exhibit.create(exhibit) } + end + + report 'Resource#attributes=' do + attrs_first = { :name => 'sam' } + attrs_second = { :name => 'tom' } + ar { exhibit = Exhibit.new(attrs_first); exhibit.attributes = attrs_second } + end + + report 'Resource#update' do + ar { Exhibit.find(1).update_attributes(:name => 'bob') } + end + + report 'Resource#destroy' do + ar { Exhibit.first.destroy } + end + + report 'Model.transaction' do + ar { Exhibit.transaction { Exhibit.new } } + end + + summary 'Total' +end + +ActiveRecord::Migration.drop_table "exhibits" +ActiveRecord::Migration.drop_table "users" -- cgit v1.2.3 From 689b89f548077264e46153222455d931a0d7ddf6 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 21 Aug 2009 17:43:46 -0300 Subject: Revert "Add bench script for ActiveRecord. Ignore log file and temporary cache" This reverts commit 0c6aed0a09e3a4f8cdf2b277f3144f715c0e30fb. --- .gitignore | 2 - activerecord/scripts/performance.rb | 229 ------------------------------------ 2 files changed, 231 deletions(-) delete mode 100644 activerecord/scripts/performance.rb diff --git a/.gitignore b/.gitignore index 17c77cc23e..43c4d7b124 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ debug.log -performance.log doc/rdoc activeresource/doc activerecord/doc @@ -8,7 +7,6 @@ actionmailer/doc activesupport/doc activeresource/pkg activerecord/pkg -activerecord/scripts/tmp actionpack/pkg activemodel/test/fixtures/fixture_database.sqlite3 actionmailer/pkg diff --git a/activerecord/scripts/performance.rb b/activerecord/scripts/performance.rb deleted file mode 100644 index fb84543685..0000000000 --- a/activerecord/scripts/performance.rb +++ /dev/null @@ -1,229 +0,0 @@ -#!/usr/bin/env ruby -KU - -$:.unshift(File.dirname(__FILE__) + '/../lib') - -require 'ftools' -require 'rubygems' - -gem 'addressable', '~>2.0' -gem 'faker', '~>0.3.1' -gem 'rbench', '~>0.2.3' - -require 'active_record' -require 'logger' -require 'active_support' -require 'addressable/uri' -require 'faker' -require 'rbench' - -socket_file = Pathname.glob(%w[ - /opt/local/var/run/mysql5/mysqld.sock - tmp/mysqld.sock - /tmp/mysqld.sock - tmp/mysql.sock - /tmp/mysql.sock - /var/mysql/mysql.sock - /var/run/mysqld/mysqld.sock -]).find { |path| path.socket? } - -configuration_options = { - :adapter => 'mysql', - :username => 'rails', - :password => '', - :database => 'activerecord_unittest', -} - -configuration_options[:socket] = socket_file unless socket_file.nil? - -if configuration_options[:adapter] - sqlfile = File.join(File.dirname(__FILE__), 'tmp', 'performance.sql') - mysql_bin = %w[ mysql mysql5 ].select { |bin| `which #{bin}`.length > 0 } - mysqldump_bin = %w[ mysqldump mysqldump5 ].select { |bin| `which #{bin}`.length > 0 } -end - -ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), 'performance.log')) -ActiveRecord::Base.logger.level = 0 - -ActiveRecord::Base.establish_connection(configuration_options) - -class Exhibit < ActiveRecord::Base #:nodoc: - belongs_to :user -end - -class User < ActiveRecord::Base #:nodoc: - has_many :exhibits -end - -ActiveRecord::Migration.create_table :users, :force => true do |t| - t.string :name, :email - t.datetime :created_on -end - -ActiveRecord::Migration.create_table :exhibits, :force => true do |t| - t.string :name - t.integer :user_id - t.text :notes - t.datetime :created_on -end - -Exhibit.find_by_sql('SELECT 1') - -def touch_attributes(*exhibits) - exhibits.flatten.each do |exhibit| - exhibit.id - exhibit.name - exhibit.created_on - end -end - -def touch_relationships(*exhibits) - exhibits.flatten.each do |exhibit| - exhibit.id - exhibit.name - exhibit.created_on - exhibit.user - end -end - -c = configuration_options - -if sqlfile && File.exists?(sqlfile) - puts "Found data-file. Importing from #{sqlfile}" - `#{mysql_bin} -u #{c[:username]} #{"-p#{c[:password]}" unless c[:password].blank?} #{c[:database]} < #{sqlfile}` -else - puts 'Generating data for benchmarking...' - - # pre-compute the insert statements and fake data compilation, - # so the benchmarks below show the actual runtime for the execute - # method, minus the setup steps - - # Using the same paragraph for all exhibits because it is very slow - # to generate unique paragraphs for all exhibits. - notes = Faker::Lorem.paragraphs.join($/) - today = Date.today - - puts 'Inserting 10,000 users and exhibits...' - 10_000.times do - user = User.create( - :created_on => today, - :name => Faker::Name.name, - :email => Faker::Internet.email - ) - - Exhibit.create( - :created_on => today, - :name => Faker::Company.name, - :user => user, - :notes => notes - ) - end - - if sqlfile - answer = nil - until answer && answer[/^$|y|yes|n|no/] - print('Would you like to dump data into tmp/performance.sql (for faster setup)? [Yn]'); - STDOUT.flush - answer = gets - end - - if answer[/^$|y|yes/] - File.makedirs(File.dirname(sqlfile)) - `#{mysqldump_bin} -u #{c[:username]} #{"-p#{c[:password]}" unless c[:password].blank?} #{c[:database]} exhibits users > #{sqlfile}` - puts "File saved\n" - end - end -end - -TIMES = ENV.key?('x') ? ENV['x'].to_i : 10_000 - -puts 'You can specify how many times you want to run the benchmarks with rake:perf x=(number)' -puts 'Some tasks will be run 10 and 1000 times less than (number)' -puts "Benchmarks will now run #{TIMES} times" -# Inform about slow benchmark -# answer = nil -# until answer && answer[/^$|y|yes|n|no/] -# print("A slow benchmark exposing problems with SEL is newly added. It takes approx. 20s\n"); -# print("you have scheduled it to run #{TIMES / 100} times.\nWould you still include the particular benchmark? [Yn]") -# STDOUT.flush -# answer = gets -# end -# run_rel_bench = answer[/^$|y|yes/] ? true : false - - -RBench.run(TIMES) do - - column :times - column :ar - - report 'Model#id', (TIMES * 100).ceil do - ar_obj = Exhibit.find(1) - - ar { ar_obj.id } - end - - report 'Model.new (instantiation)' do - ar { Exhibit.new } - end - - report 'Model.new (setting attributes)' do - attrs = { :name => 'sam' } - ar { Exhibit.new(attrs) } - end - - report 'Model.get specific (not cached)' do - ActiveRecord::Base.uncached { ar { touch_attributes(Exhibit.find(1)) } } - end - - report 'Model.get specific (cached)' do - ActiveRecord::Base.cache { ar { touch_attributes(Exhibit.find(1)) } } - end - - report 'Model.first' do - ar { touch_attributes(Exhibit.first) } - end - - report 'Model.all limit(100)', (TIMES / 10).ceil do - ar { touch_attributes(Exhibit.find(:all, :limit => 100)) } - end - - report 'Model.all limit(100) with relationship', (TIMES / 10).ceil do - ar { touch_relationships(Exhibit.find(:all, :limit => 100, :include => [ :user ])) } - end - - report 'Model.all limit(10,000)', (TIMES / 1000).ceil do - ar { touch_attributes(Exhibit.find(:all, :limit => 10_000)) } - end - - exhibit = { - :name => Faker::Company.name, - :notes => Faker::Lorem.paragraphs.join($/), - :created_on => Date.today - } - - report 'Model.create' do - ar { Exhibit.create(exhibit) } - end - - report 'Resource#attributes=' do - attrs_first = { :name => 'sam' } - attrs_second = { :name => 'tom' } - ar { exhibit = Exhibit.new(attrs_first); exhibit.attributes = attrs_second } - end - - report 'Resource#update' do - ar { Exhibit.find(1).update_attributes(:name => 'bob') } - end - - report 'Resource#destroy' do - ar { Exhibit.first.destroy } - end - - report 'Model.transaction' do - ar { Exhibit.transaction { Exhibit.new } } - end - - summary 'Total' -end - -ActiveRecord::Migration.drop_table "exhibits" -ActiveRecord::Migration.drop_table "users" -- cgit v1.2.3 From 33746c44cb3ace58507d5edc9833088524821d22 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 25 Aug 2009 19:47:29 -0300 Subject: No need to create a new relation if the argument is blank. --- activerecord/lib/active_record/relation.rb | 12 ++++++------ arel | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index b69a12bc7b..570ba3f80d 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -21,27 +21,27 @@ module ActiveRecord end def select(selects) - Relation.new(@klass, @relation.project(selects)) + selects.blank? ? self : Relation.new(@klass, @relation.project(selects)) end def group(groups) - Relation.new(@klass, @relation.group(groups)) + groups.blank? ? self : Relation.new(@klass, @relation.group(groups)) end def order(orders) - Relation.new(@klass, @relation.order(orders)) + orders.blank? ? self : Relation.new(@klass, @relation.order(orders)) end def limit(limits) - Relation.new(@klass, @relation.take(limits)) + limits.blank? ? self : Relation.new(@klass, @relation.take(limits)) end def offset(offsets) - Relation.new(@klass, @relation.skip(offsets)) + offsets.blank? ? self : Relation.new(@klass, @relation.skip(offsets)) end def on(join) - Relation.new(@klass, @relation.on(join)) + join.blank? ? self : Relation.new(@klass, @relation.on(join)) end def joins(join, join_type = nil) diff --git a/arel b/arel index 3d747a56b7..755a7ced2f 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 3d747a56b76ae97645dd265cc75e73e5f7827193 +Subproject commit 755a7ced2f98b0bb246089c80cdfa04cd918fa89 -- cgit v1.2.3 From 286f47f3b034db4550110b9a0f9ff48dda29e807 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 26 Aug 2009 16:19:19 -0300 Subject: Remove useless var local definition. --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index b0286f7409..8217f5e8e9 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1722,7 +1722,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - relation = arel_table(options[:from]). + arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). -- cgit v1.2.3 From 1cc0ea826e92169575b486e662dff1e1d44db992 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 16:30:48 -0300 Subject: Performance: Don't reload the arel_table when destroying. --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8217f5e8e9..0307aa29d3 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2572,7 +2572,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - self.class.arel_table(self.class.table_name, true).conditions(self.class.arel_table[self.class.primary_key].eq(id)).delete + self.class.arel_table(self.class.table_name).conditions(self.class.arel_table[self.class.primary_key].eq(id)).delete end @destroyed = true -- cgit v1.2.3 From e204f80dbb2134867b006d02c4d5d15c265351b8 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 16:42:57 -0300 Subject: Performance: Don't reload the ARel relation on create, do it on reset_column_information. --- activerecord/lib/active_record/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 0307aa29d3..4e2261d044 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1365,6 +1365,8 @@ module ActiveRecord #:nodoc: # end def reset_column_information undefine_attribute_methods + # Reload ARel relation cached table + arel_table(table_name, true) @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil end @@ -2877,8 +2879,6 @@ module ActiveRecord #:nodoc: self.id = connection.next_sequence_value(self.class.sequence_name) end - # Reload ARel relation cached table - self.class.arel_table(self.class.table_name, true) attributes_values = arel_attributes_values new_id = if attributes_values.empty? -- cgit v1.2.3 From 53f6c6d24e6fb25a62144c6ef5020cc04a893f56 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 16:46:24 -0300 Subject: Performance: Don't reload ARel relation on update. --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4e2261d044..2fc7b1e9c6 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2869,7 +2869,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - self.class.arel_table(self.class.table_name, true).conditions(self.class.arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) + self.class.arel_table(self.class.table_name).conditions(self.class.arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes -- cgit v1.2.3 From d56e987757923fa28ae90cf269707b78b744d66d Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 16:49:16 -0300 Subject: No need to reload the relation table with a method param, just nil it. --- activerecord/lib/active_record/base.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2fc7b1e9c6..c11c049415 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1365,9 +1365,7 @@ module ActiveRecord #:nodoc: # end def reset_column_information undefine_attribute_methods - # Reload ARel relation cached table - arel_table(table_name, true) - @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil + @arel_table = @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil end def reset_column_information_and_inheritable_attributes_for_all_subclasses#:nodoc: @@ -1535,9 +1533,9 @@ module ActiveRecord #:nodoc: end - def arel_table(table = nil, reload = nil) + def arel_table(table = nil) table = table_name if table.blank? - if reload || @arel_table.nil? || @arel_table.name != table + if @arel_table.nil? || @arel_table.name != table @arel_table = Relation.new(self, Arel::Table.new(table)) end @arel_table -- cgit v1.2.3 From 7cce95b25ace33e04526d4490e487a080c1f9b96 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 18:52:14 -0300 Subject: Add readonly support for relations. --- activerecord/lib/active_record/base.rb | 7 ++++++- activerecord/lib/active_record/relation.rb | 12 +++++++++++- activerecord/test/cases/relations_test.rb | 6 ++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c11c049415..402d68c36e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1722,7 +1722,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - arel_table(options[:from]). + relation = arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). @@ -1730,6 +1730,11 @@ module ActiveRecord #:nodoc: order(construct_order(options[:order], scope)). limit(construct_limit(options[:limit], scope)). offset(construct_offset(options[:offset], scope)) + + relation = relation.readonly if options[:readonly] + + relation + end def construct_finder_sql(options, scope = scope(:find)) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 570ba3f80d..4b53857d36 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -5,10 +5,20 @@ module ActiveRecord def initialize(klass, relation) @klass, @relation = klass, relation + @readonly = false + end + + def readonly + @readonly = true + self end def to_a - @klass.find_by_sql(@relation.to_sql) + records = @klass.find_by_sql(@relation.to_sql) + + records.each { |record| record.readonly! } if @readonly + + records end def each(&block) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 6a39aa6e40..655eb3314d 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -79,5 +79,11 @@ class RelationTest < ActiveRecord::TestCase assert relation.respond_to?(method) end end + + def test_find_with_readonly_option + Developer.all.each { |d| assert !d.readonly? } + Developer.all.readonly.each { |d| assert d.readonly? } + Developer.all(:readonly => true).each { |d| assert d.readonly? } + end end -- cgit v1.2.3 From f2c0725d79e29b02e30e7a4827851acc4a766730 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 20:00:14 -0300 Subject: Revert "Add readonly support for relations." This reverts commit 7cce95b25ace33e04526d4490e487a080c1f9b96. --- activerecord/lib/active_record/base.rb | 7 +------ activerecord/lib/active_record/relation.rb | 12 +----------- activerecord/test/cases/relations_test.rb | 6 ------ 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 402d68c36e..c11c049415 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1722,7 +1722,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - relation = arel_table(options[:from]). + arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). @@ -1730,11 +1730,6 @@ module ActiveRecord #:nodoc: order(construct_order(options[:order], scope)). limit(construct_limit(options[:limit], scope)). offset(construct_offset(options[:offset], scope)) - - relation = relation.readonly if options[:readonly] - - relation - end def construct_finder_sql(options, scope = scope(:find)) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 4b53857d36..570ba3f80d 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -5,20 +5,10 @@ module ActiveRecord def initialize(klass, relation) @klass, @relation = klass, relation - @readonly = false - end - - def readonly - @readonly = true - self end def to_a - records = @klass.find_by_sql(@relation.to_sql) - - records.each { |record| record.readonly! } if @readonly - - records + @klass.find_by_sql(@relation.to_sql) end def each(&block) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 655eb3314d..6a39aa6e40 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -79,11 +79,5 @@ class RelationTest < ActiveRecord::TestCase assert relation.respond_to?(method) end end - - def test_find_with_readonly_option - Developer.all.each { |d| assert !d.readonly? } - Developer.all.readonly.each { |d| assert d.readonly? } - Developer.all(:readonly => true).each { |d| assert d.readonly? } - end end -- cgit v1.2.3 From 6b67df70ab1bc42d9a05571144cdf5614a7d4a6a Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 27 Aug 2009 20:03:46 -0300 Subject: Revert "Revert "Add readonly support for relations."" This reverts commit f2c0725d79e29b02e30e7a4827851acc4a766730. --- activerecord/lib/active_record/base.rb | 7 ++++++- activerecord/lib/active_record/relation.rb | 12 +++++++++++- activerecord/test/cases/relations_test.rb | 6 ++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c11c049415..402d68c36e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1722,7 +1722,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - arel_table(options[:from]). + relation = arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). @@ -1730,6 +1730,11 @@ module ActiveRecord #:nodoc: order(construct_order(options[:order], scope)). limit(construct_limit(options[:limit], scope)). offset(construct_offset(options[:offset], scope)) + + relation = relation.readonly if options[:readonly] + + relation + end def construct_finder_sql(options, scope = scope(:find)) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 570ba3f80d..4b53857d36 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -5,10 +5,20 @@ module ActiveRecord def initialize(klass, relation) @klass, @relation = klass, relation + @readonly = false + end + + def readonly + @readonly = true + self end def to_a - @klass.find_by_sql(@relation.to_sql) + records = @klass.find_by_sql(@relation.to_sql) + + records.each { |record| record.readonly! } if @readonly + + records end def each(&block) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 6a39aa6e40..655eb3314d 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -79,5 +79,11 @@ class RelationTest < ActiveRecord::TestCase assert relation.respond_to?(method) end end + + def test_find_with_readonly_option + Developer.all.each { |d| assert !d.readonly? } + Developer.all.readonly.each { |d| assert d.readonly? } + Developer.all(:readonly => true).each { |d| assert d.readonly? } + end end -- cgit v1.2.3 From c01c21b31d590f7e8d12e3ae083fcdf0f0c6fd54 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 1 Sep 2009 15:36:09 -0300 Subject: Added association preload to relation. --- activerecord/lib/active_record/base.rb | 23 +++++++++++++++++++--- activerecord/lib/active_record/relation.rb | 8 ++++++++ activerecord/test/cases/relations_test.rb | 31 +++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 402d68c36e..1c12189e15 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -664,11 +664,28 @@ module ActiveRecord #:nodoc: # This is an alias for find(:all). You can pass in all the same arguments to this method as you can # to find(:all) def all(*args) - if args.empty? && !scoped?(:find) - arel_table + options = args.extract_options! + + + if options.empty? #&& !scoped?(:find) + relation = arel_table else - construct_finder_arel(*args) + include_associations = merge_includes(scope(:find, :include), options[:include]) + + # if include_associations.any? && references_eager_loaded_tables?(options) + # join_dependency = JoinDependency.new(self, include_associations, options[:joins]) + + # relation = construct_finder_arel_with_included_associations(options, join_dependency) + + # relation.preload(include_associations) + # else + relation = construct_finder_arel(options) + if include_associations.any? + relation.preload(include_associations) + # end + end end + relation end # Executes a custom SQL query against your database and returns all the results. The results will diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 4b53857d36..6abb2df8ff 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -6,6 +6,12 @@ module ActiveRecord def initialize(klass, relation) @klass, @relation = klass, relation @readonly = false + @associations_to_preload = [] + end + + def preload(association) + @associations_to_preload << association + @associations_to_preload.flatten! end def readonly @@ -16,6 +22,8 @@ module ActiveRecord def to_a records = @klass.find_by_sql(@relation.to_sql) + @klass.send :preload_associations, records, @associations_to_preload unless @associations_to_preload.empty? + records.each { |record| record.readonly! } if @readonly records diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 655eb3314d..6fb505ca36 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1,6 +1,7 @@ require "cases/helper" require 'models/post' require 'models/topic' +require 'models/comment' require 'models/reply' require 'models/author' require 'models/entrant' @@ -8,7 +9,7 @@ require 'models/developer' require 'models/company' class RelationTest < ActiveRecord::TestCase - fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts + fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts, :comments def test_finding_with_conditions assert_equal Author.find(:all, :conditions => "name = 'David'"), Author.all.conditions("name = 'David'").to_a @@ -85,5 +86,33 @@ class RelationTest < ActiveRecord::TestCase Developer.all.readonly.each { |d| assert d.readonly? } Developer.all(:readonly => true).each { |d| assert d.readonly? } end + + def test_eager_association_loading_of_stis_with_multiple_references + authors = Author.all(:include => { :posts => { :special_comments => { :post => [ :special_comments, :very_special_comment ] } } }, :order => 'comments.body, very_special_comments_posts.body', :conditions => 'posts.id = 4').to_a + assert_equal [authors(:david)], authors + assert_no_queries do + authors.first.posts.first.special_comments.first.post.special_comments + authors.first.posts.first.special_comments.first.post.very_special_comment + end + end + + def test_find_with_included_associations + assert_queries(2) do + posts = Post.find(:all, :include => :comments) + posts.first.comments.first + end + assert_queries(2) do + posts = Post.all(:include => :comments).to_a + posts.first.comments.first + end + assert_queries(2) do + posts = Post.find(:all, :include => :author) + posts.first.author + end + assert_queries(2) do + posts = Post.all(:include => :author).to_a + posts.first.author + end + end end -- cgit v1.2.3 From 378b02d3aa890cedabf1ef81c34a371dbbc52c25 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 14 Sep 2009 17:37:26 -0300 Subject: Updated ARel version. --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index 755a7ced2f..8852db7087 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 755a7ced2f98b0bb246089c80cdfa04cd918fa89 +Subproject commit 8852db7087a8f4f98e5fd26fa33bac14a5400979 -- cgit v1.2.3 From 3747f896a1b727d67e6022001007e5f58b24a267 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 5 Oct 2009 14:39:20 -0300 Subject: Moved relation's test to relation_test. --- activerecord/lib/active_record/base.rb | 3 +-- activerecord/test/cases/method_scoping_test.rb | 4 ++-- activerecord/test/cases/relations_test.rb | 11 +++++++++++ arel | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 1c12189e15..2fd3384877 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -667,7 +667,7 @@ module ActiveRecord #:nodoc: options = args.extract_options! - if options.empty? #&& !scoped?(:find) + if options.empty? && !scoped?(:find) relation = arel_table else include_associations = merge_includes(scope(:find, :include), options[:include]) @@ -1751,7 +1751,6 @@ module ActiveRecord #:nodoc: relation = relation.readonly if options[:readonly] relation - end def construct_finder_sql(options, scope = scope(:find)) diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb index 6dec474f7d..eb4ce0e774 100644 --- a/activerecord/test/cases/method_scoping_test.rb +++ b/activerecord/test/cases/method_scoping_test.rb @@ -593,12 +593,12 @@ class DefaultScopingTest < ActiveRecord::TestCase end def test_default_scope_with_conditions_string - assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.all.to_a.map(&:id).sort + assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.find(:all).map(&:id).sort assert_equal nil, DeveloperCalledDavid.create!.name end def test_default_scope_with_conditions_hash - assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort + assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.find(:all).map(&:id).sort assert_equal 'Jamis', DeveloperCalledJamis.create!.name end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 6fb505ca36..17c228616b 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -114,5 +114,16 @@ class RelationTest < ActiveRecord::TestCase posts.first.author end end + + def test_default_scope_with_conditions_string + assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.all.to_a.map(&:id).sort + assert_equal nil, DeveloperCalledDavid.create!.name + end + + def test_default_scope_with_conditions_hash + assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort + assert_equal 'Jamis', DeveloperCalledJamis.create!.name + end + end diff --git a/arel b/arel index 755a7ced2f..8852db7087 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 755a7ced2f98b0bb246089c80cdfa04cd918fa89 +Subproject commit 8852db7087a8f4f98e5fd26fa33bac14a5400979 -- cgit v1.2.3 From 65f055a3ed790d41aeca8d4ca7f3771b05cf544f Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 5 Oct 2009 15:24:08 -0300 Subject: Added eager loading support to Relation and ActiveRecord#all. --- activerecord/lib/active_record/associations.rb | 4 +-- activerecord/lib/active_record/base.rb | 17 ++++-------- activerecord/lib/active_record/relation.rb | 32 +++++++++++++++++----- .../associations/cascaded_eager_loading_test.rb | 2 +- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index b363cceccb..016745add2 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1455,9 +1455,9 @@ module ActiveRecord after_destroy(method_name) end - def find_with_associations(options = {}) + def find_with_associations(options = {}, join_dependency = nil) catch :invalid_query do - join_dependency = JoinDependency.new(self, merge_includes(scope(:find, :include), options[:include]), options[:joins]) + join_dependency ||= JoinDependency.new(self, merge_includes(scope(:find, :include), options[:include]), options[:joins]) rows = select_all_rows(options, join_dependency) return join_dependency.instantiate(rows) end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2fd3384877..60e69f020c 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -666,23 +666,18 @@ module ActiveRecord #:nodoc: def all(*args) options = args.extract_options! - if options.empty? && !scoped?(:find) relation = arel_table else + relation = construct_finder_arel(options) include_associations = merge_includes(scope(:find, :include), options[:include]) - # if include_associations.any? && references_eager_loaded_tables?(options) - # join_dependency = JoinDependency.new(self, include_associations, options[:joins]) - - # relation = construct_finder_arel_with_included_associations(options, join_dependency) - - # relation.preload(include_associations) - # else - relation = construct_finder_arel(options) - if include_associations.any? + if include_associations.any? + if references_eager_loaded_tables?(options) + relation.eager_load(include_associations) + else relation.preload(include_associations) - # end + end end end relation diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 6abb2df8ff..24fd29c7f3 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -7,11 +7,17 @@ module ActiveRecord @klass, @relation = klass, relation @readonly = false @associations_to_preload = [] + @eager_load_associations = [] end def preload(association) - @associations_to_preload << association - @associations_to_preload.flatten! + @associations_to_preload += association + self + end + + def eager_load(association) + @eager_load_associations += association + self end def readonly @@ -20,11 +26,23 @@ module ActiveRecord end def to_a - records = @klass.find_by_sql(@relation.to_sql) - - @klass.send :preload_associations, records, @associations_to_preload unless @associations_to_preload.empty? - - records.each { |record| record.readonly! } if @readonly + if @eager_load_associations.any? + records = catch :invalid_query do + @klass.send(:find_with_associations, { + :select => @relation.send(:select_clauses).join(', '), + :joins => @relation.joins(relation), + :group => @relation.send(:group_clauses).join(', '), + :order => @relation.send(:order_clauses).join(', '), + :conditions => @relation.send(:where_clauses).join("\n\tAND "), + :limit => @relation.taken + }, + ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, @eager_load_associations, nil)) + end + else + records = @klass.find_by_sql(@relation.to_sql) + @klass.send(:preload_associations, records, @associations_to_preload) unless @associations_to_preload.empty? + records.each { |record| record.readonly! } if @readonly + end records end diff --git a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb index 45e74ea024..ed2e2e9f8f 100644 --- a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +++ b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb @@ -104,7 +104,7 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase authors.first.posts.first.special_comments.first.post.very_special_comment end end - + def test_eager_association_loading_where_first_level_returns_nil authors = Author.find(:all, :include => {:post_about_thinking => :comments}, :order => 'authors.id DESC') assert_equal [authors(:mary), authors(:david)], authors -- cgit v1.2.3 From 23c168a4fdd5a8f2191283d1d5c626c348fb6ae0 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 5 Oct 2009 15:27:40 -0300 Subject: Initial documentation to Base#all. --- activerecord/lib/active_record/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 668506c01a..8ea6c69fc5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -661,8 +661,8 @@ module ActiveRecord #:nodoc: find(:last, *args) end - # This is an alias for find(:all). You can pass in all the same arguments to this method as you can - # to find(:all) + # Returns an ActiveRecord::Relation object. You can pass in all the same arguments to this method as you can + # to find(:all). def all(*args) options = args.extract_options! -- cgit v1.2.3 From 1d5854826b27e5e8bfb041c57a49d1e46178b49e Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 7 Oct 2009 11:57:59 -0300 Subject: Allow preload and eager_load to work on relations at the same time. --- activerecord/lib/active_record/relation.rb | 14 ++++++++------ activerecord/test/cases/relations_test.rb | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 24fd29c7f3..db1c9c24de 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -26,9 +26,9 @@ module ActiveRecord end def to_a - if @eager_load_associations.any? - records = catch :invalid_query do - @klass.send(:find_with_associations, { + records = if @eager_load_associations.any? + catch :invalid_query do + return @klass.send(:find_with_associations, { :select => @relation.send(:select_clauses).join(', '), :joins => @relation.joins(relation), :group => @relation.send(:group_clauses).join(', '), @@ -38,12 +38,14 @@ module ActiveRecord }, ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, @eager_load_associations, nil)) end + [] else - records = @klass.find_by_sql(@relation.to_sql) - @klass.send(:preload_associations, records, @associations_to_preload) unless @associations_to_preload.empty? - records.each { |record| record.readonly! } if @readonly + @klass.find_by_sql(@relation.to_sql) end + @klass.send(:preload_associations, records, @associations_to_preload) unless @associations_to_preload.empty? + records.each { |record| record.readonly! } if @readonly + records end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 17c228616b..54b72554b9 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -4,6 +4,7 @@ require 'models/topic' require 'models/comment' require 'models/reply' require 'models/author' +require 'models/comment' require 'models/entrant' require 'models/developer' require 'models/company' @@ -125,5 +126,26 @@ class RelationTest < ActiveRecord::TestCase assert_equal 'Jamis', DeveloperCalledJamis.create!.name end + def test_loading_with_one_association + posts = Post.all(:include => :comments).to_a + post = posts.find { |p| p.id == 1 } + assert_equal 2, post.comments.size + assert post.comments.include?(comments(:greetings)) + + post = Post.find(:first, :include => :comments, :conditions => "posts.title = 'Welcome to the weblog'") + assert_equal 2, post.comments.size + assert post.comments.include?(comments(:greetings)) + + posts = Post.all(:include => :last_comment).to_a + post = posts.find { |p| p.id == 1 } + assert_equal Post.find(1).last_comment, post.last_comment + end + + def test_loading_with_one_association_with_non_preload + posts = Post.all(:include => :last_comment, :order => 'comments.id DESC').to_a + post = posts.find { |p| p.id == 1 } + assert_equal Post.find(1).last_comment, post.last_comment + end + end -- cgit v1.2.3 From 942d4b2e4fb6128c3163fb24893e3de9ae73e7c3 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 7 Oct 2009 12:17:51 -0300 Subject: Don't send table_name when there's no need to. --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8ea6c69fc5..4472db28ce 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2573,7 +2573,7 @@ module ActiveRecord #:nodoc: # be made (since they can't be persisted). def destroy unless new_record? - self.class.arel_table(self.class.table_name).conditions(self.class.arel_table[self.class.primary_key].eq(id)).delete + self.class.arel_table.conditions(self.class.arel_table[self.class.primary_key].eq(id)).delete end @destroyed = true -- cgit v1.2.3 From f13a7bf4e17f265b340ca7d703caeed12716e386 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 7 Oct 2009 12:21:52 -0300 Subject: Don't send table_name when updating attributes, use the class arel_table. --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4472db28ce..44eaff3aa7 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2868,7 +2868,7 @@ module ActiveRecord #:nodoc: def update(attribute_names = @attributes.keys) attributes_with_values = arel_attributes_values(false, false, attribute_names) return 0 if attributes_with_values.empty? - self.class.arel_table(self.class.table_name).conditions(self.class.arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) + self.class.arel_table.conditions(self.class.arel_table[self.class.primary_key].eq(id)).update(attributes_with_values) end # Creates a record with values matching those of the instance attributes -- cgit v1.2.3 From 9a958a3d7dc1640c90abbe1164d7ccb7ea9ae685 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 7 Oct 2009 12:43:04 -0300 Subject: Relations: Added offset when finding with associations. Delegate array instance methods to to_a. --- activerecord/lib/active_record/relation.rb | 8 +++----- activerecord/test/cases/relations_test.rb | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index db1c9c24de..6bc56ecf15 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,6 +1,7 @@ module ActiveRecord class Relation delegate :to_sql, :to => :relation + delegate :length, :collect, :find, :map, :each, :to => :to_a attr_reader :relation, :klass def initialize(klass, relation) @@ -34,7 +35,8 @@ module ActiveRecord :group => @relation.send(:group_clauses).join(', '), :order => @relation.send(:order_clauses).join(', '), :conditions => @relation.send(:where_clauses).join("\n\tAND "), - :limit => @relation.taken + :limit => @relation.taken, + :offset => @relation.skipped }, ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, @eager_load_associations, nil)) end @@ -49,10 +51,6 @@ module ActiveRecord records end - def each(&block) - to_a.each(&block) - end - def first @relation = @relation.take(1) to_a.first diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 54b72554b9..4833d04aff 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -122,12 +122,12 @@ class RelationTest < ActiveRecord::TestCase end def test_default_scope_with_conditions_hash - assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort + assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.map(&:id).sort assert_equal 'Jamis', DeveloperCalledJamis.create!.name end def test_loading_with_one_association - posts = Post.all(:include => :comments).to_a + posts = Post.all(:include => :comments) post = posts.find { |p| p.id == 1 } assert_equal 2, post.comments.size assert post.comments.include?(comments(:greetings)) @@ -136,16 +136,15 @@ class RelationTest < ActiveRecord::TestCase assert_equal 2, post.comments.size assert post.comments.include?(comments(:greetings)) - posts = Post.all(:include => :last_comment).to_a + posts = Post.all(:include => :last_comment) post = posts.find { |p| p.id == 1 } assert_equal Post.find(1).last_comment, post.last_comment end def test_loading_with_one_association_with_non_preload - posts = Post.all(:include => :last_comment, :order => 'comments.id DESC').to_a + posts = Post.all(:include => :last_comment, :order => 'comments.id DESC') post = posts.find { |p| p.id == 1 } assert_equal Post.find(1).last_comment, post.last_comment end - end -- cgit v1.2.3 From c3f9d51a00b9e7e5f5d14e7464fae04c48198756 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Thu, 8 Oct 2009 15:04:27 -0300 Subject: Updated ARel commit version. --- arel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arel b/arel index 8852db7087..927d8b8cde 160000 --- a/arel +++ b/arel @@ -1 +1 @@ -Subproject commit 8852db7087a8f4f98e5fd26fa33bac14a5400979 +Subproject commit 927d8b8cde930244a16215c57896c8e45f616d0f -- cgit v1.2.3 From 7bc5e3bd02632bd3545b9097e14ea289e9531bb5 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 10 Oct 2009 19:53:40 -0500 Subject: Add define a "stuff" controller in fixtures to support routing tests --- actionpack/test/lib/controller/fake_controllers.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/actionpack/test/lib/controller/fake_controllers.rb b/actionpack/test/lib/controller/fake_controllers.rb index 9ec7f330b8..54b6e3ba4c 100644 --- a/actionpack/test/lib/controller/fake_controllers.rb +++ b/actionpack/test/lib/controller/fake_controllers.rb @@ -7,6 +7,7 @@ module Admin class << self; alias_method :const_available?, :const_defined?; end class UserController < ActionController::Base; end class NewsFeedController < ActionController::Base; end + class StuffController < ActionController::Base; end end module Api -- cgit v1.2.3 From 5d071b4bc28596896b8e51703afe2d0ff44c4143 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 10 Oct 2009 19:58:36 -0500 Subject: Drop implementation specific routing test assertions --- actionpack/test/controller/routing_test.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index edf243337f..32d60d8b7a 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -984,9 +984,6 @@ class RouteSetTest < ActiveSupport::TestCase end assert_equal 1, set.routes.size - route = set.routes.first - - assert route.segments.last.optional? assert_equal '/users/show/10', set.generate(:controller => 'users', :action => 'show', :id => 10) assert_equal '/users/index/10', set.generate(:controller => 'users', :id => 10) -- cgit v1.2.3 From 673f73b53822a8a94bac0b6d4ffc485f6eaeb9cd Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 10 Oct 2009 20:04:44 -0500 Subject: Add define another "stuff" controller to support routing tests --- actionpack/test/lib/controller/fake_controllers.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/actionpack/test/lib/controller/fake_controllers.rb b/actionpack/test/lib/controller/fake_controllers.rb index 54b6e3ba4c..c993836a61 100644 --- a/actionpack/test/lib/controller/fake_controllers.rb +++ b/actionpack/test/lib/controller/fake_controllers.rb @@ -27,6 +27,7 @@ class HiController < ActionController::Base; end class ImageController < ActionController::Base; end class PeopleController < ActionController::Base; end class SessionsController < ActionController::Base; end +class StuffController < ActionController::Base; end class SubpathBooksController < ActionController::Base; end class WeblogController < ActionController::Base; end -- cgit v1.2.3 From 21be1dcffa98321fc999e39d11e902d717affad1 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 10 Oct 2009 20:16:55 -0500 Subject: Relative url generations are covered more thoroughly by url rewriter tests --- actionpack/test/controller/routing_test.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 32d60d8b7a..f3eef58f46 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -240,18 +240,6 @@ class LegacyRouteSetTests < Test::Unit::TestCase x.send(:home_url)) end - def test_basic_named_route_with_relative_url_root - rs.draw do |map| - map.home '', :controller => 'content', :action => 'list' - end - x = setup_for_named_route - ActionController::Base.relative_url_root = "/foo" - assert_equal("http://test.host/foo/", - x.send(:home_url)) - assert_equal "/foo/", x.send(:home_path) - ActionController::Base.relative_url_root = nil - end - def test_named_route_with_option rs.draw do |map| map.page 'page/:title', :controller => 'content', :action => 'show_page' -- cgit v1.2.3 From 1610cd0827129c28518ee6586d8ecf922576bf20 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 10 Oct 2009 20:19:47 -0500 Subject: Move safe buffer into test/template --- actionpack/test/template/safe_buffer_test.rb | 41 ++++++++++++++++++++++++++++ actionpack/test/view/safe_buffer_test.rb | 41 ---------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 actionpack/test/template/safe_buffer_test.rb delete mode 100644 actionpack/test/view/safe_buffer_test.rb diff --git a/actionpack/test/template/safe_buffer_test.rb b/actionpack/test/template/safe_buffer_test.rb new file mode 100644 index 0000000000..2236709627 --- /dev/null +++ b/actionpack/test/template/safe_buffer_test.rb @@ -0,0 +1,41 @@ +require 'abstract_unit' + +class SafeBufferTest < ActionView::TestCase + def setup + @buffer = ActionView::SafeBuffer.new + end + + test "Should look like a string" do + assert @buffer.is_a?(String) + assert_equal "", @buffer + end + + test "Should escape a raw string which is passed to them" do + @buffer << "", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") assert_dom_equal "", mail_to("me@domain.com", nil, :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") end - + def protect_against_forgery? false end + + private + def sort_query_string_params(uri) + path, qs = uri.split('?') + qs = qs.split('&').sort.join('&') if qs + qs ? "#{path}?#{qs}" : path + end end class UrlHelperController < ActionController::Base -- cgit v1.2.3 From 6c581f5fd57dc1706d5f674b4371c07d040c4151 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 19 Oct 2009 22:41:58 -0500 Subject: Kill routing tests expecting path to be unescaped. Most rack servers already escape PATH_INFO. --- actionpack/test/controller/routing_test.rb | 62 ++++++------------------------ 1 file changed, 12 insertions(+), 50 deletions(-) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index cbbd7e6951..67448e66b9 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -27,7 +27,7 @@ class UriReservedCharactersRoutingTest < Test::Unit::TestCase map.connect ':controller/:action/:variable/*additional' end - safe, unsafe = %w(: @ & = + $ , ;), %w(^ / ? # [ ]) + safe, unsafe = %w(: @ & = + $ , ;), %w(^ ? # [ ]) hex = unsafe.map { |char| '%' + char.unpack('H2').first.upcase } @segment = "#{safe.join}#{unsafe.join}".freeze @@ -366,10 +366,6 @@ class LegacyRouteSetTests < Test::Unit::TestCase results = rs.recognize_path "/file/hello%20world/how%20are%20you%3F" assert results, "Recognition should have succeeded" assert_equal ['hello world', 'how are you?'], results[:path] - - results = rs.recognize_path "/file" - assert results, "Recognition should have succeeded" - assert_equal [], results[:path] end def test_paths_slashes_unescaped_with_ordered_parameters @@ -379,7 +375,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase # No / to %2F in URI, only for query params. x = setup_for_named_route - assert_equal("/file/hello/world", x.send(:path_path, 'hello/world')) + assert_equal("/file/hello/world", x.send(:path_path, ['hello', 'world'])) end def test_non_controllers_cannot_be_matched @@ -1234,16 +1230,16 @@ class RouteSetTest < ActiveSupport::TestCase assert_equal "/foo/bar/baz/7", url end - def test_id_is_not_impossibly_sticky - set.draw do |map| - map.connect 'foo/:number', :controller => "people", :action => "index" - map.connect ':controller/:action/:id' - end - - url = set.generate({:controller => "people", :action => "index", :number => 3}, - {:controller => "people", :action => "index", :id => "21"}) - assert_equal "/foo/3", url - end + # def test_id_is_not_impossibly_sticky + # set.draw do |map| + # map.connect 'foo/:number', :controller => "people", :action => "index" + # map.connect ':controller/:action/:id' + # end + # + # url = set.generate({:controller => "people", :action => "index", :number => 3}, + # {:controller => "people", :action => "index", :id => "21"}) + # assert_equal "/foo/3", url + # end def test_id_is_sticky_when_it_ought_to_be set.draw do |map| @@ -1520,39 +1516,6 @@ class RouteSetTest < ActiveSupport::TestCase assert_equal({:controller => 'pages', :action => 'show', :name => :as_symbol}, set.recognize_path('/named')) end - def test_interpolation_chunk_should_respect_raw - set.draw do |map| - map.connect '/Hello World', :controller => 'hello' - end - - assert_equal '/Hello%20World', set.generate(:controller => 'hello') - assert_equal({:controller => "hello", :action => "index"}, set.recognize_path('/Hello World')) - assert_raise(ActionController::RoutingError) { set.recognize_path('/Hello%20World') } - end - - def test_value_should_not_be_double_unescaped - set.draw do |map| - map.connect '/Карта', :controller => 'foo' - end - - assert_equal '/%D0%9A%D0%B0%D1%80%D1%82%D0%B0', set.generate(:controller => 'foo') - assert_equal({:controller => "foo", :action => "index"}, set.recognize_path('/Карта')) - assert_raise(ActionController::RoutingError) { set.recognize_path('/%D0%9A%D0%B0%D1%80%D1%82%D0%B0') } - end - - def test_regexp_chunk_should_escape_specials - set.draw do |map| - map.connect '/Hello*World', :controller => 'foo' - map.connect '/HelloWorld', :controller => 'bar' - end - - assert_equal '/Hello*World', set.generate(:controller => 'foo') - assert_equal '/HelloWorld', set.generate(:controller => 'bar') - - assert_equal({:controller => "foo", :action => "index"}, set.recognize_path('/Hello*World')) - assert_equal({:controller => "bar", :action => "index"}, set.recognize_path('/HelloWorld')) - end - def test_regexp_chunk_should_add_question_mark_for_optionals set.draw do |map| map.connect '/', :controller => 'foo' @@ -1654,7 +1617,6 @@ class RouteSetTest < ActiveSupport::TestCase def test_default_route_should_uri_escape_pluses expected = { :controller => 'pages', :action => 'show', :id => 'hello world' } - assert_equal expected, default_route_set.recognize_path('/pages/show/hello world') assert_equal expected, default_route_set.recognize_path('/pages/show/hello%20world') assert_equal '/pages/show/hello%20world', default_route_set.generate(expected, expected) -- cgit v1.2.3 From 248d84f2e6d5948cc88a5735c6685e7ed81abb6b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 19 Oct 2009 20:58:55 -0700 Subject: Simplify path expansions --- railties/lib/rails/generators/rails/app/templates/Rakefile | 2 +- railties/lib/rails/generators/rails/app/templates/config/application.rb | 2 +- railties/lib/rails/generators/rails/app/templates/config/environment.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/Rakefile b/railties/lib/rails/generators/rails/app/templates/Rakefile index 2450a927f0..6b6d07e8cc 100755 --- a/railties/lib/rails/generators/rails/app/templates/Rakefile +++ b/railties/lib/rails/generators/rails/app/templates/Rakefile @@ -1,7 +1,7 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path(File.join(File.dirname(__FILE__), 'config', 'application')) +require File.expand_path('../config/application', __FILE__) require 'rake' require 'rake/testtask' diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index bb30136686..8008c6ba07 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.join(File.dirname(__FILE__), 'boot')) +require File.expand_path('../boot', __FILE__) Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here. diff --git a/railties/lib/rails/generators/rails/app/templates/config/environment.rb b/railties/lib/rails/generators/rails/app/templates/config/environment.rb index e5362b21cc..0bb191f205 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environment.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/environment.rb @@ -1,5 +1,5 @@ # Load the rails application -require File.expand_path(File.join(File.dirname(__FILE__), 'application')) +require File.expand_path('../application', __FILE__) # Initialize the rails application Rails.initialize! -- cgit v1.2.3 From cbedcb06152ed6d7e7457334cd45af5ab24ef6ea Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 19 Oct 2009 21:03:37 -0700 Subject: Missed cherry-pick from 2e37effd7203cad84459661e11db2be44586cb4f --- .../lib/active_support/core_ext/class/inheritable_attributes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb index d8e9768a5e..e4d22516c1 100644 --- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/object/duplicable' +require 'active_support/core_ext/array/extract_options' # Retain for backward compatibility. Methods are now included in Class. module ClassInheritableAttributes # :nodoc: -- cgit v1.2.3 From a1df2590744ed126981dfd5b5709ff6fd5dc6476 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 19 Oct 2009 23:32:06 -0500 Subject: Replace decaying routing internals w/ rack-mount --- actionpack/Gemfile | 1 + actionpack/lib/action_controller.rb | 6 +- actionpack/lib/action_controller/routing.rb | 18 +- .../lib/action_controller/routing/builder.rb | 199 ---------- .../routing/generation/polymorphic_routes.rb | 210 ---------- .../routing/generation/url_rewriter.rb | 204 ---------- .../lib/action_controller/routing/optimisations.rb | 130 ------ .../routing/polymorphic_routes.rb | 210 ++++++++++ .../routing/recognition_optimisation.rb | 167 -------- actionpack/lib/action_controller/routing/route.rb | 267 ------------- .../lib/action_controller/routing/route_set.rb | 434 +++++++++++++++------ .../lib/action_controller/routing/routing_ext.rb | 4 - .../lib/action_controller/routing/segments.rb | 343 ---------------- .../lib/action_controller/routing/url_rewriter.rb | 204 ++++++++++ .../lib/action_controller/testing/test_case.rb | 9 +- actionpack/test/controller/routing_test.rb | 27 -- .../lib/active_support/core_ext/regexp.rb | 22 -- activesupport/test/core_ext/regexp_ext_test.rb | 19 - 18 files changed, 755 insertions(+), 1719 deletions(-) delete mode 100644 actionpack/lib/action_controller/routing/builder.rb delete mode 100644 actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb delete mode 100644 actionpack/lib/action_controller/routing/generation/url_rewriter.rb delete mode 100644 actionpack/lib/action_controller/routing/optimisations.rb create mode 100644 actionpack/lib/action_controller/routing/polymorphic_routes.rb delete mode 100644 actionpack/lib/action_controller/routing/recognition_optimisation.rb delete mode 100644 actionpack/lib/action_controller/routing/route.rb delete mode 100644 actionpack/lib/action_controller/routing/routing_ext.rb delete mode 100644 actionpack/lib/action_controller/routing/segments.rb create mode 100644 actionpack/lib/action_controller/routing/url_rewriter.rb diff --git a/actionpack/Gemfile b/actionpack/Gemfile index b3ffeaecb6..af95766608 100644 --- a/actionpack/Gemfile +++ b/actionpack/Gemfile @@ -3,6 +3,7 @@ rails_root = Pathname.new(File.dirname(__FILE__)).join("..") Gem.sources.each { |uri| source uri } gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0" +gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" gem "rack-test", "~> 0.5.0" gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport") gem "activemodel", "3.0.pre", :vendored_at => rails_root.join("activemodel") diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 6702cb47f8..809e5f2ad4 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -26,14 +26,14 @@ module ActionController autoload :IntegrationTest, 'action_controller/deprecated/integration_test' autoload :MimeResponds, 'action_controller/metal/mime_responds' autoload :PerformanceTest, 'action_controller/deprecated/performance_test' - autoload :PolymorphicRoutes, 'action_controller/routing/generation/polymorphic_routes' + autoload :PolymorphicRoutes, 'action_controller/routing/polymorphic_routes' autoload :RecordIdentifier, 'action_controller/record_identifier' autoload :Resources, 'action_controller/routing/resources' autoload :SessionManagement, 'action_controller/metal/session_management' autoload :TestCase, 'action_controller/testing/test_case' autoload :TestProcess, 'action_controller/testing/process' - autoload :UrlRewriter, 'action_controller/routing/generation/url_rewriter' - autoload :UrlWriter, 'action_controller/routing/generation/url_rewriter' + autoload :UrlRewriter, 'action_controller/routing/url_rewriter' + autoload :UrlWriter, 'action_controller/routing/url_rewriter' autoload :Verification, 'action_controller/metal/verification' autoload :Flash, 'action_controller/metal/flash' diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 5b9ded83dd..979a4ad8c9 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -1,16 +1,8 @@ -require 'cgi' -require 'uri' -require 'set' - -require 'active_support/core_ext/module/aliasing' -require 'active_support/core_ext/module/attribute_accessors' -require 'action_controller/routing/optimisations' -require 'action_controller/routing/routing_ext' -require 'action_controller/routing/route' -require 'action_controller/routing/segments' -require 'action_controller/routing/builder' +require 'active_support/core_ext/object/conversions' +require 'active_support/core_ext/boolean/conversions' +require 'active_support/core_ext/nil/conversions' +require 'active_support/core_ext/regexp' require 'action_controller/routing/route_set' -require 'action_controller/routing/recognition_optimisation' module ActionController # == Routing @@ -197,7 +189,7 @@ module ActionController # # map.connect '*path' , :controller => 'blog' , :action => 'unrecognized?' # - # will glob all remaining parts of the route that were not recognized earlier. + # will glob all remaining parts of the route that were not recognized earlier. # The globbed values are in params[:path] as an array of path segments. # # == Route conditions diff --git a/actionpack/lib/action_controller/routing/builder.rb b/actionpack/lib/action_controller/routing/builder.rb deleted file mode 100644 index 42ad12e1ea..0000000000 --- a/actionpack/lib/action_controller/routing/builder.rb +++ /dev/null @@ -1,199 +0,0 @@ -require 'active_support/core_ext/hash/except' - -module ActionController - module Routing - class RouteBuilder #:nodoc: - attr_reader :separators, :optional_separators - attr_reader :separator_regexp, :nonseparator_regexp, :interval_regexp - - def initialize - @separators = Routing::SEPARATORS - @optional_separators = %w( / ) - - @separator_regexp = /[#{Regexp.escape(separators.join)}]/ - @nonseparator_regexp = /\A([^#{Regexp.escape(separators.join)}]+)/ - @interval_regexp = /(.*?)(#{separator_regexp}|$)/ - end - - # Accepts a "route path" (a string defining a route), and returns the array - # of segments that corresponds to it. Note that the segment array is only - # partially initialized--the defaults and requirements, for instance, need - # to be set separately, via the +assign_route_options+ method, and the - # optional? method for each segment will not be reliable until after - # +assign_route_options+ is called, as well. - def segments_for_route_path(path) - rest, segments = path, [] - - until rest.empty? - segment, rest = segment_for(rest) - segments << segment - end - segments - end - - # A factory method that returns a new segment instance appropriate for the - # format of the given string. - def segment_for(string) - segment = - case string - when /\A\.(:format)?\// - OptionalFormatSegment.new - when /\A:(\w+)/ - key = $1.to_sym - key == :controller ? ControllerSegment.new(key) : DynamicSegment.new(key) - when /\A\*(\w+)/ - PathSegment.new($1.to_sym, :optional => true) - when /\A\?(.*?)\?/ - StaticSegment.new($1, :optional => true) - when nonseparator_regexp - StaticSegment.new($1) - when separator_regexp - DividerSegment.new($&, :optional => optional_separators.include?($&)) - end - [segment, $~.post_match] - end - - # Split the given hash of options into requirement and default hashes. The - # segments are passed alongside in order to distinguish between default values - # and requirements. - def divide_route_options(segments, options) - options = options.except(:path_prefix, :name_prefix) - - if options[:namespace] - options[:controller] = "#{options.delete(:namespace).sub(/\/$/, '')}/#{options[:controller]}" - end - - requirements = (options.delete(:requirements) || {}).dup - defaults = (options.delete(:defaults) || {}).dup - conditions = (options.delete(:conditions) || {}).dup - - validate_route_conditions(conditions) - - path_keys = segments.collect { |segment| segment.key if segment.respond_to?(:key) }.compact - options.each do |key, value| - hash = (path_keys.include?(key) && ! value.is_a?(Regexp)) ? defaults : requirements - hash[key] = value - end - - [defaults, requirements, conditions] - end - - # Takes a hash of defaults and a hash of requirements, and assigns them to - # the segments. Any unused requirements (which do not correspond to a segment) - # are returned as a hash. - def assign_route_options(segments, defaults, requirements) - route_requirements = {} # Requirements that do not belong to a segment - - segment_named = Proc.new do |key| - segments.detect { |segment| segment.key == key if segment.respond_to?(:key) } - end - - requirements.each do |key, requirement| - segment = segment_named[key] - if segment - raise TypeError, "#{key}: requirements on a path segment must be regular expressions" unless requirement.is_a?(Regexp) - if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} - raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" - end - if requirement.multiline? - raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" - end - segment.regexp = requirement - else - route_requirements[key] = requirement - end - end - - defaults.each do |key, default| - segment = segment_named[key] - raise ArgumentError, "#{key}: No matching segment exists; cannot assign default" unless segment - segment.is_optional = true - segment.default = default.to_param if default - end - - assign_default_route_options(segments) - ensure_required_segments(segments) - route_requirements - end - - # Assign default options, such as 'index' as a default for :action. This - # method must be run *after* user supplied requirements and defaults have - # been applied to the segments. - def assign_default_route_options(segments) - segments.each do |segment| - next unless segment.is_a? DynamicSegment - case segment.key - when :action - if segment.regexp.nil? || segment.regexp.match('index').to_s == 'index' - segment.default ||= 'index' - segment.is_optional = true - end - when :id - if segment.default.nil? && segment.regexp.nil? || segment.regexp =~ '' - segment.is_optional = true - end - end - end - end - - # Makes sure that there are no optional segments that precede a required - # segment. If any are found that precede a required segment, they are - # made required. - def ensure_required_segments(segments) - allow_optional = true - segments.reverse_each do |segment| - allow_optional &&= segment.optional? - if !allow_optional && segment.optional? - unless segment.optionality_implied? - warn "Route segment \"#{segment.to_s}\" cannot be optional because it precedes a required segment. This segment will be required." - end - segment.is_optional = false - elsif allow_optional && segment.respond_to?(:default) && segment.default - # if a segment has a default, then it is optional - segment.is_optional = true - end - end - end - - # Construct and return a route with the given path and options. - def build(path, options) - # Wrap the path with slashes - path = "/#{path}" unless path[0] == ?/ - path = "#{path}/" unless path[-1] == ?/ - - prefix = options[:path_prefix].to_s.gsub(/^\//,'') - path = "/#{prefix}#{path}" unless prefix.blank? - - segments = segments_for_route_path(path) - defaults, requirements, conditions = divide_route_options(segments, options) - requirements = assign_route_options(segments, defaults, requirements) - - # TODO: Segments should be frozen on initialize - segments.each { |segment| segment.freeze } - - route = Route.new(segments, requirements, conditions) - - if !route.significant_keys.include?(:controller) - raise ArgumentError, "Illegal route: the :controller must be specified!" - end - - route.freeze - end - - private - def validate_route_conditions(conditions) - if method = conditions[:method] - [method].flatten.each do |m| - if m == :head - raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" - end - - unless HTTP_METHODS.include?(m.to_sym) - raise ArgumentError, "Invalid HTTP method specified in route conditions: #{conditions.inspect}" - end - end - end - end - end - end -end diff --git a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb deleted file mode 100644 index 2adf3575a7..0000000000 --- a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb +++ /dev/null @@ -1,210 +0,0 @@ -module ActionController - # Polymorphic URL helpers are methods for smart resolution to a named route call when - # given an Active Record model instance. They are to be used in combination with - # ActionController::Resources. - # - # These methods are useful when you want to generate correct URL or path to a RESTful - # resource without having to know the exact type of the record in question. - # - # Nested resources and/or namespaces are also supported, as illustrated in the example: - # - # polymorphic_url([:admin, @article, @comment]) - # - # results in: - # - # admin_article_comment_url(@article, @comment) - # - # == Usage within the framework - # - # Polymorphic URL helpers are used in a number of places throughout the Rails framework: - # - # * url_for, so you can use it with a record as the argument, e.g. - # url_for(@article); - # * ActionView::Helpers::FormHelper uses polymorphic_path, so you can write - # form_for(@article) without having to specify :url parameter for the form - # action; - # * redirect_to (which, in fact, uses url_for) so you can write - # redirect_to(post) in your controllers; - # * ActionView::Helpers::AtomFeedHelper, so you don't have to explicitly specify URLs - # for feed entries. - # - # == Prefixed polymorphic helpers - # - # In addition to polymorphic_url and polymorphic_path methods, a - # number of prefixed helpers are available as a shorthand to :action => "..." - # in options. Those are: - # - # * edit_polymorphic_url, edit_polymorphic_path - # * new_polymorphic_url, new_polymorphic_path - # - # Example usage: - # - # edit_polymorphic_path(@post) # => "/posts/1/edit" - # polymorphic_path(@post, :format => :pdf) # => "/posts/1.pdf" - module PolymorphicRoutes - # Constructs a call to a named RESTful route for the given record and returns the - # resulting URL string. For example: - # - # # calls post_url(post) - # polymorphic_url(post) # => "http://example.com/posts/1" - # polymorphic_url([blog, post]) # => "http://example.com/blogs/1/posts/1" - # polymorphic_url([:admin, blog, post]) # => "http://example.com/admin/blogs/1/posts/1" - # polymorphic_url([user, :blog, post]) # => "http://example.com/users/1/blog/posts/1" - # polymorphic_url(Comment) # => "http://example.com/comments" - # - # ==== Options - # - # * :action - Specifies the action prefix for the named route: - # :new or :edit. Default is no prefix. - # * :routing_type - Allowed values are :path or :url. - # Default is :url. - # - # ==== Examples - # - # # an Article record - # polymorphic_url(record) # same as article_url(record) - # - # # a Comment record - # polymorphic_url(record) # same as comment_url(record) - # - # # it recognizes new records and maps to the collection - # record = Comment.new - # polymorphic_url(record) # same as comments_url() - # - # # the class of a record will also map to the collection - # polymorphic_url(Comment) # same as comments_url() - # - def polymorphic_url(record_or_hash_or_array, options = {}) - if record_or_hash_or_array.kind_of?(Array) - record_or_hash_or_array = record_or_hash_or_array.compact - record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 - end - - record = extract_record(record_or_hash_or_array) - record = record.to_model if record.respond_to?(:to_model) - namespace = extract_namespace(record_or_hash_or_array) - - args = case record_or_hash_or_array - when Hash; [ record_or_hash_or_array ] - when Array; record_or_hash_or_array.dup - else [ record_or_hash_or_array ] - end - - inflection = if options[:action].to_s == "new" - args.pop - :singular - elsif (record.respond_to?(:new_record?) && record.new_record?) || - (record.respond_to?(:destroyed?) && record.destroyed?) - args.pop - :plural - elsif record.is_a?(Class) - args.pop - :plural - else - :singular - end - - args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} - - named_route = build_named_route_call(record_or_hash_or_array, namespace, inflection, options) - - url_options = options.except(:action, :routing_type) - unless url_options.empty? - args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options - end - - __send__(named_route, *args) - end - - # Returns the path component of a URL for the given record. It uses - # polymorphic_url with :routing_type => :path. - def polymorphic_path(record_or_hash_or_array, options = {}) - polymorphic_url(record_or_hash_or_array, options.merge(:routing_type => :path)) - end - - %w(edit new).each do |action| - module_eval <<-EOT, __FILE__, __LINE__ - def #{action}_polymorphic_url(record_or_hash, options = {}) # def edit_polymorphic_url(record_or_hash, options = {}) - polymorphic_url( # polymorphic_url( - record_or_hash, # record_or_hash, - options.merge(:action => "#{action}")) # options.merge(:action => "edit")) - end # end - # - def #{action}_polymorphic_path(record_or_hash, options = {}) # def edit_polymorphic_path(record_or_hash, options = {}) - polymorphic_url( # polymorphic_url( - record_or_hash, # record_or_hash, - options.merge(:action => "#{action}", :routing_type => :path)) # options.merge(:action => "edit", :routing_type => :path)) - end # end - EOT - end - - def formatted_polymorphic_url(record_or_hash, options = {}) - ActiveSupport::Deprecation.warn("formatted_polymorphic_url has been deprecated. Please pass :format to the polymorphic_url method instead", caller) - options[:format] = record_or_hash.pop if Array === record_or_hash - polymorphic_url(record_or_hash, options) - end - - def formatted_polymorphic_path(record_or_hash, options = {}) - ActiveSupport::Deprecation.warn("formatted_polymorphic_path has been deprecated. Please pass :format to the polymorphic_path method instead", caller) - options[:format] = record_or_hash.pop if record_or_hash === Array - polymorphic_url(record_or_hash, options.merge(:routing_type => :path)) - end - - private - def action_prefix(options) - options[:action] ? "#{options[:action]}_" : '' - end - - def routing_type(options) - options[:routing_type] || :url - end - - def build_named_route_call(records, namespace, inflection, options = {}) - unless records.is_a?(Array) - record = extract_record(records) - route = '' - else - record = records.pop - route = records.inject("") do |string, parent| - if parent.is_a?(Symbol) || parent.is_a?(String) - string << "#{parent}_" - else - string << "#{RecordIdentifier.__send__("plural_class_name", parent)}".singularize - string << "_" - end - end - end - - if record.is_a?(Symbol) || record.is_a?(String) - route << "#{record}_" - else - route << "#{RecordIdentifier.__send__("plural_class_name", record)}" - route = route.singularize if inflection == :singular - route << "_" - end - - action_prefix(options) + namespace + route + routing_type(options).to_s - end - - def extract_record(record_or_hash_or_array) - case record_or_hash_or_array - when Array; record_or_hash_or_array.last - when Hash; record_or_hash_or_array[:id] - else record_or_hash_or_array - end - end - - # Remove the first symbols from the array and return the url prefix - # implied by those symbols. - def extract_namespace(record_or_hash_or_array) - return "" unless record_or_hash_or_array.is_a?(Array) - - namespace_keys = [] - while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol) - namespace_keys << record_or_hash_or_array.shift - end - - namespace_keys.map {|k| "#{k}_"}.join - end - end -end diff --git a/actionpack/lib/action_controller/routing/generation/url_rewriter.rb b/actionpack/lib/action_controller/routing/generation/url_rewriter.rb deleted file mode 100644 index 52b66c9303..0000000000 --- a/actionpack/lib/action_controller/routing/generation/url_rewriter.rb +++ /dev/null @@ -1,204 +0,0 @@ -module ActionController - # In routes.rb one defines URL-to-controller mappings, but the reverse - # is also possible: an URL can be generated from one of your routing definitions. - # URL generation functionality is centralized in this module. - # - # See ActionController::Routing and ActionController::Resources for general - # information about routing and routes.rb. - # - # Tip: If you need to generate URLs from your models or some other place, - # then ActionController::UrlWriter is what you're looking for. Read on for - # an introduction. - # - # == URL generation from parameters - # - # As you may know, some functions - such as ActionController::Base#url_for - # and ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set - # of parameters. For example, you've probably had the chance to write code - # like this in one of your views: - # - # <%= link_to('Click here', :controller => 'users', - # :action => 'new', :message => 'Welcome!') %> - # - # #=> Generates a link to: /users/new?message=Welcome%21 - # - # link_to, and all other functions that require URL generation functionality, - # actually use ActionController::UrlWriter under the hood. And in particular, - # they use the ActionController::UrlWriter#url_for method. One can generate - # the same path as the above example by using the following code: - # - # include UrlWriter - # url_for(:controller => 'users', - # :action => 'new', - # :message => 'Welcome!', - # :only_path => true) - # # => "/users/new?message=Welcome%21" - # - # Notice the :only_path => true part. This is because UrlWriter has no - # information about the website hostname that your Rails app is serving. So if you - # want to include the hostname as well, then you must also pass the :host - # argument: - # - # include UrlWriter - # url_for(:controller => 'users', - # :action => 'new', - # :message => 'Welcome!', - # :host => 'www.example.com') # Changed this. - # # => "http://www.example.com/users/new?message=Welcome%21" - # - # By default, all controllers and views have access to a special version of url_for, - # that already knows what the current hostname is. So if you use url_for in your - # controllers or your views, then you don't need to explicitly pass the :host - # argument. - # - # For convenience reasons, mailers provide a shortcut for ActionController::UrlWriter#url_for. - # So within mailers, you only have to type 'url_for' instead of 'ActionController::UrlWriter#url_for' - # in full. However, mailers don't have hostname information, and what's why you'll still - # have to specify the :host argument when generating URLs in mailers. - # - # - # == URL generation for named routes - # - # UrlWriter also allows one to access methods that have been auto-generated from - # named routes. For example, suppose that you have a 'users' resource in your - # routes.rb: - # - # map.resources :users - # - # This generates, among other things, the method users_path. By default, - # this method is accessible from your controllers, views and mailers. If you need - # to access this auto-generated method from other places (such as a model), then - # you can do that by including ActionController::UrlWriter in your class: - # - # class User < ActiveRecord::Base - # include ActionController::UrlWriter - # - # def base_uri - # user_path(self) - # end - # end - # - # User.find(1).base_uri # => "/users/1" - module UrlWriter - def self.included(base) #:nodoc: - ActionController::Routing::Routes.install_helpers(base) - base.mattr_accessor :default_url_options - - # The default options for urls written by this writer. Typically a :host pair is provided. - base.default_url_options ||= {} - end - - # Generate a url based on the options provided, default_url_options and the - # routes defined in routes.rb. The following options are supported: - # - # * :only_path - If true, the relative url is returned. Defaults to +false+. - # * :protocol - The protocol to connect to. Defaults to 'http'. - # * :host - Specifies the host the link should be targeted at. - # If :only_path is false, this option must be - # provided either explicitly, or via +default_url_options+. - # * :port - Optionally specify the port to connect to. - # * :anchor - An anchor name to be appended to the path. - # * :skip_relative_url_root - If true, the url is not constructed using the - # +relative_url_root+ set in ActionController::Base.relative_url_root. - # * :trailing_slash - If true, adds a trailing slash, as in "/archive/2009/" - # - # Any other key (:controller, :action, etc.) given to - # +url_for+ is forwarded to the Routes module. - # - # Examples: - # - # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing' - # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok' - # url_for :controller => 'tasks', :action => 'testing', :trailing_slash=>true # => 'http://somehost.org/tasks/testing/' - # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33' - def url_for(options) - options = self.class.default_url_options.merge(options) - - url = '' - - unless options.delete(:only_path) - url << (options.delete(:protocol) || 'http') - url << '://' unless url.match("://") - - raise "Missing host to link to! Please provide :host parameter or set default_url_options[:host]" unless options[:host] - - url << options.delete(:host) - url << ":#{options.delete(:port)}" if options.key?(:port) - else - # Delete the unused options to prevent their appearance in the query string. - [:protocol, :host, :port, :skip_relative_url_root].each { |k| options.delete(k) } - end - trailing_slash = options.delete(:trailing_slash) if options.key?(:trailing_slash) - url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] - anchor = "##{CGI.escape options.delete(:anchor).to_param.to_s}" if options[:anchor] - generated = Routing::Routes.generate(options, {}) - url << (trailing_slash ? generated.sub(/\?|\z/) { "/" + $& } : generated) - url << anchor if anchor - - url - end - end - - # Rewrites URLs for Base.redirect_to and Base.url_for in the controller. - class UrlRewriter #:nodoc: - RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :skip_relative_url_root] - def initialize(request, parameters) - @request, @parameters = request, parameters - end - - def rewrite(options = {}) - rewrite_url(options) - end - - def to_str - "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}" - end - - alias_method :to_s, :to_str - - private - # Given a path and options, returns a rewritten URL string - def rewrite_url(options) - rewritten_url = "" - - unless options[:only_path] - rewritten_url << (options[:protocol] || @request.protocol) - rewritten_url << "://" unless rewritten_url.match("://") - rewritten_url << rewrite_authentication(options) - rewritten_url << (options[:host] || @request.host_with_port) - rewritten_url << ":#{options.delete(:port)}" if options.key?(:port) - end - - path = rewrite_path(options) - rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] - rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) - rewritten_url << "##{CGI.escape(options[:anchor].to_param.to_s)}" if options[:anchor] - - rewritten_url - end - - # Given a Hash of options, generates a route - def rewrite_path(options) - options = options.symbolize_keys - options.update(options[:params].symbolize_keys) if options[:params] - - if (overwrite = options.delete(:overwrite_params)) - options.update(@parameters.symbolize_keys) - options.update(overwrite.symbolize_keys) - end - - RESERVED_OPTIONS.each { |k| options.delete(k) } - - # Generates the query string, too - Routing::Routes.generate(options, @request.symbolized_path_parameters) - end - - def rewrite_authentication(options) - if options[:user] && options[:password] - "#{CGI.escape(options.delete(:user))}:#{CGI.escape(options.delete(:password))}@" - else - "" - end - end - end -end diff --git a/actionpack/lib/action_controller/routing/optimisations.rb b/actionpack/lib/action_controller/routing/optimisations.rb deleted file mode 100644 index 714cf97861..0000000000 --- a/actionpack/lib/action_controller/routing/optimisations.rb +++ /dev/null @@ -1,130 +0,0 @@ -module ActionController - module Routing - # Much of the slow performance from routes comes from the - # complexity of expiry, :requirements matching, defaults providing - # and figuring out which url pattern to use. With named routes - # we can avoid the expense of finding the right route. So if - # they've provided the right number of arguments, and have no - # :requirements, we can just build up a string and return it. - # - # To support building optimisations for other common cases, the - # generation code is separated into several classes - module Optimisation - def generate_optimisation_block(route, kind) - return "" unless route.optimise? - OPTIMISERS.inject("") do |memo, klazz| - memo << klazz.new(route, kind).source_code - memo - end - end - - class Optimiser - attr_reader :route, :kind - GLOBAL_GUARD_CONDITIONS = [ - "(!defined?(default_url_options) || default_url_options.blank?)", - "(!defined?(controller.default_url_options) || controller.default_url_options.blank?)", - "defined?(request)", - "request" - ] - - def initialize(route, kind) - @route = route - @kind = kind - end - - def guard_conditions - ["false"] - end - - def generation_code - 'nil' - end - - def source_code - if applicable? - guard_condition = (GLOBAL_GUARD_CONDITIONS + guard_conditions).join(" && ") - "return #{generation_code} if #{guard_condition}\n" - else - "\n" - end - end - - # Temporarily disabled :url optimisation pending proper solution to - # Issues around request.host etc. - def applicable? - true - end - end - - # Given a route - # - # map.person '/people/:id' - # - # If the user calls person_url(@person), we can simply - # return a string like "/people/#{@person.to_param}" - # rather than triggering the expensive logic in +url_for+. - class PositionalArguments < Optimiser - def guard_conditions - number_of_arguments = route.required_segment_keys.size - # if they're using foo_url(:id=>2) it's one - # argument, but we don't want to generate /foos/id2 - if number_of_arguments == 1 - ["args.size == 1", "!args.first.is_a?(Hash)"] - else - ["args.size == #{number_of_arguments}"] - end - end - - def generation_code - elements = [] - idx = 0 - - if kind == :url - elements << '#{request.protocol}' - elements << '#{request.host_with_port}' - end - - elements << '#{ActionController::Base.relative_url_root if ActionController::Base.relative_url_root}' - - # The last entry in route.segments appears to *always* be a - # 'divider segment' for '/' but we have assertions to ensure that - # we don't include the trailing slashes, so skip them. - (route.segments.size == 1 ? route.segments : route.segments[0..-2]).each do |segment| - if segment.is_a?(DynamicSegment) - elements << segment.interpolation_chunk("args[#{idx}].to_param") - idx += 1 - else - elements << segment.interpolation_chunk - end - end - %("#{elements * ''}") - end - end - - # This case is mostly the same as the positional arguments case - # above, but it supports additional query parameters as the last - # argument - class PositionalArgumentsWithAdditionalParams < PositionalArguments - def guard_conditions - ["args.size == #{route.segment_keys.size + 1}"] + - UrlRewriter::RESERVED_OPTIONS.collect{ |key| "!args.last.has_key?(:#{key})" } - end - - # This case uses almost the same code as positional arguments, - # but add a question mark and args.last.to_query on the end, - # unless the last arg is empty - def generation_code - super.insert(-2, '#{\'?\' + args.last.to_query unless args.last.empty?}') - end - - # To avoid generating "http://localhost/?host=foo.example.com" we - # can't use this optimisation on routes without any segments - def applicable? - super && route.segment_keys.size > 0 - end - end - - OPTIMISERS = [PositionalArguments, PositionalArgumentsWithAdditionalParams] - end - end -end diff --git a/actionpack/lib/action_controller/routing/polymorphic_routes.rb b/actionpack/lib/action_controller/routing/polymorphic_routes.rb new file mode 100644 index 0000000000..2adf3575a7 --- /dev/null +++ b/actionpack/lib/action_controller/routing/polymorphic_routes.rb @@ -0,0 +1,210 @@ +module ActionController + # Polymorphic URL helpers are methods for smart resolution to a named route call when + # given an Active Record model instance. They are to be used in combination with + # ActionController::Resources. + # + # These methods are useful when you want to generate correct URL or path to a RESTful + # resource without having to know the exact type of the record in question. + # + # Nested resources and/or namespaces are also supported, as illustrated in the example: + # + # polymorphic_url([:admin, @article, @comment]) + # + # results in: + # + # admin_article_comment_url(@article, @comment) + # + # == Usage within the framework + # + # Polymorphic URL helpers are used in a number of places throughout the Rails framework: + # + # * url_for, so you can use it with a record as the argument, e.g. + # url_for(@article); + # * ActionView::Helpers::FormHelper uses polymorphic_path, so you can write + # form_for(@article) without having to specify :url parameter for the form + # action; + # * redirect_to (which, in fact, uses url_for) so you can write + # redirect_to(post) in your controllers; + # * ActionView::Helpers::AtomFeedHelper, so you don't have to explicitly specify URLs + # for feed entries. + # + # == Prefixed polymorphic helpers + # + # In addition to polymorphic_url and polymorphic_path methods, a + # number of prefixed helpers are available as a shorthand to :action => "..." + # in options. Those are: + # + # * edit_polymorphic_url, edit_polymorphic_path + # * new_polymorphic_url, new_polymorphic_path + # + # Example usage: + # + # edit_polymorphic_path(@post) # => "/posts/1/edit" + # polymorphic_path(@post, :format => :pdf) # => "/posts/1.pdf" + module PolymorphicRoutes + # Constructs a call to a named RESTful route for the given record and returns the + # resulting URL string. For example: + # + # # calls post_url(post) + # polymorphic_url(post) # => "http://example.com/posts/1" + # polymorphic_url([blog, post]) # => "http://example.com/blogs/1/posts/1" + # polymorphic_url([:admin, blog, post]) # => "http://example.com/admin/blogs/1/posts/1" + # polymorphic_url([user, :blog, post]) # => "http://example.com/users/1/blog/posts/1" + # polymorphic_url(Comment) # => "http://example.com/comments" + # + # ==== Options + # + # * :action - Specifies the action prefix for the named route: + # :new or :edit. Default is no prefix. + # * :routing_type - Allowed values are :path or :url. + # Default is :url. + # + # ==== Examples + # + # # an Article record + # polymorphic_url(record) # same as article_url(record) + # + # # a Comment record + # polymorphic_url(record) # same as comment_url(record) + # + # # it recognizes new records and maps to the collection + # record = Comment.new + # polymorphic_url(record) # same as comments_url() + # + # # the class of a record will also map to the collection + # polymorphic_url(Comment) # same as comments_url() + # + def polymorphic_url(record_or_hash_or_array, options = {}) + if record_or_hash_or_array.kind_of?(Array) + record_or_hash_or_array = record_or_hash_or_array.compact + record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 + end + + record = extract_record(record_or_hash_or_array) + record = record.to_model if record.respond_to?(:to_model) + namespace = extract_namespace(record_or_hash_or_array) + + args = case record_or_hash_or_array + when Hash; [ record_or_hash_or_array ] + when Array; record_or_hash_or_array.dup + else [ record_or_hash_or_array ] + end + + inflection = if options[:action].to_s == "new" + args.pop + :singular + elsif (record.respond_to?(:new_record?) && record.new_record?) || + (record.respond_to?(:destroyed?) && record.destroyed?) + args.pop + :plural + elsif record.is_a?(Class) + args.pop + :plural + else + :singular + end + + args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} + + named_route = build_named_route_call(record_or_hash_or_array, namespace, inflection, options) + + url_options = options.except(:action, :routing_type) + unless url_options.empty? + args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options + end + + __send__(named_route, *args) + end + + # Returns the path component of a URL for the given record. It uses + # polymorphic_url with :routing_type => :path. + def polymorphic_path(record_or_hash_or_array, options = {}) + polymorphic_url(record_or_hash_or_array, options.merge(:routing_type => :path)) + end + + %w(edit new).each do |action| + module_eval <<-EOT, __FILE__, __LINE__ + def #{action}_polymorphic_url(record_or_hash, options = {}) # def edit_polymorphic_url(record_or_hash, options = {}) + polymorphic_url( # polymorphic_url( + record_or_hash, # record_or_hash, + options.merge(:action => "#{action}")) # options.merge(:action => "edit")) + end # end + # + def #{action}_polymorphic_path(record_or_hash, options = {}) # def edit_polymorphic_path(record_or_hash, options = {}) + polymorphic_url( # polymorphic_url( + record_or_hash, # record_or_hash, + options.merge(:action => "#{action}", :routing_type => :path)) # options.merge(:action => "edit", :routing_type => :path)) + end # end + EOT + end + + def formatted_polymorphic_url(record_or_hash, options = {}) + ActiveSupport::Deprecation.warn("formatted_polymorphic_url has been deprecated. Please pass :format to the polymorphic_url method instead", caller) + options[:format] = record_or_hash.pop if Array === record_or_hash + polymorphic_url(record_or_hash, options) + end + + def formatted_polymorphic_path(record_or_hash, options = {}) + ActiveSupport::Deprecation.warn("formatted_polymorphic_path has been deprecated. Please pass :format to the polymorphic_path method instead", caller) + options[:format] = record_or_hash.pop if record_or_hash === Array + polymorphic_url(record_or_hash, options.merge(:routing_type => :path)) + end + + private + def action_prefix(options) + options[:action] ? "#{options[:action]}_" : '' + end + + def routing_type(options) + options[:routing_type] || :url + end + + def build_named_route_call(records, namespace, inflection, options = {}) + unless records.is_a?(Array) + record = extract_record(records) + route = '' + else + record = records.pop + route = records.inject("") do |string, parent| + if parent.is_a?(Symbol) || parent.is_a?(String) + string << "#{parent}_" + else + string << "#{RecordIdentifier.__send__("plural_class_name", parent)}".singularize + string << "_" + end + end + end + + if record.is_a?(Symbol) || record.is_a?(String) + route << "#{record}_" + else + route << "#{RecordIdentifier.__send__("plural_class_name", record)}" + route = route.singularize if inflection == :singular + route << "_" + end + + action_prefix(options) + namespace + route + routing_type(options).to_s + end + + def extract_record(record_or_hash_or_array) + case record_or_hash_or_array + when Array; record_or_hash_or_array.last + when Hash; record_or_hash_or_array[:id] + else record_or_hash_or_array + end + end + + # Remove the first symbols from the array and return the url prefix + # implied by those symbols. + def extract_namespace(record_or_hash_or_array) + return "" unless record_or_hash_or_array.is_a?(Array) + + namespace_keys = [] + while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol) + namespace_keys << record_or_hash_or_array.shift + end + + namespace_keys.map {|k| "#{k}_"}.join + end + end +end diff --git a/actionpack/lib/action_controller/routing/recognition_optimisation.rb b/actionpack/lib/action_controller/routing/recognition_optimisation.rb deleted file mode 100644 index 9bfebff0c0..0000000000 --- a/actionpack/lib/action_controller/routing/recognition_optimisation.rb +++ /dev/null @@ -1,167 +0,0 @@ -module ActionController - module Routing - # BEFORE: 0.191446860631307 ms/url - # AFTER: 0.029847304022858 ms/url - # Speed up: 6.4 times - # - # Route recognition is slow due to one-by-one iterating over - # a whole routeset (each map.resources generates at least 14 routes) - # and matching weird regexps on each step. - # - # We optimize this by skipping all URI segments that 100% sure can't - # be matched, moving deeper in a tree of routes (where node == segment) - # until first possible match is accured. In such case, we start walking - # a flat list of routes, matching them with accurate matcher. - # So, first step: search a segment tree for the first relevant index. - # Second step: iterate routes starting with that index. - # - # How tree is walked? We can do a recursive tests, but it's smarter: - # We just create a tree of if-s and elsif-s matching segments. - # - # We have segments of 3 flavors: - # 1) nil (no segment, route finished) - # 2) const-dot-dynamic (like "/posts.:xml", "/preview.:size.jpg") - # 3) const (like "/posts", "/comments") - # 4) dynamic ("/:id", "file.:size.:extension") - # - # We split incoming string into segments and iterate over them. - # When segment is nil, we drop immediately, on a current node index. - # When segment is equal to some const, we step into branch. - # If none constants matched, we step into 'dynamic' branch (it's a last). - # If we can't match anything, we drop to last index on a level. - # - # Note: we maintain the original routes order, so we finish building - # steps on a first dynamic segment. - # - # - # Example. Given the routes: - # 0 /posts/ - # 1 /posts/:id - # 2 /posts/:id/comments - # 3 /posts/blah - # 4 /users/ - # 5 /users/:id - # 6 /users/:id/profile - # - # request_uri = /users/123 - # - # There will be only 4 iterations: - # 1) segm test for /posts prefix, skip all /posts/* routes - # 2) segm test for /users/ - # 3) segm test for /users/:id - # (jump to list index = 5) - # 4) full test for /users/:id => here we are! - class RouteSet - def recognize_path(path, environment={}) - result = recognize_optimized(path, environment) and return result - - # Route was not recognized. Try to find out why (maybe wrong verb). - allows = HTTP_METHODS.select { |verb| routes.find { |r| r.recognize(path, environment.merge(:method => verb)) } } - - if environment[:method] && !HTTP_METHODS.include?(environment[:method]) - raise NotImplemented.new(*allows) - elsif !allows.empty? - raise MethodNotAllowed.new(*allows) - else - raise RoutingError, "No route matches #{path.inspect} with #{environment.inspect}" - end - end - - def segment_tree(routes) - tree = [0] - - i = -1 - routes.each do |route| - i += 1 - # not fast, but runs only once - segments = to_plain_segments(route.segments.inject("") { |str,s| str << s.to_s }) - - node = tree - segments.each do |seg| - seg = :dynamic if seg && seg[0] == ?: - node << [seg, [i]] if node.empty? || node[node.size - 1][0] != seg - node = node[node.size - 1][1] - end - end - tree - end - - def generate_code(list, padding=' ', level = 0) - # a digit - return padding + "#{list[0]}\n" if list.size == 1 && !(Array === list[0]) - - body = padding + "(seg = segments[#{level}]; \n" - - i = 0 - was_nil = false - list.each do |item| - if Array === item - i += 1 - start = (i == 1) - tag, sub = item - if tag == :dynamic - body += padding + "#{start ? 'if' : 'elsif'} true\n" - body += generate_code(sub, padding + " ", level + 1) - break - elsif tag == nil && !was_nil - was_nil = true - body += padding + "#{start ? 'if' : 'elsif'} seg.nil?\n" - body += generate_code(sub, padding + " ", level + 1) - else - body += padding + "#{start ? 'if' : 'elsif'} seg == '#{tag}'\n" - body += generate_code(sub, padding + " ", level + 1) - end - end - end - body += padding + "else\n" - body += padding + " #{list[0]}\n" - body += padding + "end)\n" - body - end - - # this must be really fast - def to_plain_segments(str) - str = str.dup - str.sub!(/^\/+/,'') - str.sub!(/\/+$/,'') - segments = str.split(/\.[^\/]+\/+|\/+|\.[^\/]+\Z/) # cut off ".format" also - segments << nil - segments - end - - private - def write_recognize_optimized! - tree = segment_tree(routes) - body = generate_code(tree) - - remove_recognize_optimized! - - instance_eval %{ - def recognize_optimized(path, env) - segments = to_plain_segments(path) - index = #{body} - return nil unless index - while index < routes.size - result = routes[index].recognize(path, env) and return result - index += 1 - end - nil - end - }, '(recognize_optimized)', 1 - end - - def clear_recognize_optimized! - remove_recognize_optimized! - write_recognize_optimized! - end - - def remove_recognize_optimized! - if respond_to?(:recognize_optimized) - class << self - remove_method :recognize_optimized - end - end - end - end - end -end diff --git a/actionpack/lib/action_controller/routing/route.rb b/actionpack/lib/action_controller/routing/route.rb deleted file mode 100644 index eba05a3c5a..0000000000 --- a/actionpack/lib/action_controller/routing/route.rb +++ /dev/null @@ -1,267 +0,0 @@ -require 'active_support/core_ext/object/misc' - -module ActionController - module Routing - class Route #:nodoc: - attr_accessor :segments, :requirements, :conditions, :optimise - - def initialize(segments = [], requirements = {}, conditions = {}) - @segments = segments - @requirements = requirements - @conditions = conditions - - if !significant_keys.include?(:action) && !requirements[:action] - @requirements[:action] = "index" - @significant_keys << :action - end - - # Routes cannot use the current string interpolation method - # if there are user-supplied :requirements as the interpolation - # code won't raise RoutingErrors when generating - has_requirements = @segments.detect { |segment| segment.respond_to?(:regexp) && segment.regexp } - if has_requirements || @requirements.keys.to_set != Routing::ALLOWED_REQUIREMENTS_FOR_OPTIMISATION - @optimise = false - else - @optimise = true - end - end - - # Indicates whether the routes should be optimised with the string interpolation - # version of the named routes methods. - def optimise? - @optimise && ActionController::Base::optimise_named_routes - end - - def segment_keys - segments.collect do |segment| - segment.key if segment.respond_to? :key - end.compact - end - - def required_segment_keys - required_segments = segments.select {|seg| (!seg.optional? && !seg.is_a?(DividerSegment)) || seg.is_a?(PathSegment) } - required_segments.collect { |seg| seg.key if seg.respond_to?(:key)}.compact - end - - # Build a query string from the keys of the given hash. If +only_keys+ - # is given (as an array), only the keys indicated will be used to build - # the query string. The query string will correctly build array parameter - # values. - def build_query_string(hash, only_keys = nil) - elements = [] - - (only_keys || hash.keys).each do |key| - if value = hash[key] - elements << value.to_query(key) - end - end - - elements.empty? ? '' : "?#{elements.sort * '&'}" - end - - # A route's parameter shell contains parameter values that are not in the - # route's path, but should be placed in the recognized hash. - # - # For example, +{:controller => 'pages', :action => 'show'} is the shell for the route: - # - # map.connect '/page/:id', :controller => 'pages', :action => 'show', :id => /\d+/ - # - def parameter_shell - @parameter_shell ||= {}.tap do |shell| - requirements.each do |key, requirement| - shell[key] = requirement unless requirement.is_a? Regexp - end - end - end - - # Return an array containing all the keys that are used in this route. This - # includes keys that appear inside the path, and keys that have requirements - # placed upon them. - def significant_keys - @significant_keys ||= [].tap do |sk| - segments.each { |segment| sk << segment.key if segment.respond_to? :key } - sk.concat requirements.keys - sk.uniq! - end - end - - # Return a hash of key/value pairs representing the keys in the route that - # have defaults, or which are specified by non-regexp requirements. - def defaults - @defaults ||= {}.tap do |hash| - segments.each do |segment| - next unless segment.respond_to? :default - hash[segment.key] = segment.default unless segment.default.nil? - end - requirements.each do |key,req| - next if Regexp === req || req.nil? - hash[key] = req - end - end - end - - def matches_controller_and_action?(controller, action) - prepare_matching! - (@controller_requirement.nil? || @controller_requirement === controller) && - (@action_requirement.nil? || @action_requirement === action) - end - - def to_s - @to_s ||= begin - segs = segments.inject("") { |str,s| str << s.to_s } - "%-6s %-40s %s" % [(conditions[:method] || :any).to_s.upcase, segs, requirements.inspect] - end - end - - # TODO: Route should be prepared and frozen on initialize - def freeze - unless frozen? - write_generation! - write_recognition! - prepare_matching! - - parameter_shell - significant_keys - defaults - to_s - end - - super - end - - def generate(options, hash, expire_on = {}) - path, hash = generate_raw(options, hash, expire_on) - append_query_string(path, hash, extra_keys(options)) - end - - def generate_extras(options, hash, expire_on = {}) - path, hash = generate_raw(options, hash, expire_on) - [path, extra_keys(options)] - end - - private - def requirement_for(key) - return requirements[key] if requirements.key? key - segments.each do |segment| - return segment.regexp if segment.respond_to?(:key) && segment.key == key - end - nil - end - - # Write and compile a +generate+ method for this Route. - def write_generation! - # Build the main body of the generation - body = "expired = false\n#{generation_extraction}\n#{generation_structure}" - - # If we have conditions that must be tested first, nest the body inside an if - body = "if #{generation_requirements}\n#{body}\nend" if generation_requirements - args = "options, hash, expire_on = {}" - - # Nest the body inside of a def block, and then compile it. - raw_method = method_decl = "def generate_raw(#{args})\npath = begin\n#{body}\nend\n[path, hash]\nend" - instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})" - - # expire_on.keys == recall.keys; in other words, the keys in the expire_on hash - # are the same as the keys that were recalled from the previous request. Thus, - # we can use the expire_on.keys to determine which keys ought to be used to build - # the query string. (Never use keys from the recalled request when building the - # query string.) - - raw_method - end - - # Build several lines of code that extract values from the options hash. If any - # of the values are missing or rejected then a return will be executed. - def generation_extraction - segments.collect do |segment| - segment.extraction_code - end.compact * "\n" - end - - # Produce a condition expression that will check the requirements of this route - # upon generation. - def generation_requirements - requirement_conditions = requirements.collect do |key, req| - if req.is_a? Regexp - value_regexp = Regexp.new "\\A#{req.to_s}\\Z" - "hash[:#{key}] && #{value_regexp.inspect} =~ options[:#{key}]" - else - "hash[:#{key}] == #{req.inspect}" - end - end - requirement_conditions * ' && ' unless requirement_conditions.empty? - end - - def generation_structure - segments.last.string_structure segments[0..-2] - end - - # Write and compile a +recognize+ method for this Route. - def write_recognition! - # Create an if structure to extract the params from a match if it occurs. - body = "params = parameter_shell.dup\n#{recognition_extraction * "\n"}\nparams" - body = "if #{recognition_conditions.join(" && ")}\n#{body}\nend" - - # Build the method declaration and compile it - method_decl = "def recognize(path, env = {})\n#{body}\nend" - instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})" - method_decl - end - - # Plugins may override this method to add other conditions, like checks on - # host, subdomain, and so forth. Note that changes here only affect route - # recognition, not generation. - def recognition_conditions - result = ["(match = #{Regexp.new(recognition_pattern).inspect}.match(path))"] - result << "[conditions[:method]].flatten.include?(env[:method])" if conditions[:method] - result - end - - # Build the regular expression pattern that will match this route. - def recognition_pattern(wrap = true) - pattern = '' - segments.reverse_each do |segment| - pattern = segment.build_pattern pattern - end - wrap ? ("\\A" + pattern + "\\Z") : pattern - end - - # Write the code to extract the parameters from a matched route. - def recognition_extraction - next_capture = 1 - extraction = segments.collect do |segment| - x = segment.match_extraction(next_capture) - next_capture += segment.number_of_captures - x - end - extraction.compact - end - - # Generate the query string with any extra keys in the hash and append - # it to the given path, returning the new path. - def append_query_string(path, hash, query_keys = nil) - return nil unless path - query_keys ||= extra_keys(hash) - "#{path}#{build_query_string(hash, query_keys)}" - end - - # Determine which keys in the given hash are "extra". Extra keys are - # those that were not used to generate a particular route. The extra - # keys also do not include those recalled from the prior request, nor - # do they include any keys that were implied in the route (like a - # :controller that is required, but not explicitly used in the - # text of the route.) - def extra_keys(hash, recall = {}) - (hash || {}).keys.map { |k| k.to_sym } - (recall || {}).keys - significant_keys - end - - def prepare_matching! - unless defined? @matching_prepared - @controller_requirement = requirement_for(:controller) - @action_requirement = requirement_for(:action) - @matching_prepared = true - end - end - end - end -end diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb index 25fdbf480e..8135b5811e 100644 --- a/actionpack/lib/action_controller/routing/route_set.rb +++ b/actionpack/lib/action_controller/routing/route_set.rb @@ -1,6 +1,58 @@ +require 'rack/mount' +require 'forwardable' + module ActionController module Routing class RouteSet #:nodoc: + NotFound = lambda { |env| + raise RoutingError, "No route matches #{env[::Rack::Mount::Const::PATH_INFO].inspect} with #{env.inspect}" + } + + PARAMETERS_KEY = 'action_dispatch.request.path_parameters' + + class Dispatcher + def initialize(options = {}) + defaults = options[:defaults] + @glob_param = options.delete(:glob) + end + + def call(env) + params = env[PARAMETERS_KEY] + merge_default_action!(params) + split_glob_param!(params) if @glob_param + params.each { |key, value| params[key] = URI.unescape(value) if value.is_a?(String) } + + if env['action_controller.recognize'] + [200, {}, params] + else + controller = controller(params) + controller.action(params[:action]).call(env) + end + end + + private + def controller(params) + if params && params.has_key?(:controller) + controller = "#{params[:controller].camelize}Controller" + ActiveSupport::Inflector.constantize(controller) + end + end + + def merge_default_action!(params) + params[:action] ||= 'index' + end + + def split_glob_param!(params) + params[@glob_param] = params[@glob_param].split('/').map { |v| URI.unescape(v) } + end + end + + module RouteExtensions + def segment_keys + conditions[:path_info].names.compact.map { |key| key.to_sym } + end + end + # Mapper instances are used to build routes. The object passed to the draw # block in config/routes.rb is a Mapper instance. # @@ -63,7 +115,6 @@ module ActionController # named routes. class NamedRouteCollection #:nodoc: include Enumerable - include ActionController::Routing::Optimisation attr_reader :routes, :helpers def initialize @@ -175,8 +226,6 @@ module ActionController named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks def #{selector}(*args) # def users_url(*args) # - #{generate_optimisation_block(route, kind)} # #{generate_optimisation_block(route, kind)} - # opts = if args.empty? || Hash === args.first # opts = if args.empty? || Hash === args.first args.first || {} # args.first || {} else # else @@ -216,28 +265,18 @@ module ActionController clear! end - # Subclasses and plugins may override this method to specify a different - # RouteBuilder instance, so that other route DSL's can be created. - def builder - @builder ||= RouteBuilder.new - end - def draw clear! yield Mapper.new(self) + @set.add_route(NotFound) install_helpers + @set.freeze end def clear! routes.clear named_routes.clear - - @combined_regexp = nil - @routes_by_controller = nil - - # This will force routing/recognition_optimization.rb - # to refresh optimisations. - clear_recognize_optimized! + @set = ::Rack::Mount::RouteSet.new(:parameters_key => PARAMETERS_KEY) end def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false) @@ -257,7 +296,7 @@ module ActionController def configuration_file=(path) add_configuration_file(path) end - + # Deprecated accessor def configuration_file configuration_files @@ -296,29 +335,119 @@ module ActionController def routes_changed_at routes_changed_at = nil - + configuration_files.each do |config| config_changed_at = File.stat(config).mtime if routes_changed_at.nil? || config_changed_at > routes_changed_at - routes_changed_at = config_changed_at + routes_changed_at = config_changed_at end end - + routes_changed_at end def add_route(path, options = {}) - options.each { |k, v| options[k] = v.to_s if [:controller, :action].include?(k) && v.is_a?(Symbol) } - route = builder.build(path, options) + options = options.dup + + if conditions = options.delete(:conditions) + conditions = conditions.dup + method = [conditions.delete(:method)].flatten.compact + method.map! { |m| + m = m.to_s.upcase + + if m == "HEAD" + raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" + end + + unless HTTP_METHODS.include?(m.downcase.to_sym) + raise ArgumentError, "Invalid HTTP method specified in route conditions" + end + + m + } + + if method.length > 1 + method = Regexp.union(*method) + elsif method.length == 1 + method = method.first + else + method = nil + end + end + + path_prefix = options.delete(:path_prefix) + name_prefix = options.delete(:name_prefix) + namespace = options.delete(:namespace) + + name = options.delete(:_name) + name = "#{name_prefix}#{name}" if name_prefix + + requirements = options.delete(:requirements) || {} + defaults = options.delete(:defaults) || {} + options.each do |k, v| + if v.is_a?(Regexp) + if value = options.delete(k) + requirements[k.to_sym] = value + end + else + value = options.delete(k) + defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param + end + end + + requirements.each do |_, requirement| + if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} + raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" + end + if requirement.multiline? + raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" + end + end + + possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } + requirements[:controller] ||= Regexp.union(*possible_names) + + if defaults[:controller] + defaults[:action] ||= 'index' + defaults[:controller] = defaults[:controller].to_s + defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace + end + + if defaults[:action] + defaults[:action] = defaults[:action].to_s + end + + if path.is_a?(String) + path = "#{path_prefix}/#{path}" if path_prefix + path = path.gsub('.:format', '(.:format)') + path = optionalize_trailing_dynamic_segments(path, requirements, defaults) + glob = $1.to_sym if path =~ /\/\*(\w+)$/ + path = ::Rack::Mount::Utils.normalize_path(path) + path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) + + if glob && !defaults[glob].blank? + raise RoutingError, "paths cannot have non-empty default values" + end + end + + app = Dispatcher.new(:defaults => defaults, :glob => glob) + + conditions = {} + conditions[:request_method] = method if method + conditions[:path_info] = path if path + + route = @set.add_route(app, conditions, defaults, name) + route.extend(RouteExtensions) routes << route route end def add_named_route(name, path, options = {}) - # TODO - is options EVER used? - name = options[:name_prefix] + name.to_s if options[:name_prefix] - named_routes[name.to_sym] = add_route(path, options) + options[:_name] = name + route = add_route(path, options) + named_routes[route.name] = route + route end def options_as_params(options) @@ -356,24 +485,29 @@ module ActionController generate(options, recall, :generate_extras) end - def generate(options, recall = {}, method=:generate) - named_route_name = options.delete(:use_route) - generate_all = options.delete(:generate_all) - if named_route_name - named_route = named_routes[named_route_name] - options = named_route.parameter_shell.merge(options) - end + def generate(options, recall = {}, method = :generate) + options, recall = options.dup, recall.dup + named_route = options.delete(:use_route) options = options_as_params(options) expire_on = build_expiry(options, recall) - if options[:controller] - options[:controller] = options[:controller].to_s + recall[:action] ||= 'index' if options[:controller] || recall[:controller] + + if recall[:controller] && (!options.has_key?(:controller) || options[:controller] == recall[:controller]) + options[:controller] = recall.delete(:controller) + + if recall[:action] && (!options.has_key?(:action) || options[:action] == recall[:action]) + options[:action] = recall.delete(:action) + + if recall[:id] && (!options.has_key?(:id) || options[:id] == recall[:id]) + options[:id] = recall.delete(:id) + end + end end - # if the controller has changed, make sure it changes relative to the - # current controller module, if any. In other words, if we're currently - # on admin/get, and the new controller is 'set', the new controller - # should really be admin/set. + + options[:controller] = options[:controller].to_s if options[:controller] + if !named_route && expire_on[:controller] && options[:controller] && options[:controller][0] != ?/ old_parts = recall[:controller].split('/') new_parts = options[:controller].split('/') @@ -381,98 +515,75 @@ module ActionController options[:controller] = parts.join('/') end - # drop the leading '/' on the controller name options[:controller] = options[:controller][1..-1] if options[:controller] && options[:controller][0] == ?/ - merged = recall.merge(options) - if named_route - path = named_route.generate(options, merged, expire_on) - if path.nil? - raise_named_route_error(options, named_route, named_route_name) - else - return path - end + merged = options.merge(recall) + if options.has_key?(:action) && options[:action].nil? + options.delete(:action) + recall[:action] = 'index' + end + recall[:action] = options.delete(:action) if options[:action] == 'index' + + path = _uri(named_route, options, recall) + if path && method == :generate_extras + uri = URI(path) + extras = uri.query ? + Rack::Utils.parse_nested_query(uri.query).keys.map { |k| k.to_sym } : + [] + [uri.path, extras] + elsif path + path else - merged[:action] ||= 'index' - options[:action] ||= 'index' - - controller = merged[:controller] - action = merged[:action] - - raise RoutingError, "Need controller and action!" unless controller && action - - if generate_all - # Used by caching to expire all paths for a resource - return routes.collect do |route| - route.__send__(method, options, merged, expire_on) - end.compact - end - - # don't use the recalled keys when determining which routes to check - routes = routes_by_controller[controller][action][options.reject {|k,v| !v}.keys.sort_by { |x| x.object_id }] - - routes.each_with_index do |route, index| - results = route.__send__(method, options, merged, expire_on) - if results && (!results.is_a?(Array) || results.first) - return results - end - end + raise RoutingError, "No route matches #{options.inspect}" end - + rescue Rack::Mount::RoutingError raise RoutingError, "No route matches #{options.inspect}" end - # try to give a helpful error message when named route generation fails - def raise_named_route_error(options, named_route, named_route_name) - diff = named_route.requirements.diff(options) - unless diff.empty? - raise RoutingError, "#{named_route_name}_url failed to generate from #{options.inspect}, expected: #{named_route.requirements.inspect}, diff: #{named_route.requirements.diff(options).inspect}" + def call(env) + @set.call(env) + rescue ActionController::RoutingError => e + raise e if env['action_controller.rescue_error'] == false + + method, path = env['REQUEST_METHOD'].downcase.to_sym, env['PATH_INFO'] + + # Route was not recognized. Try to find out why (maybe wrong verb). + allows = HTTP_METHODS.select { |verb| + begin + recognize_path(path, {:method => verb}, false) + rescue ActionController::RoutingError + nil + end + } + + if !HTTP_METHODS.include?(method) + raise NotImplemented.new(*allows) + elsif !allows.empty? + raise MethodNotAllowed.new(*allows) else - required_segments = named_route.segments.select {|seg| (!seg.optional?) && (!seg.is_a?(DividerSegment)) } - required_keys_or_values = required_segments.map { |seg| seg.key rescue seg.value } # we want either the key or the value from the segment - raise RoutingError, "#{named_route_name}_url failed to generate from #{options.inspect} - you may have ambiguous routes, or you may need to supply additional parameters for this route. content_url has the following required parameters: #{required_keys_or_values.inspect} - are they all satisfied?" + raise e end end - def call(env) - request = ActionDispatch::Request.new(env) - app = Routing::Routes.recognize(request) - app.action(request.parameters[:action] || 'index').call(env) - end - def recognize(request) params = recognize_path(request.path, extract_request_environment(request)) request.path_parameters = params.with_indifferent_access "#{params[:controller].to_s.camelize}Controller".constantize end - def recognize_path(path, environment={}) - raise "Not optimized! Check that routing/recognition_optimisation overrides RouteSet#recognize_path." - end + def recognize_path(path, environment = {}, rescue_error = true) + method = (environment[:method] || "GET").to_s.upcase - def routes_by_controller - @routes_by_controller ||= Hash.new do |controller_hash, controller| - controller_hash[controller] = Hash.new do |action_hash, action| - action_hash[action] = Hash.new do |key_hash, keys| - key_hash[keys] = routes_for_controller_and_action_and_keys(controller, action, keys) - end - end + begin + env = Rack::MockRequest.env_for(path, {:method => method}) + rescue URI::InvalidURIError => e + raise RoutingError, e.message end - end - - def routes_for(options, merged, expire_on) - raise "Need controller and action!" unless controller && action - controller = merged[:controller] - merged = options if expire_on[:controller] - action = merged[:action] || 'index' - - routes_by_controller[controller][action][merged.keys][1] - end - def routes_for_controller_and_action_and_keys(controller, action, keys) - routes.select do |route| - route.matches_controller_and_action? controller, action - end + env['action_controller.recognize'] = true + env['action_controller.rescue_error'] = rescue_error + status, headers, body = call(env) + body end # Subclasses and plugins may override this method to extract further attributes @@ -480,6 +591,109 @@ module ActionController def extract_request_environment(request) { :method => request.method } end + + private + def _uri(named_route, params, recall) + params = URISegment.wrap_values(params) + recall = URISegment.wrap_values(recall) + + unless result = @set.generate(:path_info, named_route, params, recall) + return + end + + uri, params = result + params.each do |k, v| + if v._value + params[k] = v._value + else + params.delete(k) + end + end + + uri << "?#{Rack::Mount::Utils.build_nested_query(params)}" if uri && params.any? + uri + end + + class URISegment < Struct.new(:_value, :_escape) + EXCLUDED = [:controller] + + def self.wrap_values(hash) + hash.inject({}) { |h, (k, v)| + h[k] = new(v, !EXCLUDED.include?(k.to_sym)) + h + } + end + + extend Forwardable + def_delegators :_value, :==, :eql?, :hash + + def to_param + @to_param ||= begin + if _value.is_a?(Array) + _value.map { |v| _escaped(v) }.join('/') + else + _escaped(_value) + end + end + end + alias_method :to_s, :to_param + + private + def _escaped(value) + v = value.respond_to?(:to_param) ? value.to_param : value + _escape ? Rack::Mount::Utils.escape_uri(v) : v.to_s + end + end + + def optionalize_trailing_dynamic_segments(path, requirements, defaults) + path = (path =~ /^\//) ? path.dup : "/#{path}" + optional, segments = true, [] + + required_segments = requirements.keys + required_segments -= defaults.keys.compact + + old_segments = path.split('/') + old_segments.shift + length = old_segments.length + + old_segments.reverse.each_with_index do |segment, index| + required_segments.each do |required| + if segment =~ /#{required}/ + optional = false + break + end + end + + if optional + if segment == ":id" && segments.include?(":action") + optional = false + elsif segment == ":controller" || segment == ":action" || segment == ":id" + # Ignore + elsif !(segment =~ /^:\w+$/) && + !(segment =~ /^:\w+\(\.:format\)$/) + optional = false + elsif segment =~ /^:(\w+)$/ + if defaults.has_key?($1.to_sym) + defaults.delete($1.to_sym) + else + optional = false + end + end + end + + if optional && index < length - 1 + segments.unshift('(/', segment) + segments.push(')') + elsif optional + segments.unshift('/(', segment) + segments.push(')') + else + segments.unshift('/', segment) + end + end + + segments.join + end end end end diff --git a/actionpack/lib/action_controller/routing/routing_ext.rb b/actionpack/lib/action_controller/routing/routing_ext.rb deleted file mode 100644 index 5e5b22b6c2..0000000000 --- a/actionpack/lib/action_controller/routing/routing_ext.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'active_support/core_ext/object/conversions' -require 'active_support/core_ext/boolean/conversions' -require 'active_support/core_ext/nil/conversions' -require 'active_support/core_ext/regexp' diff --git a/actionpack/lib/action_controller/routing/segments.rb b/actionpack/lib/action_controller/routing/segments.rb deleted file mode 100644 index 2603855476..0000000000 --- a/actionpack/lib/action_controller/routing/segments.rb +++ /dev/null @@ -1,343 +0,0 @@ -module ActionController - module Routing - class Segment #:nodoc: - RESERVED_PCHAR = ':@&=+$,;%' - SAFE_PCHAR = "#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}" - if RUBY_VERSION >= '1.9' - UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false).freeze - else - UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false, 'N').freeze - end - - # TODO: Convert :is_optional accessor to read only - attr_accessor :is_optional - alias_method :optional?, :is_optional - - def initialize - @is_optional = false - end - - def number_of_captures - Regexp.new(regexp_chunk).number_of_captures - end - - def extraction_code - nil - end - - # Continue generating string for the prior segments. - def continue_string_structure(prior_segments) - if prior_segments.empty? - interpolation_statement(prior_segments) - else - new_priors = prior_segments[0..-2] - prior_segments.last.string_structure(new_priors) - end - end - - def interpolation_chunk - URI.escape(value, UNSAFE_PCHAR) - end - - # Return a string interpolation statement for this segment and those before it. - def interpolation_statement(prior_segments) - chunks = prior_segments.collect { |s| s.interpolation_chunk } - chunks << interpolation_chunk - "\"#{chunks * ''}\"#{all_optionals_available_condition(prior_segments)}" - end - - def string_structure(prior_segments) - optional? ? continue_string_structure(prior_segments) : interpolation_statement(prior_segments) - end - - # Return an if condition that is true if all the prior segments can be generated. - # If there are no optional segments before this one, then nil is returned. - def all_optionals_available_condition(prior_segments) - optional_locals = prior_segments.collect { |s| s.local_name if s.optional? && s.respond_to?(:local_name) }.compact - optional_locals.empty? ? nil : " if #{optional_locals * ' && '}" - end - - # Recognition - - def match_extraction(next_capture) - nil - end - - # Warning - - # Returns true if this segment is optional? because of a default. If so, then - # no warning will be emitted regarding this segment. - def optionality_implied? - false - end - end - - class StaticSegment < Segment #:nodoc: - attr_reader :value, :raw - alias_method :raw?, :raw - - def initialize(value = nil, options = {}) - super() - @value = value - @raw = options[:raw] if options.key?(:raw) - @is_optional = options[:optional] if options.key?(:optional) - end - - def interpolation_chunk - raw? ? value : super - end - - def regexp_chunk - chunk = Regexp.escape(value) - optional? ? Regexp.optionalize(chunk) : chunk - end - - def number_of_captures - 0 - end - - def build_pattern(pattern) - escaped = Regexp.escape(value) - if optional? && ! pattern.empty? - "(?:#{Regexp.optionalize escaped}\\Z|#{escaped}#{Regexp.unoptionalize pattern})" - elsif optional? - Regexp.optionalize escaped - else - escaped + pattern - end - end - - def to_s - value - end - end - - class DividerSegment < StaticSegment #:nodoc: - def initialize(value = nil, options = {}) - super(value, {:raw => true, :optional => true}.merge(options)) - end - - def optionality_implied? - true - end - end - - class DynamicSegment < Segment #:nodoc: - attr_reader :key - - # TODO: Convert these accessors to read only - attr_accessor :default, :regexp - - def initialize(key = nil, options = {}) - super() - @key = key - @default = options[:default] if options.key?(:default) - @regexp = options[:regexp] if options.key?(:regexp) - @is_optional = true if options[:optional] || options.key?(:default) - end - - def to_s - ":#{key}" - end - - # The local variable name that the value of this segment will be extracted to. - def local_name - "#{key}_value" - end - - def extract_value - "#{local_name} = hash[:#{key}] && hash[:#{key}].to_param #{"|| #{default.inspect}" if default}" - end - - def value_check - if default # Then we know it won't be nil - "#{value_regexp.inspect} =~ #{local_name}" if regexp - elsif optional? - # If we have a regexp check that the value is not given, or that it matches. - # If we have no regexp, return nil since we do not require a condition. - "#{local_name}.nil? || #{value_regexp.inspect} =~ #{local_name}" if regexp - else # Then it must be present, and if we have a regexp, it must match too. - "#{local_name} #{"&& #{value_regexp.inspect} =~ #{local_name}" if regexp}" - end - end - - def expiry_statement - "expired, hash = true, options if !expired && expire_on[:#{key}]" - end - - def extraction_code - s = extract_value - vc = value_check - s << "\nreturn [nil,nil] unless #{vc}" if vc - s << "\n#{expiry_statement}" - end - - def interpolation_chunk(value_code = local_name) - "\#{URI.escape(#{value_code}.to_s, ActionController::Routing::Segment::UNSAFE_PCHAR)}" - end - - def string_structure(prior_segments) - if optional? # We have a conditional to do... - # If we should not appear in the url, just write the code for the prior - # segments. This occurs if our value is the default value, or, if we are - # optional, if we have nil as our value. - "if #{local_name} == #{default.inspect}\n" + - continue_string_structure(prior_segments) + - "\nelse\n" + # Otherwise, write the code up to here - "#{interpolation_statement(prior_segments)}\nend" - else - interpolation_statement(prior_segments) - end - end - - def value_regexp - Regexp.new "\\A#{regexp.to_s}\\Z" if regexp - end - - def regexp_chunk - regexp ? regexp_string : default_regexp_chunk - end - - def regexp_string - regexp_has_modifiers? ? "(#{regexp.to_s})" : "(#{regexp.source})" - end - - def default_regexp_chunk - "([^#{Routing::SEPARATORS.join}]+)" - end - - def number_of_captures - regexp ? regexp.number_of_captures + 1 : 1 - end - - def build_pattern(pattern) - pattern = "#{regexp_chunk}#{pattern}" - optional? ? Regexp.optionalize(pattern) : pattern - end - - def match_extraction(next_capture) - # All non code-related keys (such as :id, :slug) are URI-unescaped as - # path parameters. - default_value = default ? default.inspect : nil - %[ - value = if (m = match[#{next_capture}]) - URI.unescape(m) - else - #{default_value} - end - params[:#{key}] = value if value - ] - end - - def optionality_implied? - [:action, :id].include? key - end - - def regexp_has_modifiers? - regexp.options & (Regexp::IGNORECASE | Regexp::EXTENDED) != 0 - end - end - - class ControllerSegment < DynamicSegment #:nodoc: - def regexp_chunk - possible_names = Routing.possible_controllers.collect { |name| Regexp.escape name } - "(?i-:(#{(regexp || Regexp.union(*possible_names)).source}))" - end - - # Don't URI.escape the controller name since it may contain slashes. - def interpolation_chunk(value_code = local_name) - "\#{#{value_code}.to_s}" - end - - # Make sure controller names like Admin/Content are correctly normalized to - # admin/content - def extract_value - "#{local_name} = (hash[:#{key}] #{"|| #{default.inspect}" if default}).downcase" - end - - def match_extraction(next_capture) - if default - "params[:#{key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{default}'" - else - "params[:#{key}] = match[#{next_capture}].downcase if match[#{next_capture}]" - end - end - end - - class PathSegment < DynamicSegment #:nodoc: - def interpolation_chunk(value_code = local_name) - "\#{#{value_code}}" - end - - def extract_value - "#{local_name} = hash[:#{key}] && Array(hash[:#{key}]).collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}" - end - - def default - '' - end - - def default=(path) - raise RoutingError, "paths cannot have non-empty default values" unless path.blank? - end - - def match_extraction(next_capture) - "params[:#{key}] = PathSegment::Result.new_escaped((match[#{next_capture}]#{" || " + default.inspect if default}).split('/'))#{" if match[" + next_capture + "]" if !default}" - end - - def default_regexp_chunk - "(.*)" - end - - def number_of_captures - regexp ? regexp.number_of_captures : 1 - end - - def optionality_implied? - true - end - - class Result < ::Array #:nodoc: - def to_s() join '/' end - def self.new_escaped(strings) - new strings.collect {|str| URI.unescape str} - end - end - end - - # The OptionalFormatSegment allows for any resource route to have an optional - # :format, which decreases the amount of routes created by 50%. - class OptionalFormatSegment < DynamicSegment - - def initialize(key = nil, options = {}) - super(:format, {:optional => true}.merge(options)) - end - - def interpolation_chunk - "." + super - end - - def regexp_chunk - '/|(\.[^/?\.]+)?' - end - - def to_s - '(.:format)?' - end - - def extract_value - "#{local_name} = options[:#{key}] && options[:#{key}].to_s.downcase" - end - - #the value should not include the period (.) - def match_extraction(next_capture) - %[ - if (m = match[#{next_capture}]) - params[:#{key}] = URI.unescape(m.from(1)) - end - ] - end - end - - end -end diff --git a/actionpack/lib/action_controller/routing/url_rewriter.rb b/actionpack/lib/action_controller/routing/url_rewriter.rb new file mode 100644 index 0000000000..52b66c9303 --- /dev/null +++ b/actionpack/lib/action_controller/routing/url_rewriter.rb @@ -0,0 +1,204 @@ +module ActionController + # In routes.rb one defines URL-to-controller mappings, but the reverse + # is also possible: an URL can be generated from one of your routing definitions. + # URL generation functionality is centralized in this module. + # + # See ActionController::Routing and ActionController::Resources for general + # information about routing and routes.rb. + # + # Tip: If you need to generate URLs from your models or some other place, + # then ActionController::UrlWriter is what you're looking for. Read on for + # an introduction. + # + # == URL generation from parameters + # + # As you may know, some functions - such as ActionController::Base#url_for + # and ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set + # of parameters. For example, you've probably had the chance to write code + # like this in one of your views: + # + # <%= link_to('Click here', :controller => 'users', + # :action => 'new', :message => 'Welcome!') %> + # + # #=> Generates a link to: /users/new?message=Welcome%21 + # + # link_to, and all other functions that require URL generation functionality, + # actually use ActionController::UrlWriter under the hood. And in particular, + # they use the ActionController::UrlWriter#url_for method. One can generate + # the same path as the above example by using the following code: + # + # include UrlWriter + # url_for(:controller => 'users', + # :action => 'new', + # :message => 'Welcome!', + # :only_path => true) + # # => "/users/new?message=Welcome%21" + # + # Notice the :only_path => true part. This is because UrlWriter has no + # information about the website hostname that your Rails app is serving. So if you + # want to include the hostname as well, then you must also pass the :host + # argument: + # + # include UrlWriter + # url_for(:controller => 'users', + # :action => 'new', + # :message => 'Welcome!', + # :host => 'www.example.com') # Changed this. + # # => "http://www.example.com/users/new?message=Welcome%21" + # + # By default, all controllers and views have access to a special version of url_for, + # that already knows what the current hostname is. So if you use url_for in your + # controllers or your views, then you don't need to explicitly pass the :host + # argument. + # + # For convenience reasons, mailers provide a shortcut for ActionController::UrlWriter#url_for. + # So within mailers, you only have to type 'url_for' instead of 'ActionController::UrlWriter#url_for' + # in full. However, mailers don't have hostname information, and what's why you'll still + # have to specify the :host argument when generating URLs in mailers. + # + # + # == URL generation for named routes + # + # UrlWriter also allows one to access methods that have been auto-generated from + # named routes. For example, suppose that you have a 'users' resource in your + # routes.rb: + # + # map.resources :users + # + # This generates, among other things, the method users_path. By default, + # this method is accessible from your controllers, views and mailers. If you need + # to access this auto-generated method from other places (such as a model), then + # you can do that by including ActionController::UrlWriter in your class: + # + # class User < ActiveRecord::Base + # include ActionController::UrlWriter + # + # def base_uri + # user_path(self) + # end + # end + # + # User.find(1).base_uri # => "/users/1" + module UrlWriter + def self.included(base) #:nodoc: + ActionController::Routing::Routes.install_helpers(base) + base.mattr_accessor :default_url_options + + # The default options for urls written by this writer. Typically a :host pair is provided. + base.default_url_options ||= {} + end + + # Generate a url based on the options provided, default_url_options and the + # routes defined in routes.rb. The following options are supported: + # + # * :only_path - If true, the relative url is returned. Defaults to +false+. + # * :protocol - The protocol to connect to. Defaults to 'http'. + # * :host - Specifies the host the link should be targeted at. + # If :only_path is false, this option must be + # provided either explicitly, or via +default_url_options+. + # * :port - Optionally specify the port to connect to. + # * :anchor - An anchor name to be appended to the path. + # * :skip_relative_url_root - If true, the url is not constructed using the + # +relative_url_root+ set in ActionController::Base.relative_url_root. + # * :trailing_slash - If true, adds a trailing slash, as in "/archive/2009/" + # + # Any other key (:controller, :action, etc.) given to + # +url_for+ is forwarded to the Routes module. + # + # Examples: + # + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing' + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok' + # url_for :controller => 'tasks', :action => 'testing', :trailing_slash=>true # => 'http://somehost.org/tasks/testing/' + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33' + def url_for(options) + options = self.class.default_url_options.merge(options) + + url = '' + + unless options.delete(:only_path) + url << (options.delete(:protocol) || 'http') + url << '://' unless url.match("://") + + raise "Missing host to link to! Please provide :host parameter or set default_url_options[:host]" unless options[:host] + + url << options.delete(:host) + url << ":#{options.delete(:port)}" if options.key?(:port) + else + # Delete the unused options to prevent their appearance in the query string. + [:protocol, :host, :port, :skip_relative_url_root].each { |k| options.delete(k) } + end + trailing_slash = options.delete(:trailing_slash) if options.key?(:trailing_slash) + url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] + anchor = "##{CGI.escape options.delete(:anchor).to_param.to_s}" if options[:anchor] + generated = Routing::Routes.generate(options, {}) + url << (trailing_slash ? generated.sub(/\?|\z/) { "/" + $& } : generated) + url << anchor if anchor + + url + end + end + + # Rewrites URLs for Base.redirect_to and Base.url_for in the controller. + class UrlRewriter #:nodoc: + RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :skip_relative_url_root] + def initialize(request, parameters) + @request, @parameters = request, parameters + end + + def rewrite(options = {}) + rewrite_url(options) + end + + def to_str + "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}" + end + + alias_method :to_s, :to_str + + private + # Given a path and options, returns a rewritten URL string + def rewrite_url(options) + rewritten_url = "" + + unless options[:only_path] + rewritten_url << (options[:protocol] || @request.protocol) + rewritten_url << "://" unless rewritten_url.match("://") + rewritten_url << rewrite_authentication(options) + rewritten_url << (options[:host] || @request.host_with_port) + rewritten_url << ":#{options.delete(:port)}" if options.key?(:port) + end + + path = rewrite_path(options) + rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] + rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) + rewritten_url << "##{CGI.escape(options[:anchor].to_param.to_s)}" if options[:anchor] + + rewritten_url + end + + # Given a Hash of options, generates a route + def rewrite_path(options) + options = options.symbolize_keys + options.update(options[:params].symbolize_keys) if options[:params] + + if (overwrite = options.delete(:overwrite_params)) + options.update(@parameters.symbolize_keys) + options.update(overwrite.symbolize_keys) + end + + RESERVED_OPTIONS.each { |k| options.delete(k) } + + # Generates the query string, too + Routing::Routes.generate(options, @request.symbolized_path_parameters) + end + + def rewrite_authentication(options) + if options[:user] && options[:password] + "#{CGI.escape(options.delete(:user))}:#{CGI.escape(options.delete(:password))}@" + else + "" + end + end + end +end diff --git a/actionpack/lib/action_controller/testing/test_case.rb b/actionpack/lib/action_controller/testing/test_case.rb index 178e3477a6..01a55fe930 100644 --- a/actionpack/lib/action_controller/testing/test_case.rb +++ b/actionpack/lib/action_controller/testing/test_case.rb @@ -10,6 +10,13 @@ module ActionController self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => ActiveSupport::SecureRandom.hex(16)) end + class Result < ::Array #:nodoc: + def to_s() join '/' end + def self.new_escaped(strings) + new strings.collect {|str| URI.unescape str} + end + end + def assign_parameters(controller_path, action, parameters = {}) parameters = parameters.symbolize_keys.merge(:controller => controller_path, :action => action) extra_keys = ActionController::Routing::Routes.extra_keys(parameters) @@ -18,7 +25,7 @@ module ActionController if value.is_a? Fixnum value = value.to_s elsif value.is_a? Array - value = ActionController::Routing::PathSegment::Result.new(value) + value = Result.new(value) end if extra_keys.include?(key.to_sym) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 67448e66b9..cbfc8267f2 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -11,14 +11,6 @@ end ROUTING = ActionController::Routing -class ROUTING::RouteBuilder - attr_reader :warn_output - - def warn(msg) - (@warn_output ||= []) << msg - end -end - # See RFC 3986, section 3.3 for allowed path characters. class UriReservedCharactersRoutingTest < Test::Unit::TestCase def setup @@ -1626,25 +1618,6 @@ class RouteSetTest < ActiveSupport::TestCase assert_equal '/pages/show/hello+world', default_route_set.generate(expected, expected) end - def test_parameter_shell - page_url = ROUTING::Route.new - page_url.requirements = {:controller => 'pages', :action => 'show', :id => /\d+/} - assert_equal({:controller => 'pages', :action => 'show'}, page_url.parameter_shell) - end - - def test_defaults - route = ROUTING::RouteBuilder.new.build '/users/:id.:format', :controller => "users", :action => "show", :format => "html" - assert_equal( - { :controller => "users", :action => "show", :format => "html" }, - route.defaults) - end - - def test_builder_complains_without_controller - assert_raise(ArgumentError) do - ROUTING::RouteBuilder.new.build '/contact', :contoller => "contact", :action => "index" - end - end - def test_build_empty_query_string assert_uri_equal '/foo', default_route_set.generate({:controller => 'foo'}) end diff --git a/activesupport/lib/active_support/core_ext/regexp.rb b/activesupport/lib/active_support/core_ext/regexp.rb index 95d06ee6ee..784145f5fb 100644 --- a/activesupport/lib/active_support/core_ext/regexp.rb +++ b/activesupport/lib/active_support/core_ext/regexp.rb @@ -1,27 +1,5 @@ class Regexp #:nodoc: - def number_of_captures - Regexp.new("|#{source}").match('').captures.length - end - def multiline? options & MULTILINE == MULTILINE end - - class << self - def optionalize(pattern) - return pattern if pattern == "" - - case unoptionalize(pattern) - when /\A(.|\(.*\))\Z/ then "#{pattern}?" - else "(?:#{pattern})?" - end - end - - def unoptionalize(pattern) - [/\A\(\?:(.*)\)\?\Z/, /\A(.|\(.*\))\?\Z/].each do |regexp| - return $1 if regexp =~ pattern - end - return pattern - end - end end diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb index cc3f07d5c5..68b089d5b4 100644 --- a/activesupport/test/core_ext/regexp_ext_test.rb +++ b/activesupport/test/core_ext/regexp_ext_test.rb @@ -2,28 +2,9 @@ require 'abstract_unit' require 'active_support/core_ext/regexp' class RegexpExtAccessTests < Test::Unit::TestCase - def test_number_of_captures - assert_equal 0, //.number_of_captures - assert_equal 1, /.(.)./.number_of_captures - assert_equal 2, /.(.).(?:.).(.)/.number_of_captures - assert_equal 3, /.((.).(?:.).(.))/.number_of_captures - end - def test_multiline assert_equal true, //m.multiline? assert_equal false, //.multiline? assert_equal false, /(?m:)/.multiline? end - - def test_optionalize - assert_equal "a?", Regexp.optionalize("a") - assert_equal "(?:foo)?", Regexp.optionalize("foo") - assert_equal "", Regexp.optionalize("") - end - - def test_unoptionalize - assert_equal "a", Regexp.unoptionalize("a?") - assert_equal "foo", Regexp.unoptionalize("(?:foo)?") - assert_equal "", Regexp.unoptionalize("") - end end -- cgit v1.2.3 From e994bf0c810925ccdbe08cff1774b2c0865e491d Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 09:27:06 -0500 Subject: Add rackmount to actionmailer gemspec --- actionmailer/Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/actionmailer/Gemfile b/actionmailer/Gemfile index 5dec362d57..430b32e8ca 100644 --- a/actionmailer/Gemfile +++ b/actionmailer/Gemfile @@ -4,6 +4,7 @@ sibling = "#{File.dirname(__FILE__)}/.." gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport" gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel" gem "actionpack", "3.0.pre", :vendored_at => "#{sibling}/actionpack" +gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" gem "mocha" #disable_system_gems -- cgit v1.2.3 From 80a3983b7b987ef11c8875c5c23707b4903cdf72 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 09:27:37 -0500 Subject: Add rackmount to railties gemspec --- railties/Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/railties/Gemfile b/railties/Gemfile index f7e7b3ffc0..c441d69ded 100644 --- a/railties/Gemfile +++ b/railties/Gemfile @@ -5,6 +5,7 @@ gem "mocha" gem "arel", :git => "git://github.com/rails/arel.git" gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0" +gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" gem "rack-test", "~> 0.5.0" %w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib| -- cgit v1.2.3 From fa1926ddaa7ad481c55b76d1f2c1952721b7b586 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 09:32:26 -0500 Subject: Exclude gem backtrace filter if rubygems is not loaded --- railties/lib/rails/backtrace_cleaner.rb | 4 ++-- railties/test/backtrace_cleaner_test.rb | 33 +++++++++++++++++---------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/railties/lib/rails/backtrace_cleaner.rb b/railties/lib/rails/backtrace_cleaner.rb index 2f5632c3e4..cd7dd0f80a 100644 --- a/railties/lib/rails/backtrace_cleaner.rb +++ b/railties/lib/rails/backtrace_cleaner.rb @@ -27,10 +27,10 @@ module Rails add_silencer { |line| RAILS_GEMS.any? { |gem| line =~ /^#{gem} / } } add_silencer { |line| line =~ %r(vendor/plugins/[^\/]+/lib) } end - - + private def add_gem_filters + return unless defined? Gem (Gem.path + [Gem.default_dir]).uniq.each do |path| # http://gist.github.com/30430 add_filter { |line| line.sub(/(#{path})\/gems\/([a-z]+)-([0-9.]+)\/(.*)/, '\2 (\3) \4')} diff --git a/railties/test/backtrace_cleaner_test.rb b/railties/test/backtrace_cleaner_test.rb index 64a47712b7..4e273852e0 100644 --- a/railties/test/backtrace_cleaner_test.rb +++ b/railties/test/backtrace_cleaner_test.rb @@ -29,25 +29,26 @@ else $stderr.puts 'No BacktraceFilter for minitest' end -class BacktraceCleanerVendorGemTest < ActiveSupport::TestCase - def setup - @cleaner = Rails::BacktraceCleaner.new - end - - test "should format installed gems correctly" do - @backtrace = [ "#{Gem.path[0]}/gems/nosuchgem-1.2.3/lib/foo.rb" ] - @result = @cleaner.clean(@backtrace) - assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0] - end +if defined? Gem + class BacktraceCleanerVendorGemTest < ActiveSupport::TestCase + def setup + @cleaner = Rails::BacktraceCleaner.new + end - test "should format installed gems not in Gem.default_dir correctly" do - @target_dir = Gem.path.detect { |p| p != Gem.default_dir } - # skip this test if default_dir is the only directory on Gem.path - if @target_dir - @backtrace = [ "#{@target_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ] + test "should format installed gems correctly" do + @backtrace = [ "#{Gem.path[0]}/gems/nosuchgem-1.2.3/lib/foo.rb" ] @result = @cleaner.clean(@backtrace) assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0] end - end + test "should format installed gems not in Gem.default_dir correctly" do + @target_dir = Gem.path.detect { |p| p != Gem.default_dir } + # skip this test if default_dir is the only directory on Gem.path + if @target_dir + @backtrace = [ "#{@target_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ] + @result = @cleaner.clean(@backtrace) + assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0] + end + end + end end -- cgit v1.2.3 From 3895e2ccb3fe7cfcf36794fe9c941dc1381a0cb7 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 09:52:59 -0500 Subject: Donate tests I wrote for rackmount rails integration --- actionpack/test/controller/routing_test.rb | 314 ++++++++++++++++++++- actionpack/test/lib/controller/fake_controllers.rb | 5 +- 2 files changed, 316 insertions(+), 3 deletions(-) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index cbfc8267f2..308e2a85b1 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -110,8 +110,6 @@ class LegacyRouteSetTests < Test::Unit::TestCase ActionController::Base.optimise_named_routes = true @rs = ::ActionController::Routing::RouteSet.new - - ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed) end def teardown @@ -1736,3 +1734,315 @@ class RouteLoadingTest < Test::Unit::TestCase ActionController::Routing::Routes end end + +class RackMountIntegrationTests < ActiveSupport::TestCase + Model = Struct.new(:to_param) + + Mapping = lambda { |map| + map.namespace :admin do |admin| + admin.resources :users + end + + map.namespace 'api' do |api| + api.root :controller => 'users' + end + + map.connect 'blog/:year/:month/:day', + :controller => 'posts', + :action => 'show_date', + :requirements => { :year => /(19|20)\d\d/, :month => /[01]?\d/, :day => /[0-3]?\d/}, + :day => nil, + :month => nil + + map.blog('archive/:year', :controller => 'archive', :action => 'index', + :defaults => { :year => nil }, + :requirements => { :year => /\d{4}/ } + ) + + map.resources :people + map.connect 'legacy/people', :controller => 'people', :action => 'index', :legacy => 'true' + + map.connect 'symbols', :controller => :symbols, :action => :show, :name => :as_symbol + map.connect 'id_default/:id', :controller => 'foo', :action => 'id_default', :id => 1 + map.connect 'get_or_post', :controller => 'foo', :action => 'get_or_post', :conditions => { :method => [:get, :post] } + map.connect 'optional/:optional', :controller => 'posts', :action => 'index' + map.project 'projects/:project_id', :controller => 'project' + map.connect 'clients', :controller => 'projects', :action => 'index' + + map.connect 'ignorecase/geocode/:postalcode', :controller => 'geocode', + :action => 'show', :postalcode => /hx\d\d-\d[a-z]{2}/i + map.geocode 'extended/geocode/:postalcode', :controller => 'geocode', + :action => 'show',:requirements => { + :postalcode => /# Postcode format + \d{5} #Prefix + (-\d{4})? #Suffix + /x + } + + map.connect '', :controller => 'news', :format => nil + map.connect 'news.:format', :controller => 'news' + + map.connect 'comment/:id/:action', :controller => 'comments', :action => 'show' + map.connect 'ws/:controller/:action/:id', :ws => true + map.connect 'account/:action', :controller => :account, :action => :subscription + map.connect 'pages/:page_id/:controller/:action/:id' + map.connect ':controller/ping', :action => 'ping' + map.connect ':controller/:action/:id' + } + + def setup + @routes = ActionController::Routing::RouteSet.new + @routes.draw(&Mapping) + end + + def test_add_route + @routes.clear! + + assert_raise(ActionController::RoutingError) do + @routes.draw do |map| + map.path 'file/*path', :controller => 'content', :action => 'show_file', :path => %w(fake default) + map.connect ':controller/:action/:id' + end + end + end + + def test_recognize_path + assert_equal({:controller => 'admin/users', :action => 'index'}, @routes.recognize_path('/admin/users', :method => :get)) + assert_equal({:controller => 'admin/users', :action => 'create'}, @routes.recognize_path('/admin/users', :method => :post)) + assert_equal({:controller => 'admin/users', :action => 'new'}, @routes.recognize_path('/admin/users/new', :method => :get)) + assert_equal({:controller => 'admin/users', :action => 'show', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :get)) + assert_equal({:controller => 'admin/users', :action => 'update', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :put)) + assert_equal({:controller => 'admin/users', :action => 'destroy', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :delete)) + assert_equal({:controller => 'admin/users', :action => 'edit', :id => '1'}, @routes.recognize_path('/admin/users/1/edit', :method => :get)) + + assert_equal({:controller => 'admin/posts', :action => 'index'}, @routes.recognize_path('/admin/posts', :method => :get)) + assert_equal({:controller => 'admin/posts', :action => 'new'}, @routes.recognize_path('/admin/posts/new', :method => :get)) + + assert_equal({:controller => 'api/users', :action => 'index'}, @routes.recognize_path('/api', :method => :get)) + assert_equal({:controller => 'api/users', :action => 'index'}, @routes.recognize_path('/api/', :method => :get)) + + assert_equal({:controller => 'posts', :action => 'show_date', :year => '2009'}, @routes.recognize_path('/blog/2009', :method => :get)) + assert_equal({:controller => 'posts', :action => 'show_date', :year => '2009', :month => '01'}, @routes.recognize_path('/blog/2009/01', :method => :get)) + assert_equal({:controller => 'posts', :action => 'show_date', :year => '2009', :month => '01', :day => '01'}, @routes.recognize_path('/blog/2009/01/01', :method => :get)) + assert_raise(ActionController::ActionControllerError) { @routes.recognize_path('/blog/123456789', :method => :get) } + + assert_equal({:controller => 'archive', :action => 'index', :year => '2010'}, @routes.recognize_path('/archive/2010')) + assert_equal({:controller => 'archive', :action => 'index'}, @routes.recognize_path('/archive')) + assert_raise(ActionController::ActionControllerError) { @routes.recognize_path('/archive/january') } + + assert_equal({:controller => 'people', :action => 'index'}, @routes.recognize_path('/people', :method => :get)) + assert_equal({:controller => 'people', :action => 'index', :format => 'xml'}, @routes.recognize_path('/people.xml', :method => :get)) + assert_equal({:controller => 'people', :action => 'create'}, @routes.recognize_path('/people', :method => :post)) + assert_equal({:controller => 'people', :action => 'new'}, @routes.recognize_path('/people/new', :method => :get)) + assert_equal({:controller => 'people', :action => 'show', :id => '1'}, @routes.recognize_path('/people/1', :method => :get)) + assert_equal({:controller => 'people', :action => 'show', :id => '1', :format => 'xml'}, @routes.recognize_path('/people/1.xml', :method => :get)) + assert_equal({:controller => 'people', :action => 'update', :id => '1'}, @routes.recognize_path('/people/1', :method => :put)) + assert_equal({:controller => 'people', :action => 'destroy', :id => '1'}, @routes.recognize_path('/people/1', :method => :delete)) + assert_equal({:controller => 'people', :action => 'edit', :id => '1'}, @routes.recognize_path('/people/1/edit', :method => :get)) + assert_equal({:controller => 'people', :action => 'edit', :id => '1', :format => 'xml'}, @routes.recognize_path('/people/1/edit.xml', :method => :get)) + + assert_equal({:controller => 'symbols', :action => 'show', :name => :as_symbol}, @routes.recognize_path('/symbols')) + assert_equal({:controller => 'foo', :action => 'id_default', :id => '1'}, @routes.recognize_path('/id_default/1')) + assert_equal({:controller => 'foo', :action => 'id_default', :id => '2'}, @routes.recognize_path('/id_default/2')) + assert_equal({:controller => 'foo', :action => 'id_default', :id => '1'}, @routes.recognize_path('/id_default')) + assert_equal({:controller => 'foo', :action => 'get_or_post'}, @routes.recognize_path('/get_or_post', :method => :get)) + assert_equal({:controller => 'foo', :action => 'get_or_post'}, @routes.recognize_path('/get_or_post', :method => :post)) + assert_raise(ActionController::ActionControllerError) { @routes.recognize_path('/get_or_post', :method => :put) } + assert_raise(ActionController::ActionControllerError) { @routes.recognize_path('/get_or_post', :method => :delete) } + + assert_equal({:controller => 'posts', :action => 'index', :optional => 'bar'}, @routes.recognize_path('/optional/bar')) + assert_raise(ActionController::ActionControllerError) { @routes.recognize_path('/optional') } + + assert_equal({:controller => 'posts', :action => 'show', :id => '1', :ws => true}, @routes.recognize_path('/ws/posts/show/1', :method => :get)) + assert_equal({:controller => 'posts', :action => 'list', :ws => true}, @routes.recognize_path('/ws/posts/list', :method => :get)) + assert_equal({:controller => 'posts', :action => 'index', :ws => true}, @routes.recognize_path('/ws/posts', :method => :get)) + + assert_equal({:controller => 'account', :action => 'subscription'}, @routes.recognize_path('/account', :method => :get)) + assert_equal({:controller => 'account', :action => 'subscription'}, @routes.recognize_path('/account/subscription', :method => :get)) + assert_equal({:controller => 'account', :action => 'billing'}, @routes.recognize_path('/account/billing', :method => :get)) + + assert_equal({:page_id => '1', :controller => 'notes', :action => 'index'}, @routes.recognize_path('/pages/1/notes', :method => :get)) + assert_equal({:page_id => '1', :controller => 'notes', :action => 'list'}, @routes.recognize_path('/pages/1/notes/list', :method => :get)) + assert_equal({:page_id => '1', :controller => 'notes', :action => 'show', :id => '2'}, @routes.recognize_path('/pages/1/notes/show/2', :method => :get)) + + assert_equal({:controller => 'posts', :action => 'ping'}, @routes.recognize_path('/posts/ping', :method => :get)) + assert_equal({:controller => 'posts', :action => 'index'}, @routes.recognize_path('/posts', :method => :get)) + assert_equal({:controller => 'posts', :action => 'index'}, @routes.recognize_path('/posts/index', :method => :get)) + assert_equal({:controller => 'posts', :action => 'show'}, @routes.recognize_path('/posts/show', :method => :get)) + assert_equal({:controller => 'posts', :action => 'show', :id => '1'}, @routes.recognize_path('/posts/show/1', :method => :get)) + assert_equal({:controller => 'posts', :action => 'create'}, @routes.recognize_path('/posts/create', :method => :post)) + + assert_equal({:controller => 'geocode', :action => 'show', :postalcode => 'hx12-1az'}, @routes.recognize_path('/ignorecase/geocode/hx12-1az')) + assert_equal({:controller => 'geocode', :action => 'show', :postalcode => 'hx12-1AZ'}, @routes.recognize_path('/ignorecase/geocode/hx12-1AZ')) + assert_equal({:controller => 'geocode', :action => 'show', :postalcode => '12345-1234'}, @routes.recognize_path('/extended/geocode/12345-1234')) + assert_equal({:controller => 'geocode', :action => 'show', :postalcode => '12345'}, @routes.recognize_path('/extended/geocode/12345')) + + assert_equal({:controller => 'news', :action => 'index', :format => nil}, @routes.recognize_path('/', :method => :get)) + assert_equal({:controller => 'news', :action => 'index', :format => 'rss'}, @routes.recognize_path('/news.rss', :method => :get)) + + assert_raise(ActionController::RoutingError) { @routes.recognize_path('/none', :method => :get) } + end + + def test_generate + assert_equal '/admin/users', @routes.generate(:use_route => 'admin_users') + assert_equal '/admin/users', @routes.generate(:controller => 'admin/users') + assert_equal '/admin/users', @routes.generate(:controller => 'admin/users', :action => 'index') + assert_equal '/admin/users', @routes.generate({:action => 'index'}, {:controller => 'admin/users'}) + assert_equal '/admin/users', @routes.generate({:controller => 'users', :action => 'index'}, {:controller => 'admin/accounts'}) + assert_equal '/people', @routes.generate({:controller => '/people', :action => 'index'}, {:controller => 'admin/accounts'}) + + assert_equal '/admin/posts', @routes.generate({:controller => 'admin/posts'}) + assert_equal '/admin/posts/new', @routes.generate({:controller => 'admin/posts', :action => 'new'}) + + assert_equal '/blog/2009', @routes.generate(:controller => 'posts', :action => 'show_date', :year => 2009) + assert_equal '/blog/2009/1', @routes.generate(:controller => 'posts', :action => 'show_date', :year => 2009, :month => 1) + assert_equal '/blog/2009/1/1', @routes.generate(:controller => 'posts', :action => 'show_date', :year => 2009, :month => 1, :day => 1) + + assert_equal '/archive/2010', @routes.generate(:controller => 'archive', :action => 'index', :year => '2010') + assert_equal '/archive', @routes.generate(:controller => 'archive', :action => 'index') + assert_equal '/archive?year=january', @routes.generate(:controller => 'archive', :action => 'index', :year => 'january') + + assert_equal '/people', @routes.generate(:use_route => 'people') + assert_equal '/people', @routes.generate(:use_route => 'people', :controller => 'people', :action => 'index') + assert_equal '/people.xml', @routes.generate(:use_route => 'people', :controller => 'people', :action => 'index', :format => 'xml') + assert_equal '/people', @routes.generate({:use_route => 'people', :controller => 'people', :action => 'index'}, {:controller => 'people', :action => 'index'}) + assert_equal '/people', @routes.generate(:controller => 'people') + assert_equal '/people', @routes.generate(:controller => 'people', :action => 'index') + assert_equal '/people', @routes.generate({:action => 'index'}, {:controller => 'people'}) + assert_equal '/people', @routes.generate({:action => 'index'}, {:controller => 'people', :action => 'show', :id => '1'}) + assert_equal '/people', @routes.generate({:controller => 'people', :action => 'index'}, {:controller => 'people', :action => 'show', :id => '1'}) + assert_equal '/people', @routes.generate({}, {:controller => 'people', :action => 'index'}) + assert_equal '/people/1', @routes.generate({:controller => 'people', :action => 'show'}, {:controller => 'people', :action => 'show', :id => '1'}) + assert_equal '/people/new', @routes.generate(:use_route => 'new_person') + assert_equal '/people/new', @routes.generate(:controller => 'people', :action => 'new') + assert_equal '/people/1', @routes.generate(:use_route => 'person', :id => '1') + assert_equal '/people/1', @routes.generate(:controller => 'people', :action => 'show', :id => '1') + assert_equal '/people/1.xml', @routes.generate(:controller => 'people', :action => 'show', :id => '1', :format => 'xml') + assert_equal '/people/1', @routes.generate(:controller => 'people', :action => 'show', :id => 1) + assert_equal '/people/1', @routes.generate(:controller => 'people', :action => 'show', :id => Model.new('1')) + assert_equal '/people/1', @routes.generate({:action => 'show', :id => '1'}, {:controller => 'people', :action => 'index'}) + assert_equal '/people/1', @routes.generate({:action => 'show', :id => 1}, {:controller => 'people', :action => 'show', :id => '1'}) + # assert_equal '/people', @routes.generate({:controller => 'people', :action => 'index'}, {:controller => 'people', :action => 'index', :id => '1'}) + assert_equal '/people', @routes.generate({:controller => 'people', :action => 'index'}, {:controller => 'people', :action => 'show', :id => '1'}) + assert_equal '/people/1', @routes.generate({}, {:controller => 'people', :action => 'show', :id => '1'}) + assert_equal '/people/1', @routes.generate({:controller => 'people', :action => 'show'}, {:controller => 'people', :action => 'index', :id => '1'}) + assert_equal '/people/1/edit', @routes.generate(:controller => 'people', :action => 'edit', :id => '1') + assert_equal '/people/1/edit.xml', @routes.generate(:controller => 'people', :action => 'edit', :id => '1', :format => 'xml') + assert_equal '/people/1/edit', @routes.generate(:use_route => 'edit_person', :id => '1') + assert_equal '/people/1?legacy=true', @routes.generate(:controller => 'people', :action => 'show', :id => '1', :legacy => 'true') + assert_equal '/people?legacy=true', @routes.generate(:controller => 'people', :action => 'index', :legacy => 'true') + + assert_equal '/id_default/2', @routes.generate(:controller => 'foo', :action => 'id_default', :id => '2') + assert_equal '/id_default', @routes.generate(:controller => 'foo', :action => 'id_default', :id => '1') + assert_equal '/id_default', @routes.generate(:controller => 'foo', :action => 'id_default', :id => 1) + assert_equal '/id_default', @routes.generate(:controller => 'foo', :action => 'id_default') + assert_equal '/optional/bar', @routes.generate(:controller => 'posts', :action => 'index', :optional => 'bar') + assert_equal '/posts', @routes.generate(:controller => 'posts', :action => 'index') + + assert_equal '/project', @routes.generate({:controller => 'project', :action => 'index'}) + assert_equal '/projects/1', @routes.generate({:controller => 'project', :action => 'index', :project_id => '1'}) + assert_equal '/projects/1', @routes.generate({:controller => 'project', :action => 'index'}, {:project_id => '1'}) + assert_raise(ActionController::RoutingError) { @routes.generate({:use_route => 'project', :controller => 'project', :action => 'index'}) } + assert_equal '/projects/1', @routes.generate({:use_route => 'project', :controller => 'project', :action => 'index', :project_id => '1'}) + assert_equal '/projects/1', @routes.generate({:use_route => 'project', :controller => 'project', :action => 'index'}, {:project_id => '1'}) + + assert_equal '/clients', @routes.generate(:controller => 'projects', :action => 'index') + assert_equal '/clients?project_id=1', @routes.generate(:controller => 'projects', :action => 'index', :project_id => '1') + assert_equal '/clients', @routes.generate({:controller => 'projects', :action => 'index'}, {:project_id => '1'}) + assert_equal '/clients', @routes.generate({:action => 'index'}, {:controller => 'projects', :action => 'index', :project_id => '1'}) + + assert_equal '/comment/20', @routes.generate({:id => 20}, {:controller => 'comments', :action => 'show'}) + assert_equal '/comment/20', @routes.generate(:controller => 'comments', :id => 20, :action => 'show') + assert_equal '/comments/boo', @routes.generate(:controller => 'comments', :action => 'boo') + + assert_equal '/ws/posts/show/1', @routes.generate(:controller => 'posts', :action => 'show', :id => '1', :ws => true) + assert_equal '/ws/posts', @routes.generate(:controller => 'posts', :action => 'index', :ws => true) + + assert_equal '/account', @routes.generate(:controller => 'account', :action => 'subscription') + assert_equal '/account/billing', @routes.generate(:controller => 'account', :action => 'billing') + + assert_equal '/pages/1/notes/show/1', @routes.generate(:page_id => '1', :controller => 'notes', :action => 'show', :id => '1') + assert_equal '/pages/1/notes/list', @routes.generate(:page_id => '1', :controller => 'notes', :action => 'list') + assert_equal '/pages/1/notes', @routes.generate(:page_id => '1', :controller => 'notes', :action => 'index') + assert_equal '/pages/1/notes', @routes.generate(:page_id => '1', :controller => 'notes') + assert_equal '/notes', @routes.generate(:page_id => nil, :controller => 'notes') + assert_equal '/notes', @routes.generate(:controller => 'notes') + assert_equal '/notes/print', @routes.generate(:controller => 'notes', :action => 'print') + assert_equal '/notes/print', @routes.generate({}, {:controller => 'notes', :action => 'print'}) + + assert_equal '/notes/index/1', @routes.generate({:controller => 'notes'}, {:controller => 'notes', :id => '1'}) + assert_equal '/notes/index/1', @routes.generate({:controller => 'notes'}, {:controller => 'notes', :id => '1', :foo => 'bar'}) + assert_equal '/notes/index/1', @routes.generate({:controller => 'notes'}, {:controller => 'notes', :id => '1'}) + assert_equal '/notes/index/1', @routes.generate({:action => 'index'}, {:controller => 'notes', :id => '1'}) + assert_equal '/notes/index/1', @routes.generate({}, {:controller => 'notes', :id => '1'}) + assert_equal '/notes/show/1', @routes.generate({}, {:controller => 'notes', :action => 'show', :id => '1'}) + assert_equal '/notes/index/1', @routes.generate({:controller => 'notes', :id => '1'}, {:foo => 'bar'}) + assert_equal '/posts', @routes.generate({:controller => 'posts'}, {:controller => 'notes', :action => 'show', :id => '1'}) + assert_equal '/notes/list', @routes.generate({:action => 'list'}, {:controller => 'notes', :action => 'show', :id => '1'}) + + assert_equal '/posts/ping', @routes.generate(:controller => 'posts', :action => 'ping') + assert_equal '/posts/show/1', @routes.generate(:controller => 'posts', :action => 'show', :id => '1') + assert_equal '/posts', @routes.generate(:controller => 'posts') + assert_equal '/posts', @routes.generate(:controller => 'posts', :action => 'index') + assert_equal '/posts', @routes.generate({:controller => 'posts'}, {:controller => 'posts', :action => 'index'}) + assert_equal '/posts/create', @routes.generate({:action => 'create'}, {:controller => 'posts'}) + assert_equal '/posts?foo=bar', @routes.generate(:controller => 'posts', :foo => 'bar') + assert_equal '/posts?foo%5B%5D=bar&foo%5B%5D=baz', @routes.generate(:controller => 'posts', :foo => ['bar', 'baz']) + assert_equal '/posts?page=2', @routes.generate(:controller => 'posts', :page => 2) + assert_equal '/posts?q%5Bfoo%5D%5Ba%5D=b', @routes.generate(:controller => 'posts', :q => { :foo => { :a => 'b'}}) + + assert_equal '/', @routes.generate(:controller => 'news', :action => 'index') + assert_equal '/', @routes.generate(:controller => 'news', :action => 'index', :format => nil) + assert_equal '/news.rss', @routes.generate(:controller => 'news', :action => 'index', :format => 'rss') + + + assert_raise(ActionController::RoutingError) { @routes.generate({:action => 'index'}) } + end + + def test_generate_extras + assert_equal ['/people', []], @routes.generate_extras(:controller => 'people') + assert_equal ['/people', [:foo]], @routes.generate_extras(:controller => 'people', :foo => 'bar') + assert_equal ['/people', []], @routes.generate_extras(:controller => 'people', :action => 'index') + assert_equal ['/people', [:foo]], @routes.generate_extras(:controller => 'people', :action => 'index', :foo => 'bar') + assert_equal ['/people/new', []], @routes.generate_extras(:controller => 'people', :action => 'new') + assert_equal ['/people/new', [:foo]], @routes.generate_extras(:controller => 'people', :action => 'new', :foo => 'bar') + assert_equal ['/people/1', []], @routes.generate_extras(:controller => 'people', :action => 'show', :id => '1') + assert_equal ['/people/1', [:bar, :foo]], sort_extras!(@routes.generate_extras(:controller => 'people', :action => 'show', :id => '1', :foo => '2', :bar => '3')) + assert_equal ['/people', [:person]], @routes.generate_extras(:controller => 'people', :action => 'create', :person => { :first_name => 'Josh', :last_name => 'Peek' }) + assert_equal ['/people', [:people]], @routes.generate_extras(:controller => 'people', :action => 'create', :people => ['Josh', 'Dave']) + + assert_equal ['/posts/show/1', []], @routes.generate_extras(:controller => 'posts', :action => 'show', :id => '1') + assert_equal ['/posts/show/1', [:bar, :foo]], sort_extras!(@routes.generate_extras(:controller => 'posts', :action => 'show', :id => '1', :foo => '2', :bar => '3')) + assert_equal ['/posts', []], @routes.generate_extras(:controller => 'posts', :action => 'index') + assert_equal ['/posts', [:foo]], @routes.generate_extras(:controller => 'posts', :action => 'index', :foo => 'bar') + end + + def test_extras + params = {:controller => 'people'} + assert_equal [], @routes.extra_keys(params) + assert_equal({:controller => 'people'}, params) + + params = {:controller => 'people', :foo => 'bar'} + assert_equal [:foo], @routes.extra_keys(params) + assert_equal({:controller => 'people', :foo => 'bar'}, params) + + params = {:controller => 'people', :action => 'create', :person => { :name => 'Josh'}} + assert_equal [:person], @routes.extra_keys(params) + assert_equal({:controller => 'people', :action => 'create', :person => { :name => 'Josh'}}, params) + end + + private + def sort_extras!(extras) + if extras.length == 2 + extras[1].sort! { |a, b| a.to_s <=> b.to_s } + end + extras + end + + def assert_raise(e) + result = yield + flunk "Did not raise #{e}, but returned #{result.inspect}" + rescue e + assert true + end +end diff --git a/actionpack/test/lib/controller/fake_controllers.rb b/actionpack/test/lib/controller/fake_controllers.rb index c993836a61..250327e6dc 100644 --- a/actionpack/test/lib/controller/fake_controllers.rb +++ b/actionpack/test/lib/controller/fake_controllers.rb @@ -5,9 +5,10 @@ class NotAController; end module Admin class << self; alias_method :const_available?, :const_defined?; end - class UserController < ActionController::Base; end class NewsFeedController < ActionController::Base; end + class PostsController < ActionController::Base; end class StuffController < ActionController::Base; end + class UserController < ActionController::Base; end end module Api @@ -25,7 +26,9 @@ class ElsewhereController < ActionController::Base; end class FooController < ActionController::Base; end class HiController < ActionController::Base; end class ImageController < ActionController::Base; end +class NotesController < ActionController::Base; end class PeopleController < ActionController::Base; end +class PostsController < ActionController::Base; end class SessionsController < ActionController::Base; end class StuffController < ActionController::Base; end class SubpathBooksController < ActionController::Base; end -- cgit v1.2.3 From a74022ecd3e078f55ed6049a96565119dc540ff5 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 10:14:46 -0500 Subject: Move Routing into AD --- actionpack/lib/action_controller.rb | 13 +- actionpack/lib/action_controller/deprecated.rb | 3 + .../lib/action_controller/polymorphic_routes.rb | 210 +++++++ actionpack/lib/action_controller/routing.rb | 381 ----------- .../routing/polymorphic_routes.rb | 210 ------- .../lib/action_controller/routing/resources.rb | 685 -------------------- .../lib/action_controller/routing/route_set.rb | 699 --------------------- .../lib/action_controller/routing/url_rewriter.rb | 204 ------ actionpack/lib/action_controller/url_rewriter.rb | 204 ++++++ actionpack/lib/action_dispatch.rb | 2 + actionpack/lib/action_dispatch/routing.rb | 381 +++++++++++ .../lib/action_dispatch/routing/resources.rb | 687 ++++++++++++++++++++ .../lib/action_dispatch/routing/route_set.rb | 699 +++++++++++++++++++++ actionpack/test/controller/resources_test.rb | 12 +- 14 files changed, 2197 insertions(+), 2193 deletions(-) create mode 100644 actionpack/lib/action_controller/polymorphic_routes.rb delete mode 100644 actionpack/lib/action_controller/routing.rb delete mode 100644 actionpack/lib/action_controller/routing/polymorphic_routes.rb delete mode 100644 actionpack/lib/action_controller/routing/resources.rb delete mode 100644 actionpack/lib/action_controller/routing/route_set.rb delete mode 100644 actionpack/lib/action_controller/routing/url_rewriter.rb create mode 100644 actionpack/lib/action_controller/url_rewriter.rb create mode 100644 actionpack/lib/action_dispatch/routing.rb create mode 100644 actionpack/lib/action_dispatch/routing/resources.rb create mode 100644 actionpack/lib/action_dispatch/routing/route_set.rb diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 809e5f2ad4..b5091f39f9 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -18,22 +18,21 @@ module ActionController autoload :Testing, "action_controller/metal/testing" autoload :UrlFor, "action_controller/metal/url_for" - # Ported modules - # require 'action_controller/routing' autoload :Caching, 'action_controller/caching' autoload :Dispatcher, 'action_controller/dispatch/dispatcher' autoload :Integration, 'action_controller/deprecated/integration_test' autoload :IntegrationTest, 'action_controller/deprecated/integration_test' autoload :MimeResponds, 'action_controller/metal/mime_responds' autoload :PerformanceTest, 'action_controller/deprecated/performance_test' - autoload :PolymorphicRoutes, 'action_controller/routing/polymorphic_routes' + autoload :PolymorphicRoutes, 'action_controller/polymorphic_routes' autoload :RecordIdentifier, 'action_controller/record_identifier' - autoload :Resources, 'action_controller/routing/resources' + autoload :Resources, 'action_controller/deprecated' + autoload :Routing, 'action_controller/deprecated' autoload :SessionManagement, 'action_controller/metal/session_management' autoload :TestCase, 'action_controller/testing/test_case' autoload :TestProcess, 'action_controller/testing/process' - autoload :UrlRewriter, 'action_controller/routing/url_rewriter' - autoload :UrlWriter, 'action_controller/routing/url_rewriter' + autoload :UrlRewriter, 'action_controller/url_rewriter' + autoload :UrlWriter, 'action_controller/url_rewriter' autoload :Verification, 'action_controller/metal/verification' autoload :Flash, 'action_controller/metal/flash' @@ -54,8 +53,6 @@ module ActionController autoload :RenderError, 'action_controller/metal/exceptions' autoload :SessionOverflowError, 'action_controller/metal/exceptions' autoload :UnknownHttpMethod, 'action_controller/metal/exceptions' - - autoload :Routing, 'action_controller/routing' end autoload :HTML, 'action_controller/vendor/html-scanner' diff --git a/actionpack/lib/action_controller/deprecated.rb b/actionpack/lib/action_controller/deprecated.rb index d98e9ac7bd..23fe6a4c3a 100644 --- a/actionpack/lib/action_controller/deprecated.rb +++ b/actionpack/lib/action_controller/deprecated.rb @@ -1,2 +1,5 @@ ActionController::AbstractRequest = ActionController::Request = ActionDispatch::Request ActionController::AbstractResponse = ActionController::Response = ActionDispatch::Response +ActionController::Routing = ActionDispatch::Routing +ActionDispatch::Resources = ActionDispatch::Routing::Resources +ActionController::Routing::Routes = ActionDispatch::Routing::RouteSet.new diff --git a/actionpack/lib/action_controller/polymorphic_routes.rb b/actionpack/lib/action_controller/polymorphic_routes.rb new file mode 100644 index 0000000000..2adf3575a7 --- /dev/null +++ b/actionpack/lib/action_controller/polymorphic_routes.rb @@ -0,0 +1,210 @@ +module ActionController + # Polymorphic URL helpers are methods for smart resolution to a named route call when + # given an Active Record model instance. They are to be used in combination with + # ActionController::Resources. + # + # These methods are useful when you want to generate correct URL or path to a RESTful + # resource without having to know the exact type of the record in question. + # + # Nested resources and/or namespaces are also supported, as illustrated in the example: + # + # polymorphic_url([:admin, @article, @comment]) + # + # results in: + # + # admin_article_comment_url(@article, @comment) + # + # == Usage within the framework + # + # Polymorphic URL helpers are used in a number of places throughout the Rails framework: + # + # * url_for, so you can use it with a record as the argument, e.g. + # url_for(@article); + # * ActionView::Helpers::FormHelper uses polymorphic_path, so you can write + # form_for(@article) without having to specify :url parameter for the form + # action; + # * redirect_to (which, in fact, uses url_for) so you can write + # redirect_to(post) in your controllers; + # * ActionView::Helpers::AtomFeedHelper, so you don't have to explicitly specify URLs + # for feed entries. + # + # == Prefixed polymorphic helpers + # + # In addition to polymorphic_url and polymorphic_path methods, a + # number of prefixed helpers are available as a shorthand to :action => "..." + # in options. Those are: + # + # * edit_polymorphic_url, edit_polymorphic_path + # * new_polymorphic_url, new_polymorphic_path + # + # Example usage: + # + # edit_polymorphic_path(@post) # => "/posts/1/edit" + # polymorphic_path(@post, :format => :pdf) # => "/posts/1.pdf" + module PolymorphicRoutes + # Constructs a call to a named RESTful route for the given record and returns the + # resulting URL string. For example: + # + # # calls post_url(post) + # polymorphic_url(post) # => "http://example.com/posts/1" + # polymorphic_url([blog, post]) # => "http://example.com/blogs/1/posts/1" + # polymorphic_url([:admin, blog, post]) # => "http://example.com/admin/blogs/1/posts/1" + # polymorphic_url([user, :blog, post]) # => "http://example.com/users/1/blog/posts/1" + # polymorphic_url(Comment) # => "http://example.com/comments" + # + # ==== Options + # + # * :action - Specifies the action prefix for the named route: + # :new or :edit. Default is no prefix. + # * :routing_type - Allowed values are :path or :url. + # Default is :url. + # + # ==== Examples + # + # # an Article record + # polymorphic_url(record) # same as article_url(record) + # + # # a Comment record + # polymorphic_url(record) # same as comment_url(record) + # + # # it recognizes new records and maps to the collection + # record = Comment.new + # polymorphic_url(record) # same as comments_url() + # + # # the class of a record will also map to the collection + # polymorphic_url(Comment) # same as comments_url() + # + def polymorphic_url(record_or_hash_or_array, options = {}) + if record_or_hash_or_array.kind_of?(Array) + record_or_hash_or_array = record_or_hash_or_array.compact + record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 + end + + record = extract_record(record_or_hash_or_array) + record = record.to_model if record.respond_to?(:to_model) + namespace = extract_namespace(record_or_hash_or_array) + + args = case record_or_hash_or_array + when Hash; [ record_or_hash_or_array ] + when Array; record_or_hash_or_array.dup + else [ record_or_hash_or_array ] + end + + inflection = if options[:action].to_s == "new" + args.pop + :singular + elsif (record.respond_to?(:new_record?) && record.new_record?) || + (record.respond_to?(:destroyed?) && record.destroyed?) + args.pop + :plural + elsif record.is_a?(Class) + args.pop + :plural + else + :singular + end + + args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} + + named_route = build_named_route_call(record_or_hash_or_array, namespace, inflection, options) + + url_options = options.except(:action, :routing_type) + unless url_options.empty? + args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options + end + + __send__(named_route, *args) + end + + # Returns the path component of a URL for the given record. It uses + # polymorphic_url with :routing_type => :path. + def polymorphic_path(record_or_hash_or_array, options = {}) + polymorphic_url(record_or_hash_or_array, options.merge(:routing_type => :path)) + end + + %w(edit new).each do |action| + module_eval <<-EOT, __FILE__, __LINE__ + def #{action}_polymorphic_url(record_or_hash, options = {}) # def edit_polymorphic_url(record_or_hash, options = {}) + polymorphic_url( # polymorphic_url( + record_or_hash, # record_or_hash, + options.merge(:action => "#{action}")) # options.merge(:action => "edit")) + end # end + # + def #{action}_polymorphic_path(record_or_hash, options = {}) # def edit_polymorphic_path(record_or_hash, options = {}) + polymorphic_url( # polymorphic_url( + record_or_hash, # record_or_hash, + options.merge(:action => "#{action}", :routing_type => :path)) # options.merge(:action => "edit", :routing_type => :path)) + end # end + EOT + end + + def formatted_polymorphic_url(record_or_hash, options = {}) + ActiveSupport::Deprecation.warn("formatted_polymorphic_url has been deprecated. Please pass :format to the polymorphic_url method instead", caller) + options[:format] = record_or_hash.pop if Array === record_or_hash + polymorphic_url(record_or_hash, options) + end + + def formatted_polymorphic_path(record_or_hash, options = {}) + ActiveSupport::Deprecation.warn("formatted_polymorphic_path has been deprecated. Please pass :format to the polymorphic_path method instead", caller) + options[:format] = record_or_hash.pop if record_or_hash === Array + polymorphic_url(record_or_hash, options.merge(:routing_type => :path)) + end + + private + def action_prefix(options) + options[:action] ? "#{options[:action]}_" : '' + end + + def routing_type(options) + options[:routing_type] || :url + end + + def build_named_route_call(records, namespace, inflection, options = {}) + unless records.is_a?(Array) + record = extract_record(records) + route = '' + else + record = records.pop + route = records.inject("") do |string, parent| + if parent.is_a?(Symbol) || parent.is_a?(String) + string << "#{parent}_" + else + string << "#{RecordIdentifier.__send__("plural_class_name", parent)}".singularize + string << "_" + end + end + end + + if record.is_a?(Symbol) || record.is_a?(String) + route << "#{record}_" + else + route << "#{RecordIdentifier.__send__("plural_class_name", record)}" + route = route.singularize if inflection == :singular + route << "_" + end + + action_prefix(options) + namespace + route + routing_type(options).to_s + end + + def extract_record(record_or_hash_or_array) + case record_or_hash_or_array + when Array; record_or_hash_or_array.last + when Hash; record_or_hash_or_array[:id] + else record_or_hash_or_array + end + end + + # Remove the first symbols from the array and return the url prefix + # implied by those symbols. + def extract_namespace(record_or_hash_or_array) + return "" unless record_or_hash_or_array.is_a?(Array) + + namespace_keys = [] + while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol) + namespace_keys << record_or_hash_or_array.shift + end + + namespace_keys.map {|k| "#{k}_"}.join + end + end +end diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb deleted file mode 100644 index 979a4ad8c9..0000000000 --- a/actionpack/lib/action_controller/routing.rb +++ /dev/null @@ -1,381 +0,0 @@ -require 'active_support/core_ext/object/conversions' -require 'active_support/core_ext/boolean/conversions' -require 'active_support/core_ext/nil/conversions' -require 'active_support/core_ext/regexp' -require 'action_controller/routing/route_set' - -module ActionController - # == Routing - # - # The routing module provides URL rewriting in native Ruby. It's a way to - # redirect incoming requests to controllers and actions. This replaces - # mod_rewrite rules. Best of all, Rails' Routing works with any web server. - # Routes are defined in config/routes.rb. - # - # Consider the following route, installed by Rails when you generate your - # application: - # - # map.connect ':controller/:action/:id' - # - # This route states that it expects requests to consist of a - # :controller followed by an :action that in turn is fed - # some :id. - # - # Suppose you get an incoming request for /blog/edit/22, you'll end up - # with: - # - # params = { :controller => 'blog', - # :action => 'edit', - # :id => '22' - # } - # - # Think of creating routes as drawing a map for your requests. The map tells - # them where to go based on some predefined pattern: - # - # ActionController::Routing::Routes.draw do |map| - # Pattern 1 tells some request to go to one place - # Pattern 2 tell them to go to another - # ... - # end - # - # The following symbols are special: - # - # :controller maps to your controller name - # :action maps to an action with your controllers - # - # Other names simply map to a parameter as in the case of :id. - # - # == Route priority - # - # Not all routes are created equally. Routes have priority defined by the - # order of appearance of the routes in the config/routes.rb file. The priority goes - # from top to bottom. The last route in that file is at the lowest priority - # and will be applied last. If no route matches, 404 is returned. - # - # Within blocks, the empty pattern is at the highest priority. - # In practice this works out nicely: - # - # ActionController::Routing::Routes.draw do |map| - # map.with_options :controller => 'blog' do |blog| - # blog.show '', :action => 'list' - # end - # map.connect ':controller/:action/:view' - # end - # - # In this case, invoking blog controller (with an URL like '/blog/') - # without parameters will activate the 'list' action by default. - # - # == Defaults routes and default parameters - # - # Setting a default route is straightforward in Rails - you simply append a - # Hash at the end of your mapping to set any default parameters. - # - # Example: - # - # ActionController::Routing:Routes.draw do |map| - # map.connect ':controller/:action/:id', :controller => 'blog' - # end - # - # This sets up +blog+ as the default controller if no other is specified. - # This means visiting '/' would invoke the blog controller. - # - # More formally, you can include arbitrary parameters in the route, thus: - # - # map.connect ':controller/:action/:id', :action => 'show', :page => 'Dashboard' - # - # This will pass the :page parameter to all incoming requests that match this route. - # - # Note: The default routes, as provided by the Rails generator, make all actions in every - # controller accessible via GET requests. You should consider removing them or commenting - # them out if you're using named routes and resources. - # - # == Named routes - # - # Routes can be named with the syntax map.name_of_route options, - # allowing for easy reference within your source as +name_of_route_url+ - # for the full URL and +name_of_route_path+ for the URI path. - # - # Example: - # - # # In routes.rb - # map.login 'login', :controller => 'accounts', :action => 'login' - # - # # With render, redirect_to, tests, etc. - # redirect_to login_url - # - # Arguments can be passed as well. - # - # redirect_to show_item_path(:id => 25) - # - # Use map.root as a shorthand to name a route for the root path "". - # - # # In routes.rb - # map.root :controller => 'blogs' - # - # # would recognize http://www.example.com/ as - # params = { :controller => 'blogs', :action => 'index' } - # - # # and provide these named routes - # root_url # => 'http://www.example.com/' - # root_path # => '' - # - # You can also specify an already-defined named route in your map.root call: - # - # # In routes.rb - # map.new_session :controller => 'sessions', :action => 'new' - # map.root :new_session - # - # Note: when using +with_options+, the route is simply named after the - # method you call on the block parameter rather than map. - # - # # In routes.rb - # map.with_options :controller => 'blog' do |blog| - # blog.show '', :action => 'list' - # blog.delete 'delete/:id', :action => 'delete' - # blog.edit 'edit/:id', :action => 'edit' - # end - # - # # provides named routes for show, delete, and edit - # link_to @article.title, show_path(:id => @article.id) - # - # == Pretty URLs - # - # Routes can generate pretty URLs. For example: - # - # map.connect 'articles/:year/:month/:day', - # :controller => 'articles', - # :action => 'find_by_date', - # :year => /\d{4}/, - # :month => /\d{1,2}/, - # :day => /\d{1,2}/ - # - # Using the route above, the URL "http://localhost:3000/articles/2005/11/06" - # maps to - # - # params = {:year => '2005', :month => '11', :day => '06'} - # - # == Regular Expressions and parameters - # You can specify a regular expression to define a format for a parameter. - # - # map.geocode 'geocode/:postalcode', :controller => 'geocode', - # :action => 'show', :postalcode => /\d{5}(-\d{4})?/ - # - # or, more formally: - # - # map.geocode 'geocode/:postalcode', :controller => 'geocode', - # :action => 'show', :requirements => { :postalcode => /\d{5}(-\d{4})?/ } - # - # Formats can include the 'ignorecase' and 'extended syntax' regular - # expression modifiers: - # - # map.geocode 'geocode/:postalcode', :controller => 'geocode', - # :action => 'show', :postalcode => /hx\d\d\s\d[a-z]{2}/i - # - # map.geocode 'geocode/:postalcode', :controller => 'geocode', - # :action => 'show',:requirements => { - # :postalcode => /# Postcode format - # \d{5} #Prefix - # (-\d{4})? #Suffix - # /x - # } - # - # Using the multiline match modifier will raise an ArgumentError. - # Encoding regular expression modifiers are silently ignored. The - # match will always use the default encoding or ASCII. - # - # == Route globbing - # - # Specifying *[string] as part of a rule like: - # - # map.connect '*path' , :controller => 'blog' , :action => 'unrecognized?' - # - # will glob all remaining parts of the route that were not recognized earlier. - # The globbed values are in params[:path] as an array of path segments. - # - # == Route conditions - # - # With conditions you can define restrictions on routes. Currently the only valid condition is :method. - # - # * :method - Allows you to specify which method can access the route. Possible values are :post, - # :get, :put, :delete and :any. The default value is :any, - # :any means that any method can access the route. - # - # Example: - # - # map.connect 'post/:id', :controller => 'posts', :action => 'show', - # :conditions => { :method => :get } - # map.connect 'post/:id', :controller => 'posts', :action => 'create_comment', - # :conditions => { :method => :post } - # - # Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same - # URL will route to the show action. - # - # == Reloading routes - # - # You can reload routes if you feel you must: - # - # ActionController::Routing::Routes.reload - # - # This will clear all named routes and reload routes.rb if the file has been modified from - # last load. To absolutely force reloading, use reload!. - # - # == Testing Routes - # - # The two main methods for testing your routes: - # - # === +assert_routing+ - # - # def test_movie_route_properly_splits - # opts = {:controller => "plugin", :action => "checkout", :id => "2"} - # assert_routing "plugin/checkout/2", opts - # end - # - # +assert_routing+ lets you test whether or not the route properly resolves into options. - # - # === +assert_recognizes+ - # - # def test_route_has_options - # opts = {:controller => "plugin", :action => "show", :id => "12"} - # assert_recognizes opts, "/plugins/show/12" - # end - # - # Note the subtle difference between the two: +assert_routing+ tests that - # a URL fits options while +assert_recognizes+ tests that a URL - # breaks into parameters properly. - # - # In tests you can simply pass the URL or named route to +get+ or +post+. - # - # def send_to_jail - # get '/jail' - # assert_response :success - # assert_template "jail/front" - # end - # - # def goes_to_login - # get login_url - # #... - # end - # - # == View a list of all your routes - # - # Run rake routes. - # - module Routing - SEPARATORS = %w( / . ? ) - - HTTP_METHODS = [:get, :head, :post, :put, :delete, :options] - - ALLOWED_REQUIREMENTS_FOR_OPTIMISATION = [:controller, :action].to_set - - # The root paths which may contain controller files - mattr_accessor :controller_paths - self.controller_paths = [] - - # A helper module to hold URL related helpers. - module Helpers - include PolymorphicRoutes - end - - class << self - # Expects an array of controller names as the first argument. - # Executes the passed block with only the named controllers named available. - # This method is used in internal Rails testing. - def with_controllers(names) - prior_controllers = @possible_controllers - use_controllers! names - yield - ensure - use_controllers! prior_controllers - end - - # Returns an array of paths, cleaned of double-slashes and relative path references. - # * "\\\" and "//" become "\\" or "/". - # * "/foo/bar/../config" becomes "/foo/config". - # The returned array is sorted by length, descending. - def normalize_paths(paths) - # do the hokey-pokey of path normalization... - paths = paths.collect do |path| - path = path. - gsub("//", "/"). # replace double / chars with a single - gsub("\\\\", "\\"). # replace double \ chars with a single - gsub(%r{(.)[\\/]$}, '\1') # drop final / or \ if path ends with it - - # eliminate .. paths where possible - re = %r{[^/\\]+[/\\]\.\.[/\\]} - path.gsub!(re, "") while path.match(re) - path - end - - # start with longest path, first - paths = paths.uniq.sort_by { |path| - path.length } - end - - # Returns the array of controller names currently available to ActionController::Routing. - def possible_controllers - unless @possible_controllers - @possible_controllers = [] - - paths = controller_paths.select { |path| File.directory?(path) && path != "." } - - seen_paths = Hash.new {|h, k| h[k] = true; false} - normalize_paths(paths).each do |load_path| - Dir["#{load_path}/**/*_controller.rb"].collect do |path| - next if seen_paths[path.gsub(%r{^\.[/\\]}, "")] - - controller_name = path[(load_path.length + 1)..-1] - - controller_name.gsub!(/_controller\.rb\Z/, '') - @possible_controllers << controller_name - end - end - - # remove duplicates - @possible_controllers.uniq! - end - @possible_controllers - end - - # Replaces the internal list of controllers available to ActionController::Routing with the passed argument. - # ActionController::Routing.use_controllers!([ "posts", "comments", "admin/comments" ]) - def use_controllers!(controller_names) - @possible_controllers = controller_names - end - - # Returns a controller path for a new +controller+ based on a +previous+ controller path. - # Handles 4 scenarios: - # - # * stay in the previous controller: - # controller_relative_to( nil, "groups/discussion" ) # => "groups/discussion" - # - # * stay in the previous namespace: - # controller_relative_to( "posts", "groups/discussion" ) # => "groups/posts" - # - # * forced move to the root namespace: - # controller_relative_to( "/posts", "groups/discussion" ) # => "posts" - # - # * previous namespace is root: - # controller_relative_to( "posts", "anything_with_no_slashes" ) # =>"posts" - # - def controller_relative_to(controller, previous) - if controller.nil? then previous - elsif controller[0] == ?/ then controller[1..-1] - elsif %r{^(.*)/} =~ previous then "#{$1}/#{controller}" - else controller - end - end - end - - Routes = RouteSet.new - - ActiveSupport::Inflector.module_eval do - # Ensures that routes are reloaded when Rails inflections are updated. - def inflections_with_route_reloading(&block) - returning(inflections_without_route_reloading(&block)) { - ActionController::Routing::Routes.reload! if block_given? - } - end - - alias_method_chain :inflections, :route_reloading - end - end -end diff --git a/actionpack/lib/action_controller/routing/polymorphic_routes.rb b/actionpack/lib/action_controller/routing/polymorphic_routes.rb deleted file mode 100644 index 2adf3575a7..0000000000 --- a/actionpack/lib/action_controller/routing/polymorphic_routes.rb +++ /dev/null @@ -1,210 +0,0 @@ -module ActionController - # Polymorphic URL helpers are methods for smart resolution to a named route call when - # given an Active Record model instance. They are to be used in combination with - # ActionController::Resources. - # - # These methods are useful when you want to generate correct URL or path to a RESTful - # resource without having to know the exact type of the record in question. - # - # Nested resources and/or namespaces are also supported, as illustrated in the example: - # - # polymorphic_url([:admin, @article, @comment]) - # - # results in: - # - # admin_article_comment_url(@article, @comment) - # - # == Usage within the framework - # - # Polymorphic URL helpers are used in a number of places throughout the Rails framework: - # - # * url_for, so you can use it with a record as the argument, e.g. - # url_for(@article); - # * ActionView::Helpers::FormHelper uses polymorphic_path, so you can write - # form_for(@article) without having to specify :url parameter for the form - # action; - # * redirect_to (which, in fact, uses url_for) so you can write - # redirect_to(post) in your controllers; - # * ActionView::Helpers::AtomFeedHelper, so you don't have to explicitly specify URLs - # for feed entries. - # - # == Prefixed polymorphic helpers - # - # In addition to polymorphic_url and polymorphic_path methods, a - # number of prefixed helpers are available as a shorthand to :action => "..." - # in options. Those are: - # - # * edit_polymorphic_url, edit_polymorphic_path - # * new_polymorphic_url, new_polymorphic_path - # - # Example usage: - # - # edit_polymorphic_path(@post) # => "/posts/1/edit" - # polymorphic_path(@post, :format => :pdf) # => "/posts/1.pdf" - module PolymorphicRoutes - # Constructs a call to a named RESTful route for the given record and returns the - # resulting URL string. For example: - # - # # calls post_url(post) - # polymorphic_url(post) # => "http://example.com/posts/1" - # polymorphic_url([blog, post]) # => "http://example.com/blogs/1/posts/1" - # polymorphic_url([:admin, blog, post]) # => "http://example.com/admin/blogs/1/posts/1" - # polymorphic_url([user, :blog, post]) # => "http://example.com/users/1/blog/posts/1" - # polymorphic_url(Comment) # => "http://example.com/comments" - # - # ==== Options - # - # * :action - Specifies the action prefix for the named route: - # :new or :edit. Default is no prefix. - # * :routing_type - Allowed values are :path or :url. - # Default is :url. - # - # ==== Examples - # - # # an Article record - # polymorphic_url(record) # same as article_url(record) - # - # # a Comment record - # polymorphic_url(record) # same as comment_url(record) - # - # # it recognizes new records and maps to the collection - # record = Comment.new - # polymorphic_url(record) # same as comments_url() - # - # # the class of a record will also map to the collection - # polymorphic_url(Comment) # same as comments_url() - # - def polymorphic_url(record_or_hash_or_array, options = {}) - if record_or_hash_or_array.kind_of?(Array) - record_or_hash_or_array = record_or_hash_or_array.compact - record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 - end - - record = extract_record(record_or_hash_or_array) - record = record.to_model if record.respond_to?(:to_model) - namespace = extract_namespace(record_or_hash_or_array) - - args = case record_or_hash_or_array - when Hash; [ record_or_hash_or_array ] - when Array; record_or_hash_or_array.dup - else [ record_or_hash_or_array ] - end - - inflection = if options[:action].to_s == "new" - args.pop - :singular - elsif (record.respond_to?(:new_record?) && record.new_record?) || - (record.respond_to?(:destroyed?) && record.destroyed?) - args.pop - :plural - elsif record.is_a?(Class) - args.pop - :plural - else - :singular - end - - args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} - - named_route = build_named_route_call(record_or_hash_or_array, namespace, inflection, options) - - url_options = options.except(:action, :routing_type) - unless url_options.empty? - args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options - end - - __send__(named_route, *args) - end - - # Returns the path component of a URL for the given record. It uses - # polymorphic_url with :routing_type => :path. - def polymorphic_path(record_or_hash_or_array, options = {}) - polymorphic_url(record_or_hash_or_array, options.merge(:routing_type => :path)) - end - - %w(edit new).each do |action| - module_eval <<-EOT, __FILE__, __LINE__ - def #{action}_polymorphic_url(record_or_hash, options = {}) # def edit_polymorphic_url(record_or_hash, options = {}) - polymorphic_url( # polymorphic_url( - record_or_hash, # record_or_hash, - options.merge(:action => "#{action}")) # options.merge(:action => "edit")) - end # end - # - def #{action}_polymorphic_path(record_or_hash, options = {}) # def edit_polymorphic_path(record_or_hash, options = {}) - polymorphic_url( # polymorphic_url( - record_or_hash, # record_or_hash, - options.merge(:action => "#{action}", :routing_type => :path)) # options.merge(:action => "edit", :routing_type => :path)) - end # end - EOT - end - - def formatted_polymorphic_url(record_or_hash, options = {}) - ActiveSupport::Deprecation.warn("formatted_polymorphic_url has been deprecated. Please pass :format to the polymorphic_url method instead", caller) - options[:format] = record_or_hash.pop if Array === record_or_hash - polymorphic_url(record_or_hash, options) - end - - def formatted_polymorphic_path(record_or_hash, options = {}) - ActiveSupport::Deprecation.warn("formatted_polymorphic_path has been deprecated. Please pass :format to the polymorphic_path method instead", caller) - options[:format] = record_or_hash.pop if record_or_hash === Array - polymorphic_url(record_or_hash, options.merge(:routing_type => :path)) - end - - private - def action_prefix(options) - options[:action] ? "#{options[:action]}_" : '' - end - - def routing_type(options) - options[:routing_type] || :url - end - - def build_named_route_call(records, namespace, inflection, options = {}) - unless records.is_a?(Array) - record = extract_record(records) - route = '' - else - record = records.pop - route = records.inject("") do |string, parent| - if parent.is_a?(Symbol) || parent.is_a?(String) - string << "#{parent}_" - else - string << "#{RecordIdentifier.__send__("plural_class_name", parent)}".singularize - string << "_" - end - end - end - - if record.is_a?(Symbol) || record.is_a?(String) - route << "#{record}_" - else - route << "#{RecordIdentifier.__send__("plural_class_name", record)}" - route = route.singularize if inflection == :singular - route << "_" - end - - action_prefix(options) + namespace + route + routing_type(options).to_s - end - - def extract_record(record_or_hash_or_array) - case record_or_hash_or_array - when Array; record_or_hash_or_array.last - when Hash; record_or_hash_or_array[:id] - else record_or_hash_or_array - end - end - - # Remove the first symbols from the array and return the url prefix - # implied by those symbols. - def extract_namespace(record_or_hash_or_array) - return "" unless record_or_hash_or_array.is_a?(Array) - - namespace_keys = [] - while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol) - namespace_keys << record_or_hash_or_array.shift - end - - namespace_keys.map {|k| "#{k}_"}.join - end - end -end diff --git a/actionpack/lib/action_controller/routing/resources.rb b/actionpack/lib/action_controller/routing/resources.rb deleted file mode 100644 index 06506435a2..0000000000 --- a/actionpack/lib/action_controller/routing/resources.rb +++ /dev/null @@ -1,685 +0,0 @@ -require 'active_support/core_ext/hash/slice' -require 'active_support/core_ext/object/try' - -module ActionController - # == Overview - # - # ActionController::Resources are a way of defining RESTful \resources. A RESTful \resource, in basic terms, - # is something that can be pointed at and it will respond with a representation of the data requested. - # In real terms this could mean a user with a browser requests an HTML page, or that a desktop application - # requests XML data. - # - # RESTful design is based on the assumption that there are four generic verbs that a user of an - # application can request from a \resource (the noun). - # - # \Resources can be requested using four basic HTTP verbs (GET, POST, PUT, DELETE), the method used - # denotes the type of action that should take place. - # - # === The Different Methods and their Usage - # - # * GET - Requests for a \resource, no saving or editing of a \resource should occur in a GET request. - # * POST - Creation of \resources. - # * PUT - Editing of attributes on a \resource. - # * DELETE - Deletion of a \resource. - # - # === Examples - # - # # A GET request on the Posts resource is asking for all Posts - # GET /posts - # - # # A GET request on a single Post resource is asking for that particular Post - # GET /posts/1 - # - # # A POST request on the Posts resource is asking for a Post to be created with the supplied details - # POST /posts # with => { :post => { :title => "My Whizzy New Post", :body => "I've got a brand new combine harvester" } } - # - # # A PUT request on a single Post resource is asking for a Post to be updated - # PUT /posts # with => { :id => 1, :post => { :title => "Changed Whizzy Title" } } - # - # # A DELETE request on a single Post resource is asking for it to be deleted - # DELETE /posts # with => { :id => 1 } - # - # By using the REST convention, users of our application can assume certain things about how the data - # is requested and how it is returned. Rails simplifies the routing part of RESTful design by - # supplying you with methods to create them in your routes.rb file. - # - # Read more about REST at http://en.wikipedia.org/wiki/Representational_State_Transfer - module Resources - INHERITABLE_OPTIONS = :namespace, :shallow - - class Resource #:nodoc: - DEFAULT_ACTIONS = :index, :create, :new, :edit, :show, :update, :destroy - - attr_reader :collection_methods, :member_methods, :new_methods - attr_reader :path_prefix, :name_prefix, :path_segment - attr_reader :plural, :singular - attr_reader :options - - def initialize(entities, options) - @plural ||= entities - @singular ||= options[:singular] || plural.to_s.singularize - @path_segment = options.delete(:as) || @plural - - @options = options - - arrange_actions - add_default_actions - set_allowed_actions - set_prefixes - end - - def controller - @controller ||= "#{options[:namespace]}#{(options[:controller] || plural).to_s}" - end - - def requirements(with_id = false) - @requirements ||= @options[:requirements] || {} - @id_requirement ||= { :id => @requirements.delete(:id) || /[^#{Routing::SEPARATORS.join}]+/ } - - with_id ? @requirements.merge(@id_requirement) : @requirements - end - - def conditions - @conditions ||= @options[:conditions] || {} - end - - def path - @path ||= "#{path_prefix}/#{path_segment}" - end - - def new_path - new_action = self.options[:path_names][:new] if self.options[:path_names] - new_action ||= Base.resources_path_names[:new] - @new_path ||= "#{path}/#{new_action}" - end - - def shallow_path_prefix - @shallow_path_prefix ||= @options[:shallow] ? @options[:namespace].try(:sub, /\/$/, '') : path_prefix - end - - def member_path - @member_path ||= "#{shallow_path_prefix}/#{path_segment}/:id" - end - - def nesting_path_prefix - @nesting_path_prefix ||= "#{shallow_path_prefix}/#{path_segment}/:#{singular}_id" - end - - def shallow_name_prefix - @shallow_name_prefix ||= @options[:shallow] ? @options[:namespace].try(:gsub, /\//, '_') : name_prefix - end - - def nesting_name_prefix - "#{shallow_name_prefix}#{singular}_" - end - - def action_separator - @action_separator ||= Base.resource_action_separator - end - - def uncountable? - @singular.to_s == @plural.to_s - end - - def has_action?(action) - !DEFAULT_ACTIONS.include?(action) || action_allowed?(action) - end - - protected - def arrange_actions - @collection_methods = arrange_actions_by_methods(options.delete(:collection)) - @member_methods = arrange_actions_by_methods(options.delete(:member)) - @new_methods = arrange_actions_by_methods(options.delete(:new)) - end - - def add_default_actions - add_default_action(member_methods, :get, :edit) - add_default_action(new_methods, :get, :new) - end - - def set_allowed_actions - only, except = @options.values_at(:only, :except) - @allowed_actions ||= {} - - if only == :all || except == :none - only = nil - except = [] - elsif only == :none || except == :all - only = [] - except = nil - end - - if only - @allowed_actions[:only] = Array(only).map {|a| a.to_sym } - elsif except - @allowed_actions[:except] = Array(except).map {|a| a.to_sym } - end - end - - def action_allowed?(action) - only, except = @allowed_actions.values_at(:only, :except) - (!only || only.include?(action)) && (!except || !except.include?(action)) - end - - def set_prefixes - @path_prefix = options.delete(:path_prefix) - @name_prefix = options.delete(:name_prefix) - end - - def arrange_actions_by_methods(actions) - (actions || {}).inject({}) do |flipped_hash, (key, value)| - (flipped_hash[value] ||= []) << key - flipped_hash - end - end - - def add_default_action(collection, method, action) - (collection[method] ||= []).unshift(action) - end - end - - class SingletonResource < Resource #:nodoc: - def initialize(entity, options) - @singular = @plural = entity - options[:controller] ||= @singular.to_s.pluralize - super - end - - alias_method :shallow_path_prefix, :path_prefix - alias_method :shallow_name_prefix, :name_prefix - alias_method :member_path, :path - alias_method :nesting_path_prefix, :path - end - - # Creates named routes for implementing verb-oriented controllers - # for a collection \resource. - # - # For example: - # - # map.resources :messages - # - # will map the following actions in the corresponding controller: - # - # class MessagesController < ActionController::Base - # # GET messages_url - # def index - # # return all messages - # end - # - # # GET new_message_url - # def new - # # return an HTML form for describing a new message - # end - # - # # POST messages_url - # def create - # # create a new message - # end - # - # # GET message_url(:id => 1) - # def show - # # find and return a specific message - # end - # - # # GET edit_message_url(:id => 1) - # def edit - # # return an HTML form for editing a specific message - # end - # - # # PUT message_url(:id => 1) - # def update - # # find and update a specific message - # end - # - # # DELETE message_url(:id => 1) - # def destroy - # # delete a specific message - # end - # end - # - # Along with the routes themselves, +resources+ generates named routes for use in - # controllers and views. map.resources :messages produces the following named routes and helpers: - # - # Named Route Helpers - # ============ ===================================================== - # messages messages_url, hash_for_messages_url, - # messages_path, hash_for_messages_path - # - # message message_url(id), hash_for_message_url(id), - # message_path(id), hash_for_message_path(id) - # - # new_message new_message_url, hash_for_new_message_url, - # new_message_path, hash_for_new_message_path - # - # edit_message edit_message_url(id), hash_for_edit_message_url(id), - # edit_message_path(id), hash_for_edit_message_path(id) - # - # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example: - # - # redirect_to :controller => 'messages', :action => 'index' - # # and - # <%= link_to "edit this message", :controller => 'messages', :action => 'edit', :id => @message.id %> - # - # now become: - # - # redirect_to messages_url - # # and - # <%= link_to "edit this message", edit_message_url(@message) # calls @message.id automatically - # - # Since web browsers don't support the PUT and DELETE verbs, you will need to add a parameter '_method' to your - # form tags. The form helpers make this a little easier. For an update form with a @message object: - # - # <%= form_tag message_path(@message), :method => :put %> - # - # or - # - # <% form_for :message, @message, :url => message_path(@message), :html => {:method => :put} do |f| %> - # - # or - # - # <% form_for @message do |f| %> - # - # which takes into account whether @message is a new record or not and generates the - # path and method accordingly. - # - # The +resources+ method accepts the following options to customize the resulting routes: - # * :collection - Add named routes for other actions that operate on the collection. - # Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, - # an array of any of the previous, or :any if the method does not matter. - # These routes map to a URL like /messages/rss, with a route of +rss_messages_url+. - # * :member - Same as :collection, but for actions that operate on a specific member. - # * :new - Same as :collection, but for actions that operate on the new \resource action. - # * :controller - Specify the controller name for the routes. - # * :singular - Specify the singular name used in the member routes. - # * :requirements - Set custom routing parameter requirements; this is a hash of either - # regular expressions (which must match for the route to match) or extra parameters. For example: - # - # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' } - # - # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller. - # * :conditions - Specify custom routing recognition conditions. \Resources sets the :method value for the method-specific routes. - # * :as - Specify a different \resource name to use in the URL path. For example: - # # products_path == '/productos' - # map.resources :products, :as => 'productos' do |product| - # # product_reviews_path(product) == '/productos/1234/comentarios' - # product.resources :product_reviews, :as => 'comentarios' - # end - # - # * :has_one - Specify nested \resources, this is a shorthand for mapping singleton \resources beneath the current. - # * :has_many - Same has :has_one, but for plural \resources. - # - # You may directly specify the routing association with +has_one+ and +has_many+ like: - # - # map.resources :notes, :has_one => :author, :has_many => [:comments, :attachments] - # - # This is the same as: - # - # map.resources :notes do |notes| - # notes.resource :author - # notes.resources :comments - # notes.resources :attachments - # end - # - # * :path_names - Specify different path names for the actions. For example: - # # new_products_path == '/productos/nuevo' - # # bids_product_path(1) == '/productos/1/licitacoes' - # map.resources :products, :as => 'productos', :member => { :bids => :get }, :path_names => { :new => 'nuevo', :bids => 'licitacoes' } - # - # You can also set default action names from an environment, like this: - # config.action_controller.resources_path_names = { :new => 'nuevo', :edit => 'editar' } - # - # * :path_prefix - Set a prefix to the routes with required route variables. - # - # Weblog comments usually belong to a post, so you might use +resources+ like: - # - # map.resources :articles - # map.resources :comments, :path_prefix => '/articles/:article_id' - # - # You can nest +resources+ calls to set this automatically: - # - # map.resources :articles do |article| - # article.resources :comments - # end - # - # The comment \resources work the same, but must now include a value for :article_id. - # - # article_comments_url(@article) - # article_comment_url(@article, @comment) - # - # article_comments_url(:article_id => @article) - # article_comment_url(:article_id => @article, :id => @comment) - # - # If you don't want to load all objects from the database you might want to use the article_id directly: - # - # articles_comments_url(@comment.article_id, @comment) - # - # * :name_prefix - Define a prefix for all generated routes, usually ending in an underscore. - # Use this if you have named routes that may clash. - # - # map.resources :tags, :path_prefix => '/books/:book_id', :name_prefix => 'book_' - # map.resources :tags, :path_prefix => '/toys/:toy_id', :name_prefix => 'toy_' - # - # You may also use :name_prefix to override the generic named routes in a nested \resource: - # - # map.resources :articles do |article| - # article.resources :comments, :name_prefix => nil - # end - # - # This will yield named \resources like so: - # - # comments_url(@article) - # comment_url(@article, @comment) - # - # * :shallow - If true, paths for nested resources which reference a specific member - # (ie. those with an :id parameter) will not use the parent path prefix or name prefix. - # - # The :shallow option is inherited by any nested resource(s). - # - # For example, 'users', 'posts' and 'comments' all use shallow paths with the following nested resources: - # - # map.resources :users, :shallow => true do |user| - # user.resources :posts do |post| - # post.resources :comments - # end - # end - # # --> GET /users/1/posts (maps to the PostsController#index action as usual) - # # also adds the usual named route called "user_posts" - # # --> GET /posts/2 (maps to the PostsController#show action as if it were not nested) - # # also adds the named route called "post" - # # --> GET /posts/2/comments (maps to the CommentsController#index action) - # # also adds the named route called "post_comments" - # # --> GET /comments/2 (maps to the CommentsController#show action as if it were not nested) - # # also adds the named route called "comment" - # - # You may also use :shallow in combination with the +has_one+ and +has_many+ shorthand notations like: - # - # map.resources :users, :has_many => { :posts => :comments }, :shallow => true - # - # * :only and :except - Specify which of the seven default actions should be routed to. - # - # :only and :except may be set to :all, :none, an action name or a - # list of action names. By default, routes are generated for all seven actions. - # - # For example: - # - # map.resources :posts, :only => [:index, :show] do |post| - # post.resources :comments, :except => [:update, :destroy] - # end - # # --> GET /posts (maps to the PostsController#index action) - # # --> POST /posts (fails) - # # --> GET /posts/1 (maps to the PostsController#show action) - # # --> DELETE /posts/1 (fails) - # # --> POST /posts/1/comments (maps to the CommentsController#create action) - # # --> PUT /posts/1/comments/1 (fails) - # - # If map.resources is called with multiple resources, they all get the same options applied. - # - # Examples: - # - # map.resources :messages, :path_prefix => "/thread/:thread_id" - # # --> GET /thread/7/messages/1 - # - # map.resources :messages, :collection => { :rss => :get } - # # --> GET /messages/rss (maps to the #rss action) - # # also adds a named route called "rss_messages" - # - # map.resources :messages, :member => { :mark => :post } - # # --> POST /messages/1/mark (maps to the #mark action) - # # also adds a named route called "mark_message" - # - # map.resources :messages, :new => { :preview => :post } - # # --> POST /messages/new/preview (maps to the #preview action) - # # also adds a named route called "preview_new_message" - # - # map.resources :messages, :new => { :new => :any, :preview => :post } - # # --> POST /messages/new/preview (maps to the #preview action) - # # also adds a named route called "preview_new_message" - # # --> /messages/new can be invoked via any request method - # - # map.resources :messages, :controller => "categories", - # :path_prefix => "/category/:category_id", - # :name_prefix => "category_" - # # --> GET /categories/7/messages/1 - # # has named route "category_message" - # - # The +resources+ method sets HTTP method restrictions on the routes it generates. For example, making an - # HTTP POST on new_message_url will raise a RoutingError exception. The default route in - # config/routes.rb overrides this and allows invalid HTTP methods for \resource routes. - def resources(*entities, &block) - options = entities.extract_options! - entities.each { |entity| map_resource(entity, options.dup, &block) } - end - - # Creates named routes for implementing verb-oriented controllers for a singleton \resource. - # A singleton \resource is global to its current context. For unnested singleton \resources, - # the \resource is global to the current user visiting the application, such as a user's - # /account profile. For nested singleton \resources, the \resource is global to its parent - # \resource, such as a projects \resource that has_one :project_manager. - # The project_manager should be mapped as a singleton \resource under projects: - # - # map.resources :projects do |project| - # project.resource :project_manager - # end - # - # See +resources+ for general conventions. These are the main differences: - # * A singular name is given to map.resource. The default controller name is still taken from the plural name. - # * To specify a custom plural name, use the :plural option. There is no :singular option. - # * No default index route is created for the singleton \resource controller. - # * When nesting singleton \resources, only the singular name is used as the path prefix (example: 'account/messages/1') - # - # For example: - # - # map.resource :account - # - # maps these actions in the Accounts controller: - # - # class AccountsController < ActionController::Base - # # GET new_account_url - # def new - # # return an HTML form for describing the new account - # end - # - # # POST account_url - # def create - # # create an account - # end - # - # # GET account_url - # def show - # # find and return the account - # end - # - # # GET edit_account_url - # def edit - # # return an HTML form for editing the account - # end - # - # # PUT account_url - # def update - # # find and update the account - # end - # - # # DELETE account_url - # def destroy - # # delete the account - # end - # end - # - # Along with the routes themselves, +resource+ generates named routes for - # use in controllers and views. map.resource :account produces - # these named routes and helpers: - # - # Named Route Helpers - # ============ ============================================= - # account account_url, hash_for_account_url, - # account_path, hash_for_account_path - # - # new_account new_account_url, hash_for_new_account_url, - # new_account_path, hash_for_new_account_path - # - # edit_account edit_account_url, hash_for_edit_account_url, - # edit_account_path, hash_for_edit_account_path - def resource(*entities, &block) - options = entities.extract_options! - entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } - end - - private - def map_resource(entities, options = {}, &block) - resource = Resource.new(entities, options) - - with_options :controller => resource.controller do |map| - map_associations(resource, options) - - if block_given? - with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) - end - - map_collection_actions(map, resource) - map_default_collection_actions(map, resource) - map_new_actions(map, resource) - map_member_actions(map, resource) - end - end - - def map_singleton_resource(entities, options = {}, &block) - resource = SingletonResource.new(entities, options) - - with_options :controller => resource.controller do |map| - map_associations(resource, options) - - if block_given? - with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) - end - - map_collection_actions(map, resource) - map_new_actions(map, resource) - map_member_actions(map, resource) - map_default_singleton_actions(map, resource) - end - end - - def map_associations(resource, options) - map_has_many_associations(resource, options.delete(:has_many), options) if options[:has_many] - - path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}" - name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" - - Array(options[:has_one]).each do |association| - resource(association, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => path_prefix, :name_prefix => name_prefix)) - end - end - - def map_has_many_associations(resource, associations, options) - case associations - when Hash - associations.each do |association,has_many| - map_has_many_associations(resource, association, options.merge(:has_many => has_many)) - end - when Array - associations.each do |association| - map_has_many_associations(resource, association, options) - end - when Symbol, String - resources(associations, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, :has_many => options[:has_many])) - else - end - end - - def map_collection_actions(map, resource) - resource.collection_methods.each do |method, actions| - actions.each do |action| - [method].flatten.each do |m| - action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) - action_path ||= action - - map_resource_routes(map, resource, action, "#{resource.path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.name_prefix}#{resource.plural}", m) - end - end - end - end - - def map_default_collection_actions(map, resource) - index_route_name = "#{resource.name_prefix}#{resource.plural}" - - if resource.uncountable? - index_route_name << "_index" - end - - map_resource_routes(map, resource, :index, resource.path, index_route_name) - map_resource_routes(map, resource, :create, resource.path, index_route_name) - end - - def map_default_singleton_actions(map, resource) - map_resource_routes(map, resource, :create, resource.path, "#{resource.shallow_name_prefix}#{resource.singular}") - end - - def map_new_actions(map, resource) - resource.new_methods.each do |method, actions| - actions.each do |action| - route_path = resource.new_path - route_name = "new_#{resource.name_prefix}#{resource.singular}" - - unless action == :new - route_path = "#{route_path}#{resource.action_separator}#{action}" - route_name = "#{action}_#{route_name}" - end - - map_resource_routes(map, resource, action, route_path, route_name, method) - end - end - end - - def map_member_actions(map, resource) - resource.member_methods.each do |method, actions| - actions.each do |action| - [method].flatten.each do |m| - action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) - action_path ||= Base.resources_path_names[action] || action - - map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true }) - end - end - end - - route_path = "#{resource.shallow_name_prefix}#{resource.singular}" - map_resource_routes(map, resource, :show, resource.member_path, route_path) - map_resource_routes(map, resource, :update, resource.member_path, route_path) - map_resource_routes(map, resource, :destroy, resource.member_path, route_path) - end - - def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} ) - if resource.has_action?(action) - action_options = action_options_for(action, resource, method, resource_options) - formatted_route_path = "#{route_path}.:format" - - if route_name && @set.named_routes[route_name.to_sym].nil? - map.named_route(route_name, formatted_route_path, action_options) - else - map.connect(formatted_route_path, action_options) - end - end - end - - def add_conditions_for(conditions, method) - returning({:conditions => conditions.dup}) do |options| - options[:conditions][:method] = method unless method == :any - end - end - - def action_options_for(action, resource, method = nil, resource_options = {}) - default_options = { :action => action.to_s } - require_id = !resource.kind_of?(SingletonResource) - force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource) - - case default_options[:action] - when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) - when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) - when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) - when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) - when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) - else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id)) - end - end - end -end diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb deleted file mode 100644 index 8135b5811e..0000000000 --- a/actionpack/lib/action_controller/routing/route_set.rb +++ /dev/null @@ -1,699 +0,0 @@ -require 'rack/mount' -require 'forwardable' - -module ActionController - module Routing - class RouteSet #:nodoc: - NotFound = lambda { |env| - raise RoutingError, "No route matches #{env[::Rack::Mount::Const::PATH_INFO].inspect} with #{env.inspect}" - } - - PARAMETERS_KEY = 'action_dispatch.request.path_parameters' - - class Dispatcher - def initialize(options = {}) - defaults = options[:defaults] - @glob_param = options.delete(:glob) - end - - def call(env) - params = env[PARAMETERS_KEY] - merge_default_action!(params) - split_glob_param!(params) if @glob_param - params.each { |key, value| params[key] = URI.unescape(value) if value.is_a?(String) } - - if env['action_controller.recognize'] - [200, {}, params] - else - controller = controller(params) - controller.action(params[:action]).call(env) - end - end - - private - def controller(params) - if params && params.has_key?(:controller) - controller = "#{params[:controller].camelize}Controller" - ActiveSupport::Inflector.constantize(controller) - end - end - - def merge_default_action!(params) - params[:action] ||= 'index' - end - - def split_glob_param!(params) - params[@glob_param] = params[@glob_param].split('/').map { |v| URI.unescape(v) } - end - end - - module RouteExtensions - def segment_keys - conditions[:path_info].names.compact.map { |key| key.to_sym } - end - end - - # Mapper instances are used to build routes. The object passed to the draw - # block in config/routes.rb is a Mapper instance. - # - # Mapper instances have relatively few instance methods, in order to avoid - # clashes with named routes. - class Mapper #:doc: - include ActionController::Resources - - def initialize(set) #:nodoc: - @set = set - end - - # Create an unnamed route with the provided +path+ and +options+. See - # ActionController::Routing for an introduction to routes. - def connect(path, options = {}) - @set.add_route(path, options) - end - - # Creates a named route called "root" for matching the root level request. - def root(options = {}) - if options.is_a?(Symbol) - if source_route = @set.named_routes.routes[options] - options = source_route.defaults.merge({ :conditions => source_route.conditions }) - end - end - named_route("root", '', options) - end - - def named_route(name, path, options = {}) #:nodoc: - @set.add_named_route(name, path, options) - end - - # Enables the use of resources in a module by setting the name_prefix, path_prefix, and namespace for the model. - # Example: - # - # map.namespace(:admin) do |admin| - # admin.resources :products, - # :has_many => [ :tags, :images, :variants ] - # end - # - # This will create +admin_products_url+ pointing to "admin/products", which will look for an Admin::ProductsController. - # It'll also create +admin_product_tags_url+ pointing to "admin/products/#{product_id}/tags", which will look for - # Admin::TagsController. - def namespace(name, options = {}, &block) - if options[:namespace] - with_options({:path_prefix => "#{options.delete(:path_prefix)}/#{name}", :name_prefix => "#{options.delete(:name_prefix)}#{name}_", :namespace => "#{options.delete(:namespace)}#{name}/" }.merge(options), &block) - else - with_options({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(options), &block) - end - end - - def method_missing(route_name, *args, &proc) #:nodoc: - super unless args.length >= 1 && proc.nil? - @set.add_named_route(route_name, *args) - end - end - - # A NamedRouteCollection instance is a collection of named routes, and also - # maintains an anonymous module that can be used to install helpers for the - # named routes. - class NamedRouteCollection #:nodoc: - include Enumerable - attr_reader :routes, :helpers - - def initialize - clear! - end - - def clear! - @routes = {} - @helpers = [] - - @module ||= Module.new - @module.instance_methods.each do |selector| - @module.class_eval { remove_method selector } - end - end - - def add(name, route) - routes[name.to_sym] = route - define_named_route_methods(name, route) - end - - def get(name) - routes[name.to_sym] - end - - alias []= add - alias [] get - alias clear clear! - - def each - routes.each { |name, route| yield name, route } - self - end - - def names - routes.keys - end - - def length - routes.length - end - - def reset! - old_routes = routes.dup - clear! - old_routes.each do |name, route| - add(name, route) - end - end - - def install(destinations = [ActionController::Base, ActionView::Base], regenerate = false) - reset! if regenerate - Array(destinations).each do |dest| - dest.__send__(:include, @module) - end - end - - private - def url_helper_name(name, kind = :url) - :"#{name}_#{kind}" - end - - def hash_access_name(name, kind = :url) - :"hash_for_#{name}_#{kind}" - end - - def define_named_route_methods(name, route) - {:url => {:only_path => false}, :path => {:only_path => true}}.each do |kind, opts| - hash = route.defaults.merge(:use_route => name).merge(opts) - define_hash_access route, name, kind, hash - define_url_helper route, name, kind, hash - end - end - - def named_helper_module_eval(code, *args) - @module.module_eval(code, *args) - end - - def define_hash_access(route, name, kind, options) - selector = hash_access_name(name, kind) - named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks - def #{selector}(options = nil) # def hash_for_users_url(options = nil) - options ? #{options.inspect}.merge(options) : #{options.inspect} # options ? {:only_path=>false}.merge(options) : {:only_path=>false} - end # end - protected :#{selector} # protected :hash_for_users_url - end_eval - helpers << selector - end - - def define_url_helper(route, name, kind, options) - selector = url_helper_name(name, kind) - # The segment keys used for positional parameters - - hash_access_method = hash_access_name(name, kind) - - # allow ordered parameters to be associated with corresponding - # dynamic segments, so you can do - # - # foo_url(bar, baz, bang) - # - # instead of - # - # foo_url(:bar => bar, :baz => baz, :bang => bang) - # - # Also allow options hash, so you can do - # - # foo_url(bar, baz, bang, :sort_by => 'baz') - # - named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks - def #{selector}(*args) # def users_url(*args) - # - opts = if args.empty? || Hash === args.first # opts = if args.empty? || Hash === args.first - args.first || {} # args.first || {} - else # else - options = args.extract_options! # options = args.extract_options! - args = args.zip(#{route.segment_keys.inspect}).inject({}) do |h, (v, k)| # args = args.zip([]).inject({}) do |h, (v, k)| - h[k] = v # h[k] = v - h # h - end # end - options.merge(args) # options.merge(args) - end # end - # - url_for(#{hash_access_method}(opts)) # url_for(hash_for_users_url(opts)) - # - end # end - #Add an alias to support the now deprecated formatted_* URL. # #Add an alias to support the now deprecated formatted_* URL. - def formatted_#{selector}(*args) # def formatted_users_url(*args) - ActiveSupport::Deprecation.warn( # ActiveSupport::Deprecation.warn( - "formatted_#{selector}() has been deprecated. " + # "formatted_users_url() has been deprecated. " + - "Please pass format to the standard " + # "Please pass format to the standard " + - "#{selector} method instead.", caller) # "users_url method instead.", caller) - #{selector}(*args) # users_url(*args) - end # end - protected :#{selector} # protected :users_url - end_eval - helpers << selector - end - end - - attr_accessor :routes, :named_routes, :configuration_files - - def initialize - self.configuration_files = [] - - self.routes = [] - self.named_routes = NamedRouteCollection.new - - clear! - end - - def draw - clear! - yield Mapper.new(self) - @set.add_route(NotFound) - install_helpers - @set.freeze - end - - def clear! - routes.clear - named_routes.clear - @set = ::Rack::Mount::RouteSet.new(:parameters_key => PARAMETERS_KEY) - end - - def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false) - Array(destinations).each { |d| d.module_eval { include Helpers } } - named_routes.install(destinations, regenerate_code) - end - - def empty? - routes.empty? - end - - def add_configuration_file(path) - self.configuration_files << path - end - - # Deprecated accessor - def configuration_file=(path) - add_configuration_file(path) - end - - # Deprecated accessor - def configuration_file - configuration_files - end - - def load! - Routing.use_controllers!(nil) # Clear the controller cache so we may discover new ones - load_routes! - end - - # reload! will always force a reload whereas load checks the timestamp first - alias reload! load! - - def reload - if configuration_files.any? && @routes_last_modified - if routes_changed_at == @routes_last_modified - return # routes didn't change, don't reload - else - @routes_last_modified = routes_changed_at - end - end - - load! - end - - def load_routes! - if configuration_files.any? - configuration_files.each { |config| load(config) } - @routes_last_modified = routes_changed_at - else - draw do |map| - map.connect ":controller/:action/:id" - end - end - end - - def routes_changed_at - routes_changed_at = nil - - configuration_files.each do |config| - config_changed_at = File.stat(config).mtime - - if routes_changed_at.nil? || config_changed_at > routes_changed_at - routes_changed_at = config_changed_at - end - end - - routes_changed_at - end - - def add_route(path, options = {}) - options = options.dup - - if conditions = options.delete(:conditions) - conditions = conditions.dup - method = [conditions.delete(:method)].flatten.compact - method.map! { |m| - m = m.to_s.upcase - - if m == "HEAD" - raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" - end - - unless HTTP_METHODS.include?(m.downcase.to_sym) - raise ArgumentError, "Invalid HTTP method specified in route conditions" - end - - m - } - - if method.length > 1 - method = Regexp.union(*method) - elsif method.length == 1 - method = method.first - else - method = nil - end - end - - path_prefix = options.delete(:path_prefix) - name_prefix = options.delete(:name_prefix) - namespace = options.delete(:namespace) - - name = options.delete(:_name) - name = "#{name_prefix}#{name}" if name_prefix - - requirements = options.delete(:requirements) || {} - defaults = options.delete(:defaults) || {} - options.each do |k, v| - if v.is_a?(Regexp) - if value = options.delete(k) - requirements[k.to_sym] = value - end - else - value = options.delete(k) - defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param - end - end - - requirements.each do |_, requirement| - if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} - raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" - end - if requirement.multiline? - raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" - end - end - - possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } - requirements[:controller] ||= Regexp.union(*possible_names) - - if defaults[:controller] - defaults[:action] ||= 'index' - defaults[:controller] = defaults[:controller].to_s - defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace - end - - if defaults[:action] - defaults[:action] = defaults[:action].to_s - end - - if path.is_a?(String) - path = "#{path_prefix}/#{path}" if path_prefix - path = path.gsub('.:format', '(.:format)') - path = optionalize_trailing_dynamic_segments(path, requirements, defaults) - glob = $1.to_sym if path =~ /\/\*(\w+)$/ - path = ::Rack::Mount::Utils.normalize_path(path) - path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) - - if glob && !defaults[glob].blank? - raise RoutingError, "paths cannot have non-empty default values" - end - end - - app = Dispatcher.new(:defaults => defaults, :glob => glob) - - conditions = {} - conditions[:request_method] = method if method - conditions[:path_info] = path if path - - route = @set.add_route(app, conditions, defaults, name) - route.extend(RouteExtensions) - routes << route - route - end - - def add_named_route(name, path, options = {}) - options[:_name] = name - route = add_route(path, options) - named_routes[route.name] = route - route - end - - def options_as_params(options) - # If an explicit :controller was given, always make :action explicit - # too, so that action expiry works as expected for things like - # - # generate({:controller => 'content'}, {:controller => 'content', :action => 'show'}) - # - # (the above is from the unit tests). In the above case, because the - # controller was explicitly given, but no action, the action is implied to - # be "index", not the recalled action of "show". - # - # great fun, eh? - - options_as_params = options.clone - options_as_params[:action] ||= 'index' if options[:controller] - options_as_params[:action] = options_as_params[:action].to_s if options_as_params[:action] - options_as_params - end - - def build_expiry(options, recall) - recall.inject({}) do |expiry, (key, recalled_value)| - expiry[key] = (options.key?(key) && options[key].to_param != recalled_value.to_param) - expiry - end - end - - # Generate the path indicated by the arguments, and return an array of - # the keys that were not used to generate it. - def extra_keys(options, recall={}) - generate_extras(options, recall).last - end - - def generate_extras(options, recall={}) - generate(options, recall, :generate_extras) - end - - def generate(options, recall = {}, method = :generate) - options, recall = options.dup, recall.dup - named_route = options.delete(:use_route) - - options = options_as_params(options) - expire_on = build_expiry(options, recall) - - recall[:action] ||= 'index' if options[:controller] || recall[:controller] - - if recall[:controller] && (!options.has_key?(:controller) || options[:controller] == recall[:controller]) - options[:controller] = recall.delete(:controller) - - if recall[:action] && (!options.has_key?(:action) || options[:action] == recall[:action]) - options[:action] = recall.delete(:action) - - if recall[:id] && (!options.has_key?(:id) || options[:id] == recall[:id]) - options[:id] = recall.delete(:id) - end - end - end - - options[:controller] = options[:controller].to_s if options[:controller] - - if !named_route && expire_on[:controller] && options[:controller] && options[:controller][0] != ?/ - old_parts = recall[:controller].split('/') - new_parts = options[:controller].split('/') - parts = old_parts[0..-(new_parts.length + 1)] + new_parts - options[:controller] = parts.join('/') - end - - options[:controller] = options[:controller][1..-1] if options[:controller] && options[:controller][0] == ?/ - - merged = options.merge(recall) - if options.has_key?(:action) && options[:action].nil? - options.delete(:action) - recall[:action] = 'index' - end - recall[:action] = options.delete(:action) if options[:action] == 'index' - - path = _uri(named_route, options, recall) - if path && method == :generate_extras - uri = URI(path) - extras = uri.query ? - Rack::Utils.parse_nested_query(uri.query).keys.map { |k| k.to_sym } : - [] - [uri.path, extras] - elsif path - path - else - raise RoutingError, "No route matches #{options.inspect}" - end - rescue Rack::Mount::RoutingError - raise RoutingError, "No route matches #{options.inspect}" - end - - def call(env) - @set.call(env) - rescue ActionController::RoutingError => e - raise e if env['action_controller.rescue_error'] == false - - method, path = env['REQUEST_METHOD'].downcase.to_sym, env['PATH_INFO'] - - # Route was not recognized. Try to find out why (maybe wrong verb). - allows = HTTP_METHODS.select { |verb| - begin - recognize_path(path, {:method => verb}, false) - rescue ActionController::RoutingError - nil - end - } - - if !HTTP_METHODS.include?(method) - raise NotImplemented.new(*allows) - elsif !allows.empty? - raise MethodNotAllowed.new(*allows) - else - raise e - end - end - - def recognize(request) - params = recognize_path(request.path, extract_request_environment(request)) - request.path_parameters = params.with_indifferent_access - "#{params[:controller].to_s.camelize}Controller".constantize - end - - def recognize_path(path, environment = {}, rescue_error = true) - method = (environment[:method] || "GET").to_s.upcase - - begin - env = Rack::MockRequest.env_for(path, {:method => method}) - rescue URI::InvalidURIError => e - raise RoutingError, e.message - end - - env['action_controller.recognize'] = true - env['action_controller.rescue_error'] = rescue_error - status, headers, body = call(env) - body - end - - # Subclasses and plugins may override this method to extract further attributes - # from the request, for use by route conditions and such. - def extract_request_environment(request) - { :method => request.method } - end - - private - def _uri(named_route, params, recall) - params = URISegment.wrap_values(params) - recall = URISegment.wrap_values(recall) - - unless result = @set.generate(:path_info, named_route, params, recall) - return - end - - uri, params = result - params.each do |k, v| - if v._value - params[k] = v._value - else - params.delete(k) - end - end - - uri << "?#{Rack::Mount::Utils.build_nested_query(params)}" if uri && params.any? - uri - end - - class URISegment < Struct.new(:_value, :_escape) - EXCLUDED = [:controller] - - def self.wrap_values(hash) - hash.inject({}) { |h, (k, v)| - h[k] = new(v, !EXCLUDED.include?(k.to_sym)) - h - } - end - - extend Forwardable - def_delegators :_value, :==, :eql?, :hash - - def to_param - @to_param ||= begin - if _value.is_a?(Array) - _value.map { |v| _escaped(v) }.join('/') - else - _escaped(_value) - end - end - end - alias_method :to_s, :to_param - - private - def _escaped(value) - v = value.respond_to?(:to_param) ? value.to_param : value - _escape ? Rack::Mount::Utils.escape_uri(v) : v.to_s - end - end - - def optionalize_trailing_dynamic_segments(path, requirements, defaults) - path = (path =~ /^\//) ? path.dup : "/#{path}" - optional, segments = true, [] - - required_segments = requirements.keys - required_segments -= defaults.keys.compact - - old_segments = path.split('/') - old_segments.shift - length = old_segments.length - - old_segments.reverse.each_with_index do |segment, index| - required_segments.each do |required| - if segment =~ /#{required}/ - optional = false - break - end - end - - if optional - if segment == ":id" && segments.include?(":action") - optional = false - elsif segment == ":controller" || segment == ":action" || segment == ":id" - # Ignore - elsif !(segment =~ /^:\w+$/) && - !(segment =~ /^:\w+\(\.:format\)$/) - optional = false - elsif segment =~ /^:(\w+)$/ - if defaults.has_key?($1.to_sym) - defaults.delete($1.to_sym) - else - optional = false - end - end - end - - if optional && index < length - 1 - segments.unshift('(/', segment) - segments.push(')') - elsif optional - segments.unshift('/(', segment) - segments.push(')') - else - segments.unshift('/', segment) - end - end - - segments.join - end - end - end -end diff --git a/actionpack/lib/action_controller/routing/url_rewriter.rb b/actionpack/lib/action_controller/routing/url_rewriter.rb deleted file mode 100644 index 52b66c9303..0000000000 --- a/actionpack/lib/action_controller/routing/url_rewriter.rb +++ /dev/null @@ -1,204 +0,0 @@ -module ActionController - # In routes.rb one defines URL-to-controller mappings, but the reverse - # is also possible: an URL can be generated from one of your routing definitions. - # URL generation functionality is centralized in this module. - # - # See ActionController::Routing and ActionController::Resources for general - # information about routing and routes.rb. - # - # Tip: If you need to generate URLs from your models or some other place, - # then ActionController::UrlWriter is what you're looking for. Read on for - # an introduction. - # - # == URL generation from parameters - # - # As you may know, some functions - such as ActionController::Base#url_for - # and ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set - # of parameters. For example, you've probably had the chance to write code - # like this in one of your views: - # - # <%= link_to('Click here', :controller => 'users', - # :action => 'new', :message => 'Welcome!') %> - # - # #=> Generates a link to: /users/new?message=Welcome%21 - # - # link_to, and all other functions that require URL generation functionality, - # actually use ActionController::UrlWriter under the hood. And in particular, - # they use the ActionController::UrlWriter#url_for method. One can generate - # the same path as the above example by using the following code: - # - # include UrlWriter - # url_for(:controller => 'users', - # :action => 'new', - # :message => 'Welcome!', - # :only_path => true) - # # => "/users/new?message=Welcome%21" - # - # Notice the :only_path => true part. This is because UrlWriter has no - # information about the website hostname that your Rails app is serving. So if you - # want to include the hostname as well, then you must also pass the :host - # argument: - # - # include UrlWriter - # url_for(:controller => 'users', - # :action => 'new', - # :message => 'Welcome!', - # :host => 'www.example.com') # Changed this. - # # => "http://www.example.com/users/new?message=Welcome%21" - # - # By default, all controllers and views have access to a special version of url_for, - # that already knows what the current hostname is. So if you use url_for in your - # controllers or your views, then you don't need to explicitly pass the :host - # argument. - # - # For convenience reasons, mailers provide a shortcut for ActionController::UrlWriter#url_for. - # So within mailers, you only have to type 'url_for' instead of 'ActionController::UrlWriter#url_for' - # in full. However, mailers don't have hostname information, and what's why you'll still - # have to specify the :host argument when generating URLs in mailers. - # - # - # == URL generation for named routes - # - # UrlWriter also allows one to access methods that have been auto-generated from - # named routes. For example, suppose that you have a 'users' resource in your - # routes.rb: - # - # map.resources :users - # - # This generates, among other things, the method users_path. By default, - # this method is accessible from your controllers, views and mailers. If you need - # to access this auto-generated method from other places (such as a model), then - # you can do that by including ActionController::UrlWriter in your class: - # - # class User < ActiveRecord::Base - # include ActionController::UrlWriter - # - # def base_uri - # user_path(self) - # end - # end - # - # User.find(1).base_uri # => "/users/1" - module UrlWriter - def self.included(base) #:nodoc: - ActionController::Routing::Routes.install_helpers(base) - base.mattr_accessor :default_url_options - - # The default options for urls written by this writer. Typically a :host pair is provided. - base.default_url_options ||= {} - end - - # Generate a url based on the options provided, default_url_options and the - # routes defined in routes.rb. The following options are supported: - # - # * :only_path - If true, the relative url is returned. Defaults to +false+. - # * :protocol - The protocol to connect to. Defaults to 'http'. - # * :host - Specifies the host the link should be targeted at. - # If :only_path is false, this option must be - # provided either explicitly, or via +default_url_options+. - # * :port - Optionally specify the port to connect to. - # * :anchor - An anchor name to be appended to the path. - # * :skip_relative_url_root - If true, the url is not constructed using the - # +relative_url_root+ set in ActionController::Base.relative_url_root. - # * :trailing_slash - If true, adds a trailing slash, as in "/archive/2009/" - # - # Any other key (:controller, :action, etc.) given to - # +url_for+ is forwarded to the Routes module. - # - # Examples: - # - # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing' - # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok' - # url_for :controller => 'tasks', :action => 'testing', :trailing_slash=>true # => 'http://somehost.org/tasks/testing/' - # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33' - def url_for(options) - options = self.class.default_url_options.merge(options) - - url = '' - - unless options.delete(:only_path) - url << (options.delete(:protocol) || 'http') - url << '://' unless url.match("://") - - raise "Missing host to link to! Please provide :host parameter or set default_url_options[:host]" unless options[:host] - - url << options.delete(:host) - url << ":#{options.delete(:port)}" if options.key?(:port) - else - # Delete the unused options to prevent their appearance in the query string. - [:protocol, :host, :port, :skip_relative_url_root].each { |k| options.delete(k) } - end - trailing_slash = options.delete(:trailing_slash) if options.key?(:trailing_slash) - url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] - anchor = "##{CGI.escape options.delete(:anchor).to_param.to_s}" if options[:anchor] - generated = Routing::Routes.generate(options, {}) - url << (trailing_slash ? generated.sub(/\?|\z/) { "/" + $& } : generated) - url << anchor if anchor - - url - end - end - - # Rewrites URLs for Base.redirect_to and Base.url_for in the controller. - class UrlRewriter #:nodoc: - RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :skip_relative_url_root] - def initialize(request, parameters) - @request, @parameters = request, parameters - end - - def rewrite(options = {}) - rewrite_url(options) - end - - def to_str - "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}" - end - - alias_method :to_s, :to_str - - private - # Given a path and options, returns a rewritten URL string - def rewrite_url(options) - rewritten_url = "" - - unless options[:only_path] - rewritten_url << (options[:protocol] || @request.protocol) - rewritten_url << "://" unless rewritten_url.match("://") - rewritten_url << rewrite_authentication(options) - rewritten_url << (options[:host] || @request.host_with_port) - rewritten_url << ":#{options.delete(:port)}" if options.key?(:port) - end - - path = rewrite_path(options) - rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] - rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) - rewritten_url << "##{CGI.escape(options[:anchor].to_param.to_s)}" if options[:anchor] - - rewritten_url - end - - # Given a Hash of options, generates a route - def rewrite_path(options) - options = options.symbolize_keys - options.update(options[:params].symbolize_keys) if options[:params] - - if (overwrite = options.delete(:overwrite_params)) - options.update(@parameters.symbolize_keys) - options.update(overwrite.symbolize_keys) - end - - RESERVED_OPTIONS.each { |k| options.delete(k) } - - # Generates the query string, too - Routing::Routes.generate(options, @request.symbolized_path_parameters) - end - - def rewrite_authentication(options) - if options[:user] && options[:password] - "#{CGI.escape(options.delete(:user))}:#{CGI.escape(options.delete(:password))}@" - else - "" - end - end - end -end diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb new file mode 100644 index 0000000000..52b66c9303 --- /dev/null +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -0,0 +1,204 @@ +module ActionController + # In routes.rb one defines URL-to-controller mappings, but the reverse + # is also possible: an URL can be generated from one of your routing definitions. + # URL generation functionality is centralized in this module. + # + # See ActionController::Routing and ActionController::Resources for general + # information about routing and routes.rb. + # + # Tip: If you need to generate URLs from your models or some other place, + # then ActionController::UrlWriter is what you're looking for. Read on for + # an introduction. + # + # == URL generation from parameters + # + # As you may know, some functions - such as ActionController::Base#url_for + # and ActionView::Helpers::UrlHelper#link_to, can generate URLs given a set + # of parameters. For example, you've probably had the chance to write code + # like this in one of your views: + # + # <%= link_to('Click here', :controller => 'users', + # :action => 'new', :message => 'Welcome!') %> + # + # #=> Generates a link to: /users/new?message=Welcome%21 + # + # link_to, and all other functions that require URL generation functionality, + # actually use ActionController::UrlWriter under the hood. And in particular, + # they use the ActionController::UrlWriter#url_for method. One can generate + # the same path as the above example by using the following code: + # + # include UrlWriter + # url_for(:controller => 'users', + # :action => 'new', + # :message => 'Welcome!', + # :only_path => true) + # # => "/users/new?message=Welcome%21" + # + # Notice the :only_path => true part. This is because UrlWriter has no + # information about the website hostname that your Rails app is serving. So if you + # want to include the hostname as well, then you must also pass the :host + # argument: + # + # include UrlWriter + # url_for(:controller => 'users', + # :action => 'new', + # :message => 'Welcome!', + # :host => 'www.example.com') # Changed this. + # # => "http://www.example.com/users/new?message=Welcome%21" + # + # By default, all controllers and views have access to a special version of url_for, + # that already knows what the current hostname is. So if you use url_for in your + # controllers or your views, then you don't need to explicitly pass the :host + # argument. + # + # For convenience reasons, mailers provide a shortcut for ActionController::UrlWriter#url_for. + # So within mailers, you only have to type 'url_for' instead of 'ActionController::UrlWriter#url_for' + # in full. However, mailers don't have hostname information, and what's why you'll still + # have to specify the :host argument when generating URLs in mailers. + # + # + # == URL generation for named routes + # + # UrlWriter also allows one to access methods that have been auto-generated from + # named routes. For example, suppose that you have a 'users' resource in your + # routes.rb: + # + # map.resources :users + # + # This generates, among other things, the method users_path. By default, + # this method is accessible from your controllers, views and mailers. If you need + # to access this auto-generated method from other places (such as a model), then + # you can do that by including ActionController::UrlWriter in your class: + # + # class User < ActiveRecord::Base + # include ActionController::UrlWriter + # + # def base_uri + # user_path(self) + # end + # end + # + # User.find(1).base_uri # => "/users/1" + module UrlWriter + def self.included(base) #:nodoc: + ActionController::Routing::Routes.install_helpers(base) + base.mattr_accessor :default_url_options + + # The default options for urls written by this writer. Typically a :host pair is provided. + base.default_url_options ||= {} + end + + # Generate a url based on the options provided, default_url_options and the + # routes defined in routes.rb. The following options are supported: + # + # * :only_path - If true, the relative url is returned. Defaults to +false+. + # * :protocol - The protocol to connect to. Defaults to 'http'. + # * :host - Specifies the host the link should be targeted at. + # If :only_path is false, this option must be + # provided either explicitly, or via +default_url_options+. + # * :port - Optionally specify the port to connect to. + # * :anchor - An anchor name to be appended to the path. + # * :skip_relative_url_root - If true, the url is not constructed using the + # +relative_url_root+ set in ActionController::Base.relative_url_root. + # * :trailing_slash - If true, adds a trailing slash, as in "/archive/2009/" + # + # Any other key (:controller, :action, etc.) given to + # +url_for+ is forwarded to the Routes module. + # + # Examples: + # + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :port=>'8080' # => 'http://somehost.org:8080/tasks/testing' + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :anchor => 'ok', :only_path => true # => '/tasks/testing#ok' + # url_for :controller => 'tasks', :action => 'testing', :trailing_slash=>true # => 'http://somehost.org/tasks/testing/' + # url_for :controller => 'tasks', :action => 'testing', :host=>'somehost.org', :number => '33' # => 'http://somehost.org/tasks/testing?number=33' + def url_for(options) + options = self.class.default_url_options.merge(options) + + url = '' + + unless options.delete(:only_path) + url << (options.delete(:protocol) || 'http') + url << '://' unless url.match("://") + + raise "Missing host to link to! Please provide :host parameter or set default_url_options[:host]" unless options[:host] + + url << options.delete(:host) + url << ":#{options.delete(:port)}" if options.key?(:port) + else + # Delete the unused options to prevent their appearance in the query string. + [:protocol, :host, :port, :skip_relative_url_root].each { |k| options.delete(k) } + end + trailing_slash = options.delete(:trailing_slash) if options.key?(:trailing_slash) + url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] + anchor = "##{CGI.escape options.delete(:anchor).to_param.to_s}" if options[:anchor] + generated = Routing::Routes.generate(options, {}) + url << (trailing_slash ? generated.sub(/\?|\z/) { "/" + $& } : generated) + url << anchor if anchor + + url + end + end + + # Rewrites URLs for Base.redirect_to and Base.url_for in the controller. + class UrlRewriter #:nodoc: + RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :skip_relative_url_root] + def initialize(request, parameters) + @request, @parameters = request, parameters + end + + def rewrite(options = {}) + rewrite_url(options) + end + + def to_str + "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}" + end + + alias_method :to_s, :to_str + + private + # Given a path and options, returns a rewritten URL string + def rewrite_url(options) + rewritten_url = "" + + unless options[:only_path] + rewritten_url << (options[:protocol] || @request.protocol) + rewritten_url << "://" unless rewritten_url.match("://") + rewritten_url << rewrite_authentication(options) + rewritten_url << (options[:host] || @request.host_with_port) + rewritten_url << ":#{options.delete(:port)}" if options.key?(:port) + end + + path = rewrite_path(options) + rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] + rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) + rewritten_url << "##{CGI.escape(options[:anchor].to_param.to_s)}" if options[:anchor] + + rewritten_url + end + + # Given a Hash of options, generates a route + def rewrite_path(options) + options = options.symbolize_keys + options.update(options[:params].symbolize_keys) if options[:params] + + if (overwrite = options.delete(:overwrite_params)) + options.update(@parameters.symbolize_keys) + options.update(overwrite.symbolize_keys) + end + + RESERVED_OPTIONS.each { |k| options.delete(k) } + + # Generates the query string, too + Routing::Routes.generate(options, @request.symbolized_path_parameters) + end + + def rewrite_authentication(options) + if options[:user] && options[:password] + "#{CGI.escape(options.delete(:user))}:#{CGI.escape(options.delete(:password))}@" + else + "" + end + end + end +end diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb index 11cd812695..259814a322 100644 --- a/actionpack/lib/action_dispatch.rb +++ b/actionpack/lib/action_dispatch.rb @@ -41,6 +41,8 @@ module ActionDispatch autoload :Static, 'action_dispatch/middleware/static' autoload :StringCoercion, 'action_dispatch/middleware/string_coercion' + autoload :Routing, 'action_dispatch/routing' + autoload :Assertions, 'action_dispatch/testing/assertions' autoload :Integration, 'action_dispatch/testing/integration' autoload :IntegrationTest, 'action_dispatch/testing/integration' diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb new file mode 100644 index 0000000000..5a8df76326 --- /dev/null +++ b/actionpack/lib/action_dispatch/routing.rb @@ -0,0 +1,381 @@ +require 'active_support/core_ext/object/conversions' +require 'active_support/core_ext/boolean/conversions' +require 'active_support/core_ext/nil/conversions' +require 'active_support/core_ext/regexp' + +module ActionDispatch + # == Routing + # + # The routing module provides URL rewriting in native Ruby. It's a way to + # redirect incoming requests to controllers and actions. This replaces + # mod_rewrite rules. Best of all, Rails' Routing works with any web server. + # Routes are defined in config/routes.rb. + # + # Consider the following route, installed by Rails when you generate your + # application: + # + # map.connect ':controller/:action/:id' + # + # This route states that it expects requests to consist of a + # :controller followed by an :action that in turn is fed + # some :id. + # + # Suppose you get an incoming request for /blog/edit/22, you'll end up + # with: + # + # params = { :controller => 'blog', + # :action => 'edit', + # :id => '22' + # } + # + # Think of creating routes as drawing a map for your requests. The map tells + # them where to go based on some predefined pattern: + # + # ActionController::Routing::Routes.draw do |map| + # Pattern 1 tells some request to go to one place + # Pattern 2 tell them to go to another + # ... + # end + # + # The following symbols are special: + # + # :controller maps to your controller name + # :action maps to an action with your controllers + # + # Other names simply map to a parameter as in the case of :id. + # + # == Route priority + # + # Not all routes are created equally. Routes have priority defined by the + # order of appearance of the routes in the config/routes.rb file. The priority goes + # from top to bottom. The last route in that file is at the lowest priority + # and will be applied last. If no route matches, 404 is returned. + # + # Within blocks, the empty pattern is at the highest priority. + # In practice this works out nicely: + # + # ActionController::Routing::Routes.draw do |map| + # map.with_options :controller => 'blog' do |blog| + # blog.show '', :action => 'list' + # end + # map.connect ':controller/:action/:view' + # end + # + # In this case, invoking blog controller (with an URL like '/blog/') + # without parameters will activate the 'list' action by default. + # + # == Defaults routes and default parameters + # + # Setting a default route is straightforward in Rails - you simply append a + # Hash at the end of your mapping to set any default parameters. + # + # Example: + # + # ActionController::Routing:Routes.draw do |map| + # map.connect ':controller/:action/:id', :controller => 'blog' + # end + # + # This sets up +blog+ as the default controller if no other is specified. + # This means visiting '/' would invoke the blog controller. + # + # More formally, you can include arbitrary parameters in the route, thus: + # + # map.connect ':controller/:action/:id', :action => 'show', :page => 'Dashboard' + # + # This will pass the :page parameter to all incoming requests that match this route. + # + # Note: The default routes, as provided by the Rails generator, make all actions in every + # controller accessible via GET requests. You should consider removing them or commenting + # them out if you're using named routes and resources. + # + # == Named routes + # + # Routes can be named with the syntax map.name_of_route options, + # allowing for easy reference within your source as +name_of_route_url+ + # for the full URL and +name_of_route_path+ for the URI path. + # + # Example: + # + # # In routes.rb + # map.login 'login', :controller => 'accounts', :action => 'login' + # + # # With render, redirect_to, tests, etc. + # redirect_to login_url + # + # Arguments can be passed as well. + # + # redirect_to show_item_path(:id => 25) + # + # Use map.root as a shorthand to name a route for the root path "". + # + # # In routes.rb + # map.root :controller => 'blogs' + # + # # would recognize http://www.example.com/ as + # params = { :controller => 'blogs', :action => 'index' } + # + # # and provide these named routes + # root_url # => 'http://www.example.com/' + # root_path # => '' + # + # You can also specify an already-defined named route in your map.root call: + # + # # In routes.rb + # map.new_session :controller => 'sessions', :action => 'new' + # map.root :new_session + # + # Note: when using +with_options+, the route is simply named after the + # method you call on the block parameter rather than map. + # + # # In routes.rb + # map.with_options :controller => 'blog' do |blog| + # blog.show '', :action => 'list' + # blog.delete 'delete/:id', :action => 'delete' + # blog.edit 'edit/:id', :action => 'edit' + # end + # + # # provides named routes for show, delete, and edit + # link_to @article.title, show_path(:id => @article.id) + # + # == Pretty URLs + # + # Routes can generate pretty URLs. For example: + # + # map.connect 'articles/:year/:month/:day', + # :controller => 'articles', + # :action => 'find_by_date', + # :year => /\d{4}/, + # :month => /\d{1,2}/, + # :day => /\d{1,2}/ + # + # Using the route above, the URL "http://localhost:3000/articles/2005/11/06" + # maps to + # + # params = {:year => '2005', :month => '11', :day => '06'} + # + # == Regular Expressions and parameters + # You can specify a regular expression to define a format for a parameter. + # + # map.geocode 'geocode/:postalcode', :controller => 'geocode', + # :action => 'show', :postalcode => /\d{5}(-\d{4})?/ + # + # or, more formally: + # + # map.geocode 'geocode/:postalcode', :controller => 'geocode', + # :action => 'show', :requirements => { :postalcode => /\d{5}(-\d{4})?/ } + # + # Formats can include the 'ignorecase' and 'extended syntax' regular + # expression modifiers: + # + # map.geocode 'geocode/:postalcode', :controller => 'geocode', + # :action => 'show', :postalcode => /hx\d\d\s\d[a-z]{2}/i + # + # map.geocode 'geocode/:postalcode', :controller => 'geocode', + # :action => 'show',:requirements => { + # :postalcode => /# Postcode format + # \d{5} #Prefix + # (-\d{4})? #Suffix + # /x + # } + # + # Using the multiline match modifier will raise an ArgumentError. + # Encoding regular expression modifiers are silently ignored. The + # match will always use the default encoding or ASCII. + # + # == Route globbing + # + # Specifying *[string] as part of a rule like: + # + # map.connect '*path' , :controller => 'blog' , :action => 'unrecognized?' + # + # will glob all remaining parts of the route that were not recognized earlier. + # The globbed values are in params[:path] as an array of path segments. + # + # == Route conditions + # + # With conditions you can define restrictions on routes. Currently the only valid condition is :method. + # + # * :method - Allows you to specify which method can access the route. Possible values are :post, + # :get, :put, :delete and :any. The default value is :any, + # :any means that any method can access the route. + # + # Example: + # + # map.connect 'post/:id', :controller => 'posts', :action => 'show', + # :conditions => { :method => :get } + # map.connect 'post/:id', :controller => 'posts', :action => 'create_comment', + # :conditions => { :method => :post } + # + # Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same + # URL will route to the show action. + # + # == Reloading routes + # + # You can reload routes if you feel you must: + # + # ActionController::Routing::Routes.reload + # + # This will clear all named routes and reload routes.rb if the file has been modified from + # last load. To absolutely force reloading, use reload!. + # + # == Testing Routes + # + # The two main methods for testing your routes: + # + # === +assert_routing+ + # + # def test_movie_route_properly_splits + # opts = {:controller => "plugin", :action => "checkout", :id => "2"} + # assert_routing "plugin/checkout/2", opts + # end + # + # +assert_routing+ lets you test whether or not the route properly resolves into options. + # + # === +assert_recognizes+ + # + # def test_route_has_options + # opts = {:controller => "plugin", :action => "show", :id => "12"} + # assert_recognizes opts, "/plugins/show/12" + # end + # + # Note the subtle difference between the two: +assert_routing+ tests that + # a URL fits options while +assert_recognizes+ tests that a URL + # breaks into parameters properly. + # + # In tests you can simply pass the URL or named route to +get+ or +post+. + # + # def send_to_jail + # get '/jail' + # assert_response :success + # assert_template "jail/front" + # end + # + # def goes_to_login + # get login_url + # #... + # end + # + # == View a list of all your routes + # + # Run rake routes. + # + module Routing + autoload :Resources, 'action_dispatch/routing/resources' + autoload :RouteSet, 'action_dispatch/routing/route_set' + + SEPARATORS = %w( / . ? ) + + HTTP_METHODS = [:get, :head, :post, :put, :delete, :options] + + ALLOWED_REQUIREMENTS_FOR_OPTIMISATION = [:controller, :action].to_set + + # The root paths which may contain controller files + mattr_accessor :controller_paths + self.controller_paths = [] + + # A helper module to hold URL related helpers. + module Helpers + include ActionController::PolymorphicRoutes + end + + class << self + # Expects an array of controller names as the first argument. + # Executes the passed block with only the named controllers named available. + # This method is used in internal Rails testing. + def with_controllers(names) + prior_controllers = @possible_controllers + use_controllers! names + yield + ensure + use_controllers! prior_controllers + end + + # Returns an array of paths, cleaned of double-slashes and relative path references. + # * "\\\" and "//" become "\\" or "/". + # * "/foo/bar/../config" becomes "/foo/config". + # The returned array is sorted by length, descending. + def normalize_paths(paths) + # do the hokey-pokey of path normalization... + paths = paths.collect do |path| + path = path. + gsub("//", "/"). # replace double / chars with a single + gsub("\\\\", "\\"). # replace double \ chars with a single + gsub(%r{(.)[\\/]$}, '\1') # drop final / or \ if path ends with it + + # eliminate .. paths where possible + re = %r{[^/\\]+[/\\]\.\.[/\\]} + path.gsub!(re, "") while path.match(re) + path + end + + # start with longest path, first + paths = paths.uniq.sort_by { |path| - path.length } + end + + # Returns the array of controller names currently available to ActionController::Routing. + def possible_controllers + unless @possible_controllers + @possible_controllers = [] + + paths = controller_paths.select { |path| File.directory?(path) && path != "." } + + seen_paths = Hash.new {|h, k| h[k] = true; false} + normalize_paths(paths).each do |load_path| + Dir["#{load_path}/**/*_controller.rb"].collect do |path| + next if seen_paths[path.gsub(%r{^\.[/\\]}, "")] + + controller_name = path[(load_path.length + 1)..-1] + + controller_name.gsub!(/_controller\.rb\Z/, '') + @possible_controllers << controller_name + end + end + + # remove duplicates + @possible_controllers.uniq! + end + @possible_controllers + end + + # Replaces the internal list of controllers available to ActionController::Routing with the passed argument. + # ActionController::Routing.use_controllers!([ "posts", "comments", "admin/comments" ]) + def use_controllers!(controller_names) + @possible_controllers = controller_names + end + + # Returns a controller path for a new +controller+ based on a +previous+ controller path. + # Handles 4 scenarios: + # + # * stay in the previous controller: + # controller_relative_to( nil, "groups/discussion" ) # => "groups/discussion" + # + # * stay in the previous namespace: + # controller_relative_to( "posts", "groups/discussion" ) # => "groups/posts" + # + # * forced move to the root namespace: + # controller_relative_to( "/posts", "groups/discussion" ) # => "posts" + # + # * previous namespace is root: + # controller_relative_to( "posts", "anything_with_no_slashes" ) # =>"posts" + # + def controller_relative_to(controller, previous) + if controller.nil? then previous + elsif controller[0] == ?/ then controller[1..-1] + elsif %r{^(.*)/} =~ previous then "#{$1}/#{controller}" + else controller + end + end + end + + ActiveSupport::Inflector.module_eval do + # Ensures that routes are reloaded when Rails inflections are updated. + def inflections_with_route_reloading(&block) + returning(inflections_without_route_reloading(&block)) { + ActionDispatch::Routing::Routes.reload! if block_given? + } + end + + alias_method_chain :inflections, :route_reloading + end + end +end diff --git a/actionpack/lib/action_dispatch/routing/resources.rb b/actionpack/lib/action_dispatch/routing/resources.rb new file mode 100644 index 0000000000..ada0d0a648 --- /dev/null +++ b/actionpack/lib/action_dispatch/routing/resources.rb @@ -0,0 +1,687 @@ +require 'active_support/core_ext/hash/slice' +require 'active_support/core_ext/object/try' + +module ActionDispatch + module Routing + # == Overview + # + # ActionController::Resources are a way of defining RESTful \resources. A RESTful \resource, in basic terms, + # is something that can be pointed at and it will respond with a representation of the data requested. + # In real terms this could mean a user with a browser requests an HTML page, or that a desktop application + # requests XML data. + # + # RESTful design is based on the assumption that there are four generic verbs that a user of an + # application can request from a \resource (the noun). + # + # \Resources can be requested using four basic HTTP verbs (GET, POST, PUT, DELETE), the method used + # denotes the type of action that should take place. + # + # === The Different Methods and their Usage + # + # * GET - Requests for a \resource, no saving or editing of a \resource should occur in a GET request. + # * POST - Creation of \resources. + # * PUT - Editing of attributes on a \resource. + # * DELETE - Deletion of a \resource. + # + # === Examples + # + # # A GET request on the Posts resource is asking for all Posts + # GET /posts + # + # # A GET request on a single Post resource is asking for that particular Post + # GET /posts/1 + # + # # A POST request on the Posts resource is asking for a Post to be created with the supplied details + # POST /posts # with => { :post => { :title => "My Whizzy New Post", :body => "I've got a brand new combine harvester" } } + # + # # A PUT request on a single Post resource is asking for a Post to be updated + # PUT /posts # with => { :id => 1, :post => { :title => "Changed Whizzy Title" } } + # + # # A DELETE request on a single Post resource is asking for it to be deleted + # DELETE /posts # with => { :id => 1 } + # + # By using the REST convention, users of our application can assume certain things about how the data + # is requested and how it is returned. Rails simplifies the routing part of RESTful design by + # supplying you with methods to create them in your routes.rb file. + # + # Read more about REST at http://en.wikipedia.org/wiki/Representational_State_Transfer + module Resources + INHERITABLE_OPTIONS = :namespace, :shallow + + class Resource #:nodoc: + DEFAULT_ACTIONS = :index, :create, :new, :edit, :show, :update, :destroy + + attr_reader :collection_methods, :member_methods, :new_methods + attr_reader :path_prefix, :name_prefix, :path_segment + attr_reader :plural, :singular + attr_reader :options + + def initialize(entities, options) + @plural ||= entities + @singular ||= options[:singular] || plural.to_s.singularize + @path_segment = options.delete(:as) || @plural + + @options = options + + arrange_actions + add_default_actions + set_allowed_actions + set_prefixes + end + + def controller + @controller ||= "#{options[:namespace]}#{(options[:controller] || plural).to_s}" + end + + def requirements(with_id = false) + @requirements ||= @options[:requirements] || {} + @id_requirement ||= { :id => @requirements.delete(:id) || /[^#{Routing::SEPARATORS.join}]+/ } + + with_id ? @requirements.merge(@id_requirement) : @requirements + end + + def conditions + @conditions ||= @options[:conditions] || {} + end + + def path + @path ||= "#{path_prefix}/#{path_segment}" + end + + def new_path + new_action = self.options[:path_names][:new] if self.options[:path_names] + new_action ||= ActionController::Base.resources_path_names[:new] + @new_path ||= "#{path}/#{new_action}" + end + + def shallow_path_prefix + @shallow_path_prefix ||= @options[:shallow] ? @options[:namespace].try(:sub, /\/$/, '') : path_prefix + end + + def member_path + @member_path ||= "#{shallow_path_prefix}/#{path_segment}/:id" + end + + def nesting_path_prefix + @nesting_path_prefix ||= "#{shallow_path_prefix}/#{path_segment}/:#{singular}_id" + end + + def shallow_name_prefix + @shallow_name_prefix ||= @options[:shallow] ? @options[:namespace].try(:gsub, /\//, '_') : name_prefix + end + + def nesting_name_prefix + "#{shallow_name_prefix}#{singular}_" + end + + def action_separator + @action_separator ||= ActionController::Base.resource_action_separator + end + + def uncountable? + @singular.to_s == @plural.to_s + end + + def has_action?(action) + !DEFAULT_ACTIONS.include?(action) || action_allowed?(action) + end + + protected + def arrange_actions + @collection_methods = arrange_actions_by_methods(options.delete(:collection)) + @member_methods = arrange_actions_by_methods(options.delete(:member)) + @new_methods = arrange_actions_by_methods(options.delete(:new)) + end + + def add_default_actions + add_default_action(member_methods, :get, :edit) + add_default_action(new_methods, :get, :new) + end + + def set_allowed_actions + only, except = @options.values_at(:only, :except) + @allowed_actions ||= {} + + if only == :all || except == :none + only = nil + except = [] + elsif only == :none || except == :all + only = [] + except = nil + end + + if only + @allowed_actions[:only] = Array(only).map {|a| a.to_sym } + elsif except + @allowed_actions[:except] = Array(except).map {|a| a.to_sym } + end + end + + def action_allowed?(action) + only, except = @allowed_actions.values_at(:only, :except) + (!only || only.include?(action)) && (!except || !except.include?(action)) + end + + def set_prefixes + @path_prefix = options.delete(:path_prefix) + @name_prefix = options.delete(:name_prefix) + end + + def arrange_actions_by_methods(actions) + (actions || {}).inject({}) do |flipped_hash, (key, value)| + (flipped_hash[value] ||= []) << key + flipped_hash + end + end + + def add_default_action(collection, method, action) + (collection[method] ||= []).unshift(action) + end + end + + class SingletonResource < Resource #:nodoc: + def initialize(entity, options) + @singular = @plural = entity + options[:controller] ||= @singular.to_s.pluralize + super + end + + alias_method :shallow_path_prefix, :path_prefix + alias_method :shallow_name_prefix, :name_prefix + alias_method :member_path, :path + alias_method :nesting_path_prefix, :path + end + + # Creates named routes for implementing verb-oriented controllers + # for a collection \resource. + # + # For example: + # + # map.resources :messages + # + # will map the following actions in the corresponding controller: + # + # class MessagesController < ActionController::Base + # # GET messages_url + # def index + # # return all messages + # end + # + # # GET new_message_url + # def new + # # return an HTML form for describing a new message + # end + # + # # POST messages_url + # def create + # # create a new message + # end + # + # # GET message_url(:id => 1) + # def show + # # find and return a specific message + # end + # + # # GET edit_message_url(:id => 1) + # def edit + # # return an HTML form for editing a specific message + # end + # + # # PUT message_url(:id => 1) + # def update + # # find and update a specific message + # end + # + # # DELETE message_url(:id => 1) + # def destroy + # # delete a specific message + # end + # end + # + # Along with the routes themselves, +resources+ generates named routes for use in + # controllers and views. map.resources :messages produces the following named routes and helpers: + # + # Named Route Helpers + # ============ ===================================================== + # messages messages_url, hash_for_messages_url, + # messages_path, hash_for_messages_path + # + # message message_url(id), hash_for_message_url(id), + # message_path(id), hash_for_message_path(id) + # + # new_message new_message_url, hash_for_new_message_url, + # new_message_path, hash_for_new_message_path + # + # edit_message edit_message_url(id), hash_for_edit_message_url(id), + # edit_message_path(id), hash_for_edit_message_path(id) + # + # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example: + # + # redirect_to :controller => 'messages', :action => 'index' + # # and + # <%= link_to "edit this message", :controller => 'messages', :action => 'edit', :id => @message.id %> + # + # now become: + # + # redirect_to messages_url + # # and + # <%= link_to "edit this message", edit_message_url(@message) # calls @message.id automatically + # + # Since web browsers don't support the PUT and DELETE verbs, you will need to add a parameter '_method' to your + # form tags. The form helpers make this a little easier. For an update form with a @message object: + # + # <%= form_tag message_path(@message), :method => :put %> + # + # or + # + # <% form_for :message, @message, :url => message_path(@message), :html => {:method => :put} do |f| %> + # + # or + # + # <% form_for @message do |f| %> + # + # which takes into account whether @message is a new record or not and generates the + # path and method accordingly. + # + # The +resources+ method accepts the following options to customize the resulting routes: + # * :collection - Add named routes for other actions that operate on the collection. + # Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, + # an array of any of the previous, or :any if the method does not matter. + # These routes map to a URL like /messages/rss, with a route of +rss_messages_url+. + # * :member - Same as :collection, but for actions that operate on a specific member. + # * :new - Same as :collection, but for actions that operate on the new \resource action. + # * :controller - Specify the controller name for the routes. + # * :singular - Specify the singular name used in the member routes. + # * :requirements - Set custom routing parameter requirements; this is a hash of either + # regular expressions (which must match for the route to match) or extra parameters. For example: + # + # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' } + # + # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller. + # * :conditions - Specify custom routing recognition conditions. \Resources sets the :method value for the method-specific routes. + # * :as - Specify a different \resource name to use in the URL path. For example: + # # products_path == '/productos' + # map.resources :products, :as => 'productos' do |product| + # # product_reviews_path(product) == '/productos/1234/comentarios' + # product.resources :product_reviews, :as => 'comentarios' + # end + # + # * :has_one - Specify nested \resources, this is a shorthand for mapping singleton \resources beneath the current. + # * :has_many - Same has :has_one, but for plural \resources. + # + # You may directly specify the routing association with +has_one+ and +has_many+ like: + # + # map.resources :notes, :has_one => :author, :has_many => [:comments, :attachments] + # + # This is the same as: + # + # map.resources :notes do |notes| + # notes.resource :author + # notes.resources :comments + # notes.resources :attachments + # end + # + # * :path_names - Specify different path names for the actions. For example: + # # new_products_path == '/productos/nuevo' + # # bids_product_path(1) == '/productos/1/licitacoes' + # map.resources :products, :as => 'productos', :member => { :bids => :get }, :path_names => { :new => 'nuevo', :bids => 'licitacoes' } + # + # You can also set default action names from an environment, like this: + # config.action_controller.resources_path_names = { :new => 'nuevo', :edit => 'editar' } + # + # * :path_prefix - Set a prefix to the routes with required route variables. + # + # Weblog comments usually belong to a post, so you might use +resources+ like: + # + # map.resources :articles + # map.resources :comments, :path_prefix => '/articles/:article_id' + # + # You can nest +resources+ calls to set this automatically: + # + # map.resources :articles do |article| + # article.resources :comments + # end + # + # The comment \resources work the same, but must now include a value for :article_id. + # + # article_comments_url(@article) + # article_comment_url(@article, @comment) + # + # article_comments_url(:article_id => @article) + # article_comment_url(:article_id => @article, :id => @comment) + # + # If you don't want to load all objects from the database you might want to use the article_id directly: + # + # articles_comments_url(@comment.article_id, @comment) + # + # * :name_prefix - Define a prefix for all generated routes, usually ending in an underscore. + # Use this if you have named routes that may clash. + # + # map.resources :tags, :path_prefix => '/books/:book_id', :name_prefix => 'book_' + # map.resources :tags, :path_prefix => '/toys/:toy_id', :name_prefix => 'toy_' + # + # You may also use :name_prefix to override the generic named routes in a nested \resource: + # + # map.resources :articles do |article| + # article.resources :comments, :name_prefix => nil + # end + # + # This will yield named \resources like so: + # + # comments_url(@article) + # comment_url(@article, @comment) + # + # * :shallow - If true, paths for nested resources which reference a specific member + # (ie. those with an :id parameter) will not use the parent path prefix or name prefix. + # + # The :shallow option is inherited by any nested resource(s). + # + # For example, 'users', 'posts' and 'comments' all use shallow paths with the following nested resources: + # + # map.resources :users, :shallow => true do |user| + # user.resources :posts do |post| + # post.resources :comments + # end + # end + # # --> GET /users/1/posts (maps to the PostsController#index action as usual) + # # also adds the usual named route called "user_posts" + # # --> GET /posts/2 (maps to the PostsController#show action as if it were not nested) + # # also adds the named route called "post" + # # --> GET /posts/2/comments (maps to the CommentsController#index action) + # # also adds the named route called "post_comments" + # # --> GET /comments/2 (maps to the CommentsController#show action as if it were not nested) + # # also adds the named route called "comment" + # + # You may also use :shallow in combination with the +has_one+ and +has_many+ shorthand notations like: + # + # map.resources :users, :has_many => { :posts => :comments }, :shallow => true + # + # * :only and :except - Specify which of the seven default actions should be routed to. + # + # :only and :except may be set to :all, :none, an action name or a + # list of action names. By default, routes are generated for all seven actions. + # + # For example: + # + # map.resources :posts, :only => [:index, :show] do |post| + # post.resources :comments, :except => [:update, :destroy] + # end + # # --> GET /posts (maps to the PostsController#index action) + # # --> POST /posts (fails) + # # --> GET /posts/1 (maps to the PostsController#show action) + # # --> DELETE /posts/1 (fails) + # # --> POST /posts/1/comments (maps to the CommentsController#create action) + # # --> PUT /posts/1/comments/1 (fails) + # + # If map.resources is called with multiple resources, they all get the same options applied. + # + # Examples: + # + # map.resources :messages, :path_prefix => "/thread/:thread_id" + # # --> GET /thread/7/messages/1 + # + # map.resources :messages, :collection => { :rss => :get } + # # --> GET /messages/rss (maps to the #rss action) + # # also adds a named route called "rss_messages" + # + # map.resources :messages, :member => { :mark => :post } + # # --> POST /messages/1/mark (maps to the #mark action) + # # also adds a named route called "mark_message" + # + # map.resources :messages, :new => { :preview => :post } + # # --> POST /messages/new/preview (maps to the #preview action) + # # also adds a named route called "preview_new_message" + # + # map.resources :messages, :new => { :new => :any, :preview => :post } + # # --> POST /messages/new/preview (maps to the #preview action) + # # also adds a named route called "preview_new_message" + # # --> /messages/new can be invoked via any request method + # + # map.resources :messages, :controller => "categories", + # :path_prefix => "/category/:category_id", + # :name_prefix => "category_" + # # --> GET /categories/7/messages/1 + # # has named route "category_message" + # + # The +resources+ method sets HTTP method restrictions on the routes it generates. For example, making an + # HTTP POST on new_message_url will raise a RoutingError exception. The default route in + # config/routes.rb overrides this and allows invalid HTTP methods for \resource routes. + def resources(*entities, &block) + options = entities.extract_options! + entities.each { |entity| map_resource(entity, options.dup, &block) } + end + + # Creates named routes for implementing verb-oriented controllers for a singleton \resource. + # A singleton \resource is global to its current context. For unnested singleton \resources, + # the \resource is global to the current user visiting the application, such as a user's + # /account profile. For nested singleton \resources, the \resource is global to its parent + # \resource, such as a projects \resource that has_one :project_manager. + # The project_manager should be mapped as a singleton \resource under projects: + # + # map.resources :projects do |project| + # project.resource :project_manager + # end + # + # See +resources+ for general conventions. These are the main differences: + # * A singular name is given to map.resource. The default controller name is still taken from the plural name. + # * To specify a custom plural name, use the :plural option. There is no :singular option. + # * No default index route is created for the singleton \resource controller. + # * When nesting singleton \resources, only the singular name is used as the path prefix (example: 'account/messages/1') + # + # For example: + # + # map.resource :account + # + # maps these actions in the Accounts controller: + # + # class AccountsController < ActionController::Base + # # GET new_account_url + # def new + # # return an HTML form for describing the new account + # end + # + # # POST account_url + # def create + # # create an account + # end + # + # # GET account_url + # def show + # # find and return the account + # end + # + # # GET edit_account_url + # def edit + # # return an HTML form for editing the account + # end + # + # # PUT account_url + # def update + # # find and update the account + # end + # + # # DELETE account_url + # def destroy + # # delete the account + # end + # end + # + # Along with the routes themselves, +resource+ generates named routes for + # use in controllers and views. map.resource :account produces + # these named routes and helpers: + # + # Named Route Helpers + # ============ ============================================= + # account account_url, hash_for_account_url, + # account_path, hash_for_account_path + # + # new_account new_account_url, hash_for_new_account_url, + # new_account_path, hash_for_new_account_path + # + # edit_account edit_account_url, hash_for_edit_account_url, + # edit_account_path, hash_for_edit_account_path + def resource(*entities, &block) + options = entities.extract_options! + entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } + end + + private + def map_resource(entities, options = {}, &block) + resource = Resource.new(entities, options) + + with_options :controller => resource.controller do |map| + map_associations(resource, options) + + if block_given? + with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) + end + + map_collection_actions(map, resource) + map_default_collection_actions(map, resource) + map_new_actions(map, resource) + map_member_actions(map, resource) + end + end + + def map_singleton_resource(entities, options = {}, &block) + resource = SingletonResource.new(entities, options) + + with_options :controller => resource.controller do |map| + map_associations(resource, options) + + if block_given? + with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) + end + + map_collection_actions(map, resource) + map_new_actions(map, resource) + map_member_actions(map, resource) + map_default_singleton_actions(map, resource) + end + end + + def map_associations(resource, options) + map_has_many_associations(resource, options.delete(:has_many), options) if options[:has_many] + + path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}" + name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" + + Array(options[:has_one]).each do |association| + resource(association, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => path_prefix, :name_prefix => name_prefix)) + end + end + + def map_has_many_associations(resource, associations, options) + case associations + when Hash + associations.each do |association,has_many| + map_has_many_associations(resource, association, options.merge(:has_many => has_many)) + end + when Array + associations.each do |association| + map_has_many_associations(resource, association, options) + end + when Symbol, String + resources(associations, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, :has_many => options[:has_many])) + else + end + end + + def map_collection_actions(map, resource) + resource.collection_methods.each do |method, actions| + actions.each do |action| + [method].flatten.each do |m| + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= action + + map_resource_routes(map, resource, action, "#{resource.path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.name_prefix}#{resource.plural}", m) + end + end + end + end + + def map_default_collection_actions(map, resource) + index_route_name = "#{resource.name_prefix}#{resource.plural}" + + if resource.uncountable? + index_route_name << "_index" + end + + map_resource_routes(map, resource, :index, resource.path, index_route_name) + map_resource_routes(map, resource, :create, resource.path, index_route_name) + end + + def map_default_singleton_actions(map, resource) + map_resource_routes(map, resource, :create, resource.path, "#{resource.shallow_name_prefix}#{resource.singular}") + end + + def map_new_actions(map, resource) + resource.new_methods.each do |method, actions| + actions.each do |action| + route_path = resource.new_path + route_name = "new_#{resource.name_prefix}#{resource.singular}" + + unless action == :new + route_path = "#{route_path}#{resource.action_separator}#{action}" + route_name = "#{action}_#{route_name}" + end + + map_resource_routes(map, resource, action, route_path, route_name, method) + end + end + end + + def map_member_actions(map, resource) + resource.member_methods.each do |method, actions| + actions.each do |action| + [method].flatten.each do |m| + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= ActionController::Base.resources_path_names[action] || action + + map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true }) + end + end + end + + route_path = "#{resource.shallow_name_prefix}#{resource.singular}" + map_resource_routes(map, resource, :show, resource.member_path, route_path) + map_resource_routes(map, resource, :update, resource.member_path, route_path) + map_resource_routes(map, resource, :destroy, resource.member_path, route_path) + end + + def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} ) + if resource.has_action?(action) + action_options = action_options_for(action, resource, method, resource_options) + formatted_route_path = "#{route_path}.:format" + + if route_name && @set.named_routes[route_name.to_sym].nil? + map.named_route(route_name, formatted_route_path, action_options) + else + map.connect(formatted_route_path, action_options) + end + end + end + + def add_conditions_for(conditions, method) + returning({:conditions => conditions.dup}) do |options| + options[:conditions][:method] = method unless method == :any + end + end + + def action_options_for(action, resource, method = nil, resource_options = {}) + default_options = { :action => action.to_s } + require_id = !resource.kind_of?(SingletonResource) + force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource) + + case default_options[:action] + when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) + when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) + when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) + when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) + when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) + else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id)) + end + end + end + end +end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb new file mode 100644 index 0000000000..9e40108d00 --- /dev/null +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -0,0 +1,699 @@ +require 'rack/mount' +require 'forwardable' + +module ActionDispatch + module Routing + class RouteSet #:nodoc: + NotFound = lambda { |env| + raise ActionController::RoutingError, "No route matches #{env[::Rack::Mount::Const::PATH_INFO].inspect} with #{env.inspect}" + } + + PARAMETERS_KEY = 'action_dispatch.request.path_parameters' + + class Dispatcher + def initialize(options = {}) + defaults = options[:defaults] + @glob_param = options.delete(:glob) + end + + def call(env) + params = env[PARAMETERS_KEY] + merge_default_action!(params) + split_glob_param!(params) if @glob_param + params.each { |key, value| params[key] = URI.unescape(value) if value.is_a?(String) } + + if env['action_controller.recognize'] + [200, {}, params] + else + controller = controller(params) + controller.action(params[:action]).call(env) + end + end + + private + def controller(params) + if params && params.has_key?(:controller) + controller = "#{params[:controller].camelize}Controller" + ActiveSupport::Inflector.constantize(controller) + end + end + + def merge_default_action!(params) + params[:action] ||= 'index' + end + + def split_glob_param!(params) + params[@glob_param] = params[@glob_param].split('/').map { |v| URI.unescape(v) } + end + end + + module RouteExtensions + def segment_keys + conditions[:path_info].names.compact.map { |key| key.to_sym } + end + end + + # Mapper instances are used to build routes. The object passed to the draw + # block in config/routes.rb is a Mapper instance. + # + # Mapper instances have relatively few instance methods, in order to avoid + # clashes with named routes. + class Mapper #:doc: + include Routing::Resources + + def initialize(set) #:nodoc: + @set = set + end + + # Create an unnamed route with the provided +path+ and +options+. See + # ActionDispatch::Routing for an introduction to routes. + def connect(path, options = {}) + @set.add_route(path, options) + end + + # Creates a named route called "root" for matching the root level request. + def root(options = {}) + if options.is_a?(Symbol) + if source_route = @set.named_routes.routes[options] + options = source_route.defaults.merge({ :conditions => source_route.conditions }) + end + end + named_route("root", '', options) + end + + def named_route(name, path, options = {}) #:nodoc: + @set.add_named_route(name, path, options) + end + + # Enables the use of resources in a module by setting the name_prefix, path_prefix, and namespace for the model. + # Example: + # + # map.namespace(:admin) do |admin| + # admin.resources :products, + # :has_many => [ :tags, :images, :variants ] + # end + # + # This will create +admin_products_url+ pointing to "admin/products", which will look for an Admin::ProductsController. + # It'll also create +admin_product_tags_url+ pointing to "admin/products/#{product_id}/tags", which will look for + # Admin::TagsController. + def namespace(name, options = {}, &block) + if options[:namespace] + with_options({:path_prefix => "#{options.delete(:path_prefix)}/#{name}", :name_prefix => "#{options.delete(:name_prefix)}#{name}_", :namespace => "#{options.delete(:namespace)}#{name}/" }.merge(options), &block) + else + with_options({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(options), &block) + end + end + + def method_missing(route_name, *args, &proc) #:nodoc: + super unless args.length >= 1 && proc.nil? + @set.add_named_route(route_name, *args) + end + end + + # A NamedRouteCollection instance is a collection of named routes, and also + # maintains an anonymous module that can be used to install helpers for the + # named routes. + class NamedRouteCollection #:nodoc: + include Enumerable + attr_reader :routes, :helpers + + def initialize + clear! + end + + def clear! + @routes = {} + @helpers = [] + + @module ||= Module.new + @module.instance_methods.each do |selector| + @module.class_eval { remove_method selector } + end + end + + def add(name, route) + routes[name.to_sym] = route + define_named_route_methods(name, route) + end + + def get(name) + routes[name.to_sym] + end + + alias []= add + alias [] get + alias clear clear! + + def each + routes.each { |name, route| yield name, route } + self + end + + def names + routes.keys + end + + def length + routes.length + end + + def reset! + old_routes = routes.dup + clear! + old_routes.each do |name, route| + add(name, route) + end + end + + def install(destinations = [ActionController::Base, ActionView::Base], regenerate = false) + reset! if regenerate + Array(destinations).each do |dest| + dest.__send__(:include, @module) + end + end + + private + def url_helper_name(name, kind = :url) + :"#{name}_#{kind}" + end + + def hash_access_name(name, kind = :url) + :"hash_for_#{name}_#{kind}" + end + + def define_named_route_methods(name, route) + {:url => {:only_path => false}, :path => {:only_path => true}}.each do |kind, opts| + hash = route.defaults.merge(:use_route => name).merge(opts) + define_hash_access route, name, kind, hash + define_url_helper route, name, kind, hash + end + end + + def named_helper_module_eval(code, *args) + @module.module_eval(code, *args) + end + + def define_hash_access(route, name, kind, options) + selector = hash_access_name(name, kind) + named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks + def #{selector}(options = nil) # def hash_for_users_url(options = nil) + options ? #{options.inspect}.merge(options) : #{options.inspect} # options ? {:only_path=>false}.merge(options) : {:only_path=>false} + end # end + protected :#{selector} # protected :hash_for_users_url + end_eval + helpers << selector + end + + def define_url_helper(route, name, kind, options) + selector = url_helper_name(name, kind) + # The segment keys used for positional parameters + + hash_access_method = hash_access_name(name, kind) + + # allow ordered parameters to be associated with corresponding + # dynamic segments, so you can do + # + # foo_url(bar, baz, bang) + # + # instead of + # + # foo_url(:bar => bar, :baz => baz, :bang => bang) + # + # Also allow options hash, so you can do + # + # foo_url(bar, baz, bang, :sort_by => 'baz') + # + named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks + def #{selector}(*args) # def users_url(*args) + # + opts = if args.empty? || Hash === args.first # opts = if args.empty? || Hash === args.first + args.first || {} # args.first || {} + else # else + options = args.extract_options! # options = args.extract_options! + args = args.zip(#{route.segment_keys.inspect}).inject({}) do |h, (v, k)| # args = args.zip([]).inject({}) do |h, (v, k)| + h[k] = v # h[k] = v + h # h + end # end + options.merge(args) # options.merge(args) + end # end + # + url_for(#{hash_access_method}(opts)) # url_for(hash_for_users_url(opts)) + # + end # end + #Add an alias to support the now deprecated formatted_* URL. # #Add an alias to support the now deprecated formatted_* URL. + def formatted_#{selector}(*args) # def formatted_users_url(*args) + ActiveSupport::Deprecation.warn( # ActiveSupport::Deprecation.warn( + "formatted_#{selector}() has been deprecated. " + # "formatted_users_url() has been deprecated. " + + "Please pass format to the standard " + # "Please pass format to the standard " + + "#{selector} method instead.", caller) # "users_url method instead.", caller) + #{selector}(*args) # users_url(*args) + end # end + protected :#{selector} # protected :users_url + end_eval + helpers << selector + end + end + + attr_accessor :routes, :named_routes, :configuration_files + + def initialize + self.configuration_files = [] + + self.routes = [] + self.named_routes = NamedRouteCollection.new + + clear! + end + + def draw + clear! + yield Mapper.new(self) + @set.add_route(NotFound) + install_helpers + @set.freeze + end + + def clear! + routes.clear + named_routes.clear + @set = ::Rack::Mount::RouteSet.new(:parameters_key => PARAMETERS_KEY) + end + + def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false) + Array(destinations).each { |d| d.module_eval { include Helpers } } + named_routes.install(destinations, regenerate_code) + end + + def empty? + routes.empty? + end + + def add_configuration_file(path) + self.configuration_files << path + end + + # Deprecated accessor + def configuration_file=(path) + add_configuration_file(path) + end + + # Deprecated accessor + def configuration_file + configuration_files + end + + def load! + Routing.use_controllers!(nil) # Clear the controller cache so we may discover new ones + load_routes! + end + + # reload! will always force a reload whereas load checks the timestamp first + alias reload! load! + + def reload + if configuration_files.any? && @routes_last_modified + if routes_changed_at == @routes_last_modified + return # routes didn't change, don't reload + else + @routes_last_modified = routes_changed_at + end + end + + load! + end + + def load_routes! + if configuration_files.any? + configuration_files.each { |config| load(config) } + @routes_last_modified = routes_changed_at + else + draw do |map| + map.connect ":controller/:action/:id" + end + end + end + + def routes_changed_at + routes_changed_at = nil + + configuration_files.each do |config| + config_changed_at = File.stat(config).mtime + + if routes_changed_at.nil? || config_changed_at > routes_changed_at + routes_changed_at = config_changed_at + end + end + + routes_changed_at + end + + def add_route(path, options = {}) + options = options.dup + + if conditions = options.delete(:conditions) + conditions = conditions.dup + method = [conditions.delete(:method)].flatten.compact + method.map! { |m| + m = m.to_s.upcase + + if m == "HEAD" + raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" + end + + unless HTTP_METHODS.include?(m.downcase.to_sym) + raise ArgumentError, "Invalid HTTP method specified in route conditions" + end + + m + } + + if method.length > 1 + method = Regexp.union(*method) + elsif method.length == 1 + method = method.first + else + method = nil + end + end + + path_prefix = options.delete(:path_prefix) + name_prefix = options.delete(:name_prefix) + namespace = options.delete(:namespace) + + name = options.delete(:_name) + name = "#{name_prefix}#{name}" if name_prefix + + requirements = options.delete(:requirements) || {} + defaults = options.delete(:defaults) || {} + options.each do |k, v| + if v.is_a?(Regexp) + if value = options.delete(k) + requirements[k.to_sym] = value + end + else + value = options.delete(k) + defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param + end + end + + requirements.each do |_, requirement| + if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} + raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" + end + if requirement.multiline? + raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" + end + end + + possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } + requirements[:controller] ||= Regexp.union(*possible_names) + + if defaults[:controller] + defaults[:action] ||= 'index' + defaults[:controller] = defaults[:controller].to_s + defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace + end + + if defaults[:action] + defaults[:action] = defaults[:action].to_s + end + + if path.is_a?(String) + path = "#{path_prefix}/#{path}" if path_prefix + path = path.gsub('.:format', '(.:format)') + path = optionalize_trailing_dynamic_segments(path, requirements, defaults) + glob = $1.to_sym if path =~ /\/\*(\w+)$/ + path = ::Rack::Mount::Utils.normalize_path(path) + path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) + + if glob && !defaults[glob].blank? + raise ActionController::RoutingError, "paths cannot have non-empty default values" + end + end + + app = Dispatcher.new(:defaults => defaults, :glob => glob) + + conditions = {} + conditions[:request_method] = method if method + conditions[:path_info] = path if path + + route = @set.add_route(app, conditions, defaults, name) + route.extend(RouteExtensions) + routes << route + route + end + + def add_named_route(name, path, options = {}) + options[:_name] = name + route = add_route(path, options) + named_routes[route.name] = route + route + end + + def options_as_params(options) + # If an explicit :controller was given, always make :action explicit + # too, so that action expiry works as expected for things like + # + # generate({:controller => 'content'}, {:controller => 'content', :action => 'show'}) + # + # (the above is from the unit tests). In the above case, because the + # controller was explicitly given, but no action, the action is implied to + # be "index", not the recalled action of "show". + # + # great fun, eh? + + options_as_params = options.clone + options_as_params[:action] ||= 'index' if options[:controller] + options_as_params[:action] = options_as_params[:action].to_s if options_as_params[:action] + options_as_params + end + + def build_expiry(options, recall) + recall.inject({}) do |expiry, (key, recalled_value)| + expiry[key] = (options.key?(key) && options[key].to_param != recalled_value.to_param) + expiry + end + end + + # Generate the path indicated by the arguments, and return an array of + # the keys that were not used to generate it. + def extra_keys(options, recall={}) + generate_extras(options, recall).last + end + + def generate_extras(options, recall={}) + generate(options, recall, :generate_extras) + end + + def generate(options, recall = {}, method = :generate) + options, recall = options.dup, recall.dup + named_route = options.delete(:use_route) + + options = options_as_params(options) + expire_on = build_expiry(options, recall) + + recall[:action] ||= 'index' if options[:controller] || recall[:controller] + + if recall[:controller] && (!options.has_key?(:controller) || options[:controller] == recall[:controller]) + options[:controller] = recall.delete(:controller) + + if recall[:action] && (!options.has_key?(:action) || options[:action] == recall[:action]) + options[:action] = recall.delete(:action) + + if recall[:id] && (!options.has_key?(:id) || options[:id] == recall[:id]) + options[:id] = recall.delete(:id) + end + end + end + + options[:controller] = options[:controller].to_s if options[:controller] + + if !named_route && expire_on[:controller] && options[:controller] && options[:controller][0] != ?/ + old_parts = recall[:controller].split('/') + new_parts = options[:controller].split('/') + parts = old_parts[0..-(new_parts.length + 1)] + new_parts + options[:controller] = parts.join('/') + end + + options[:controller] = options[:controller][1..-1] if options[:controller] && options[:controller][0] == ?/ + + merged = options.merge(recall) + if options.has_key?(:action) && options[:action].nil? + options.delete(:action) + recall[:action] = 'index' + end + recall[:action] = options.delete(:action) if options[:action] == 'index' + + path = _uri(named_route, options, recall) + if path && method == :generate_extras + uri = URI(path) + extras = uri.query ? + Rack::Utils.parse_nested_query(uri.query).keys.map { |k| k.to_sym } : + [] + [uri.path, extras] + elsif path + path + else + raise ActionController::RoutingError, "No route matches #{options.inspect}" + end + rescue Rack::Mount::RoutingError + raise ActionController::RoutingError, "No route matches #{options.inspect}" + end + + def call(env) + @set.call(env) + rescue ActionController::RoutingError => e + raise e if env['action_controller.rescue_error'] == false + + method, path = env['REQUEST_METHOD'].downcase.to_sym, env['PATH_INFO'] + + # Route was not recognized. Try to find out why (maybe wrong verb). + allows = HTTP_METHODS.select { |verb| + begin + recognize_path(path, {:method => verb}, false) + rescue ActionController::RoutingError + nil + end + } + + if !HTTP_METHODS.include?(method) + raise ActionController::NotImplemented.new(*allows) + elsif !allows.empty? + raise ActionController::MethodNotAllowed.new(*allows) + else + raise e + end + end + + def recognize(request) + params = recognize_path(request.path, extract_request_environment(request)) + request.path_parameters = params.with_indifferent_access + "#{params[:controller].to_s.camelize}Controller".constantize + end + + def recognize_path(path, environment = {}, rescue_error = true) + method = (environment[:method] || "GET").to_s.upcase + + begin + env = Rack::MockRequest.env_for(path, {:method => method}) + rescue URI::InvalidURIError => e + raise ActionController::RoutingError, e.message + end + + env['action_controller.recognize'] = true + env['action_controller.rescue_error'] = rescue_error + status, headers, body = call(env) + body + end + + # Subclasses and plugins may override this method to extract further attributes + # from the request, for use by route conditions and such. + def extract_request_environment(request) + { :method => request.method } + end + + private + def _uri(named_route, params, recall) + params = URISegment.wrap_values(params) + recall = URISegment.wrap_values(recall) + + unless result = @set.generate(:path_info, named_route, params, recall) + return + end + + uri, params = result + params.each do |k, v| + if v._value + params[k] = v._value + else + params.delete(k) + end + end + + uri << "?#{Rack::Mount::Utils.build_nested_query(params)}" if uri && params.any? + uri + end + + class URISegment < Struct.new(:_value, :_escape) + EXCLUDED = [:controller] + + def self.wrap_values(hash) + hash.inject({}) { |h, (k, v)| + h[k] = new(v, !EXCLUDED.include?(k.to_sym)) + h + } + end + + extend Forwardable + def_delegators :_value, :==, :eql?, :hash + + def to_param + @to_param ||= begin + if _value.is_a?(Array) + _value.map { |v| _escaped(v) }.join('/') + else + _escaped(_value) + end + end + end + alias_method :to_s, :to_param + + private + def _escaped(value) + v = value.respond_to?(:to_param) ? value.to_param : value + _escape ? Rack::Mount::Utils.escape_uri(v) : v.to_s + end + end + + def optionalize_trailing_dynamic_segments(path, requirements, defaults) + path = (path =~ /^\//) ? path.dup : "/#{path}" + optional, segments = true, [] + + required_segments = requirements.keys + required_segments -= defaults.keys.compact + + old_segments = path.split('/') + old_segments.shift + length = old_segments.length + + old_segments.reverse.each_with_index do |segment, index| + required_segments.each do |required| + if segment =~ /#{required}/ + optional = false + break + end + end + + if optional + if segment == ":id" && segments.include?(":action") + optional = false + elsif segment == ":controller" || segment == ":action" || segment == ":id" + # Ignore + elsif !(segment =~ /^:\w+$/) && + !(segment =~ /^:\w+\(\.:format\)$/) + optional = false + elsif segment =~ /^:(\w+)$/ + if defaults.has_key?($1.to_sym) + defaults.delete($1.to_sym) + else + optional = false + end + end + end + + if optional && index < length - 1 + segments.unshift('(/', segment) + segments.push(')') + elsif optional + segments.unshift('/(', segment) + segments.push(')') + else + segments.unshift('/', segment) + end + end + + segments.join + end + end + end +end diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 5b47de19ae..4f1bafbad1 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -41,7 +41,7 @@ class ResourcesTest < ActionController::TestCase end def test_should_arrange_actions - resource = ActionController::Resources::Resource.new(:messages, + resource = ActionDispatch::Routing::Resources::Resource.new(:messages, :collection => { :rss => :get, :reorder => :post, :csv => :post }, :member => { :rss => :get, :atom => :get, :upload => :post, :fix => :post }, :new => { :preview => :get, :draft => :get }) @@ -54,18 +54,18 @@ class ResourcesTest < ActionController::TestCase end def test_should_resource_controller_name_equal_resource_name_by_default - resource = ActionController::Resources::Resource.new(:messages, {}) + resource = ActionDispatch::Routing::Resources::Resource.new(:messages, {}) assert_equal 'messages', resource.controller end def test_should_resource_controller_name_equal_controller_option - resource = ActionController::Resources::Resource.new(:messages, :controller => 'posts') + resource = ActionDispatch::Routing::Resources::Resource.new(:messages, :controller => 'posts') assert_equal 'posts', resource.controller end def test_should_all_singleton_paths_be_the_same [ :path, :nesting_path_prefix, :member_path ].each do |method| - resource = ActionController::Resources::SingletonResource.new(:messages, :path_prefix => 'admin') + resource = ActionDispatch::Routing::Resources::SingletonResource.new(:messages, :path_prefix => 'admin') assert_equal 'admin/messages', resource.send(method) end end @@ -121,7 +121,7 @@ class ResourcesTest < ActionController::TestCase end def test_override_paths_for_default_restful_actions - resource = ActionController::Resources::Resource.new(:messages, + resource = ActionDispatch::Routing::Resources::Resource.new(:messages, :path_names => {:new => 'nuevo', :edit => 'editar'}) assert_equal resource.new_path, "#{resource.path}/nuevo" end @@ -135,7 +135,7 @@ class ResourcesTest < ActionController::TestCase def test_with_custom_conditions with_restful_routing :messages, :conditions => { :subdomain => 'app' } do - assert ActionController::Routing::Routes.recognize_path("/messages", :method => :get, :subdomain => 'app') + assert ActionDispatch::Routing::Routes.recognize_path("/messages", :method => :get, :subdomain => 'app') end end -- cgit v1.2.3 From 35576a237e2c721dca8be0f8f0d653ae8bc07389 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 10:16:19 -0500 Subject: Add arel to AMo gemfile --- activemodel/Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/activemodel/Gemfile b/activemodel/Gemfile index 289d696792..a192fdaf82 100644 --- a/activemodel/Gemfile +++ b/activemodel/Gemfile @@ -3,6 +3,7 @@ rails_root = Pathname.new(File.dirname(__FILE__)).join("..") Gem.sources.each { |uri| source uri } gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport") +gem "arel", :git => "git://github.com/rails/arel.git" only :test do gem "sqlite3-ruby" -- cgit v1.2.3 From df68cae0c0837fbf23fdfc3f04162307ffa8f2c1 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 10:46:27 -0500 Subject: Group together all the old routing dsl logic --- actionpack/lib/action_controller.rb | 1 - actionpack/lib/action_controller/deprecated.rb | 1 - actionpack/lib/action_dispatch/routing.rb | 2 +- actionpack/lib/action_dispatch/routing/mapper.rb | 879 +++++++++++++++++++++ .../lib/action_dispatch/routing/resources.rb | 687 ---------------- .../lib/action_dispatch/routing/route_set.rb | 206 +---- actionpack/test/controller/resources_test.rb | 10 +- 7 files changed, 887 insertions(+), 899 deletions(-) create mode 100644 actionpack/lib/action_dispatch/routing/mapper.rb delete mode 100644 actionpack/lib/action_dispatch/routing/resources.rb diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index b5091f39f9..9db1a71202 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -26,7 +26,6 @@ module ActionController autoload :PerformanceTest, 'action_controller/deprecated/performance_test' autoload :PolymorphicRoutes, 'action_controller/polymorphic_routes' autoload :RecordIdentifier, 'action_controller/record_identifier' - autoload :Resources, 'action_controller/deprecated' autoload :Routing, 'action_controller/deprecated' autoload :SessionManagement, 'action_controller/metal/session_management' autoload :TestCase, 'action_controller/testing/test_case' diff --git a/actionpack/lib/action_controller/deprecated.rb b/actionpack/lib/action_controller/deprecated.rb index 23fe6a4c3a..589061e77c 100644 --- a/actionpack/lib/action_controller/deprecated.rb +++ b/actionpack/lib/action_controller/deprecated.rb @@ -1,5 +1,4 @@ ActionController::AbstractRequest = ActionController::Request = ActionDispatch::Request ActionController::AbstractResponse = ActionController::Response = ActionDispatch::Response ActionController::Routing = ActionDispatch::Routing -ActionDispatch::Resources = ActionDispatch::Routing::Resources ActionController::Routing::Routes = ActionDispatch::Routing::RouteSet.new diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 5a8df76326..0647d051cb 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -260,7 +260,7 @@ module ActionDispatch # Run rake routes. # module Routing - autoload :Resources, 'action_dispatch/routing/resources' + autoload :Mapper, 'action_dispatch/routing/mapper' autoload :RouteSet, 'action_dispatch/routing/route_set' SEPARATORS = %w( / . ? ) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb new file mode 100644 index 0000000000..44afbb9cd7 --- /dev/null +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -0,0 +1,879 @@ +module ActionDispatch + module Routing + # Mapper instances are used to build routes. The object passed to the draw + # block in config/routes.rb is a Mapper instance. + # + # Mapper instances have relatively few instance methods, in order to avoid + # clashes with named routes. + # + # == Overview + # + # ActionController::Resources are a way of defining RESTful \resources. A RESTful \resource, in basic terms, + # is something that can be pointed at and it will respond with a representation of the data requested. + # In real terms this could mean a user with a browser requests an HTML page, or that a desktop application + # requests XML data. + # + # RESTful design is based on the assumption that there are four generic verbs that a user of an + # application can request from a \resource (the noun). + # + # \Resources can be requested using four basic HTTP verbs (GET, POST, PUT, DELETE), the method used + # denotes the type of action that should take place. + # + # === The Different Methods and their Usage + # + # * GET - Requests for a \resource, no saving or editing of a \resource should occur in a GET request. + # * POST - Creation of \resources. + # * PUT - Editing of attributes on a \resource. + # * DELETE - Deletion of a \resource. + # + # === Examples + # + # # A GET request on the Posts resource is asking for all Posts + # GET /posts + # + # # A GET request on a single Post resource is asking for that particular Post + # GET /posts/1 + # + # # A POST request on the Posts resource is asking for a Post to be created with the supplied details + # POST /posts # with => { :post => { :title => "My Whizzy New Post", :body => "I've got a brand new combine harvester" } } + # + # # A PUT request on a single Post resource is asking for a Post to be updated + # PUT /posts # with => { :id => 1, :post => { :title => "Changed Whizzy Title" } } + # + # # A DELETE request on a single Post resource is asking for it to be deleted + # DELETE /posts # with => { :id => 1 } + # + # By using the REST convention, users of our application can assume certain things about how the data + # is requested and how it is returned. Rails simplifies the routing part of RESTful design by + # supplying you with methods to create them in your routes.rb file. + # + # Read more about REST at http://en.wikipedia.org/wiki/Representational_State_Transfer + class Mapper #:doc: + def initialize(set) #:nodoc: + @set = set + end + + # Create an unnamed route with the provided +path+ and +options+. See + # ActionDispatch::Routing for an introduction to routes. + def connect(path, options = {}) + options = options.dup + + if conditions = options.delete(:conditions) + conditions = conditions.dup + method = [conditions.delete(:method)].flatten.compact + method.map! { |m| + m = m.to_s.upcase + + if m == "HEAD" + raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" + end + + unless HTTP_METHODS.include?(m.downcase.to_sym) + raise ArgumentError, "Invalid HTTP method specified in route conditions" + end + + m + } + + if method.length > 1 + method = Regexp.union(*method) + elsif method.length == 1 + method = method.first + else + method = nil + end + end + + path_prefix = options.delete(:path_prefix) + name_prefix = options.delete(:name_prefix) + namespace = options.delete(:namespace) + + name = options.delete(:_name) + name = "#{name_prefix}#{name}" if name_prefix + + requirements = options.delete(:requirements) || {} + defaults = options.delete(:defaults) || {} + options.each do |k, v| + if v.is_a?(Regexp) + if value = options.delete(k) + requirements[k.to_sym] = value + end + else + value = options.delete(k) + defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param + end + end + + requirements.each do |_, requirement| + if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} + raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" + end + if requirement.multiline? + raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" + end + end + + possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } + requirements[:controller] ||= Regexp.union(*possible_names) + + if defaults[:controller] + defaults[:action] ||= 'index' + defaults[:controller] = defaults[:controller].to_s + defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace + end + + if defaults[:action] + defaults[:action] = defaults[:action].to_s + end + + if path.is_a?(String) + path = "#{path_prefix}/#{path}" if path_prefix + path = path.gsub('.:format', '(.:format)') + path = optionalize_trailing_dynamic_segments(path, requirements, defaults) + glob = $1.to_sym if path =~ /\/\*(\w+)$/ + path = ::Rack::Mount::Utils.normalize_path(path) + path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) + + if glob && !defaults[glob].blank? + raise ActionController::RoutingError, "paths cannot have non-empty default values" + end + end + + app = Routing::RouteSet::Dispatcher.new(:defaults => defaults, :glob => glob) + + conditions = {} + conditions[:request_method] = method if method + conditions[:path_info] = path if path + + @set.add_route(app, conditions, defaults, name) + end + + def optionalize_trailing_dynamic_segments(path, requirements, defaults) #:nodoc: + path = (path =~ /^\//) ? path.dup : "/#{path}" + optional, segments = true, [] + + required_segments = requirements.keys + required_segments -= defaults.keys.compact + + old_segments = path.split('/') + old_segments.shift + length = old_segments.length + + old_segments.reverse.each_with_index do |segment, index| + required_segments.each do |required| + if segment =~ /#{required}/ + optional = false + break + end + end + + if optional + if segment == ":id" && segments.include?(":action") + optional = false + elsif segment == ":controller" || segment == ":action" || segment == ":id" + # Ignore + elsif !(segment =~ /^:\w+$/) && + !(segment =~ /^:\w+\(\.:format\)$/) + optional = false + elsif segment =~ /^:(\w+)$/ + if defaults.has_key?($1.to_sym) + defaults.delete($1.to_sym) + else + optional = false + end + end + end + + if optional && index < length - 1 + segments.unshift('(/', segment) + segments.push(')') + elsif optional + segments.unshift('/(', segment) + segments.push(')') + else + segments.unshift('/', segment) + end + end + + segments.join + end + private :optionalize_trailing_dynamic_segments + + # Creates a named route called "root" for matching the root level request. + def root(options = {}) + if options.is_a?(Symbol) + if source_route = @set.named_routes.routes[options] + options = source_route.defaults.merge({ :conditions => source_route.conditions }) + end + end + named_route("root", '', options) + end + + def named_route(name, path, options = {}) #:nodoc: + options[:_name] = name + connect(path, options) + end + + # Enables the use of resources in a module by setting the name_prefix, path_prefix, and namespace for the model. + # Example: + # + # map.namespace(:admin) do |admin| + # admin.resources :products, + # :has_many => [ :tags, :images, :variants ] + # end + # + # This will create +admin_products_url+ pointing to "admin/products", which will look for an Admin::ProductsController. + # It'll also create +admin_product_tags_url+ pointing to "admin/products/#{product_id}/tags", which will look for + # Admin::TagsController. + def namespace(name, options = {}, &block) + if options[:namespace] + with_options({:path_prefix => "#{options.delete(:path_prefix)}/#{name}", :name_prefix => "#{options.delete(:name_prefix)}#{name}_", :namespace => "#{options.delete(:namespace)}#{name}/" }.merge(options), &block) + else + with_options({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(options), &block) + end + end + + def method_missing(route_name, *args, &proc) #:nodoc: + super unless args.length >= 1 && proc.nil? + named_route(route_name, *args) + end + + INHERITABLE_OPTIONS = :namespace, :shallow + + class Resource #:nodoc: + DEFAULT_ACTIONS = :index, :create, :new, :edit, :show, :update, :destroy + + attr_reader :collection_methods, :member_methods, :new_methods + attr_reader :path_prefix, :name_prefix, :path_segment + attr_reader :plural, :singular + attr_reader :options + + def initialize(entities, options) + @plural ||= entities + @singular ||= options[:singular] || plural.to_s.singularize + @path_segment = options.delete(:as) || @plural + + @options = options + + arrange_actions + add_default_actions + set_allowed_actions + set_prefixes + end + + def controller + @controller ||= "#{options[:namespace]}#{(options[:controller] || plural).to_s}" + end + + def requirements(with_id = false) + @requirements ||= @options[:requirements] || {} + @id_requirement ||= { :id => @requirements.delete(:id) || /[^#{Routing::SEPARATORS.join}]+/ } + + with_id ? @requirements.merge(@id_requirement) : @requirements + end + + def conditions + @conditions ||= @options[:conditions] || {} + end + + def path + @path ||= "#{path_prefix}/#{path_segment}" + end + + def new_path + new_action = self.options[:path_names][:new] if self.options[:path_names] + new_action ||= ActionController::Base.resources_path_names[:new] + @new_path ||= "#{path}/#{new_action}" + end + + def shallow_path_prefix + @shallow_path_prefix ||= @options[:shallow] ? @options[:namespace].try(:sub, /\/$/, '') : path_prefix + end + + def member_path + @member_path ||= "#{shallow_path_prefix}/#{path_segment}/:id" + end + + def nesting_path_prefix + @nesting_path_prefix ||= "#{shallow_path_prefix}/#{path_segment}/:#{singular}_id" + end + + def shallow_name_prefix + @shallow_name_prefix ||= @options[:shallow] ? @options[:namespace].try(:gsub, /\//, '_') : name_prefix + end + + def nesting_name_prefix + "#{shallow_name_prefix}#{singular}_" + end + + def action_separator + @action_separator ||= ActionController::Base.resource_action_separator + end + + def uncountable? + @singular.to_s == @plural.to_s + end + + def has_action?(action) + !DEFAULT_ACTIONS.include?(action) || action_allowed?(action) + end + + protected + def arrange_actions + @collection_methods = arrange_actions_by_methods(options.delete(:collection)) + @member_methods = arrange_actions_by_methods(options.delete(:member)) + @new_methods = arrange_actions_by_methods(options.delete(:new)) + end + + def add_default_actions + add_default_action(member_methods, :get, :edit) + add_default_action(new_methods, :get, :new) + end + + def set_allowed_actions + only, except = @options.values_at(:only, :except) + @allowed_actions ||= {} + + if only == :all || except == :none + only = nil + except = [] + elsif only == :none || except == :all + only = [] + except = nil + end + + if only + @allowed_actions[:only] = Array(only).map {|a| a.to_sym } + elsif except + @allowed_actions[:except] = Array(except).map {|a| a.to_sym } + end + end + + def action_allowed?(action) + only, except = @allowed_actions.values_at(:only, :except) + (!only || only.include?(action)) && (!except || !except.include?(action)) + end + + def set_prefixes + @path_prefix = options.delete(:path_prefix) + @name_prefix = options.delete(:name_prefix) + end + + def arrange_actions_by_methods(actions) + (actions || {}).inject({}) do |flipped_hash, (key, value)| + (flipped_hash[value] ||= []) << key + flipped_hash + end + end + + def add_default_action(collection, method, action) + (collection[method] ||= []).unshift(action) + end + end + + class SingletonResource < Resource #:nodoc: + def initialize(entity, options) + @singular = @plural = entity + options[:controller] ||= @singular.to_s.pluralize + super + end + + alias_method :shallow_path_prefix, :path_prefix + alias_method :shallow_name_prefix, :name_prefix + alias_method :member_path, :path + alias_method :nesting_path_prefix, :path + end + + # Creates named routes for implementing verb-oriented controllers + # for a collection \resource. + # + # For example: + # + # map.resources :messages + # + # will map the following actions in the corresponding controller: + # + # class MessagesController < ActionController::Base + # # GET messages_url + # def index + # # return all messages + # end + # + # # GET new_message_url + # def new + # # return an HTML form for describing a new message + # end + # + # # POST messages_url + # def create + # # create a new message + # end + # + # # GET message_url(:id => 1) + # def show + # # find and return a specific message + # end + # + # # GET edit_message_url(:id => 1) + # def edit + # # return an HTML form for editing a specific message + # end + # + # # PUT message_url(:id => 1) + # def update + # # find and update a specific message + # end + # + # # DELETE message_url(:id => 1) + # def destroy + # # delete a specific message + # end + # end + # + # Along with the routes themselves, +resources+ generates named routes for use in + # controllers and views. map.resources :messages produces the following named routes and helpers: + # + # Named Route Helpers + # ============ ===================================================== + # messages messages_url, hash_for_messages_url, + # messages_path, hash_for_messages_path + # + # message message_url(id), hash_for_message_url(id), + # message_path(id), hash_for_message_path(id) + # + # new_message new_message_url, hash_for_new_message_url, + # new_message_path, hash_for_new_message_path + # + # edit_message edit_message_url(id), hash_for_edit_message_url(id), + # edit_message_path(id), hash_for_edit_message_path(id) + # + # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example: + # + # redirect_to :controller => 'messages', :action => 'index' + # # and + # <%= link_to "edit this message", :controller => 'messages', :action => 'edit', :id => @message.id %> + # + # now become: + # + # redirect_to messages_url + # # and + # <%= link_to "edit this message", edit_message_url(@message) # calls @message.id automatically + # + # Since web browsers don't support the PUT and DELETE verbs, you will need to add a parameter '_method' to your + # form tags. The form helpers make this a little easier. For an update form with a @message object: + # + # <%= form_tag message_path(@message), :method => :put %> + # + # or + # + # <% form_for :message, @message, :url => message_path(@message), :html => {:method => :put} do |f| %> + # + # or + # + # <% form_for @message do |f| %> + # + # which takes into account whether @message is a new record or not and generates the + # path and method accordingly. + # + # The +resources+ method accepts the following options to customize the resulting routes: + # * :collection - Add named routes for other actions that operate on the collection. + # Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, + # an array of any of the previous, or :any if the method does not matter. + # These routes map to a URL like /messages/rss, with a route of +rss_messages_url+. + # * :member - Same as :collection, but for actions that operate on a specific member. + # * :new - Same as :collection, but for actions that operate on the new \resource action. + # * :controller - Specify the controller name for the routes. + # * :singular - Specify the singular name used in the member routes. + # * :requirements - Set custom routing parameter requirements; this is a hash of either + # regular expressions (which must match for the route to match) or extra parameters. For example: + # + # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' } + # + # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller. + # * :conditions - Specify custom routing recognition conditions. \Resources sets the :method value for the method-specific routes. + # * :as - Specify a different \resource name to use in the URL path. For example: + # # products_path == '/productos' + # map.resources :products, :as => 'productos' do |product| + # # product_reviews_path(product) == '/productos/1234/comentarios' + # product.resources :product_reviews, :as => 'comentarios' + # end + # + # * :has_one - Specify nested \resources, this is a shorthand for mapping singleton \resources beneath the current. + # * :has_many - Same has :has_one, but for plural \resources. + # + # You may directly specify the routing association with +has_one+ and +has_many+ like: + # + # map.resources :notes, :has_one => :author, :has_many => [:comments, :attachments] + # + # This is the same as: + # + # map.resources :notes do |notes| + # notes.resource :author + # notes.resources :comments + # notes.resources :attachments + # end + # + # * :path_names - Specify different path names for the actions. For example: + # # new_products_path == '/productos/nuevo' + # # bids_product_path(1) == '/productos/1/licitacoes' + # map.resources :products, :as => 'productos', :member => { :bids => :get }, :path_names => { :new => 'nuevo', :bids => 'licitacoes' } + # + # You can also set default action names from an environment, like this: + # config.action_controller.resources_path_names = { :new => 'nuevo', :edit => 'editar' } + # + # * :path_prefix - Set a prefix to the routes with required route variables. + # + # Weblog comments usually belong to a post, so you might use +resources+ like: + # + # map.resources :articles + # map.resources :comments, :path_prefix => '/articles/:article_id' + # + # You can nest +resources+ calls to set this automatically: + # + # map.resources :articles do |article| + # article.resources :comments + # end + # + # The comment \resources work the same, but must now include a value for :article_id. + # + # article_comments_url(@article) + # article_comment_url(@article, @comment) + # + # article_comments_url(:article_id => @article) + # article_comment_url(:article_id => @article, :id => @comment) + # + # If you don't want to load all objects from the database you might want to use the article_id directly: + # + # articles_comments_url(@comment.article_id, @comment) + # + # * :name_prefix - Define a prefix for all generated routes, usually ending in an underscore. + # Use this if you have named routes that may clash. + # + # map.resources :tags, :path_prefix => '/books/:book_id', :name_prefix => 'book_' + # map.resources :tags, :path_prefix => '/toys/:toy_id', :name_prefix => 'toy_' + # + # You may also use :name_prefix to override the generic named routes in a nested \resource: + # + # map.resources :articles do |article| + # article.resources :comments, :name_prefix => nil + # end + # + # This will yield named \resources like so: + # + # comments_url(@article) + # comment_url(@article, @comment) + # + # * :shallow - If true, paths for nested resources which reference a specific member + # (ie. those with an :id parameter) will not use the parent path prefix or name prefix. + # + # The :shallow option is inherited by any nested resource(s). + # + # For example, 'users', 'posts' and 'comments' all use shallow paths with the following nested resources: + # + # map.resources :users, :shallow => true do |user| + # user.resources :posts do |post| + # post.resources :comments + # end + # end + # # --> GET /users/1/posts (maps to the PostsController#index action as usual) + # # also adds the usual named route called "user_posts" + # # --> GET /posts/2 (maps to the PostsController#show action as if it were not nested) + # # also adds the named route called "post" + # # --> GET /posts/2/comments (maps to the CommentsController#index action) + # # also adds the named route called "post_comments" + # # --> GET /comments/2 (maps to the CommentsController#show action as if it were not nested) + # # also adds the named route called "comment" + # + # You may also use :shallow in combination with the +has_one+ and +has_many+ shorthand notations like: + # + # map.resources :users, :has_many => { :posts => :comments }, :shallow => true + # + # * :only and :except - Specify which of the seven default actions should be routed to. + # + # :only and :except may be set to :all, :none, an action name or a + # list of action names. By default, routes are generated for all seven actions. + # + # For example: + # + # map.resources :posts, :only => [:index, :show] do |post| + # post.resources :comments, :except => [:update, :destroy] + # end + # # --> GET /posts (maps to the PostsController#index action) + # # --> POST /posts (fails) + # # --> GET /posts/1 (maps to the PostsController#show action) + # # --> DELETE /posts/1 (fails) + # # --> POST /posts/1/comments (maps to the CommentsController#create action) + # # --> PUT /posts/1/comments/1 (fails) + # + # If map.resources is called with multiple resources, they all get the same options applied. + # + # Examples: + # + # map.resources :messages, :path_prefix => "/thread/:thread_id" + # # --> GET /thread/7/messages/1 + # + # map.resources :messages, :collection => { :rss => :get } + # # --> GET /messages/rss (maps to the #rss action) + # # also adds a named route called "rss_messages" + # + # map.resources :messages, :member => { :mark => :post } + # # --> POST /messages/1/mark (maps to the #mark action) + # # also adds a named route called "mark_message" + # + # map.resources :messages, :new => { :preview => :post } + # # --> POST /messages/new/preview (maps to the #preview action) + # # also adds a named route called "preview_new_message" + # + # map.resources :messages, :new => { :new => :any, :preview => :post } + # # --> POST /messages/new/preview (maps to the #preview action) + # # also adds a named route called "preview_new_message" + # # --> /messages/new can be invoked via any request method + # + # map.resources :messages, :controller => "categories", + # :path_prefix => "/category/:category_id", + # :name_prefix => "category_" + # # --> GET /categories/7/messages/1 + # # has named route "category_message" + # + # The +resources+ method sets HTTP method restrictions on the routes it generates. For example, making an + # HTTP POST on new_message_url will raise a RoutingError exception. The default route in + # config/routes.rb overrides this and allows invalid HTTP methods for \resource routes. + def resources(*entities, &block) + options = entities.extract_options! + entities.each { |entity| map_resource(entity, options.dup, &block) } + end + + # Creates named routes for implementing verb-oriented controllers for a singleton \resource. + # A singleton \resource is global to its current context. For unnested singleton \resources, + # the \resource is global to the current user visiting the application, such as a user's + # /account profile. For nested singleton \resources, the \resource is global to its parent + # \resource, such as a projects \resource that has_one :project_manager. + # The project_manager should be mapped as a singleton \resource under projects: + # + # map.resources :projects do |project| + # project.resource :project_manager + # end + # + # See +resources+ for general conventions. These are the main differences: + # * A singular name is given to map.resource. The default controller name is still taken from the plural name. + # * To specify a custom plural name, use the :plural option. There is no :singular option. + # * No default index route is created for the singleton \resource controller. + # * When nesting singleton \resources, only the singular name is used as the path prefix (example: 'account/messages/1') + # + # For example: + # + # map.resource :account + # + # maps these actions in the Accounts controller: + # + # class AccountsController < ActionController::Base + # # GET new_account_url + # def new + # # return an HTML form for describing the new account + # end + # + # # POST account_url + # def create + # # create an account + # end + # + # # GET account_url + # def show + # # find and return the account + # end + # + # # GET edit_account_url + # def edit + # # return an HTML form for editing the account + # end + # + # # PUT account_url + # def update + # # find and update the account + # end + # + # # DELETE account_url + # def destroy + # # delete the account + # end + # end + # + # Along with the routes themselves, +resource+ generates named routes for + # use in controllers and views. map.resource :account produces + # these named routes and helpers: + # + # Named Route Helpers + # ============ ============================================= + # account account_url, hash_for_account_url, + # account_path, hash_for_account_path + # + # new_account new_account_url, hash_for_new_account_url, + # new_account_path, hash_for_new_account_path + # + # edit_account edit_account_url, hash_for_edit_account_url, + # edit_account_path, hash_for_edit_account_path + def resource(*entities, &block) + options = entities.extract_options! + entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } + end + + private + def map_resource(entities, options = {}, &block) + resource = Resource.new(entities, options) + + with_options :controller => resource.controller do |map| + map_associations(resource, options) + + if block_given? + with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) + end + + map_collection_actions(map, resource) + map_default_collection_actions(map, resource) + map_new_actions(map, resource) + map_member_actions(map, resource) + end + end + + def map_singleton_resource(entities, options = {}, &block) + resource = SingletonResource.new(entities, options) + + with_options :controller => resource.controller do |map| + map_associations(resource, options) + + if block_given? + with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) + end + + map_collection_actions(map, resource) + map_new_actions(map, resource) + map_member_actions(map, resource) + map_default_singleton_actions(map, resource) + end + end + + def map_associations(resource, options) + map_has_many_associations(resource, options.delete(:has_many), options) if options[:has_many] + + path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}" + name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" + + Array(options[:has_one]).each do |association| + resource(association, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => path_prefix, :name_prefix => name_prefix)) + end + end + + def map_has_many_associations(resource, associations, options) + case associations + when Hash + associations.each do |association,has_many| + map_has_many_associations(resource, association, options.merge(:has_many => has_many)) + end + when Array + associations.each do |association| + map_has_many_associations(resource, association, options) + end + when Symbol, String + resources(associations, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, :has_many => options[:has_many])) + else + end + end + + def map_collection_actions(map, resource) + resource.collection_methods.each do |method, actions| + actions.each do |action| + [method].flatten.each do |m| + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= action + + map_resource_routes(map, resource, action, "#{resource.path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.name_prefix}#{resource.plural}", m) + end + end + end + end + + def map_default_collection_actions(map, resource) + index_route_name = "#{resource.name_prefix}#{resource.plural}" + + if resource.uncountable? + index_route_name << "_index" + end + + map_resource_routes(map, resource, :index, resource.path, index_route_name) + map_resource_routes(map, resource, :create, resource.path, index_route_name) + end + + def map_default_singleton_actions(map, resource) + map_resource_routes(map, resource, :create, resource.path, "#{resource.shallow_name_prefix}#{resource.singular}") + end + + def map_new_actions(map, resource) + resource.new_methods.each do |method, actions| + actions.each do |action| + route_path = resource.new_path + route_name = "new_#{resource.name_prefix}#{resource.singular}" + + unless action == :new + route_path = "#{route_path}#{resource.action_separator}#{action}" + route_name = "#{action}_#{route_name}" + end + + map_resource_routes(map, resource, action, route_path, route_name, method) + end + end + end + + def map_member_actions(map, resource) + resource.member_methods.each do |method, actions| + actions.each do |action| + [method].flatten.each do |m| + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= ActionController::Base.resources_path_names[action] || action + + map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true }) + end + end + end + + route_path = "#{resource.shallow_name_prefix}#{resource.singular}" + map_resource_routes(map, resource, :show, resource.member_path, route_path) + map_resource_routes(map, resource, :update, resource.member_path, route_path) + map_resource_routes(map, resource, :destroy, resource.member_path, route_path) + end + + def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} ) + if resource.has_action?(action) + action_options = action_options_for(action, resource, method, resource_options) + formatted_route_path = "#{route_path}.:format" + + if route_name && @set.named_routes[route_name.to_sym].nil? + map.named_route(route_name, formatted_route_path, action_options) + else + map.connect(formatted_route_path, action_options) + end + end + end + + def add_conditions_for(conditions, method) + returning({:conditions => conditions.dup}) do |options| + options[:conditions][:method] = method unless method == :any + end + end + + def action_options_for(action, resource, method = nil, resource_options = {}) + default_options = { :action => action.to_s } + require_id = !resource.kind_of?(SingletonResource) + force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource) + + case default_options[:action] + when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) + when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) + when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) + when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) + when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) + else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id)) + end + end + end + end +end diff --git a/actionpack/lib/action_dispatch/routing/resources.rb b/actionpack/lib/action_dispatch/routing/resources.rb deleted file mode 100644 index ada0d0a648..0000000000 --- a/actionpack/lib/action_dispatch/routing/resources.rb +++ /dev/null @@ -1,687 +0,0 @@ -require 'active_support/core_ext/hash/slice' -require 'active_support/core_ext/object/try' - -module ActionDispatch - module Routing - # == Overview - # - # ActionController::Resources are a way of defining RESTful \resources. A RESTful \resource, in basic terms, - # is something that can be pointed at and it will respond with a representation of the data requested. - # In real terms this could mean a user with a browser requests an HTML page, or that a desktop application - # requests XML data. - # - # RESTful design is based on the assumption that there are four generic verbs that a user of an - # application can request from a \resource (the noun). - # - # \Resources can be requested using four basic HTTP verbs (GET, POST, PUT, DELETE), the method used - # denotes the type of action that should take place. - # - # === The Different Methods and their Usage - # - # * GET - Requests for a \resource, no saving or editing of a \resource should occur in a GET request. - # * POST - Creation of \resources. - # * PUT - Editing of attributes on a \resource. - # * DELETE - Deletion of a \resource. - # - # === Examples - # - # # A GET request on the Posts resource is asking for all Posts - # GET /posts - # - # # A GET request on a single Post resource is asking for that particular Post - # GET /posts/1 - # - # # A POST request on the Posts resource is asking for a Post to be created with the supplied details - # POST /posts # with => { :post => { :title => "My Whizzy New Post", :body => "I've got a brand new combine harvester" } } - # - # # A PUT request on a single Post resource is asking for a Post to be updated - # PUT /posts # with => { :id => 1, :post => { :title => "Changed Whizzy Title" } } - # - # # A DELETE request on a single Post resource is asking for it to be deleted - # DELETE /posts # with => { :id => 1 } - # - # By using the REST convention, users of our application can assume certain things about how the data - # is requested and how it is returned. Rails simplifies the routing part of RESTful design by - # supplying you with methods to create them in your routes.rb file. - # - # Read more about REST at http://en.wikipedia.org/wiki/Representational_State_Transfer - module Resources - INHERITABLE_OPTIONS = :namespace, :shallow - - class Resource #:nodoc: - DEFAULT_ACTIONS = :index, :create, :new, :edit, :show, :update, :destroy - - attr_reader :collection_methods, :member_methods, :new_methods - attr_reader :path_prefix, :name_prefix, :path_segment - attr_reader :plural, :singular - attr_reader :options - - def initialize(entities, options) - @plural ||= entities - @singular ||= options[:singular] || plural.to_s.singularize - @path_segment = options.delete(:as) || @plural - - @options = options - - arrange_actions - add_default_actions - set_allowed_actions - set_prefixes - end - - def controller - @controller ||= "#{options[:namespace]}#{(options[:controller] || plural).to_s}" - end - - def requirements(with_id = false) - @requirements ||= @options[:requirements] || {} - @id_requirement ||= { :id => @requirements.delete(:id) || /[^#{Routing::SEPARATORS.join}]+/ } - - with_id ? @requirements.merge(@id_requirement) : @requirements - end - - def conditions - @conditions ||= @options[:conditions] || {} - end - - def path - @path ||= "#{path_prefix}/#{path_segment}" - end - - def new_path - new_action = self.options[:path_names][:new] if self.options[:path_names] - new_action ||= ActionController::Base.resources_path_names[:new] - @new_path ||= "#{path}/#{new_action}" - end - - def shallow_path_prefix - @shallow_path_prefix ||= @options[:shallow] ? @options[:namespace].try(:sub, /\/$/, '') : path_prefix - end - - def member_path - @member_path ||= "#{shallow_path_prefix}/#{path_segment}/:id" - end - - def nesting_path_prefix - @nesting_path_prefix ||= "#{shallow_path_prefix}/#{path_segment}/:#{singular}_id" - end - - def shallow_name_prefix - @shallow_name_prefix ||= @options[:shallow] ? @options[:namespace].try(:gsub, /\//, '_') : name_prefix - end - - def nesting_name_prefix - "#{shallow_name_prefix}#{singular}_" - end - - def action_separator - @action_separator ||= ActionController::Base.resource_action_separator - end - - def uncountable? - @singular.to_s == @plural.to_s - end - - def has_action?(action) - !DEFAULT_ACTIONS.include?(action) || action_allowed?(action) - end - - protected - def arrange_actions - @collection_methods = arrange_actions_by_methods(options.delete(:collection)) - @member_methods = arrange_actions_by_methods(options.delete(:member)) - @new_methods = arrange_actions_by_methods(options.delete(:new)) - end - - def add_default_actions - add_default_action(member_methods, :get, :edit) - add_default_action(new_methods, :get, :new) - end - - def set_allowed_actions - only, except = @options.values_at(:only, :except) - @allowed_actions ||= {} - - if only == :all || except == :none - only = nil - except = [] - elsif only == :none || except == :all - only = [] - except = nil - end - - if only - @allowed_actions[:only] = Array(only).map {|a| a.to_sym } - elsif except - @allowed_actions[:except] = Array(except).map {|a| a.to_sym } - end - end - - def action_allowed?(action) - only, except = @allowed_actions.values_at(:only, :except) - (!only || only.include?(action)) && (!except || !except.include?(action)) - end - - def set_prefixes - @path_prefix = options.delete(:path_prefix) - @name_prefix = options.delete(:name_prefix) - end - - def arrange_actions_by_methods(actions) - (actions || {}).inject({}) do |flipped_hash, (key, value)| - (flipped_hash[value] ||= []) << key - flipped_hash - end - end - - def add_default_action(collection, method, action) - (collection[method] ||= []).unshift(action) - end - end - - class SingletonResource < Resource #:nodoc: - def initialize(entity, options) - @singular = @plural = entity - options[:controller] ||= @singular.to_s.pluralize - super - end - - alias_method :shallow_path_prefix, :path_prefix - alias_method :shallow_name_prefix, :name_prefix - alias_method :member_path, :path - alias_method :nesting_path_prefix, :path - end - - # Creates named routes for implementing verb-oriented controllers - # for a collection \resource. - # - # For example: - # - # map.resources :messages - # - # will map the following actions in the corresponding controller: - # - # class MessagesController < ActionController::Base - # # GET messages_url - # def index - # # return all messages - # end - # - # # GET new_message_url - # def new - # # return an HTML form for describing a new message - # end - # - # # POST messages_url - # def create - # # create a new message - # end - # - # # GET message_url(:id => 1) - # def show - # # find and return a specific message - # end - # - # # GET edit_message_url(:id => 1) - # def edit - # # return an HTML form for editing a specific message - # end - # - # # PUT message_url(:id => 1) - # def update - # # find and update a specific message - # end - # - # # DELETE message_url(:id => 1) - # def destroy - # # delete a specific message - # end - # end - # - # Along with the routes themselves, +resources+ generates named routes for use in - # controllers and views. map.resources :messages produces the following named routes and helpers: - # - # Named Route Helpers - # ============ ===================================================== - # messages messages_url, hash_for_messages_url, - # messages_path, hash_for_messages_path - # - # message message_url(id), hash_for_message_url(id), - # message_path(id), hash_for_message_path(id) - # - # new_message new_message_url, hash_for_new_message_url, - # new_message_path, hash_for_new_message_path - # - # edit_message edit_message_url(id), hash_for_edit_message_url(id), - # edit_message_path(id), hash_for_edit_message_path(id) - # - # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example: - # - # redirect_to :controller => 'messages', :action => 'index' - # # and - # <%= link_to "edit this message", :controller => 'messages', :action => 'edit', :id => @message.id %> - # - # now become: - # - # redirect_to messages_url - # # and - # <%= link_to "edit this message", edit_message_url(@message) # calls @message.id automatically - # - # Since web browsers don't support the PUT and DELETE verbs, you will need to add a parameter '_method' to your - # form tags. The form helpers make this a little easier. For an update form with a @message object: - # - # <%= form_tag message_path(@message), :method => :put %> - # - # or - # - # <% form_for :message, @message, :url => message_path(@message), :html => {:method => :put} do |f| %> - # - # or - # - # <% form_for @message do |f| %> - # - # which takes into account whether @message is a new record or not and generates the - # path and method accordingly. - # - # The +resources+ method accepts the following options to customize the resulting routes: - # * :collection - Add named routes for other actions that operate on the collection. - # Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, - # an array of any of the previous, or :any if the method does not matter. - # These routes map to a URL like /messages/rss, with a route of +rss_messages_url+. - # * :member - Same as :collection, but for actions that operate on a specific member. - # * :new - Same as :collection, but for actions that operate on the new \resource action. - # * :controller - Specify the controller name for the routes. - # * :singular - Specify the singular name used in the member routes. - # * :requirements - Set custom routing parameter requirements; this is a hash of either - # regular expressions (which must match for the route to match) or extra parameters. For example: - # - # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' } - # - # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller. - # * :conditions - Specify custom routing recognition conditions. \Resources sets the :method value for the method-specific routes. - # * :as - Specify a different \resource name to use in the URL path. For example: - # # products_path == '/productos' - # map.resources :products, :as => 'productos' do |product| - # # product_reviews_path(product) == '/productos/1234/comentarios' - # product.resources :product_reviews, :as => 'comentarios' - # end - # - # * :has_one - Specify nested \resources, this is a shorthand for mapping singleton \resources beneath the current. - # * :has_many - Same has :has_one, but for plural \resources. - # - # You may directly specify the routing association with +has_one+ and +has_many+ like: - # - # map.resources :notes, :has_one => :author, :has_many => [:comments, :attachments] - # - # This is the same as: - # - # map.resources :notes do |notes| - # notes.resource :author - # notes.resources :comments - # notes.resources :attachments - # end - # - # * :path_names - Specify different path names for the actions. For example: - # # new_products_path == '/productos/nuevo' - # # bids_product_path(1) == '/productos/1/licitacoes' - # map.resources :products, :as => 'productos', :member => { :bids => :get }, :path_names => { :new => 'nuevo', :bids => 'licitacoes' } - # - # You can also set default action names from an environment, like this: - # config.action_controller.resources_path_names = { :new => 'nuevo', :edit => 'editar' } - # - # * :path_prefix - Set a prefix to the routes with required route variables. - # - # Weblog comments usually belong to a post, so you might use +resources+ like: - # - # map.resources :articles - # map.resources :comments, :path_prefix => '/articles/:article_id' - # - # You can nest +resources+ calls to set this automatically: - # - # map.resources :articles do |article| - # article.resources :comments - # end - # - # The comment \resources work the same, but must now include a value for :article_id. - # - # article_comments_url(@article) - # article_comment_url(@article, @comment) - # - # article_comments_url(:article_id => @article) - # article_comment_url(:article_id => @article, :id => @comment) - # - # If you don't want to load all objects from the database you might want to use the article_id directly: - # - # articles_comments_url(@comment.article_id, @comment) - # - # * :name_prefix - Define a prefix for all generated routes, usually ending in an underscore. - # Use this if you have named routes that may clash. - # - # map.resources :tags, :path_prefix => '/books/:book_id', :name_prefix => 'book_' - # map.resources :tags, :path_prefix => '/toys/:toy_id', :name_prefix => 'toy_' - # - # You may also use :name_prefix to override the generic named routes in a nested \resource: - # - # map.resources :articles do |article| - # article.resources :comments, :name_prefix => nil - # end - # - # This will yield named \resources like so: - # - # comments_url(@article) - # comment_url(@article, @comment) - # - # * :shallow - If true, paths for nested resources which reference a specific member - # (ie. those with an :id parameter) will not use the parent path prefix or name prefix. - # - # The :shallow option is inherited by any nested resource(s). - # - # For example, 'users', 'posts' and 'comments' all use shallow paths with the following nested resources: - # - # map.resources :users, :shallow => true do |user| - # user.resources :posts do |post| - # post.resources :comments - # end - # end - # # --> GET /users/1/posts (maps to the PostsController#index action as usual) - # # also adds the usual named route called "user_posts" - # # --> GET /posts/2 (maps to the PostsController#show action as if it were not nested) - # # also adds the named route called "post" - # # --> GET /posts/2/comments (maps to the CommentsController#index action) - # # also adds the named route called "post_comments" - # # --> GET /comments/2 (maps to the CommentsController#show action as if it were not nested) - # # also adds the named route called "comment" - # - # You may also use :shallow in combination with the +has_one+ and +has_many+ shorthand notations like: - # - # map.resources :users, :has_many => { :posts => :comments }, :shallow => true - # - # * :only and :except - Specify which of the seven default actions should be routed to. - # - # :only and :except may be set to :all, :none, an action name or a - # list of action names. By default, routes are generated for all seven actions. - # - # For example: - # - # map.resources :posts, :only => [:index, :show] do |post| - # post.resources :comments, :except => [:update, :destroy] - # end - # # --> GET /posts (maps to the PostsController#index action) - # # --> POST /posts (fails) - # # --> GET /posts/1 (maps to the PostsController#show action) - # # --> DELETE /posts/1 (fails) - # # --> POST /posts/1/comments (maps to the CommentsController#create action) - # # --> PUT /posts/1/comments/1 (fails) - # - # If map.resources is called with multiple resources, they all get the same options applied. - # - # Examples: - # - # map.resources :messages, :path_prefix => "/thread/:thread_id" - # # --> GET /thread/7/messages/1 - # - # map.resources :messages, :collection => { :rss => :get } - # # --> GET /messages/rss (maps to the #rss action) - # # also adds a named route called "rss_messages" - # - # map.resources :messages, :member => { :mark => :post } - # # --> POST /messages/1/mark (maps to the #mark action) - # # also adds a named route called "mark_message" - # - # map.resources :messages, :new => { :preview => :post } - # # --> POST /messages/new/preview (maps to the #preview action) - # # also adds a named route called "preview_new_message" - # - # map.resources :messages, :new => { :new => :any, :preview => :post } - # # --> POST /messages/new/preview (maps to the #preview action) - # # also adds a named route called "preview_new_message" - # # --> /messages/new can be invoked via any request method - # - # map.resources :messages, :controller => "categories", - # :path_prefix => "/category/:category_id", - # :name_prefix => "category_" - # # --> GET /categories/7/messages/1 - # # has named route "category_message" - # - # The +resources+ method sets HTTP method restrictions on the routes it generates. For example, making an - # HTTP POST on new_message_url will raise a RoutingError exception. The default route in - # config/routes.rb overrides this and allows invalid HTTP methods for \resource routes. - def resources(*entities, &block) - options = entities.extract_options! - entities.each { |entity| map_resource(entity, options.dup, &block) } - end - - # Creates named routes for implementing verb-oriented controllers for a singleton \resource. - # A singleton \resource is global to its current context. For unnested singleton \resources, - # the \resource is global to the current user visiting the application, such as a user's - # /account profile. For nested singleton \resources, the \resource is global to its parent - # \resource, such as a projects \resource that has_one :project_manager. - # The project_manager should be mapped as a singleton \resource under projects: - # - # map.resources :projects do |project| - # project.resource :project_manager - # end - # - # See +resources+ for general conventions. These are the main differences: - # * A singular name is given to map.resource. The default controller name is still taken from the plural name. - # * To specify a custom plural name, use the :plural option. There is no :singular option. - # * No default index route is created for the singleton \resource controller. - # * When nesting singleton \resources, only the singular name is used as the path prefix (example: 'account/messages/1') - # - # For example: - # - # map.resource :account - # - # maps these actions in the Accounts controller: - # - # class AccountsController < ActionController::Base - # # GET new_account_url - # def new - # # return an HTML form for describing the new account - # end - # - # # POST account_url - # def create - # # create an account - # end - # - # # GET account_url - # def show - # # find and return the account - # end - # - # # GET edit_account_url - # def edit - # # return an HTML form for editing the account - # end - # - # # PUT account_url - # def update - # # find and update the account - # end - # - # # DELETE account_url - # def destroy - # # delete the account - # end - # end - # - # Along with the routes themselves, +resource+ generates named routes for - # use in controllers and views. map.resource :account produces - # these named routes and helpers: - # - # Named Route Helpers - # ============ ============================================= - # account account_url, hash_for_account_url, - # account_path, hash_for_account_path - # - # new_account new_account_url, hash_for_new_account_url, - # new_account_path, hash_for_new_account_path - # - # edit_account edit_account_url, hash_for_edit_account_url, - # edit_account_path, hash_for_edit_account_path - def resource(*entities, &block) - options = entities.extract_options! - entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } - end - - private - def map_resource(entities, options = {}, &block) - resource = Resource.new(entities, options) - - with_options :controller => resource.controller do |map| - map_associations(resource, options) - - if block_given? - with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) - end - - map_collection_actions(map, resource) - map_default_collection_actions(map, resource) - map_new_actions(map, resource) - map_member_actions(map, resource) - end - end - - def map_singleton_resource(entities, options = {}, &block) - resource = SingletonResource.new(entities, options) - - with_options :controller => resource.controller do |map| - map_associations(resource, options) - - if block_given? - with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) - end - - map_collection_actions(map, resource) - map_new_actions(map, resource) - map_member_actions(map, resource) - map_default_singleton_actions(map, resource) - end - end - - def map_associations(resource, options) - map_has_many_associations(resource, options.delete(:has_many), options) if options[:has_many] - - path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}" - name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" - - Array(options[:has_one]).each do |association| - resource(association, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => path_prefix, :name_prefix => name_prefix)) - end - end - - def map_has_many_associations(resource, associations, options) - case associations - when Hash - associations.each do |association,has_many| - map_has_many_associations(resource, association, options.merge(:has_many => has_many)) - end - when Array - associations.each do |association| - map_has_many_associations(resource, association, options) - end - when Symbol, String - resources(associations, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, :has_many => options[:has_many])) - else - end - end - - def map_collection_actions(map, resource) - resource.collection_methods.each do |method, actions| - actions.each do |action| - [method].flatten.each do |m| - action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) - action_path ||= action - - map_resource_routes(map, resource, action, "#{resource.path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.name_prefix}#{resource.plural}", m) - end - end - end - end - - def map_default_collection_actions(map, resource) - index_route_name = "#{resource.name_prefix}#{resource.plural}" - - if resource.uncountable? - index_route_name << "_index" - end - - map_resource_routes(map, resource, :index, resource.path, index_route_name) - map_resource_routes(map, resource, :create, resource.path, index_route_name) - end - - def map_default_singleton_actions(map, resource) - map_resource_routes(map, resource, :create, resource.path, "#{resource.shallow_name_prefix}#{resource.singular}") - end - - def map_new_actions(map, resource) - resource.new_methods.each do |method, actions| - actions.each do |action| - route_path = resource.new_path - route_name = "new_#{resource.name_prefix}#{resource.singular}" - - unless action == :new - route_path = "#{route_path}#{resource.action_separator}#{action}" - route_name = "#{action}_#{route_name}" - end - - map_resource_routes(map, resource, action, route_path, route_name, method) - end - end - end - - def map_member_actions(map, resource) - resource.member_methods.each do |method, actions| - actions.each do |action| - [method].flatten.each do |m| - action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) - action_path ||= ActionController::Base.resources_path_names[action] || action - - map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true }) - end - end - end - - route_path = "#{resource.shallow_name_prefix}#{resource.singular}" - map_resource_routes(map, resource, :show, resource.member_path, route_path) - map_resource_routes(map, resource, :update, resource.member_path, route_path) - map_resource_routes(map, resource, :destroy, resource.member_path, route_path) - end - - def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} ) - if resource.has_action?(action) - action_options = action_options_for(action, resource, method, resource_options) - formatted_route_path = "#{route_path}.:format" - - if route_name && @set.named_routes[route_name.to_sym].nil? - map.named_route(route_name, formatted_route_path, action_options) - else - map.connect(formatted_route_path, action_options) - end - end - end - - def add_conditions_for(conditions, method) - returning({:conditions => conditions.dup}) do |options| - options[:conditions][:method] = method unless method == :any - end - end - - def action_options_for(action, resource, method = nil, resource_options = {}) - default_options = { :action => action.to_s } - require_id = !resource.kind_of?(SingletonResource) - force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource) - - case default_options[:action] - when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) - when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) - when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) - when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) - when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) - else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id)) - end - end - end - end -end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 9e40108d00..a6e46b1c78 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -53,63 +53,6 @@ module ActionDispatch end end - # Mapper instances are used to build routes. The object passed to the draw - # block in config/routes.rb is a Mapper instance. - # - # Mapper instances have relatively few instance methods, in order to avoid - # clashes with named routes. - class Mapper #:doc: - include Routing::Resources - - def initialize(set) #:nodoc: - @set = set - end - - # Create an unnamed route with the provided +path+ and +options+. See - # ActionDispatch::Routing for an introduction to routes. - def connect(path, options = {}) - @set.add_route(path, options) - end - - # Creates a named route called "root" for matching the root level request. - def root(options = {}) - if options.is_a?(Symbol) - if source_route = @set.named_routes.routes[options] - options = source_route.defaults.merge({ :conditions => source_route.conditions }) - end - end - named_route("root", '', options) - end - - def named_route(name, path, options = {}) #:nodoc: - @set.add_named_route(name, path, options) - end - - # Enables the use of resources in a module by setting the name_prefix, path_prefix, and namespace for the model. - # Example: - # - # map.namespace(:admin) do |admin| - # admin.resources :products, - # :has_many => [ :tags, :images, :variants ] - # end - # - # This will create +admin_products_url+ pointing to "admin/products", which will look for an Admin::ProductsController. - # It'll also create +admin_product_tags_url+ pointing to "admin/products/#{product_id}/tags", which will look for - # Admin::TagsController. - def namespace(name, options = {}, &block) - if options[:namespace] - with_options({:path_prefix => "#{options.delete(:path_prefix)}/#{name}", :name_prefix => "#{options.delete(:name_prefix)}#{name}_", :namespace => "#{options.delete(:namespace)}#{name}/" }.merge(options), &block) - else - with_options({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(options), &block) - end - end - - def method_missing(route_name, *args, &proc) #:nodoc: - super unless args.length >= 1 && proc.nil? - @set.add_named_route(route_name, *args) - end - end - # A NamedRouteCollection instance is a collection of named routes, and also # maintains an anonymous module that can be used to install helpers for the # named routes. @@ -347,109 +290,14 @@ module ActionDispatch routes_changed_at end - def add_route(path, options = {}) - options = options.dup - - if conditions = options.delete(:conditions) - conditions = conditions.dup - method = [conditions.delete(:method)].flatten.compact - method.map! { |m| - m = m.to_s.upcase - - if m == "HEAD" - raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" - end - - unless HTTP_METHODS.include?(m.downcase.to_sym) - raise ArgumentError, "Invalid HTTP method specified in route conditions" - end - - m - } - - if method.length > 1 - method = Regexp.union(*method) - elsif method.length == 1 - method = method.first - else - method = nil - end - end - - path_prefix = options.delete(:path_prefix) - name_prefix = options.delete(:name_prefix) - namespace = options.delete(:namespace) - - name = options.delete(:_name) - name = "#{name_prefix}#{name}" if name_prefix - - requirements = options.delete(:requirements) || {} - defaults = options.delete(:defaults) || {} - options.each do |k, v| - if v.is_a?(Regexp) - if value = options.delete(k) - requirements[k.to_sym] = value - end - else - value = options.delete(k) - defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param - end - end - - requirements.each do |_, requirement| - if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} - raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" - end - if requirement.multiline? - raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" - end - end - - possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } - requirements[:controller] ||= Regexp.union(*possible_names) - - if defaults[:controller] - defaults[:action] ||= 'index' - defaults[:controller] = defaults[:controller].to_s - defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace - end - - if defaults[:action] - defaults[:action] = defaults[:action].to_s - end - - if path.is_a?(String) - path = "#{path_prefix}/#{path}" if path_prefix - path = path.gsub('.:format', '(.:format)') - path = optionalize_trailing_dynamic_segments(path, requirements, defaults) - glob = $1.to_sym if path =~ /\/\*(\w+)$/ - path = ::Rack::Mount::Utils.normalize_path(path) - path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) - - if glob && !defaults[glob].blank? - raise ActionController::RoutingError, "paths cannot have non-empty default values" - end - end - - app = Dispatcher.new(:defaults => defaults, :glob => glob) - - conditions = {} - conditions[:request_method] = method if method - conditions[:path_info] = path if path - + def add_route(app, conditions = {}, defaults = {}, name = nil) route = @set.add_route(app, conditions, defaults, name) route.extend(RouteExtensions) + named_routes[name] = route if name routes << route route end - def add_named_route(name, path, options = {}) - options[:_name] = name - route = add_route(path, options) - named_routes[route.name] = route - route - end - def options_as_params(options) # If an explicit :controller was given, always make :action explicit # too, so that action expiry works as expected for things like @@ -644,56 +492,6 @@ module ActionDispatch _escape ? Rack::Mount::Utils.escape_uri(v) : v.to_s end end - - def optionalize_trailing_dynamic_segments(path, requirements, defaults) - path = (path =~ /^\//) ? path.dup : "/#{path}" - optional, segments = true, [] - - required_segments = requirements.keys - required_segments -= defaults.keys.compact - - old_segments = path.split('/') - old_segments.shift - length = old_segments.length - - old_segments.reverse.each_with_index do |segment, index| - required_segments.each do |required| - if segment =~ /#{required}/ - optional = false - break - end - end - - if optional - if segment == ":id" && segments.include?(":action") - optional = false - elsif segment == ":controller" || segment == ":action" || segment == ":id" - # Ignore - elsif !(segment =~ /^:\w+$/) && - !(segment =~ /^:\w+\(\.:format\)$/) - optional = false - elsif segment =~ /^:(\w+)$/ - if defaults.has_key?($1.to_sym) - defaults.delete($1.to_sym) - else - optional = false - end - end - end - - if optional && index < length - 1 - segments.unshift('(/', segment) - segments.push(')') - elsif optional - segments.unshift('/(', segment) - segments.push(')') - else - segments.unshift('/', segment) - end - end - - segments.join - end end end end diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 4f1bafbad1..92373b5d26 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -41,7 +41,7 @@ class ResourcesTest < ActionController::TestCase end def test_should_arrange_actions - resource = ActionDispatch::Routing::Resources::Resource.new(:messages, + resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, :collection => { :rss => :get, :reorder => :post, :csv => :post }, :member => { :rss => :get, :atom => :get, :upload => :post, :fix => :post }, :new => { :preview => :get, :draft => :get }) @@ -54,18 +54,18 @@ class ResourcesTest < ActionController::TestCase end def test_should_resource_controller_name_equal_resource_name_by_default - resource = ActionDispatch::Routing::Resources::Resource.new(:messages, {}) + resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, {}) assert_equal 'messages', resource.controller end def test_should_resource_controller_name_equal_controller_option - resource = ActionDispatch::Routing::Resources::Resource.new(:messages, :controller => 'posts') + resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, :controller => 'posts') assert_equal 'posts', resource.controller end def test_should_all_singleton_paths_be_the_same [ :path, :nesting_path_prefix, :member_path ].each do |method| - resource = ActionDispatch::Routing::Resources::SingletonResource.new(:messages, :path_prefix => 'admin') + resource = ActionDispatch::Routing::Mapper::SingletonResource.new(:messages, :path_prefix => 'admin') assert_equal 'admin/messages', resource.send(method) end end @@ -121,7 +121,7 @@ class ResourcesTest < ActionController::TestCase end def test_override_paths_for_default_restful_actions - resource = ActionDispatch::Routing::Resources::Resource.new(:messages, + resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, :path_names => {:new => 'nuevo', :edit => 'editar'}) assert_equal resource.new_path, "#{resource.path}/nuevo" end -- cgit v1.2.3 From a1ce52effccae4851593f1d9b83ca9bf826bf338 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 12:31:23 -0500 Subject: New routing dsl --- actionpack/lib/action_dispatch/routing.rb | 1 + .../action_dispatch/routing/deprecated_mapper.rb | 879 +++++++++++++++++ actionpack/lib/action_dispatch/routing/mapper.rb | 1004 +++++--------------- .../lib/action_dispatch/routing/route_set.rb | 4 +- actionpack/test/controller/resources_test.rb | 20 +- actionpack/test/controller/routing_test.rb | 332 +++++++ 6 files changed, 1443 insertions(+), 797 deletions(-) create mode 100644 actionpack/lib/action_dispatch/routing/deprecated_mapper.rb diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 0647d051cb..3803929847 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -260,6 +260,7 @@ module ActionDispatch # Run rake routes. # module Routing + autoload :DeprecatedMapper, 'action_dispatch/routing/deprecated_mapper' autoload :Mapper, 'action_dispatch/routing/mapper' autoload :RouteSet, 'action_dispatch/routing/route_set' diff --git a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb new file mode 100644 index 0000000000..f2a1f10fa7 --- /dev/null +++ b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb @@ -0,0 +1,879 @@ +module ActionDispatch + module Routing + # Mapper instances are used to build routes. The object passed to the draw + # block in config/routes.rb is a Mapper instance. + # + # Mapper instances have relatively few instance methods, in order to avoid + # clashes with named routes. + # + # == Overview + # + # ActionController::Resources are a way of defining RESTful \resources. A RESTful \resource, in basic terms, + # is something that can be pointed at and it will respond with a representation of the data requested. + # In real terms this could mean a user with a browser requests an HTML page, or that a desktop application + # requests XML data. + # + # RESTful design is based on the assumption that there are four generic verbs that a user of an + # application can request from a \resource (the noun). + # + # \Resources can be requested using four basic HTTP verbs (GET, POST, PUT, DELETE), the method used + # denotes the type of action that should take place. + # + # === The Different Methods and their Usage + # + # * GET - Requests for a \resource, no saving or editing of a \resource should occur in a GET request. + # * POST - Creation of \resources. + # * PUT - Editing of attributes on a \resource. + # * DELETE - Deletion of a \resource. + # + # === Examples + # + # # A GET request on the Posts resource is asking for all Posts + # GET /posts + # + # # A GET request on a single Post resource is asking for that particular Post + # GET /posts/1 + # + # # A POST request on the Posts resource is asking for a Post to be created with the supplied details + # POST /posts # with => { :post => { :title => "My Whizzy New Post", :body => "I've got a brand new combine harvester" } } + # + # # A PUT request on a single Post resource is asking for a Post to be updated + # PUT /posts # with => { :id => 1, :post => { :title => "Changed Whizzy Title" } } + # + # # A DELETE request on a single Post resource is asking for it to be deleted + # DELETE /posts # with => { :id => 1 } + # + # By using the REST convention, users of our application can assume certain things about how the data + # is requested and how it is returned. Rails simplifies the routing part of RESTful design by + # supplying you with methods to create them in your routes.rb file. + # + # Read more about REST at http://en.wikipedia.org/wiki/Representational_State_Transfer + class DeprecatedMapper #:doc: + def initialize(set) #:nodoc: + @set = set + end + + # Create an unnamed route with the provided +path+ and +options+. See + # ActionDispatch::Routing for an introduction to routes. + def connect(path, options = {}) + options = options.dup + + if conditions = options.delete(:conditions) + conditions = conditions.dup + method = [conditions.delete(:method)].flatten.compact + method.map! { |m| + m = m.to_s.upcase + + if m == "HEAD" + raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" + end + + unless HTTP_METHODS.include?(m.downcase.to_sym) + raise ArgumentError, "Invalid HTTP method specified in route conditions" + end + + m + } + + if method.length > 1 + method = Regexp.union(*method) + elsif method.length == 1 + method = method.first + else + method = nil + end + end + + path_prefix = options.delete(:path_prefix) + name_prefix = options.delete(:name_prefix) + namespace = options.delete(:namespace) + + name = options.delete(:_name) + name = "#{name_prefix}#{name}" if name_prefix + + requirements = options.delete(:requirements) || {} + defaults = options.delete(:defaults) || {} + options.each do |k, v| + if v.is_a?(Regexp) + if value = options.delete(k) + requirements[k.to_sym] = value + end + else + value = options.delete(k) + defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param + end + end + + requirements.each do |_, requirement| + if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} + raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" + end + if requirement.multiline? + raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" + end + end + + possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } + requirements[:controller] ||= Regexp.union(*possible_names) + + if defaults[:controller] + defaults[:action] ||= 'index' + defaults[:controller] = defaults[:controller].to_s + defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace + end + + if defaults[:action] + defaults[:action] = defaults[:action].to_s + end + + if path.is_a?(String) + path = "#{path_prefix}/#{path}" if path_prefix + path = path.gsub('.:format', '(.:format)') + path = optionalize_trailing_dynamic_segments(path, requirements, defaults) + glob = $1.to_sym if path =~ /\/\*(\w+)$/ + path = ::Rack::Mount::Utils.normalize_path(path) + path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) + + if glob && !defaults[glob].blank? + raise ActionController::RoutingError, "paths cannot have non-empty default values" + end + end + + app = Routing::RouteSet::Dispatcher.new(:defaults => defaults, :glob => glob) + + conditions = {} + conditions[:request_method] = method if method + conditions[:path_info] = path if path + + @set.add_route(app, conditions, defaults, name) + end + + def optionalize_trailing_dynamic_segments(path, requirements, defaults) #:nodoc: + path = (path =~ /^\//) ? path.dup : "/#{path}" + optional, segments = true, [] + + required_segments = requirements.keys + required_segments -= defaults.keys.compact + + old_segments = path.split('/') + old_segments.shift + length = old_segments.length + + old_segments.reverse.each_with_index do |segment, index| + required_segments.each do |required| + if segment =~ /#{required}/ + optional = false + break + end + end + + if optional + if segment == ":id" && segments.include?(":action") + optional = false + elsif segment == ":controller" || segment == ":action" || segment == ":id" + # Ignore + elsif !(segment =~ /^:\w+$/) && + !(segment =~ /^:\w+\(\.:format\)$/) + optional = false + elsif segment =~ /^:(\w+)$/ + if defaults.has_key?($1.to_sym) + defaults.delete($1.to_sym) + else + optional = false + end + end + end + + if optional && index < length - 1 + segments.unshift('(/', segment) + segments.push(')') + elsif optional + segments.unshift('/(', segment) + segments.push(')') + else + segments.unshift('/', segment) + end + end + + segments.join + end + private :optionalize_trailing_dynamic_segments + + # Creates a named route called "root" for matching the root level request. + def root(options = {}) + if options.is_a?(Symbol) + if source_route = @set.named_routes.routes[options] + options = source_route.defaults.merge({ :conditions => source_route.conditions }) + end + end + named_route("root", '', options) + end + + def named_route(name, path, options = {}) #:nodoc: + options[:_name] = name + connect(path, options) + end + + # Enables the use of resources in a module by setting the name_prefix, path_prefix, and namespace for the model. + # Example: + # + # map.namespace(:admin) do |admin| + # admin.resources :products, + # :has_many => [ :tags, :images, :variants ] + # end + # + # This will create +admin_products_url+ pointing to "admin/products", which will look for an Admin::ProductsController. + # It'll also create +admin_product_tags_url+ pointing to "admin/products/#{product_id}/tags", which will look for + # Admin::TagsController. + def namespace(name, options = {}, &block) + if options[:namespace] + with_options({:path_prefix => "#{options.delete(:path_prefix)}/#{name}", :name_prefix => "#{options.delete(:name_prefix)}#{name}_", :namespace => "#{options.delete(:namespace)}#{name}/" }.merge(options), &block) + else + with_options({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(options), &block) + end + end + + def method_missing(route_name, *args, &proc) #:nodoc: + super unless args.length >= 1 && proc.nil? + named_route(route_name, *args) + end + + INHERITABLE_OPTIONS = :namespace, :shallow + + class Resource #:nodoc: + DEFAULT_ACTIONS = :index, :create, :new, :edit, :show, :update, :destroy + + attr_reader :collection_methods, :member_methods, :new_methods + attr_reader :path_prefix, :name_prefix, :path_segment + attr_reader :plural, :singular + attr_reader :options + + def initialize(entities, options) + @plural ||= entities + @singular ||= options[:singular] || plural.to_s.singularize + @path_segment = options.delete(:as) || @plural + + @options = options + + arrange_actions + add_default_actions + set_allowed_actions + set_prefixes + end + + def controller + @controller ||= "#{options[:namespace]}#{(options[:controller] || plural).to_s}" + end + + def requirements(with_id = false) + @requirements ||= @options[:requirements] || {} + @id_requirement ||= { :id => @requirements.delete(:id) || /[^#{Routing::SEPARATORS.join}]+/ } + + with_id ? @requirements.merge(@id_requirement) : @requirements + end + + def conditions + @conditions ||= @options[:conditions] || {} + end + + def path + @path ||= "#{path_prefix}/#{path_segment}" + end + + def new_path + new_action = self.options[:path_names][:new] if self.options[:path_names] + new_action ||= ActionController::Base.resources_path_names[:new] + @new_path ||= "#{path}/#{new_action}" + end + + def shallow_path_prefix + @shallow_path_prefix ||= @options[:shallow] ? @options[:namespace].try(:sub, /\/$/, '') : path_prefix + end + + def member_path + @member_path ||= "#{shallow_path_prefix}/#{path_segment}/:id" + end + + def nesting_path_prefix + @nesting_path_prefix ||= "#{shallow_path_prefix}/#{path_segment}/:#{singular}_id" + end + + def shallow_name_prefix + @shallow_name_prefix ||= @options[:shallow] ? @options[:namespace].try(:gsub, /\//, '_') : name_prefix + end + + def nesting_name_prefix + "#{shallow_name_prefix}#{singular}_" + end + + def action_separator + @action_separator ||= ActionController::Base.resource_action_separator + end + + def uncountable? + @singular.to_s == @plural.to_s + end + + def has_action?(action) + !DEFAULT_ACTIONS.include?(action) || action_allowed?(action) + end + + protected + def arrange_actions + @collection_methods = arrange_actions_by_methods(options.delete(:collection)) + @member_methods = arrange_actions_by_methods(options.delete(:member)) + @new_methods = arrange_actions_by_methods(options.delete(:new)) + end + + def add_default_actions + add_default_action(member_methods, :get, :edit) + add_default_action(new_methods, :get, :new) + end + + def set_allowed_actions + only, except = @options.values_at(:only, :except) + @allowed_actions ||= {} + + if only == :all || except == :none + only = nil + except = [] + elsif only == :none || except == :all + only = [] + except = nil + end + + if only + @allowed_actions[:only] = Array(only).map {|a| a.to_sym } + elsif except + @allowed_actions[:except] = Array(except).map {|a| a.to_sym } + end + end + + def action_allowed?(action) + only, except = @allowed_actions.values_at(:only, :except) + (!only || only.include?(action)) && (!except || !except.include?(action)) + end + + def set_prefixes + @path_prefix = options.delete(:path_prefix) + @name_prefix = options.delete(:name_prefix) + end + + def arrange_actions_by_methods(actions) + (actions || {}).inject({}) do |flipped_hash, (key, value)| + (flipped_hash[value] ||= []) << key + flipped_hash + end + end + + def add_default_action(collection, method, action) + (collection[method] ||= []).unshift(action) + end + end + + class SingletonResource < Resource #:nodoc: + def initialize(entity, options) + @singular = @plural = entity + options[:controller] ||= @singular.to_s.pluralize + super + end + + alias_method :shallow_path_prefix, :path_prefix + alias_method :shallow_name_prefix, :name_prefix + alias_method :member_path, :path + alias_method :nesting_path_prefix, :path + end + + # Creates named routes for implementing verb-oriented controllers + # for a collection \resource. + # + # For example: + # + # map.resources :messages + # + # will map the following actions in the corresponding controller: + # + # class MessagesController < ActionController::Base + # # GET messages_url + # def index + # # return all messages + # end + # + # # GET new_message_url + # def new + # # return an HTML form for describing a new message + # end + # + # # POST messages_url + # def create + # # create a new message + # end + # + # # GET message_url(:id => 1) + # def show + # # find and return a specific message + # end + # + # # GET edit_message_url(:id => 1) + # def edit + # # return an HTML form for editing a specific message + # end + # + # # PUT message_url(:id => 1) + # def update + # # find and update a specific message + # end + # + # # DELETE message_url(:id => 1) + # def destroy + # # delete a specific message + # end + # end + # + # Along with the routes themselves, +resources+ generates named routes for use in + # controllers and views. map.resources :messages produces the following named routes and helpers: + # + # Named Route Helpers + # ============ ===================================================== + # messages messages_url, hash_for_messages_url, + # messages_path, hash_for_messages_path + # + # message message_url(id), hash_for_message_url(id), + # message_path(id), hash_for_message_path(id) + # + # new_message new_message_url, hash_for_new_message_url, + # new_message_path, hash_for_new_message_path + # + # edit_message edit_message_url(id), hash_for_edit_message_url(id), + # edit_message_path(id), hash_for_edit_message_path(id) + # + # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example: + # + # redirect_to :controller => 'messages', :action => 'index' + # # and + # <%= link_to "edit this message", :controller => 'messages', :action => 'edit', :id => @message.id %> + # + # now become: + # + # redirect_to messages_url + # # and + # <%= link_to "edit this message", edit_message_url(@message) # calls @message.id automatically + # + # Since web browsers don't support the PUT and DELETE verbs, you will need to add a parameter '_method' to your + # form tags. The form helpers make this a little easier. For an update form with a @message object: + # + # <%= form_tag message_path(@message), :method => :put %> + # + # or + # + # <% form_for :message, @message, :url => message_path(@message), :html => {:method => :put} do |f| %> + # + # or + # + # <% form_for @message do |f| %> + # + # which takes into account whether @message is a new record or not and generates the + # path and method accordingly. + # + # The +resources+ method accepts the following options to customize the resulting routes: + # * :collection - Add named routes for other actions that operate on the collection. + # Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, + # an array of any of the previous, or :any if the method does not matter. + # These routes map to a URL like /messages/rss, with a route of +rss_messages_url+. + # * :member - Same as :collection, but for actions that operate on a specific member. + # * :new - Same as :collection, but for actions that operate on the new \resource action. + # * :controller - Specify the controller name for the routes. + # * :singular - Specify the singular name used in the member routes. + # * :requirements - Set custom routing parameter requirements; this is a hash of either + # regular expressions (which must match for the route to match) or extra parameters. For example: + # + # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' } + # + # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller. + # * :conditions - Specify custom routing recognition conditions. \Resources sets the :method value for the method-specific routes. + # * :as - Specify a different \resource name to use in the URL path. For example: + # # products_path == '/productos' + # map.resources :products, :as => 'productos' do |product| + # # product_reviews_path(product) == '/productos/1234/comentarios' + # product.resources :product_reviews, :as => 'comentarios' + # end + # + # * :has_one - Specify nested \resources, this is a shorthand for mapping singleton \resources beneath the current. + # * :has_many - Same has :has_one, but for plural \resources. + # + # You may directly specify the routing association with +has_one+ and +has_many+ like: + # + # map.resources :notes, :has_one => :author, :has_many => [:comments, :attachments] + # + # This is the same as: + # + # map.resources :notes do |notes| + # notes.resource :author + # notes.resources :comments + # notes.resources :attachments + # end + # + # * :path_names - Specify different path names for the actions. For example: + # # new_products_path == '/productos/nuevo' + # # bids_product_path(1) == '/productos/1/licitacoes' + # map.resources :products, :as => 'productos', :member => { :bids => :get }, :path_names => { :new => 'nuevo', :bids => 'licitacoes' } + # + # You can also set default action names from an environment, like this: + # config.action_controller.resources_path_names = { :new => 'nuevo', :edit => 'editar' } + # + # * :path_prefix - Set a prefix to the routes with required route variables. + # + # Weblog comments usually belong to a post, so you might use +resources+ like: + # + # map.resources :articles + # map.resources :comments, :path_prefix => '/articles/:article_id' + # + # You can nest +resources+ calls to set this automatically: + # + # map.resources :articles do |article| + # article.resources :comments + # end + # + # The comment \resources work the same, but must now include a value for :article_id. + # + # article_comments_url(@article) + # article_comment_url(@article, @comment) + # + # article_comments_url(:article_id => @article) + # article_comment_url(:article_id => @article, :id => @comment) + # + # If you don't want to load all objects from the database you might want to use the article_id directly: + # + # articles_comments_url(@comment.article_id, @comment) + # + # * :name_prefix - Define a prefix for all generated routes, usually ending in an underscore. + # Use this if you have named routes that may clash. + # + # map.resources :tags, :path_prefix => '/books/:book_id', :name_prefix => 'book_' + # map.resources :tags, :path_prefix => '/toys/:toy_id', :name_prefix => 'toy_' + # + # You may also use :name_prefix to override the generic named routes in a nested \resource: + # + # map.resources :articles do |article| + # article.resources :comments, :name_prefix => nil + # end + # + # This will yield named \resources like so: + # + # comments_url(@article) + # comment_url(@article, @comment) + # + # * :shallow - If true, paths for nested resources which reference a specific member + # (ie. those with an :id parameter) will not use the parent path prefix or name prefix. + # + # The :shallow option is inherited by any nested resource(s). + # + # For example, 'users', 'posts' and 'comments' all use shallow paths with the following nested resources: + # + # map.resources :users, :shallow => true do |user| + # user.resources :posts do |post| + # post.resources :comments + # end + # end + # # --> GET /users/1/posts (maps to the PostsController#index action as usual) + # # also adds the usual named route called "user_posts" + # # --> GET /posts/2 (maps to the PostsController#show action as if it were not nested) + # # also adds the named route called "post" + # # --> GET /posts/2/comments (maps to the CommentsController#index action) + # # also adds the named route called "post_comments" + # # --> GET /comments/2 (maps to the CommentsController#show action as if it were not nested) + # # also adds the named route called "comment" + # + # You may also use :shallow in combination with the +has_one+ and +has_many+ shorthand notations like: + # + # map.resources :users, :has_many => { :posts => :comments }, :shallow => true + # + # * :only and :except - Specify which of the seven default actions should be routed to. + # + # :only and :except may be set to :all, :none, an action name or a + # list of action names. By default, routes are generated for all seven actions. + # + # For example: + # + # map.resources :posts, :only => [:index, :show] do |post| + # post.resources :comments, :except => [:update, :destroy] + # end + # # --> GET /posts (maps to the PostsController#index action) + # # --> POST /posts (fails) + # # --> GET /posts/1 (maps to the PostsController#show action) + # # --> DELETE /posts/1 (fails) + # # --> POST /posts/1/comments (maps to the CommentsController#create action) + # # --> PUT /posts/1/comments/1 (fails) + # + # If map.resources is called with multiple resources, they all get the same options applied. + # + # Examples: + # + # map.resources :messages, :path_prefix => "/thread/:thread_id" + # # --> GET /thread/7/messages/1 + # + # map.resources :messages, :collection => { :rss => :get } + # # --> GET /messages/rss (maps to the #rss action) + # # also adds a named route called "rss_messages" + # + # map.resources :messages, :member => { :mark => :post } + # # --> POST /messages/1/mark (maps to the #mark action) + # # also adds a named route called "mark_message" + # + # map.resources :messages, :new => { :preview => :post } + # # --> POST /messages/new/preview (maps to the #preview action) + # # also adds a named route called "preview_new_message" + # + # map.resources :messages, :new => { :new => :any, :preview => :post } + # # --> POST /messages/new/preview (maps to the #preview action) + # # also adds a named route called "preview_new_message" + # # --> /messages/new can be invoked via any request method + # + # map.resources :messages, :controller => "categories", + # :path_prefix => "/category/:category_id", + # :name_prefix => "category_" + # # --> GET /categories/7/messages/1 + # # has named route "category_message" + # + # The +resources+ method sets HTTP method restrictions on the routes it generates. For example, making an + # HTTP POST on new_message_url will raise a RoutingError exception. The default route in + # config/routes.rb overrides this and allows invalid HTTP methods for \resource routes. + def resources(*entities, &block) + options = entities.extract_options! + entities.each { |entity| map_resource(entity, options.dup, &block) } + end + + # Creates named routes for implementing verb-oriented controllers for a singleton \resource. + # A singleton \resource is global to its current context. For unnested singleton \resources, + # the \resource is global to the current user visiting the application, such as a user's + # /account profile. For nested singleton \resources, the \resource is global to its parent + # \resource, such as a projects \resource that has_one :project_manager. + # The project_manager should be mapped as a singleton \resource under projects: + # + # map.resources :projects do |project| + # project.resource :project_manager + # end + # + # See +resources+ for general conventions. These are the main differences: + # * A singular name is given to map.resource. The default controller name is still taken from the plural name. + # * To specify a custom plural name, use the :plural option. There is no :singular option. + # * No default index route is created for the singleton \resource controller. + # * When nesting singleton \resources, only the singular name is used as the path prefix (example: 'account/messages/1') + # + # For example: + # + # map.resource :account + # + # maps these actions in the Accounts controller: + # + # class AccountsController < ActionController::Base + # # GET new_account_url + # def new + # # return an HTML form for describing the new account + # end + # + # # POST account_url + # def create + # # create an account + # end + # + # # GET account_url + # def show + # # find and return the account + # end + # + # # GET edit_account_url + # def edit + # # return an HTML form for editing the account + # end + # + # # PUT account_url + # def update + # # find and update the account + # end + # + # # DELETE account_url + # def destroy + # # delete the account + # end + # end + # + # Along with the routes themselves, +resource+ generates named routes for + # use in controllers and views. map.resource :account produces + # these named routes and helpers: + # + # Named Route Helpers + # ============ ============================================= + # account account_url, hash_for_account_url, + # account_path, hash_for_account_path + # + # new_account new_account_url, hash_for_new_account_url, + # new_account_path, hash_for_new_account_path + # + # edit_account edit_account_url, hash_for_edit_account_url, + # edit_account_path, hash_for_edit_account_path + def resource(*entities, &block) + options = entities.extract_options! + entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } + end + + private + def map_resource(entities, options = {}, &block) + resource = Resource.new(entities, options) + + with_options :controller => resource.controller do |map| + map_associations(resource, options) + + if block_given? + with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) + end + + map_collection_actions(map, resource) + map_default_collection_actions(map, resource) + map_new_actions(map, resource) + map_member_actions(map, resource) + end + end + + def map_singleton_resource(entities, options = {}, &block) + resource = SingletonResource.new(entities, options) + + with_options :controller => resource.controller do |map| + map_associations(resource, options) + + if block_given? + with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) + end + + map_collection_actions(map, resource) + map_new_actions(map, resource) + map_member_actions(map, resource) + map_default_singleton_actions(map, resource) + end + end + + def map_associations(resource, options) + map_has_many_associations(resource, options.delete(:has_many), options) if options[:has_many] + + path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}" + name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" + + Array(options[:has_one]).each do |association| + resource(association, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => path_prefix, :name_prefix => name_prefix)) + end + end + + def map_has_many_associations(resource, associations, options) + case associations + when Hash + associations.each do |association,has_many| + map_has_many_associations(resource, association, options.merge(:has_many => has_many)) + end + when Array + associations.each do |association| + map_has_many_associations(resource, association, options) + end + when Symbol, String + resources(associations, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, :has_many => options[:has_many])) + else + end + end + + def map_collection_actions(map, resource) + resource.collection_methods.each do |method, actions| + actions.each do |action| + [method].flatten.each do |m| + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= action + + map_resource_routes(map, resource, action, "#{resource.path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.name_prefix}#{resource.plural}", m) + end + end + end + end + + def map_default_collection_actions(map, resource) + index_route_name = "#{resource.name_prefix}#{resource.plural}" + + if resource.uncountable? + index_route_name << "_index" + end + + map_resource_routes(map, resource, :index, resource.path, index_route_name) + map_resource_routes(map, resource, :create, resource.path, index_route_name) + end + + def map_default_singleton_actions(map, resource) + map_resource_routes(map, resource, :create, resource.path, "#{resource.shallow_name_prefix}#{resource.singular}") + end + + def map_new_actions(map, resource) + resource.new_methods.each do |method, actions| + actions.each do |action| + route_path = resource.new_path + route_name = "new_#{resource.name_prefix}#{resource.singular}" + + unless action == :new + route_path = "#{route_path}#{resource.action_separator}#{action}" + route_name = "#{action}_#{route_name}" + end + + map_resource_routes(map, resource, action, route_path, route_name, method) + end + end + end + + def map_member_actions(map, resource) + resource.member_methods.each do |method, actions| + actions.each do |action| + [method].flatten.each do |m| + action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) + action_path ||= ActionController::Base.resources_path_names[action] || action + + map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true }) + end + end + end + + route_path = "#{resource.shallow_name_prefix}#{resource.singular}" + map_resource_routes(map, resource, :show, resource.member_path, route_path) + map_resource_routes(map, resource, :update, resource.member_path, route_path) + map_resource_routes(map, resource, :destroy, resource.member_path, route_path) + end + + def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} ) + if resource.has_action?(action) + action_options = action_options_for(action, resource, method, resource_options) + formatted_route_path = "#{route_path}.:format" + + if route_name && @set.named_routes[route_name.to_sym].nil? + map.named_route(route_name, formatted_route_path, action_options) + else + map.connect(formatted_route_path, action_options) + end + end + end + + def add_conditions_for(conditions, method) + returning({:conditions => conditions.dup}) do |options| + options[:conditions][:method] = method unless method == :any + end + end + + def action_options_for(action, resource, method = nil, resource_options = {}) + default_options = { :action => action.to_s } + require_id = !resource.kind_of?(SingletonResource) + force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource) + + case default_options[:action] + when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) + when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) + when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) + when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) + when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) + else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id)) + end + end + end + end +end diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 44afbb9cd7..ab4193266a 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1,878 +1,312 @@ module ActionDispatch module Routing - # Mapper instances are used to build routes. The object passed to the draw - # block in config/routes.rb is a Mapper instance. - # - # Mapper instances have relatively few instance methods, in order to avoid - # clashes with named routes. - # - # == Overview - # - # ActionController::Resources are a way of defining RESTful \resources. A RESTful \resource, in basic terms, - # is something that can be pointed at and it will respond with a representation of the data requested. - # In real terms this could mean a user with a browser requests an HTML page, or that a desktop application - # requests XML data. - # - # RESTful design is based on the assumption that there are four generic verbs that a user of an - # application can request from a \resource (the noun). - # - # \Resources can be requested using four basic HTTP verbs (GET, POST, PUT, DELETE), the method used - # denotes the type of action that should take place. - # - # === The Different Methods and their Usage - # - # * GET - Requests for a \resource, no saving or editing of a \resource should occur in a GET request. - # * POST - Creation of \resources. - # * PUT - Editing of attributes on a \resource. - # * DELETE - Deletion of a \resource. - # - # === Examples - # - # # A GET request on the Posts resource is asking for all Posts - # GET /posts - # - # # A GET request on a single Post resource is asking for that particular Post - # GET /posts/1 - # - # # A POST request on the Posts resource is asking for a Post to be created with the supplied details - # POST /posts # with => { :post => { :title => "My Whizzy New Post", :body => "I've got a brand new combine harvester" } } - # - # # A PUT request on a single Post resource is asking for a Post to be updated - # PUT /posts # with => { :id => 1, :post => { :title => "Changed Whizzy Title" } } - # - # # A DELETE request on a single Post resource is asking for it to be deleted - # DELETE /posts # with => { :id => 1 } - # - # By using the REST convention, users of our application can assume certain things about how the data - # is requested and how it is returned. Rails simplifies the routing part of RESTful design by - # supplying you with methods to create them in your routes.rb file. - # - # Read more about REST at http://en.wikipedia.org/wiki/Representational_State_Transfer - class Mapper #:doc: - def initialize(set) #:nodoc: - @set = set - end - - # Create an unnamed route with the provided +path+ and +options+. See - # ActionDispatch::Routing for an introduction to routes. - def connect(path, options = {}) - options = options.dup - - if conditions = options.delete(:conditions) - conditions = conditions.dup - method = [conditions.delete(:method)].flatten.compact - method.map! { |m| - m = m.to_s.upcase + class Mapper + module Resources + def resource(*resources, &block) + options = resources.last.is_a?(Hash) ? resources.pop : {} + + if resources.length > 1 + raise ArgumentError if block_given? + resources.each { |r| resource(r, options) } + return self + end - if m == "HEAD" - raise ArgumentError, "HTTP method HEAD is invalid in route conditions. Rails processes HEAD requests the same as GETs, returning just the response headers" - end + resource = resources.pop - unless HTTP_METHODS.include?(m.downcase.to_sym) - raise ArgumentError, "Invalid HTTP method specified in route conditions" + if @scope[:scope_level] == :resources + member do + resource(resource, options, &block) end - - m - } - - if method.length > 1 - method = Regexp.union(*method) - elsif method.length == 1 - method = method.first - else - method = nil + return self end - end - path_prefix = options.delete(:path_prefix) - name_prefix = options.delete(:name_prefix) - namespace = options.delete(:namespace) + controller(resource) do + namespace(resource) do + with_scope_level(:resource) do + yield if block_given? - name = options.delete(:_name) - name = "#{name_prefix}#{name}" if name_prefix - - requirements = options.delete(:requirements) || {} - defaults = options.delete(:defaults) || {} - options.each do |k, v| - if v.is_a?(Regexp) - if value = options.delete(k) - requirements[k.to_sym] = value + get "", :to => :show + post "", :to => :create + put "", :to => :update + delete "", :to => :destory + end end - else - value = options.delete(k) - defaults[k.to_sym] = value.is_a?(Symbol) ? value : value.to_param end - end - requirements.each do |_, requirement| - if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} - raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" - end - if requirement.multiline? - raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}" - end + self end - possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) } - requirements[:controller] ||= Regexp.union(*possible_names) + def resources(*resources, &block) + options = resources.last.is_a?(Hash) ? resources.pop : {} - if defaults[:controller] - defaults[:action] ||= 'index' - defaults[:controller] = defaults[:controller].to_s - defaults[:controller] = "#{namespace}#{defaults[:controller]}" if namespace - end - - if defaults[:action] - defaults[:action] = defaults[:action].to_s - end - - if path.is_a?(String) - path = "#{path_prefix}/#{path}" if path_prefix - path = path.gsub('.:format', '(.:format)') - path = optionalize_trailing_dynamic_segments(path, requirements, defaults) - glob = $1.to_sym if path =~ /\/\*(\w+)$/ - path = ::Rack::Mount::Utils.normalize_path(path) - path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) - - if glob && !defaults[glob].blank? - raise ActionController::RoutingError, "paths cannot have non-empty default values" + if resources.length > 1 + raise ArgumentError if block_given? + resources.each { |r| resources(r, options) } + return self end - end - - app = Routing::RouteSet::Dispatcher.new(:defaults => defaults, :glob => glob) - conditions = {} - conditions[:request_method] = method if method - conditions[:path_info] = path if path - - @set.add_route(app, conditions, defaults, name) - end + resource = resources.pop - def optionalize_trailing_dynamic_segments(path, requirements, defaults) #:nodoc: - path = (path =~ /^\//) ? path.dup : "/#{path}" - optional, segments = true, [] - - required_segments = requirements.keys - required_segments -= defaults.keys.compact - - old_segments = path.split('/') - old_segments.shift - length = old_segments.length - - old_segments.reverse.each_with_index do |segment, index| - required_segments.each do |required| - if segment =~ /#{required}/ - optional = false - break + if @scope[:scope_level] == :resources + member do + resources(resource, options, &block) end + return self end - if optional - if segment == ":id" && segments.include?(":action") - optional = false - elsif segment == ":controller" || segment == ":action" || segment == ":id" - # Ignore - elsif !(segment =~ /^:\w+$/) && - !(segment =~ /^:\w+\(\.:format\)$/) - optional = false - elsif segment =~ /^:(\w+)$/ - if defaults.has_key?($1.to_sym) - defaults.delete($1.to_sym) - else - optional = false + controller(resource) do + namespace(resource) do + with_scope_level(:resources) do + yield if block_given? + + member do + get "", :to => :show + put "", :to => :update + delete "", :to => :destory + get "edit", :to => :edit + end + + collection do + get "", :to => :index + post "", :to => :create + get "new", :to => :new + end end end end - if optional && index < length - 1 - segments.unshift('(/', segment) - segments.push(')') - elsif optional - segments.unshift('/(', segment) - segments.push(')') - else - segments.unshift('/', segment) - end + self end - segments.join - end - private :optionalize_trailing_dynamic_segments - - # Creates a named route called "root" for matching the root level request. - def root(options = {}) - if options.is_a?(Symbol) - if source_route = @set.named_routes.routes[options] - options = source_route.defaults.merge({ :conditions => source_route.conditions }) + def collection + unless @scope[:scope_level] == :resources + raise ArgumentError, "can't use collection outside resources scope" end - end - named_route("root", '', options) - end - - def named_route(name, path, options = {}) #:nodoc: - options[:_name] = name - connect(path, options) - end - # Enables the use of resources in a module by setting the name_prefix, path_prefix, and namespace for the model. - # Example: - # - # map.namespace(:admin) do |admin| - # admin.resources :products, - # :has_many => [ :tags, :images, :variants ] - # end - # - # This will create +admin_products_url+ pointing to "admin/products", which will look for an Admin::ProductsController. - # It'll also create +admin_product_tags_url+ pointing to "admin/products/#{product_id}/tags", which will look for - # Admin::TagsController. - def namespace(name, options = {}, &block) - if options[:namespace] - with_options({:path_prefix => "#{options.delete(:path_prefix)}/#{name}", :name_prefix => "#{options.delete(:name_prefix)}#{name}_", :namespace => "#{options.delete(:namespace)}#{name}/" }.merge(options), &block) - else - with_options({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(options), &block) + with_scope_level(:collection) do + yield + end end - end - - def method_missing(route_name, *args, &proc) #:nodoc: - super unless args.length >= 1 && proc.nil? - named_route(route_name, *args) - end - - INHERITABLE_OPTIONS = :namespace, :shallow - class Resource #:nodoc: - DEFAULT_ACTIONS = :index, :create, :new, :edit, :show, :update, :destroy - - attr_reader :collection_methods, :member_methods, :new_methods - attr_reader :path_prefix, :name_prefix, :path_segment - attr_reader :plural, :singular - attr_reader :options - - def initialize(entities, options) - @plural ||= entities - @singular ||= options[:singular] || plural.to_s.singularize - @path_segment = options.delete(:as) || @plural - - @options = options - - arrange_actions - add_default_actions - set_allowed_actions - set_prefixes - end + def member + unless @scope[:scope_level] == :resources + raise ArgumentError, "can't use member outside resources scope" + end - def controller - @controller ||= "#{options[:namespace]}#{(options[:controller] || plural).to_s}" + with_scope_level(:member) do + scope(":id") do + yield + end + end end - def requirements(with_id = false) - @requirements ||= @options[:requirements] || {} - @id_requirement ||= { :id => @requirements.delete(:id) || /[^#{Routing::SEPARATORS.join}]+/ } + def match(*args) + options = args.last.is_a?(Hash) ? args.pop : {} + args.push(options) - with_id ? @requirements.merge(@id_requirement) : @requirements - end + case options.delete(:on) + when :collection + return collection { match(*args) } + when :member + return member { match(*args) } + end - def conditions - @conditions ||= @options[:conditions] || {} - end + if @scope[:scope_level] == :resources + raise ArgumentError, "can't define route directly in resources scope" + end - def path - @path ||= "#{path_prefix}/#{path_segment}" + super end - def new_path - new_action = self.options[:path_names][:new] if self.options[:path_names] - new_action ||= ActionController::Base.resources_path_names[:new] - @new_path ||= "#{path}/#{new_action}" - end + private + def with_scope_level(kind) + old, @scope[:scope_level] = @scope[:scope_level], kind + yield + ensure + @scope[:scope_level] = old + end + end - def shallow_path_prefix - @shallow_path_prefix ||= @options[:shallow] ? @options[:namespace].try(:sub, /\/$/, '') : path_prefix - end + module Scoping + def scope(*args) + options = args.last.is_a?(Hash) ? args.pop : {} - def member_path - @member_path ||= "#{shallow_path_prefix}/#{path_segment}/:id" - end + constraints = options.delete(:constraints) || {} + unless constraints.is_a?(Hash) + block, constraints = constraints, {} + end + constraints, @scope[:constraints] = @scope[:constraints], (@scope[:constraints] || {}).merge(constraints) + blocks, @scope[:blocks] = @scope[:blocks], (@scope[:blocks] || []) + [block] + + options, @scope[:options] = @scope[:options], (@scope[:options] || {}).merge(options) + + path_set = controller_set = false + + case args.first + when String + path_set = true + path = args.first + path, @scope[:path] = @scope[:path], "#{@scope[:path]}#{Rack::Mount::Utils.normalize_path(path)}" + when Symbol + controller_set = true + controller = args.first + controller, @scope[:controller] = @scope[:controller], controller + end - def nesting_path_prefix - @nesting_path_prefix ||= "#{shallow_path_prefix}/#{path_segment}/:#{singular}_id" - end + yield - def shallow_name_prefix - @shallow_name_prefix ||= @options[:shallow] ? @options[:namespace].try(:gsub, /\//, '_') : name_prefix + self + ensure + @scope[:path] = path if path_set + @scope[:controller] = controller if controller_set + @scope[:options] = options + @scope[:blocks] = blocks + @scope[:constraints] = constraints end - def nesting_name_prefix - "#{shallow_name_prefix}#{singular}_" + def controller(controller) + scope(controller.to_sym) { yield } end - def action_separator - @action_separator ||= ActionController::Base.resource_action_separator + def namespace(path) + scope(path.to_s) { yield } end - def uncountable? - @singular.to_s == @plural.to_s + def constraints(constraints = {}) + scope(:constraints => constraints) { yield } end + end - def has_action?(action) - !DEFAULT_ACTIONS.include?(action) || action_allowed?(action) + class Constraints + def initialize(app, constraints = []) + @app, @constraints = app, constraints end - protected - def arrange_actions - @collection_methods = arrange_actions_by_methods(options.delete(:collection)) - @member_methods = arrange_actions_by_methods(options.delete(:member)) - @new_methods = arrange_actions_by_methods(options.delete(:new)) - end - - def add_default_actions - add_default_action(member_methods, :get, :edit) - add_default_action(new_methods, :get, :new) - end - - def set_allowed_actions - only, except = @options.values_at(:only, :except) - @allowed_actions ||= {} - - if only == :all || except == :none - only = nil - except = [] - elsif only == :none || except == :all - only = [] - except = nil - end - - if only - @allowed_actions[:only] = Array(only).map {|a| a.to_sym } - elsif except - @allowed_actions[:except] = Array(except).map {|a| a.to_sym } - end - end - - def action_allowed?(action) - only, except = @allowed_actions.values_at(:only, :except) - (!only || only.include?(action)) && (!except || !except.include?(action)) - end - - def set_prefixes - @path_prefix = options.delete(:path_prefix) - @name_prefix = options.delete(:name_prefix) - end + def call(env) + req = Rack::Request.new(env) - def arrange_actions_by_methods(actions) - (actions || {}).inject({}) do |flipped_hash, (key, value)| - (flipped_hash[value] ||= []) << key - flipped_hash + @constraints.each { |constraint| + if constraint.respond_to?(:matches?) && !constraint.matches?(req) + return Rack::Mount::Const::EXPECTATION_FAILED_RESPONSE + elsif constraint.respond_to?(:call) && !constraint.call(req) + return Rack::Mount::Const::EXPECTATION_FAILED_RESPONSE end - end + } - def add_default_action(collection, method, action) - (collection[method] ||= []).unshift(action) - end + @app.call(env) + end end - class SingletonResource < Resource #:nodoc: - def initialize(entity, options) - @singular = @plural = entity - options[:controller] ||= @singular.to_s.pluralize - super - end + def initialize(set) + @set = set + @scope = {} - alias_method :shallow_path_prefix, :path_prefix - alias_method :shallow_name_prefix, :name_prefix - alias_method :member_path, :path - alias_method :nesting_path_prefix, :path + extend Scoping + extend Resources end - # Creates named routes for implementing verb-oriented controllers - # for a collection \resource. - # - # For example: - # - # map.resources :messages - # - # will map the following actions in the corresponding controller: - # - # class MessagesController < ActionController::Base - # # GET messages_url - # def index - # # return all messages - # end - # - # # GET new_message_url - # def new - # # return an HTML form for describing a new message - # end - # - # # POST messages_url - # def create - # # create a new message - # end - # - # # GET message_url(:id => 1) - # def show - # # find and return a specific message - # end - # - # # GET edit_message_url(:id => 1) - # def edit - # # return an HTML form for editing a specific message - # end - # - # # PUT message_url(:id => 1) - # def update - # # find and update a specific message - # end - # - # # DELETE message_url(:id => 1) - # def destroy - # # delete a specific message - # end - # end - # - # Along with the routes themselves, +resources+ generates named routes for use in - # controllers and views. map.resources :messages produces the following named routes and helpers: - # - # Named Route Helpers - # ============ ===================================================== - # messages messages_url, hash_for_messages_url, - # messages_path, hash_for_messages_path - # - # message message_url(id), hash_for_message_url(id), - # message_path(id), hash_for_message_path(id) - # - # new_message new_message_url, hash_for_new_message_url, - # new_message_path, hash_for_new_message_path - # - # edit_message edit_message_url(id), hash_for_edit_message_url(id), - # edit_message_path(id), hash_for_edit_message_path(id) - # - # You can use these helpers instead of +url_for+ or methods that take +url_for+ parameters. For example: - # - # redirect_to :controller => 'messages', :action => 'index' - # # and - # <%= link_to "edit this message", :controller => 'messages', :action => 'edit', :id => @message.id %> - # - # now become: - # - # redirect_to messages_url - # # and - # <%= link_to "edit this message", edit_message_url(@message) # calls @message.id automatically - # - # Since web browsers don't support the PUT and DELETE verbs, you will need to add a parameter '_method' to your - # form tags. The form helpers make this a little easier. For an update form with a @message object: - # - # <%= form_tag message_path(@message), :method => :put %> - # - # or - # - # <% form_for :message, @message, :url => message_path(@message), :html => {:method => :put} do |f| %> - # - # or - # - # <% form_for @message do |f| %> - # - # which takes into account whether @message is a new record or not and generates the - # path and method accordingly. - # - # The +resources+ method accepts the following options to customize the resulting routes: - # * :collection - Add named routes for other actions that operate on the collection. - # Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, - # an array of any of the previous, or :any if the method does not matter. - # These routes map to a URL like /messages/rss, with a route of +rss_messages_url+. - # * :member - Same as :collection, but for actions that operate on a specific member. - # * :new - Same as :collection, but for actions that operate on the new \resource action. - # * :controller - Specify the controller name for the routes. - # * :singular - Specify the singular name used in the member routes. - # * :requirements - Set custom routing parameter requirements; this is a hash of either - # regular expressions (which must match for the route to match) or extra parameters. For example: - # - # map.resource :profile, :path_prefix => ':name', :requirements => { :name => /[a-zA-Z]+/, :extra => 'value' } - # - # will only match if the first part is alphabetic, and will pass the parameter :extra to the controller. - # * :conditions - Specify custom routing recognition conditions. \Resources sets the :method value for the method-specific routes. - # * :as - Specify a different \resource name to use in the URL path. For example: - # # products_path == '/productos' - # map.resources :products, :as => 'productos' do |product| - # # product_reviews_path(product) == '/productos/1234/comentarios' - # product.resources :product_reviews, :as => 'comentarios' - # end - # - # * :has_one - Specify nested \resources, this is a shorthand for mapping singleton \resources beneath the current. - # * :has_many - Same has :has_one, but for plural \resources. - # - # You may directly specify the routing association with +has_one+ and +has_many+ like: - # - # map.resources :notes, :has_one => :author, :has_many => [:comments, :attachments] - # - # This is the same as: - # - # map.resources :notes do |notes| - # notes.resource :author - # notes.resources :comments - # notes.resources :attachments - # end - # - # * :path_names - Specify different path names for the actions. For example: - # # new_products_path == '/productos/nuevo' - # # bids_product_path(1) == '/productos/1/licitacoes' - # map.resources :products, :as => 'productos', :member => { :bids => :get }, :path_names => { :new => 'nuevo', :bids => 'licitacoes' } - # - # You can also set default action names from an environment, like this: - # config.action_controller.resources_path_names = { :new => 'nuevo', :edit => 'editar' } - # - # * :path_prefix - Set a prefix to the routes with required route variables. - # - # Weblog comments usually belong to a post, so you might use +resources+ like: - # - # map.resources :articles - # map.resources :comments, :path_prefix => '/articles/:article_id' - # - # You can nest +resources+ calls to set this automatically: - # - # map.resources :articles do |article| - # article.resources :comments - # end - # - # The comment \resources work the same, but must now include a value for :article_id. - # - # article_comments_url(@article) - # article_comment_url(@article, @comment) - # - # article_comments_url(:article_id => @article) - # article_comment_url(:article_id => @article, :id => @comment) - # - # If you don't want to load all objects from the database you might want to use the article_id directly: - # - # articles_comments_url(@comment.article_id, @comment) - # - # * :name_prefix - Define a prefix for all generated routes, usually ending in an underscore. - # Use this if you have named routes that may clash. - # - # map.resources :tags, :path_prefix => '/books/:book_id', :name_prefix => 'book_' - # map.resources :tags, :path_prefix => '/toys/:toy_id', :name_prefix => 'toy_' - # - # You may also use :name_prefix to override the generic named routes in a nested \resource: - # - # map.resources :articles do |article| - # article.resources :comments, :name_prefix => nil - # end - # - # This will yield named \resources like so: - # - # comments_url(@article) - # comment_url(@article, @comment) - # - # * :shallow - If true, paths for nested resources which reference a specific member - # (ie. those with an :id parameter) will not use the parent path prefix or name prefix. - # - # The :shallow option is inherited by any nested resource(s). - # - # For example, 'users', 'posts' and 'comments' all use shallow paths with the following nested resources: - # - # map.resources :users, :shallow => true do |user| - # user.resources :posts do |post| - # post.resources :comments - # end - # end - # # --> GET /users/1/posts (maps to the PostsController#index action as usual) - # # also adds the usual named route called "user_posts" - # # --> GET /posts/2 (maps to the PostsController#show action as if it were not nested) - # # also adds the named route called "post" - # # --> GET /posts/2/comments (maps to the CommentsController#index action) - # # also adds the named route called "post_comments" - # # --> GET /comments/2 (maps to the CommentsController#show action as if it were not nested) - # # also adds the named route called "comment" - # - # You may also use :shallow in combination with the +has_one+ and +has_many+ shorthand notations like: - # - # map.resources :users, :has_many => { :posts => :comments }, :shallow => true - # - # * :only and :except - Specify which of the seven default actions should be routed to. - # - # :only and :except may be set to :all, :none, an action name or a - # list of action names. By default, routes are generated for all seven actions. - # - # For example: - # - # map.resources :posts, :only => [:index, :show] do |post| - # post.resources :comments, :except => [:update, :destroy] - # end - # # --> GET /posts (maps to the PostsController#index action) - # # --> POST /posts (fails) - # # --> GET /posts/1 (maps to the PostsController#show action) - # # --> DELETE /posts/1 (fails) - # # --> POST /posts/1/comments (maps to the CommentsController#create action) - # # --> PUT /posts/1/comments/1 (fails) - # - # If map.resources is called with multiple resources, they all get the same options applied. - # - # Examples: - # - # map.resources :messages, :path_prefix => "/thread/:thread_id" - # # --> GET /thread/7/messages/1 - # - # map.resources :messages, :collection => { :rss => :get } - # # --> GET /messages/rss (maps to the #rss action) - # # also adds a named route called "rss_messages" - # - # map.resources :messages, :member => { :mark => :post } - # # --> POST /messages/1/mark (maps to the #mark action) - # # also adds a named route called "mark_message" - # - # map.resources :messages, :new => { :preview => :post } - # # --> POST /messages/new/preview (maps to the #preview action) - # # also adds a named route called "preview_new_message" - # - # map.resources :messages, :new => { :new => :any, :preview => :post } - # # --> POST /messages/new/preview (maps to the #preview action) - # # also adds a named route called "preview_new_message" - # # --> /messages/new can be invoked via any request method - # - # map.resources :messages, :controller => "categories", - # :path_prefix => "/category/:category_id", - # :name_prefix => "category_" - # # --> GET /categories/7/messages/1 - # # has named route "category_message" - # - # The +resources+ method sets HTTP method restrictions on the routes it generates. For example, making an - # HTTP POST on new_message_url will raise a RoutingError exception. The default route in - # config/routes.rb overrides this and allows invalid HTTP methods for \resource routes. - def resources(*entities, &block) - options = entities.extract_options! - entities.each { |entity| map_resource(entity, options.dup, &block) } + def get(*args, &block) + map_method(:get, *args, &block) end - # Creates named routes for implementing verb-oriented controllers for a singleton \resource. - # A singleton \resource is global to its current context. For unnested singleton \resources, - # the \resource is global to the current user visiting the application, such as a user's - # /account profile. For nested singleton \resources, the \resource is global to its parent - # \resource, such as a projects \resource that has_one :project_manager. - # The project_manager should be mapped as a singleton \resource under projects: - # - # map.resources :projects do |project| - # project.resource :project_manager - # end - # - # See +resources+ for general conventions. These are the main differences: - # * A singular name is given to map.resource. The default controller name is still taken from the plural name. - # * To specify a custom plural name, use the :plural option. There is no :singular option. - # * No default index route is created for the singleton \resource controller. - # * When nesting singleton \resources, only the singular name is used as the path prefix (example: 'account/messages/1') - # - # For example: - # - # map.resource :account - # - # maps these actions in the Accounts controller: - # - # class AccountsController < ActionController::Base - # # GET new_account_url - # def new - # # return an HTML form for describing the new account - # end - # - # # POST account_url - # def create - # # create an account - # end - # - # # GET account_url - # def show - # # find and return the account - # end - # - # # GET edit_account_url - # def edit - # # return an HTML form for editing the account - # end - # - # # PUT account_url - # def update - # # find and update the account - # end - # - # # DELETE account_url - # def destroy - # # delete the account - # end - # end - # - # Along with the routes themselves, +resource+ generates named routes for - # use in controllers and views. map.resource :account produces - # these named routes and helpers: - # - # Named Route Helpers - # ============ ============================================= - # account account_url, hash_for_account_url, - # account_path, hash_for_account_path - # - # new_account new_account_url, hash_for_new_account_url, - # new_account_path, hash_for_new_account_path - # - # edit_account edit_account_url, hash_for_edit_account_url, - # edit_account_path, hash_for_edit_account_path - def resource(*entities, &block) - options = entities.extract_options! - entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } + def post(*args, &block) + map_method(:post, *args, &block) end - private - def map_resource(entities, options = {}, &block) - resource = Resource.new(entities, options) + def put(*args, &block) + map_method(:put, *args, &block) + end - with_options :controller => resource.controller do |map| - map_associations(resource, options) + def delete(*args, &block) + map_method(:delete, *args, &block) + end - if block_given? - with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) - end + def match(*args) + options = args.last.is_a?(Hash) ? args.pop : {} - map_collection_actions(map, resource) - map_default_collection_actions(map, resource) - map_new_actions(map, resource) - map_member_actions(map, resource) - end + if args.length > 1 + args.each { |path| match(path, options) } + return self end - def map_singleton_resource(entities, options = {}, &block) - resource = SingletonResource.new(entities, options) - - with_options :controller => resource.controller do |map| - map_associations(resource, options) - - if block_given? - with_options(options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix), &block) - end - - map_collection_actions(map, resource) - map_new_actions(map, resource) - map_member_actions(map, resource) - map_default_singleton_actions(map, resource) - end + if args.first.is_a?(Symbol) + return match(args.first.to_s, options.merge(:to => args.first.to_sym)) end - def map_associations(resource, options) - map_has_many_associations(resource, options.delete(:has_many), options) if options[:has_many] + path = args.first - path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}" - name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}" + options = (@scope[:options] || {}).merge(options) + conditions, defaults = {}, {} - Array(options[:has_one]).each do |association| - resource(association, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => path_prefix, :name_prefix => name_prefix)) - end - end - - def map_has_many_associations(resource, associations, options) - case associations - when Hash - associations.each do |association,has_many| - map_has_many_associations(resource, association, options.merge(:has_many => has_many)) - end - when Array - associations.each do |association| - map_has_many_associations(resource, association, options) - end - when Symbol, String - resources(associations, options.slice(*INHERITABLE_OPTIONS).merge(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, :has_many => options[:has_many])) - else - end - end + path = nil if path == "" + path = Rack::Mount::Utils.normalize_path(path) if path + path = "#{@scope[:path]}#{path}" if @scope[:path] - def map_collection_actions(map, resource) - resource.collection_methods.each do |method, actions| - actions.each do |action| - [method].flatten.each do |m| - action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) - action_path ||= action + raise ArgumentError, "path is required" unless path - map_resource_routes(map, resource, action, "#{resource.path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.name_prefix}#{resource.plural}", m) - end - end - end + constraints = options[:constraints] || {} + unless constraints.is_a?(Hash) + block, constraints = constraints, {} end + blocks = ((@scope[:blocks] || []) + [block]).compact + constraints = (@scope[:constraints] || {}).merge(constraints) + options.each { |k, v| constraints[k] = v if v.is_a?(Regexp) } - def map_default_collection_actions(map, resource) - index_route_name = "#{resource.name_prefix}#{resource.plural}" - - if resource.uncountable? - index_route_name << "_index" - end + conditions[:path_info] = Rack::Mount::Strexp.compile(path, constraints, %w( / . ? )) - map_resource_routes(map, resource, :index, resource.path, index_route_name) - map_resource_routes(map, resource, :create, resource.path, index_route_name) - end + segment_keys = Rack::Mount::RegexpWithNamedGroups.new(conditions[:path_info]).names + constraints.reject! { |k, v| segment_keys.include?(k.to_s) } + conditions.merge!(constraints) - def map_default_singleton_actions(map, resource) - map_resource_routes(map, resource, :create, resource.path, "#{resource.shallow_name_prefix}#{resource.singular}") + if via = options[:via] + via = Array(via).map { |m| m.to_s.upcase } + conditions[:request_method] = Regexp.union(*via) end - def map_new_actions(map, resource) - resource.new_methods.each do |method, actions| - actions.each do |action| - route_path = resource.new_path - route_name = "new_#{resource.name_prefix}#{resource.singular}" + defaults[:controller] = @scope[:controller].to_s if @scope[:controller] - unless action == :new - route_path = "#{route_path}#{resource.action_separator}#{action}" - route_name = "#{action}_#{route_name}" - end - - map_resource_routes(map, resource, action, route_path, route_name, method) - end - end + if options[:to].respond_to?(:call) + app = options[:to] + defaults.delete(:controller) + defaults.delete(:action) + elsif options[:to].is_a?(String) + defaults[:controller], defaults[:action] = options[:to].split('#') + elsif options[:to].is_a?(Symbol) + defaults[:action] = options[:to].to_s end + app ||= Routing::RouteSet::Dispatcher.new(:defaults => defaults) - def map_member_actions(map, resource) - resource.member_methods.each do |method, actions| - actions.each do |action| - [method].flatten.each do |m| - action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash) - action_path ||= ActionController::Base.resources_path_names[action] || action - - map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true }) - end - end + if app.is_a?(Routing::RouteSet::Dispatcher) + unless defaults.include?(:controller) || segment_keys.include?("controller") + raise ArgumentError, "missing :controller" + end + unless defaults.include?(:action) || segment_keys.include?("action") + raise ArgumentError, "missing :action" end - - route_path = "#{resource.shallow_name_prefix}#{resource.singular}" - map_resource_routes(map, resource, :show, resource.member_path, route_path) - map_resource_routes(map, resource, :update, resource.member_path, route_path) - map_resource_routes(map, resource, :destroy, resource.member_path, route_path) end - def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} ) - if resource.has_action?(action) - action_options = action_options_for(action, resource, method, resource_options) - formatted_route_path = "#{route_path}.:format" + app = Constraints.new(app, blocks) if blocks.any? + @set.add_route(app, conditions, defaults, options[:as]) - if route_name && @set.named_routes[route_name.to_sym].nil? - map.named_route(route_name, formatted_route_path, action_options) - else - map.connect(formatted_route_path, action_options) - end - end - end + self + end - def add_conditions_for(conditions, method) - returning({:conditions => conditions.dup}) do |options| - options[:conditions][:method] = method unless method == :any - end - end + def redirect(path, options = {}) + status = options[:status] || 301 + lambda { |env| + req = Rack::Request.new(env) + url = req.scheme + '://' + req.host + path + [status, {'Location' => url, 'Content-Type' => 'text/html'}, ['Moved Permanently']] + } + end - def action_options_for(action, resource, method = nil, resource_options = {}) - default_options = { :action => action.to_s } - require_id = !resource.kind_of?(SingletonResource) - force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource) - - case default_options[:action] - when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) - when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) - when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) - when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) - when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) - else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id)) - end + private + def map_method(method, *args, &block) + options = args.last.is_a?(Hash) ? args.pop : {} + options[:via] = method + args.push(options) + match(*args, &block) + self end end end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index a6e46b1c78..90d7c208a5 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -208,9 +208,9 @@ module ActionDispatch clear! end - def draw + def draw(&block) clear! - yield Mapper.new(self) + Mapper.new(self).instance_exec(DeprecatedMapper.new(self), &block) @set.add_route(NotFound) install_helpers @set.freeze diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 92373b5d26..04e9acf855 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -41,7 +41,7 @@ class ResourcesTest < ActionController::TestCase end def test_should_arrange_actions - resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, + resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, :collection => { :rss => :get, :reorder => :post, :csv => :post }, :member => { :rss => :get, :atom => :get, :upload => :post, :fix => :post }, :new => { :preview => :get, :draft => :get }) @@ -54,18 +54,18 @@ class ResourcesTest < ActionController::TestCase end def test_should_resource_controller_name_equal_resource_name_by_default - resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, {}) + resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, {}) assert_equal 'messages', resource.controller end def test_should_resource_controller_name_equal_controller_option - resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, :controller => 'posts') + resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, :controller => 'posts') assert_equal 'posts', resource.controller end def test_should_all_singleton_paths_be_the_same [ :path, :nesting_path_prefix, :member_path ].each do |method| - resource = ActionDispatch::Routing::Mapper::SingletonResource.new(:messages, :path_prefix => 'admin') + resource = ActionDispatch::Routing::DeprecatedMapper::SingletonResource.new(:messages, :path_prefix => 'admin') assert_equal 'admin/messages', resource.send(method) end end @@ -121,7 +121,7 @@ class ResourcesTest < ActionController::TestCase end def test_override_paths_for_default_restful_actions - resource = ActionDispatch::Routing::Mapper::Resource.new(:messages, + resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, :path_names => {:new => 'nuevo', :edit => 'editar'}) assert_equal resource.new_path, "#{resource.path}/nuevo" end @@ -281,7 +281,7 @@ class ResourcesTest < ActionController::TestCase def test_with_member_action_and_requirement expected_options = {:controller => 'messages', :action => 'mark', :id => '1.1.1'} - + with_restful_routing(:messages, :requirements => {:id => /[0-9]\.[0-9]\.[0-9]/}, :member => { :mark => :get }) do assert_recognizes(expected_options, :path => 'messages/1.1.1/mark', :method => :get) end @@ -701,8 +701,8 @@ class ResourcesTest < ActionController::TestCase def test_should_not_allow_invalid_head_method_for_member_routes with_routing do |set| - set.draw do |map| - assert_raise(ArgumentError) do + assert_raise(ArgumentError) do + set.draw do |map| map.resources :messages, :member => {:something => :head} end end @@ -711,8 +711,8 @@ class ResourcesTest < ActionController::TestCase def test_should_not_allow_invalid_http_methods_for_member_routes with_routing do |set| - set.draw do |map| - assert_raise(ArgumentError) do + assert_raise(ArgumentError) do + set.draw do |map| map.resources :messages, :member => {:something => :invalid} end end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 308e2a85b1..d7e4646df5 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -2046,3 +2046,335 @@ class RackMountIntegrationTests < ActiveSupport::TestCase assert true end end + +class TestRoutingMapper < ActiveSupport::TestCase + include Rack::Test::Methods + + SprocketsApp = lambda { |env| + [200, {"Content-Type" => "text/html"}, ["javascripts"]] + } + + class IpRestrictor + def self.matches?(request) + request.ip =~ /192\.168\.1\.1\d\d/ + end + end + + class Dispatcher + def self.new(*args) + lambda { |env| + params = env['action_dispatch.request.path_parameters'] + controller, action = params[:controller], params[:action] + [200, {'Content-Type' => 'text/html'}, ["#{controller}##{action}"]] + } + end + end + old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher + ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } + ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, Dispatcher } + + Routes = ActionDispatch::Routing::RouteSet.new + Routes.draw do + controller :sessions do + get 'login', :to => :new, :as => :login + post 'login', :to => :create + + delete 'logout', :to => :destroy, :as => :logout + end + + match 'account/login', :to => redirect("/login") + + match 'openid/login', :via => [:get, :post], :to => "openid#login" + + controller(:global) do + match 'global/:action' + match 'global/export', :to => :export, :as => :export_request + match 'global/hide_notice', :to => :hide_notice, :as => :hide_notice + match '/export/:id/:file', :to => :export, :as => :export_download, :constraints => { :file => /.*/ } + end + + constraints(:ip => /192\.168\.1\.\d\d\d/) do + get 'admin', :to => "queenbee#index" + end + + constraints IpRestrictor do + get 'admin/accounts', :to => "queenbee#accounts" + end + + resources :projects, :controller => :project do + resources :involvements, :attachments + + resources :participants do + put :update_all, :on => :collection + end + + resources :companies do + resources :people + resource :avatar + end + + resources :images do + post :revise, :on => :member + end + + resources :people do + namespace ":access_token" do + resource :avatar + end + + member do + put :accessible_projects + post :resend, :generate_new_password + end + end + + resources :posts do + get :archive, :toggle_view, :on => :collection + post :preview, :on => :member + + resource :subscription + + resources :comments do + post :preview, :on => :collection + end + end + end + + match 'sprockets.js', :to => SprocketsApp + + match 'people/:id/update', :to => 'people#update', :as => :update_person + match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person + + # misc + match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article + + namespace :account do + resource :subscription, :credit, :credit_card + end + + controller :articles do + scope 'articles' do + scope ':title', :title => /[a-z]+/, :as => :with_title do + match ':id', :to => :with_id + end + end + end + + scope ':access_token', :constraints => { :access_token => /\w{5,5}/ } do + resources :rooms + end + end + ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } + ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher } + + def app + Routes + end + + def test_logout + delete '/logout' + assert_equal 'sessions#destroy', last_response.body + + # assert_equal '/logout', app.logout_path + end + + def test_login + get '/login' + assert_equal 'sessions#new', last_response.body + + post '/login' + assert_equal 'sessions#create', last_response.body + + # assert_equal '/login', app.login_path + end + + def test_login_redirect + get '/account/login' + assert_equal 301, last_response.status + assert_equal 'http://example.org/login', last_response.headers['Location'] + assert_equal 'Moved Permanently', last_response.body + end + + def test_openid + get '/openid/login' + assert_equal 'openid#login', last_response.body + + post '/openid/login' + assert_equal 'openid#login', last_response.body + end + + # def test_admin + # get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'} + # assert_equal 'queenbee#index', last_response.body + # + # assert_raise(ActionController::RoutingError) { get '/admin', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # + # get '/admin/accounts', {}, {'REMOTE_ADDR' => '192.168.1.100'} + # assert_equal 'queenbee#accounts', last_response.body + # + # assert_raise(ActionController::RoutingError) { get '/admin/accounts', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # end + + def test_global + get '/global/dashboard' + assert_equal 'global#dashboard', last_response.body + + get '/global/export' + assert_equal 'global#export', last_response.body + + get '/global/hide_notice' + assert_equal 'global#hide_notice', last_response.body + + get '/export/123/foo.txt' + assert_equal 'global#export', last_response.body + + # assert_equal '/global/export', app.export_request_path + # assert_equal '/global/hide_notice', app.hide_notice_path + # assert_equal '/export/123/foo.txt', app.export_download_path(:id => 123, :file => 'foo.txt') + end + + def test_projects + get '/projects/1' + assert_equal 'projects#show', last_response.body + end + + def test_projects_involvements + get '/projects/1/involvements' + assert_equal 'involvements#index', last_response.body + + get '/projects/1/involvements/1' + assert_equal 'involvements#show', last_response.body + end + + def test_projects_attachments + get '/projects/1/attachments' + assert_equal 'attachments#index', last_response.body + end + + def test_projects_participants + get '/projects/1/participants' + assert_equal 'participants#index', last_response.body + + put '/projects/1/participants/update_all' + assert_equal 'participants#update_all', last_response.body + end + + def test_projects_companies + get '/projects/1/companies' + assert_equal 'companies#index', last_response.body + + get '/projects/1/companies/1/people' + assert_equal 'people#index', last_response.body + + get '/projects/1/companies/1/avatar' + assert_equal 'avatar#show', last_response.body + end + + def test_project_images + get '/projects/1/images' + assert_equal 'images#index', last_response.body + + post '/projects/1/images/1/revise' + assert_equal 'images#revise', last_response.body + end + + def test_projects_people + get '/projects/1/people' + assert_equal 'people#index', last_response.body + + get '/projects/1/people/1' + assert_equal 'people#show', last_response.body + + get '/projects/1/people/1/7a2dec8/avatar' + assert_equal 'avatar#show', last_response.body + + put '/projects/1/people/1/accessible_projects' + assert_equal 'people#accessible_projects', last_response.body + + post '/projects/1/people/1/resend' + assert_equal 'people#resend', last_response.body + + post '/projects/1/people/1/generate_new_password' + assert_equal 'people#generate_new_password', last_response.body + end + + def test_projects_posts + get '/projects/1/posts' + assert_equal 'posts#index', last_response.body + + get '/projects/1/posts/archive' + assert_equal 'posts#archive', last_response.body + + get '/projects/1/posts/toggle_view' + assert_equal 'posts#toggle_view', last_response.body + + post '/projects/1/posts/1/preview' + assert_equal 'posts#preview', last_response.body + + get '/projects/1/posts/1/subscription' + assert_equal 'subscription#show', last_response.body + + get '/projects/1/posts/1/comments' + assert_equal 'comments#index', last_response.body + + post '/projects/1/posts/1/comments/preview' + assert_equal 'comments#preview', last_response.body + end + + def test_sprockets + get '/sprockets.js' + assert_equal 'javascripts', last_response.body + end + + def test_update_person_route + get '/people/1/update' + assert_equal 'people#update', last_response.body + + # assert_equal '/people/1/update', app.update_person_path(:id => 1) + end + + def test_update_project_person + get '/projects/1/people/2/update' + assert_equal 'people#update', last_response.body + + # assert_equal '/projects/1/people/2/update', app.update_project_person_path(:project_id => 1, :id => 2) + end + + def test_articles_perma + get '/articles/2009/08/18/rails-3' + assert_equal 'articles#show', last_response.body + + # assert_equal '/articles/2009/8/18/rails-3', app.article_path(:year => 2009, :month => 8, :day => 18, :title => 'rails-3') + end + + def test_account_namespace + get '/account/subscription' + assert_equal 'subscription#show', last_response.body + + get '/account/credit' + assert_equal 'credit#show', last_response.body + + get '/account/credit_card' + assert_equal 'credit_card#show', last_response.body + end + + def test_articles_with_id + get '/articles/rails/1' + assert_equal 'articles#with_id', last_response.body + + assert_raise(ActionController::RoutingError) { get '/articles/123/1' } + + # assert_equal '/articles/rails/1', app.with_title_path(:title => 'rails', :id => 1) + end + + def test_access_token_rooms + get '/12345/rooms' + assert_equal 'rooms#index', last_response.body + + get '/12345/rooms/1' + assert_equal 'rooms#show', last_response.body + + get '/12345/rooms/1/edit' + assert_equal 'rooms#edit', last_response.body + end +end -- cgit v1.2.3 From 207d0483e57b8d017ddd0c225d30a3e4fc9edc0c Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 15:28:34 -0500 Subject: Run bundler before AM and AMo tests --- ci/ci_build.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 6574481c19..c49fb5f0c4 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -50,7 +50,7 @@ cd "#{root_dir}/activemodel" do puts puts "[CruiseControl] Building ActiveModel" puts - build_results[:activemodel] = system 'rake' + build_results[:activemodel] = system 'gem bundle && rake' end rm_f "#{root_dir}/activeresource/debug.log" @@ -73,7 +73,7 @@ cd "#{root_dir}/actionmailer" do puts puts "[CruiseControl] Building ActionMailer" puts - build_results[:actionmailer] = system 'rake' + build_results[:actionmailer] = system 'gem bundle && rake' end cd "#{root_dir}/railties" do -- cgit v1.2.3 From a5c82a9dfb6d63bf90a3378da0b71d6ea592d7e3 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 20 Oct 2009 16:03:55 -0500 Subject: Start rewriting some internal tests to use the new routing dsl --- actionpack/lib/action_controller/metal.rb | 4 ++++ actionpack/test/controller/base_test.rb | 24 +++++++++++----------- actionpack/test/controller/integration_test.rb | 2 +- actionpack/test/controller/rescue_test.rb | 6 +++--- actionpack/test/controller/url_rewriter_test.rb | 8 +++----- actionpack/test/controller/verification_test.rb | 4 ++-- .../dispatch/request/json_params_parsing_test.rb | 2 +- .../dispatch/request/query_string_parsing_test.rb | 2 +- .../request/url_encoded_params_parsing_test.rb | 2 +- .../dispatch/request/xml_params_parsing_test.rb | 2 +- .../test/dispatch/session/cookie_store_test.rb | 2 +- .../test/dispatch/session/mem_cache_store_test.rb | 2 +- actionpack/test/template/test_test.rb | 3 +-- 13 files changed, 32 insertions(+), 31 deletions(-) diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index e9007d3631..6f89bf5d67 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -109,6 +109,10 @@ module ActionController middleware_stack end + def self.call(env) + action(env['action_dispatch.request.path_parameters'][:action]).call(env) + end + # Return a rack endpoint for the given action. Memoize the endpoint, so # multiple calls into MyController.action will return the same object # for the same action. diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index b97ceb4594..b57550a69a 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -10,12 +10,12 @@ module Submodule def public_action render :nothing => true end - + hide_action :hidden_action def hidden_action raise "Noooo!" end - + def another_hidden_action end hide_action :another_hidden_action @@ -30,25 +30,25 @@ class NonEmptyController < ActionController::Base def public_action render :nothing => true end - + hide_action :hidden_action def hidden_action end end class MethodMissingController < ActionController::Base - + hide_action :shouldnt_be_called def shouldnt_be_called raise "NO WAY!" end - + protected - + def method_missing(selector) render :text => selector.to_s end - + end class DefaultUrlOptionsController < ActionController::Base @@ -79,7 +79,7 @@ class ControllerInstanceTests < Test::Unit::TestCase @empty = EmptyController.new @contained = Submodule::ContainedEmptyController.new @empty_controllers = [@empty, @contained, Submodule::SubclassedController.new] - + @non_empty_controllers = [NonEmptyController.new, Submodule::ContainedNonEmptyController.new] end @@ -135,24 +135,24 @@ class PerformActionTest < ActionController::TestCase rescue_action_in_public! end - + def test_get_on_priv_should_show_selector use_controller MethodMissingController get :shouldnt_be_called assert_response :success assert_equal 'shouldnt_be_called', @response.body end - + def test_method_missing_is_not_an_action_name use_controller MethodMissingController assert ! @controller.__send__(:action_method?, 'method_missing') - + get :method_missing assert_response :success assert_equal 'method_missing', @response.body end - + def test_get_on_hidden_should_fail use_controller NonEmptyController assert_raise(ActionController::UnknownAction) { get :hidden_action } diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index fe95fb5750..d6e2a5a974 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -390,7 +390,7 @@ class IntegrationProcessTest < ActionController::IntegrationTest def with_test_route_set with_routing do |set| set.draw do |map| - map.connect "/:action", :controller => "integration_process_test/integration" + match ':action', :to => IntegrationController end yield end diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb index 054a9f2aaf..2b1f532b8d 100644 --- a/actionpack/test/controller/rescue_test.rb +++ b/actionpack/test/controller/rescue_test.rb @@ -343,9 +343,9 @@ class RescueTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - map.connect 'foo', :controller => "rescue_test/test", :action => 'foo' - map.connect 'invalid', :controller => "rescue_test/test", :action => 'invalid' - map.connect 'b00m', :controller => "rescue_test/test", :action => 'b00m' + match 'foo', :to => TestController.action(:foo) + match 'invalid', :to => TestController.action(:invalid) + match 'b00m', :to => TestController.action(:b00m) end yield end diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index d81ced96a8..3b14cbb2d8 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -224,9 +224,8 @@ class UrlWriterTests < ActionController::TestCase def test_named_routes with_routing do |set| set.draw do |map| - map.no_args '/this/is/verbose', :controller => 'home', :action => 'index' - map.home '/home/sweet/home/:user', :controller => 'home', :action => 'index' - map.connect ':controller/:action/:id' + match 'this/is/verbose', :to => 'home#index', :as => :no_args + match 'home/sweet/home/:user', :to => 'home#index', :as => :home end # We need to create a new class in order to install the new named route. @@ -264,7 +263,7 @@ class UrlWriterTests < ActionController::TestCase def test_only_path with_routing do |set| set.draw do |map| - map.home '/home/sweet/home/:user', :controller => 'home', :action => 'index' + match 'home/sweet/home/:user', :to => 'home#index', :as => :home map.connect ':controller/:action/:id' end @@ -334,7 +333,6 @@ class UrlWriterTests < ActionController::TestCase set.draw do |map| map.main '', :controller => 'posts', :format => nil map.resources :posts - map.connect ':controller/:action/:id' end # We need to create a new class in order to install the new named route. diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb index 1a9eb65f29..63e8cf3e61 100644 --- a/actionpack/test/controller/verification_test.rb +++ b/actionpack/test/controller/verification_test.rb @@ -125,8 +125,8 @@ class VerificationTest < ActionController::TestCase assert_not_deprecated do with_routing do |set| set.draw do |map| - map.foo '/foo', :controller => 'test', :action => 'foo' - map.connect ":controller/:action/:id" + match 'foo', :to => 'test#foo', :as => :foo + match 'verification_test/:action', :to => TestController end get :guarded_one_for_named_route_test, :two => "not one" assert_redirected_to '/foo' diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index db6cf7b330..3c2408de5f 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -57,7 +57,7 @@ class JsonParamsParsingTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - map.connect ':action', :controller => "json_params_parsing_test/test" + match ':action', :to => TestController end yield end diff --git a/actionpack/test/dispatch/request/query_string_parsing_test.rb b/actionpack/test/dispatch/request/query_string_parsing_test.rb index a31e326ddf..b764478d87 100644 --- a/actionpack/test/dispatch/request/query_string_parsing_test.rb +++ b/actionpack/test/dispatch/request/query_string_parsing_test.rb @@ -109,7 +109,7 @@ class QueryStringParsingTest < ActionController::IntegrationTest def assert_parses(expected, actual) with_routing do |set| set.draw do |map| - map.connect ':action', :controller => "query_string_parsing_test/test" + match ':action', :to => TestController end get "/parse", actual diff --git a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb index 7167cdafac..e98a49980e 100644 --- a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb @@ -130,7 +130,7 @@ class UrlEncodedParamsParsingTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - map.connect ':action', :controller => "url_encoded_params_parsing_test/test" + match ':action', :to => TestController end yield end diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb index 521002b519..0dc47ed9d5 100644 --- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb @@ -84,7 +84,7 @@ class XmlParamsParsingTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - map.connect ':action', :controller => "xml_params_parsing_test/test" + match ':action', :to => TestController end yield end diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index ab5fabde65..edfc303d3d 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -219,7 +219,7 @@ class CookieStoreTest < ActionController::IntegrationTest def with_test_route_set(options = {}) with_routing do |set| set.draw do |map| - map.connect "/:action", :controller => "cookie_store_test/test" + match ':action', :to => TestController end options = {:key => SessionKey, :secret => SessionSecret}.merge(options) @app = ActionDispatch::Session::CookieStore.new(set, options) diff --git a/actionpack/test/dispatch/session/mem_cache_store_test.rb b/actionpack/test/dispatch/session/mem_cache_store_test.rb index c7435bd06b..afc9d91d50 100644 --- a/actionpack/test/dispatch/session/mem_cache_store_test.rb +++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb @@ -112,7 +112,7 @@ class MemCacheStoreTest < ActionController::IntegrationTest def with_test_route_set with_routing do |set| set.draw do |map| - map.connect "/:action", :controller => "mem_cache_store_test/test" + match ':action', :to => TestController end @app = ActionDispatch::Session::MemCacheStore.new(set, :key => '_session_id') yield diff --git a/actionpack/test/template/test_test.rb b/actionpack/test/template/test_test.rb index 05a14f3554..68e790cf46 100644 --- a/actionpack/test/template/test_test.rb +++ b/actionpack/test/template/test_test.rb @@ -48,8 +48,7 @@ class PeopleHelperTest < ActionView::TestCase def with_test_route_set with_routing do |set| set.draw do |map| - map.people 'people', :controller => 'people', :action => 'index' - map.connect ':controller/:action/:id' + match 'people', :to => 'people#index', :as => :people end yield end -- cgit v1.2.3 From 4f6d6f7031a88b647814fc0154e6b69b636dc912 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Tue, 20 Oct 2009 16:33:54 -0700 Subject: Have all the tests running off a single Gemfile --- .gitignore | 6 +----- Gemfile | 21 +++++++++++++++++++++ actionmailer/Gemfile | 10 ---------- actionmailer/test/abstract_unit.rb | 14 +++++++------- actionpack/Gemfile | 18 ------------------ actionpack/test/abstract_unit.rb | 15 +++++++-------- activemodel/Gemfile | 12 ------------ activemodel/test/cases/helper.rb | 13 ++++++------- activerecord/Gemfile | 8 -------- activerecord/test/cases/helper.rb | 13 ++++++------- activeresource/test/abstract_unit.rb | 10 ++++++++-- .../lib/active_support/testing/isolation.rb | 2 -- activesupport/lib/active_support/vendor.rb | 5 ++++- activesupport/test/abstract_unit.rb | 9 ++++++++- railties/Gemfile | 13 ------------- railties/test/abstract_unit.rb | 15 +++++++-------- railties/test/application/initializer_test.rb | 20 -------------------- railties/test/isolation/abstract_unit.rb | 19 ++++++++----------- 18 files changed, 83 insertions(+), 140 deletions(-) create mode 100644 Gemfile delete mode 100644 actionmailer/Gemfile delete mode 100644 actionpack/Gemfile delete mode 100644 activemodel/Gemfile delete mode 100644 activerecord/Gemfile delete mode 100644 railties/Gemfile diff --git a/.gitignore b/.gitignore index ea0d8bbba7..3b922f29f7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,10 +27,6 @@ railties/guides/output *.rbc *.swp *.swo -actionpack/bin -activerecord/bin +bin vendor/gems/ -*/vendor/gems/ railties/tmp -activerecord/vendor -actionpack/vendor diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..ba55d96783 --- /dev/null +++ b/Gemfile @@ -0,0 +1,21 @@ +Gem.sources.each { |uri| source uri } + +gem "rails", "3.0.pre", :vendored_at => "railties" +%w( + activesupport + activemodel + actionpack + actionmailer + activerecord + activeresource +).each do |lib| + gem lib, '3.0.pre', :vendored_at => lib +end +gem "rack", "1.0.1" +gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" +gem "rack-test", "~> 0.5.0" +gem "erubis", "~> 2.6.0" +gem "arel", :git => "git://github.com/rails/arel.git" +gem "mocha" +gem "sqlite3-ruby" +gem "RedCloth" \ No newline at end of file diff --git a/actionmailer/Gemfile b/actionmailer/Gemfile deleted file mode 100644 index 430b32e8ca..0000000000 --- a/actionmailer/Gemfile +++ /dev/null @@ -1,10 +0,0 @@ -Gem.sources.each { |uri| source uri } -sibling = "#{File.dirname(__FILE__)}/.." - -gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport" -gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel" -gem "actionpack", "3.0.pre", :vendored_at => "#{sibling}/actionpack" -gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" -gem "mocha" - -#disable_system_gems diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 7843623996..fcbaa9e186 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -1,15 +1,15 @@ -bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment" -if File.exist?("#{bundled}.rb") - require bundled -else - $:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib" - $:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib" +root = File.expand_path('../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + $:.unshift("#{root}/activesupport/lib") + $:.unshift("#{root}/actionpack/lib") + $:.unshift("#{root}/actionmailer/lib") end require 'rubygems' require 'test/unit' -$:.unshift "#{File.dirname(__FILE__)}/../lib" require 'action_mailer' require 'action_mailer/test_case' diff --git a/actionpack/Gemfile b/actionpack/Gemfile deleted file mode 100644 index af95766608..0000000000 --- a/actionpack/Gemfile +++ /dev/null @@ -1,18 +0,0 @@ -rails_root = Pathname.new(File.dirname(__FILE__)).join("..") - -Gem.sources.each { |uri| source uri } - -gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0" -gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" -gem "rack-test", "~> 0.5.0" -gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport") -gem "activemodel", "3.0.pre", :vendored_at => rails_root.join("activemodel") -gem "arel", :git => "git://github.com/rails/arel.git" -gem "activerecord", "3.0.pre", :vendored_at => rails_root.join("activerecord") -gem "erubis", "~> 2.6.0" - -gem "mocha" -gem "sqlite3-ruby" -gem "RedCloth" - -disable_system_gems diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index f7a1564f90..05b15d38ee 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -1,13 +1,12 @@ -bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment" -if File.exist?("#{bundled}.rb") - require bundled -else - $:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib" - $:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib" +root = File.expand_path('../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + $:.unshift "#{root}/activesupport/lib" + $:.unshift "#{root}/activemodel/lib" + $:.unshift "#{root}/lib" end -$:.unshift(File.dirname(__FILE__) + '/../lib') - $:.unshift(File.dirname(__FILE__) + '/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers') diff --git a/activemodel/Gemfile b/activemodel/Gemfile deleted file mode 100644 index a192fdaf82..0000000000 --- a/activemodel/Gemfile +++ /dev/null @@ -1,12 +0,0 @@ -rails_root = Pathname.new(File.dirname(__FILE__)).join("..") - -Gem.sources.each { |uri| source uri } - -gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport") -gem "arel", :git => "git://github.com/rails/arel.git" - -only :test do - gem "sqlite3-ruby" -end - -disable_system_gems diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb index e54c85938b..49783c2735 100644 --- a/activemodel/test/cases/helper.rb +++ b/activemodel/test/cases/helper.rb @@ -1,13 +1,12 @@ -bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment" -if File.exist?("#{bundled}.rb") - require bundled -else - $:.unshift(File.dirname(__FILE__) + '/../../lib') - $:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib') +root = File.expand_path('../../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + $:.unshift("#{root}/activesupport/lib") + $:.unshift("#{root}/activemodel/lib") end require 'config' - require 'active_model' # Show backtraces for deprecated behavior for quicker cleanup. diff --git a/activerecord/Gemfile b/activerecord/Gemfile deleted file mode 100644 index 3201e65f02..0000000000 --- a/activerecord/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -Gem.sources.each { |uri| source uri } -sibling = "#{File.dirname(__FILE__)}/.." - -gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport" -gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel" -gem "arel", :git => "git://github.com/rails/arel.git" - -gem "mocha" diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 63014c0297..871cfa6468 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,10 +1,9 @@ -$:.unshift(File.dirname(__FILE__) + '/../../lib') - -bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment" -if File.exist?("#{bundled}.rb") - require bundled -else - $:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib') +root = File.expand_path('../../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + $:.unshift("#{root}/activesupport/lib") + $:.unshift("#{root}/activerecord/lib") end require 'config' diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb index 6a33040243..ee12f785b5 100644 --- a/activeresource/test/abstract_unit.rb +++ b/activeresource/test/abstract_unit.rb @@ -1,9 +1,15 @@ +root = File.expand_path('../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + $:.unshift("#{root}/activesupport/lib") + $:.unshift("#{root}/activeresource/lib") +end + require 'rubygems' require 'test/unit' require 'active_support' require 'active_support/test_case' - -$:.unshift "#{File.dirname(__FILE__)}/../lib" require 'active_resource' $:.unshift "#{File.dirname(__FILE__)}/../test" diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb index 8f7d1c29a9..c75b59c284 100644 --- a/activesupport/lib/active_support/testing/isolation.rb +++ b/activesupport/lib/active_support/testing/isolation.rb @@ -1,5 +1,3 @@ -require "active_support/core_ext/load_error" - module ActiveSupport module Testing class ProxyTestResult diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index 9f464c8246..0f9b0c7554 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -1,3 +1,5 @@ +require 'pathname' + def ActiveSupport.requirable?(file) $LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? } end @@ -10,7 +12,8 @@ end gem lib, "~> #{version}" # Use the vendored lib if the gem's missing or we aren't using RubyGems. rescue LoadError, NoMethodError - $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib") + # There could be symlinks + $LOAD_PATH.unshift Pathname.new(__FILE__).dirname.join("vendor/#{lib}-#{version}/lib").realpath.to_s end end end diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index af9656615c..f390c66838 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,4 +1,12 @@ ORIG_ARGV = ARGV.dup +root = File.expand_path('../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + $:.unshift("#{root}/activesupport/lib") + $:.unshift("#{root}/activerecord/lib") +end + require 'test/unit' @@ -11,7 +19,6 @@ rescue LoadError end ENV['NO_RELOAD'] = '1' -$:.unshift "#{File.dirname(__FILE__)}/../lib" require 'active_support' require 'active_support/test_case' diff --git a/railties/Gemfile b/railties/Gemfile deleted file mode 100644 index c441d69ded..0000000000 --- a/railties/Gemfile +++ /dev/null @@ -1,13 +0,0 @@ -Gem.sources.each { |uri| source uri } -sibling = "#{File.dirname(__FILE__)}/.." - -gem "mocha" - -gem "arel", :git => "git://github.com/rails/arel.git" -gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0" -gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" -gem "rack-test", "~> 0.5.0" - -%w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib| - gem lib, '3.0.pre', :vendored_at => "#{sibling}/#{lib}" -end diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 7977b45a57..47013d7797 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -1,16 +1,15 @@ ORIG_ARGV = ARGV.dup -bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment" -if File.exist?("#{bundled}.rb") - require bundled -else - %w(activesupport activemodel activerecord actionpack actionmailer activeresource).each do |lib| - $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../#{lib}/lib" +root = File.expand_path('../../..', __FILE__) +begin + require "#{root}/vendor/gems/environment" +rescue LoadError + %w(activesupport activemodel activerecord actionpack actionmailer activeresource railties).each do |lib| + $:.unshift "#{root}/#{lib}/lib" end end -$:.unshift File.dirname(__FILE__) + "/../lib" -$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info" +$:.unshift "#{root}/railties/builtin/rails_info" require 'stringio' require 'test/unit' diff --git a/railties/test/application/initializer_test.rb b/railties/test/application/initializer_test.rb index f42954079b..719520bf68 100644 --- a/railties/test/application/initializer_test.rb +++ b/railties/test/application/initializer_test.rb @@ -82,26 +82,6 @@ module ApplicationTests end end - test "action_pack is added to the load path if action_controller is required" do - Rails::Initializer.run do |config| - config.root = app_path - config.frameworks = [:action_controller] - end - Rails.initialize! - - assert $:.include?("#{framework_path}/actionpack/lib") - end - - test "action_pack is added to the load path if action_view is required" do - Rails::Initializer.run do |config| - config.root = app_path - config.frameworks = [:action_view] - end - Rails.initialize! - - assert $:.include?("#{framework_path}/actionpack/lib") - end - test "after_initialize block works correctly" do Rails::Initializer.run do |config| config.root = app_path diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 557292e7d3..11cabb2c0b 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -6,7 +6,6 @@ # # It is also good to know what is the bare minimum to get # Rails booted up. - require 'fileutils' # TODO: Remove rubygems when possible @@ -82,6 +81,7 @@ module TestHelpers def build_app(options = {}) FileUtils.rm_rf(app_path) FileUtils.cp_r(tmp_path('app_template'), app_path) + FileUtils.ln_s(RAILS_FRAMEWORK_ROOT, app_path('vendor/rails')) # Delete the initializers unless requested unless options[:initializers] @@ -114,13 +114,10 @@ module TestHelpers end def boot_rails - bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment" - if File.exist?("#{bundled}.rb") - require bundled - %w(railties railties/lib).each do |path| - $LOAD_PATH.unshift File.expand_path("../../../../#{path}", __FILE__) - end - else + root = File.expand_path('../../../..', __FILE__) + begin + require "#{root}/vendor/gems/environment" + rescue LoadError %w( actionmailer/lib actionpack/lib @@ -131,8 +128,7 @@ module TestHelpers railties/lib railties ).reverse_each do |path| - path = File.expand_path("../../../../#{path}", __FILE__) - $:.unshift(path) + $:.unshift "#{root}/#{path}" end end end @@ -155,5 +151,6 @@ Module.new do end FileUtils.mkdir(tmp_path) - `#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` + root = File.expand_path('../../../..', __FILE__) + `#{Gem.ruby} -r #{root}/vendor/gems/environment #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` end -- cgit v1.2.3 From e714b499cc1f7ebc84f8d0e96607b79e60f2828d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 20 Oct 2009 22:20:01 -0200 Subject: Move validator, human_name and human_attribute_name to ActiveModel, remove deprecated error messages and add i18n_scope and lookup_ancestors. Signed-off-by: Carl Lerche --- activemodel/lib/active_model.rb | 2 + activemodel/lib/active_model/errors.rb | 19 +- activemodel/lib/active_model/naming.rb | 9 +- activemodel/lib/active_model/translation.rb | 59 ++ activemodel/lib/active_model/validations.rb | 1 + activemodel/lib/active_model/validator.rb | 68 ++ activemodel/test/cases/naming_test.rb | 2 +- activemodel/test/cases/translation_test.rb | 51 ++ .../i18n_generate_message_validation_test.rb | 1 - .../test/cases/validations/i18n_validation_test.rb | 8 + .../test/cases/validations/with_validation_test.rb | 8 +- activerecord/lib/active_record.rb | 1 - activerecord/lib/active_record/base.rb | 32 +- activerecord/lib/active_record/validations.rb | 89 --- activerecord/lib/active_record/validator.rb | 68 -- activerecord/test/cases/i18n_test.rb | 6 +- activerecord/test/cases/reflection_test.rb | 4 +- .../i18n_generate_message_validation_test.rb | 129 +--- .../test/cases/validations/i18n_validation_test.rb | 732 --------------------- activerecord/test/cases/validations_test.rb | 31 - 20 files changed, 227 insertions(+), 1093 deletions(-) create mode 100644 activemodel/lib/active_model/translation.rb create mode 100644 activemodel/lib/active_model/validator.rb create mode 100644 activemodel/test/cases/translation_test.rb delete mode 100644 activerecord/lib/active_record/validator.rb diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb index 67f529262d..505e16c195 100644 --- a/activemodel/lib/active_model.rb +++ b/activemodel/lib/active_model.rb @@ -39,8 +39,10 @@ module ActiveModel autoload :Serialization, 'active_model/serialization' autoload :StateMachine, 'active_model/state_machine' autoload :TestCase, 'active_model/test_case' + autoload :Translation, 'active_model/translation' autoload :Validations, 'active_model/validations' autoload :ValidationsRepairHelper, 'active_model/validations_repair_helper' + autoload :Validator, 'active_model/validator' autoload :VERSION, 'active_model/version' module Serializers diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 7a48960f89..e8bb62953d 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -93,7 +93,7 @@ module ActiveModel # company = Company.create(:address => '123 First St.') # company.errors.full_messages # => # ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"] - def full_messages(options = {}) + def full_messages full_messages = [] each do |attribute, messages| @@ -103,8 +103,10 @@ module ActiveModel if attribute == :base messages.each {|m| full_messages << m } else - attr_name = attribute.to_s.humanize - prefix = attr_name + I18n.t('activemodel.errors.format.separator', :default => ' ') + attr_name = @base.class.human_attribute_name(attribute) + options = { :default => ' ', :scope => @base.class.i18n_scope } + prefix = attr_name + I18n.t(:"errors.format.separator", options) + messages.each do |m| full_messages << "#{prefix}#{m}" end @@ -135,10 +137,7 @@ module ActiveModel def generate_message(attribute, message = :invalid, options = {}) message, options[:default] = options[:default], message if options[:default].is_a?(Symbol) - klass_ancestors = [@base.class] - klass_ancestors += @base.class.ancestors.reject {|x| x.is_a?(Module)} - - defaults = klass_ancestors.map do |klass| + defaults = @base.class.lookup_ancestors.map do |klass| [ :"models.#{klass.name.underscore}.attributes.#{attribute}.#{message}", :"models.#{klass.name.underscore}.#{message}" ] end @@ -150,10 +149,10 @@ module ActiveModel value = @base.send(:read_attribute_for_validation, attribute) options = { :default => defaults, - :model => @base.class.name.humanize, - :attribute => attribute.to_s.humanize, + :model => @base.class.model_name.human, + :attribute => @base.class.human_attribute_name(attribute), :value => value, - :scope => [:activemodel, :errors] + :scope => [@base.class.i18n_scope, :errors] }.merge(options) I18n.translate(key, options) diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb index b8c2a367b4..675d62b9a6 100644 --- a/activemodel/lib/active_model/naming.rb +++ b/activemodel/lib/active_model/naming.rb @@ -5,12 +5,13 @@ module ActiveModel attr_reader :singular, :plural, :element, :collection, :partial_path, :human alias_method :cache_key, :collection - def initialize(name) - super + def initialize(klass, name) + super(name) + @klass = klass @singular = ActiveSupport::Inflector.underscore(self).tr('/', '_').freeze @plural = ActiveSupport::Inflector.pluralize(@singular).freeze @element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)).freeze - @human = @element.gsub(/_/, " ") + @human = ActiveSupport::Inflector.humanize(@element).freeze @collection = ActiveSupport::Inflector.tableize(self).freeze @partial_path = "#{@collection}/#{@element}".freeze end @@ -20,7 +21,7 @@ module ActiveModel # Returns an ActiveModel::Name object for module. It can be # used to retrieve all kinds of naming-related information. def model_name - @_model_name ||= ActiveModel::Name.new(name) + @_model_name ||= ActiveModel::Name.new(self, name) end end end diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb new file mode 100644 index 0000000000..dc11198c66 --- /dev/null +++ b/activemodel/lib/active_model/translation.rb @@ -0,0 +1,59 @@ +module ActiveModel + module Translation + include ActiveModel::Naming + + # Returns the i18n_scope for the class. Overwrite if you want custom lookup. + def i18n_scope + :activemodel + end + + # When localizing a string, goes through the lookup returned by this method. + # Used in ActiveModel::Name#human, ActiveModel::Errors#full_messages and + # ActiveModel::Translation#human_attribute_name. + def lookup_ancestors + self.ancestors.select { |x| x.respond_to?(:model_name) } + end + + # Transforms attributes names into a more human format, such as "First name" instead of "first_name". + # + # Example: + # + # Person.human_attribute_name("first_name") # => "First name" + # + # Specify +options+ with additional translating options. + def human_attribute_name(attribute, options = {}) + defaults = lookup_ancestors.map do |klass| + :"#{klass.model_name.underscore}.#{attribute}" + end + + defaults << options.delete(:default) if options[:default] + defaults << attribute.to_s.humanize + + options.reverse_merge! :scope => [self.i18n_scope, :attributes], :count => 1, :default => defaults + I18n.translate(defaults.shift, options) + end + + # Model.human_name is deprecated. Use Model.model_name.human instead. + def human_name(*args) + ActiveSupport::Deprecation.warn("human_name has been deprecated, please use model_name.human instead", caller[0,1]) + model_name.human(*args) + end + end + + class Name < String + # Transform the model name into a more humane format, using I18n. By default, + # it will underscore then humanize the class name (BlogPost.human_name #=> "Blog post"). + # Specify +options+ with additional translating options. + def human(options={}) + defaults = @klass.lookup_ancestors.map do |klass| + klass.model_name.underscore.to_sym + end + + defaults << options.delete(:default) if options[:default] + defaults << @human + + options.reverse_merge! :scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults + I18n.translate(defaults.shift, options) + end + end +end diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 0f178a07c8..064ec98f3a 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -7,6 +7,7 @@ module ActiveModel include ActiveSupport::Callbacks included do + extend ActiveModel::Translation define_callbacks :validate, :scope => :name end diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb new file mode 100644 index 0000000000..09de72b757 --- /dev/null +++ b/activemodel/lib/active_model/validator.rb @@ -0,0 +1,68 @@ +module ActiveModel #:nodoc: + + # A simple base class that can be used along with ActiveModel::Base.validates_with + # + # class Person < ActiveModel::Base + # validates_with MyValidator + # end + # + # class MyValidator < ActiveModel::Validator + # def validate + # if some_complex_logic + # record.errors[:base] = "This record is invalid" + # end + # end + # + # private + # def some_complex_logic + # # ... + # end + # end + # + # Any class that inherits from ActiveModel::Validator will have access to record, + # which is an instance of the record being validated, and must implement a method called validate. + # + # class Person < ActiveModel::Base + # validates_with MyValidator + # end + # + # class MyValidator < ActiveModel::Validator + # def validate + # record # => The person instance being validated + # options # => Any non-standard options passed to validates_with + # end + # end + # + # To cause a validation error, you must add to the record's errors directly + # from within the validators message + # + # class MyValidator < ActiveModel::Validator + # def validate + # record.errors[:base] << "This is some custom error message" + # record.errors[:first_name] << "This is some complex validation" + # # etc... + # end + # end + # + # To add behavior to the initialize method, use the following signature: + # + # class MyValidator < ActiveModel::Validator + # def initialize(record, options) + # super + # @my_custom_field = options[:field_name] || :first_name + # end + # end + # + class Validator + attr_reader :record, :options + + def initialize(record, options) + @record = record + @options = options + end + + def validate + raise "You must override this method" + end + end +end diff --git a/activemodel/test/cases/naming_test.rb b/activemodel/test/cases/naming_test.rb index 4d97af3d13..fe1ea36450 100644 --- a/activemodel/test/cases/naming_test.rb +++ b/activemodel/test/cases/naming_test.rb @@ -2,7 +2,7 @@ require 'cases/helper' class NamingTest < ActiveModel::TestCase def setup - @model_name = ActiveModel::Name.new('Post::TrackBack') + @model_name = ActiveModel::Name.new(self, 'Post::TrackBack') end def test_singular diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb new file mode 100644 index 0000000000..d171784963 --- /dev/null +++ b/activemodel/test/cases/translation_test.rb @@ -0,0 +1,51 @@ +require 'cases/helper' + +class SuperUser + extend ActiveModel::Translation +end + +class User < SuperUser +end + +class ActiveModelI18nTests < ActiveModel::TestCase + + def setup + I18n.backend = I18n::Backend::Simple.new + end + + def test_translated_model_attributes + I18n.backend.store_translations 'en', :activemodel => {:attributes => {:super_user => {:name => 'super_user name attribute'} } } + assert_equal 'super_user name attribute', SuperUser.human_attribute_name('name') + end + + def test_translated_model_attributes_with_symbols + I18n.backend.store_translations 'en', :activemodel => {:attributes => {:super_user => {:name => 'super_user name attribute'} } } + assert_equal 'super_user name attribute', SuperUser.human_attribute_name(:name) + end + + def test_translated_model_attributes_with_ancestor + I18n.backend.store_translations 'en', :activemodel => {:attributes => {:user => {:name => 'user name attribute'} } } + assert_equal 'user name attribute', User.human_attribute_name('name') + end + + def test_translated_model_attributes_with_ancestors_fallback + I18n.backend.store_translations 'en', :activemodel => {:attributes => {:super_user => {:name => 'super_user name attribute'} } } + assert_equal 'super_user name attribute', User.human_attribute_name('name') + end + + def test_translated_model_names + I18n.backend.store_translations 'en', :activemodel => {:models => {:super_user => 'super_user model'} } + assert_equal 'super_user model', SuperUser.model_name.human + end + + def test_translated_model_names_with_sti + I18n.backend.store_translations 'en', :activemodel => {:models => {:user => 'user model'} } + assert_equal 'user model', User.model_name.human + end + + def test_translated_model_names_with_ancestors_fallback + I18n.backend.store_translations 'en', :activemodel => {:models => {:super_user => 'super_user model'} } + assert_equal 'super_user model', User.model_name.human + end +end + diff --git a/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb b/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb index 443a81c6ac..54b2405c92 100644 --- a/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb @@ -63,7 +63,6 @@ class I18nGenerateMessageValidationTest < ActiveModel::TestCase assert_equal 'custom message title', @person.errors.generate_message(:title, :exclusion, :default => 'custom message {{value}}', :value => 'title') end - # validates_associated: generate_message(attr_name, :invalid, :default => configuration[:message], :value => value) # validates_format_of: generate_message(attr_name, :invalid, :default => configuration[:message], :value => value) def test_generate_message_invalid_with_default_message assert_equal 'is invalid', @person.errors.generate_message(:title, :invalid, :default => nil, :value => 'title') diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index fc4f1926b0..68b1b27f75 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -56,6 +56,12 @@ class I18nValidationTest < ActiveModel::TestCase @person.errors.add_on_blank :title, 'custom' end + def test_errors_full_messages_translates_human_attribute_name_for_model_attributes + @person.errors.add('name', 'empty') + I18n.expects(:translate).with(:"person.name", :default => ['Name'], :scope => [:activemodel, :attributes], :count => 1).returns('Name') + @person.errors.full_messages + end + # ActiveRecord::Validations # validates_confirmation_of w/ mocha def test_validates_confirmation_of_generates_message @@ -494,6 +500,8 @@ class I18nValidationTest < ActiveModel::TestCase assert_equal ['global message'], @person.errors[:title] end + # test with validates_with + def test_validations_with_message_symbol_must_translate I18n.backend.store_translations 'en', :activemodel => {:errors => {:messages => {:custom_error => "I am a custom error"}}} Person.validates_presence_of :title, :message => :custom_error diff --git a/activemodel/test/cases/validations/with_validation_test.rb b/activemodel/test/cases/validations/with_validation_test.rb index c290b49a28..fae87a6188 100644 --- a/activemodel/test/cases/validations/with_validation_test.rb +++ b/activemodel/test/cases/validations/with_validation_test.rb @@ -13,24 +13,24 @@ class ValidatesWithTest < ActiveRecord::TestCase ERROR_MESSAGE = "Validation error from validator" OTHER_ERROR_MESSAGE = "Validation error from other validator" - class ValidatorThatAddsErrors < ActiveRecord::Validator + class ValidatorThatAddsErrors < ActiveModel::Validator def validate() record.errors[:base] << ERROR_MESSAGE end end - class OtherValidatorThatAddsErrors < ActiveRecord::Validator + class OtherValidatorThatAddsErrors < ActiveModel::Validator def validate() record.errors[:base] << OTHER_ERROR_MESSAGE end end - class ValidatorThatDoesNotAddErrors < ActiveRecord::Validator + class ValidatorThatDoesNotAddErrors < ActiveModel::Validator def validate() end end - class ValidatorThatValidatesOptions < ActiveRecord::Validator + class ValidatorThatValidatesOptions < ActiveModel::Validator def validate() if options[:field] == :first_name record.errors[:base] << ERROR_MESSAGE diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 88becfb482..8195e78826 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -71,7 +71,6 @@ module ActiveRecord autoload :Timestamp, 'active_record/timestamp' autoload :Transactions, 'active_record/transactions' autoload :Types, 'active_record/types' - autoload :Validator, 'active_record/validator' autoload :Validations, 'active_record/validations' module AttributeMethods diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4274df54cc..4e6090458a 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1386,7 +1386,8 @@ module ActiveRecord #:nodoc: subclasses.each { |klass| klass.reset_inheritable_attributes; klass.reset_column_information } end - def self_and_descendants_from_active_record#nodoc: + # Set the lookup ancestors for ActiveModel. + def lookup_ancestors #:nodoc: klass = self classes = [klass] while klass != klass.base_class @@ -1400,32 +1401,9 @@ module ActiveRecord #:nodoc: [self] end - # Transforms attribute key names into a more humane format, such as "First name" instead of "first_name". Example: - # Person.human_attribute_name("first_name") # => "First name" - # This used to be deprecated in favor of humanize, but is now preferred, because it automatically uses the I18n - # module now. - # Specify +options+ with additional translating options. - def human_attribute_name(attribute_key_name, options = {}) - defaults = self_and_descendants_from_active_record.map do |klass| - :"#{klass.name.underscore}.#{attribute_key_name}" - end - defaults << options[:default] if options[:default] - defaults.flatten! - defaults << attribute_key_name.to_s.humanize - options[:count] ||= 1 - I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => [:activerecord, :attributes])) - end - - # Transform the modelname into a more humane format, using I18n. - # By default, it will underscore then humanize the class name (BlogPost.human_name #=> "Blog post"). - # Default scope of the translation is activerecord.models - # Specify +options+ with additional translating options. - def human_name(options = {}) - defaults = self_and_descendants_from_active_record.map do |klass| - :"#{klass.name.underscore}" - end - defaults << self.name.underscore.humanize - I18n.translate(defaults.shift, {:scope => [:activerecord, :models], :count => 1, :default => defaults}.merge(options)) + # Set the i18n scope to overwrite ActiveModel. + def i18n_scope #:nodoc: + :activerecord end # True if this isn't a concrete subclass needing a STI type condition. diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index e61b253192..0365cb592f 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -17,90 +17,6 @@ module ActiveRecord end end - class Errors < ActiveModel::Errors - class << self - def default_error_messages - message = "Errors.default_error_messages has been deprecated. Please use I18n.translate('activerecord.errors.messages')." - ActiveSupport::Deprecation.warn(message) - - I18n.translate 'activerecord.errors.messages' - end - end - - # Returns all the full error messages in an array. - # - # class Company < ActiveRecord::Base - # validates_presence_of :name, :address, :email - # validates_length_of :name, :in => 5..30 - # end - # - # company = Company.create(:address => '123 First St.') - # company.errors.full_messages # => - # ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"] - def full_messages(options = {}) - full_messages = [] - - each do |attribute, messages| - messages = Array.wrap(messages) - next if messages.empty? - - if attribute == :base - messages.each {|m| full_messages << m } - else - attr_name = @base.class.human_attribute_name(attribute.to_s) - prefix = attr_name + I18n.t('activerecord.errors.format.separator', :default => ' ') - messages.each do |m| - full_messages << "#{prefix}#{m}" - end - end - end - - full_messages - end - - # Translates an error message in it's default scope (activerecord.errrors.messages). - # Error messages are first looked up in models.MODEL.attributes.ATTRIBUTE.MESSAGE, if it's not there, - # it's looked up in models.MODEL.MESSAGE and if that is not there it returns the translation of the - # default message (e.g. activerecord.errors.messages.MESSAGE). The translated model name, - # translated attribute name and the value are available for interpolation. - # - # When using inheritance in your models, it will check all the inherited models too, but only if the model itself - # hasn't been found. Say you have class Admin < User; end and you wanted the translation for the :blank - # error +message+ for the title +attribute+, it looks for these translations: - # - #
    - #
  1. activerecord.errors.models.admin.attributes.title.blank
  2. - #
  3. activerecord.errors.models.admin.blank
  4. - #
  5. activerecord.errors.models.user.attributes.title.blank
  6. - #
  7. activerecord.errors.models.user.blank
  8. - #
  9. activerecord.errors.messages.blank
  10. - #
  11. any default you provided through the +options+ hash (in the activerecord.errors scope)
  12. - #
- def generate_message(attribute, message = :invalid, options = {}) - message, options[:default] = options[:default], message if options[:default].is_a?(Symbol) - - defaults = @base.class.self_and_descendants_from_active_record.map do |klass| - [ :"models.#{klass.name.underscore}.attributes.#{attribute}.#{message}", - :"models.#{klass.name.underscore}.#{message}" ] - end - - defaults << options.delete(:default) - defaults = defaults.compact.flatten << :"messages.#{message}" - - key = defaults.shift - value = @base.respond_to?(attribute) ? @base.send(attribute) : nil - - options = { :default => defaults, - :model => @base.class.human_name, - :attribute => @base.class.human_attribute_name(attribute.to_s), - :value => value, - :scope => [:activerecord, :errors] - }.merge(options) - - I18n.translate(key, options) - end - end - module Validations extend ActiveSupport::Concern @@ -165,11 +81,6 @@ module ActiveRecord errors.empty? end - - # Returns the Errors object that holds all information about attribute error messages. - def errors - @errors ||= Errors.new(self) - end end end end diff --git a/activerecord/lib/active_record/validator.rb b/activerecord/lib/active_record/validator.rb deleted file mode 100644 index 83a33f4dcd..0000000000 --- a/activerecord/lib/active_record/validator.rb +++ /dev/null @@ -1,68 +0,0 @@ -module ActiveRecord #:nodoc: - - # A simple base class that can be used along with ActiveRecord::Base.validates_with - # - # class Person < ActiveRecord::Base - # validates_with MyValidator - # end - # - # class MyValidator < ActiveRecord::Validator - # def validate - # if some_complex_logic - # record.errors[:base] = "This record is invalid" - # end - # end - # - # private - # def some_complex_logic - # # ... - # end - # end - # - # Any class that inherits from ActiveRecord::Validator will have access to record, - # which is an instance of the record being validated, and must implement a method called validate. - # - # class Person < ActiveRecord::Base - # validates_with MyValidator - # end - # - # class MyValidator < ActiveRecord::Validator - # def validate - # record # => The person instance being validated - # options # => Any non-standard options passed to validates_with - # end - # end - # - # To cause a validation error, you must add to the record's errors directly - # from within the validators message - # - # class MyValidator < ActiveRecord::Validator - # def validate - # record.errors[:base] << "This is some custom error message" - # record.errors[:first_name] << "This is some complex validation" - # # etc... - # end - # end - # - # To add behavior to the initialize method, use the following signature: - # - # class MyValidator < ActiveRecord::Validator - # def initialize(record, options) - # super - # @my_custom_field = options[:field_name] || :first_name - # end - # end - # - class Validator - attr_reader :record, :options - - def initialize(record, options) - @record = record - @options = options - end - - def validate - raise "You must override this method" - end - end -end diff --git a/activerecord/test/cases/i18n_test.rb b/activerecord/test/cases/i18n_test.rb index d59c53cec8..ae4dcfb81e 100644 --- a/activerecord/test/cases/i18n_test.rb +++ b/activerecord/test/cases/i18n_test.rb @@ -30,17 +30,17 @@ class ActiveRecordI18nTests < Test::Unit::TestCase def test_translated_model_names I18n.backend.store_translations 'en', :activerecord => {:models => {:topic => 'topic model'} } - assert_equal 'topic model', Topic.human_name + assert_equal 'topic model', Topic.model_name.human end def test_translated_model_names_with_sti I18n.backend.store_translations 'en', :activerecord => {:models => {:reply => 'reply model'} } - assert_equal 'reply model', Reply.human_name + assert_equal 'reply model', Reply.model_name.human end def test_translated_model_names_with_sti_fallback I18n.backend.store_translations 'en', :activerecord => {:models => {:topic => 'topic model'} } - assert_equal 'topic model', Reply.human_name + assert_equal 'topic model', Reply.model_name.human end end diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index f3ed8ccd8d..99e248743a 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -15,8 +15,8 @@ class ReflectionTest < ActiveRecord::TestCase end def test_human_name - assert_equal "Price estimate", PriceEstimate.human_name - assert_equal "Subscriber", Subscriber.human_name + assert_equal "Price estimate", PriceEstimate.model_name.human + assert_equal "Subscriber", Subscriber.model_name.human end def test_column_null_not_null diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb index 3794a0ebb9..3f96d7973b 100644 --- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb @@ -17,26 +17,7 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase } end - # validates_inclusion_of: generate_message(attr_name, :inclusion, :default => configuration[:message], :value => value) - def test_generate_message_inclusion_with_default_message - assert_equal 'is not included in the list', @topic.errors.generate_message(:title, :inclusion, :default => nil, :value => 'title') - end - - def test_generate_message_inclusion_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :inclusion, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_exclusion_of: generate_message(attr_name, :exclusion, :default => configuration[:message], :value => value) - def test_generate_message_exclusion_with_default_message - assert_equal 'is reserved', @topic.errors.generate_message(:title, :exclusion, :default => nil, :value => 'title') - end - - def test_generate_message_exclusion_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :exclusion, :default => 'custom message {{value}}', :value => 'title') - end - # validates_associated: generate_message(attr_name, :invalid, :default => configuration[:message], :value => value) - # validates_format_of: generate_message(attr_name, :invalid, :default => configuration[:message], :value => value) def test_generate_message_invalid_with_default_message assert_equal 'is invalid', @topic.errors.generate_message(:title, :invalid, :default => nil, :value => 'title') end @@ -45,107 +26,6 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase assert_equal 'custom message title', @topic.errors.generate_message(:title, :invalid, :default => 'custom message {{value}}', :value => 'title') end - # validates_confirmation_of: generate_message(attr_name, :confirmation, :default => configuration[:message]) - def test_generate_message_confirmation_with_default_message - assert_equal "doesn't match confirmation", @topic.errors.generate_message(:title, :confirmation, :default => nil) - end - - def test_generate_message_confirmation_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :confirmation, :default => 'custom message') - end - - # validates_acceptance_of: generate_message(attr_name, :accepted, :default => configuration[:message]) - def test_generate_message_accepted_with_default_message - assert_equal "must be accepted", @topic.errors.generate_message(:title, :accepted, :default => nil) - end - - def test_generate_message_accepted_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :accepted, :default => 'custom message') - end - - # add_on_empty: generate_message(attr, :empty, :default => custom_message) - def test_generate_message_empty_with_default_message - assert_equal "can't be empty", @topic.errors.generate_message(:title, :empty, :default => nil) - end - - def test_generate_message_empty_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :empty, :default => 'custom message') - end - - # add_on_blank: generate_message(attr, :blank, :default => custom_message) - def test_generate_message_blank_with_default_message - assert_equal "can't be blank", @topic.errors.generate_message(:title, :blank, :default => nil) - end - - def test_generate_message_blank_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :blank, :default => 'custom message') - end - - # validates_length_of: generate_message(attr, :too_long, :default => options[:too_long], :count => option_value.end) - def test_generate_message_too_long_with_default_message - assert_equal "is too long (maximum is 10 characters)", @topic.errors.generate_message(:title, :too_long, :default => nil, :count => 10) - end - - def test_generate_message_too_long_with_custom_message - assert_equal 'custom message 10', @topic.errors.generate_message(:title, :too_long, :default => 'custom message {{count}}', :count => 10) - end - - # validates_length_of: generate_message(attr, :too_short, :default => options[:too_short], :count => option_value.begin) - def test_generate_message_too_short_with_default_message - assert_equal "is too short (minimum is 10 characters)", @topic.errors.generate_message(:title, :too_short, :default => nil, :count => 10) - end - - def test_generate_message_too_short_with_custom_message - assert_equal 'custom message 10', @topic.errors.generate_message(:title, :too_short, :default => 'custom message {{count}}', :count => 10) - end - - # validates_length_of: generate_message(attr, key, :default => custom_message, :count => option_value) - def test_generate_message_wrong_length_with_default_message - assert_equal "is the wrong length (should be 10 characters)", @topic.errors.generate_message(:title, :wrong_length, :default => nil, :count => 10) - end - - def test_generate_message_wrong_length_with_custom_message - assert_equal 'custom message 10', @topic.errors.generate_message(:title, :wrong_length, :default => 'custom message {{count}}', :count => 10) - end - - # validates_numericality_of: generate_message(attr_name, :not_a_number, :value => raw_value, :default => configuration[:message]) - def test_generate_message_not_a_number_with_default_message - assert_equal "is not a number", @topic.errors.generate_message(:title, :not_a_number, :default => nil, :value => 'title') - end - - def test_generate_message_not_a_number_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :not_a_number, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_numericality_of: generate_message(attr_name, option, :value => raw_value, :default => configuration[:message]) - def test_generate_message_greater_than_with_default_message - assert_equal "must be greater than 10", @topic.errors.generate_message(:title, :greater_than, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_greater_than_or_equal_to_with_default_message - assert_equal "must be greater than or equal to 10", @topic.errors.generate_message(:title, :greater_than_or_equal_to, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_equal_to_with_default_message - assert_equal "must be equal to 10", @topic.errors.generate_message(:title, :equal_to, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_less_than_with_default_message - assert_equal "must be less than 10", @topic.errors.generate_message(:title, :less_than, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_less_than_or_equal_to_with_default_message - assert_equal "must be less than or equal to 10", @topic.errors.generate_message(:title, :less_than_or_equal_to, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_odd_with_default_message - assert_equal "must be odd", @topic.errors.generate_message(:title, :odd, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_even_with_default_message - assert_equal "must be even", @topic.errors.generate_message(:title, :even, :default => nil, :value => 'title', :count => 10) - end - # validates_uniqueness_of: generate_message(attr_name, :taken, :default => configuration[:message]) def test_generate_message_taken_with_default_message assert_equal "has already been taken", @topic.errors.generate_message(:title, :taken, :default => nil, :value => 'title') @@ -155,4 +35,13 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase assert_equal 'custom message title', @topic.errors.generate_message(:title, :taken, :default => 'custom message {{value}}', :value => 'title') end + # ActiveRecord#RecordInvalid exception + + test "RecordInvalid exception can be localized" do + topic = Topic.new + topic.errors.add(:title, :invalid) + topic.errors.add(:title, :blank) + assert_equal "Validation failed: Title is invalid, Title can't be blank", ActiveRecord::RecordInvalid.new(topic).message + end + end diff --git a/activerecord/test/cases/validations/i18n_validation_test.rb b/activerecord/test/cases/validations/i18n_validation_test.rb index 252138c0d6..532de67d99 100644 --- a/activerecord/test/cases/validations/i18n_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_validation_test.rb @@ -30,20 +30,6 @@ class I18nValidationTest < ActiveRecord::TestCase end end - def test_percent_s_interpolation_syntax_in_error_messages_was_deprecated - assert_not_deprecated do - default = "%s interpolation syntax was deprecated" - assert_equal default, I18n.t(:does_not_exist, :default => default, :value => 'this') - end - end - - def test_percent_d_interpolation_syntax_in_error_messages_was_deprecated - assert_not_deprecated do - default = "%d interpolation syntaxes are deprecated" - assert_equal default, I18n.t(:does_not_exist, :default => default, :count => 2) - end - end - # ActiveRecord::Errors def test_errors_generate_message_translates_custom_model_attribute_key I18n.expects(:translate).with( @@ -162,722 +148,4 @@ class I18nValidationTest < ActiveRecord::TestCase assert_equal ['global message'], replied_topic.errors[:replies] end - def test_errors_add_on_empty_generates_message - @topic.errors.expects(:generate_message).with(:title, :empty, {:default => nil}) - @topic.errors.add_on_empty :title - end - - def test_errors_add_on_empty_generates_message_with_custom_default_message - @topic.errors.expects(:generate_message).with(:title, :empty, {:default => 'custom'}) - @topic.errors.add_on_empty :title, 'custom' - end - - def test_errors_add_on_blank_generates_message - @topic.errors.expects(:generate_message).with(:title, :blank, {:default => nil}) - @topic.errors.add_on_blank :title - end - - def test_errors_add_on_blank_generates_message_with_custom_default_message - @topic.errors.expects(:generate_message).with(:title, :blank, {:default => 'custom'}) - @topic.errors.add_on_blank :title, 'custom' - end - - def test_errors_full_messages_translates_human_attribute_name_for_model_attributes - @topic.errors.add('title', 'empty') - I18n.expects(:translate).with(:"topic.title", :default => ['Title'], :scope => [:activerecord, :attributes], :count => 1).returns('Title') - @topic.errors.full_messages :locale => 'en' - end - - # ActiveRecord::Validations - # validates_confirmation_of w/ mocha - def test_validates_confirmation_of_generates_message - Topic.validates_confirmation_of :title - @topic.title_confirmation = 'foo' - @topic.errors.expects(:generate_message).with(:title, :confirmation, {:default => nil}) - @topic.valid? - end - - def test_validates_confirmation_of_generates_message_with_custom_default_message - Topic.validates_confirmation_of :title, :message => 'custom' - @topic.title_confirmation = 'foo' - @topic.errors.expects(:generate_message).with(:title, :confirmation, {:default => 'custom'}) - @topic.valid? - end - - # validates_acceptance_of w/ mocha - - def test_validates_acceptance_of_generates_message - Topic.validates_acceptance_of :title, :allow_nil => false - @topic.errors.expects(:generate_message).with(:title, :accepted, {:default => nil}) - @topic.valid? - end - - def test_validates_acceptance_of_generates_message_with_custom_default_message - Topic.validates_acceptance_of :title, :message => 'custom', :allow_nil => false - @topic.errors.expects(:generate_message).with(:title, :accepted, {:default => 'custom'}) - @topic.valid? - end - - # validates_presence_of w/ mocha - - def test_validates_presence_of_generates_message - Topic.validates_presence_of :title - @topic.errors.expects(:generate_message).with(:title, :blank, {:default => nil}) - @topic.valid? - end - - def test_validates_presence_of_generates_message_with_custom_default_message - Topic.validates_presence_of :title, :message => 'custom' - @topic.errors.expects(:generate_message).with(:title, :blank, {:default => 'custom'}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_short - Topic.validates_length_of :title, :within => 3..5 - @topic.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => nil}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_short_and_custom_default_message - Topic.validates_length_of :title, :within => 3..5, :too_short => 'custom' - @topic.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => 'custom'}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_long - Topic.validates_length_of :title, :within => 3..5 - @topic.title = 'this title is too long' - @topic.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => nil}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_long_and_custom_default_message - Topic.validates_length_of :title, :within => 3..5, :too_long => 'custom' - @topic.title = 'this title is too long' - @topic.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => 'custom'}) - @topic.valid? - end - - # validates_length_of :within w/ mocha - - def test_validates_length_of_within_generates_message_with_title_too_short - Topic.validates_length_of :title, :within => 3..5 - @topic.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => nil}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_short_and_custom_default_message - Topic.validates_length_of :title, :within => 3..5, :too_short => 'custom' - @topic.errors.expects(:generate_message).with(:title, :too_short, {:count => 3, :default => 'custom'}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_long - Topic.validates_length_of :title, :within => 3..5 - @topic.title = 'this title is too long' - @topic.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => nil}) - @topic.valid? - end - - def test_validates_length_of_within_generates_message_with_title_too_long_and_custom_default_message - Topic.validates_length_of :title, :within => 3..5, :too_long => 'custom' - @topic.title = 'this title is too long' - @topic.errors.expects(:generate_message).with(:title, :too_long, {:count => 5, :default => 'custom'}) - @topic.valid? - end - - # validates_length_of :is w/ mocha - - def test_validates_length_of_is_generates_message - Topic.validates_length_of :title, :is => 5 - @topic.errors.expects(:generate_message).with(:title, :wrong_length, {:count => 5, :default => nil}) - @topic.valid? - end - - def test_validates_length_of_is_generates_message_with_custom_default_message - Topic.validates_length_of :title, :is => 5, :message => 'custom' - @topic.errors.expects(:generate_message).with(:title, :wrong_length, {:count => 5, :default => 'custom'}) - @topic.valid? - end - - # validates_format_of w/ mocha - - def test_validates_format_of_generates_message - Topic.validates_format_of :title, :with => /^[1-9][0-9]*$/ - @topic.title = '72x' - @topic.errors.expects(:generate_message).with(:title, :invalid, {:value => '72x', :default => nil}) - @topic.valid? - end - - def test_validates_format_of_generates_message_with_custom_default_message - Topic.validates_format_of :title, :with => /^[1-9][0-9]*$/, :message => 'custom' - @topic.title = '72x' - @topic.errors.expects(:generate_message).with(:title, :invalid, {:value => '72x', :default => 'custom'}) - @topic.valid? - end - - # validates_inclusion_of w/ mocha - - def test_validates_inclusion_of_generates_message - Topic.validates_inclusion_of :title, :in => %w(a b c) - @topic.title = 'z' - @topic.errors.expects(:generate_message).with(:title, :inclusion, {:value => 'z', :default => nil}) - @topic.valid? - end - - def test_validates_inclusion_of_generates_message_with_custom_default_message - Topic.validates_inclusion_of :title, :in => %w(a b c), :message => 'custom' - @topic.title = 'z' - @topic.errors.expects(:generate_message).with(:title, :inclusion, {:value => 'z', :default => 'custom'}) - @topic.valid? - end - - # validates_exclusion_of w/ mocha - - def test_validates_exclusion_of_generates_message - Topic.validates_exclusion_of :title, :in => %w(a b c) - @topic.title = 'a' - @topic.errors.expects(:generate_message).with(:title, :exclusion, {:value => 'a', :default => nil}) - @topic.valid? - end - - def test_validates_exclusion_of_generates_message_with_custom_default_message - Topic.validates_exclusion_of :title, :in => %w(a b c), :message => 'custom' - @topic.title = 'a' - @topic.errors.expects(:generate_message).with(:title, :exclusion, {:value => 'a', :default => 'custom'}) - @topic.valid? - end - - # validates_numericality_of without :only_integer w/ mocha - - def test_validates_numericality_of_generates_message - Topic.validates_numericality_of :title - @topic.title = 'a' - @topic.errors.expects(:generate_message).with(:title, :not_a_number, {:value => 'a', :default => nil}) - @topic.valid? - end - - def test_validates_numericality_of_generates_message_with_custom_default_message - Topic.validates_numericality_of :title, :message => 'custom' - @topic.title = 'a' - @topic.errors.expects(:generate_message).with(:title, :not_a_number, {:value => 'a', :default => 'custom'}) - @topic.valid? - end - - # validates_numericality_of with :only_integer w/ mocha - - def test_validates_numericality_of_only_integer_generates_message - Topic.validates_numericality_of :title, :only_integer => true - @topic.title = 'a' - @topic.errors.expects(:generate_message).with(:title, :not_a_number, {:value => 'a', :default => nil}) - @topic.valid? - end - - def test_validates_numericality_of_only_integer_generates_message_with_custom_default_message - Topic.validates_numericality_of :title, :only_integer => true, :message => 'custom' - @topic.title = 'a' - @topic.errors.expects(:generate_message).with(:title, :not_a_number, {:value => 'a', :default => 'custom'}) - @topic.valid? - end - - # validates_numericality_of :odd w/ mocha - - def test_validates_numericality_of_odd_generates_message - Topic.validates_numericality_of :title, :only_integer => true, :odd => true - @topic.title = 0 - @topic.errors.expects(:generate_message).with(:title, :odd, {:value => 0, :default => nil}) - @topic.valid? - end - - def test_validates_numericality_of_odd_generates_message_with_custom_default_message - Topic.validates_numericality_of :title, :only_integer => true, :odd => true, :message => 'custom' - @topic.title = 0 - @topic.errors.expects(:generate_message).with(:title, :odd, {:value => 0, :default => 'custom'}) - @topic.valid? - end - - # validates_numericality_of :less_than w/ mocha - - def test_validates_numericality_of_less_than_generates_message - Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0 - @topic.title = 1 - @topic.errors.expects(:generate_message).with(:title, :less_than, {:value => 1, :count => 0, :default => nil}) - @topic.valid? - end - - def test_validates_numericality_of_odd_generates_message_with_custom_default_message - Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0, :message => 'custom' - @topic.title = 1 - @topic.errors.expects(:generate_message).with(:title, :less_than, {:value => 1, :count => 0, :default => 'custom'}) - @topic.valid? - end - - # validates_confirmation_of w/o mocha - - def test_validates_confirmation_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:confirmation => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:confirmation => 'global message'}}} - - Topic.validates_confirmation_of :title - @topic.title_confirmation = 'foo' - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_confirmation_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:confirmation => 'global message'}}} - - Topic.validates_confirmation_of :title - @topic.title_confirmation = 'foo' - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_acceptance_of w/o mocha - - def test_validates_acceptance_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:accepted => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:accepted => 'global message'}}} - - Topic.validates_acceptance_of :title, :allow_nil => false - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_acceptance_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:accepted => 'global message'}}} - - Topic.validates_acceptance_of :title, :allow_nil => false - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_presence_of w/o mocha - - def test_validates_presence_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:blank => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:blank => 'global message'}}} - - Topic.validates_presence_of :title - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_presence_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:blank => 'global message'}}} - - Topic.validates_presence_of :title - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_length_of :within w/o mocha - - def test_validates_length_of_within_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:too_short => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:too_short => 'global message'}}} - - Topic.validates_length_of :title, :within => 3..5 - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_length_of_within_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:too_short => 'global message'}}} - - Topic.validates_length_of :title, :within => 3..5 - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_length_of :is w/o mocha - - def test_validates_length_of_is_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:wrong_length => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:wrong_length => 'global message'}}} - - Topic.validates_length_of :title, :is => 5 - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_length_of_is_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:wrong_length => 'global message'}}} - - Topic.validates_length_of :title, :is => 5 - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - def test_validates_length_of_is_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:wrong_length => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:wrong_length => 'global message'}}} - - Topic.validates_length_of :title, :is => 5 - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_length_of_is_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:wrong_length => 'global message'}}} - - Topic.validates_length_of :title, :is => 5 - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - - # validates_format_of w/o mocha - - def test_validates_format_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:invalid => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:invalid => 'global message'}}} - - Topic.validates_format_of :title, :with => /^[1-9][0-9]*$/ - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_format_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:invalid => 'global message'}}} - - Topic.validates_format_of :title, :with => /^[1-9][0-9]*$/ - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_inclusion_of w/o mocha - - def test_validates_inclusion_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:inclusion => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:inclusion => 'global message'}}} - - Topic.validates_inclusion_of :title, :in => %w(a b c) - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_inclusion_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:inclusion => 'global message'}}} - - Topic.validates_inclusion_of :title, :in => %w(a b c) - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_exclusion_of w/o mocha - - def test_validates_exclusion_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:exclusion => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:exclusion => 'global message'}}} - - Topic.validates_exclusion_of :title, :in => %w(a b c) - @topic.title = 'a' - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_exclusion_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:exclusion => 'global message'}}} - - Topic.validates_exclusion_of :title, :in => %w(a b c) - @topic.title = 'a' - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_numericality_of without :only_integer w/o mocha - - def test_validates_numericality_of_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:not_a_number => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:not_a_number => 'global message'}}} - - Topic.validates_numericality_of :title - @topic.title = 'a' - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_numericality_of_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:not_a_number => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true - @topic.title = 'a' - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_numericality_of with :only_integer w/o mocha - - def test_validates_numericality_of_only_integer_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:not_a_number => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:not_a_number => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true - @topic.title = 'a' - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_numericality_of_only_integer_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:not_a_number => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true - @topic.title = 'a' - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_numericality_of :odd w/o mocha - - def test_validates_numericality_of_odd_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:odd => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:odd => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true, :odd => true - @topic.title = 0 - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_numericality_of_odd_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:odd => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true, :odd => true - @topic.title = 0 - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - # validates_numericality_of :less_than w/o mocha - - def test_validates_numericality_of_less_than_finds_custom_model_key_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:less_than => 'custom message'}}}}}} - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:less_than => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0 - @topic.title = 1 - @topic.valid? - assert_equal ['custom message'], @topic.errors[:title] - end - - def test_validates_numericality_of_less_than_finds_global_default_translation - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:less_than => 'global message'}}} - - Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0 - @topic.title = 1 - @topic.valid? - assert_equal ['global message'], @topic.errors[:title] - end - - def test_validations_with_message_symbol_must_translate - I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:custom_error => "I am a custom error"}}} - Topic.validates_presence_of :title, :message => :custom_error - @topic.title = nil - @topic.valid? - assert_equal ["I am a custom error"], @topic.errors[:title] - end - - def test_validates_with_message_symbol_must_translate_per_attribute - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:title => {:custom_error => "I am a custom error"}}}}}} - Topic.validates_presence_of :title, :message => :custom_error - @topic.title = nil - @topic.valid? - assert_equal ["I am a custom error"], @topic.errors[:title] - end - - def test_validates_with_message_symbol_must_translate_per_model - I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:custom_error => "I am a custom error"}}}} - Topic.validates_presence_of :title, :message => :custom_error - @topic.title = nil - @topic.valid? - assert_equal ["I am a custom error"], @topic.errors[:title] - end - - def test_validates_with_message_string - Topic.validates_presence_of :title, :message => "I am a custom error" - @topic.title = nil - @topic.valid? - assert_equal ["I am a custom error"], @topic.errors[:title] - end -end - -class ActiveRecordValidationsGenerateMessageI18nTests < ActiveRecord::TestCase - - def setup - @topic = Topic.new - I18n.backend.store_translations :'en', { - :activerecord => { - :errors => { - :messages => { - :inclusion => "is not included in the list", - :exclusion => "is reserved", - :invalid => "is invalid", - :confirmation => "doesn't match confirmation", - :accepted => "must be accepted", - :empty => "can't be empty", - :blank => "can't be blank", - :too_long => "is too long (maximum is {{count}} characters)", - :too_short => "is too short (minimum is {{count}} characters)", - :wrong_length => "is the wrong length (should be {{count}} characters)", - :taken => "has already been taken", - :not_a_number => "is not a number", - :greater_than => "must be greater than {{count}}", - :greater_than_or_equal_to => "must be greater than or equal to {{count}}", - :equal_to => "must be equal to {{count}}", - :less_than => "must be less than {{count}}", - :less_than_or_equal_to => "must be less than or equal to {{count}}", - :odd => "must be odd", - :even => "must be even" - } - } - } - } - end - - # validates_inclusion_of: generate_message(attr_name, :inclusion, :default => configuration[:message], :value => value) - def test_generate_message_inclusion_with_default_message - assert_equal 'is not included in the list', @topic.errors.generate_message(:title, :inclusion, :default => nil, :value => 'title') - end - - def test_generate_message_inclusion_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :inclusion, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_exclusion_of: generate_message(attr_name, :exclusion, :default => configuration[:message], :value => value) - def test_generate_message_exclusion_with_default_message - assert_equal 'is reserved', @topic.errors.generate_message(:title, :exclusion, :default => nil, :value => 'title') - end - - def test_generate_message_exclusion_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :exclusion, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_associated: generate_message(attr_name, :invalid, :default => configuration[:message], :value => value) - # validates_format_of: generate_message(attr_name, :invalid, :default => configuration[:message], :value => value) - def test_generate_message_invalid_with_default_message - assert_equal 'is invalid', @topic.errors.generate_message(:title, :invalid, :default => nil, :value => 'title') - end - - def test_generate_message_invalid_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :invalid, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_confirmation_of: generate_message(attr_name, :confirmation, :default => configuration[:message]) - def test_generate_message_confirmation_with_default_message - assert_equal "doesn't match confirmation", @topic.errors.generate_message(:title, :confirmation, :default => nil) - end - - def test_generate_message_confirmation_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :confirmation, :default => 'custom message') - end - - # validates_acceptance_of: generate_message(attr_name, :accepted, :default => configuration[:message]) - def test_generate_message_accepted_with_default_message - assert_equal "must be accepted", @topic.errors.generate_message(:title, :accepted, :default => nil) - end - - def test_generate_message_accepted_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :accepted, :default => 'custom message') - end - - # add_on_empty: generate_message(attr, :empty, :default => custom_message) - def test_generate_message_empty_with_default_message - assert_equal "can't be empty", @topic.errors.generate_message(:title, :empty, :default => nil) - end - - def test_generate_message_empty_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :empty, :default => 'custom message') - end - - # add_on_blank: generate_message(attr, :blank, :default => custom_message) - def test_generate_message_blank_with_default_message - assert_equal "can't be blank", @topic.errors.generate_message(:title, :blank, :default => nil) - end - - def test_generate_message_blank_with_custom_message - assert_equal 'custom message', @topic.errors.generate_message(:title, :blank, :default => 'custom message') - end - - # validates_length_of: generate_message(attr, :too_long, :default => options[:too_long], :count => option_value.end) - def test_generate_message_too_long_with_default_message - assert_equal "is too long (maximum is 10 characters)", @topic.errors.generate_message(:title, :too_long, :default => nil, :count => 10) - end - - def test_generate_message_too_long_with_custom_message - assert_equal 'custom message 10', @topic.errors.generate_message(:title, :too_long, :default => 'custom message {{count}}', :count => 10) - end - - # validates_length_of: generate_message(attr, :too_short, :default => options[:too_short], :count => option_value.begin) - def test_generate_message_too_short_with_default_message - assert_equal "is too short (minimum is 10 characters)", @topic.errors.generate_message(:title, :too_short, :default => nil, :count => 10) - end - - def test_generate_message_too_short_with_custom_message - assert_equal 'custom message 10', @topic.errors.generate_message(:title, :too_short, :default => 'custom message {{count}}', :count => 10) - end - - # validates_length_of: generate_message(attr, key, :default => custom_message, :count => option_value) - def test_generate_message_wrong_length_with_default_message - assert_equal "is the wrong length (should be 10 characters)", @topic.errors.generate_message(:title, :wrong_length, :default => nil, :count => 10) - end - - def test_generate_message_wrong_length_with_custom_message - assert_equal 'custom message 10', @topic.errors.generate_message(:title, :wrong_length, :default => 'custom message {{count}}', :count => 10) - end - - # validates_uniqueness_of: generate_message(attr_name, :taken, :default => configuration[:message]) - def test_generate_message_taken_with_default_message - assert_equal "has already been taken", @topic.errors.generate_message(:title, :taken, :default => nil, :value => 'title') - end - - def test_generate_message_taken_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :taken, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_numericality_of: generate_message(attr_name, :not_a_number, :value => raw_value, :default => configuration[:message]) - def test_generate_message_not_a_number_with_default_message - assert_equal "is not a number", @topic.errors.generate_message(:title, :not_a_number, :default => nil, :value => 'title') - end - - def test_generate_message_not_a_number_with_custom_message - assert_equal 'custom message title', @topic.errors.generate_message(:title, :not_a_number, :default => 'custom message {{value}}', :value => 'title') - end - - # validates_numericality_of: generate_message(attr_name, option, :value => raw_value, :default => configuration[:message]) - def test_generate_message_greater_than_with_default_message - assert_equal "must be greater than 10", @topic.errors.generate_message(:title, :greater_than, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_greater_than_or_equal_to_with_default_message - assert_equal "must be greater than or equal to 10", @topic.errors.generate_message(:title, :greater_than_or_equal_to, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_equal_to_with_default_message - assert_equal "must be equal to 10", @topic.errors.generate_message(:title, :equal_to, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_less_than_with_default_message - assert_equal "must be less than 10", @topic.errors.generate_message(:title, :less_than, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_less_than_or_equal_to_with_default_message - assert_equal "must be less than or equal to 10", @topic.errors.generate_message(:title, :less_than_or_equal_to, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_odd_with_default_message - assert_equal "must be odd", @topic.errors.generate_message(:title, :odd, :default => nil, :value => 'title', :count => 10) - end - - def test_generate_message_even_with_default_message - assert_equal "must be even", @topic.errors.generate_message(:title, :even, :default => nil, :value => 'title', :count => 10) - end - # ActiveRecord#RecordInvalid exception - - test "RecordInvalid exception can be localized" do - topic = Topic.new - topic.errors.add(:title, :invalid) - topic.errors.add(:title, :blank) - assert_equal "Validation failed: Title is invalid, Title can't be blank", ActiveRecord::RecordInvalid.new(topic).message - end end diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index 5cdb623eef..130231c622 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -148,40 +148,9 @@ class ValidationsTest < ActiveRecord::TestCase assert_equal "100,000", d.salary_before_type_cast end - def test_validates_length_with_globally_modified_error_message - defaults = ActiveSupport::Deprecation.silence { ActiveRecord::Errors.default_error_messages } - original_message = defaults[:too_short] - defaults[:too_short] = 'tu est trops petit hombre {{count}}' - - Topic.validates_length_of :title, :minimum => 10 - t = Topic.create(:title => 'too short') - assert !t.valid? - - assert_equal ['tu est trops petit hombre 10'], t.errors[:title] - - ensure - defaults[:too_short] = original_message - end - def test_validates_acceptance_of_as_database_column Topic.validates_acceptance_of(:author_name) topic = Topic.create("author_name" => "Dan Brown") assert_equal "Dan Brown", topic["author_name"] end - - def test_deprecated_validation_instance_methods - tom = DeprecatedPerson.new - - assert_deprecated do - assert tom.invalid? - assert_equal ["always invalid", "invalid on create"], tom.errors[:name] - end - - tom.save(false) - - assert_deprecated do - assert tom.invalid? - assert_equal ["always invalid", "invalid on update"], tom.errors[:name] - end - end end -- cgit v1.2.3 From 9fbb2c571b65e0501bf3570a3d49e553a9ae39c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 11:18:36 -0500 Subject: Fix error_messages_for when instance variable names are given. Signed-off-by: Joshua Peek --- actionpack/lib/action_view/helpers/active_model_helper.rb | 12 ++++++------ activemodel/lib/active_model/translation.rb | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/actionpack/lib/action_view/helpers/active_model_helper.rb b/actionpack/lib/action_view/helpers/active_model_helper.rb index 3c398fe4da..c70f29f098 100644 --- a/actionpack/lib/action_view/helpers/active_model_helper.rb +++ b/actionpack/lib/action_view/helpers/active_model_helper.rb @@ -191,13 +191,13 @@ module ActionView options = params.extract_options!.symbolize_keys objects = Array.wrap(options.delete(:object) || params).map do |object| - unless object.respond_to?(:to_model) - object = instance_variable_get("@#{object}") - object = convert_to_model(object) - else - object = object.to_model - options[:object_name] ||= object.class.model_name.human + object = instance_variable_get("@#{object}") unless object.respond_to?(:to_model) + object = convert_to_model(object) + + if object.class.respond_to?(:model_name) + options[:object_name] ||= object.class.model_name.human.downcase end + object end diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb index dc11198c66..2ad8ca9dea 100644 --- a/activemodel/lib/active_model/translation.rb +++ b/activemodel/lib/active_model/translation.rb @@ -45,6 +45,9 @@ module ActiveModel # it will underscore then humanize the class name (BlogPost.human_name #=> "Blog post"). # Specify +options+ with additional translating options. def human(options={}) + return @human unless @klass.respond_to?(:lookup_ancestors) && + @klass.respond_to?(:i18n_scope) + defaults = @klass.lookup_ancestors.map do |klass| klass.model_name.underscore.to_sym end -- cgit v1.2.3 From 3e35d30c0cab711fcc9feddd23f2f682f5d0a050 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 21 Oct 2009 11:32:31 -0500 Subject: Always add actionpack/lib to load path for isolated tests --- actionpack/test/abstract_unit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 05b15d38ee..86c8a95a43 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -4,9 +4,9 @@ begin rescue LoadError $:.unshift "#{root}/activesupport/lib" $:.unshift "#{root}/activemodel/lib" - $:.unshift "#{root}/lib" end +$:.unshift(File.dirname(__FILE__) + '/../lib') $:.unshift(File.dirname(__FILE__) + '/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers') -- cgit v1.2.3 From 8a0f4564432bef9dde815dd6b768d088cfad16ed Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 21 Oct 2009 15:45:11 -0700 Subject: Refactored railties' isolation tests to be able to run script/* scripts. --- railties/test/isolation/abstract_unit.rb | 17 +++++++++++++---- railties/test/plugins/vendored_test.rb | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 railties/test/plugins/vendored_test.rb diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 11cabb2c0b..462a4d8dea 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -81,7 +81,6 @@ module TestHelpers def build_app(options = {}) FileUtils.rm_rf(app_path) FileUtils.cp_r(tmp_path('app_template'), app_path) - FileUtils.ln_s(RAILS_FRAMEWORK_ROOT, app_path('vendor/rails')) # Delete the initializers unless requested unless options[:initializers] @@ -93,6 +92,12 @@ module TestHelpers add_to_config 'config.action_controller.session = { :key => "_myapp_session", :secret => "bac838a849c1d5c4de2e6a50af826079" }' end + def script(script) + Dir.chdir(app_path) do + `#{Gem.ruby} #{app_path}/script/#{script}` + end + end + def add_to_config(str) environment = File.read("#{app_path}/config/application.rb") if environment =~ /(\n\s*end\s*)\Z/ @@ -149,8 +154,12 @@ Module.new do if File.exist?(tmp_path) FileUtils.rm_rf(tmp_path) end - FileUtils.mkdir(tmp_path) - root = File.expand_path('../../../..', __FILE__) - `#{Gem.ruby} -r #{root}/vendor/gems/environment #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` + + environment = File.expand_path('../../../../vendor/gems/environment', __FILE__) + + `#{Gem.ruby} -r #{environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` + File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f| + f.puts "require '#{environment}' ; require 'rails'" + end end diff --git a/railties/test/plugins/vendored_test.rb b/railties/test/plugins/vendored_test.rb new file mode 100644 index 0000000000..71de542ff7 --- /dev/null +++ b/railties/test/plugins/vendored_test.rb @@ -0,0 +1,19 @@ +require "isolation/abstract_unit" + +module ApplicationTests + class PluginTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + end + + test "generates the plugin" do + script "generate plugin my_plugin" + File.open("#{app_path}/vendor/plugins/my_plugin/init.rb", 'w') do |f| + f.puts "OMG = 'hello'" + end + require "#{app_path}/config/environment" + end + end +end \ No newline at end of file -- cgit v1.2.3 From a0049a6b429c6de46537cc31bf7b3ca48b4c1b2c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 22 Oct 2009 20:13:46 -0700 Subject: Use rails/rack-mount --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index ba55d96783..e99e7c7591 100644 --- a/Gemfile +++ b/Gemfile @@ -12,10 +12,10 @@ gem "rails", "3.0.pre", :vendored_at => "railties" gem lib, '3.0.pre', :vendored_at => lib end gem "rack", "1.0.1" -gem "rack-mount", :git => "git://github.com/josh/rack-mount.git" +gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", "~> 0.5.0" gem "erubis", "~> 2.6.0" gem "arel", :git => "git://github.com/rails/arel.git" gem "mocha" gem "sqlite3-ruby" -gem "RedCloth" \ No newline at end of file +gem "RedCloth" -- cgit v1.2.3 From a840c8afbf4e30b7bd9979e8cd70192c65be7a43 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 24 Oct 2009 18:08:54 -0500 Subject: Restore `rake routes` [#3402 state:resolved] --- actionpack/lib/action_dispatch/routing.rb | 1 + .../action_dispatch/routing/deprecated_mapper.rb | 3 +- actionpack/lib/action_dispatch/routing/mapper.rb | 8 ++-- actionpack/lib/action_dispatch/routing/route.rb | 44 ++++++++++++++++++++++ .../lib/action_dispatch/routing/route_set.rb | 11 ++---- railties/lib/rails/tasks/routes.rake | 9 ++--- 6 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 actionpack/lib/action_dispatch/routing/route.rb diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 3803929847..b9c377db2c 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -262,6 +262,7 @@ module ActionDispatch module Routing autoload :DeprecatedMapper, 'action_dispatch/routing/deprecated_mapper' autoload :Mapper, 'action_dispatch/routing/mapper' + autoload :Route, 'action_dispatch/routing/route' autoload :RouteSet, 'action_dispatch/routing/route_set' SEPARATORS = %w( / . ? ) diff --git a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb index f2a1f10fa7..0564ba9797 100644 --- a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb +++ b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb @@ -132,7 +132,6 @@ module ActionDispatch path = optionalize_trailing_dynamic_segments(path, requirements, defaults) glob = $1.to_sym if path =~ /\/\*(\w+)$/ path = ::Rack::Mount::Utils.normalize_path(path) - path = ::Rack::Mount::Strexp.compile(path, requirements, %w( / . ? )) if glob && !defaults[glob].blank? raise ActionController::RoutingError, "paths cannot have non-empty default values" @@ -145,7 +144,7 @@ module ActionDispatch conditions[:request_method] = method if method conditions[:path_info] = path if path - @set.add_route(app, conditions, defaults, name) + @set.add_route(app, conditions, requirements, defaults, name) end def optionalize_trailing_dynamic_segments(path, requirements, defaults) #:nodoc: diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index ab4193266a..d6d822842b 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -252,9 +252,11 @@ module ActionDispatch constraints = (@scope[:constraints] || {}).merge(constraints) options.each { |k, v| constraints[k] = v if v.is_a?(Regexp) } - conditions[:path_info] = Rack::Mount::Strexp.compile(path, constraints, %w( / . ? )) + conditions[:path_info] = path + requirements = constraints.dup - segment_keys = Rack::Mount::RegexpWithNamedGroups.new(conditions[:path_info]).names + path_regexp = Rack::Mount::Strexp.compile(path, constraints, SEPARATORS) + segment_keys = Rack::Mount::RegexpWithNamedGroups.new(path_regexp).names constraints.reject! { |k, v| segment_keys.include?(k.to_s) } conditions.merge!(constraints) @@ -286,7 +288,7 @@ module ActionDispatch end app = Constraints.new(app, blocks) if blocks.any? - @set.add_route(app, conditions, defaults, options[:as]) + @set.add_route(app, conditions, requirements, defaults, options[:as]) self end diff --git a/actionpack/lib/action_dispatch/routing/route.rb b/actionpack/lib/action_dispatch/routing/route.rb new file mode 100644 index 0000000000..8990e207c2 --- /dev/null +++ b/actionpack/lib/action_dispatch/routing/route.rb @@ -0,0 +1,44 @@ +module ActionDispatch + module Routing + class Route #:nodoc: + attr_reader :app, :conditions, :defaults, :name + attr_reader :path, :requirements + + def initialize(app, conditions = {}, requirements = {}, defaults = {}, name = nil) + @app = app + @defaults = defaults + @name = name + + @requirements = requirements.merge(defaults) + @requirements.delete(:controller) if @requirements[:controller].is_a?(Regexp) + @requirements.delete_if { |k, v| + v == Regexp.compile("[^#{SEPARATORS.join}]+") + } + + if path = conditions[:path_info] + @path = path + conditions[:path_info] = ::Rack::Mount::Strexp.compile(path, requirements, SEPARATORS) + end + + @conditions = conditions.inject({}) { |h, (k, v)| + h[k] = Rack::Mount::RegexpWithNamedGroups.new(v) + h + } + end + + def verb + if verb = conditions[:verb] + verb.to_s.upcase + end + end + + def segment_keys + @segment_keys ||= conditions[:path_info].names.compact.map { |key| key.to_sym } + end + + def to_ary + [@app, @conditions, @defaults, @name] + end + end + end +end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 90d7c208a5..93617e826d 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -47,11 +47,6 @@ module ActionDispatch end end - module RouteExtensions - def segment_keys - conditions[:path_info].names.compact.map { |key| key.to_sym } - end - end # A NamedRouteCollection instance is a collection of named routes, and also # maintains an anonymous module that can be used to install helpers for the @@ -290,9 +285,9 @@ module ActionDispatch routes_changed_at end - def add_route(app, conditions = {}, defaults = {}, name = nil) - route = @set.add_route(app, conditions, defaults, name) - route.extend(RouteExtensions) + def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil) + route = Route.new(app, conditions, requirements, defaults, name) + @set.add_route(*route) named_routes[name] = route if name routes << route route diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake index abbf3258c1..2395d73b2f 100644 --- a/railties/lib/rails/tasks/routes.rake +++ b/railties/lib/rails/tasks/routes.rake @@ -3,16 +3,13 @@ task :routes => :environment do all_routes = ENV['CONTROLLER'] ? ActionController::Routing::Routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : ActionController::Routing::Routes.routes routes = all_routes.collect do |route| name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s - verb = route.conditions[:method].to_s.upcase - segs = route.segments.inject("") { |str,s| str << s.to_s } - segs.chop! if segs.length > 1 reqs = route.requirements.empty? ? "" : route.requirements.inspect - {:name => name, :verb => verb, :segs => segs, :reqs => reqs} + {:name => name, :verb => route.verb.to_s, :path => route.path, :reqs => reqs} end name_width = routes.collect {|r| r[:name]}.collect {|n| n.length}.max verb_width = routes.collect {|r| r[:verb]}.collect {|v| v.length}.max - segs_width = routes.collect {|r| r[:segs]}.collect {|s| s.length}.max + path_width = routes.collect {|r| r[:path]}.collect {|s| s.length}.max routes.each do |r| - puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:segs].ljust(segs_width)} #{r[:reqs]}" + puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}" end end -- cgit v1.2.3 From 6083a87d63af9ca1b66fedcb92cd4a395965173b Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 26 Oct 2009 11:16:17 -0500 Subject: Splat calls to_a not to_ary [#3423 state:resolved] --- actionpack/lib/action_dispatch/routing/route.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/routing/route.rb b/actionpack/lib/action_dispatch/routing/route.rb index 8990e207c2..e3aaa29e76 100644 --- a/actionpack/lib/action_dispatch/routing/route.rb +++ b/actionpack/lib/action_dispatch/routing/route.rb @@ -36,7 +36,7 @@ module ActionDispatch @segment_keys ||= conditions[:path_info].names.compact.map { |key| key.to_sym } end - def to_ary + def to_a [@app, @conditions, @defaults, @name] end end -- cgit v1.2.3 From 55ae53baadf37daf2c966bf5d9d67c1f954cb681 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 26 Oct 2009 11:23:39 -0500 Subject: Fix `rake routes` method name output [#3422 state:resolved] --- actionpack/lib/action_dispatch/routing/route.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/route.rb b/actionpack/lib/action_dispatch/routing/route.rb index e3aaa29e76..f1431e7a37 100644 --- a/actionpack/lib/action_dispatch/routing/route.rb +++ b/actionpack/lib/action_dispatch/routing/route.rb @@ -27,8 +27,13 @@ module ActionDispatch end def verb - if verb = conditions[:verb] - verb.to_s.upcase + if method = conditions[:request_method] + case method + when Regexp + method.source.upcase + else + method.to_s.upcase + end end end -- cgit v1.2.3 From 60cc86136bffc96bc62798538e08e0d28138d41c Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 15:47:08 -0700 Subject: Base setup for config object in AC. --- actionpack/lib/action_controller.rb | 1 + actionpack/lib/action_controller/base.rb | 1 + .../lib/action_controller/metal/configuration.rb | 28 ++++++++++++++++++++++ .../action_controller/metal/session_management.rb | 15 +++--------- 4 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 actionpack/lib/action_controller/metal/configuration.rb diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 9db1a71202..c5de4361bb 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -2,6 +2,7 @@ module ActionController autoload :Base, "action_controller/base" autoload :Benchmarking, "action_controller/metal/benchmarking" autoload :ConditionalGet, "action_controller/metal/conditional_get" + autoload :Configuration, "action_controller/metal/configuration" autoload :Helpers, "action_controller/metal/helpers" autoload :HideActions, "action_controller/metal/hide_actions" autoload :Layouts, "action_controller/metal/layouts" diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 5338a70104..4c026fe5f7 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -15,6 +15,7 @@ module ActionController include ActionController::ConditionalGet include ActionController::RackConvenience include ActionController::Benchmarking + include ActionController::Configuration # Legacy modules include SessionManagement diff --git a/actionpack/lib/action_controller/metal/configuration.rb b/actionpack/lib/action_controller/metal/configuration.rb new file mode 100644 index 0000000000..5c829853b7 --- /dev/null +++ b/actionpack/lib/action_controller/metal/configuration.rb @@ -0,0 +1,28 @@ +module ActionController + module Configuration + extend ActiveSupport::Concern + + def config + @config ||= self.class.config + end + + def config=(config) + @config = config + end + + module ClassMethods + def default_config + @default_config ||= {} + end + + def config + self.config ||= default_config + end + + def config=(config) + @config = ActiveSupport::OrderedHash.new + @config.merge!(config) + end + end + end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/metal/session_management.rb b/actionpack/lib/action_controller/metal/session_management.rb index 654aa08cd3..9f4c4b8b39 100644 --- a/actionpack/lib/action_controller/metal/session_management.rb +++ b/actionpack/lib/action_controller/metal/session_management.rb @@ -1,10 +1,8 @@ module ActionController #:nodoc: module SessionManagement #:nodoc: - def self.included(base) - base.class_eval do - extend ClassMethods - end - end + include ActiveSupport::Concern + + include ActionController::Configuration module ClassMethods # Set the session store to be used for keeping the session data between requests. @@ -35,13 +33,6 @@ module ActionController #:nodoc: session_options.merge!(options) end - # Returns the hash used to configure the session. Example use: - # - # ActionController::Base.session_options[:secure] = true # session only available over HTTPS - def session_options - @session_options ||= {} - end - def session(*args) ActiveSupport::Deprecation.warn( "Disabling sessions for a single controller has been deprecated. " + -- cgit v1.2.3 From d7499f8ee8faa80d12dccae5baf5ab2acc79e77d Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 17:13:43 -0700 Subject: Extract #head into its own module and simplify it --- actionpack/lib/action_controller.rb | 1 + .../lib/action_controller/metal/conditional_get.rb | 39 ++-------------------- actionpack/lib/action_controller/metal/head.rb | 27 +++++++++++++++ 3 files changed, 31 insertions(+), 36 deletions(-) create mode 100644 actionpack/lib/action_controller/metal/head.rb diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index c5de4361bb..03a40e4fce 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -3,6 +3,7 @@ module ActionController autoload :Benchmarking, "action_controller/metal/benchmarking" autoload :ConditionalGet, "action_controller/metal/conditional_get" autoload :Configuration, "action_controller/metal/configuration" + autoload :Head, "action_controller/metal/head" autoload :Helpers, "action_controller/metal/helpers" autoload :HideActions, "action_controller/metal/hide_actions" autoload :Layouts, "action_controller/metal/layouts" diff --git a/actionpack/lib/action_controller/metal/conditional_get.rb b/actionpack/lib/action_controller/metal/conditional_get.rb index 8575d30335..52f5a9727e 100644 --- a/actionpack/lib/action_controller/metal/conditional_get.rb +++ b/actionpack/lib/action_controller/metal/conditional_get.rb @@ -3,6 +3,7 @@ module ActionController extend ActiveSupport::Concern include RackConvenience + include Head # Sets the etag, last_modified, or both on the response and renders a # "304 Not Modified" response if the request is already fresh. @@ -27,43 +28,9 @@ module ActionController response.etag = options[:etag] if options[:etag] response.last_modified = options[:last_modified] if options[:last_modified] + response.cache_control[:public] = true if options[:public] - if options[:public] - response.cache_control[:public] = true - end - - if request.fresh?(response) - head :not_modified - end - end - - # Return a response that has no content (merely headers). The options - # argument is interpreted to be a hash of header names and values. - # This allows you to easily return a response that consists only of - # significant headers: - # - # head :created, :location => person_path(@person) - # - # It can also be used to return exceptional conditions: - # - # return head(:method_not_allowed) unless request.post? - # return head(:bad_request) unless valid_request? - # render - def head(*args) - if args.length > 2 - raise ArgumentError, "too many arguments to head" - elsif args.empty? - raise ArgumentError, "too few arguments to head" - end - options = args.extract_options! - status = args.shift || options.delete(:status) || :ok - location = options.delete(:location) - - options.each do |key, value| - headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s - end - - render :nothing => true, :status => status, :location => location + head :not_modified if request.fresh?(response) end # Sets the etag and/or last_modified on the response and checks it against diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb new file mode 100644 index 0000000000..68fa0a0402 --- /dev/null +++ b/actionpack/lib/action_controller/metal/head.rb @@ -0,0 +1,27 @@ +module ActionController + module Head + # Return a response that has no content (merely headers). The options + # argument is interpreted to be a hash of header names and values. + # This allows you to easily return a response that consists only of + # significant headers: + # + # head :created, :location => person_path(@person) + # + # It can also be used to return exceptional conditions: + # + # return head(:method_not_allowed) unless request.post? + # return head(:bad_request) unless valid_request? + # render + def head(status, options = {}) + options, status = status, nil if status.is_a?(Hash) + status ||= options.delete(:status) || :ok + location = options.delete(:location) + + options.each do |key, value| + headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s + end + + render :nothing => true, :status => status, :location => location + end + end +end \ No newline at end of file -- cgit v1.2.3 From e1786ee6ebee9fab10d6756be1eeacbbe6b65b48 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 17:32:42 -0700 Subject: Fixes expires_now and cleans things up a bit --- .../lib/action_controller/metal/conditional_get.rb | 2 +- actionpack/lib/action_dispatch/http/request.rb | 21 +++++++++------------ actionpack/lib/action_dispatch/http/response.rb | 2 ++ actionpack/test/controller/render_test.rb | 10 ++++++++++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/actionpack/lib/action_controller/metal/conditional_get.rb b/actionpack/lib/action_controller/metal/conditional_get.rb index 52f5a9727e..5156fbc1d5 100644 --- a/actionpack/lib/action_controller/metal/conditional_get.rb +++ b/actionpack/lib/action_controller/metal/conditional_get.rb @@ -80,7 +80,7 @@ module ActionController # Sets a HTTP 1.1 Cache-Control header of "no-cache" so no caching should occur by the browser or # intermediate caches (like caching proxy servers). def expires_now #:doc: - response.headers["Cache-Control"] = "no-cache" + response.cache_control.replace(:no_cache => true) end end end diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index bff030f0e4..1e366520c9 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -136,19 +136,16 @@ module ActionDispatch # If-Modified-Since and If-None-Match conditions. If both headers are # supplied, both must match, or the request is not considered fresh. def fresh?(response) - case - when if_modified_since && if_none_match - not_modified?(response.last_modified) && etag_matches?(response.etag) - when if_modified_since - not_modified?(response.last_modified) - when if_none_match - etag_matches?(response.etag) - else - false - end - end + last_modified = if_modified_since + etag = if_none_match - ONLY_ALL = [Mime::ALL].freeze + return false unless last_modified || etag + + success = true + success &&= not_modified?(response.last_modified) if last_modified + success &&= etag_matches?(response.etag) if etag + success + end # Returns the Mime type for the \format used in the request. # diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 3e3b473178..b3ed7c9d1a 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -270,6 +270,8 @@ module ActionDispatch # :nodoc: if control.empty? headers["Cache-Control"] = DEFAULT_CACHE_CONTROL + elsif @cache_control[:no_cache] + headers["Cache-Control"] = "no-cache" else extras = control[:extras] max_age = control[:max_age] diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 2db524ca4b..ac8dad7c42 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -73,6 +73,11 @@ class TestController < ActionController::Base render :action => 'hello_world' end + def conditional_hello_with_expires_now + expires_now + render :action => 'hello_world' + end + def conditional_hello_with_bangs render :action => 'hello_world' end @@ -1321,6 +1326,11 @@ class ExpiresInRenderTest < ActionController::TestCase get :conditional_hello_with_expires_in_with_public_with_more_keys_old_syntax assert_equal "max-age=60, public, max-stale=18000", @response.headers["Cache-Control"] end + + def test_expires_now + get :conditional_hello_with_expires_now + assert_equal "no-cache", @response.headers["Cache-Control"] + end end -- cgit v1.2.3 From 000d5936216f363a5b11013f664959019b7ebac2 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 18:01:09 -0700 Subject: Clean up and update cookies --- actionpack/lib/action_controller/metal/cookies.rb | 44 ++++++++++++++--------- actionpack/test/controller/cookie_test.rb | 11 +++--- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/actionpack/lib/action_controller/metal/cookies.rb b/actionpack/lib/action_controller/metal/cookies.rb index c328db8beb..6855ca1478 100644 --- a/actionpack/lib/action_controller/metal/cookies.rb +++ b/actionpack/lib/action_controller/metal/cookies.rb @@ -44,24 +44,31 @@ module ActionController #:nodoc: # * :httponly - Whether this cookie is accessible via scripting or # only HTTP. Defaults to +false+. module Cookies - def self.included(base) - base.helper_method :cookies + extend ActiveSupport::Concern + + include RackConvenience + + included do + helper_method :cookies end - protected - # Returns the cookie container, which operates as described above. - def cookies - @cookies ||= CookieJar.new(self) - end + protected + # Returns the cookie container, which operates as described above. + def cookies + @cookies ||= CookieJar.build(request, response) + end end class CookieJar < Hash #:nodoc: - def initialize(controller) - @controller, @cookies = controller, controller.request.cookies - super() - update(@cookies) + def self.build(request, response) + new.tap do |hash| + hash.update(request.cookies) + hash.response = response + end end + attr_accessor :response + # Returns the value of the cookie by +name+, or +nil+ if no such cookie exists. def [](name) super(name.to_s) @@ -72,13 +79,16 @@ module ActionController #:nodoc: def []=(key, options) if options.is_a?(Hash) options.symbolize_keys! + value = options[:value] else - options = { :value => options } + value = options + options = { :value => value } end - options[:path] = "/" unless options.has_key?(:path) - super(key.to_s, options[:value]) - @controller.response.set_cookie(key, options) + super(key.to_s, value) + + options[:path] ||= "/" + response.set_cookie(key, options) end # Removes the cookie on the client machine by setting the value to an empty string @@ -86,9 +96,9 @@ module ActionController #:nodoc: # an options hash to delete cookies with extra data such as a :path. def delete(key, options = {}) options.symbolize_keys! - options[:path] = "/" unless options.has_key?(:path) + options[:path] ||= "/" value = super(key.to_s) - @controller.response.delete_cookie(key, options) + response.delete_cookie(key, options) value end end diff --git a/actionpack/test/controller/cookie_test.rb b/actionpack/test/controller/cookie_test.rb index b429cbf0e6..53d4364576 100644 --- a/actionpack/test/controller/cookie_test.rb +++ b/actionpack/test/controller/cookie_test.rb @@ -106,7 +106,7 @@ class CookieTest < ActionController::TestCase def test_cookiejar_accessor @request.cookies["user_name"] = "david" @controller.request = @request - jar = ActionController::CookieJar.new(@controller) + jar = ActionController::CookieJar.build(@controller.request, @controller.response) assert_equal "david", jar["user_name"] assert_equal nil, jar["something_else"] end @@ -114,14 +114,14 @@ class CookieTest < ActionController::TestCase def test_cookiejar_accessor_with_array_value @request.cookies["pages"] = %w{1 2 3} @controller.request = @request - jar = ActionController::CookieJar.new(@controller) + jar = ActionController::CookieJar.build(@controller.request, @controller.response) assert_equal %w{1 2 3}, jar["pages"] end def test_cookiejar_delete_removes_item_and_returns_its_value @request.cookies["user_name"] = "david" @controller.response = @response - jar = ActionController::CookieJar.new(@controller) + jar = ActionController::CookieJar.build(@controller.request, @controller.response) assert_equal "david", jar.delete("user_name") end @@ -131,9 +131,8 @@ class CookieTest < ActionController::TestCase end def test_cookies_persist_throughout_request - get :authenticate - cookies = @controller.send(:cookies) - assert_equal 'david', cookies['user_name'] + response = get :authenticate + assert response.headers["Set-Cookie"] =~ /user_name=david/ end private -- cgit v1.2.3 From 2bdd8fa86313a48de11d95fc48f97ada24d7d8af Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 21:10:40 -0700 Subject: Clean up parameter logging some --- .../metal/filter_parameter_logging.rb | 65 ++++++++-------------- actionpack/test/controller/filter_params_test.rb | 18 +++--- 2 files changed, 32 insertions(+), 51 deletions(-) diff --git a/actionpack/lib/action_controller/metal/filter_parameter_logging.rb b/actionpack/lib/action_controller/metal/filter_parameter_logging.rb index 4259d9de19..a53c052075 100644 --- a/actionpack/lib/action_controller/metal/filter_parameter_logging.rb +++ b/actionpack/lib/action_controller/metal/filter_parameter_logging.rb @@ -4,10 +4,6 @@ module ActionController include AbstractController::Logger - included do - include InstanceMethodsForNewBase - end - module ClassMethods # Replace sensitive parameter data from the request log. # Filters parameters that have any of the arguments as a substring. @@ -17,8 +13,6 @@ module ActionController # can be replaced using String#replace or similar method. # # Examples: - # filter_parameter_logging - # => Does nothing, just slows the logging process down # # filter_parameter_logging :password # => replaces the value to all keys matching /password/i with "[FILTERED]" @@ -33,64 +27,51 @@ module ActionController # => reverses the value to all keys matching /secret/i, and # replaces the value to all keys matching /foo|bar/i with "[FILTERED]" def filter_parameter_logging(*filter_words, &block) - parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0 + raise "You must filter at least one word from logging" if filter_words.empty? + + parameter_filter = Regexp.new(filter_words.join('|'), true) - define_method(:filter_parameters) do |unfiltered_parameters| - filtered_parameters = {} + define_method(:filter_parameters) do |original_params| + filtered_params = {} - unfiltered_parameters.each do |key, value| + original_params.each do |key, value| if key =~ parameter_filter - filtered_parameters[key] = '[FILTERED]' + value = '[FILTERED]' elsif value.is_a?(Hash) - filtered_parameters[key] = filter_parameters(value) + value = filter_parameters(value) elsif value.is_a?(Array) - filtered_parameters[key] = value.collect do |item| - filter_parameters(item) - end + value = value.map { |item| filter_parameters(item) } elsif block_given? key = key.dup value = value.dup if value.duplicable? yield key, value - filtered_parameters[key] = value - else - filtered_parameters[key] = value end + + filtered_params[key] = value end - filtered_parameters + filtered_params end protected :filter_parameters end end - module InstanceMethodsForNewBase - # TODO : Fix the order of information inside such that it's exactly same as the old base - def process(*) - ret = super - - if logger - parameters = respond_to?(:filter_parameters) ? filter_parameters(params) : params.dup - parameters = parameters.except!(:controller, :action, :format, :_method, :only_path) + INTERNAL_PARAMS = [:controller, :action, :format, :_method, :only_path] - unless parameters.empty? - # TODO : Move DelayedLog to AS - log = AbstractController::Logger::DelayedLog.new { " Parameters: #{parameters.inspect}" } - logger.info(log) - end - end - - ret + def process(*) + response = super + if logger + parameters = filter_parameters(params).except!(*INTERNAL_PARAMS) + logger.info { " Parameters: #{parameters.inspect}" } unless parameters.empty? end + response end - private + protected - # TODO : This method is not needed for the new base - def log_processing_for_parameters - parameters = respond_to?(:filter_parameters) ? filter_parameters(params) : params.dup - parameters = parameters.except!(:controller, :action, :format, :_method) - - logger.info " Parameters: #{parameters.inspect}" unless parameters.empty? + def filter_parameters(params) + params.dup end + end end diff --git a/actionpack/test/controller/filter_params_test.rb b/actionpack/test/controller/filter_params_test.rb index 19232c6bc9..43bef34885 100644 --- a/actionpack/test/controller/filter_params_test.rb +++ b/actionpack/test/controller/filter_params_test.rb @@ -19,23 +19,23 @@ class FilterParamTest < ActionController::TestCase def method_missing(method, *args) @logged ||= [] - @logged << args.first + @logged << args.first unless block_given? + @logged << yield if block_given? end end setup :set_logger + def test_filter_parameters_must_have_one_word + assert_raises RuntimeError do + FilterParamController.filter_parameter_logging + end + end + def test_filter_parameters assert FilterParamController.respond_to?(:filter_parameter_logging) - assert !@controller.respond_to?(:filter_parameters) - - FilterParamController.filter_parameter_logging - assert @controller.respond_to?(:filter_parameters) - test_hashes = [[{},{},[]], - [{'foo'=>nil},{'foo'=>nil},[]], - [{'foo'=>'bar'},{'foo'=>'bar'},[]], - [{'foo'=>1},{'foo'=>1},[]], + test_hashes = [ [{'foo'=>'bar'},{'foo'=>'bar'},%w'food'], [{'foo'=>'bar'},{'foo'=>'[FILTERED]'},%w'foo'], [{'foo'=>'bar', 'bar'=>'foo'},{'foo'=>'[FILTERED]', 'bar'=>'foo'},%w'foo baz'], -- cgit v1.2.3 From df06e0bd86bc054fc4e3d78193c09da9e27971a4 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 23:11:52 -0700 Subject: Clean up flash a bit --- actionpack/lib/action_controller/metal/flash.rb | 48 ++++++++++++------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/actionpack/lib/action_controller/metal/flash.rb b/actionpack/lib/action_controller/metal/flash.rb index 590f9be3ac..b2fc359df4 100644 --- a/actionpack/lib/action_controller/metal/flash.rb +++ b/actionpack/lib/action_controller/metal/flash.rb @@ -49,7 +49,7 @@ module ActionController #:nodoc: class FlashHash < Hash def initialize #:nodoc: super - @used = {} + @used = Set.new end def []=(k, v) #:nodoc: @@ -65,7 +65,7 @@ module ActionController #:nodoc: alias :merge! :update def replace(h) #:nodoc: - @used = {} + @used = Set.new super end @@ -104,8 +104,8 @@ module ActionController #:nodoc: # This method is called automatically by filters, so you generally don't need to care about it. def sweep #:nodoc: keys.each do |k| - unless @used[k] - use(k) + unless @used.include?(k) + @used << k else delete(k) @used.delete(k) @@ -113,47 +113,45 @@ module ActionController #:nodoc: end # clean up after keys that could have been left over by calling reject! or shift on the flash - (@used.keys - keys).each{ |k| @used.delete(k) } + (@used - keys).each{ |k| @used.delete(k) } end - def store(session, key = "flash") + def store(session) return if self.empty? - session[key] = self + session["flash"] = self end - private - # Used internally by the keep and discard methods - # use() # marks the entire flash as used - # use('msg') # marks the "msg" entry as used - # use(nil, false) # marks the entire flash as unused (keeps it around for one more action) - # use('msg', false) # marks the "msg" entry as unused (keeps it around for one more action) - # Returns the single value for the key you asked to be marked (un)used or the FlashHash itself - # if no key is passed. - def use(key = nil, used = true) - Array(key || keys).each { |k| @used[k] = used } - return key ? self[key] : self - end + private + # Used internally by the keep and discard methods + # use() # marks the entire flash as used + # use('msg') # marks the "msg" entry as used + # use(nil, false) # marks the entire flash as unused (keeps it around for one more action) + # use('msg', false) # marks the "msg" entry as unused (keeps it around for one more action) + # Returns the single value for the key you asked to be marked (un)used or the FlashHash itself + # if no key is passed. + def use(key = nil, used = true) + Array(key || keys).each { |k| used ? @used << k : @used.delete(k) } + return key ? self[key] : self + end end protected def process_action(method_name) super - if defined? @_flash - @_flash.store(session) - remove_instance_variable(:@_flash) - end + @_flash.store(session) if @_flash + @_flash = nil end def reset_session super - remove_instance_variable(:@_flash) if defined?(@_flash) + @_flash = nil end # Access the contents of the flash. Use flash["notice"] to # read a notice you put there or flash["notice"] = "hello" # to put a new one. def flash #:doc: - if !defined?(@_flash) + if !@_flash @_flash = session["flash"] || FlashHash.new @_flash.sweep end -- cgit v1.2.3 From b3012bbd1637e61c628fc700f885ab4a06251175 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 27 Oct 2009 01:55:17 -0700 Subject: Tweak CI for toplevel gem bundle --- ci/ci_build.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index c49fb5f0c4..23e223b1b2 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -16,6 +16,14 @@ root_dir = File.expand_path(File.dirname(__FILE__) + "/..") # A security hole, but there is nothing valuable on rails CI box anyway. build_results[:geminstaller] = system "sudo geminstaller --config=#{root_dir}/ci/geminstaller.yml --exceptions" +rm_f "#{root_dir}/vendor" +cd root_dir do + puts + puts "[CruiseControl] Bundling RubyGems" + puts + build_results[:bundle] = system 'gem bundle' +end + cd "#{root_dir}/activesupport" do puts puts "[CruiseControl] Building ActiveSupport" @@ -29,28 +37,28 @@ cd "#{root_dir}/activerecord" do puts puts "[CruiseControl] Building ActiveRecord with MySQL" puts - build_results[:activerecord_mysql] = system 'gem bundle && rake mysql:rebuild_databases && rake test_mysql' + build_results[:activerecord_mysql] = system 'rake mysql:rebuild_databases && rake test_mysql' end cd "#{root_dir}/activerecord" do puts puts "[CruiseControl] Building ActiveRecord with PostgreSQL" puts - build_results[:activerecord_postgresql8] = system 'gem bundle && rake postgresql:rebuild_databases && rake test_postgresql' + build_results[:activerecord_postgresql8] = system 'rake postgresql:rebuild_databases && rake test_postgresql' end cd "#{root_dir}/activerecord" do puts puts "[CruiseControl] Building ActiveRecord with SQLite 3" puts - build_results[:activerecord_sqlite3] = system 'gem bundle && rake test_sqlite3' + build_results[:activerecord_sqlite3] = system 'rake test_sqlite3' end cd "#{root_dir}/activemodel" do puts puts "[CruiseControl] Building ActiveModel" puts - build_results[:activemodel] = system 'gem bundle && rake' + build_results[:activemodel] = system 'rake' end rm_f "#{root_dir}/activeresource/debug.log" @@ -65,7 +73,7 @@ cd "#{root_dir}/actionpack" do puts puts "[CruiseControl] Building ActionPack" puts - build_results[:actionpack] = system 'gem bundle && rake' + build_results[:actionpack] = system 'rake' build_results[:actionpack_isolated] = system 'rake test:isolated' end @@ -73,14 +81,14 @@ cd "#{root_dir}/actionmailer" do puts puts "[CruiseControl] Building ActionMailer" puts - build_results[:actionmailer] = system 'gem bundle && rake' + build_results[:actionmailer] = system 'rake' end cd "#{root_dir}/railties" do puts puts "[CruiseControl] Building RailTies" puts - build_results[:railties] = system 'gem bundle && rake' + build_results[:railties] = system 'rake' end -- cgit v1.2.3 From 58555d0c8b8beaee02ad72cfaf262dbf21674066 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 27 Oct 2009 02:03:25 -0700 Subject: Remove old per-component bundled environments first --- ci/ci_build.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 23e223b1b2..b2f9f59bec 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -17,6 +17,7 @@ root_dir = File.expand_path(File.dirname(__FILE__) + "/..") build_results[:geminstaller] = system "sudo geminstaller --config=#{root_dir}/ci/geminstaller.yml --exceptions" rm_f "#{root_dir}/vendor" +system "rm -rf #{root_dir}/*/vendor" cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" -- cgit v1.2.3 From 4653719aa6407f7d0288210204c7f3d8f2728489 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 26 Oct 2009 23:11:52 -0700 Subject: Clean up flash a bit --- actionpack/lib/action_controller/metal/flash.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/flash.rb b/actionpack/lib/action_controller/metal/flash.rb index b2fc359df4..f43900faa0 100644 --- a/actionpack/lib/action_controller/metal/flash.rb +++ b/actionpack/lib/action_controller/metal/flash.rb @@ -151,7 +151,7 @@ module ActionController #:nodoc: # read a notice you put there or flash["notice"] = "hello" # to put a new one. def flash #:doc: - if !@_flash + unless @_flash @_flash = session["flash"] || FlashHash.new @_flash.sweep end -- cgit v1.2.3 From b3a198041befa933a26a597451f84482df268d0f Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Tue, 27 Oct 2009 00:07:21 -0700 Subject: Some optimizations on AS::Notifications. This does not change the public-facing API. --- activesupport/lib/active_support/notifications.rb | 62 ++++++++++++----------- activesupport/test/notifications_test.rb | 29 +++++++---- 2 files changed, 51 insertions(+), 40 deletions(-) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 7e9ffca13f..8e705a4eaa 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -62,15 +62,14 @@ module ActiveSupport class Instrumenter def initialize(publisher) @publisher = publisher + @id = SecureRandom.hex(10) end def instrument(name, payload={}) - payload[:time] = Time.now - payload[:thread_id] = Thread.current.object_id - payload[:result] = yield if block_given? + time = Time.now + result = yield if block_given? ensure - payload[:duration] = 1000 * (Time.now.to_f - payload[:time].to_f) - @publisher.publish(name, payload) + @publisher.publish(name, time, Time.now, result, @id, payload) end end @@ -79,8 +78,8 @@ module ActiveSupport @queue = queue end - def publish(name, payload) - @queue.publish(name, payload) + def publish(*args) + @queue.publish(*args) end end @@ -95,27 +94,31 @@ module ActiveSupport end def subscribe - @queue.subscribe(@pattern) do |name, payload| - yield Event.new(name, payload) + @queue.subscribe(@pattern) do |*args| + yield Event.new(*args) end end end class Event - attr_reader :name, :time, :duration, :thread_id, :result, :payload + attr_reader :name, :time, :end, :thread_id, :result, :payload - def initialize(name, payload) + def initialize(name, start, ending, result, thread_id, payload) @name = name @payload = payload.dup - @time = @payload.delete(:time) - @thread_id = @payload.delete(:thread_id) - @result = @payload.delete(:result) - @duration = @payload.delete(:duration) + @time = start + @thread_id = thread_id + @end = ending + @result = result + end + + def duration + @duration ||= 1000.0 * (@end - @time) end def parent_of?(event) start = (self.time - event.time) * 1000 - start <= 0 && (start + self.duration >= event.duration) + start <= 0 && (start + duration >= event.duration) end end @@ -124,12 +127,13 @@ module ActiveSupport # class LittleFanout def initialize - @listeners, @stream = [], Queue.new - @thread = Thread.new { consume } + @listeners = [] + @stream = Queue.new + Thread.new { consume } end - def publish(*event) - @stream.push(event) + def publish(*args) + @stream.push(args) end def subscribe(pattern=nil, &block) @@ -137,30 +141,30 @@ module ActiveSupport end def consume - while event = @stream.shift - @listeners.each { |l| l.publish(*event) } + while args = @stream.shift + @listeners.each { |l| l.publish(*args) } end end class Listener - attr_reader :thread + # attr_reader :thread def initialize(pattern, &block) @pattern = pattern @subscriber = block @queue = Queue.new - @thread = Thread.new { consume } + Thread.new { consume } end - def publish(name, payload) - unless @pattern && !(@pattern === name.to_s) - @queue << [name, payload] + def publish(name, *args) + if !@pattern || @pattern === name.to_s + @queue << args.unshift(name) end end def consume - while event = @queue.shift - @subscriber.call(*event) + while args = @queue.shift + @subscriber.call(*args) end end end diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 561ee2b0ba..7d2bdf5ccf 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -8,25 +8,28 @@ class ActiveSupport::Notifications::LittleFanout end class NotificationsEventTest < Test::Unit::TestCase - def test_events_are_initialized_with_name_and_payload - event = event(:foo, :payload => :bar) + def test_events_are_initialized_with_details + event = event(:foo, Time.now, Time.now + 1, 1, random_id, :payload => :bar) assert_equal :foo, event.name assert_equal Hash[:payload => :bar], event.payload end def test_events_consumes_information_given_as_payload - event = event(:foo, :time => (time = Time.now), :result => 1, :duration => 10) + time = Time.now + event = event(:foo, time, time + 0.01, 1, random_id, {}) assert_equal Hash.new, event.payload assert_equal time, event.time assert_equal 1, event.result - assert_equal 10, event.duration + assert_equal 10.0, event.duration end def test_event_is_parent_based_on_time_frame - parent = event(:foo, :time => Time.utc(2009), :duration => 10000) - child = event(:foo, :time => Time.utc(2009, 01, 01, 0, 0, 1), :duration => 1000) - not_child = event(:foo, :time => Time.utc(2009, 01, 01, 0, 0, 1), :duration => 10000) + time = Time.utc(2009, 01, 01, 0, 0, 1) + + parent = event(:foo, Time.utc(2009), Time.utc(2009) + 100, nil, random_id, {}) + child = event(:foo, time, time + 10, nil, random_id, {}) + not_child = event(:foo, time, time + 100, nil, random_id, {}) assert parent.parent_of?(child) assert !child.parent_of?(parent) @@ -34,11 +37,15 @@ class NotificationsEventTest < Test::Unit::TestCase assert !not_child.parent_of?(parent) end - protected +protected - def event(*args) - ActiveSupport::Notifications::Event.new(*args) - end + def random_id + @random_id ||= ActiveSupport::SecureRandom.hex(10) + end + + def event(*args) + ActiveSupport::Notifications::Event.new(*args) + end end class NotificationsMainTest < Test::Unit::TestCase -- cgit v1.2.3 From c3fa20883e667ce2e7ce207ce8f08ba64f7dcf23 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Tue, 27 Oct 2009 09:21:01 -0700 Subject: #include should be #extend --- actionpack/lib/action_controller/metal/session_management.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/session_management.rb b/actionpack/lib/action_controller/metal/session_management.rb index 9f4c4b8b39..d70f40ce7a 100644 --- a/actionpack/lib/action_controller/metal/session_management.rb +++ b/actionpack/lib/action_controller/metal/session_management.rb @@ -1,6 +1,6 @@ module ActionController #:nodoc: module SessionManagement #:nodoc: - include ActiveSupport::Concern + extend ActiveSupport::Concern include ActionController::Configuration -- cgit v1.2.3 From b30294b54ab019b0e53402c6927981f8c306e976 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 27 Oct 2009 09:34:17 -0700 Subject: Fix broken tests --- activesupport/lib/active_support/notifications.rb | 1 + railties/test/application/notifications_test.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 8e705a4eaa..139c66b1e1 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -1,6 +1,7 @@ require 'thread' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/module/attribute_accessors' +require 'active_support/secure_random' module ActiveSupport # Notifications provides an instrumentation API for Ruby. To instrument an diff --git a/railties/test/application/notifications_test.rb b/railties/test/application/notifications_test.rb index 83c18be057..62ed4f4ad4 100644 --- a/railties/test/application/notifications_test.rb +++ b/railties/test/application/notifications_test.rb @@ -12,7 +12,7 @@ module ApplicationTests @subscribers = [] end - def publish(name, payload=nil) + def publish(name, *args) @events << name end -- cgit v1.2.3 From c28a45ad8bb72896d84285158e7f5dc728933062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 11:12:30 -0200 Subject: Fix rake dev and update vendored Thor. Signed-off-by: Yehuda Katz --- railties/Rakefile | 4 +- railties/lib/rails/generators.rb | 2 +- .../lib/rails/vendor/thor-0.11.6/CHANGELOG.rdoc | 77 --- railties/lib/rails/vendor/thor-0.11.6/LICENSE | 20 - railties/lib/rails/vendor/thor-0.11.6/README.rdoc | 234 ---------- .../lib/rails/vendor/thor-0.11.6/bin/rake2thor | 87 ---- railties/lib/rails/vendor/thor-0.11.6/bin/thor | 7 - railties/lib/rails/vendor/thor-0.11.6/lib/thor.rb | 243 ---------- .../rails/vendor/thor-0.11.6/lib/thor/actions.rb | 273 ----------- .../thor-0.11.6/lib/thor/actions/create_file.rb | 102 ---- .../thor-0.11.6/lib/thor/actions/directory.rb | 87 ---- .../lib/thor/actions/empty_directory.rb | 133 ------ .../lib/thor/actions/file_manipulation.rb | 219 --------- .../lib/thor/actions/inject_into_file.rb | 101 ---- .../lib/rails/vendor/thor-0.11.6/lib/thor/base.rb | 517 --------------------- .../thor/core_ext/hash_with_indifferent_access.rb | 75 --- .../thor-0.11.6/lib/thor/core_ext/ordered_hash.rb | 100 ---- .../lib/rails/vendor/thor-0.11.6/lib/thor/error.rb | 27 -- .../lib/rails/vendor/thor-0.11.6/lib/thor/group.rb | 263 ----------- .../vendor/thor-0.11.6/lib/thor/invocation.rb | 178 ------- .../rails/vendor/thor-0.11.6/lib/thor/parser.rb | 4 - .../vendor/thor-0.11.6/lib/thor/parser/argument.rb | 67 --- .../thor-0.11.6/lib/thor/parser/arguments.rb | 145 ------ .../vendor/thor-0.11.6/lib/thor/parser/option.rb | 132 ------ .../vendor/thor-0.11.6/lib/thor/parser/options.rb | 142 ------ .../vendor/thor-0.11.6/lib/thor/rake_compat.rb | 67 --- .../rails/vendor/thor-0.11.6/lib/thor/runner.rb | 299 ------------ .../lib/rails/vendor/thor-0.11.6/lib/thor/shell.rb | 72 --- .../vendor/thor-0.11.6/lib/thor/shell/basic.rb | 219 --------- .../vendor/thor-0.11.6/lib/thor/shell/color.rb | 108 ----- .../lib/rails/vendor/thor-0.11.6/lib/thor/task.rb | 122 ----- .../lib/rails/vendor/thor-0.11.6/lib/thor/util.rb | 251 ---------- .../lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc | 77 +++ railties/lib/rails/vendor/thor-0.11.8/LICENSE | 20 + railties/lib/rails/vendor/thor-0.11.8/README.rdoc | 234 ++++++++++ railties/lib/rails/vendor/thor-0.11.8/Thorfile | 63 +++ railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb | 242 ++++++++++ .../rails/vendor/thor-0.11.8/lib/thor/actions.rb | 273 +++++++++++ .../thor-0.11.8/lib/thor/actions/create_file.rb | 102 ++++ .../thor-0.11.8/lib/thor/actions/directory.rb | 89 ++++ .../lib/thor/actions/empty_directory.rb | 133 ++++++ .../lib/thor/actions/file_manipulation.rb | 219 +++++++++ .../lib/thor/actions/inject_into_file.rb | 101 ++++ .../lib/rails/vendor/thor-0.11.8/lib/thor/base.rb | 517 +++++++++++++++++++++ .../thor/core_ext/hash_with_indifferent_access.rb | 75 +++ .../thor-0.11.8/lib/thor/core_ext/ordered_hash.rb | 100 ++++ .../lib/rails/vendor/thor-0.11.8/lib/thor/error.rb | 27 ++ .../lib/rails/vendor/thor-0.11.8/lib/thor/group.rb | 263 +++++++++++ .../vendor/thor-0.11.8/lib/thor/invocation.rb | 178 +++++++ .../rails/vendor/thor-0.11.8/lib/thor/parser.rb | 4 + .../vendor/thor-0.11.8/lib/thor/parser/argument.rb | 67 +++ .../thor-0.11.8/lib/thor/parser/arguments.rb | 145 ++++++ .../vendor/thor-0.11.8/lib/thor/parser/option.rb | 132 ++++++ .../vendor/thor-0.11.8/lib/thor/parser/options.rb | 142 ++++++ .../vendor/thor-0.11.8/lib/thor/rake_compat.rb | 66 +++ .../rails/vendor/thor-0.11.8/lib/thor/runner.rb | 299 ++++++++++++ .../lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb | 78 ++++ .../vendor/thor-0.11.8/lib/thor/shell/basic.rb | 219 +++++++++ .../vendor/thor-0.11.8/lib/thor/shell/color.rb | 108 +++++ .../lib/rails/vendor/thor-0.11.8/lib/thor/task.rb | 122 +++++ .../lib/rails/vendor/thor-0.11.8/lib/thor/util.rb | 251 ++++++++++ .../rails/vendor/thor-0.11.8/lib/thor/version.rb | 3 + 62 files changed, 4352 insertions(+), 4374 deletions(-) delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/CHANGELOG.rdoc delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/LICENSE delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/README.rdoc delete mode 100755 railties/lib/rails/vendor/thor-0.11.6/bin/rake2thor delete mode 100755 railties/lib/rails/vendor/thor-0.11.6/bin/thor delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/create_file.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/directory.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/base.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/error.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/group.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/invocation.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/argument.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/arguments.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/option.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/options.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/rake_compat.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/runner.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell/basic.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell/color.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/task.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.6/lib/thor/util.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc create mode 100644 railties/lib/rails/vendor/thor-0.11.8/LICENSE create mode 100644 railties/lib/rails/vendor/thor-0.11.8/README.rdoc create mode 100644 railties/lib/rails/vendor/thor-0.11.8/Thorfile create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/color.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/task.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb create mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb diff --git a/railties/Rakefile b/railties/Rakefile index 0ba5ca10c2..ebac90a403 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -6,7 +6,8 @@ require 'rake/gempackagetask' require 'date' require 'rbconfig' -require File.join(File.dirname(__FILE__), 'lib/rails', 'version') +$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib" +require 'rails' PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' PKG_NAME = ENV['PKG_NAME'] || 'rails' @@ -81,7 +82,6 @@ end # Run application generator ------------------------------------------------------------- task :create_rails do - $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib" require 'rails/generators' require 'rails/generators/rails/app/app_generator' Rails::Generators::AppGenerator.start [ File.basename(PKG_DESTINATION), "--quiet" ], diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index d1bdbd5253..49f32aa0db 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -9,7 +9,7 @@ require 'active_support/core_ext/module/attribute_accessors' require 'active_support/core_ext/string/inflections' # TODO: Do not always push on vendored thor -$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/vendor/thor-0.11.6/lib") +$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/vendor/thor-0.11.8/lib") require 'rails/generators/base' require 'rails/generators/named_base' diff --git a/railties/lib/rails/vendor/thor-0.11.6/CHANGELOG.rdoc b/railties/lib/rails/vendor/thor-0.11.6/CHANGELOG.rdoc deleted file mode 100644 index dba25b7205..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/CHANGELOG.rdoc +++ /dev/null @@ -1,77 +0,0 @@ -== TODO - -* Improve spec coverage for Thor::Runner - -== 0.11.x, released 2009-07-01 - -* Added a rake compatibility layer. It allows you to use spec and rdoc tasks on - Thor classes. - -* BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore - since it wrong behavior to the invocation system. - -* thor help now show information about any class/task. All those calls are - possible: - - thor help describe - thor help describe:amazing - - Or even with default namespaces: - - thor help :spec - -* Thor::Runner now invokes the default task if none is supplied: - - thor describe # invokes the default task, usually help - -* Thor::Runner now works with mappings: - - thor describe -h - -* Added some documentation and code refactoring. - -== 0.9.8, released 2008-10-20 - -* Fixed some tiny issues that were introduced lately. - -== 0.9.7, released 2008-10-13 - -* Setting global method options on the initialize method works as expected: - All other tasks will accept these global options in addition to their own. -* Added 'group' notion to Thor task sets (class Thor); by default all tasks - are in the 'standard' group. Running 'thor -T' will only show the standard - tasks - adding --all will show all tasks. You can also filter on a specific - group using the --group option: thor -T --group advanced - -== 0.9.6, released 2008-09-13 - -* Generic improvements - -== 0.9.5, released 2008-08-27 - -* Improve Windows compatibility -* Update (incorrect) README and task.thor sample file -* Options hash is now frozen (once returned) -* Allow magic predicates on options object. For instance: `options.force?` -* Add support for :numeric type -* BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f]) -* Allow specifying optional args with default values: method_options(:user => "mislav") -* Don't write options for nil or false values. This allows, for example, turning color off when running specs. -* Exit with the status of the spec command to help CI stuff out some. - -== 0.9.4, released 2008-08-13 - -* Try to add Windows compatibility. -* BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore -* Allow options at the beginning of the argument list as well as the end. -* Make options available with symbol keys in addition to string keys. -* Allow true to be passed to Thor#method_options to denote a boolean option. -* If loading a thor file fails, don't give up, just print a warning and keep going. -* Make sure that we re-raise errors if they happened further down the pipe than we care about. -* Only delete the old file on updating when the installation of the new one is a success -* Make it Ruby 1.8.5 compatible. -* Don't raise an error if a boolean switch is defined multiple times. -* Thor::Options now doesn't parse through things that look like options but aren't. -* Add URI detection to install task, and make sure we don't append ".thor" to URIs -* Add rake2thor to the gem binfiles. -* Make sure local Thorfiles override system-wide ones. diff --git a/railties/lib/rails/vendor/thor-0.11.6/LICENSE b/railties/lib/rails/vendor/thor-0.11.6/LICENSE deleted file mode 100644 index 98722da459..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008 Yehuda Katz - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/railties/lib/rails/vendor/thor-0.11.6/README.rdoc b/railties/lib/rails/vendor/thor-0.11.6/README.rdoc deleted file mode 100644 index f1106f02b6..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/README.rdoc +++ /dev/null @@ -1,234 +0,0 @@ -= thor - -Map options to a class. Simply create a class with the appropriate annotations -and have options automatically map to functions and parameters. - -Example: - - class App < Thor # [1] - map "-L" => :list # [2] - - desc "install APP_NAME", "install one of the available apps" # [3] - method_options :force => :boolean, :alias => :string # [4] - def install(name) - user_alias = options[:alias] - if options.force? - # do something - end - # other code - end - - desc "list [SEARCH]", "list all of the available apps, limited by SEARCH" - def list(search="") - # list everything - end - end - -Thor automatically maps commands as such: - - thor app:install myname --force - -That gets converted to: - - App.new.install("myname") - # with {'force' => true} as options hash - -1. Inherit from Thor to turn a class into an option mapper -2. Map additional non-valid identifiers to specific methods. In this case, convert -L to :list -3. Describe the method immediately below. The first parameter is the usage information, and the second parameter is the description -4. Provide any additional options that will be available the instance method options. - -== Types for method_options - -* :boolean - is parsed as --option or --option=true -* :string - is parsed as --option=VALUE -* :numeric - is parsed as --option=N -* :array - is parsed as --option=one two three -* :hash - is parsed as --option=name:string age:integer - -Besides, method_option allows a default value to be given, examples: - - method_options :force => false - #=> Creates a boolean option with default value false - - method_options :alias => "bar" - #=> Creates a string option with default value "bar" - - method_options :threshold => 3.0 - #=> Creates a numeric option with default value 3.0 - -You can also supply :option => :required to mark an option as required. The -type is assumed to be string. If you want a required hash with default values -as option, you can use method_option which uses a more declarative style: - - method_option :attributes, :type => :hash, :default => {}, :required => true - -All arguments can be set to nil (except required arguments), by suppling a no or -skip variant. For example: - - thor app name --no-attributes - -In previous versions, aliases for options were created automatically, but now -they should be explicit. You can supply aliases in both short and declarative -styles: - - method_options %w( force -f ) => :boolean - -Or: - - method_option :force, :type => :boolean, :aliases => "-f" - -You can supply as many aliases as you want. - -NOTE: Type :optional available in Thor 0.9.0 was deprecated. Use :string or :boolean instead. - -== Namespaces - -By default, your Thor tasks are invoked using Ruby namespace. In the example -above, tasks are invoked as: - - thor app:install name --force - -However, you could namespace your class as: - - module Sinatra - class App < Thor - # tasks - end - end - -And then you should invoke your tasks as: - - thor sinatra:app:install name --force - -If desired, you can change the namespace: - - module Sinatra - class App < Thor - namespace :myapp - # tasks - end - end - -And then your tasks hould be invoked as: - - thor myapp:install name --force - -== Invocations - -Thor comes with a invocation-dependency system as well which allows a task to be -invoked only once. For example: - - class Counter < Thor - desc "one", "Prints 1, 2, 3" - def one - puts 1 - invoke :two - invoke :three - end - - desc "two", "Prints 2, 3" - def two - puts 2 - invoke :three - end - - desc "three", "Prints 3" - def three - puts 3 - end - end - -When invoking the task one: - - thor counter:one - -The output is "1 2 3", which means that the three task was invoked only once. -You can even invoke tasks from another class, so be sure to check the -documentation. - -== Thor::Group - -Thor has a special class called Thor::Group. The main difference to Thor class -is that it invokes all tasks at once. The example above could be rewritten in -Thor::Group as this: - - class Counter < Thor::Group - desc "Prints 1, 2, 3" - - def one - puts 1 - end - - def two - puts 2 - end - - def three - puts 3 - end - end - -When invoked: - - thor counter - -It prints "1 2 3" as well. Notice you should describe (using the method desc) -only the class and not each task anymore. Thor::Group is a great tool to create -generators, since you can define several steps which are invoked in the order they -are defined (Thor::Group is the tool use in generators in Rails 3.0). - -Besides, Thor::Group can parse arguments and options as Thor tasks: - - class Counter < Thor::Group - # number will be available as attr_accessor - argument :number, :type => :numeric, :desc => "The number to start counting" - desc "Prints the 'number' given upto 'number+2'" - - def one - puts number + 0 - end - - def two - puts number + 1 - end - - def three - puts number + 2 - end - end - -The counter above expects one parameter and has the folling outputs: - - thor counter 5 - # Prints "5 6 7" - - thor counter 11 - # Prints "11 12 13" - -You can also give options to Thor::Group, but instead of using method_option -and method_options, you should use class_option and class_options. -Both argument and class_options methods are available to Thor class as well. - -== Actions - -Thor comes with several actions which helps with script and generator tasks. You -might be familiar with them since some came from Rails Templates. They are: -say, ask, yes?, no?, add_file, -remove_file, copy_file, template, directory, -inside, run, inject_into_file and a couple more. - -To use them, you just need to include Thor::Actions in your Thor classes: - - class App < Thor - include Thor::Actions - # tasks - end - -Some actions like copy file requires that a class method called source_root is -defined in your class. This is the directory where your templates should be -placed. Be sure to check the documentation. - -== License - -See MIT LICENSE. diff --git a/railties/lib/rails/vendor/thor-0.11.6/bin/rake2thor b/railties/lib/rails/vendor/thor-0.11.6/bin/rake2thor deleted file mode 100755 index 50c7410d80..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/bin/rake2thor +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'ruby2ruby' -require 'parse_tree' -if Ruby2Ruby::VERSION >= "1.2.0" - require 'parse_tree_extensions' -end -require 'rake' - -input = ARGV[0] || 'Rakefile' -output = ARGV[1] || 'Thorfile' - -$requires = [] - -module Kernel - def require_with_record(file) - $requires << file if caller[1] =~ /rake2thor:/ - require_without_record file - end - alias_method :require_without_record, :require - alias_method :require, :require_with_record -end - -load input - -@private_methods = [] - -def file_task_name(name) - "compile_" + name.gsub('/', '_slash_').gsub('.', '_dot_').gsub(/\W/, '_') -end - -def method_for_task(task) - file_task = task.is_a?(Rake::FileTask) - comment = task.instance_variable_get('@comment') - prereqs = task.instance_variable_get('@prerequisites').select(&Rake::Task.method(:task_defined?)) - actions = task.instance_variable_get('@actions') - name = task.name.gsub(/^([^:]+:)+/, '') - name = file_task_name(name) if file_task - meth = '' - - meth << "desc #{name.inspect}, #{comment.inspect}\n" if comment - meth << "def #{name}\n" - - meth << prereqs.map do |pre| - pre = pre.to_s - pre = file_task_name(pre) if Rake::Task[pre].is_a?(Rake::FileTask) - ' ' + pre - end.join("\n") - - meth << "\n\n" unless prereqs.empty? || actions.empty? - - meth << actions.map do |act| - act = act.to_ruby - unless act.gsub!(/^proc \{ \|(\w+)\|\n/, - " \\1 = Struct.new(:name).new(#{name.inspect}) # A crude mock Rake::Task object\n") - act.gsub!(/^proc \{\n/, '') - end - act.gsub(/\n\}$/, '') - end.join("\n") - - meth << "\nend" - - if file_task - @private_methods << meth - return - end - - meth -end - -body = Rake::Task.tasks.map(&method(:method_for_task)).compact.map { |meth| meth.gsub(/^/, ' ') }.join("\n\n") - -unless @private_methods.empty? - body << "\n\n private\n\n" - body << @private_methods.map { |meth| meth.gsub(/^/, ' ') }.join("\n\n") -end - -requires = $requires.map { |r| "require #{r.inspect}" }.join("\n") - -File.open(output, 'w') { |f| f.write(<:: name of the defaut task - # - def default_task(meth=nil) - case meth - when :none - @default_task = 'help' - when nil - @default_task ||= from_superclass(:default_task, 'help') - else - @default_task = meth.to_s - end - end - - # Defines the usage and the description of the next task. - # - # ==== Parameters - # usage - # description - # - def desc(usage, description, options={}) - if options[:for] - task = find_and_refresh_task(options[:for]) - task.usage = usage if usage - task.description = description if description - else - @usage, @desc = usage, description - end - end - - # Maps an input to a task. If you define: - # - # map "-T" => "list" - # - # Running: - # - # thor -T - # - # Will invoke the list task. - # - # ==== Parameters - # Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given task. - # - def map(mappings=nil) - @map ||= from_superclass(:map, {}) - - if mappings - mappings.each do |key, value| - if key.respond_to?(:each) - key.each {|subkey| @map[subkey] = value} - else - @map[key] = value - end - end - end - - @map - end - - # Declares the options for the next task to be declared. - # - # ==== Parameters - # Hash[Symbol => Object]:: The hash key is the name of the option and the value - # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric - # or :required (string). If you give a value, the type of the value is used. - # - def method_options(options=nil) - @method_options ||= {} - build_options(options, @method_options) if options - @method_options - end - - # Adds an option to the set of class options. If :for is given as option, - # it allows you to change the options from a previous defined task. - # - # def previous_task - # # magic - # end - # - # method_options :foo => :bar, :for => :previous_task - # - # def next_task - # # magic - # end - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described below. - # - # ==== Options - # :desc - Description for the argument. - # :required - If the argument is required or not. - # :default - Default value for this argument. It cannot be required and have default values. - # :aliases - Aliases for this option. - # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. - # :group - The group for this options. Use by class options to output options in different levels. - # :banner - String to show on usage notes. - # - def method_option(name, options={}) - scope = if options[:for] - find_and_refresh_task(options[:for]).options - else - method_options - end - - build_option(name, options, scope) - end - - # Parses the task and options from the given args, instantiate the class - # and invoke the task. This method is used when the arguments must be parsed - # from an array. If you are inside Ruby and want to use a Thor class, you - # can simply initialize it: - # - # script = MyScript.new(args, options, config) - # script.invoke(:task, first_arg, second_arg, third_arg) - # - def start(given_args=ARGV, config={}) - super do - meth = normalize_task_name(given_args.shift) - task = all_tasks[meth] - - if task - args, opts = Thor::Options.split(given_args) - config.merge!(:task_options => task.options) - else - args, opts = given_args, {} - end - - task ||= Thor::Task::Dynamic.new(meth) - trailing = args[Range.new(arguments.size, -1)] - new(args, opts, config).invoke(task, trailing || []) - end - end - - # Prints help information. If a task name is given, it shows information - # only about the specific task. - # - # ==== Parameters - # meth:: An optional task name to print usage information about. - # - # ==== Options - # namespace:: When true, shows the namespace in the output before the usage. - # skip_inherited:: When true, does not show tasks from superclass. - # - def help(shell, meth=nil, options={}) - meth, options = nil, meth if meth.is_a?(Hash) - - if meth - task = all_tasks[meth] - raise UndefinedTaskError, "task '#{meth}' could not be found in namespace '#{self.namespace}'" unless task - - shell.say "Usage:" - shell.say " #{banner(task, options[:namespace], false)}" - shell.say - class_options_help(shell, "Class", :Method => task.options.map { |_, o| o }) - shell.say task.description - else - list = (options[:short] ? tasks : all_tasks).map do |_, task| - item = [ banner(task, options[:namespace]) ] - item << "# #{task.short_description}" if task.short_description - item << " " - end - - options[:ident] ||= 2 - if options[:short] - shell.print_list(list, :ident => options[:ident]) - else - shell.say "Tasks:" - shell.print_list(list, :ident => options[:ident]) - end - - Thor::Util.thor_classes_in(self).each do |subclass| - namespace = options[:namespace] == true || subclass.namespace.gsub(/^#{self.namespace}:/, '') - subclass.help(shell, options.merge(:short => true, :namespace => namespace)) - end - - class_options_help(shell, "Class") unless options[:short] - end - end - - protected - - # The banner for this class. You can customize it if you are invoking the - # thor class by another ways which is not the Thor::Runner. It receives - # the task that is going to be invoked and a boolean which indicates if - # the namespace should be displayed as arguments. - # - def banner(task, namespace=true, show_options=true) - task.formatted_usage(self, namespace, show_options) - end - - def baseclass #:nodoc: - Thor - end - - def create_task(meth) #:nodoc: - if @usage && @desc - tasks[meth.to_s] = Thor::Task.new(meth, @desc, @usage, method_options) - @usage, @desc, @method_options = nil - true - elsif self.all_tasks[meth.to_s] || meth.to_sym == :method_missing - true - else - puts "[WARNING] Attempted to create task #{meth.inspect} without usage or description. " << - "Call desc if you want this method to be available as task or declare it inside a " << - "no_tasks{} block. Invoked from #{caller[1].inspect}." - false - end - end - - def initialize_added #:nodoc: - class_options.merge!(method_options) - @method_options = nil - end - - # Receives a task name (can be nil), and try to get a map from it. - # If a map can't be found use the sent name or the default task. - # - def normalize_task_name(meth) #:nodoc: - mapping = map[meth.to_s] - meth = mapping || meth || default_task - meth.to_s.gsub('-','_') # treat foo-bar > foo_bar - end - end - - include Thor::Base - - map HELP_MAPPINGS => :help - - desc "help [TASK]", "Describe available tasks or one specific task" - def help(task=nil) - self.class.help(shell, task, :namespace => task && task.include?(?:)) - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions.rb deleted file mode 100644 index d561ccb2aa..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions.rb +++ /dev/null @@ -1,273 +0,0 @@ -require 'fileutils' - -Dir[File.join(File.dirname(__FILE__), "actions", "*.rb")].each do |action| - require action -end - -class Thor - module Actions - attr_accessor :behavior - - def self.included(base) #:nodoc: - base.extend ClassMethods - end - - module ClassMethods - # Hold source paths for one Thor instance. source_paths_for_search is the - # method responsible to gather source_paths from this current class, - # inherited paths and the source root. - # - def source_paths - @source_paths ||= [] - end - - # Returns the source paths in the following order: - # - # 1) This class source paths - # 2) Source root - # 3) Parents source paths - # - def source_paths_for_search - paths = [] - paths += self.source_paths - paths << self.source_root if self.respond_to?(:source_root) - paths += from_superclass(:source_paths, []) - paths - end - - # Add runtime options that help actions execution. - # - def add_runtime_options! - class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime, - :desc => "Run but do not make any changes" - - class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime, - :desc => "Overwrite files that already exist" - - class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime, - :desc => "Skip files that already exist" - - class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime, - :desc => "Supress status output" - end - end - - # Extends initializer to add more configuration options. - # - # ==== Configuration - # behavior:: The actions default behavior. Can be :invoke or :revoke. - # It also accepts :force, :skip and :pretend to set the behavior - # and the respective option. - # - # destination_root:: The root directory needed for some actions. - # - def initialize(args=[], options={}, config={}) - self.behavior = case config[:behavior].to_s - when "force", "skip" - _cleanup_options_and_set(options, config[:behavior]) - :invoke - when "revoke" - :revoke - else - :invoke - end - - super - self.destination_root = config[:destination_root] - end - - # Wraps an action object and call it accordingly to the thor class behavior. - # - def action(instance) #:nodoc: - if behavior == :revoke - instance.revoke! - else - instance.invoke! - end - end - - # Returns the root for this thor class (also aliased as destination root). - # - def destination_root - @destination_stack.last - end - - # Sets the root for this thor class. Relatives path are added to the - # directory where the script was invoked and expanded. - # - def destination_root=(root) - @destination_stack ||= [] - @destination_stack[0] = File.expand_path(root || '') - end - - # Returns the given path relative to the absolute root (ie, root where - # the script started). - # - def relative_to_original_destination_root(path, remove_dot=true) - path = path.gsub(@destination_stack[0], '.') - remove_dot ? (path[2..-1] || '') : path - end - - # Holds source paths in instance so they can be manipulated. - # - def source_paths - @source_paths ||= self.class.source_paths_for_search - end - - # Receives a file or directory and search for it in the source paths. - # - def find_in_source_paths(file) - relative_root = relative_to_original_destination_root(destination_root, false) - - source_paths.each do |source| - source_file = File.expand_path(file, File.join(source, relative_root)) - return source_file if File.exists?(source_file) - end - - if source_paths.empty? - raise Error, "You don't have any source path defined for class #{self.class.name}. To fix this, " << - "you can define a source_root in your class." - else - raise Error, "Could not find #{file.inspect} in source paths." - end - end - - # Do something in the root or on a provided subfolder. If a relative path - # is given it's referenced from the current root. The full path is yielded - # to the block you provide. The path is set back to the previous path when - # the method exits. - # - # ==== Parameters - # dir:: the directory to move to. - # config:: give :verbose => true to log and use padding. - # - def inside(dir='', config={}, &block) - verbose = config.fetch(:verbose, false) - - say_status :inside, dir, verbose - shell.padding += 1 if verbose - @destination_stack.push File.expand_path(dir, destination_root) - - FileUtils.mkdir_p(destination_root) unless File.exist?(destination_root) - FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield } - - @destination_stack.pop - shell.padding -= 1 if verbose - end - - # Goes to the root and execute the given block. - # - def in_root - inside(@destination_stack.first) { yield } - end - - # Loads an external file and execute it in the instance binding. - # - # ==== Parameters - # path:: The path to the file to execute. Can be a web address or - # a relative path from the source root. - # - # ==== Examples - # - # apply "http://gist.github.com/103208" - # - # apply "recipes/jquery.rb" - # - def apply(path, config={}) - verbose = config.fetch(:verbose, true) - path = find_in_source_paths(path) unless path =~ /^http\:\/\// - - say_status :apply, path, verbose - shell.padding += 1 if verbose - instance_eval(open(path).read) - shell.padding -= 1 if verbose - end - - # Executes a command. - # - # ==== Parameters - # command:: the command to be executed. - # config:: give :verbose => false to not log the status. Specify :with - # to append an executable to command executation. - # - # ==== Example - # - # inside('vendor') do - # run('ln -s ~/edge rails') - # end - # - def run(command, config={}) - return unless behavior == :invoke - - destination = relative_to_original_destination_root(destination_root, false) - desc = "#{command} from #{destination.inspect}" - - if config[:with] - desc = "#{File.basename(config[:with].to_s)} #{desc}" - command = "#{config[:with]} #{command}" - end - - say_status :run, desc, config.fetch(:verbose, true) - system(command) unless options[:pretend] - end - - # Executes a ruby script (taking into account WIN32 platform quirks). - # - # ==== Parameters - # command:: the command to be executed. - # config:: give :verbose => false to not log the status. - # - def run_ruby_script(command, config={}) - return unless behavior == :invoke - run "#{command}", config.merge(:with => Thor::Util.ruby_command) - end - - # Run a thor command. A hash of options can be given and it's converted to - # switches. - # - # ==== Parameters - # task:: the task to be invoked - # args:: arguments to the task - # config:: give :verbose => false to not log the status. Other options - # are given as parameter to Thor. - # - # ==== Examples - # - # thor :install, "http://gist.github.com/103208" - # #=> thor install http://gist.github.com/103208 - # - # thor :list, :all => true, :substring => 'rails' - # #=> thor list --all --substring=rails - # - def thor(task, *args) - config = args.last.is_a?(Hash) ? args.pop : {} - verbose = config.key?(:verbose) ? config.delete(:verbose) : true - - args.unshift task - args.push Thor::Options.to_switches(config) - command = args.join(' ').strip - - run command, :with => :thor, :verbose => verbose - end - - protected - - # Allow current root to be shared between invocations. - # - def _shared_configuration #:nodoc: - super.merge!(:destination_root => self.destination_root) - end - - def _cleanup_options_and_set(options, key) #:nodoc: - case options - when Array - %w(--force -f --skip -s).each { |i| options.delete(i) } - options << "--#{key}" - when Hash - [:force, :skip, "force", "skip"].each { |i| options.delete(i) } - options.merge!(key => true) - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/create_file.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/create_file.rb deleted file mode 100644 index 8f6badee27..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/create_file.rb +++ /dev/null @@ -1,102 +0,0 @@ -require 'thor/actions/empty_directory' - -class Thor - module Actions - - # Create a new file relative to the destination root with the given data, - # which is the return value of a block or a data string. - # - # ==== Parameters - # destination:: the relative path to the destination root. - # data:: the data to append to the file. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # create_file "lib/fun_party.rb" do - # hostname = ask("What is the virtual hostname I should use?") - # "vhost.name = #{hostname}" - # end - # - # create_file "config/apach.conf", "your apache config" - # - def create_file(destination, data=nil, config={}, &block) - action CreateFile.new(self, destination, block || data.to_s, config) - end - alias :add_file :create_file - - # AddFile is a subset of Template, which instead of rendering a file with - # ERB, it gets the content from the user. - # - class CreateFile < EmptyDirectory #:nodoc: - attr_reader :data - - def initialize(base, destination, data, config={}) - @data = data - super(base, destination, config) - end - - # Checks if the content of the file at the destination is identical to the rendered result. - # - # ==== Returns - # Boolean:: true if it is identical, false otherwise. - # - def identical? - exists? && File.read(destination) == render - end - - # Holds the content to be added to the file. - # - def render - @render ||= if data.is_a?(Proc) - data.call - else - data - end - end - - def invoke! - invoke_with_conflict_check do - FileUtils.mkdir_p(File.dirname(destination)) - File.open(destination, 'w'){ |f| f.write render } - end - end - - protected - - # Now on conflict we check if the file is identical or not. - # - def on_conflict_behavior(&block) - if identical? - say_status :identical, :blue - else - options = base.options.merge(config) - force_or_skip_or_conflict(options[:force], options[:skip], &block) - end - end - - # If force is true, run the action, otherwise check if it's not being - # skipped. If both are false, show the file_collision menu, if the menu - # returns true, force it, otherwise skip. - # - def force_or_skip_or_conflict(force, skip, &block) - if force - say_status :force, :yellow - block.call unless pretend? - elsif skip - say_status :skip, :yellow - else - say_status :conflict, :red - force_or_skip_or_conflict(force_on_collision?, true, &block) - end - end - - # Shows the file collision menu to the user and gets the result. - # - def force_on_collision? - base.shell.file_collision(destination){ render } - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/directory.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/directory.rb deleted file mode 100644 index be5eb822ac..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/directory.rb +++ /dev/null @@ -1,87 +0,0 @@ -require 'thor/actions/empty_directory' - -class Thor - module Actions - - # Copies recursively the files from source directory to root directory. - # If any of the files finishes with .tt, it's considered to be a template - # and is placed in the destination without the extension .tt. If any - # empty directory is found, it's copied and all .empty_directory files are - # ignored. Remember that file paths can also be encoded, let's suppose a doc - # directory with the following files: - # - # doc/ - # components/.empty_directory - # README - # rdoc.rb.tt - # %app_name%.rb - # - # When invoked as: - # - # directory "doc" - # - # It will create a doc directory in the destination with the following - # files (assuming that the app_name is "blog"): - # - # doc/ - # components/ - # README - # rdoc.rb - # blog.rb - # - # ==== Parameters - # source:: the relative path to the source root. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # If :recursive => false, does not look for paths recursively. - # - # ==== Examples - # - # directory "doc" - # directory "doc", "docs", :recursive => false - # - def directory(source, destination=nil, config={}) - action Directory.new(self, source, destination || source, config) - end - - class Directory < EmptyDirectory #:nodoc: - attr_reader :source - - def initialize(base, source, destination=nil, config={}) - @source = File.expand_path(base.find_in_source_paths(source.to_s)) - super(base, destination, { :recursive => true }.merge(config)) - end - - def invoke! - base.empty_directory given_destination, config - execute! - end - - def revoke! - execute! - end - - protected - - def execute! - lookup = config[:recursive] ? File.join(source, '**') : source - lookup = File.join(lookup, '{*,.[a-z]*}') - - Dir[lookup].each do |file_source| - next if File.directory?(file_source) - file_destination = File.join(given_destination, file_source.gsub(source, '.')) - - case file_source - when /\.empty_directory$/ - base.empty_directory(File.dirname(file_destination), config) - when /\.tt$/ - base.template(file_source, file_destination[0..-4], config) - else - base.copy_file(file_source, file_destination, config) - end - end - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb deleted file mode 100644 index 03c1fe4af1..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/empty_directory.rb +++ /dev/null @@ -1,133 +0,0 @@ -class Thor - module Actions - - # Creates an empty directory. - # - # ==== Parameters - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # empty_directory "doc" - # - def empty_directory(destination, config={}) - action EmptyDirectory.new(self, destination, config) - end - - # Class which holds create directory logic. This is the base class for - # other actions like create_file and directory. - # - # This implementation is based in Templater actions, created by Jonas Nicklas - # and Michael S. Klishin under MIT LICENSE. - # - class EmptyDirectory #:nodoc: - attr_reader :base, :destination, :given_destination, :relative_destination, :config - - # Initializes given the source and destination. - # - # ==== Parameters - # base:: A Thor::Base instance - # source:: Relative path to the source of this file - # destination:: Relative path to the destination of this file - # config:: give :verbose => false to not log the status. - # - def initialize(base, destination, config={}) - @base, @config = base, { :verbose => true }.merge(config) - self.destination = destination - end - - # Checks if the destination file already exists. - # - # ==== Returns - # Boolean:: true if the file exists, false otherwise. - # - def exists? - ::File.exists?(destination) - end - - def invoke! - invoke_with_conflict_check do - ::FileUtils.mkdir_p(destination) - end - end - - def revoke! - say_status :remove, :red - ::FileUtils.rm_rf(destination) if !pretend? && exists? - end - - protected - - # Shortcut for pretend. - # - def pretend? - base.options[:pretend] - end - - # Sets the absolute destination value from a relative destination value. - # It also stores the given and relative destination. Let's suppose our - # script is being executed on "dest", it sets the destination root to - # "dest". The destination, given_destination and relative_destination - # are related in the following way: - # - # inside "bar" do - # empty_directory "baz" - # end - # - # destination #=> dest/bar/baz - # relative_destination #=> bar/baz - # given_destination #=> baz - # - def destination=(destination) - if destination - @given_destination = convert_encoded_instructions(destination.to_s) - @destination = ::File.expand_path(@given_destination, base.destination_root) - @relative_destination = base.relative_to_original_destination_root(@destination) - end - end - - # Filenames in the encoded form are converted. If you have a file: - # - # %class_name%.rb - # - # It gets the class name from the base and replace it: - # - # user.rb - # - def convert_encoded_instructions(filename) - filename.gsub(/%(.*?)%/) do |string| - instruction = $1.strip - base.respond_to?(instruction) ? base.send(instruction) : string - end - end - - # Receives a hash of options and just execute the block if some - # conditions are met. - # - def invoke_with_conflict_check(&block) - if exists? - on_conflict_behavior(&block) - else - say_status :create, :green - block.call unless pretend? - end - - destination - end - - # What to do when the destination file already exists. - # - def on_conflict_behavior(&block) - say_status :exist, :blue - end - - # Shortcut to say_status shell method. - # - def say_status(status, color) - base.shell.say_status status, relative_destination, color if config[:verbose] - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb deleted file mode 100644 index d77d90d448..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/file_manipulation.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'erb' -require 'open-uri' - -class Thor - module Actions - - # Copies the file from the relative source to the relative destination. If - # the destination is not given it's assumed to be equal to the source. - # - # ==== Parameters - # source:: the relative path to the source root. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # copy_file "README", "doc/README" - # - # copy_file "doc/README" - # - def copy_file(source, destination=nil, config={}) - destination ||= source - source = File.expand_path(find_in_source_paths(source.to_s)) - - create_file destination, nil, config do - File.read(source) - end - end - - # Gets the content at the given address and places it at the given relative - # destination. If a block is given instead of destination, the content of - # the url is yielded and used as location. - # - # ==== Parameters - # source:: the address of the given content. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # get "http://gist.github.com/103208", "doc/README" - # - # get "http://gist.github.com/103208" do |content| - # content.split("\n").first - # end - # - def get(source, destination=nil, config={}, &block) - source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ /^http\:\/\// - render = open(source).read - - destination ||= if block_given? - block.arity == 1 ? block.call(render) : block.call - else - File.basename(source) - end - - create_file destination, render, config - end - - # Gets an ERB template at the relative source, executes it and makes a copy - # at the relative destination. If the destination is not given it's assumed - # to be equal to the source removing .tt from the filename. - # - # ==== Parameters - # source:: the relative path to the source root. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # template "README", "doc/README" - # - # template "doc/README" - # - def template(source, destination=nil, config={}) - destination ||= source - source = File.expand_path(find_in_source_paths(source.to_s)) - context = instance_eval('binding') - - create_file destination, nil, config do - ERB.new(::File.read(source), nil, '-').result(context) - end - end - - # Changes the mode of the given file or directory. - # - # ==== Parameters - # mode:: the file mode - # path:: the name of the file to change mode - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # chmod "script/*", 0755 - # - def chmod(path, mode, config={}) - return unless behavior == :invoke - path = File.expand_path(path, destination_root) - say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true) - FileUtils.chmod_R(mode, path) unless options[:pretend] - end - - # Prepend text to a file. Since it depends on inject_into_file, it's reversible. - # - # ==== Parameters - # path:: path of the file to be changed - # data:: the data to prepend to the file, can be also given as a block. - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # prepend_file 'config/environments/test.rb', 'config.gem "rspec"' - # - # prepend_file 'config/environments/test.rb' do - # 'config.gem "rspec"' - # end - # - def prepend_file(path, *args, &block) - config = args.last.is_a?(Hash) ? args.pop : {} - config.merge!(:after => /\A/) - inject_into_file(path, *(args << config), &block) - end - - # Append text to a file. Since it depends on inject_into_file, it's reversible. - # - # ==== Parameters - # path:: path of the file to be changed - # data:: the data to append to the file, can be also given as a block. - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # append_file 'config/environments/test.rb', 'config.gem "rspec"' - # - # append_file 'config/environments/test.rb' do - # 'config.gem "rspec"' - # end - # - def append_file(path, *args, &block) - config = args.last.is_a?(Hash) ? args.pop : {} - config.merge!(:before => /\z/) - inject_into_file(path, *(args << config), &block) - end - - # Injects text right after the class definition. Since it depends on - # inject_into_file, it's reversible. - # - # ==== Parameters - # path:: path of the file to be changed - # klass:: the class to be manipulated - # data:: the data to append to the class, can be also given as a block. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # inject_into_class "app/controllers/application_controller.rb", " filter_parameter :password\n" - # - # inject_into_class "app/controllers/application_controller.rb", ApplicationController do - # " filter_parameter :password\n" - # end - # - def inject_into_class(path, klass, *args, &block) - config = args.last.is_a?(Hash) ? args.pop : {} - config.merge!(:after => /class #{klass}\n|class #{klass} .*\n/) - inject_into_file(path, *(args << config), &block) - end - - # Run a regular expression replacement on a file. - # - # ==== Parameters - # path:: path of the file to be changed - # flag:: the regexp or string to be replaced - # replacement:: the replacement, can be also given as a block - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1' - # - # gsub_file 'README', /rake/, :green do |match| - # match << " no more. Use thor!" - # end - # - def gsub_file(path, flag, *args, &block) - return unless behavior == :invoke - config = args.last.is_a?(Hash) ? args.pop : {} - - path = File.expand_path(path, destination_root) - say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true) - - unless options[:pretend] - content = File.read(path) - content.gsub!(flag, *args, &block) - File.open(path, 'wb') { |file| file.write(content) } - end - end - - # Removes a file at the given location. - # - # ==== Parameters - # path:: path of the file to be changed - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # remove_file 'README' - # remove_file 'app/controllers/application_controller.rb' - # - def remove_file(path, config={}) - return unless behavior == :invoke - path = File.expand_path(path, destination_root) - - say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) - ::FileUtils.rm_rf(path) if !options[:pretend] && File.exists?(path) - end - alias :remove_dir :remove_file - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb deleted file mode 100644 index 0636ec6591..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/actions/inject_into_file.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'thor/actions/empty_directory' - -class Thor - module Actions - - # Injects the given content into a file. Different from gsub_file, this - # method is reversible. - # - # ==== Parameters - # destination:: Relative path to the destination root - # data:: Data to add to the file. Can be given as a block. - # config:: give :verbose => false to not log the status and the flag - # for injection (:after or :before). - # - # ==== Examples - # - # inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n" - # - # inject_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do - # gems = ask "Which gems would you like to add?" - # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n") - # end - # - def inject_into_file(destination, *args, &block) - if block_given? - data, config = block, args.shift - else - data, config = args.shift, args.shift - end - action InjectIntoFile.new(self, destination, data, config) - end - - class InjectIntoFile < EmptyDirectory #:nodoc: - attr_reader :replacement, :flag, :behavior - - def initialize(base, destination, data, config) - super(base, destination, { :verbose => true }.merge(config)) - - @behavior, @flag = if @config.key?(:after) - [:after, @config.delete(:after)] - else - [:before, @config.delete(:before)] - end - - @replacement = data.is_a?(Proc) ? data.call : data - @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp) - end - - def invoke! - say_status :invoke - - content = if @behavior == :after - '\0' + replacement - else - replacement + '\0' - end - - replace!(/#{flag}/, content) - end - - def revoke! - say_status :revoke - - regexp = if @behavior == :after - content = '\1\2' - /(#{flag})(.*)(#{Regexp.escape(replacement)})/m - else - content = '\2\3' - /(#{Regexp.escape(replacement)})(.*)(#{flag})/m - end - - replace!(regexp, content) - end - - protected - - def say_status(behavior) - status = if flag == /\A/ - behavior == :invoke ? :prepend : :unprepend - elsif flag == /\z/ - behavior == :invoke ? :append : :unappend - else - behavior == :invoke ? :inject : :deinject - end - - super(status, config[:verbose]) - end - - # Adds the content to the file. - # - def replace!(regexp, string) - unless base.options[:pretend] - content = File.read(destination) - content.gsub!(regexp, string) - File.open(destination, 'wb') { |file| file.write(content) } - end - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/base.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/base.rb deleted file mode 100644 index 700d794123..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/base.rb +++ /dev/null @@ -1,517 +0,0 @@ -require 'thor/core_ext/hash_with_indifferent_access' -require 'thor/core_ext/ordered_hash' -require 'thor/error' -require 'thor/shell' -require 'thor/invocation' -require 'thor/parser' -require 'thor/task' -require 'thor/util' - -class Thor - # Shortcuts for help. - HELP_MAPPINGS = %w(-h -? --help -D) - - # Thor methods that should not be overwritten by the user. - THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root - action add_file create_file in_root inside run run_ruby_script) - - module Base - attr_accessor :options - - # It receives arguments in an Array and two hashes, one for options and - # other for configuration. - # - # Notice that it does not check if all required arguments were supplied. - # It should be done by the parser. - # - # ==== Parameters - # args:: An array of objects. The objects are applied to their - # respective accessors declared with argument. - # - # options:: An options hash that will be available as self.options. - # The hash given is converted to a hash with indifferent - # access, magic predicates (options.skip?) and then frozen. - # - # config:: Configuration for this Thor class. - # - def initialize(args=[], options={}, config={}) - Thor::Arguments.parse(self.class.arguments, args).each do |key, value| - send("#{key}=", value) - end - - parse_options = self.class.class_options - - if options.is_a?(Array) - task_options = config.delete(:task_options) # hook for start - parse_options = parse_options.merge(task_options) if task_options - array_options, hash_options = options, {} - else - array_options, hash_options = [], options - end - - options = Thor::Options.parse(parse_options, array_options) - self.options = Thor::CoreExt::HashWithIndifferentAccess.new(options).merge!(hash_options) - self.options.freeze - end - - class << self - def included(base) #:nodoc: - base.send :extend, ClassMethods - base.send :include, Invocation - base.send :include, Shell - end - - # Returns the classes that inherits from Thor or Thor::Group. - # - # ==== Returns - # Array[Class] - # - def subclasses - @subclasses ||= [] - end - - # Returns the files where the subclasses are kept. - # - # ==== Returns - # Hash[path => Class] - # - def subclass_files - @subclass_files ||= Hash.new{ |h,k| h[k] = [] } - end - - # Whenever a class inherits from Thor or Thor::Group, we should track the - # class and the file on Thor::Base. This is the method responsable for it. - # - def register_klass_file(klass) #:nodoc: - file = caller[1].match(/(.*):\d+/)[1] - Thor::Base.subclasses << klass unless Thor::Base.subclasses.include?(klass) - - file_subclasses = Thor::Base.subclass_files[File.expand_path(file)] - file_subclasses << klass unless file_subclasses.include?(klass) - end - end - - module ClassMethods - # Adds an argument to the class and creates an attr_accessor for it. - # - # Arguments are different from options in several aspects. The first one - # is how they are parsed from the command line, arguments are retrieved - # from position: - # - # thor task NAME - # - # Instead of: - # - # thor task --name=NAME - # - # Besides, arguments are used inside your code as an accessor (self.argument), - # while options are all kept in a hash (self.options). - # - # Finally, arguments cannot have type :default or :boolean but can be - # optional (supplying :optional => :true or :required => false), although - # you cannot have a required argument after a non-required argument. If you - # try it, an error is raised. - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described below. - # - # ==== Options - # :desc - Description for the argument. - # :required - If the argument is required or not. - # :optional - If the argument is optional or not. - # :type - The type of the argument, can be :string, :hash, :array, :numeric. - # :default - Default value for this argument. It cannot be required and have default values. - # :banner - String to show on usage notes. - # - # ==== Errors - # ArgumentError:: Raised if you supply a required argument after a non required one. - # - def argument(name, options={}) - is_thor_reserved_word?(name, :argument) - no_tasks { attr_accessor name } - - required = if options.key?(:optional) - !options[:optional] - elsif options.key?(:required) - options[:required] - else - options[:default].nil? - end - - remove_argument name - - arguments.each do |argument| - next if argument.required? - raise ArgumentError, "You cannot have #{name.to_s.inspect} as required argument after " << - "the non-required argument #{argument.human_name.inspect}." - end if required - - arguments << Thor::Argument.new(name, options[:desc], required, options[:type], - options[:default], options[:banner]) - end - - # Returns this class arguments, looking up in the ancestors chain. - # - # ==== Returns - # Array[Thor::Argument] - # - def arguments - @arguments ||= from_superclass(:arguments, []) - end - - # Adds a bunch of options to the set of class options. - # - # class_options :foo => false, :bar => :required, :baz => :string - # - # If you prefer more detailed declaration, check class_option. - # - # ==== Parameters - # Hash[Symbol => Object] - # - def class_options(options=nil) - @class_options ||= from_superclass(:class_options, {}) - build_options(options, @class_options) if options - @class_options - end - - # Adds an option to the set of class options - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described below. - # - # ==== Options - # :desc - Description for the argument. - # :required - If the argument is required or not. - # :default - Default value for this argument. - # :group - The group for this options. Use by class options to output options in different levels. - # :aliases - Aliases for this option. - # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. - # :banner - String to show on usage notes. - # - def class_option(name, options={}) - build_option(name, options, class_options) - end - - # Removes a previous defined argument. If :undefine is given, undefine - # accessors as well. - # - # ==== Paremeters - # names:: Arguments to be removed - # - # ==== Examples - # - # remove_argument :foo - # remove_argument :foo, :bar, :baz, :undefine => true - # - def remove_argument(*names) - options = names.last.is_a?(Hash) ? names.pop : {} - - names.each do |name| - arguments.delete_if { |a| a.name == name.to_s } - undef_method name, "#{name}=" if options[:undefine] - end - end - - # Removes a previous defined class option. - # - # ==== Paremeters - # names:: Class options to be removed - # - # ==== Examples - # - # remove_class_option :foo - # remove_class_option :foo, :bar, :baz - # - def remove_class_option(*names) - names.each do |name| - class_options.delete(name) - end - end - - # Defines the group. This is used when thor list is invoked so you can specify - # that only tasks from a pre-defined group will be shown. Defaults to standard. - # - # ==== Parameters - # name - # - def group(name=nil) - case name - when nil - @group ||= from_superclass(:group, 'standard') - else - @group = name.to_s - end - end - - # Returns the tasks for this Thor class. - # - # ==== Returns - # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task - # objects as values. - # - def tasks - @tasks ||= Thor::CoreExt::OrderedHash.new - end - - # Returns the tasks for this Thor class and all subclasses. - # - # ==== Returns - # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task - # objects as values. - # - def all_tasks - @all_tasks ||= from_superclass(:all_tasks, Thor::CoreExt::OrderedHash.new) - @all_tasks.merge(tasks) - end - - # Removes a given task from this Thor class. This is usually done if you - # are inheriting from another class and don't want it to be available - # anymore. - # - # By default it only remove the mapping to the task. But you can supply - # :undefine => true to undefine the method from the class as well. - # - # ==== Parameters - # name:: The name of the task to be removed - # options:: You can give :undefine => true if you want tasks the method - # to be undefined from the class as well. - # - def remove_task(*names) - options = names.last.is_a?(Hash) ? names.pop : {} - - names.each do |name| - tasks.delete(name.to_s) - all_tasks.delete(name.to_s) - undef_method name if options[:undefine] - end - end - - # All methods defined inside the given block are not added as tasks. - # - # So you can do: - # - # class MyScript < Thor - # no_tasks do - # def this_is_not_a_task - # end - # end - # end - # - # You can also add the method and remove it from the task list: - # - # class MyScript < Thor - # def this_is_not_a_task - # end - # remove_task :this_is_not_a_task - # end - # - def no_tasks - @no_tasks = true - yield - @no_tasks = false - end - - # Sets the namespace for the Thor or Thor::Group class. By default the - # namespace is retrieved from the class name. If your Thor class is named - # Scripts::MyScript, the help method, for example, will be called as: - # - # thor scripts:my_script -h - # - # If you change the namespace: - # - # namespace :my_scripts - # - # You change how your tasks are invoked: - # - # thor my_scripts -h - # - # Finally, if you change your namespace to default: - # - # namespace :default - # - # Your tasks can be invoked with a shortcut. Instead of: - # - # thor :my_task - # - def namespace(name=nil) - case name - when nil - @namespace ||= Thor::Util.namespace_from_thor_class(self, false) - else - @namespace = name.to_s - end - end - - # Default way to start generators from the command line. - # - def start(given_args=ARGV, config={}) - config[:shell] ||= Thor::Base.shell.new - yield - rescue Thor::Error => e - if given_args.include?("--debug") - raise e - else - config[:shell].error e.message - end - exit(1) if exit_on_failure? - end - - protected - - # Prints the class options per group. If an option does not belong to - # any group, it uses the ungrouped name value. This method provide to - # hooks to add extra options, one of them if the third argument called - # extra_group that should be a hash in the format :group => Array[Options]. - # - # The second is by returning a lambda used to print values. The lambda - # requires two options: the group name and the array of options. - # - def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: - groups = {} - - class_options.each do |_, value| - groups[value.group] ||= [] - groups[value.group] << value - end - - printer = proc do |group_name, options| - list = [] - padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 - - options.each do |option| - item = [ option.usage(padding) ] - item.push(option.description ? "# #{option.description}" : "") - - list << item - list << [ "", "# Default: #{option.default}" ] if option.show_default? - end - - unless list.empty? - shell.say(group_name ? "#{group_name} options:" : "Options:") - shell.print_table(list, :ident => 2) - shell.say "" - end - end - - # Deal with default group - global_options = groups.delete(nil) || [] - printer.call(ungrouped_name, global_options) if global_options - - # Print all others - groups = extra_group.merge(groups) if extra_group - groups.each(&printer) - printer - end - - # Raises an error if the word given is a Thor reserved word. - # - def is_thor_reserved_word?(word, type) #:nodoc: - return false unless THOR_RESERVED_WORDS.include?(word.to_s) - raise "#{word.inspect} is a Thor reserved word and cannot be defined as #{type}" - end - - # Build an option and adds it to the given scope. - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described in both class_option and method_option. - # - def build_option(name, options, scope) #:nodoc: - scope[name] = Thor::Option.new(name, options[:desc], options[:required], - options[:type], options[:default], options[:banner], - options[:group], options[:aliases]) - end - - # Receives a hash of options, parse them and add to the scope. This is a - # fast way to set a bunch of options: - # - # build_options :foo => true, :bar => :required, :baz => :string - # - # ==== Parameters - # Hash[Symbol => Object] - # - def build_options(options, scope) #:nodoc: - options.each do |key, value| - scope[key] = Thor::Option.parse(key, value) - end - end - - # Finds a task with the given name. If the task belongs to the current - # class, just return it, otherwise dup it and add the fresh copy to the - # current task hash. - # - def find_and_refresh_task(name) #:nodoc: - task = if task = tasks[name.to_s] - task - elsif task = all_tasks[name.to_s] - tasks[name.to_s] = task.clone - else - raise ArgumentError, "You supplied :for => #{name.inspect}, but the task #{name.inspect} could not be found." - end - end - - # Everytime someone inherits from a Thor class, register the klass - # and file into baseclass. - # - def inherited(klass) - Thor::Base.register_klass_file(klass) - end - - # Fire this callback whenever a method is added. Added methods are - # tracked as tasks by invoking the create_task method. - # - def method_added(meth) - meth = meth.to_s - - if meth == "initialize" - initialize_added - return - end - - # Return if it's not a public instance method - return unless public_instance_methods.include?(meth) || - public_instance_methods.include?(meth.to_sym) - - return if @no_tasks || !create_task(meth) - - is_thor_reserved_word?(meth, :task) - Thor::Base.register_klass_file(self) - end - - # Retrieves a value from superclass. If it reaches the baseclass, - # returns default. - # - def from_superclass(method, default=nil) - if self == baseclass || !superclass.respond_to?(method, true) - default - else - value = superclass.send(method) - value.dup if value - end - end - - # A flag that makes the process exit with status 1 if any error happens. - # - def exit_on_failure? - false - end - - # SIGNATURE: Sets the baseclass. This is where the superclass lookup - # finishes. - def baseclass #:nodoc: - end - - # SIGNATURE: Creates a new task if valid_task? is true. This method is - # called when a new method is added to the class. - def create_task(meth) #:nodoc: - end - - # SIGNATURE: Defines behavior when the initialize method is added to the - # class. - def initialize_added #:nodoc: - end - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb deleted file mode 100644 index 78bc5cf4bf..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/hash_with_indifferent_access.rb +++ /dev/null @@ -1,75 +0,0 @@ -class Thor - module CoreExt #:nodoc: - - # A hash with indifferent access and magic predicates. - # - # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true - # - # hash[:foo] #=> 'bar' - # hash['foo'] #=> 'bar' - # hash.foo? #=> true - # - class HashWithIndifferentAccess < ::Hash #:nodoc: - - def initialize(hash={}) - super() - hash.each do |key, value| - self[convert_key(key)] = value - end - end - - def [](key) - super(convert_key(key)) - end - - def []=(key, value) - super(convert_key(key), value) - end - - def delete(key) - super(convert_key(key)) - end - - def values_at(*indices) - indices.collect { |key| self[convert_key(key)] } - end - - def merge(other) - dup.merge!(other) - end - - def merge!(other) - other.each do |key, value| - self[convert_key(key)] = value - end - self - end - - protected - - def convert_key(key) - key.is_a?(Symbol) ? key.to_s : key - end - - # Magic predicates. For instance: - # - # options.force? # => !!options['force'] - # options.shebang # => "/usr/lib/local/ruby" - # options.test_framework?(:rspec) # => options[:test_framework] == :rspec - # - def method_missing(method, *args, &block) - method = method.to_s - if method =~ /^(\w+)\?$/ - if args.empty? - !!self[$1] - else - self[$1] == args.first - end - else - self[method] - end - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb deleted file mode 100644 index 27fea5bb35..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/core_ext/ordered_hash.rb +++ /dev/null @@ -1,100 +0,0 @@ -class Thor - module CoreExt #:nodoc: - - if RUBY_VERSION >= '1.9' - class OrderedHash < ::Hash - end - else - # This class is based on the Ruby 1.9 ordered hashes. - # - # It keeps the semantics and most of the efficiency of normal hashes - # while also keeping track of the order in which elements were set. - # - class OrderedHash #:nodoc: - include Enumerable - - Node = Struct.new(:key, :value, :next, :prev) - - def initialize - @hash = {} - end - - def [](key) - @hash[key] && @hash[key].value - end - - def []=(key, value) - if node = @hash[key] - node.value = value - else - node = Node.new(key, value) - - if @first.nil? - @first = @last = node - else - node.prev = @last - @last.next = node - @last = node - end - end - - @hash[key] = node - value - end - - def delete(key) - if node = @hash[key] - prev_node = node.prev - next_node = node.next - - next_node.prev = prev_node if next_node - prev_node.next = next_node if prev_node - - @first = next_node if @first == node - @last = prev_node if @last == node - - value = node.value - end - - @hash.delete(key) - value - end - - def keys - self.map { |k, v| k } - end - - def values - self.map { |k, v| v } - end - - def each - return unless @first - yield [@first.key, @first.value] - node = @first - yield [node.key, node.value] while node = node.next - self - end - - def merge(other) - hash = self.class.new - - self.each do |key, value| - hash[key] = value - end - - other.each do |key, value| - hash[key] = value - end - - hash - end - - def empty? - @hash.empty? - end - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/error.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/error.rb deleted file mode 100644 index f9b31a35d1..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/error.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Thor - # Thor::Error is raised when it's caused by wrong usage of thor classes. Those - # errors have their backtrace supressed and are nicely shown to the user. - # - # Errors that are caused by the developer, like declaring a method which - # overwrites a thor keyword, it SHOULD NOT raise a Thor::Error. This way, we - # ensure that developer errors are shown with full backtrace. - # - class Error < StandardError - end - - # Raised when a task was not found. - # - class UndefinedTaskError < Error - end - - # Raised when a task was found, but not invoked properly. - # - class InvocationError < Error - end - - class RequiredArgumentMissingError < InvocationError - end - - class MalformattedArgumentError < InvocationError - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/group.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/group.rb deleted file mode 100644 index 1e59df2313..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/group.rb +++ /dev/null @@ -1,263 +0,0 @@ -# Thor has a special class called Thor::Group. The main difference to Thor class -# is that it invokes all tasks at once. It also include some methods that allows -# invocations to be done at the class method, which are not available to Thor -# tasks. -# -class Thor::Group - class << self - # The descrition for this Thor::Group. If none is provided, but a source root - # exists, tries to find the USAGE one folder above it, otherwise searches - # in the superclass. - # - # ==== Parameters - # description:: The description for this Thor::Group. - # - def desc(description=nil) - case description - when nil - @desc ||= from_superclass(:desc, nil) - else - @desc = description - end - end - - # Start works differently in Thor::Group, it simply invokes all tasks - # inside the class. - # - def start(given_args=ARGV, config={}) - super do - if Thor::HELP_MAPPINGS.include?(given_args.first) - help(config[:shell]) - return - end - - args, opts = Thor::Options.split(given_args) - new(args, opts, config).invoke - end - end - - # Prints help information. - # - # ==== Options - # short:: When true, shows only usage. - # - def help(shell, options={}) - if options[:short] - shell.say banner - else - shell.say "Usage:" - shell.say " #{banner}" - shell.say - class_options_help(shell) - shell.say self.desc if self.desc - end - end - - # Stores invocations for this class merging with superclass values. - # - def invocations #:nodoc: - @invocations ||= from_superclass(:invocations, {}) - end - - # Stores invocation blocks used on invoke_from_option. - # - def invocation_blocks #:nodoc: - @invocation_blocks ||= from_superclass(:invocation_blocks, {}) - end - - # Invoke the given namespace or class given. It adds an instance - # method that will invoke the klass and task. You can give a block to - # configure how it will be invoked. - # - # The namespace/class given will have its options showed on the help - # usage. Check invoke_from_option for more information. - # - def invoke(*names, &block) - options = names.last.is_a?(Hash) ? names.pop : {} - verbose = options.fetch(:verbose, :white) - - names.each do |name| - invocations[name] = false - invocation_blocks[name] = block if block_given? - - class_eval <<-METHOD, __FILE__, __LINE__ - def _invoke_#{name.to_s.gsub(/\W/, '_')} - klass, task = self.class.prepare_for_invocation(nil, #{name.inspect}) - - if klass - say_status :invoke, #{name.inspect}, #{verbose.inspect} - block = self.class.invocation_blocks[#{name.inspect}] - _invoke_for_class_method klass, task, &block - else - say_status :error, %(#{name.inspect} [not found]), :red - end - end - METHOD - end - end - - # Invoke a thor class based on the value supplied by the user to the - # given option named "name". A class option must be created before this - # method is invoked for each name given. - # - # ==== Examples - # - # class GemGenerator < Thor::Group - # class_option :test_framework, :type => :string - # invoke_from_option :test_framework - # end - # - # ==== Boolean options - # - # In some cases, you want to invoke a thor class if some option is true or - # false. This is automatically handled by invoke_from_option. Then the - # option name is used to invoke the generator. - # - # ==== Preparing for invocation - # - # In some cases you want to customize how a specified hook is going to be - # invoked. You can do that by overwriting the class method - # prepare_for_invocation. The class method must necessarily return a klass - # and an optional task. - # - # ==== Custom invocations - # - # You can also supply a block to customize how the option is giong to be - # invoked. The block receives two parameters, an instance of the current - # class and the klass to be invoked. - # - def invoke_from_option(*names, &block) - options = names.last.is_a?(Hash) ? names.pop : {} - verbose = options.fetch(:verbose, :white) - - names.each do |name| - unless class_options.key?(name) - raise ArgumentError, "You have to define the option #{name.inspect} " << - "before setting invoke_from_option." - end - - invocations[name] = true - invocation_blocks[name] = block if block_given? - - class_eval <<-METHOD, __FILE__, __LINE__ - def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')} - return unless options[#{name.inspect}] - - value = options[#{name.inspect}] - value = #{name.inspect} if TrueClass === value - klass, task = self.class.prepare_for_invocation(#{name.inspect}, value) - - if klass - say_status :invoke, value, #{verbose.inspect} - block = self.class.invocation_blocks[#{name.inspect}] - _invoke_for_class_method klass, task, &block - else - say_status :error, %(\#{value} [not found]), :red - end - end - METHOD - end - end - - # Remove a previously added invocation. - # - # ==== Examples - # - # remove_invocation :test_framework - # - def remove_invocation(*names) - names.each do |name| - remove_task(name) - remove_class_option(name) - invocations.delete(name) - invocation_blocks.delete(name) - end - end - - # Overwrite class options help to allow invoked generators options to be - # shown recursively when invoking a generator. - # - def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: - group_options = {} - - get_options_from_invocations(group_options, class_options) do |klass| - klass.send(:get_options_from_invocations, group_options, class_options) - end - - group_options.merge!(extra_group) if extra_group - super(shell, ungrouped_name, group_options) - end - - # Get invocations array and merge options from invocations. Those - # options are added to group_options hash. Options that already exists - # in base_options are not added twice. - # - def get_options_from_invocations(group_options, base_options) #:nodoc: - invocations.each do |name, from_option| - value = if from_option - option = class_options[name] - option.type == :boolean ? name : option.default - else - name - end - next unless value - - klass, task = prepare_for_invocation(name, value) - next unless klass && klass.respond_to?(:class_options) - - value = value.to_s - human_name = value.respond_to?(:classify) ? value.classify : value - - group_options[human_name] ||= [] - group_options[human_name] += klass.class_options.values.select do |option| - base_options[option.name.to_sym].nil? && option.group.nil? && - !group_options.values.flatten.any? { |i| i.name == option.name } - end - - yield klass if block_given? - end - end - - protected - - # The banner for this class. You can customize it if you are invoking the - # thor class by another ways which is not the Thor::Runner. - # - def banner - "#{self.namespace} #{self.arguments.map {|a| a.usage }.join(' ')}" - end - - def baseclass #:nodoc: - Thor::Group - end - - def create_task(meth) #:nodoc: - tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) - true - end - end - - include Thor::Base - - protected - - # Shortcut to invoke with padding and block handling. Use internally by - # invoke and invoke_from_option class methods. - # - def _invoke_for_class_method(klass, task=nil, *args, &block) #:nodoc: - shell.padding += 1 - - result = if block_given? - if block.arity == 2 - block.call(self, klass) - else - block.call(self, klass, task) - end - else - invoke klass, task, *args - end - - shell.padding -= 1 - result - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/invocation.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/invocation.rb deleted file mode 100644 index 32e6a72454..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/invocation.rb +++ /dev/null @@ -1,178 +0,0 @@ -class Thor - module Invocation - def self.included(base) #:nodoc: - base.extend ClassMethods - end - - module ClassMethods - # Prepare for class methods invocations. This method must return a klass to - # have the invoked class options showed in help messages in generators. - # - def prepare_for_invocation(key, name) #:nodoc: - case name - when Symbol, String - Thor::Util.namespace_to_thor_class_and_task(name.to_s, false) - else - name - end - end - end - - # Make initializer aware of invocations and the initializer proc. - # - def initialize(args=[], options={}, config={}, &block) #:nodoc: - @_invocations = config[:invocations] || Hash.new { |h,k| h[k] = [] } - @_initializer = [ args, options, config ] - super - end - - # Receives a name and invokes it. The name can be a string (either "task" or - # "namespace:task"), a Thor::Task, a Class or a Thor instance. If the task - # cannot be guessed by name, it can also be supplied as second argument. - # - # You can also supply the arguments, options and configuration values for - # the task to be invoked, if none is given, the same values used to - # initialize the invoker are used to initialize the invoked. - # - # ==== Examples - # - # class A < Thor - # def foo - # invoke :bar - # invoke "b:hello", ["José"] - # end - # - # def bar - # invoke "b:hello", ["José"] - # end - # end - # - # class B < Thor - # def hello(name) - # puts "hello #{name}" - # end - # end - # - # You can notice that the method "foo" above invokes two tasks: "bar", - # which belongs to the same class and "hello" which belongs to the class B. - # - # By using an invocation system you ensure that a task is invoked only once. - # In the example above, invoking "foo" will invoke "b:hello" just once, even - # if it's invoked later by "bar" method. - # - # When class A invokes class B, all arguments used on A initialization are - # supplied to B. This allows lazy parse of options. Let's suppose you have - # some rspec tasks: - # - # class Rspec < Thor::Group - # class_option :mock_framework, :type => :string, :default => :rr - # - # def invoke_mock_framework - # invoke "rspec:#{options[:mock_framework]}" - # end - # end - # - # As you noticed, it invokes the given mock framework, which might have its - # own options: - # - # class Rspec::RR < Thor::Group - # class_option :style, :type => :string, :default => :mock - # end - # - # Since it's not rspec concern to parse mock framework options, when RR - # is invoked all options are parsed again, so RR can extract only the options - # that it's going to use. - # - # If you want Rspec::RR to be initialized with its own set of options, you - # have to do that explicitely: - # - # invoke "rspec:rr", [], :style => :foo - # - # Besides giving an instance, you can also give a class to invoke: - # - # invoke Rspec::RR, [], :style => :foo - # - def invoke(name=nil, task=nil, args=nil, opts=nil, config=nil) - task, args, opts, config = nil, task, args, opts if task.nil? || task.is_a?(Array) - args, opts, config = nil, args, opts if args.is_a?(Hash) - - object, task = _prepare_for_invocation(name, task) - klass, instance = _initialize_klass_with_initializer(object, args, opts, config) - - method_args = [] - current = @_invocations[klass] - - iterator = proc do |_, task| - unless current.include?(task.name) - current << task.name - task.run(instance, method_args) - end - end - - if task - args ||= [] - method_args = args[Range.new(klass.arguments.size, -1)] || [] - iterator.call(nil, task) - else - klass.all_tasks.map(&iterator) - end - end - - protected - - # Configuration values that are shared between invocations. - # - def _shared_configuration #:nodoc: - { :invocations => @_invocations } - end - - # Prepare for invocation in the instance level. In this case, we have to - # take into account that a just a task name from the current class was - # given or even a Thor::Task object. - # - def _prepare_for_invocation(name, sent_task=nil) #:nodoc: - if name.is_a?(Thor::Task) - task = name - elsif task = self.class.all_tasks[name.to_s] - object = self - else - object, task = self.class.prepare_for_invocation(nil, name) - task ||= sent_task - end - - # If the object was not set, use self and use the name as task. - object, task = self, name unless object - return object, _validate_task(object, task) - end - - # Check if the object given is a Thor class object and get a task object - # for it. - # - def _validate_task(object, task) #:nodoc: - klass = object.is_a?(Class) ? object : object.class - raise "Expected Thor class, got #{klass}" unless klass <= Thor::Base - - task ||= klass.default_task if klass <= Thor - task = klass.all_tasks[task.to_s] || Thor::Task::Dynamic.new(task) if task && !task.is_a?(Thor::Task) - task - end - - # Initialize klass using values stored in the @_initializer. - # - def _initialize_klass_with_initializer(object, args, opts, config) #:nodoc: - if object.is_a?(Class) - klass = object - - stored_args, stored_opts, stored_config = @_initializer - args ||= stored_args.dup - opts ||= stored_opts.dup - - config ||= {} - config = stored_config.merge(_shared_configuration).merge!(config) - [ klass, klass.new(args, opts, config) ] - else - [ object.class, object ] - end - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser.rb deleted file mode 100644 index 57a3f6e1a5..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'thor/parser/argument' -require 'thor/parser/arguments' -require 'thor/parser/option' -require 'thor/parser/options' diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/argument.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/argument.rb deleted file mode 100644 index aa8ace4719..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/argument.rb +++ /dev/null @@ -1,67 +0,0 @@ -class Thor - class Argument #:nodoc: - VALID_TYPES = [ :numeric, :hash, :array, :string ] - - attr_reader :name, :description, :required, :type, :default, :banner - alias :human_name :name - - def initialize(name, description=nil, required=true, type=:string, default=nil, banner=nil) - class_name = self.class.name.split("::").last - - raise ArgumentError, "#{class_name} name can't be nil." if name.nil? - raise ArgumentError, "Type :#{type} is not valid for #{class_name.downcase}s." if type && !valid_type?(type) - - @name = name.to_s - @description = description - @required = required || false - @type = (type || :string).to_sym - @default = default - @banner = banner || default_banner - - validate! # Trigger specific validations - end - - def usage - required? ? banner : "[#{banner}]" - end - - def required? - required - end - - def show_default? - case default - when Array, String, Hash - !default.empty? - else - default - end - end - - protected - - def validate! - raise ArgumentError, "An argument cannot be required and have default value." if required? && !default.nil? - end - - def valid_type?(type) - VALID_TYPES.include?(type.to_sym) - end - - def default_banner - case type - when :boolean - nil - when :string, :default - human_name.upcase - when :numeric - "N" - when :hash - "key:value" - when :array - "one two three" - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/arguments.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/arguments.rb deleted file mode 100644 index fb5d965e06..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/arguments.rb +++ /dev/null @@ -1,145 +0,0 @@ -class Thor - class Arguments #:nodoc: - NUMERIC = /(\d*\.\d+|\d+)/ - - # Receives an array of args and returns two arrays, one with arguments - # and one with switches. - # - def self.split(args) - arguments = [] - - args.each do |item| - break if item =~ /^-/ - arguments << item - end - - return arguments, args[Range.new(arguments.size, -1)] - end - - def self.parse(base, args) - new(base).parse(args) - end - - # Takes an array of Thor::Argument objects. - # - def initialize(arguments=[]) - @assigns, @non_assigned_required = {}, [] - @switches = arguments - - arguments.each do |argument| - if argument.default - @assigns[argument.human_name] = argument.default - elsif argument.required? - @non_assigned_required << argument - end - end - end - - def parse(args) - @pile = args.dup - - @switches.each do |argument| - break unless peek - @non_assigned_required.delete(argument) - @assigns[argument.human_name] = send(:"parse_#{argument.type}", argument.human_name) - end - - check_requirement! - @assigns - end - - private - - def peek - @pile.first - end - - def shift - @pile.shift - end - - def unshift(arg) - unless arg.kind_of?(Array) - @pile.unshift(arg) - else - @pile = arg + @pile - end - end - - def current_is_value? - peek && peek.to_s !~ /^-/ - end - - # Runs through the argument array getting strings that contains ":" and - # mark it as a hash: - # - # [ "name:string", "age:integer" ] - # - # Becomes: - # - # { "name" => "string", "age" => "integer" } - # - def parse_hash(name) - return shift if peek.is_a?(Hash) - hash = {} - - while current_is_value? && peek.include?(?:) - key, value = shift.split(':') - hash[key] = value - end - hash - end - - # Runs through the argument array getting all strings until no string is - # found or a switch is found. - # - # ["a", "b", "c"] - # - # And returns it as an array: - # - # ["a", "b", "c"] - # - def parse_array(name) - return shift if peek.is_a?(Array) - array = [] - - while current_is_value? - array << shift - end - array - end - - # Check if the peel is numeric ofrmat and return a Float or Integer. - # Otherwise raises an error. - # - def parse_numeric(name) - return shift if peek.is_a?(Numeric) - - unless peek =~ NUMERIC && $& == peek - raise MalformattedArgumentError, "expected numeric value for '#{name}'; got #{peek.inspect}" - end - - $&.index('.') ? shift.to_f : shift.to_i - end - - # Parse string, i.e., just return the current value in the pile. - # - def parse_string(name) - shift - end - - # Raises an error if @non_assigned_required array is not empty. - # - def check_requirement! - unless @non_assigned_required.empty? - names = @non_assigned_required.map do |o| - o.respond_to?(:switch_name) ? o.switch_name : o.human_name - end.join("', '") - - class_name = self.class.name.split('::').last.downcase - raise RequiredArgumentMissingError, "no value provided for required #{class_name} '#{names}'" - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/option.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/option.rb deleted file mode 100644 index 9e40ec73fa..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/option.rb +++ /dev/null @@ -1,132 +0,0 @@ -class Thor - class Option < Argument #:nodoc: - attr_reader :aliases, :group - - VALID_TYPES = [:boolean, :numeric, :hash, :array, :string] - - def initialize(name, description=nil, required=nil, type=nil, default=nil, banner=nil, group=nil, aliases=nil) - super(name, description, required, type, default, banner) - @aliases = [*aliases].compact - @group = group.to_s.capitalize if group - end - - # This parse quick options given as method_options. It makes several - # assumptions, but you can be more specific using the option method. - # - # parse :foo => "bar" - # #=> Option foo with default value bar - # - # parse [:foo, :baz] => "bar" - # #=> Option foo with default value bar and alias :baz - # - # parse :foo => :required - # #=> Required option foo without default value - # - # parse :foo => 2 - # #=> Option foo with default value 2 and type numeric - # - # parse :foo => :numeric - # #=> Option foo without default value and type numeric - # - # parse :foo => true - # #=> Option foo with default value true and type boolean - # - # The valid types are :boolean, :numeric, :hash, :array and :string. If none - # is given a default type is assumed. This default type accepts arguments as - # string (--foo=value) or booleans (just --foo). - # - # By default all options are optional, unless :required is given. - # - def self.parse(key, value) - if key.is_a?(Array) - name, *aliases = key - else - name, aliases = key, [] - end - - name = name.to_s - default = value - - type = case value - when Symbol - default = nil - - if VALID_TYPES.include?(value) - value - elsif required = (value == :required) - :string - elsif value == :optional - # TODO Remove this warning in the future. - warn "Optional type is deprecated. Choose :boolean or :string instead. Assumed to be :boolean." - :boolean - end - when TrueClass, FalseClass - :boolean - when Numeric - :numeric - when Hash, Array, String - value.class.name.downcase.to_sym - end - - self.new(name.to_s, nil, required, type, default, nil, nil, aliases) - end - - def switch_name - @switch_name ||= dasherized? ? name : dasherize(name) - end - - def human_name - @human_name ||= dasherized? ? undasherize(name) : name - end - - def usage(padding=0) - sample = if banner && !banner.to_s.empty? - "#{switch_name}=#{banner}" - else - switch_name - end - - sample = "[#{sample}]" unless required? - - if aliases.empty? - (" " * padding) << sample - else - "#{aliases.join(', ')}, #{sample}" - end - end - - # Allow some type predicates as: boolean?, string? and etc. - # - def method_missing(method, *args, &block) - given = method.to_s.sub(/\?$/, '').to_sym - if valid_type?(given) - self.type == given - else - super - end - end - - protected - - def validate! - raise ArgumentError, "An option cannot be boolean and required." if boolean? && required? - end - - def valid_type?(type) - VALID_TYPES.include?(type.to_sym) - end - - def dasherized? - name.index('-') == 0 - end - - def undasherize(str) - str.sub(/^-{1,2}/, '') - end - - def dasherize(str) - (str.length > 1 ? "--" : "-") + str.gsub('_', '-') - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/options.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/options.rb deleted file mode 100644 index 75092308b5..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/parser/options.rb +++ /dev/null @@ -1,142 +0,0 @@ -class Thor - # This is a modified version of Daniel Berger's Getopt::Long class, licensed - # under Ruby's license. - # - class Options < Arguments #:nodoc: - LONG_RE = /^(--\w+[-\w+]*)$/ - SHORT_RE = /^(-[a-z])$/i - EQ_RE = /^(--\w+[-\w+]*|-[a-z])=(.*)$/i - SHORT_SQ_RE = /^-([a-z]{2,})$/i # Allow either -x -v or -xv style for single char args - SHORT_NUM = /^(-[a-z])#{NUMERIC}$/i - - # Receives a hash and makes it switches. - # - def self.to_switches(options) - options.map do |key, value| - case value - when true - "--#{key}" - when Array - "--#{key} #{value.map{ |v| v.inspect }.join(' ')}" - when Hash - "--#{key} #{value.map{ |k,v| "#{k}:#{v}" }.join(' ')}" - when nil, false - "" - else - "--#{key} #{value.inspect}" - end - end.join(" ") - end - - # Takes a hash of Thor::Option objects. - # - def initialize(options={}) - options = options.values - super(options) - @shorts, @switches = {}, {} - - options.each do |option| - @switches[option.switch_name] = option - - option.aliases.each do |short| - @shorts[short.to_s] ||= option.switch_name - end - end - end - - def parse(args) - @pile = args.dup - - while peek - if current_is_switch? - case shift - when SHORT_SQ_RE - unshift($1.split('').map { |f| "-#{f}" }) - next - when EQ_RE, SHORT_NUM - unshift($2) - switch = $1 - when LONG_RE, SHORT_RE - switch = $1 - end - - switch = normalize_switch(switch) - next unless option = switch_option(switch) - - @assigns[option.human_name] = parse_peek(switch, option) - else - shift - end - end - - check_requirement! - @assigns - end - - protected - - # Returns true if the current value in peek is a registered switch. - # - def current_is_switch? - case peek - when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM - switch?($1) - when SHORT_SQ_RE - $1.split('').any? { |f| switch?("-#{f}") } - end - end - - def switch?(arg) - switch_option(arg) || @shorts.key?(arg) - end - - def switch_option(arg) - if match = no_or_skip?(arg) - @switches[arg] || @switches["--#{match}"] - else - @switches[arg] - end - end - - def no_or_skip?(arg) - arg =~ /^--(no|skip)-([-\w]+)$/ - $2 - end - - # Check if the given argument is actually a shortcut. - # - def normalize_switch(arg) - @shorts.key?(arg) ? @shorts[arg] : arg - end - - # Parse boolean values which can be given as --foo=true, --foo or --no-foo. - # - def parse_boolean(switch) - if current_is_value? - ["true", "TRUE", "t", "T", true].include?(shift) - else - @switches.key?(switch) || !no_or_skip?(switch) - end - end - - # Parse the value at the peek analyzing if it requires an input or not. - # - def parse_peek(switch, option) - unless current_is_value? - if option.boolean? - # No problem for boolean types - elsif no_or_skip?(switch) - return nil # User set value to nil - elsif option.string? && !option.required? - return option.human_name # Return the option name - else - raise MalformattedArgumentError, "no value provided for option '#{switch}'" - end - end - - @non_assigned_required.delete(option) - send(:"parse_#{option.type}", switch) - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/rake_compat.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/rake_compat.rb deleted file mode 100644 index 3ab6bb21f5..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/rake_compat.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'rake' - -class Thor - # Adds a compatibility layer to your Thor classes which allows you to use - # rake package tasks. For example, to use rspec rake tasks, one can do: - # - # require 'thor/rake_compat' - # - # class Default < Thor - # include Thor::RakeCompat - # - # Spec::Rake::SpecTask.new(:spec) do |t| - # t.spec_opts = ['--options', "spec/spec.opts"] - # t.spec_files = FileList['spec/**/*_spec.rb'] - # end - # end - # - module RakeCompat - def self.rake_classes - @rake_classes ||= [] - end - - def self.included(base) - # Hack. Make rakefile point to invoker, so rdoc task is generated properly. - Rake.application.instance_variable_set(:@rakefile, caller[0].match(/(.*):\d+/)[1]) - self.rake_classes << base - end - end -end - -class Object #:nodoc: - alias :rake_task :task - alias :rake_namespace :namespace - - def task(*args, &block) - task = rake_task(*args, &block) - - if klass = Thor::RakeCompat.rake_classes.last - non_namespaced_name = task.name.split(':').last - - description = non_namespaced_name - description << task.arg_names.map{ |n| n.to_s.upcase }.join(' ') - description.strip! - - klass.desc description, task.comment || non_namespaced_name - klass.class_eval <<-METHOD - def #{non_namespaced_name}(#{task.arg_names.join(', ')}) - Rake::Task[#{task.name.to_sym.inspect}].invoke(#{task.arg_names.join(', ')}) - end - METHOD - end - - task - end - - def namespace(name, &block) - if klass = Thor::RakeCompat.rake_classes.last - const_name = Thor::Util.camel_case(name.to_s).to_sym - klass.const_set(const_name, Class.new(Thor)) - new_klass = klass.const_get(const_name) - Thor::RakeCompat.rake_classes << new_klass - end - - rake_namespace(name, &block) - Thor::RakeCompat.rake_classes.pop - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/runner.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/runner.rb deleted file mode 100644 index 43da09b336..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/runner.rb +++ /dev/null @@ -1,299 +0,0 @@ -require 'fileutils' -require 'open-uri' -require 'yaml' -require 'digest/md5' -require 'pathname' - -class Thor::Runner < Thor #:nodoc: - map "-T" => :list, "-i" => :install, "-u" => :update - - # Override Thor#help so it can give information about any class and any method. - # - def help(meth=nil) - if meth && !self.respond_to?(meth) - initialize_thorfiles(meth) - klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) - # Send mapping -h because it works with Thor::Group too - klass.start(["-h", task].compact, :shell => self.shell) - else - super - end - end - - # If a task is not found on Thor::Runner, method missing is invoked and - # Thor::Runner is then responsable for finding the task in all classes. - # - def method_missing(meth, *args) - meth = meth.to_s - initialize_thorfiles(meth) - klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) - args.unshift(task) if task - klass.start(args, :shell => shell) - end - - desc "install NAME", "Install an optionally named Thor file into your system tasks" - method_options :as => :string, :relative => :boolean - def install(name) - initialize_thorfiles - - # If a directory name is provided as the argument, look for a 'main.thor' - # task in said directory. - begin - if File.directory?(File.expand_path(name)) - base, package = File.join(name, "main.thor"), :directory - contents = open(base).read - else - base, package = name, :file - contents = open(name).read - end - rescue OpenURI::HTTPError - raise Error, "Error opening URI '#{name}'" - rescue Errno::ENOENT - raise Error, "Error opening file '#{name}'" - end - - say "Your Thorfile contains:" - say contents - - return false if no?("Do you wish to continue [y/N]?") - - as = options["as"] || begin - first_line = contents.split("\n")[0] - (match = first_line.match(/\s*#\s*module:\s*([^\n]*)/)) ? match[1].strip : nil - end - - unless as - basename = File.basename(name) - as = ask("Please specify a name for #{name} in the system repository [#{basename}]:") - as = basename if as.empty? - end - - location = if options[:relative] || name =~ /^http:\/\// - name - else - File.expand_path(name) - end - - thor_yaml[as] = { - :filename => Digest::MD5.hexdigest(name + as), - :location => location, - :namespaces => Thor::Util.namespaces_in_content(contents, base) - } - - save_yaml(thor_yaml) - say "Storing thor file in your system repository" - destination = File.join(thor_root, thor_yaml[as][:filename]) - - if package == :file - File.open(destination, "w") { |f| f.puts contents } - else - FileUtils.cp_r(name, destination) - end - - thor_yaml[as][:filename] # Indicate success - end - - desc "uninstall NAME", "Uninstall a named Thor module" - def uninstall(name) - raise Error, "Can't find module '#{name}'" unless thor_yaml[name] - say "Uninstalling #{name}." - FileUtils.rm_rf(File.join(thor_root, "#{thor_yaml[name][:filename]}")) - - thor_yaml.delete(name) - save_yaml(thor_yaml) - - puts "Done." - end - - desc "update NAME", "Update a Thor file from its original location" - def update(name) - raise Error, "Can't find module '#{name}'" if !thor_yaml[name] || !thor_yaml[name][:location] - - say "Updating '#{name}' from #{thor_yaml[name][:location]}" - - old_filename = thor_yaml[name][:filename] - self.options = self.options.merge("as" => name) - filename = install(thor_yaml[name][:location]) - - unless filename == old_filename - File.delete(File.join(thor_root, old_filename)) - end - end - - desc "installed", "List the installed Thor modules and tasks" - method_options :internal => :boolean - def installed - initialize_thorfiles(nil, true) - - klasses = Thor::Base.subclasses - klasses -= [Thor, Thor::Runner] unless options["internal"] - - display_klasses(true, klasses) - end - - desc "list [SEARCH]", "List the available thor tasks (--substring means .*SEARCH)" - method_options :substring => :boolean, :group => :string, :all => :boolean - def list(search="") - initialize_thorfiles - - search = ".*#{search}" if options["substring"] - search = /^#{search}.*/i - group = options[:group] || "standard" - - klasses = Thor::Base.subclasses.select do |k| - (options[:all] || k.group == group) && k.namespace =~ search - end - - display_klasses(false, klasses) - end - - private - - def thor_root - Thor::Util.thor_root - end - - def thor_yaml - @thor_yaml ||= begin - yaml_file = File.join(thor_root, "thor.yml") - yaml = YAML.load_file(yaml_file) if File.exists?(yaml_file) - yaml || {} - end - end - - # Save the yaml file. If none exists in thor root, creates one. - # - def save_yaml(yaml) - yaml_file = File.join(thor_root, "thor.yml") - - unless File.exists?(yaml_file) - FileUtils.mkdir_p(thor_root) - yaml_file = File.join(thor_root, "thor.yml") - FileUtils.touch(yaml_file) - end - - File.open(yaml_file, "w") { |f| f.puts yaml.to_yaml } - end - - def self.exit_on_failure? - true - end - - # Load the thorfiles. If relevant_to is supplied, looks for specific files - # in the thor_root instead of loading them all. - # - # By default, it also traverses the current path until find Thor files, as - # described in thorfiles. This look up can be skipped by suppliying - # skip_lookup true. - # - def initialize_thorfiles(relevant_to=nil, skip_lookup=false) - thorfiles(relevant_to, skip_lookup).each do |f| - Thor::Util.load_thorfile(f) unless Thor::Base.subclass_files.keys.include?(File.expand_path(f)) - end - end - - # Finds Thorfiles by traversing from your current directory down to the root - # directory of your system. If at any time we find a Thor file, we stop. - # - # We also ensure that system-wide Thorfiles are loaded first, so local - # Thorfiles can override them. - # - # ==== Example - # - # If we start at /Users/wycats/dev/thor ... - # - # 1. /Users/wycats/dev/thor - # 2. /Users/wycats/dev - # 3. /Users/wycats <-- we find a Thorfile here, so we stop - # - # Suppose we start at c:\Documents and Settings\james\dev\thor ... - # - # 1. c:\Documents and Settings\james\dev\thor - # 2. c:\Documents and Settings\james\dev - # 3. c:\Documents and Settings\james - # 4. c:\Documents and Settings - # 5. c:\ <-- no Thorfiles found! - # - def thorfiles(relevant_to=nil, skip_lookup=false) - # Deal with deprecated thor when :namespaces: is available as constants - save_yaml(thor_yaml) if Thor::Util.convert_constants_to_namespaces(thor_yaml) - - thorfiles = [] - - unless skip_lookup - Pathname.pwd.ascend do |path| - thorfiles = Thor::Util.globs_for(path).map { |g| Dir[g] }.flatten - break unless thorfiles.empty? - end - end - - files = (relevant_to ? thorfiles_relevant_to(relevant_to) : Thor::Util.thor_root_glob) - files += thorfiles - files -= ["#{thor_root}/thor.yml"] - - files.map! do |file| - File.directory?(file) ? File.join(file, "main.thor") : file - end - end - - # Load thorfiles relevant to the given method. If you provide "foo:bar" it - # will load all thor files in the thor.yaml that has "foo" e "foo:bar" - # namespaces registered. - # - def thorfiles_relevant_to(meth) - lookup = [ meth, meth.split(":")[0...-1].join(":") ] - - files = thor_yaml.select do |k, v| - v[:namespaces] && !(v[:namespaces] & lookup).empty? - end - - files.map { |k, v| File.join(thor_root, "#{v[:filename]}") } - end - - # Display information about the given klasses. If with_module is given, - # it shows a table with information extracted from the yaml file. - # - def display_klasses(with_modules=false, klasses=Thor.subclasses) - klasses -= [Thor, Thor::Runner] unless with_modules - raise Error, "No Thor tasks available" if klasses.empty? - - if with_modules && !thor_yaml.empty? - info = [] - labels = ["Modules", "Namespaces"] - - info << labels - info << [ "-" * labels[0].size, "-" * labels[1].size ] - - thor_yaml.each do |name, hash| - info << [ name, hash[:namespaces].join(", ") ] - end - - print_table info - say "" - end - - unless klasses.empty? - klasses.dup.each do |klass| - klasses -= Thor::Util.thor_classes_in(klass) - end - - klasses.each { |k| display_tasks(k) } - else - say "\033[1;34mNo Thor tasks available\033[0m" - end - end - - # Display tasks from the given Thor class. - # - def display_tasks(klass) - unless klass.tasks.empty? - base = klass.namespace - - color = base == "default" ? :magenta : :blue - say shell.set_color(base, color, true) - say "-" * base.length - - klass.help(shell, :short => true, :ident => 0, :namespace => true) - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell.rb deleted file mode 100644 index 0d3f4d5951..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell.rb +++ /dev/null @@ -1,72 +0,0 @@ -require 'thor/shell/color' - -class Thor - module Base - # Returns the shell used in all Thor classes. Default to color one. - # - def self.shell - @shell ||= Thor::Shell::Color - end - - # Sets the shell used in all Thor classes. - # - def self.shell=(klass) - @shell = klass - end - end - - module Shell - SHELL_DELEGATED_METHODS = [:ask, :yes?, :no?, :say, :say_status, :print_list, :print_table] - - # Add shell to initialize config values. - # - # ==== Configuration - # shell:: An instance of the shell to be used. - # - # ==== Examples - # - # class MyScript < Thor - # argument :first, :type => :numeric - # end - # - # MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new - # - def initialize(args=[], options={}, config={}) - super - self.shell = config[:shell] - self.shell.base ||= self if self.shell.respond_to?(:base) - end - - # Holds the shell for the given Thor instance. If no shell is given, - # it gets a default shell from Thor::Base.shell. - # - def shell - @shell ||= Thor::Base.shell.new - end - - # Sets the shell for this thor class. - # - def shell=(shell) - @shell = shell - end - - # Common methods that are delegated to the shell. - # - SHELL_DELEGATED_METHODS.each do |method| - module_eval <<-METHOD, __FILE__, __LINE__ - def #{method}(*args) - shell.#{method}(*args) - end - METHOD - end - - protected - - # Allow shell to be shared between invocations. - # - def _shared_configuration #:nodoc: - super.merge!(:shell => self.shell) - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell/basic.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell/basic.rb deleted file mode 100644 index ea9665380b..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/shell/basic.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'tempfile' - -class Thor - module Shell - class Basic - attr_accessor :base, :padding - - # Initialize base and padding to nil. - # - def initialize #:nodoc: - @base, @padding = nil, 0 - end - - # Sets the output padding, not allowing less than zero values. - # - def padding=(value) - @padding = [0, value].max - end - - # Ask something to the user and receives a response. - # - # ==== Example - # ask("What is your name?") - # - def ask(statement, color=nil) - say("#{statement} ", color) - $stdin.gets.strip - end - - # Say (print) something to the user. If the sentence ends with a whitespace - # or tab character, a new line is not appended (print + flush). Otherwise - # are passed straight to puts (behavior got from Highline). - # - # ==== Example - # say("I know you knew that.") - # - def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)$/)) - message = message.to_s - message = set_color(message, color) if color - - if force_new_line - $stdout.puts(message) - else - $stdout.print(message) - $stdout.flush - end - end - - # Say a status with the given color and appends the message. Since this - # method is used frequently by actions, it allows nil or false to be given - # in log_status, avoiding the message from being shown. If a Symbol is - # given in log_status, it's used as the color. - # - def say_status(status, message, log_status=true) - return if quiet? || log_status == false - spaces = " " * (padding + 1) - color = log_status.is_a?(Symbol) ? log_status : :green - - status = status.to_s.rjust(12) - status = set_color status, color, true if color - say "#{status}#{spaces}#{message}", nil, true - end - - # Make a question the to user and returns true if the user replies "y" or - # "yes". - # - def yes?(statement, color=nil) - ask(statement, color) =~ is?(:yes) - end - - # Make a question the to user and returns true if the user replies "n" or - # "no". - # - def no?(statement, color=nil) - !yes?(statement, color) - end - - # Prints a list of items. - # - # ==== Parameters - # list - # - # ==== Options - # mode:: Can be :rows or :inline. Defaults to :rows. - # ident:: Ident each item with the value given. - # - def print_list(list, options={}) - return if list.empty? - - ident = " " * (options[:ident] || 0) - content = case options[:mode] - when :inline - last = list.pop - "#{list.join(", ")}, and #{last}" - else # rows - ident + list.join("\n#{ident}") - end - - $stdout.puts content - end - - # Prints a table. - # - # ==== Parameters - # Array[Array[String, String, ...]] - # - # ==== Options - # ident:: Ident the first column by ident value. - # - def print_table(table, options={}) - return if table.empty? - - formats = [] - 0.upto(table.first.length - 2) do |i| - maxima = table.max{ |a,b| a[i].size <=> b[i].size }[i].size - formats << "%-#{maxima + 2}s" - end - - formats[0] = formats[0].insert(0, " " * options[:ident]) if options[:ident] - formats << "%s" - - table.each do |row| - row.each_with_index do |column, i| - $stdout.print formats[i] % column.to_s - end - $stdout.puts - end - end - - # Deals with file collision and returns true if the file should be - # overwriten and false otherwise. If a block is given, it uses the block - # response as the content for the diff. - # - # ==== Parameters - # destination:: the destination file to solve conflicts - # block:: an optional block that returns the value to be used in diff - # - def file_collision(destination) - return true if @always_force - options = block_given? ? "[Ynaqdh]" : "[Ynaqh]" - - while true - answer = ask %[Overwrite #{destination}? (enter "h" for help) #{options}] - - case answer - when is?(:yes), is?(:force) - return true - when is?(:no), is?(:skip) - return false - when is?(:always) - return @always_force = true - when is?(:quit) - say 'Aborting...' - raise SystemExit - when is?(:diff) - show_diff(destination, yield) if block_given? - say 'Retrying...' - else - say file_collision_help - end - end - end - - # Called if something goes wrong during the execution. This is used by Thor - # internally and should not be used inside your scripts. If someone went - # wrong, you can always raise an exception. If you raise a Thor::Error, it - # will be rescued and wrapped in the method below. - # - def error(statement) - $stderr.puts statement - end - - # Apply color to the given string with optional bold. Disabled in the - # Thor::Shell::Basic class. - # - def set_color(string, color, bold=false) #:nodoc: - string - end - - protected - - def is?(value) #:nodoc: - value = value.to_s - - if value.size == 1 - /\A#{value}\z/i - else - /\A(#{value}|#{value[0,1]})\z/i - end - end - - def file_collision_help #:nodoc: -< e - parse_argument_error(instance, e, caller) - rescue NoMethodError => e - parse_no_method_error(instance, e) - end - - # Returns the formatted usage. If a class is given, the class arguments are - # injected in the usage. - # - def formatted_usage(klass=nil, namespace=false, show_options=true) - formatted = if namespace.is_a?(String) - "#{namespace}:" - elsif klass && namespace - "#{klass.namespace.gsub(/^default/,'')}:" - else - "" - end - - formatted << formatted_arguments(klass) - formatted << " #{formatted_options}" if show_options - formatted.strip! - formatted - end - - # Injects the class arguments into the task usage. - # - def formatted_arguments(klass) - if klass && !klass.arguments.empty? - usage.to_s.gsub(/^#{name}/) do |match| - match << " " << klass.arguments.map{ |a| a.usage }.join(' ') - end - else - usage.to_s - end - end - - # Returns the options usage for this task. - # - def formatted_options - @formatted_options ||= options.map{ |_, o| o.usage }.sort.join(" ") - end - - protected - - # Given a target, checks if this class name is not a private/protected method. - # - def public_method?(instance) #:nodoc: - collection = instance.private_methods + instance.protected_methods - (collection & [name.to_s, name.to_sym]).empty? - end - - # Clean everything that comes from the Thor gempath and remove the caller. - # - def sans_backtrace(backtrace, caller) #:nodoc: - dirname = /^#{Regexp.escape(File.dirname(__FILE__))}/ - saned = backtrace.reject { |frame| frame =~ dirname } - saned -= caller - end - - def parse_argument_error(instance, e, caller) #:nodoc: - backtrace = sans_backtrace(e.backtrace, caller) - - if backtrace.empty? && e.message =~ /wrong number of arguments/ - if instance.is_a?(Thor::Group) - raise e, "'#{name}' was called incorrectly. Are you sure it has arity equals to 0?" - else - raise InvocationError, "'#{name}' was called incorrectly. Call as " << - "'#{formatted_usage(instance.class, true)}'" - end - else - raise e - end - end - - def parse_no_method_error(instance, e) #:nodoc: - if e.message =~ /^undefined method `#{name}' for #{Regexp.escape(instance.to_s)}$/ - raise UndefinedTaskError, "The #{instance.class.namespace} namespace " << - "doesn't have a '#{name}' task" - else - raise e - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/util.rb b/railties/lib/rails/vendor/thor-0.11.6/lib/thor/util.rb deleted file mode 100644 index fd820d7462..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.6/lib/thor/util.rb +++ /dev/null @@ -1,251 +0,0 @@ -require 'rbconfig' - -class Thor - module Sandbox #:nodoc: - end - - # This module holds several utilities: - # - # 1) Methods to convert thor namespaces to constants and vice-versa. - # - # Thor::Utils.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz" - # - # 2) Loading thor files and sandboxing: - # - # Thor::Utils.load_thorfile("~/.thor/foo") - # - module Util - - # Receives a namespace and search for it in the Thor::Base subclasses. - # - # ==== Parameters - # namespace:: The namespace to search for. - # - def self.find_by_namespace(namespace) - namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/ - - Thor::Base.subclasses.find do |klass| - klass.namespace == namespace - end - end - - # Receives a constant and converts it to a Thor namespace. Since Thor tasks - # can be added to a sandbox, this method is also responsable for removing - # the sandbox namespace. - # - # This method should not be used in general because it's used to deal with - # older versions of Thor. On current versions, if you need to get the - # namespace from a class, just call namespace on it. - # - # ==== Parameters - # constant:: The constant to be converted to the thor path. - # - # ==== Returns - # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz" - # - def self.namespace_from_thor_class(constant, remove_default=true) - constant = constant.to_s.gsub(/^Thor::Sandbox::/, "") - constant = snake_case(constant).squeeze(":") - constant.gsub!(/^default/, '') if remove_default - constant - end - - # Given the contents, evaluate it inside the sandbox and returns the - # namespaces defined in the sandbox. - # - # ==== Parameters - # contents - # - # ==== Returns - # Array[Object] - # - def self.namespaces_in_content(contents, file=__FILE__) - old_constants = Thor::Base.subclasses.dup - Thor::Base.subclasses.clear - - load_thorfile(file, contents) - - new_constants = Thor::Base.subclasses.dup - Thor::Base.subclasses.replace(old_constants) - - new_constants.map!{ |c| c.namespace } - new_constants.compact! - new_constants - end - - # Returns the thor classes declared inside the given class. - # - def self.thor_classes_in(klass) - Thor::Base.subclasses.select do |subclass| - klass.constants.include?(subclass.name.gsub("#{klass.name}::", '')) - end - end - - # Receives a string and convert it to snake case. SnakeCase returns snake_case. - # - # ==== Parameters - # String - # - # ==== Returns - # String - # - def self.snake_case(str) - return str.downcase if str =~ /^[A-Z_]+$/ - str.gsub(/\B[A-Z]/, '_\&').squeeze('_') =~ /_*(.*)/ - return $+.downcase - end - - # Receives a string and convert it to camel case. camel_case returns CamelCase. - # - # ==== Parameters - # String - # - # ==== Returns - # String - # - def self.camel_case(str) - return str if str !~ /_/ && str =~ /[A-Z]+.*/ - str.split('_').map { |i| i.capitalize }.join - end - - # Receives a namespace and tries to retrieve a Thor or Thor::Group class - # from it. It first searches for a class using the all the given namespace, - # if it's not found, removes the highest entry and searches for the class - # again. If found, returns the highest entry as the class name. - # - # ==== Examples - # - # class Foo::Bar < Thor - # def baz - # end - # end - # - # class Baz::Foo < Thor::Group - # end - # - # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default task - # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil - # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz" - # - # ==== Parameters - # namespace - # - # ==== Errors - # Thor::Error:: raised if the namespace cannot be found. - # - # Thor::Error:: raised if the namespace evals to a class which does not - # inherit from Thor or Thor::Group. - # - def self.namespace_to_thor_class_and_task(namespace, raise_if_nil=true) - if namespace.include?(?:) - pieces = namespace.split(":") - task = pieces.pop - klass = Thor::Util.find_by_namespace(pieces.join(":")) - end - - unless klass - klass, task = Thor::Util.find_by_namespace(namespace), nil - end - - raise Error, "could not find Thor class or task '#{namespace}'" if raise_if_nil && klass.nil? - return klass, task - end - - # Receives a path and load the thor file in the path. The file is evaluated - # inside the sandbox to avoid namespacing conflicts. - # - def self.load_thorfile(path, content=nil) - content ||= File.read(path) - - begin - Thor::Sandbox.class_eval(content, path) - rescue Exception => e - $stderr.puts "WARNING: unable to load thorfile #{path.inspect}: #{e.message}" - end - end - - # Receives a yaml (hash) and updates all constants entries to namespace. - # This was added to deal with deprecated versions of Thor. - # - # TODO Deprecate this method in the future. - # - # ==== Returns - # TrueClass|FalseClass:: Returns true if any change to the yaml file was made. - # - def self.convert_constants_to_namespaces(yaml) - yaml_changed = false - - yaml.each do |k, v| - next unless v[:constants] && v[:namespaces].nil? - yaml_changed = true - yaml[k][:namespaces] = v[:constants].map{|c| Thor::Util.namespace_from_thor_class(c)} - end - - yaml_changed - end - - def self.user_home - @@user_home ||= if ENV["HOME"] - ENV["HOME"] - elsif ENV["USERPROFILE"] - ENV["USERPROFILE"] - elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"] - File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]) - elsif ENV["APPDATA"] - ENV["APPDATA"] - else - begin - File.expand_path("~") - rescue - if File::ALT_SEPARATOR - "C:/" - else - "/" - end - end - end - end - - # Returns the root where thor files are located, dependending on the OS. - # - def self.thor_root - File.join(user_home, ".thor") - end - - # Returns the files in the thor root. On Windows thor_root will be something - # like this: - # - # C:\Documents and Settings\james\.thor - # - # If we don't #gsub the \ character, Dir.glob will fail. - # - def self.thor_root_glob - files = Dir["#{thor_root.gsub(/\\/, '/')}/*"] - - files.map! do |file| - File.directory?(file) ? File.join(file, "main.thor") : file - end - end - - # Where to look for Thor files. - # - def self.globs_for(path) - ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"] - end - - # Return the path to the ruby interpreter taking into account multiple - # installations and windows extensions. - # - def self.ruby_command - @ruby_command ||= begin - ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) - ruby << Config::CONFIG['EXEEXT'] - - # escape string in case path to ruby executable contain spaces. - ruby.sub!(/.*\s.*/m, '"\&"') - ruby - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc b/railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc new file mode 100644 index 0000000000..dba25b7205 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc @@ -0,0 +1,77 @@ +== TODO + +* Improve spec coverage for Thor::Runner + +== 0.11.x, released 2009-07-01 + +* Added a rake compatibility layer. It allows you to use spec and rdoc tasks on + Thor classes. + +* BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore + since it wrong behavior to the invocation system. + +* thor help now show information about any class/task. All those calls are + possible: + + thor help describe + thor help describe:amazing + + Or even with default namespaces: + + thor help :spec + +* Thor::Runner now invokes the default task if none is supplied: + + thor describe # invokes the default task, usually help + +* Thor::Runner now works with mappings: + + thor describe -h + +* Added some documentation and code refactoring. + +== 0.9.8, released 2008-10-20 + +* Fixed some tiny issues that were introduced lately. + +== 0.9.7, released 2008-10-13 + +* Setting global method options on the initialize method works as expected: + All other tasks will accept these global options in addition to their own. +* Added 'group' notion to Thor task sets (class Thor); by default all tasks + are in the 'standard' group. Running 'thor -T' will only show the standard + tasks - adding --all will show all tasks. You can also filter on a specific + group using the --group option: thor -T --group advanced + +== 0.9.6, released 2008-09-13 + +* Generic improvements + +== 0.9.5, released 2008-08-27 + +* Improve Windows compatibility +* Update (incorrect) README and task.thor sample file +* Options hash is now frozen (once returned) +* Allow magic predicates on options object. For instance: `options.force?` +* Add support for :numeric type +* BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f]) +* Allow specifying optional args with default values: method_options(:user => "mislav") +* Don't write options for nil or false values. This allows, for example, turning color off when running specs. +* Exit with the status of the spec command to help CI stuff out some. + +== 0.9.4, released 2008-08-13 + +* Try to add Windows compatibility. +* BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore +* Allow options at the beginning of the argument list as well as the end. +* Make options available with symbol keys in addition to string keys. +* Allow true to be passed to Thor#method_options to denote a boolean option. +* If loading a thor file fails, don't give up, just print a warning and keep going. +* Make sure that we re-raise errors if they happened further down the pipe than we care about. +* Only delete the old file on updating when the installation of the new one is a success +* Make it Ruby 1.8.5 compatible. +* Don't raise an error if a boolean switch is defined multiple times. +* Thor::Options now doesn't parse through things that look like options but aren't. +* Add URI detection to install task, and make sure we don't append ".thor" to URIs +* Add rake2thor to the gem binfiles. +* Make sure local Thorfiles override system-wide ones. diff --git a/railties/lib/rails/vendor/thor-0.11.8/LICENSE b/railties/lib/rails/vendor/thor-0.11.8/LICENSE new file mode 100644 index 0000000000..98722da459 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/railties/lib/rails/vendor/thor-0.11.8/README.rdoc b/railties/lib/rails/vendor/thor-0.11.8/README.rdoc new file mode 100644 index 0000000000..f1106f02b6 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/README.rdoc @@ -0,0 +1,234 @@ += thor + +Map options to a class. Simply create a class with the appropriate annotations +and have options automatically map to functions and parameters. + +Example: + + class App < Thor # [1] + map "-L" => :list # [2] + + desc "install APP_NAME", "install one of the available apps" # [3] + method_options :force => :boolean, :alias => :string # [4] + def install(name) + user_alias = options[:alias] + if options.force? + # do something + end + # other code + end + + desc "list [SEARCH]", "list all of the available apps, limited by SEARCH" + def list(search="") + # list everything + end + end + +Thor automatically maps commands as such: + + thor app:install myname --force + +That gets converted to: + + App.new.install("myname") + # with {'force' => true} as options hash + +1. Inherit from Thor to turn a class into an option mapper +2. Map additional non-valid identifiers to specific methods. In this case, convert -L to :list +3. Describe the method immediately below. The first parameter is the usage information, and the second parameter is the description +4. Provide any additional options that will be available the instance method options. + +== Types for method_options + +* :boolean - is parsed as --option or --option=true +* :string - is parsed as --option=VALUE +* :numeric - is parsed as --option=N +* :array - is parsed as --option=one two three +* :hash - is parsed as --option=name:string age:integer + +Besides, method_option allows a default value to be given, examples: + + method_options :force => false + #=> Creates a boolean option with default value false + + method_options :alias => "bar" + #=> Creates a string option with default value "bar" + + method_options :threshold => 3.0 + #=> Creates a numeric option with default value 3.0 + +You can also supply :option => :required to mark an option as required. The +type is assumed to be string. If you want a required hash with default values +as option, you can use method_option which uses a more declarative style: + + method_option :attributes, :type => :hash, :default => {}, :required => true + +All arguments can be set to nil (except required arguments), by suppling a no or +skip variant. For example: + + thor app name --no-attributes + +In previous versions, aliases for options were created automatically, but now +they should be explicit. You can supply aliases in both short and declarative +styles: + + method_options %w( force -f ) => :boolean + +Or: + + method_option :force, :type => :boolean, :aliases => "-f" + +You can supply as many aliases as you want. + +NOTE: Type :optional available in Thor 0.9.0 was deprecated. Use :string or :boolean instead. + +== Namespaces + +By default, your Thor tasks are invoked using Ruby namespace. In the example +above, tasks are invoked as: + + thor app:install name --force + +However, you could namespace your class as: + + module Sinatra + class App < Thor + # tasks + end + end + +And then you should invoke your tasks as: + + thor sinatra:app:install name --force + +If desired, you can change the namespace: + + module Sinatra + class App < Thor + namespace :myapp + # tasks + end + end + +And then your tasks hould be invoked as: + + thor myapp:install name --force + +== Invocations + +Thor comes with a invocation-dependency system as well which allows a task to be +invoked only once. For example: + + class Counter < Thor + desc "one", "Prints 1, 2, 3" + def one + puts 1 + invoke :two + invoke :three + end + + desc "two", "Prints 2, 3" + def two + puts 2 + invoke :three + end + + desc "three", "Prints 3" + def three + puts 3 + end + end + +When invoking the task one: + + thor counter:one + +The output is "1 2 3", which means that the three task was invoked only once. +You can even invoke tasks from another class, so be sure to check the +documentation. + +== Thor::Group + +Thor has a special class called Thor::Group. The main difference to Thor class +is that it invokes all tasks at once. The example above could be rewritten in +Thor::Group as this: + + class Counter < Thor::Group + desc "Prints 1, 2, 3" + + def one + puts 1 + end + + def two + puts 2 + end + + def three + puts 3 + end + end + +When invoked: + + thor counter + +It prints "1 2 3" as well. Notice you should describe (using the method desc) +only the class and not each task anymore. Thor::Group is a great tool to create +generators, since you can define several steps which are invoked in the order they +are defined (Thor::Group is the tool use in generators in Rails 3.0). + +Besides, Thor::Group can parse arguments and options as Thor tasks: + + class Counter < Thor::Group + # number will be available as attr_accessor + argument :number, :type => :numeric, :desc => "The number to start counting" + desc "Prints the 'number' given upto 'number+2'" + + def one + puts number + 0 + end + + def two + puts number + 1 + end + + def three + puts number + 2 + end + end + +The counter above expects one parameter and has the folling outputs: + + thor counter 5 + # Prints "5 6 7" + + thor counter 11 + # Prints "11 12 13" + +You can also give options to Thor::Group, but instead of using method_option +and method_options, you should use class_option and class_options. +Both argument and class_options methods are available to Thor class as well. + +== Actions + +Thor comes with several actions which helps with script and generator tasks. You +might be familiar with them since some came from Rails Templates. They are: +say, ask, yes?, no?, add_file, +remove_file, copy_file, template, directory, +inside, run, inject_into_file and a couple more. + +To use them, you just need to include Thor::Actions in your Thor classes: + + class App < Thor + include Thor::Actions + # tasks + end + +Some actions like copy file requires that a class method called source_root is +defined in your class. This is the directory where your templates should be +placed. Be sure to check the documentation. + +== License + +See MIT LICENSE. diff --git a/railties/lib/rails/vendor/thor-0.11.8/Thorfile b/railties/lib/rails/vendor/thor-0.11.8/Thorfile new file mode 100644 index 0000000000..f71a1e57e2 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/Thorfile @@ -0,0 +1,63 @@ +# enconding: utf-8 + +require File.join(File.dirname(__FILE__), "lib", "thor", "version") +require 'thor/rake_compat' +require 'spec/rake/spectask' +require 'rdoc/task' + +GEM_NAME = 'thor' +EXTRA_RDOC_FILES = ["README.rdoc", "LICENSE", "CHANGELOG.rdoc", "VERSION", "Thorfile"] + +class Default < Thor + include Thor::RakeCompat + + Spec::Rake::SpecTask.new(:spec) do |t| + t.libs << 'lib' + t.spec_opts = ['--options', "spec/spec.opts"] + t.spec_files = FileList['spec/**/*_spec.rb'] + end + + Spec::Rake::SpecTask.new(:rcov) do |t| + t.libs << 'lib' + t.spec_opts = ['--options', "spec/spec.opts"] + t.spec_files = FileList['spec/**/*_spec.rb'] + t.rcov = true + t.rcov_dir = "rcov" + end + + RDoc::Task.new do |rdoc| + rdoc.main = "README.rdoc" + rdoc.rdoc_dir = "rdoc" + rdoc.title = GEM_NAME + rdoc.rdoc_files.include(*EXTRA_RDOC_FILES) + rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.options << '--line-numbers' << '--inline-source' + end + + begin + require 'jeweler' + Jeweler::Tasks.new do |s| + s.name = GEM_NAME + s.version = Thor::VERSION + s.rubyforge_project = "textmate" + s.platform = Gem::Platform::RUBY + s.summary = "A scripting framework that replaces rake, sake and rubigen" + s.email = "ruby-thor@googlegroups.com" + s.homepage = "http://yehudakatz.com" + s.description = "A scripting framework that replaces rake, sake and rubigen" + s.authors = ['Yehuda Katz', 'José Valim'] + s.has_rdoc = true + s.extra_rdoc_files = EXTRA_RDOC_FILES + s.require_path = 'lib' + s.bindir = "bin" + s.executables = %w( thor rake2thor ) + s.files = s.extra_rdoc_files + Dir.glob("{bin,lib}/**/*") + s.files.exclude 'spec/sandbox/**/*' + s.test_files.exclude 'spec/sandbox/**/*' + end + + Jeweler::RubyforgeTasks.new + rescue LoadError + puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb new file mode 100644 index 0000000000..68944f140d --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb @@ -0,0 +1,242 @@ +require 'thor/base' +require 'thor/group' +require 'thor/actions' + +class Thor + class << self + # Sets the default task when thor is executed without an explicit task to be called. + # + # ==== Parameters + # meth:: name of the defaut task + # + def default_task(meth=nil) + case meth + when :none + @default_task = 'help' + when nil + @default_task ||= from_superclass(:default_task, 'help') + else + @default_task = meth.to_s + end + end + + # Defines the usage and the description of the next task. + # + # ==== Parameters + # usage + # description + # + def desc(usage, description, options={}) + if options[:for] + task = find_and_refresh_task(options[:for]) + task.usage = usage if usage + task.description = description if description + else + @usage, @desc = usage, description + end + end + + # Maps an input to a task. If you define: + # + # map "-T" => "list" + # + # Running: + # + # thor -T + # + # Will invoke the list task. + # + # ==== Parameters + # Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given task. + # + def map(mappings=nil) + @map ||= from_superclass(:map, {}) + + if mappings + mappings.each do |key, value| + if key.respond_to?(:each) + key.each {|subkey| @map[subkey] = value} + else + @map[key] = value + end + end + end + + @map + end + + # Declares the options for the next task to be declared. + # + # ==== Parameters + # Hash[Symbol => Object]:: The hash key is the name of the option and the value + # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric + # or :required (string). If you give a value, the type of the value is used. + # + def method_options(options=nil) + @method_options ||= {} + build_options(options, @method_options) if options + @method_options + end + + # Adds an option to the set of class options. If :for is given as option, + # it allows you to change the options from a previous defined task. + # + # def previous_task + # # magic + # end + # + # method_options :foo => :bar, :for => :previous_task + # + # def next_task + # # magic + # end + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described below. + # + # ==== Options + # :desc - Description for the argument. + # :required - If the argument is required or not. + # :default - Default value for this argument. It cannot be required and have default values. + # :aliases - Aliases for this option. + # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. + # :group - The group for this options. Use by class options to output options in different levels. + # :banner - String to show on usage notes. + # + def method_option(name, options={}) + scope = if options[:for] + find_and_refresh_task(options[:for]).options + else + method_options + end + + build_option(name, options, scope) + end + + # Parses the task and options from the given args, instantiate the class + # and invoke the task. This method is used when the arguments must be parsed + # from an array. If you are inside Ruby and want to use a Thor class, you + # can simply initialize it: + # + # script = MyScript.new(args, options, config) + # script.invoke(:task, first_arg, second_arg, third_arg) + # + def start(given_args=ARGV, config={}) + super do + meth = normalize_task_name(given_args.shift) + task = all_tasks[meth] + + if task + args, opts = Thor::Options.split(given_args) + config.merge!(:task_options => task.options) + else + args, opts = given_args, {} + end + + task ||= Thor::Task::Dynamic.new(meth) + trailing = args[Range.new(arguments.size, -1)] + new(args, opts, config).invoke(task, trailing || []) + end + end + + # Prints help information. If a task name is given, it shows information + # only about the specific task. + # + # ==== Parameters + # meth:: An optional task name to print usage information about. + # + # ==== Options + # namespace:: When true, shows the namespace in the output before the usage. + # skip_inherited:: When true, does not show tasks from superclass. + # + def help(shell, meth=nil, options={}) + meth, options = nil, meth if meth.is_a?(Hash) + + if meth + task = all_tasks[meth] + raise UndefinedTaskError, "task '#{meth}' could not be found in namespace '#{self.namespace}'" unless task + + shell.say "Usage:" + shell.say " #{banner(task, options[:namespace], false)}" + shell.say + class_options_help(shell, "Class", :Method => task.options.map { |_, o| o }) + shell.say task.description + else + list = (options[:short] ? tasks : all_tasks).map do |_, task| + item = [ banner(task, options[:namespace]) ] + item << "# #{task.short_description}" if task.short_description + item << " " + end + + options[:ident] ||= 2 + if options[:short] + shell.print_list(list, :ident => options[:ident]) + else + shell.say "Tasks:" + shell.print_list(list, :ident => options[:ident]) + end + + Thor::Util.thor_classes_in(self).each do |subclass| + namespace = options[:namespace] == true || subclass.namespace.gsub(/^#{self.namespace}:/, '') + subclass.help(shell, options.merge(:short => true, :namespace => namespace)) + end + + class_options_help(shell, "Class") unless options[:short] + end + end + + protected + + # The banner for this class. You can customize it if you are invoking the + # thor class by another ways which is not the Thor::Runner. It receives + # the task that is going to be invoked and a boolean which indicates if + # the namespace should be displayed as arguments. + # + def banner(task, namespace=true, show_options=true) + task.formatted_usage(self, namespace, show_options) + end + + def baseclass #:nodoc: + Thor + end + + def create_task(meth) #:nodoc: + if @usage && @desc + tasks[meth.to_s] = Thor::Task.new(meth, @desc, @usage, method_options) + @usage, @desc, @method_options = nil + true + elsif self.all_tasks[meth.to_s] || meth.to_sym == :method_missing + true + else + puts "[WARNING] Attempted to create task #{meth.inspect} without usage or description. " << + "Call desc if you want this method to be available as task or declare it inside a " << + "no_tasks{} block. Invoked from #{caller[1].inspect}." + false + end + end + + def initialize_added #:nodoc: + class_options.merge!(method_options) + @method_options = nil + end + + # Receives a task name (can be nil), and try to get a map from it. + # If a map can't be found use the sent name or the default task. + # + def normalize_task_name(meth) #:nodoc: + mapping = map[meth.to_s] + meth = mapping || meth || default_task + meth.to_s.gsub('-','_') # treat foo-bar > foo_bar + end + end + + include Thor::Base + + map HELP_MAPPINGS => :help + + desc "help [TASK]", "Describe available tasks or one specific task" + def help(task=nil) + self.class.help(shell, task, :namespace => task && task.include?(?:)) + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb new file mode 100644 index 0000000000..d561ccb2aa --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb @@ -0,0 +1,273 @@ +require 'fileutils' + +Dir[File.join(File.dirname(__FILE__), "actions", "*.rb")].each do |action| + require action +end + +class Thor + module Actions + attr_accessor :behavior + + def self.included(base) #:nodoc: + base.extend ClassMethods + end + + module ClassMethods + # Hold source paths for one Thor instance. source_paths_for_search is the + # method responsible to gather source_paths from this current class, + # inherited paths and the source root. + # + def source_paths + @source_paths ||= [] + end + + # Returns the source paths in the following order: + # + # 1) This class source paths + # 2) Source root + # 3) Parents source paths + # + def source_paths_for_search + paths = [] + paths += self.source_paths + paths << self.source_root if self.respond_to?(:source_root) + paths += from_superclass(:source_paths, []) + paths + end + + # Add runtime options that help actions execution. + # + def add_runtime_options! + class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime, + :desc => "Run but do not make any changes" + + class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime, + :desc => "Overwrite files that already exist" + + class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime, + :desc => "Skip files that already exist" + + class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime, + :desc => "Supress status output" + end + end + + # Extends initializer to add more configuration options. + # + # ==== Configuration + # behavior:: The actions default behavior. Can be :invoke or :revoke. + # It also accepts :force, :skip and :pretend to set the behavior + # and the respective option. + # + # destination_root:: The root directory needed for some actions. + # + def initialize(args=[], options={}, config={}) + self.behavior = case config[:behavior].to_s + when "force", "skip" + _cleanup_options_and_set(options, config[:behavior]) + :invoke + when "revoke" + :revoke + else + :invoke + end + + super + self.destination_root = config[:destination_root] + end + + # Wraps an action object and call it accordingly to the thor class behavior. + # + def action(instance) #:nodoc: + if behavior == :revoke + instance.revoke! + else + instance.invoke! + end + end + + # Returns the root for this thor class (also aliased as destination root). + # + def destination_root + @destination_stack.last + end + + # Sets the root for this thor class. Relatives path are added to the + # directory where the script was invoked and expanded. + # + def destination_root=(root) + @destination_stack ||= [] + @destination_stack[0] = File.expand_path(root || '') + end + + # Returns the given path relative to the absolute root (ie, root where + # the script started). + # + def relative_to_original_destination_root(path, remove_dot=true) + path = path.gsub(@destination_stack[0], '.') + remove_dot ? (path[2..-1] || '') : path + end + + # Holds source paths in instance so they can be manipulated. + # + def source_paths + @source_paths ||= self.class.source_paths_for_search + end + + # Receives a file or directory and search for it in the source paths. + # + def find_in_source_paths(file) + relative_root = relative_to_original_destination_root(destination_root, false) + + source_paths.each do |source| + source_file = File.expand_path(file, File.join(source, relative_root)) + return source_file if File.exists?(source_file) + end + + if source_paths.empty? + raise Error, "You don't have any source path defined for class #{self.class.name}. To fix this, " << + "you can define a source_root in your class." + else + raise Error, "Could not find #{file.inspect} in source paths." + end + end + + # Do something in the root or on a provided subfolder. If a relative path + # is given it's referenced from the current root. The full path is yielded + # to the block you provide. The path is set back to the previous path when + # the method exits. + # + # ==== Parameters + # dir:: the directory to move to. + # config:: give :verbose => true to log and use padding. + # + def inside(dir='', config={}, &block) + verbose = config.fetch(:verbose, false) + + say_status :inside, dir, verbose + shell.padding += 1 if verbose + @destination_stack.push File.expand_path(dir, destination_root) + + FileUtils.mkdir_p(destination_root) unless File.exist?(destination_root) + FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield } + + @destination_stack.pop + shell.padding -= 1 if verbose + end + + # Goes to the root and execute the given block. + # + def in_root + inside(@destination_stack.first) { yield } + end + + # Loads an external file and execute it in the instance binding. + # + # ==== Parameters + # path:: The path to the file to execute. Can be a web address or + # a relative path from the source root. + # + # ==== Examples + # + # apply "http://gist.github.com/103208" + # + # apply "recipes/jquery.rb" + # + def apply(path, config={}) + verbose = config.fetch(:verbose, true) + path = find_in_source_paths(path) unless path =~ /^http\:\/\// + + say_status :apply, path, verbose + shell.padding += 1 if verbose + instance_eval(open(path).read) + shell.padding -= 1 if verbose + end + + # Executes a command. + # + # ==== Parameters + # command:: the command to be executed. + # config:: give :verbose => false to not log the status. Specify :with + # to append an executable to command executation. + # + # ==== Example + # + # inside('vendor') do + # run('ln -s ~/edge rails') + # end + # + def run(command, config={}) + return unless behavior == :invoke + + destination = relative_to_original_destination_root(destination_root, false) + desc = "#{command} from #{destination.inspect}" + + if config[:with] + desc = "#{File.basename(config[:with].to_s)} #{desc}" + command = "#{config[:with]} #{command}" + end + + say_status :run, desc, config.fetch(:verbose, true) + system(command) unless options[:pretend] + end + + # Executes a ruby script (taking into account WIN32 platform quirks). + # + # ==== Parameters + # command:: the command to be executed. + # config:: give :verbose => false to not log the status. + # + def run_ruby_script(command, config={}) + return unless behavior == :invoke + run "#{command}", config.merge(:with => Thor::Util.ruby_command) + end + + # Run a thor command. A hash of options can be given and it's converted to + # switches. + # + # ==== Parameters + # task:: the task to be invoked + # args:: arguments to the task + # config:: give :verbose => false to not log the status. Other options + # are given as parameter to Thor. + # + # ==== Examples + # + # thor :install, "http://gist.github.com/103208" + # #=> thor install http://gist.github.com/103208 + # + # thor :list, :all => true, :substring => 'rails' + # #=> thor list --all --substring=rails + # + def thor(task, *args) + config = args.last.is_a?(Hash) ? args.pop : {} + verbose = config.key?(:verbose) ? config.delete(:verbose) : true + + args.unshift task + args.push Thor::Options.to_switches(config) + command = args.join(' ').strip + + run command, :with => :thor, :verbose => verbose + end + + protected + + # Allow current root to be shared between invocations. + # + def _shared_configuration #:nodoc: + super.merge!(:destination_root => self.destination_root) + end + + def _cleanup_options_and_set(options, key) #:nodoc: + case options + when Array + %w(--force -f --skip -s).each { |i| options.delete(i) } + options << "--#{key}" + when Hash + [:force, :skip, "force", "skip"].each { |i| options.delete(i) } + options.merge!(key => true) + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb new file mode 100644 index 0000000000..8f6badee27 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb @@ -0,0 +1,102 @@ +require 'thor/actions/empty_directory' + +class Thor + module Actions + + # Create a new file relative to the destination root with the given data, + # which is the return value of a block or a data string. + # + # ==== Parameters + # destination:: the relative path to the destination root. + # data:: the data to append to the file. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # create_file "lib/fun_party.rb" do + # hostname = ask("What is the virtual hostname I should use?") + # "vhost.name = #{hostname}" + # end + # + # create_file "config/apach.conf", "your apache config" + # + def create_file(destination, data=nil, config={}, &block) + action CreateFile.new(self, destination, block || data.to_s, config) + end + alias :add_file :create_file + + # AddFile is a subset of Template, which instead of rendering a file with + # ERB, it gets the content from the user. + # + class CreateFile < EmptyDirectory #:nodoc: + attr_reader :data + + def initialize(base, destination, data, config={}) + @data = data + super(base, destination, config) + end + + # Checks if the content of the file at the destination is identical to the rendered result. + # + # ==== Returns + # Boolean:: true if it is identical, false otherwise. + # + def identical? + exists? && File.read(destination) == render + end + + # Holds the content to be added to the file. + # + def render + @render ||= if data.is_a?(Proc) + data.call + else + data + end + end + + def invoke! + invoke_with_conflict_check do + FileUtils.mkdir_p(File.dirname(destination)) + File.open(destination, 'w'){ |f| f.write render } + end + end + + protected + + # Now on conflict we check if the file is identical or not. + # + def on_conflict_behavior(&block) + if identical? + say_status :identical, :blue + else + options = base.options.merge(config) + force_or_skip_or_conflict(options[:force], options[:skip], &block) + end + end + + # If force is true, run the action, otherwise check if it's not being + # skipped. If both are false, show the file_collision menu, if the menu + # returns true, force it, otherwise skip. + # + def force_or_skip_or_conflict(force, skip, &block) + if force + say_status :force, :yellow + block.call unless pretend? + elsif skip + say_status :skip, :yellow + else + say_status :conflict, :red + force_or_skip_or_conflict(force_on_collision?, true, &block) + end + end + + # Shows the file collision menu to the user and gets the result. + # + def force_on_collision? + base.shell.file_collision(destination){ render } + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb new file mode 100644 index 0000000000..063ac57406 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb @@ -0,0 +1,89 @@ +require 'thor/actions/empty_directory' + +class Thor + module Actions + + # Copies recursively the files from source directory to root directory. + # If any of the files finishes with .tt, it's considered to be a template + # and is placed in the destination without the extension .tt. If any + # empty directory is found, it's copied and all .empty_directory files are + # ignored. Remember that file paths can also be encoded, let's suppose a doc + # directory with the following files: + # + # doc/ + # components/.empty_directory + # README + # rdoc.rb.tt + # %app_name%.rb + # + # When invoked as: + # + # directory "doc" + # + # It will create a doc directory in the destination with the following + # files (assuming that the app_name is "blog"): + # + # doc/ + # components/ + # README + # rdoc.rb + # blog.rb + # + # ==== Parameters + # source:: the relative path to the source root. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # If :recursive => false, does not look for paths recursively. + # + # ==== Examples + # + # directory "doc" + # directory "doc", "docs", :recursive => false + # + def directory(source, destination=nil, config={}) + action Directory.new(self, source, destination || source, config) + end + + class Directory < EmptyDirectory #:nodoc: + attr_reader :source + + def initialize(base, source, destination=nil, config={}) + @source = File.expand_path(base.find_in_source_paths(source.to_s)) + super(base, destination, { :recursive => true }.merge(config)) + end + + def invoke! + base.empty_directory given_destination, config + execute! + end + + def revoke! + execute! + end + + protected + + def execute! + lookup = config[:recursive] ? File.join(source, '**') : source + lookup = File.join(lookup, '{*,.[a-z]*}') + + Dir[lookup].each do |file_source| + next if File.directory?(file_source) + file_destination = File.join(given_destination, file_source.gsub(source, '.')) + + case file_source + when /\.empty_directory$/ + dirname = File.dirname(file_destination).gsub(/\/\.$/, '') + next if dirname == given_destination + base.empty_directory(dirname, config) + when /\.tt$/ + base.template(file_source, file_destination[0..-4], config) + else + base.copy_file(file_source, file_destination, config) + end + end + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb new file mode 100644 index 0000000000..03c1fe4af1 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb @@ -0,0 +1,133 @@ +class Thor + module Actions + + # Creates an empty directory. + # + # ==== Parameters + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # empty_directory "doc" + # + def empty_directory(destination, config={}) + action EmptyDirectory.new(self, destination, config) + end + + # Class which holds create directory logic. This is the base class for + # other actions like create_file and directory. + # + # This implementation is based in Templater actions, created by Jonas Nicklas + # and Michael S. Klishin under MIT LICENSE. + # + class EmptyDirectory #:nodoc: + attr_reader :base, :destination, :given_destination, :relative_destination, :config + + # Initializes given the source and destination. + # + # ==== Parameters + # base:: A Thor::Base instance + # source:: Relative path to the source of this file + # destination:: Relative path to the destination of this file + # config:: give :verbose => false to not log the status. + # + def initialize(base, destination, config={}) + @base, @config = base, { :verbose => true }.merge(config) + self.destination = destination + end + + # Checks if the destination file already exists. + # + # ==== Returns + # Boolean:: true if the file exists, false otherwise. + # + def exists? + ::File.exists?(destination) + end + + def invoke! + invoke_with_conflict_check do + ::FileUtils.mkdir_p(destination) + end + end + + def revoke! + say_status :remove, :red + ::FileUtils.rm_rf(destination) if !pretend? && exists? + end + + protected + + # Shortcut for pretend. + # + def pretend? + base.options[:pretend] + end + + # Sets the absolute destination value from a relative destination value. + # It also stores the given and relative destination. Let's suppose our + # script is being executed on "dest", it sets the destination root to + # "dest". The destination, given_destination and relative_destination + # are related in the following way: + # + # inside "bar" do + # empty_directory "baz" + # end + # + # destination #=> dest/bar/baz + # relative_destination #=> bar/baz + # given_destination #=> baz + # + def destination=(destination) + if destination + @given_destination = convert_encoded_instructions(destination.to_s) + @destination = ::File.expand_path(@given_destination, base.destination_root) + @relative_destination = base.relative_to_original_destination_root(@destination) + end + end + + # Filenames in the encoded form are converted. If you have a file: + # + # %class_name%.rb + # + # It gets the class name from the base and replace it: + # + # user.rb + # + def convert_encoded_instructions(filename) + filename.gsub(/%(.*?)%/) do |string| + instruction = $1.strip + base.respond_to?(instruction) ? base.send(instruction) : string + end + end + + # Receives a hash of options and just execute the block if some + # conditions are met. + # + def invoke_with_conflict_check(&block) + if exists? + on_conflict_behavior(&block) + else + say_status :create, :green + block.call unless pretend? + end + + destination + end + + # What to do when the destination file already exists. + # + def on_conflict_behavior(&block) + say_status :exist, :blue + end + + # Shortcut to say_status shell method. + # + def say_status(status, color) + base.shell.say_status status, relative_destination, color if config[:verbose] + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb new file mode 100644 index 0000000000..d77d90d448 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb @@ -0,0 +1,219 @@ +require 'erb' +require 'open-uri' + +class Thor + module Actions + + # Copies the file from the relative source to the relative destination. If + # the destination is not given it's assumed to be equal to the source. + # + # ==== Parameters + # source:: the relative path to the source root. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # copy_file "README", "doc/README" + # + # copy_file "doc/README" + # + def copy_file(source, destination=nil, config={}) + destination ||= source + source = File.expand_path(find_in_source_paths(source.to_s)) + + create_file destination, nil, config do + File.read(source) + end + end + + # Gets the content at the given address and places it at the given relative + # destination. If a block is given instead of destination, the content of + # the url is yielded and used as location. + # + # ==== Parameters + # source:: the address of the given content. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # get "http://gist.github.com/103208", "doc/README" + # + # get "http://gist.github.com/103208" do |content| + # content.split("\n").first + # end + # + def get(source, destination=nil, config={}, &block) + source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ /^http\:\/\// + render = open(source).read + + destination ||= if block_given? + block.arity == 1 ? block.call(render) : block.call + else + File.basename(source) + end + + create_file destination, render, config + end + + # Gets an ERB template at the relative source, executes it and makes a copy + # at the relative destination. If the destination is not given it's assumed + # to be equal to the source removing .tt from the filename. + # + # ==== Parameters + # source:: the relative path to the source root. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # template "README", "doc/README" + # + # template "doc/README" + # + def template(source, destination=nil, config={}) + destination ||= source + source = File.expand_path(find_in_source_paths(source.to_s)) + context = instance_eval('binding') + + create_file destination, nil, config do + ERB.new(::File.read(source), nil, '-').result(context) + end + end + + # Changes the mode of the given file or directory. + # + # ==== Parameters + # mode:: the file mode + # path:: the name of the file to change mode + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # chmod "script/*", 0755 + # + def chmod(path, mode, config={}) + return unless behavior == :invoke + path = File.expand_path(path, destination_root) + say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true) + FileUtils.chmod_R(mode, path) unless options[:pretend] + end + + # Prepend text to a file. Since it depends on inject_into_file, it's reversible. + # + # ==== Parameters + # path:: path of the file to be changed + # data:: the data to prepend to the file, can be also given as a block. + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # prepend_file 'config/environments/test.rb', 'config.gem "rspec"' + # + # prepend_file 'config/environments/test.rb' do + # 'config.gem "rspec"' + # end + # + def prepend_file(path, *args, &block) + config = args.last.is_a?(Hash) ? args.pop : {} + config.merge!(:after => /\A/) + inject_into_file(path, *(args << config), &block) + end + + # Append text to a file. Since it depends on inject_into_file, it's reversible. + # + # ==== Parameters + # path:: path of the file to be changed + # data:: the data to append to the file, can be also given as a block. + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # append_file 'config/environments/test.rb', 'config.gem "rspec"' + # + # append_file 'config/environments/test.rb' do + # 'config.gem "rspec"' + # end + # + def append_file(path, *args, &block) + config = args.last.is_a?(Hash) ? args.pop : {} + config.merge!(:before => /\z/) + inject_into_file(path, *(args << config), &block) + end + + # Injects text right after the class definition. Since it depends on + # inject_into_file, it's reversible. + # + # ==== Parameters + # path:: path of the file to be changed + # klass:: the class to be manipulated + # data:: the data to append to the class, can be also given as a block. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # inject_into_class "app/controllers/application_controller.rb", " filter_parameter :password\n" + # + # inject_into_class "app/controllers/application_controller.rb", ApplicationController do + # " filter_parameter :password\n" + # end + # + def inject_into_class(path, klass, *args, &block) + config = args.last.is_a?(Hash) ? args.pop : {} + config.merge!(:after => /class #{klass}\n|class #{klass} .*\n/) + inject_into_file(path, *(args << config), &block) + end + + # Run a regular expression replacement on a file. + # + # ==== Parameters + # path:: path of the file to be changed + # flag:: the regexp or string to be replaced + # replacement:: the replacement, can be also given as a block + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1' + # + # gsub_file 'README', /rake/, :green do |match| + # match << " no more. Use thor!" + # end + # + def gsub_file(path, flag, *args, &block) + return unless behavior == :invoke + config = args.last.is_a?(Hash) ? args.pop : {} + + path = File.expand_path(path, destination_root) + say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true) + + unless options[:pretend] + content = File.read(path) + content.gsub!(flag, *args, &block) + File.open(path, 'wb') { |file| file.write(content) } + end + end + + # Removes a file at the given location. + # + # ==== Parameters + # path:: path of the file to be changed + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # remove_file 'README' + # remove_file 'app/controllers/application_controller.rb' + # + def remove_file(path, config={}) + return unless behavior == :invoke + path = File.expand_path(path, destination_root) + + say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) + ::FileUtils.rm_rf(path) if !options[:pretend] && File.exists?(path) + end + alias :remove_dir :remove_file + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb new file mode 100644 index 0000000000..0636ec6591 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb @@ -0,0 +1,101 @@ +require 'thor/actions/empty_directory' + +class Thor + module Actions + + # Injects the given content into a file. Different from gsub_file, this + # method is reversible. + # + # ==== Parameters + # destination:: Relative path to the destination root + # data:: Data to add to the file. Can be given as a block. + # config:: give :verbose => false to not log the status and the flag + # for injection (:after or :before). + # + # ==== Examples + # + # inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n" + # + # inject_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do + # gems = ask "Which gems would you like to add?" + # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n") + # end + # + def inject_into_file(destination, *args, &block) + if block_given? + data, config = block, args.shift + else + data, config = args.shift, args.shift + end + action InjectIntoFile.new(self, destination, data, config) + end + + class InjectIntoFile < EmptyDirectory #:nodoc: + attr_reader :replacement, :flag, :behavior + + def initialize(base, destination, data, config) + super(base, destination, { :verbose => true }.merge(config)) + + @behavior, @flag = if @config.key?(:after) + [:after, @config.delete(:after)] + else + [:before, @config.delete(:before)] + end + + @replacement = data.is_a?(Proc) ? data.call : data + @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp) + end + + def invoke! + say_status :invoke + + content = if @behavior == :after + '\0' + replacement + else + replacement + '\0' + end + + replace!(/#{flag}/, content) + end + + def revoke! + say_status :revoke + + regexp = if @behavior == :after + content = '\1\2' + /(#{flag})(.*)(#{Regexp.escape(replacement)})/m + else + content = '\2\3' + /(#{Regexp.escape(replacement)})(.*)(#{flag})/m + end + + replace!(regexp, content) + end + + protected + + def say_status(behavior) + status = if flag == /\A/ + behavior == :invoke ? :prepend : :unprepend + elsif flag == /\z/ + behavior == :invoke ? :append : :unappend + else + behavior == :invoke ? :inject : :deinject + end + + super(status, config[:verbose]) + end + + # Adds the content to the file. + # + def replace!(regexp, string) + unless base.options[:pretend] + content = File.read(destination) + content.gsub!(regexp, string) + File.open(destination, 'wb') { |file| file.write(content) } + end + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb new file mode 100644 index 0000000000..700d794123 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb @@ -0,0 +1,517 @@ +require 'thor/core_ext/hash_with_indifferent_access' +require 'thor/core_ext/ordered_hash' +require 'thor/error' +require 'thor/shell' +require 'thor/invocation' +require 'thor/parser' +require 'thor/task' +require 'thor/util' + +class Thor + # Shortcuts for help. + HELP_MAPPINGS = %w(-h -? --help -D) + + # Thor methods that should not be overwritten by the user. + THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root + action add_file create_file in_root inside run run_ruby_script) + + module Base + attr_accessor :options + + # It receives arguments in an Array and two hashes, one for options and + # other for configuration. + # + # Notice that it does not check if all required arguments were supplied. + # It should be done by the parser. + # + # ==== Parameters + # args:: An array of objects. The objects are applied to their + # respective accessors declared with argument. + # + # options:: An options hash that will be available as self.options. + # The hash given is converted to a hash with indifferent + # access, magic predicates (options.skip?) and then frozen. + # + # config:: Configuration for this Thor class. + # + def initialize(args=[], options={}, config={}) + Thor::Arguments.parse(self.class.arguments, args).each do |key, value| + send("#{key}=", value) + end + + parse_options = self.class.class_options + + if options.is_a?(Array) + task_options = config.delete(:task_options) # hook for start + parse_options = parse_options.merge(task_options) if task_options + array_options, hash_options = options, {} + else + array_options, hash_options = [], options + end + + options = Thor::Options.parse(parse_options, array_options) + self.options = Thor::CoreExt::HashWithIndifferentAccess.new(options).merge!(hash_options) + self.options.freeze + end + + class << self + def included(base) #:nodoc: + base.send :extend, ClassMethods + base.send :include, Invocation + base.send :include, Shell + end + + # Returns the classes that inherits from Thor or Thor::Group. + # + # ==== Returns + # Array[Class] + # + def subclasses + @subclasses ||= [] + end + + # Returns the files where the subclasses are kept. + # + # ==== Returns + # Hash[path => Class] + # + def subclass_files + @subclass_files ||= Hash.new{ |h,k| h[k] = [] } + end + + # Whenever a class inherits from Thor or Thor::Group, we should track the + # class and the file on Thor::Base. This is the method responsable for it. + # + def register_klass_file(klass) #:nodoc: + file = caller[1].match(/(.*):\d+/)[1] + Thor::Base.subclasses << klass unless Thor::Base.subclasses.include?(klass) + + file_subclasses = Thor::Base.subclass_files[File.expand_path(file)] + file_subclasses << klass unless file_subclasses.include?(klass) + end + end + + module ClassMethods + # Adds an argument to the class and creates an attr_accessor for it. + # + # Arguments are different from options in several aspects. The first one + # is how they are parsed from the command line, arguments are retrieved + # from position: + # + # thor task NAME + # + # Instead of: + # + # thor task --name=NAME + # + # Besides, arguments are used inside your code as an accessor (self.argument), + # while options are all kept in a hash (self.options). + # + # Finally, arguments cannot have type :default or :boolean but can be + # optional (supplying :optional => :true or :required => false), although + # you cannot have a required argument after a non-required argument. If you + # try it, an error is raised. + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described below. + # + # ==== Options + # :desc - Description for the argument. + # :required - If the argument is required or not. + # :optional - If the argument is optional or not. + # :type - The type of the argument, can be :string, :hash, :array, :numeric. + # :default - Default value for this argument. It cannot be required and have default values. + # :banner - String to show on usage notes. + # + # ==== Errors + # ArgumentError:: Raised if you supply a required argument after a non required one. + # + def argument(name, options={}) + is_thor_reserved_word?(name, :argument) + no_tasks { attr_accessor name } + + required = if options.key?(:optional) + !options[:optional] + elsif options.key?(:required) + options[:required] + else + options[:default].nil? + end + + remove_argument name + + arguments.each do |argument| + next if argument.required? + raise ArgumentError, "You cannot have #{name.to_s.inspect} as required argument after " << + "the non-required argument #{argument.human_name.inspect}." + end if required + + arguments << Thor::Argument.new(name, options[:desc], required, options[:type], + options[:default], options[:banner]) + end + + # Returns this class arguments, looking up in the ancestors chain. + # + # ==== Returns + # Array[Thor::Argument] + # + def arguments + @arguments ||= from_superclass(:arguments, []) + end + + # Adds a bunch of options to the set of class options. + # + # class_options :foo => false, :bar => :required, :baz => :string + # + # If you prefer more detailed declaration, check class_option. + # + # ==== Parameters + # Hash[Symbol => Object] + # + def class_options(options=nil) + @class_options ||= from_superclass(:class_options, {}) + build_options(options, @class_options) if options + @class_options + end + + # Adds an option to the set of class options + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described below. + # + # ==== Options + # :desc - Description for the argument. + # :required - If the argument is required or not. + # :default - Default value for this argument. + # :group - The group for this options. Use by class options to output options in different levels. + # :aliases - Aliases for this option. + # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. + # :banner - String to show on usage notes. + # + def class_option(name, options={}) + build_option(name, options, class_options) + end + + # Removes a previous defined argument. If :undefine is given, undefine + # accessors as well. + # + # ==== Paremeters + # names:: Arguments to be removed + # + # ==== Examples + # + # remove_argument :foo + # remove_argument :foo, :bar, :baz, :undefine => true + # + def remove_argument(*names) + options = names.last.is_a?(Hash) ? names.pop : {} + + names.each do |name| + arguments.delete_if { |a| a.name == name.to_s } + undef_method name, "#{name}=" if options[:undefine] + end + end + + # Removes a previous defined class option. + # + # ==== Paremeters + # names:: Class options to be removed + # + # ==== Examples + # + # remove_class_option :foo + # remove_class_option :foo, :bar, :baz + # + def remove_class_option(*names) + names.each do |name| + class_options.delete(name) + end + end + + # Defines the group. This is used when thor list is invoked so you can specify + # that only tasks from a pre-defined group will be shown. Defaults to standard. + # + # ==== Parameters + # name + # + def group(name=nil) + case name + when nil + @group ||= from_superclass(:group, 'standard') + else + @group = name.to_s + end + end + + # Returns the tasks for this Thor class. + # + # ==== Returns + # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task + # objects as values. + # + def tasks + @tasks ||= Thor::CoreExt::OrderedHash.new + end + + # Returns the tasks for this Thor class and all subclasses. + # + # ==== Returns + # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task + # objects as values. + # + def all_tasks + @all_tasks ||= from_superclass(:all_tasks, Thor::CoreExt::OrderedHash.new) + @all_tasks.merge(tasks) + end + + # Removes a given task from this Thor class. This is usually done if you + # are inheriting from another class and don't want it to be available + # anymore. + # + # By default it only remove the mapping to the task. But you can supply + # :undefine => true to undefine the method from the class as well. + # + # ==== Parameters + # name:: The name of the task to be removed + # options:: You can give :undefine => true if you want tasks the method + # to be undefined from the class as well. + # + def remove_task(*names) + options = names.last.is_a?(Hash) ? names.pop : {} + + names.each do |name| + tasks.delete(name.to_s) + all_tasks.delete(name.to_s) + undef_method name if options[:undefine] + end + end + + # All methods defined inside the given block are not added as tasks. + # + # So you can do: + # + # class MyScript < Thor + # no_tasks do + # def this_is_not_a_task + # end + # end + # end + # + # You can also add the method and remove it from the task list: + # + # class MyScript < Thor + # def this_is_not_a_task + # end + # remove_task :this_is_not_a_task + # end + # + def no_tasks + @no_tasks = true + yield + @no_tasks = false + end + + # Sets the namespace for the Thor or Thor::Group class. By default the + # namespace is retrieved from the class name. If your Thor class is named + # Scripts::MyScript, the help method, for example, will be called as: + # + # thor scripts:my_script -h + # + # If you change the namespace: + # + # namespace :my_scripts + # + # You change how your tasks are invoked: + # + # thor my_scripts -h + # + # Finally, if you change your namespace to default: + # + # namespace :default + # + # Your tasks can be invoked with a shortcut. Instead of: + # + # thor :my_task + # + def namespace(name=nil) + case name + when nil + @namespace ||= Thor::Util.namespace_from_thor_class(self, false) + else + @namespace = name.to_s + end + end + + # Default way to start generators from the command line. + # + def start(given_args=ARGV, config={}) + config[:shell] ||= Thor::Base.shell.new + yield + rescue Thor::Error => e + if given_args.include?("--debug") + raise e + else + config[:shell].error e.message + end + exit(1) if exit_on_failure? + end + + protected + + # Prints the class options per group. If an option does not belong to + # any group, it uses the ungrouped name value. This method provide to + # hooks to add extra options, one of them if the third argument called + # extra_group that should be a hash in the format :group => Array[Options]. + # + # The second is by returning a lambda used to print values. The lambda + # requires two options: the group name and the array of options. + # + def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: + groups = {} + + class_options.each do |_, value| + groups[value.group] ||= [] + groups[value.group] << value + end + + printer = proc do |group_name, options| + list = [] + padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 + + options.each do |option| + item = [ option.usage(padding) ] + item.push(option.description ? "# #{option.description}" : "") + + list << item + list << [ "", "# Default: #{option.default}" ] if option.show_default? + end + + unless list.empty? + shell.say(group_name ? "#{group_name} options:" : "Options:") + shell.print_table(list, :ident => 2) + shell.say "" + end + end + + # Deal with default group + global_options = groups.delete(nil) || [] + printer.call(ungrouped_name, global_options) if global_options + + # Print all others + groups = extra_group.merge(groups) if extra_group + groups.each(&printer) + printer + end + + # Raises an error if the word given is a Thor reserved word. + # + def is_thor_reserved_word?(word, type) #:nodoc: + return false unless THOR_RESERVED_WORDS.include?(word.to_s) + raise "#{word.inspect} is a Thor reserved word and cannot be defined as #{type}" + end + + # Build an option and adds it to the given scope. + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described in both class_option and method_option. + # + def build_option(name, options, scope) #:nodoc: + scope[name] = Thor::Option.new(name, options[:desc], options[:required], + options[:type], options[:default], options[:banner], + options[:group], options[:aliases]) + end + + # Receives a hash of options, parse them and add to the scope. This is a + # fast way to set a bunch of options: + # + # build_options :foo => true, :bar => :required, :baz => :string + # + # ==== Parameters + # Hash[Symbol => Object] + # + def build_options(options, scope) #:nodoc: + options.each do |key, value| + scope[key] = Thor::Option.parse(key, value) + end + end + + # Finds a task with the given name. If the task belongs to the current + # class, just return it, otherwise dup it and add the fresh copy to the + # current task hash. + # + def find_and_refresh_task(name) #:nodoc: + task = if task = tasks[name.to_s] + task + elsif task = all_tasks[name.to_s] + tasks[name.to_s] = task.clone + else + raise ArgumentError, "You supplied :for => #{name.inspect}, but the task #{name.inspect} could not be found." + end + end + + # Everytime someone inherits from a Thor class, register the klass + # and file into baseclass. + # + def inherited(klass) + Thor::Base.register_klass_file(klass) + end + + # Fire this callback whenever a method is added. Added methods are + # tracked as tasks by invoking the create_task method. + # + def method_added(meth) + meth = meth.to_s + + if meth == "initialize" + initialize_added + return + end + + # Return if it's not a public instance method + return unless public_instance_methods.include?(meth) || + public_instance_methods.include?(meth.to_sym) + + return if @no_tasks || !create_task(meth) + + is_thor_reserved_word?(meth, :task) + Thor::Base.register_klass_file(self) + end + + # Retrieves a value from superclass. If it reaches the baseclass, + # returns default. + # + def from_superclass(method, default=nil) + if self == baseclass || !superclass.respond_to?(method, true) + default + else + value = superclass.send(method) + value.dup if value + end + end + + # A flag that makes the process exit with status 1 if any error happens. + # + def exit_on_failure? + false + end + + # SIGNATURE: Sets the baseclass. This is where the superclass lookup + # finishes. + def baseclass #:nodoc: + end + + # SIGNATURE: Creates a new task if valid_task? is true. This method is + # called when a new method is added to the class. + def create_task(meth) #:nodoc: + end + + # SIGNATURE: Defines behavior when the initialize method is added to the + # class. + def initialize_added #:nodoc: + end + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb new file mode 100644 index 0000000000..78bc5cf4bf --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb @@ -0,0 +1,75 @@ +class Thor + module CoreExt #:nodoc: + + # A hash with indifferent access and magic predicates. + # + # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true + # + # hash[:foo] #=> 'bar' + # hash['foo'] #=> 'bar' + # hash.foo? #=> true + # + class HashWithIndifferentAccess < ::Hash #:nodoc: + + def initialize(hash={}) + super() + hash.each do |key, value| + self[convert_key(key)] = value + end + end + + def [](key) + super(convert_key(key)) + end + + def []=(key, value) + super(convert_key(key), value) + end + + def delete(key) + super(convert_key(key)) + end + + def values_at(*indices) + indices.collect { |key| self[convert_key(key)] } + end + + def merge(other) + dup.merge!(other) + end + + def merge!(other) + other.each do |key, value| + self[convert_key(key)] = value + end + self + end + + protected + + def convert_key(key) + key.is_a?(Symbol) ? key.to_s : key + end + + # Magic predicates. For instance: + # + # options.force? # => !!options['force'] + # options.shebang # => "/usr/lib/local/ruby" + # options.test_framework?(:rspec) # => options[:test_framework] == :rspec + # + def method_missing(method, *args, &block) + method = method.to_s + if method =~ /^(\w+)\?$/ + if args.empty? + !!self[$1] + else + self[$1] == args.first + end + else + self[method] + end + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb new file mode 100644 index 0000000000..27fea5bb35 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb @@ -0,0 +1,100 @@ +class Thor + module CoreExt #:nodoc: + + if RUBY_VERSION >= '1.9' + class OrderedHash < ::Hash + end + else + # This class is based on the Ruby 1.9 ordered hashes. + # + # It keeps the semantics and most of the efficiency of normal hashes + # while also keeping track of the order in which elements were set. + # + class OrderedHash #:nodoc: + include Enumerable + + Node = Struct.new(:key, :value, :next, :prev) + + def initialize + @hash = {} + end + + def [](key) + @hash[key] && @hash[key].value + end + + def []=(key, value) + if node = @hash[key] + node.value = value + else + node = Node.new(key, value) + + if @first.nil? + @first = @last = node + else + node.prev = @last + @last.next = node + @last = node + end + end + + @hash[key] = node + value + end + + def delete(key) + if node = @hash[key] + prev_node = node.prev + next_node = node.next + + next_node.prev = prev_node if next_node + prev_node.next = next_node if prev_node + + @first = next_node if @first == node + @last = prev_node if @last == node + + value = node.value + end + + @hash.delete(key) + value + end + + def keys + self.map { |k, v| k } + end + + def values + self.map { |k, v| v } + end + + def each + return unless @first + yield [@first.key, @first.value] + node = @first + yield [node.key, node.value] while node = node.next + self + end + + def merge(other) + hash = self.class.new + + self.each do |key, value| + hash[key] = value + end + + other.each do |key, value| + hash[key] = value + end + + hash + end + + def empty? + @hash.empty? + end + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb new file mode 100644 index 0000000000..f9b31a35d1 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb @@ -0,0 +1,27 @@ +class Thor + # Thor::Error is raised when it's caused by wrong usage of thor classes. Those + # errors have their backtrace supressed and are nicely shown to the user. + # + # Errors that are caused by the developer, like declaring a method which + # overwrites a thor keyword, it SHOULD NOT raise a Thor::Error. This way, we + # ensure that developer errors are shown with full backtrace. + # + class Error < StandardError + end + + # Raised when a task was not found. + # + class UndefinedTaskError < Error + end + + # Raised when a task was found, but not invoked properly. + # + class InvocationError < Error + end + + class RequiredArgumentMissingError < InvocationError + end + + class MalformattedArgumentError < InvocationError + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb new file mode 100644 index 0000000000..1e59df2313 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb @@ -0,0 +1,263 @@ +# Thor has a special class called Thor::Group. The main difference to Thor class +# is that it invokes all tasks at once. It also include some methods that allows +# invocations to be done at the class method, which are not available to Thor +# tasks. +# +class Thor::Group + class << self + # The descrition for this Thor::Group. If none is provided, but a source root + # exists, tries to find the USAGE one folder above it, otherwise searches + # in the superclass. + # + # ==== Parameters + # description:: The description for this Thor::Group. + # + def desc(description=nil) + case description + when nil + @desc ||= from_superclass(:desc, nil) + else + @desc = description + end + end + + # Start works differently in Thor::Group, it simply invokes all tasks + # inside the class. + # + def start(given_args=ARGV, config={}) + super do + if Thor::HELP_MAPPINGS.include?(given_args.first) + help(config[:shell]) + return + end + + args, opts = Thor::Options.split(given_args) + new(args, opts, config).invoke + end + end + + # Prints help information. + # + # ==== Options + # short:: When true, shows only usage. + # + def help(shell, options={}) + if options[:short] + shell.say banner + else + shell.say "Usage:" + shell.say " #{banner}" + shell.say + class_options_help(shell) + shell.say self.desc if self.desc + end + end + + # Stores invocations for this class merging with superclass values. + # + def invocations #:nodoc: + @invocations ||= from_superclass(:invocations, {}) + end + + # Stores invocation blocks used on invoke_from_option. + # + def invocation_blocks #:nodoc: + @invocation_blocks ||= from_superclass(:invocation_blocks, {}) + end + + # Invoke the given namespace or class given. It adds an instance + # method that will invoke the klass and task. You can give a block to + # configure how it will be invoked. + # + # The namespace/class given will have its options showed on the help + # usage. Check invoke_from_option for more information. + # + def invoke(*names, &block) + options = names.last.is_a?(Hash) ? names.pop : {} + verbose = options.fetch(:verbose, :white) + + names.each do |name| + invocations[name] = false + invocation_blocks[name] = block if block_given? + + class_eval <<-METHOD, __FILE__, __LINE__ + def _invoke_#{name.to_s.gsub(/\W/, '_')} + klass, task = self.class.prepare_for_invocation(nil, #{name.inspect}) + + if klass + say_status :invoke, #{name.inspect}, #{verbose.inspect} + block = self.class.invocation_blocks[#{name.inspect}] + _invoke_for_class_method klass, task, &block + else + say_status :error, %(#{name.inspect} [not found]), :red + end + end + METHOD + end + end + + # Invoke a thor class based on the value supplied by the user to the + # given option named "name". A class option must be created before this + # method is invoked for each name given. + # + # ==== Examples + # + # class GemGenerator < Thor::Group + # class_option :test_framework, :type => :string + # invoke_from_option :test_framework + # end + # + # ==== Boolean options + # + # In some cases, you want to invoke a thor class if some option is true or + # false. This is automatically handled by invoke_from_option. Then the + # option name is used to invoke the generator. + # + # ==== Preparing for invocation + # + # In some cases you want to customize how a specified hook is going to be + # invoked. You can do that by overwriting the class method + # prepare_for_invocation. The class method must necessarily return a klass + # and an optional task. + # + # ==== Custom invocations + # + # You can also supply a block to customize how the option is giong to be + # invoked. The block receives two parameters, an instance of the current + # class and the klass to be invoked. + # + def invoke_from_option(*names, &block) + options = names.last.is_a?(Hash) ? names.pop : {} + verbose = options.fetch(:verbose, :white) + + names.each do |name| + unless class_options.key?(name) + raise ArgumentError, "You have to define the option #{name.inspect} " << + "before setting invoke_from_option." + end + + invocations[name] = true + invocation_blocks[name] = block if block_given? + + class_eval <<-METHOD, __FILE__, __LINE__ + def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')} + return unless options[#{name.inspect}] + + value = options[#{name.inspect}] + value = #{name.inspect} if TrueClass === value + klass, task = self.class.prepare_for_invocation(#{name.inspect}, value) + + if klass + say_status :invoke, value, #{verbose.inspect} + block = self.class.invocation_blocks[#{name.inspect}] + _invoke_for_class_method klass, task, &block + else + say_status :error, %(\#{value} [not found]), :red + end + end + METHOD + end + end + + # Remove a previously added invocation. + # + # ==== Examples + # + # remove_invocation :test_framework + # + def remove_invocation(*names) + names.each do |name| + remove_task(name) + remove_class_option(name) + invocations.delete(name) + invocation_blocks.delete(name) + end + end + + # Overwrite class options help to allow invoked generators options to be + # shown recursively when invoking a generator. + # + def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: + group_options = {} + + get_options_from_invocations(group_options, class_options) do |klass| + klass.send(:get_options_from_invocations, group_options, class_options) + end + + group_options.merge!(extra_group) if extra_group + super(shell, ungrouped_name, group_options) + end + + # Get invocations array and merge options from invocations. Those + # options are added to group_options hash. Options that already exists + # in base_options are not added twice. + # + def get_options_from_invocations(group_options, base_options) #:nodoc: + invocations.each do |name, from_option| + value = if from_option + option = class_options[name] + option.type == :boolean ? name : option.default + else + name + end + next unless value + + klass, task = prepare_for_invocation(name, value) + next unless klass && klass.respond_to?(:class_options) + + value = value.to_s + human_name = value.respond_to?(:classify) ? value.classify : value + + group_options[human_name] ||= [] + group_options[human_name] += klass.class_options.values.select do |option| + base_options[option.name.to_sym].nil? && option.group.nil? && + !group_options.values.flatten.any? { |i| i.name == option.name } + end + + yield klass if block_given? + end + end + + protected + + # The banner for this class. You can customize it if you are invoking the + # thor class by another ways which is not the Thor::Runner. + # + def banner + "#{self.namespace} #{self.arguments.map {|a| a.usage }.join(' ')}" + end + + def baseclass #:nodoc: + Thor::Group + end + + def create_task(meth) #:nodoc: + tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) + true + end + end + + include Thor::Base + + protected + + # Shortcut to invoke with padding and block handling. Use internally by + # invoke and invoke_from_option class methods. + # + def _invoke_for_class_method(klass, task=nil, *args, &block) #:nodoc: + shell.padding += 1 + + result = if block_given? + if block.arity == 2 + block.call(self, klass) + else + block.call(self, klass, task) + end + else + invoke klass, task, *args + end + + shell.padding -= 1 + result + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb new file mode 100644 index 0000000000..32e6a72454 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb @@ -0,0 +1,178 @@ +class Thor + module Invocation + def self.included(base) #:nodoc: + base.extend ClassMethods + end + + module ClassMethods + # Prepare for class methods invocations. This method must return a klass to + # have the invoked class options showed in help messages in generators. + # + def prepare_for_invocation(key, name) #:nodoc: + case name + when Symbol, String + Thor::Util.namespace_to_thor_class_and_task(name.to_s, false) + else + name + end + end + end + + # Make initializer aware of invocations and the initializer proc. + # + def initialize(args=[], options={}, config={}, &block) #:nodoc: + @_invocations = config[:invocations] || Hash.new { |h,k| h[k] = [] } + @_initializer = [ args, options, config ] + super + end + + # Receives a name and invokes it. The name can be a string (either "task" or + # "namespace:task"), a Thor::Task, a Class or a Thor instance. If the task + # cannot be guessed by name, it can also be supplied as second argument. + # + # You can also supply the arguments, options and configuration values for + # the task to be invoked, if none is given, the same values used to + # initialize the invoker are used to initialize the invoked. + # + # ==== Examples + # + # class A < Thor + # def foo + # invoke :bar + # invoke "b:hello", ["José"] + # end + # + # def bar + # invoke "b:hello", ["José"] + # end + # end + # + # class B < Thor + # def hello(name) + # puts "hello #{name}" + # end + # end + # + # You can notice that the method "foo" above invokes two tasks: "bar", + # which belongs to the same class and "hello" which belongs to the class B. + # + # By using an invocation system you ensure that a task is invoked only once. + # In the example above, invoking "foo" will invoke "b:hello" just once, even + # if it's invoked later by "bar" method. + # + # When class A invokes class B, all arguments used on A initialization are + # supplied to B. This allows lazy parse of options. Let's suppose you have + # some rspec tasks: + # + # class Rspec < Thor::Group + # class_option :mock_framework, :type => :string, :default => :rr + # + # def invoke_mock_framework + # invoke "rspec:#{options[:mock_framework]}" + # end + # end + # + # As you noticed, it invokes the given mock framework, which might have its + # own options: + # + # class Rspec::RR < Thor::Group + # class_option :style, :type => :string, :default => :mock + # end + # + # Since it's not rspec concern to parse mock framework options, when RR + # is invoked all options are parsed again, so RR can extract only the options + # that it's going to use. + # + # If you want Rspec::RR to be initialized with its own set of options, you + # have to do that explicitely: + # + # invoke "rspec:rr", [], :style => :foo + # + # Besides giving an instance, you can also give a class to invoke: + # + # invoke Rspec::RR, [], :style => :foo + # + def invoke(name=nil, task=nil, args=nil, opts=nil, config=nil) + task, args, opts, config = nil, task, args, opts if task.nil? || task.is_a?(Array) + args, opts, config = nil, args, opts if args.is_a?(Hash) + + object, task = _prepare_for_invocation(name, task) + klass, instance = _initialize_klass_with_initializer(object, args, opts, config) + + method_args = [] + current = @_invocations[klass] + + iterator = proc do |_, task| + unless current.include?(task.name) + current << task.name + task.run(instance, method_args) + end + end + + if task + args ||= [] + method_args = args[Range.new(klass.arguments.size, -1)] || [] + iterator.call(nil, task) + else + klass.all_tasks.map(&iterator) + end + end + + protected + + # Configuration values that are shared between invocations. + # + def _shared_configuration #:nodoc: + { :invocations => @_invocations } + end + + # Prepare for invocation in the instance level. In this case, we have to + # take into account that a just a task name from the current class was + # given or even a Thor::Task object. + # + def _prepare_for_invocation(name, sent_task=nil) #:nodoc: + if name.is_a?(Thor::Task) + task = name + elsif task = self.class.all_tasks[name.to_s] + object = self + else + object, task = self.class.prepare_for_invocation(nil, name) + task ||= sent_task + end + + # If the object was not set, use self and use the name as task. + object, task = self, name unless object + return object, _validate_task(object, task) + end + + # Check if the object given is a Thor class object and get a task object + # for it. + # + def _validate_task(object, task) #:nodoc: + klass = object.is_a?(Class) ? object : object.class + raise "Expected Thor class, got #{klass}" unless klass <= Thor::Base + + task ||= klass.default_task if klass <= Thor + task = klass.all_tasks[task.to_s] || Thor::Task::Dynamic.new(task) if task && !task.is_a?(Thor::Task) + task + end + + # Initialize klass using values stored in the @_initializer. + # + def _initialize_klass_with_initializer(object, args, opts, config) #:nodoc: + if object.is_a?(Class) + klass = object + + stored_args, stored_opts, stored_config = @_initializer + args ||= stored_args.dup + opts ||= stored_opts.dup + + config ||= {} + config = stored_config.merge(_shared_configuration).merge!(config) + [ klass, klass.new(args, opts, config) ] + else + [ object.class, object ] + end + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb new file mode 100644 index 0000000000..57a3f6e1a5 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb @@ -0,0 +1,4 @@ +require 'thor/parser/argument' +require 'thor/parser/arguments' +require 'thor/parser/option' +require 'thor/parser/options' diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb new file mode 100644 index 0000000000..aa8ace4719 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb @@ -0,0 +1,67 @@ +class Thor + class Argument #:nodoc: + VALID_TYPES = [ :numeric, :hash, :array, :string ] + + attr_reader :name, :description, :required, :type, :default, :banner + alias :human_name :name + + def initialize(name, description=nil, required=true, type=:string, default=nil, banner=nil) + class_name = self.class.name.split("::").last + + raise ArgumentError, "#{class_name} name can't be nil." if name.nil? + raise ArgumentError, "Type :#{type} is not valid for #{class_name.downcase}s." if type && !valid_type?(type) + + @name = name.to_s + @description = description + @required = required || false + @type = (type || :string).to_sym + @default = default + @banner = banner || default_banner + + validate! # Trigger specific validations + end + + def usage + required? ? banner : "[#{banner}]" + end + + def required? + required + end + + def show_default? + case default + when Array, String, Hash + !default.empty? + else + default + end + end + + protected + + def validate! + raise ArgumentError, "An argument cannot be required and have default value." if required? && !default.nil? + end + + def valid_type?(type) + VALID_TYPES.include?(type.to_sym) + end + + def default_banner + case type + when :boolean + nil + when :string, :default + human_name.upcase + when :numeric + "N" + when :hash + "key:value" + when :array + "one two three" + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb new file mode 100644 index 0000000000..fb5d965e06 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb @@ -0,0 +1,145 @@ +class Thor + class Arguments #:nodoc: + NUMERIC = /(\d*\.\d+|\d+)/ + + # Receives an array of args and returns two arrays, one with arguments + # and one with switches. + # + def self.split(args) + arguments = [] + + args.each do |item| + break if item =~ /^-/ + arguments << item + end + + return arguments, args[Range.new(arguments.size, -1)] + end + + def self.parse(base, args) + new(base).parse(args) + end + + # Takes an array of Thor::Argument objects. + # + def initialize(arguments=[]) + @assigns, @non_assigned_required = {}, [] + @switches = arguments + + arguments.each do |argument| + if argument.default + @assigns[argument.human_name] = argument.default + elsif argument.required? + @non_assigned_required << argument + end + end + end + + def parse(args) + @pile = args.dup + + @switches.each do |argument| + break unless peek + @non_assigned_required.delete(argument) + @assigns[argument.human_name] = send(:"parse_#{argument.type}", argument.human_name) + end + + check_requirement! + @assigns + end + + private + + def peek + @pile.first + end + + def shift + @pile.shift + end + + def unshift(arg) + unless arg.kind_of?(Array) + @pile.unshift(arg) + else + @pile = arg + @pile + end + end + + def current_is_value? + peek && peek.to_s !~ /^-/ + end + + # Runs through the argument array getting strings that contains ":" and + # mark it as a hash: + # + # [ "name:string", "age:integer" ] + # + # Becomes: + # + # { "name" => "string", "age" => "integer" } + # + def parse_hash(name) + return shift if peek.is_a?(Hash) + hash = {} + + while current_is_value? && peek.include?(?:) + key, value = shift.split(':') + hash[key] = value + end + hash + end + + # Runs through the argument array getting all strings until no string is + # found or a switch is found. + # + # ["a", "b", "c"] + # + # And returns it as an array: + # + # ["a", "b", "c"] + # + def parse_array(name) + return shift if peek.is_a?(Array) + array = [] + + while current_is_value? + array << shift + end + array + end + + # Check if the peel is numeric ofrmat and return a Float or Integer. + # Otherwise raises an error. + # + def parse_numeric(name) + return shift if peek.is_a?(Numeric) + + unless peek =~ NUMERIC && $& == peek + raise MalformattedArgumentError, "expected numeric value for '#{name}'; got #{peek.inspect}" + end + + $&.index('.') ? shift.to_f : shift.to_i + end + + # Parse string, i.e., just return the current value in the pile. + # + def parse_string(name) + shift + end + + # Raises an error if @non_assigned_required array is not empty. + # + def check_requirement! + unless @non_assigned_required.empty? + names = @non_assigned_required.map do |o| + o.respond_to?(:switch_name) ? o.switch_name : o.human_name + end.join("', '") + + class_name = self.class.name.split('::').last.downcase + raise RequiredArgumentMissingError, "no value provided for required #{class_name} '#{names}'" + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb new file mode 100644 index 0000000000..9e40ec73fa --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb @@ -0,0 +1,132 @@ +class Thor + class Option < Argument #:nodoc: + attr_reader :aliases, :group + + VALID_TYPES = [:boolean, :numeric, :hash, :array, :string] + + def initialize(name, description=nil, required=nil, type=nil, default=nil, banner=nil, group=nil, aliases=nil) + super(name, description, required, type, default, banner) + @aliases = [*aliases].compact + @group = group.to_s.capitalize if group + end + + # This parse quick options given as method_options. It makes several + # assumptions, but you can be more specific using the option method. + # + # parse :foo => "bar" + # #=> Option foo with default value bar + # + # parse [:foo, :baz] => "bar" + # #=> Option foo with default value bar and alias :baz + # + # parse :foo => :required + # #=> Required option foo without default value + # + # parse :foo => 2 + # #=> Option foo with default value 2 and type numeric + # + # parse :foo => :numeric + # #=> Option foo without default value and type numeric + # + # parse :foo => true + # #=> Option foo with default value true and type boolean + # + # The valid types are :boolean, :numeric, :hash, :array and :string. If none + # is given a default type is assumed. This default type accepts arguments as + # string (--foo=value) or booleans (just --foo). + # + # By default all options are optional, unless :required is given. + # + def self.parse(key, value) + if key.is_a?(Array) + name, *aliases = key + else + name, aliases = key, [] + end + + name = name.to_s + default = value + + type = case value + when Symbol + default = nil + + if VALID_TYPES.include?(value) + value + elsif required = (value == :required) + :string + elsif value == :optional + # TODO Remove this warning in the future. + warn "Optional type is deprecated. Choose :boolean or :string instead. Assumed to be :boolean." + :boolean + end + when TrueClass, FalseClass + :boolean + when Numeric + :numeric + when Hash, Array, String + value.class.name.downcase.to_sym + end + + self.new(name.to_s, nil, required, type, default, nil, nil, aliases) + end + + def switch_name + @switch_name ||= dasherized? ? name : dasherize(name) + end + + def human_name + @human_name ||= dasherized? ? undasherize(name) : name + end + + def usage(padding=0) + sample = if banner && !banner.to_s.empty? + "#{switch_name}=#{banner}" + else + switch_name + end + + sample = "[#{sample}]" unless required? + + if aliases.empty? + (" " * padding) << sample + else + "#{aliases.join(', ')}, #{sample}" + end + end + + # Allow some type predicates as: boolean?, string? and etc. + # + def method_missing(method, *args, &block) + given = method.to_s.sub(/\?$/, '').to_sym + if valid_type?(given) + self.type == given + else + super + end + end + + protected + + def validate! + raise ArgumentError, "An option cannot be boolean and required." if boolean? && required? + end + + def valid_type?(type) + VALID_TYPES.include?(type.to_sym) + end + + def dasherized? + name.index('-') == 0 + end + + def undasherize(str) + str.sub(/^-{1,2}/, '') + end + + def dasherize(str) + (str.length > 1 ? "--" : "-") + str.gsub('_', '-') + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb new file mode 100644 index 0000000000..75092308b5 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb @@ -0,0 +1,142 @@ +class Thor + # This is a modified version of Daniel Berger's Getopt::Long class, licensed + # under Ruby's license. + # + class Options < Arguments #:nodoc: + LONG_RE = /^(--\w+[-\w+]*)$/ + SHORT_RE = /^(-[a-z])$/i + EQ_RE = /^(--\w+[-\w+]*|-[a-z])=(.*)$/i + SHORT_SQ_RE = /^-([a-z]{2,})$/i # Allow either -x -v or -xv style for single char args + SHORT_NUM = /^(-[a-z])#{NUMERIC}$/i + + # Receives a hash and makes it switches. + # + def self.to_switches(options) + options.map do |key, value| + case value + when true + "--#{key}" + when Array + "--#{key} #{value.map{ |v| v.inspect }.join(' ')}" + when Hash + "--#{key} #{value.map{ |k,v| "#{k}:#{v}" }.join(' ')}" + when nil, false + "" + else + "--#{key} #{value.inspect}" + end + end.join(" ") + end + + # Takes a hash of Thor::Option objects. + # + def initialize(options={}) + options = options.values + super(options) + @shorts, @switches = {}, {} + + options.each do |option| + @switches[option.switch_name] = option + + option.aliases.each do |short| + @shorts[short.to_s] ||= option.switch_name + end + end + end + + def parse(args) + @pile = args.dup + + while peek + if current_is_switch? + case shift + when SHORT_SQ_RE + unshift($1.split('').map { |f| "-#{f}" }) + next + when EQ_RE, SHORT_NUM + unshift($2) + switch = $1 + when LONG_RE, SHORT_RE + switch = $1 + end + + switch = normalize_switch(switch) + next unless option = switch_option(switch) + + @assigns[option.human_name] = parse_peek(switch, option) + else + shift + end + end + + check_requirement! + @assigns + end + + protected + + # Returns true if the current value in peek is a registered switch. + # + def current_is_switch? + case peek + when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM + switch?($1) + when SHORT_SQ_RE + $1.split('').any? { |f| switch?("-#{f}") } + end + end + + def switch?(arg) + switch_option(arg) || @shorts.key?(arg) + end + + def switch_option(arg) + if match = no_or_skip?(arg) + @switches[arg] || @switches["--#{match}"] + else + @switches[arg] + end + end + + def no_or_skip?(arg) + arg =~ /^--(no|skip)-([-\w]+)$/ + $2 + end + + # Check if the given argument is actually a shortcut. + # + def normalize_switch(arg) + @shorts.key?(arg) ? @shorts[arg] : arg + end + + # Parse boolean values which can be given as --foo=true, --foo or --no-foo. + # + def parse_boolean(switch) + if current_is_value? + ["true", "TRUE", "t", "T", true].include?(shift) + else + @switches.key?(switch) || !no_or_skip?(switch) + end + end + + # Parse the value at the peek analyzing if it requires an input or not. + # + def parse_peek(switch, option) + unless current_is_value? + if option.boolean? + # No problem for boolean types + elsif no_or_skip?(switch) + return nil # User set value to nil + elsif option.string? && !option.required? + return option.human_name # Return the option name + else + raise MalformattedArgumentError, "no value provided for option '#{switch}'" + end + end + + @non_assigned_required.delete(option) + send(:"parse_#{option.type}", switch) + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb new file mode 100644 index 0000000000..0d0757fdda --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb @@ -0,0 +1,66 @@ +require 'rake' + +class Thor + # Adds a compatibility layer to your Thor classes which allows you to use + # rake package tasks. For example, to use rspec rake tasks, one can do: + # + # require 'thor/rake_compat' + # + # class Default < Thor + # include Thor::RakeCompat + # + # Spec::Rake::SpecTask.new(:spec) do |t| + # t.spec_opts = ['--options', "spec/spec.opts"] + # t.spec_files = FileList['spec/**/*_spec.rb'] + # end + # end + # + module RakeCompat + def self.rake_classes + @rake_classes ||= [] + end + + def self.included(base) + # Hack. Make rakefile point to invoker, so rdoc task is generated properly. + rakefile = File.basename(caller[0].match(/(.*):\d+/)[1]) + Rake.application.instance_variable_set(:@rakefile, rakefile) + self.rake_classes << base + end + end +end + +class Object #:nodoc: + alias :rake_task :task + alias :rake_namespace :namespace + + def task(*args, &block) + task = rake_task(*args, &block) + + if klass = Thor::RakeCompat.rake_classes.last + non_namespaced_name = task.name.split(':').last + + description = non_namespaced_name + description << task.arg_names.map{ |n| n.to_s.upcase }.join(' ') + description.strip! + + klass.desc description, task.comment || non_namespaced_name + klass.send :define_method, non_namespaced_name do |*args| + Rake::Task[task.name.to_sym].invoke(*args) + end + end + + task + end + + def namespace(name, &block) + if klass = Thor::RakeCompat.rake_classes.last + const_name = Thor::Util.camel_case(name.to_s).to_sym + klass.const_set(const_name, Class.new(Thor)) + new_klass = klass.const_get(const_name) + Thor::RakeCompat.rake_classes << new_klass + end + + rake_namespace(name, &block) + Thor::RakeCompat.rake_classes.pop + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb new file mode 100644 index 0000000000..9dc70ea069 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb @@ -0,0 +1,299 @@ +require 'fileutils' +require 'open-uri' +require 'yaml' +require 'digest/md5' +require 'pathname' + +class Thor::Runner < Thor #:nodoc: + map "-T" => :list, "-i" => :install, "-u" => :update + + # Override Thor#help so it can give information about any class and any method. + # + def help(meth=nil) + if meth && !self.respond_to?(meth) + initialize_thorfiles(meth) + klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) + # Send mapping -h because it works with Thor::Group too + klass.start(["-h", task].compact, :shell => self.shell) + else + super + end + end + + # If a task is not found on Thor::Runner, method missing is invoked and + # Thor::Runner is then responsable for finding the task in all classes. + # + def method_missing(meth, *args) + meth = meth.to_s + initialize_thorfiles(meth) + klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) + args.unshift(task) if task + klass.start(args, :shell => shell) + end + + desc "install NAME", "Install an optionally named Thor file into your system tasks" + method_options :as => :string, :relative => :boolean + def install(name) + initialize_thorfiles + + # If a directory name is provided as the argument, look for a 'main.thor' + # task in said directory. + begin + if File.directory?(File.expand_path(name)) + base, package = File.join(name, "main.thor"), :directory + contents = open(base).read + else + base, package = name, :file + contents = open(name).read + end + rescue OpenURI::HTTPError + raise Error, "Error opening URI '#{name}'" + rescue Errno::ENOENT + raise Error, "Error opening file '#{name}'" + end + + say "Your Thorfile contains:" + say contents + + return false if no?("Do you wish to continue [y/N]?") + + as = options["as"] || begin + first_line = contents.split("\n")[0] + (match = first_line.match(/\s*#\s*module:\s*([^\n]*)/)) ? match[1].strip : nil + end + + unless as + basename = File.basename(name) + as = ask("Please specify a name for #{name} in the system repository [#{basename}]:") + as = basename if as.empty? + end + + location = if options[:relative] || name =~ /^http:\/\// + name + else + File.expand_path(name) + end + + thor_yaml[as] = { + :filename => Digest::MD5.hexdigest(name + as), + :location => location, + :namespaces => Thor::Util.namespaces_in_content(contents, base) + } + + save_yaml(thor_yaml) + say "Storing thor file in your system repository" + destination = File.join(thor_root, thor_yaml[as][:filename]) + + if package == :file + File.open(destination, "w") { |f| f.puts contents } + else + FileUtils.cp_r(name, destination) + end + + thor_yaml[as][:filename] # Indicate success + end + + desc "uninstall NAME", "Uninstall a named Thor module" + def uninstall(name) + raise Error, "Can't find module '#{name}'" unless thor_yaml[name] + say "Uninstalling #{name}." + FileUtils.rm_rf(File.join(thor_root, "#{thor_yaml[name][:filename]}")) + + thor_yaml.delete(name) + save_yaml(thor_yaml) + + puts "Done." + end + + desc "update NAME", "Update a Thor file from its original location" + def update(name) + raise Error, "Can't find module '#{name}'" if !thor_yaml[name] || !thor_yaml[name][:location] + + say "Updating '#{name}' from #{thor_yaml[name][:location]}" + + old_filename = thor_yaml[name][:filename] + self.options = self.options.merge("as" => name) + filename = install(thor_yaml[name][:location]) + + unless filename == old_filename + File.delete(File.join(thor_root, old_filename)) + end + end + + desc "installed", "List the installed Thor modules and tasks" + method_options :internal => :boolean + def installed + initialize_thorfiles(nil, true) + + klasses = Thor::Base.subclasses + klasses -= [Thor, Thor::Runner] unless options["internal"] + + display_klasses(true, klasses) + end + + desc "list [SEARCH]", "List the available thor tasks (--substring means .*SEARCH)" + method_options :substring => :boolean, :group => :string, :all => :boolean + def list(search="") + initialize_thorfiles + + search = ".*#{search}" if options["substring"] + search = /^#{search}.*/i + group = options[:group] || "standard" + + klasses = Thor::Base.subclasses.select do |k| + (options[:all] || k.group == group) && k.namespace =~ search + end + + display_klasses(false, klasses) + end + + private + + def thor_root + Thor::Util.thor_root + end + + def thor_yaml + @thor_yaml ||= begin + yaml_file = File.join(thor_root, "thor.yml") + yaml = YAML.load_file(yaml_file) if File.exists?(yaml_file) + yaml || {} + end + end + + # Save the yaml file. If none exists in thor root, creates one. + # + def save_yaml(yaml) + yaml_file = File.join(thor_root, "thor.yml") + + unless File.exists?(yaml_file) + FileUtils.mkdir_p(thor_root) + yaml_file = File.join(thor_root, "thor.yml") + FileUtils.touch(yaml_file) + end + + File.open(yaml_file, "w") { |f| f.puts yaml.to_yaml } + end + + def self.exit_on_failure? + true + end + + # Load the thorfiles. If relevant_to is supplied, looks for specific files + # in the thor_root instead of loading them all. + # + # By default, it also traverses the current path until find Thor files, as + # described in thorfiles. This look up can be skipped by suppliying + # skip_lookup true. + # + def initialize_thorfiles(relevant_to=nil, skip_lookup=false) + thorfiles(relevant_to, skip_lookup).each do |f| + Thor::Util.load_thorfile(f) unless Thor::Base.subclass_files.keys.include?(File.expand_path(f)) + end + end + + # Finds Thorfiles by traversing from your current directory down to the root + # directory of your system. If at any time we find a Thor file, we stop. + # + # We also ensure that system-wide Thorfiles are loaded first, so local + # Thorfiles can override them. + # + # ==== Example + # + # If we start at /Users/wycats/dev/thor ... + # + # 1. /Users/wycats/dev/thor + # 2. /Users/wycats/dev + # 3. /Users/wycats <-- we find a Thorfile here, so we stop + # + # Suppose we start at c:\Documents and Settings\james\dev\thor ... + # + # 1. c:\Documents and Settings\james\dev\thor + # 2. c:\Documents and Settings\james\dev + # 3. c:\Documents and Settings\james + # 4. c:\Documents and Settings + # 5. c:\ <-- no Thorfiles found! + # + def thorfiles(relevant_to=nil, skip_lookup=false) + # TODO Remove this dealing with deprecated thor when :namespaces: is available as constants + save_yaml(thor_yaml) if Thor::Util.convert_constants_to_namespaces(thor_yaml) + + thorfiles = [] + + unless skip_lookup + Pathname.pwd.ascend do |path| + thorfiles = Thor::Util.globs_for(path).map { |g| Dir[g] }.flatten + break unless thorfiles.empty? + end + end + + files = (relevant_to ? thorfiles_relevant_to(relevant_to) : Thor::Util.thor_root_glob) + files += thorfiles + files -= ["#{thor_root}/thor.yml"] + + files.map! do |file| + File.directory?(file) ? File.join(file, "main.thor") : file + end + end + + # Load thorfiles relevant to the given method. If you provide "foo:bar" it + # will load all thor files in the thor.yaml that has "foo" e "foo:bar" + # namespaces registered. + # + def thorfiles_relevant_to(meth) + lookup = [ meth, meth.split(":")[0...-1].join(":") ] + + files = thor_yaml.select do |k, v| + v[:namespaces] && !(v[:namespaces] & lookup).empty? + end + + files.map { |k, v| File.join(thor_root, "#{v[:filename]}") } + end + + # Display information about the given klasses. If with_module is given, + # it shows a table with information extracted from the yaml file. + # + def display_klasses(with_modules=false, klasses=Thor.subclasses) + klasses -= [Thor, Thor::Runner] unless with_modules + raise Error, "No Thor tasks available" if klasses.empty? + + if with_modules && !thor_yaml.empty? + info = [] + labels = ["Modules", "Namespaces"] + + info << labels + info << [ "-" * labels[0].size, "-" * labels[1].size ] + + thor_yaml.each do |name, hash| + info << [ name, hash[:namespaces].join(", ") ] + end + + print_table info + say "" + end + + unless klasses.empty? + klasses.dup.each do |klass| + klasses -= Thor::Util.thor_classes_in(klass) + end + + klasses.each { |k| display_tasks(k) } + else + say "\033[1;34mNo Thor tasks available\033[0m" + end + end + + # Display tasks from the given Thor class. + # + def display_tasks(klass) + unless klass.tasks.empty? + base = klass.namespace + + color = base == "default" ? :magenta : :blue + say shell.set_color(base, color, true) + say "-" * base.length + + klass.help(shell, :short => true, :ident => 0, :namespace => true) + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb new file mode 100644 index 0000000000..1dc8f0e5b4 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb @@ -0,0 +1,78 @@ +require 'rbconfig' +require 'thor/shell/color' + +class Thor + module Base + # Returns the shell used in all Thor classes. If you are in a Unix platform + # it will use a colored log, otherwise it will use a basic one without color. + # + def self.shell + @shell ||= if Config::CONFIG['host_os'] =~ /mswin|mingw/ + Thor::Shell::Basic + else + Thor::Shell::Color + end + end + + # Sets the shell used in all Thor classes. + # + def self.shell=(klass) + @shell = klass + end + end + + module Shell + SHELL_DELEGATED_METHODS = [:ask, :yes?, :no?, :say, :say_status, :print_list, :print_table] + + # Add shell to initialize config values. + # + # ==== Configuration + # shell:: An instance of the shell to be used. + # + # ==== Examples + # + # class MyScript < Thor + # argument :first, :type => :numeric + # end + # + # MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new + # + def initialize(args=[], options={}, config={}) + super + self.shell = config[:shell] + self.shell.base ||= self if self.shell.respond_to?(:base) + end + + # Holds the shell for the given Thor instance. If no shell is given, + # it gets a default shell from Thor::Base.shell. + # + def shell + @shell ||= Thor::Base.shell.new + end + + # Sets the shell for this thor class. + # + def shell=(shell) + @shell = shell + end + + # Common methods that are delegated to the shell. + # + SHELL_DELEGATED_METHODS.each do |method| + module_eval <<-METHOD, __FILE__, __LINE__ + def #{method}(*args) + shell.#{method}(*args) + end + METHOD + end + + protected + + # Allow shell to be shared between invocations. + # + def _shared_configuration #:nodoc: + super.merge!(:shell => self.shell) + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb new file mode 100644 index 0000000000..ea9665380b --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb @@ -0,0 +1,219 @@ +require 'tempfile' + +class Thor + module Shell + class Basic + attr_accessor :base, :padding + + # Initialize base and padding to nil. + # + def initialize #:nodoc: + @base, @padding = nil, 0 + end + + # Sets the output padding, not allowing less than zero values. + # + def padding=(value) + @padding = [0, value].max + end + + # Ask something to the user and receives a response. + # + # ==== Example + # ask("What is your name?") + # + def ask(statement, color=nil) + say("#{statement} ", color) + $stdin.gets.strip + end + + # Say (print) something to the user. If the sentence ends with a whitespace + # or tab character, a new line is not appended (print + flush). Otherwise + # are passed straight to puts (behavior got from Highline). + # + # ==== Example + # say("I know you knew that.") + # + def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)$/)) + message = message.to_s + message = set_color(message, color) if color + + if force_new_line + $stdout.puts(message) + else + $stdout.print(message) + $stdout.flush + end + end + + # Say a status with the given color and appends the message. Since this + # method is used frequently by actions, it allows nil or false to be given + # in log_status, avoiding the message from being shown. If a Symbol is + # given in log_status, it's used as the color. + # + def say_status(status, message, log_status=true) + return if quiet? || log_status == false + spaces = " " * (padding + 1) + color = log_status.is_a?(Symbol) ? log_status : :green + + status = status.to_s.rjust(12) + status = set_color status, color, true if color + say "#{status}#{spaces}#{message}", nil, true + end + + # Make a question the to user and returns true if the user replies "y" or + # "yes". + # + def yes?(statement, color=nil) + ask(statement, color) =~ is?(:yes) + end + + # Make a question the to user and returns true if the user replies "n" or + # "no". + # + def no?(statement, color=nil) + !yes?(statement, color) + end + + # Prints a list of items. + # + # ==== Parameters + # list + # + # ==== Options + # mode:: Can be :rows or :inline. Defaults to :rows. + # ident:: Ident each item with the value given. + # + def print_list(list, options={}) + return if list.empty? + + ident = " " * (options[:ident] || 0) + content = case options[:mode] + when :inline + last = list.pop + "#{list.join(", ")}, and #{last}" + else # rows + ident + list.join("\n#{ident}") + end + + $stdout.puts content + end + + # Prints a table. + # + # ==== Parameters + # Array[Array[String, String, ...]] + # + # ==== Options + # ident:: Ident the first column by ident value. + # + def print_table(table, options={}) + return if table.empty? + + formats = [] + 0.upto(table.first.length - 2) do |i| + maxima = table.max{ |a,b| a[i].size <=> b[i].size }[i].size + formats << "%-#{maxima + 2}s" + end + + formats[0] = formats[0].insert(0, " " * options[:ident]) if options[:ident] + formats << "%s" + + table.each do |row| + row.each_with_index do |column, i| + $stdout.print formats[i] % column.to_s + end + $stdout.puts + end + end + + # Deals with file collision and returns true if the file should be + # overwriten and false otherwise. If a block is given, it uses the block + # response as the content for the diff. + # + # ==== Parameters + # destination:: the destination file to solve conflicts + # block:: an optional block that returns the value to be used in diff + # + def file_collision(destination) + return true if @always_force + options = block_given? ? "[Ynaqdh]" : "[Ynaqh]" + + while true + answer = ask %[Overwrite #{destination}? (enter "h" for help) #{options}] + + case answer + when is?(:yes), is?(:force) + return true + when is?(:no), is?(:skip) + return false + when is?(:always) + return @always_force = true + when is?(:quit) + say 'Aborting...' + raise SystemExit + when is?(:diff) + show_diff(destination, yield) if block_given? + say 'Retrying...' + else + say file_collision_help + end + end + end + + # Called if something goes wrong during the execution. This is used by Thor + # internally and should not be used inside your scripts. If someone went + # wrong, you can always raise an exception. If you raise a Thor::Error, it + # will be rescued and wrapped in the method below. + # + def error(statement) + $stderr.puts statement + end + + # Apply color to the given string with optional bold. Disabled in the + # Thor::Shell::Basic class. + # + def set_color(string, color, bold=false) #:nodoc: + string + end + + protected + + def is?(value) #:nodoc: + value = value.to_s + + if value.size == 1 + /\A#{value}\z/i + else + /\A(#{value}|#{value[0,1]})\z/i + end + end + + def file_collision_help #:nodoc: +< e + parse_argument_error(instance, e, caller) + rescue NoMethodError => e + parse_no_method_error(instance, e) + end + + # Returns the formatted usage. If a class is given, the class arguments are + # injected in the usage. + # + def formatted_usage(klass=nil, namespace=false, show_options=true) + formatted = if namespace.is_a?(String) + "#{namespace}:" + elsif klass && namespace + "#{klass.namespace.gsub(/^default/,'')}:" + else + "" + end + + formatted << formatted_arguments(klass) + formatted << " #{formatted_options}" if show_options + formatted.strip! + formatted + end + + # Injects the class arguments into the task usage. + # + def formatted_arguments(klass) + if klass && !klass.arguments.empty? + usage.to_s.gsub(/^#{name}/) do |match| + match << " " << klass.arguments.map{ |a| a.usage }.join(' ') + end + else + usage.to_s + end + end + + # Returns the options usage for this task. + # + def formatted_options + @formatted_options ||= options.map{ |_, o| o.usage }.sort.join(" ") + end + + protected + + # Given a target, checks if this class name is not a private/protected method. + # + def public_method?(instance) #:nodoc: + collection = instance.private_methods + instance.protected_methods + (collection & [name.to_s, name.to_sym]).empty? + end + + # Clean everything that comes from the Thor gempath and remove the caller. + # + def sans_backtrace(backtrace, caller) #:nodoc: + dirname = /^#{Regexp.escape(File.dirname(__FILE__))}/ + saned = backtrace.reject { |frame| frame =~ dirname } + saned -= caller + end + + def parse_argument_error(instance, e, caller) #:nodoc: + backtrace = sans_backtrace(e.backtrace, caller) + + if backtrace.empty? && e.message =~ /wrong number of arguments/ + if instance.is_a?(Thor::Group) + raise e, "'#{name}' was called incorrectly. Are you sure it has arity equals to 0?" + else + raise InvocationError, "'#{name}' was called incorrectly. Call as " << + "'#{formatted_usage(instance.class, true)}'" + end + else + raise e + end + end + + def parse_no_method_error(instance, e) #:nodoc: + if e.message =~ /^undefined method `#{name}' for #{Regexp.escape(instance.to_s)}$/ + raise UndefinedTaskError, "The #{instance.class.namespace} namespace " << + "doesn't have a '#{name}' task" + else + raise e + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb new file mode 100644 index 0000000000..ebae0a3193 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb @@ -0,0 +1,251 @@ +require 'rbconfig' + +class Thor + module Sandbox #:nodoc: + end + + # This module holds several utilities: + # + # 1) Methods to convert thor namespaces to constants and vice-versa. + # + # Thor::Utils.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz" + # + # 2) Loading thor files and sandboxing: + # + # Thor::Utils.load_thorfile("~/.thor/foo") + # + module Util + + # Receives a namespace and search for it in the Thor::Base subclasses. + # + # ==== Parameters + # namespace:: The namespace to search for. + # + def self.find_by_namespace(namespace) + namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/ + + Thor::Base.subclasses.find do |klass| + klass.namespace == namespace + end + end + + # Receives a constant and converts it to a Thor namespace. Since Thor tasks + # can be added to a sandbox, this method is also responsable for removing + # the sandbox namespace. + # + # This method should not be used in general because it's used to deal with + # older versions of Thor. On current versions, if you need to get the + # namespace from a class, just call namespace on it. + # + # ==== Parameters + # constant:: The constant to be converted to the thor path. + # + # ==== Returns + # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz" + # + def self.namespace_from_thor_class(constant, remove_default=true) + constant = constant.to_s.gsub(/^Thor::Sandbox::/, "") + constant = snake_case(constant).squeeze(":") + constant.gsub!(/^default/, '') if remove_default + constant + end + + # Given the contents, evaluate it inside the sandbox and returns the + # namespaces defined in the sandbox. + # + # ==== Parameters + # contents + # + # ==== Returns + # Array[Object] + # + def self.namespaces_in_content(contents, file=__FILE__) + old_constants = Thor::Base.subclasses.dup + Thor::Base.subclasses.clear + + load_thorfile(file, contents) + + new_constants = Thor::Base.subclasses.dup + Thor::Base.subclasses.replace(old_constants) + + new_constants.map!{ |c| c.namespace } + new_constants.compact! + new_constants + end + + # Returns the thor classes declared inside the given class. + # + def self.thor_classes_in(klass) + Thor::Base.subclasses.select do |subclass| + klass.constants.include?(subclass.name.gsub("#{klass.name}::", '')) + end + end + + # Receives a string and convert it to snake case. SnakeCase returns snake_case. + # + # ==== Parameters + # String + # + # ==== Returns + # String + # + def self.snake_case(str) + return str.downcase if str =~ /^[A-Z_]+$/ + str.gsub(/\B[A-Z]/, '_\&').squeeze('_') =~ /_*(.*)/ + return $+.downcase + end + + # Receives a string and convert it to camel case. camel_case returns CamelCase. + # + # ==== Parameters + # String + # + # ==== Returns + # String + # + def self.camel_case(str) + return str if str !~ /_/ && str =~ /[A-Z]+.*/ + str.split('_').map { |i| i.capitalize }.join + end + + # Receives a namespace and tries to retrieve a Thor or Thor::Group class + # from it. It first searches for a class using the all the given namespace, + # if it's not found, removes the highest entry and searches for the class + # again. If found, returns the highest entry as the class name. + # + # ==== Examples + # + # class Foo::Bar < Thor + # def baz + # end + # end + # + # class Baz::Foo < Thor::Group + # end + # + # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default task + # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil + # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz" + # + # ==== Parameters + # namespace + # + # ==== Errors + # Thor::Error:: raised if the namespace cannot be found. + # + # Thor::Error:: raised if the namespace evals to a class which does not + # inherit from Thor or Thor::Group. + # + def self.namespace_to_thor_class_and_task(namespace, raise_if_nil=true) + if namespace.include?(?:) + pieces = namespace.split(":") + task = pieces.pop + klass = Thor::Util.find_by_namespace(pieces.join(":")) + end + + unless klass + klass, task = Thor::Util.find_by_namespace(namespace), nil + end + + raise Error, "could not find Thor class or task '#{namespace}'" if raise_if_nil && klass.nil? + return klass, task + end + + # Receives a path and load the thor file in the path. The file is evaluated + # inside the sandbox to avoid namespacing conflicts. + # + def self.load_thorfile(path, content=nil) + content ||= File.read(path) + + begin + Thor::Sandbox.class_eval(content, path) + rescue Exception => e + $stderr.puts "WARNING: unable to load thorfile #{path.inspect}: #{e.message}" + end + end + + # Receives a yaml (hash) and updates all constants entries to namespace. + # This was added to deal with deprecated versions of Thor. + # + # TODO Deprecate this method in the future. + # + # ==== Returns + # TrueClass|FalseClass:: Returns true if any change to the yaml file was made. + # + def self.convert_constants_to_namespaces(yaml) + yaml_changed = false + + yaml.each do |k, v| + next unless v[:constants] && v[:namespaces].nil? + yaml_changed = true + yaml[k][:namespaces] = v[:constants].map{|c| Thor::Util.namespace_from_thor_class(c)} + end + + yaml_changed + end + + def self.user_home + @@user_home ||= if ENV["HOME"] + ENV["HOME"] + elsif ENV["USERPROFILE"] + ENV["USERPROFILE"] + elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"] + File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]) + elsif ENV["APPDATA"] + ENV["APPDATA"] + else + begin + File.expand_path("~") + rescue + if File::ALT_SEPARATOR + "C:/" + else + "/" + end + end + end + end + + # Returns the root where thor files are located, dependending on the OS. + # + def self.thor_root + File.join(user_home, ".thor").gsub(/\\/, '/') + end + + # Returns the files in the thor root. On Windows thor_root will be something + # like this: + # + # C:\Documents and Settings\james\.thor + # + # If we don't #gsub the \ character, Dir.glob will fail. + # + def self.thor_root_glob + files = Dir["#{thor_root}/*"] + + files.map! do |file| + File.directory?(file) ? File.join(file, "main.thor") : file + end + end + + # Where to look for Thor files. + # + def self.globs_for(path) + ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"] + end + + # Return the path to the ruby interpreter taking into account multiple + # installations and windows extensions. + # + def self.ruby_command + @ruby_command ||= begin + ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + ruby << Config::CONFIG['EXEEXT'] + + # escape string in case path to ruby executable contain spaces. + ruby.sub!(/.*\s.*/m, '"\&"') + ruby + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb new file mode 100644 index 0000000000..885230fac4 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb @@ -0,0 +1,3 @@ +class Thor + VERSION = "0.11.8".freeze +end -- cgit v1.2.3 From da62a7c5362ee76e8fdc8cb942c4c1eefccfeab0 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Tue, 27 Oct 2009 16:46:45 -0700 Subject: Duplicate AS code no longer needed --- railties/lib/rails/configuration.rb | 7 ++++--- railties/lib/rails/core.rb | 32 -------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 1a7483c548..0a545f23de 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -1,5 +1,6 @@ require 'rails/plugin/loader' require 'rails/plugin/locator' +require 'active_support/ordered_options' module Rails class Configuration @@ -23,9 +24,9 @@ module Rails @serve_static_assets = true for framework in frameworks - self.send("#{framework}=", Rails::OrderedOptions.new) + self.send("#{framework}=", ActiveSupport::OrderedOptions.new) end - self.active_support = Rails::OrderedOptions.new + self.active_support = ActiveSupport::OrderedOptions.new end def after_initialize(&blk) @@ -218,7 +219,7 @@ module Rails def i18n @i18n ||= begin - i18n = Rails::OrderedOptions.new + i18n = ActiveSupport::OrderedOptions.new i18n.load_path = [] if File.exist?(File.join(root, 'config', 'locales')) diff --git a/railties/lib/rails/core.rb b/railties/lib/rails/core.rb index 6e7f912e6d..a5e51ad04a 100644 --- a/railties/lib/rails/core.rb +++ b/railties/lib/rails/core.rb @@ -70,36 +70,4 @@ module Rails @@public_path = path end end - - class OrderedOptions < Array #:nodoc: - def []=(key, value) - key = key.to_sym - - if pair = find_pair(key) - pair.pop - pair << value - else - self << [key, value] - end - end - - def [](key) - pair = find_pair(key.to_sym) - pair ? pair.last : nil - end - - def method_missing(name, *args) - if name.to_s =~ /(.*)=$/ - self[$1.to_sym] = args.first - else - self[name] - end - end - - private - def find_pair(key) - self.each { |i| return i if i.first == key } - return false - end - end end \ No newline at end of file -- cgit v1.2.3 From df95f165708b6baf93dcc6eff6911ee159cab34c Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Tue, 27 Oct 2009 16:48:35 -0700 Subject: Update initializable --- railties/lib/rails/initializable.rb | 110 +++++++++++++++++++----------------- railties/test/initializable_test.rb | 95 +++++++++++++++++++++++++++---- 2 files changed, 144 insertions(+), 61 deletions(-) diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index 4bd5088207..affa29239f 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -1,78 +1,86 @@ module Rails module Initializable - - # A collection of initializers - class Collection - def initialize(context) - @context = context - @keys = [] - @values = {} - @ran = false + def self.included(klass) + klass.instance_eval do + extend Rails::Initializable + extend Rails::Initializable::ClassMethodsWhenIncluded + include Rails::Initializable::InstanceMethodsWhenIncluded end + end - def run - return self if @ran - each do |key, initializer| - @context.class_eval(&initializer.block) - end - @ran = true - self - end + def self.extended(klass) + klass.extend Initializer + end - def [](key) - keys, values = merge_with_parent - values[key.to_sym] + class Collection < Array + def initialize(klasses) + klasses.each do |klass| + klass.added_initializers.each do |initializer| + index = if initializer.before + index_for(initializer.before) + elsif initializer.after + index_for(initializer.after) + 1 + else + length + end + + insert(index, initializer) + end + end end - def []=(key, value) - key = key.to_sym - @keys |= [key] - @values[key] = value + def index_for(name) + inst = find {|i| i.name == name } + inst && index(inst) end - def each - keys, values = merge_with_parent - keys.each { |k| yield k, values[k] } - self - end + end - protected + attr_reader :added_initializers - attr_reader :keys, :values + # When you include Rails::Initializable, this method will be on instances + # of the class included into. When you extend it, it will be on the + # class or module itself. + # + # The #initializers method is set up to return the right list of + # initializers for the context in question. + def initialize! + return if @_initialized - private + initializers.each {|initializer| instance_eval(&initializer.block) } - def merge_with_parent - keys, values = [], {} + @_initialized = true + end - if @context.is_a?(Class) && @context.superclass.is_a?(Initializable) - parent = @context.superclass.initializers - keys, values = parent.keys, parent.values - end + module Initializer + Initializer = Struct.new(:name, :before, :after, :block, :global) - values = values.merge(@values) - return keys | @keys, values + def all_initializers + klasses = ancestors.select {|klass| klass.is_a?(Initializable) }.reverse + initializers = Collection.new(klasses) end - end - - class Initializer - attr_reader :name, :options, :block + alias initializers all_initializers - def initialize(name, options = {}, &block) - @name, @options, @block = name, options, block + def initializer(name, options = {}, &block) + @added_initializers ||= [] + @added_initializers << + Initializer.new(name, options[:before], options[:after], block, options[:global]) end end - def initializer(name, options = {}, &block) - @initializers ||= Collection.new(self) - @initializers[name] = Initializer.new(name, options, &block) - end + module ClassMethodsWhenIncluded + def initializers + all_initializers.select {|i| i.global == true } + end - def initializers - @initializers ||= Collection.new(self) end + module InstanceMethodsWhenIncluded + def initializers + self.class.all_initializers.reject {|i| i.global == true } + end + end end extend Initializable diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index 7c8aed00c9..a1306adb60 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -31,38 +31,113 @@ module InitializableTests end end + class Parent + extend Rails::Initializable + + initializer :one do + $arr << 1 + end + + initializer :two do + $arr << 2 + end + end + + class Child < Parent + extend Rails::Initializable + + initializer :three, :before => :one do + $arr << 3 + end + + initializer :four, :after => :one do + $arr << 4 + end + end + + class Parent + initializer :five, :before => :one do + $arr << 5 + end + end + + class Instance + include Rails::Initializable + + initializer :one do + $arr << 1 + end + + initializer :two do + $arr << 2 + end + + initializer :three, :global => true do + $arr << 3 + end + + initializer :four, :global => true do + $arr << 4 + end + end + class Basic < ActiveSupport::TestCase include ActiveSupport::Testing::Isolation test "initializers run" do - Foo.initializers.run + Foo.initialize! assert_equal 1, Foo.foo end test "initializers are inherited" do - Bar.initializers.run + Bar.initialize! assert_equal [1, 1], [Bar.foo, Bar.bar] end test "initializers only get run once" do - Foo.initializers.run - Foo.initializers.run + Foo.initialize! + Foo.initialize! assert_equal 1, Foo.foo end test "running initializers on children does not effect the parent" do - Bar.initializers.run + Bar.initialize! assert_nil Foo.foo assert_nil Foo.bar end - test "inherited initializers are the same objects" do - assert Foo.initializers[:foo].eql?(Bar.initializers[:foo]) - end - test "initializing with modules" do - Word.initializers.run + Word.initialize! assert_equal "bird", $word end end + + class BeforeAfter < ActiveSupport::TestCase + test "running on parent" do + $arr = [] + Parent.initialize! + assert_equal [5, 1, 2], $arr + end + + test "running on child" do + $arr = [] + Child.initialize! + assert_equal [5, 3, 1, 4, 2], $arr + end + end + + class InstanceTest < ActiveSupport::TestCase + test "running locals" do + $arr = [] + instance = Instance.new + instance.initialize! + assert_equal [1, 2], $arr + end + + test "running globals" do + $arr = [] + Instance.initialize! + assert_equal [3, 4], $arr + end + end end \ No newline at end of file -- cgit v1.2.3 From c2a17217d04a17f6614817c32349f56945ebc10c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 27 Oct 2009 18:35:41 -0700 Subject: Fix test failures due to requiring rails without AS in load path --- railties/Rakefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/railties/Rakefile b/railties/Rakefile index ebac90a403..3a87a88ddc 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -6,6 +6,10 @@ require 'rake/gempackagetask' require 'date' require 'rbconfig' +begin + require File.expand_path('../../vendor/gems/environment', __FILE__) +rescue LoadError +end $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib" require 'rails' -- cgit v1.2.3 From 759f2ccc4cebd28534aee9511af8ba3a33e33a80 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 27 Oct 2009 18:26:53 -0500 Subject: Start migrating AC routing tests into dispatch folder --- actionpack/test/controller/routing_test.rb | 332 ---------------------------- actionpack/test/dispatch/routing_test.rb | 336 +++++++++++++++++++++++++++++ 2 files changed, 336 insertions(+), 332 deletions(-) create mode 100644 actionpack/test/dispatch/routing_test.rb diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index d7e4646df5..308e2a85b1 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -2046,335 +2046,3 @@ class RackMountIntegrationTests < ActiveSupport::TestCase assert true end end - -class TestRoutingMapper < ActiveSupport::TestCase - include Rack::Test::Methods - - SprocketsApp = lambda { |env| - [200, {"Content-Type" => "text/html"}, ["javascripts"]] - } - - class IpRestrictor - def self.matches?(request) - request.ip =~ /192\.168\.1\.1\d\d/ - end - end - - class Dispatcher - def self.new(*args) - lambda { |env| - params = env['action_dispatch.request.path_parameters'] - controller, action = params[:controller], params[:action] - [200, {'Content-Type' => 'text/html'}, ["#{controller}##{action}"]] - } - end - end - old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher - ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } - ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, Dispatcher } - - Routes = ActionDispatch::Routing::RouteSet.new - Routes.draw do - controller :sessions do - get 'login', :to => :new, :as => :login - post 'login', :to => :create - - delete 'logout', :to => :destroy, :as => :logout - end - - match 'account/login', :to => redirect("/login") - - match 'openid/login', :via => [:get, :post], :to => "openid#login" - - controller(:global) do - match 'global/:action' - match 'global/export', :to => :export, :as => :export_request - match 'global/hide_notice', :to => :hide_notice, :as => :hide_notice - match '/export/:id/:file', :to => :export, :as => :export_download, :constraints => { :file => /.*/ } - end - - constraints(:ip => /192\.168\.1\.\d\d\d/) do - get 'admin', :to => "queenbee#index" - end - - constraints IpRestrictor do - get 'admin/accounts', :to => "queenbee#accounts" - end - - resources :projects, :controller => :project do - resources :involvements, :attachments - - resources :participants do - put :update_all, :on => :collection - end - - resources :companies do - resources :people - resource :avatar - end - - resources :images do - post :revise, :on => :member - end - - resources :people do - namespace ":access_token" do - resource :avatar - end - - member do - put :accessible_projects - post :resend, :generate_new_password - end - end - - resources :posts do - get :archive, :toggle_view, :on => :collection - post :preview, :on => :member - - resource :subscription - - resources :comments do - post :preview, :on => :collection - end - end - end - - match 'sprockets.js', :to => SprocketsApp - - match 'people/:id/update', :to => 'people#update', :as => :update_person - match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person - - # misc - match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article - - namespace :account do - resource :subscription, :credit, :credit_card - end - - controller :articles do - scope 'articles' do - scope ':title', :title => /[a-z]+/, :as => :with_title do - match ':id', :to => :with_id - end - end - end - - scope ':access_token', :constraints => { :access_token => /\w{5,5}/ } do - resources :rooms - end - end - ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } - ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher } - - def app - Routes - end - - def test_logout - delete '/logout' - assert_equal 'sessions#destroy', last_response.body - - # assert_equal '/logout', app.logout_path - end - - def test_login - get '/login' - assert_equal 'sessions#new', last_response.body - - post '/login' - assert_equal 'sessions#create', last_response.body - - # assert_equal '/login', app.login_path - end - - def test_login_redirect - get '/account/login' - assert_equal 301, last_response.status - assert_equal 'http://example.org/login', last_response.headers['Location'] - assert_equal 'Moved Permanently', last_response.body - end - - def test_openid - get '/openid/login' - assert_equal 'openid#login', last_response.body - - post '/openid/login' - assert_equal 'openid#login', last_response.body - end - - # def test_admin - # get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'} - # assert_equal 'queenbee#index', last_response.body - # - # assert_raise(ActionController::RoutingError) { get '/admin', {}, {'REMOTE_ADDR' => '10.0.0.100'} } - # - # get '/admin/accounts', {}, {'REMOTE_ADDR' => '192.168.1.100'} - # assert_equal 'queenbee#accounts', last_response.body - # - # assert_raise(ActionController::RoutingError) { get '/admin/accounts', {}, {'REMOTE_ADDR' => '10.0.0.100'} } - # end - - def test_global - get '/global/dashboard' - assert_equal 'global#dashboard', last_response.body - - get '/global/export' - assert_equal 'global#export', last_response.body - - get '/global/hide_notice' - assert_equal 'global#hide_notice', last_response.body - - get '/export/123/foo.txt' - assert_equal 'global#export', last_response.body - - # assert_equal '/global/export', app.export_request_path - # assert_equal '/global/hide_notice', app.hide_notice_path - # assert_equal '/export/123/foo.txt', app.export_download_path(:id => 123, :file => 'foo.txt') - end - - def test_projects - get '/projects/1' - assert_equal 'projects#show', last_response.body - end - - def test_projects_involvements - get '/projects/1/involvements' - assert_equal 'involvements#index', last_response.body - - get '/projects/1/involvements/1' - assert_equal 'involvements#show', last_response.body - end - - def test_projects_attachments - get '/projects/1/attachments' - assert_equal 'attachments#index', last_response.body - end - - def test_projects_participants - get '/projects/1/participants' - assert_equal 'participants#index', last_response.body - - put '/projects/1/participants/update_all' - assert_equal 'participants#update_all', last_response.body - end - - def test_projects_companies - get '/projects/1/companies' - assert_equal 'companies#index', last_response.body - - get '/projects/1/companies/1/people' - assert_equal 'people#index', last_response.body - - get '/projects/1/companies/1/avatar' - assert_equal 'avatar#show', last_response.body - end - - def test_project_images - get '/projects/1/images' - assert_equal 'images#index', last_response.body - - post '/projects/1/images/1/revise' - assert_equal 'images#revise', last_response.body - end - - def test_projects_people - get '/projects/1/people' - assert_equal 'people#index', last_response.body - - get '/projects/1/people/1' - assert_equal 'people#show', last_response.body - - get '/projects/1/people/1/7a2dec8/avatar' - assert_equal 'avatar#show', last_response.body - - put '/projects/1/people/1/accessible_projects' - assert_equal 'people#accessible_projects', last_response.body - - post '/projects/1/people/1/resend' - assert_equal 'people#resend', last_response.body - - post '/projects/1/people/1/generate_new_password' - assert_equal 'people#generate_new_password', last_response.body - end - - def test_projects_posts - get '/projects/1/posts' - assert_equal 'posts#index', last_response.body - - get '/projects/1/posts/archive' - assert_equal 'posts#archive', last_response.body - - get '/projects/1/posts/toggle_view' - assert_equal 'posts#toggle_view', last_response.body - - post '/projects/1/posts/1/preview' - assert_equal 'posts#preview', last_response.body - - get '/projects/1/posts/1/subscription' - assert_equal 'subscription#show', last_response.body - - get '/projects/1/posts/1/comments' - assert_equal 'comments#index', last_response.body - - post '/projects/1/posts/1/comments/preview' - assert_equal 'comments#preview', last_response.body - end - - def test_sprockets - get '/sprockets.js' - assert_equal 'javascripts', last_response.body - end - - def test_update_person_route - get '/people/1/update' - assert_equal 'people#update', last_response.body - - # assert_equal '/people/1/update', app.update_person_path(:id => 1) - end - - def test_update_project_person - get '/projects/1/people/2/update' - assert_equal 'people#update', last_response.body - - # assert_equal '/projects/1/people/2/update', app.update_project_person_path(:project_id => 1, :id => 2) - end - - def test_articles_perma - get '/articles/2009/08/18/rails-3' - assert_equal 'articles#show', last_response.body - - # assert_equal '/articles/2009/8/18/rails-3', app.article_path(:year => 2009, :month => 8, :day => 18, :title => 'rails-3') - end - - def test_account_namespace - get '/account/subscription' - assert_equal 'subscription#show', last_response.body - - get '/account/credit' - assert_equal 'credit#show', last_response.body - - get '/account/credit_card' - assert_equal 'credit_card#show', last_response.body - end - - def test_articles_with_id - get '/articles/rails/1' - assert_equal 'articles#with_id', last_response.body - - assert_raise(ActionController::RoutingError) { get '/articles/123/1' } - - # assert_equal '/articles/rails/1', app.with_title_path(:title => 'rails', :id => 1) - end - - def test_access_token_rooms - get '/12345/rooms' - assert_equal 'rooms#index', last_response.body - - get '/12345/rooms/1' - assert_equal 'rooms#show', last_response.body - - get '/12345/rooms/1/edit' - assert_equal 'rooms#edit', last_response.body - end -end diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb new file mode 100644 index 0000000000..ea7113a602 --- /dev/null +++ b/actionpack/test/dispatch/routing_test.rb @@ -0,0 +1,336 @@ +require 'abstract_unit' +require 'controller/fake_controllers' + +class TestRoutingMapper < ActionDispatch::IntegrationTest + SprocketsApp = lambda { |env| + [200, {"Content-Type" => "text/html"}, ["javascripts"]] + } + + class IpRestrictor + def self.matches?(request) + request.ip =~ /192\.168\.1\.1\d\d/ + end + end + + class Dispatcher + def self.new(*args) + lambda { |env| + params = env['action_dispatch.request.path_parameters'] + controller, action = params[:controller], params[:action] + [200, {'Content-Type' => 'text/html'}, ["#{controller}##{action}"]] + } + end + end + old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher + ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } + ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, Dispatcher } + + Routes = ActionDispatch::Routing::RouteSet.new + Routes.draw do + controller :sessions do + get 'login', :to => :new, :as => :login + post 'login', :to => :create + + delete 'logout', :to => :destroy, :as => :logout + end + + match 'account/login', :to => redirect("/login") + + match 'openid/login', :via => [:get, :post], :to => "openid#login" + + controller(:global) do + match 'global/:action' + match 'global/export', :to => :export, :as => :export_request + match 'global/hide_notice', :to => :hide_notice, :as => :hide_notice + match '/export/:id/:file', :to => :export, :as => :export_download, :constraints => { :file => /.*/ } + end + + constraints(:ip => /192\.168\.1\.\d\d\d/) do + get 'admin', :to => "queenbee#index" + end + + constraints IpRestrictor do + get 'admin/accounts', :to => "queenbee#accounts" + end + + resources :projects, :controller => :project do + resources :involvements, :attachments + + resources :participants do + put :update_all, :on => :collection + end + + resources :companies do + resources :people + resource :avatar + end + + resources :images do + post :revise, :on => :member + end + + resources :people do + namespace ":access_token" do + resource :avatar + end + + member do + put :accessible_projects + post :resend, :generate_new_password + end + end + + resources :posts do + get :archive, :toggle_view, :on => :collection + post :preview, :on => :member + + resource :subscription + + resources :comments do + post :preview, :on => :collection + end + end + end + + match 'sprockets.js', :to => SprocketsApp + + match 'people/:id/update', :to => 'people#update', :as => :update_person + match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person + + # misc + match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article + + namespace :account do + resource :subscription, :credit, :credit_card + end + + controller :articles do + scope 'articles' do + scope ':title', :title => /[a-z]+/, :as => :with_title do + match ':id', :to => :with_id + end + end + end + + scope ':access_token', :constraints => { :access_token => /\w{5,5}/ } do + resources :rooms + end + end + ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } + ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher } + + def app + Routes + end + + def setup + Routes.install_helpers(metaclass) + end + + def test_logout + delete '/logout' + assert_equal 'sessions#destroy', @response.body + + # assert_equal '/logout', logout_path + end + + def test_login + get '/login' + assert_equal 'sessions#new', @response.body + + post '/login' + assert_equal 'sessions#create', @response.body + + # assert_equal '/login', app.login_path + end + + def test_login_redirect + get '/account/login' + assert_equal 301, @response.status + assert_equal 'http://www.example.com/login', @response.headers['Location'] + assert_equal 'Moved Permanently', @response.body + end + + def test_openid + get '/openid/login' + assert_equal 'openid#login', @response.body + + post '/openid/login' + assert_equal 'openid#login', @response.body + end + + # def test_admin + # get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'} + # assert_equal 'queenbee#index', @response.body + # + # assert_raise(ActionController::RoutingError) { get '/admin', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # + # get '/admin/accounts', {}, {'REMOTE_ADDR' => '192.168.1.100'} + # assert_equal 'queenbee#accounts', @response.body + # + # assert_raise(ActionController::RoutingError) { get '/admin/accounts', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # end + + def test_global + get '/global/dashboard' + assert_equal 'global#dashboard', @response.body + + get '/global/export' + assert_equal 'global#export', @response.body + + get '/global/hide_notice' + assert_equal 'global#hide_notice', @response.body + + get '/export/123/foo.txt' + assert_equal 'global#export', @response.body + + # assert_equal '/global/export', app.export_request_path + # assert_equal '/global/hide_notice', app.hide_notice_path + # assert_equal '/export/123/foo.txt', app.export_download_path(:id => 123, :file => 'foo.txt') + end + + def test_projects + get '/projects/1' + assert_equal 'projects#show', @response.body + end + + def test_projects_involvements + get '/projects/1/involvements' + assert_equal 'involvements#index', @response.body + + get '/projects/1/involvements/1' + assert_equal 'involvements#show', @response.body + end + + def test_projects_attachments + get '/projects/1/attachments' + assert_equal 'attachments#index', @response.body + end + + def test_projects_participants + get '/projects/1/participants' + assert_equal 'participants#index', @response.body + + put '/projects/1/participants/update_all' + assert_equal 'participants#update_all', @response.body + end + + def test_projects_companies + get '/projects/1/companies' + assert_equal 'companies#index', @response.body + + get '/projects/1/companies/1/people' + assert_equal 'people#index', @response.body + + get '/projects/1/companies/1/avatar' + assert_equal 'avatar#show', @response.body + end + + def test_project_images + get '/projects/1/images' + assert_equal 'images#index', @response.body + + post '/projects/1/images/1/revise' + assert_equal 'images#revise', @response.body + end + + def test_projects_people + get '/projects/1/people' + assert_equal 'people#index', @response.body + + get '/projects/1/people/1' + assert_equal 'people#show', @response.body + + get '/projects/1/people/1/7a2dec8/avatar' + assert_equal 'avatar#show', @response.body + + put '/projects/1/people/1/accessible_projects' + assert_equal 'people#accessible_projects', @response.body + + post '/projects/1/people/1/resend' + assert_equal 'people#resend', @response.body + + post '/projects/1/people/1/generate_new_password' + assert_equal 'people#generate_new_password', @response.body + end + + def test_projects_posts + get '/projects/1/posts' + assert_equal 'posts#index', @response.body + + get '/projects/1/posts/archive' + assert_equal 'posts#archive', @response.body + + get '/projects/1/posts/toggle_view' + assert_equal 'posts#toggle_view', @response.body + + post '/projects/1/posts/1/preview' + assert_equal 'posts#preview', @response.body + + get '/projects/1/posts/1/subscription' + assert_equal 'subscription#show', @response.body + + get '/projects/1/posts/1/comments' + assert_equal 'comments#index', @response.body + + post '/projects/1/posts/1/comments/preview' + assert_equal 'comments#preview', @response.body + end + + def test_sprockets + get '/sprockets.js' + assert_equal 'javascripts', @response.body + end + + def test_update_person_route + get '/people/1/update' + assert_equal 'people#update', @response.body + + # assert_equal '/people/1/update', app.update_person_path(:id => 1) + end + + def test_update_project_person + get '/projects/1/people/2/update' + assert_equal 'people#update', @response.body + + # assert_equal '/projects/1/people/2/update', app.update_project_person_path(:project_id => 1, :id => 2) + end + + def test_articles_perma + get '/articles/2009/08/18/rails-3' + assert_equal 'articles#show', @response.body + + # assert_equal '/articles/2009/8/18/rails-3', app.article_path(:year => 2009, :month => 8, :day => 18, :title => 'rails-3') + end + + def test_account_namespace + get '/account/subscription' + assert_equal 'subscription#show', @response.body + + get '/account/credit' + assert_equal 'credit#show', @response.body + + get '/account/credit_card' + assert_equal 'credit_card#show', @response.body + end + + def test_articles_with_id + get '/articles/rails/1' + assert_equal 'articles#with_id', @response.body + + assert_raise(ActionController::RoutingError) { get '/articles/123/1' } + + # assert_equal '/articles/rails/1', app.with_title_path(:title => 'rails', :id => 1) + end + + def test_access_token_rooms + get '/12345/rooms' + assert_equal 'rooms#index', @response.body + + get '/12345/rooms/1' + assert_equal 'rooms#show', @response.body + + get '/12345/rooms/1/edit' + assert_equal 'rooms#edit', @response.body + end +end -- cgit v1.2.3 From e296ea056e87027933c7d37e1e8c1f6ef73bc447 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 27 Oct 2009 19:32:31 -0500 Subject: Enable named route tests --- actionpack/test/dispatch/routing_test.rb | 280 ++++++++++++++++++------------- 1 file changed, 166 insertions(+), 114 deletions(-) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index ea7113a602..972bf73602 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -21,12 +21,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest } end end + old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, Dispatcher } - Routes = ActionDispatch::Routing::RouteSet.new - Routes.draw do + Routes.draw do |map| controller :sessions do get 'login', :to => :new, :as => :login post 'login', :to => :create @@ -123,214 +123,266 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest Routes end - def setup - Routes.install_helpers(metaclass) - end - def test_logout - delete '/logout' - assert_equal 'sessions#destroy', @response.body + with_test_routes do + delete '/logout' + assert_equal 'sessions#destroy', @response.body - # assert_equal '/logout', logout_path + assert_equal '/logout', logout_path + end end def test_login - get '/login' - assert_equal 'sessions#new', @response.body + with_test_routes do + get '/login' + assert_equal 'sessions#new', @response.body - post '/login' - assert_equal 'sessions#create', @response.body + post '/login' + assert_equal 'sessions#create', @response.body - # assert_equal '/login', app.login_path + assert_equal '/login', login_path + end end def test_login_redirect - get '/account/login' - assert_equal 301, @response.status - assert_equal 'http://www.example.com/login', @response.headers['Location'] - assert_equal 'Moved Permanently', @response.body + with_test_routes do + get '/account/login' + assert_equal 301, @response.status + assert_equal 'http://www.example.com/login', @response.headers['Location'] + assert_equal 'Moved Permanently', @response.body + end end def test_openid - get '/openid/login' - assert_equal 'openid#login', @response.body + with_test_routes do + get '/openid/login' + assert_equal 'openid#login', @response.body - post '/openid/login' - assert_equal 'openid#login', @response.body + post '/openid/login' + assert_equal 'openid#login', @response.body + end end + # TODO: rackmount is broken # def test_admin - # get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'} - # assert_equal 'queenbee#index', @response.body + # with_test_routes do + # get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'} + # assert_equal 'queenbee#index', @response.body # - # assert_raise(ActionController::RoutingError) { get '/admin', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # assert_raise(ActionController::RoutingError) { get '/admin', {}, {'REMOTE_ADDR' => '10.0.0.100'} } # - # get '/admin/accounts', {}, {'REMOTE_ADDR' => '192.168.1.100'} - # assert_equal 'queenbee#accounts', @response.body + # get '/admin/accounts', {}, {'REMOTE_ADDR' => '192.168.1.100'} + # assert_equal 'queenbee#accounts', @response.body # - # assert_raise(ActionController::RoutingError) { get '/admin/accounts', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # assert_raise(ActionController::RoutingError) { get '/admin/accounts', {}, {'REMOTE_ADDR' => '10.0.0.100'} } + # end # end def test_global - get '/global/dashboard' - assert_equal 'global#dashboard', @response.body + with_test_routes do + get '/global/dashboard' + assert_equal 'global#dashboard', @response.body - get '/global/export' - assert_equal 'global#export', @response.body + get '/global/export' + assert_equal 'global#export', @response.body - get '/global/hide_notice' - assert_equal 'global#hide_notice', @response.body + get '/global/hide_notice' + assert_equal 'global#hide_notice', @response.body - get '/export/123/foo.txt' - assert_equal 'global#export', @response.body + get '/export/123/foo.txt' + assert_equal 'global#export', @response.body - # assert_equal '/global/export', app.export_request_path - # assert_equal '/global/hide_notice', app.hide_notice_path - # assert_equal '/export/123/foo.txt', app.export_download_path(:id => 123, :file => 'foo.txt') + assert_equal '/global/export', export_request_path + assert_equal '/global/hide_notice', hide_notice_path + assert_equal '/export/123/foo.txt', export_download_path(:id => 123, :file => 'foo.txt') + end end def test_projects - get '/projects/1' - assert_equal 'projects#show', @response.body + with_test_routes do + get '/projects/1' + assert_equal 'projects#show', @response.body + end end def test_projects_involvements - get '/projects/1/involvements' - assert_equal 'involvements#index', @response.body + with_test_routes do + get '/projects/1/involvements' + assert_equal 'involvements#index', @response.body - get '/projects/1/involvements/1' - assert_equal 'involvements#show', @response.body + get '/projects/1/involvements/1' + assert_equal 'involvements#show', @response.body + end end def test_projects_attachments - get '/projects/1/attachments' - assert_equal 'attachments#index', @response.body + with_test_routes do + get '/projects/1/attachments' + assert_equal 'attachments#index', @response.body + end end def test_projects_participants - get '/projects/1/participants' - assert_equal 'participants#index', @response.body + with_test_routes do + get '/projects/1/participants' + assert_equal 'participants#index', @response.body - put '/projects/1/participants/update_all' - assert_equal 'participants#update_all', @response.body + put '/projects/1/participants/update_all' + assert_equal 'participants#update_all', @response.body + end end def test_projects_companies - get '/projects/1/companies' - assert_equal 'companies#index', @response.body + with_test_routes do + get '/projects/1/companies' + assert_equal 'companies#index', @response.body - get '/projects/1/companies/1/people' - assert_equal 'people#index', @response.body + get '/projects/1/companies/1/people' + assert_equal 'people#index', @response.body - get '/projects/1/companies/1/avatar' - assert_equal 'avatar#show', @response.body + get '/projects/1/companies/1/avatar' + assert_equal 'avatar#show', @response.body + end end def test_project_images - get '/projects/1/images' - assert_equal 'images#index', @response.body + with_test_routes do + get '/projects/1/images' + assert_equal 'images#index', @response.body - post '/projects/1/images/1/revise' - assert_equal 'images#revise', @response.body + post '/projects/1/images/1/revise' + assert_equal 'images#revise', @response.body + end end def test_projects_people - get '/projects/1/people' - assert_equal 'people#index', @response.body + with_test_routes do + get '/projects/1/people' + assert_equal 'people#index', @response.body - get '/projects/1/people/1' - assert_equal 'people#show', @response.body + get '/projects/1/people/1' + assert_equal 'people#show', @response.body - get '/projects/1/people/1/7a2dec8/avatar' - assert_equal 'avatar#show', @response.body + get '/projects/1/people/1/7a2dec8/avatar' + assert_equal 'avatar#show', @response.body - put '/projects/1/people/1/accessible_projects' - assert_equal 'people#accessible_projects', @response.body + put '/projects/1/people/1/accessible_projects' + assert_equal 'people#accessible_projects', @response.body - post '/projects/1/people/1/resend' - assert_equal 'people#resend', @response.body + post '/projects/1/people/1/resend' + assert_equal 'people#resend', @response.body - post '/projects/1/people/1/generate_new_password' - assert_equal 'people#generate_new_password', @response.body + post '/projects/1/people/1/generate_new_password' + assert_equal 'people#generate_new_password', @response.body + end end def test_projects_posts - get '/projects/1/posts' - assert_equal 'posts#index', @response.body + with_test_routes do + get '/projects/1/posts' + assert_equal 'posts#index', @response.body - get '/projects/1/posts/archive' - assert_equal 'posts#archive', @response.body + get '/projects/1/posts/archive' + assert_equal 'posts#archive', @response.body - get '/projects/1/posts/toggle_view' - assert_equal 'posts#toggle_view', @response.body + get '/projects/1/posts/toggle_view' + assert_equal 'posts#toggle_view', @response.body - post '/projects/1/posts/1/preview' - assert_equal 'posts#preview', @response.body + post '/projects/1/posts/1/preview' + assert_equal 'posts#preview', @response.body - get '/projects/1/posts/1/subscription' - assert_equal 'subscription#show', @response.body + get '/projects/1/posts/1/subscription' + assert_equal 'subscription#show', @response.body - get '/projects/1/posts/1/comments' - assert_equal 'comments#index', @response.body + get '/projects/1/posts/1/comments' + assert_equal 'comments#index', @response.body - post '/projects/1/posts/1/comments/preview' - assert_equal 'comments#preview', @response.body + post '/projects/1/posts/1/comments/preview' + assert_equal 'comments#preview', @response.body + end end def test_sprockets - get '/sprockets.js' - assert_equal 'javascripts', @response.body + with_test_routes do + get '/sprockets.js' + assert_equal 'javascripts', @response.body + end end def test_update_person_route - get '/people/1/update' - assert_equal 'people#update', @response.body + with_test_routes do + get '/people/1/update' + assert_equal 'people#update', @response.body - # assert_equal '/people/1/update', app.update_person_path(:id => 1) + assert_equal '/people/1/update', update_person_path(:id => 1) + end end def test_update_project_person - get '/projects/1/people/2/update' - assert_equal 'people#update', @response.body + with_test_routes do + get '/projects/1/people/2/update' + assert_equal 'people#update', @response.body - # assert_equal '/projects/1/people/2/update', app.update_project_person_path(:project_id => 1, :id => 2) + assert_equal '/projects/1/people/2/update', update_project_person_path(:project_id => 1, :id => 2) + end end def test_articles_perma - get '/articles/2009/08/18/rails-3' - assert_equal 'articles#show', @response.body + with_test_routes do + get '/articles/2009/08/18/rails-3' + assert_equal 'articles#show', @response.body - # assert_equal '/articles/2009/8/18/rails-3', app.article_path(:year => 2009, :month => 8, :day => 18, :title => 'rails-3') + assert_equal '/articles/2009/8/18/rails-3', article_path(:year => 2009, :month => 8, :day => 18, :title => 'rails-3') + end end def test_account_namespace - get '/account/subscription' - assert_equal 'subscription#show', @response.body + with_test_routes do + get '/account/subscription' + assert_equal 'subscription#show', @response.body - get '/account/credit' - assert_equal 'credit#show', @response.body + get '/account/credit' + assert_equal 'credit#show', @response.body - get '/account/credit_card' - assert_equal 'credit_card#show', @response.body + get '/account/credit_card' + assert_equal 'credit_card#show', @response.body + end end def test_articles_with_id - get '/articles/rails/1' - assert_equal 'articles#with_id', @response.body + with_test_routes do + get '/articles/rails/1' + assert_equal 'articles#with_id', @response.body - assert_raise(ActionController::RoutingError) { get '/articles/123/1' } + assert_raise(ActionController::RoutingError) { get '/articles/123/1' } - # assert_equal '/articles/rails/1', app.with_title_path(:title => 'rails', :id => 1) + assert_equal '/articles/rails/1', with_title_path(:title => 'rails', :id => 1) + end end def test_access_token_rooms - get '/12345/rooms' - assert_equal 'rooms#index', @response.body + with_test_routes do + get '/12345/rooms' + assert_equal 'rooms#index', @response.body - get '/12345/rooms/1' - assert_equal 'rooms#show', @response.body + get '/12345/rooms/1' + assert_equal 'rooms#show', @response.body - get '/12345/rooms/1/edit' - assert_equal 'rooms#edit', @response.body + get '/12345/rooms/1/edit' + assert_equal 'rooms#edit', @response.body + end end + + private + def with_test_routes + real_routes, temp_routes = ActionController::Routing::Routes, Routes + + ActionController::Routing.module_eval { remove_const :Routes } + ActionController::Routing.module_eval { const_set :Routes, temp_routes } + + yield + ensure + ActionController::Routing.module_eval { remove_const :Routes } + ActionController::Routing.const_set(:Routes, real_routes) + end end -- cgit v1.2.3 From 43e0bc1c9f39ebf5b253b498b38101a4aba04a45 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 27 Oct 2009 19:48:35 -0500 Subject: Extract routing controller stub helper into abstract unit --- actionpack/test/abstract_unit.rb | 20 +++++ actionpack/test/dispatch/routing_test.rb | 145 ++++++++++++++----------------- 2 files changed, 86 insertions(+), 79 deletions(-) diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 86c8a95a43..214d79cd87 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -105,6 +105,26 @@ class ActionController::IntegrationTest < ActiveSupport::TestCase self.app = build_app + class StubDispatcher + def self.new(*args) + lambda { |env| + params = env['action_dispatch.request.path_parameters'] + controller, action = params[:controller], params[:action] + [200, {'Content-Type' => 'text/html'}, ["#{controller}##{action}"]] + } + end + end + + def self.stub_controllers + old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher + ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } + ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, StubDispatcher } + yield ActionDispatch::Routing::RouteSet.new + ensure + ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } + ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher } + end + def with_routing(&block) real_routes = ActionController::Routing::Routes ActionController::Routing.module_eval { remove_const :Routes } diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 972bf73602..5558cf0154 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -12,112 +12,99 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end - class Dispatcher - def self.new(*args) - lambda { |env| - params = env['action_dispatch.request.path_parameters'] - controller, action = params[:controller], params[:action] - [200, {'Content-Type' => 'text/html'}, ["#{controller}##{action}"]] - } - end - end - - old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher - ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } - ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, Dispatcher } - Routes = ActionDispatch::Routing::RouteSet.new - Routes.draw do |map| - controller :sessions do - get 'login', :to => :new, :as => :login - post 'login', :to => :create - - delete 'logout', :to => :destroy, :as => :logout - end - - match 'account/login', :to => redirect("/login") - - match 'openid/login', :via => [:get, :post], :to => "openid#login" - - controller(:global) do - match 'global/:action' - match 'global/export', :to => :export, :as => :export_request - match 'global/hide_notice', :to => :hide_notice, :as => :hide_notice - match '/export/:id/:file', :to => :export, :as => :export_download, :constraints => { :file => /.*/ } - end - - constraints(:ip => /192\.168\.1\.\d\d\d/) do - get 'admin', :to => "queenbee#index" - end + stub_controllers do |routes| + Routes = routes + Routes.draw do |map| + controller :sessions do + get 'login', :to => :new, :as => :login + post 'login', :to => :create + + delete 'logout', :to => :destroy, :as => :logout + end - constraints IpRestrictor do - get 'admin/accounts', :to => "queenbee#accounts" - end + match 'account/login', :to => redirect("/login") - resources :projects, :controller => :project do - resources :involvements, :attachments + match 'openid/login', :via => [:get, :post], :to => "openid#login" - resources :participants do - put :update_all, :on => :collection + controller(:global) do + match 'global/:action' + match 'global/export', :to => :export, :as => :export_request + match 'global/hide_notice', :to => :hide_notice, :as => :hide_notice + match '/export/:id/:file', :to => :export, :as => :export_download, :constraints => { :file => /.*/ } end - resources :companies do - resources :people - resource :avatar + constraints(:ip => /192\.168\.1\.\d\d\d/) do + get 'admin', :to => "queenbee#index" end - resources :images do - post :revise, :on => :member + constraints IpRestrictor do + get 'admin/accounts', :to => "queenbee#accounts" end - resources :people do - namespace ":access_token" do - resource :avatar + resources :projects, :controller => :project do + resources :involvements, :attachments + + resources :participants do + put :update_all, :on => :collection end - member do - put :accessible_projects - post :resend, :generate_new_password + resources :companies do + resources :people + resource :avatar + end + + resources :images do + post :revise, :on => :member + end + + resources :people do + namespace ":access_token" do + resource :avatar + end + + member do + put :accessible_projects + post :resend, :generate_new_password + end end - end - resources :posts do - get :archive, :toggle_view, :on => :collection - post :preview, :on => :member + resources :posts do + get :archive, :toggle_view, :on => :collection + post :preview, :on => :member - resource :subscription + resource :subscription - resources :comments do - post :preview, :on => :collection + resources :comments do + post :preview, :on => :collection + end end end - end - match 'sprockets.js', :to => SprocketsApp + match 'sprockets.js', :to => SprocketsApp - match 'people/:id/update', :to => 'people#update', :as => :update_person - match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person + match 'people/:id/update', :to => 'people#update', :as => :update_person + match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person - # misc - match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article + # misc + match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article - namespace :account do - resource :subscription, :credit, :credit_card - end + namespace :account do + resource :subscription, :credit, :credit_card + end - controller :articles do - scope 'articles' do - scope ':title', :title => /[a-z]+/, :as => :with_title do - match ':id', :to => :with_id + controller :articles do + scope 'articles' do + scope ':title', :title => /[a-z]+/, :as => :with_title do + match ':id', :to => :with_id + end end end - end - scope ':access_token', :constraints => { :access_token => /\w{5,5}/ } do - resources :rooms + scope ':access_token', :constraints => { :access_token => /\w{5,5}/ } do + resources :rooms + end end end - ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } - ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher } def app Routes -- cgit v1.2.3 From 07da304ff84dca9a286005630cd3340f51384465 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 27 Oct 2009 19:57:57 -0500 Subject: Some more generation tests --- actionpack/test/dispatch/routing_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 5558cf0154..74e6c8e72d 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -116,6 +116,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal 'sessions#destroy', @response.body assert_equal '/logout', logout_path + assert_equal '/logout', url_for(:controller => 'sessions', :action => 'destroy', :only_path => true) end end @@ -123,11 +124,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest with_test_routes do get '/login' assert_equal 'sessions#new', @response.body + assert_equal '/login', login_path post '/login' assert_equal 'sessions#create', @response.body - assert_equal '/login', login_path + assert_equal '/login', url_for(:controller => 'sessions', :action => 'create', :only_path => true) + assert_equal '/login', url_for(:controller => 'sessions', :action => 'new', :only_path => true) end end -- cgit v1.2.3 From 86596975be45fa9088fba4db99b67518434f3afc Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Tue, 27 Oct 2009 19:05:29 -0700 Subject: Tests pass again --- railties/lib/rails/application.rb | 4 ++-- railties/lib/rails/initializable.rb | 4 ++-- railties/test/initializable_test.rb | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 943c939757..26a55a73e1 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -41,13 +41,13 @@ module Rails end def new - initializers.run + run_initializers self end end initializer :initialize_rails do - Rails.initializers.run + Rails.run_initializers end # Set the $LOAD_PATH based on the value of diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index affa29239f..c491d5e012 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -15,7 +15,7 @@ module Rails class Collection < Array def initialize(klasses) klasses.each do |klass| - klass.added_initializers.each do |initializer| + (klass.added_initializers || []).each do |initializer| index = if initializer.before index_for(initializer.before) elsif initializer.after @@ -44,7 +44,7 @@ module Rails # # The #initializers method is set up to return the right list of # initializers for the context in question. - def initialize! + def run_initializers return if @_initialized initializers.each {|initializer| instance_eval(&initializer.block) } diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index a1306adb60..f7237e69cc 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -85,29 +85,29 @@ module InitializableTests include ActiveSupport::Testing::Isolation test "initializers run" do - Foo.initialize! + Foo.run_initializers assert_equal 1, Foo.foo end test "initializers are inherited" do - Bar.initialize! + Bar.run_initializers assert_equal [1, 1], [Bar.foo, Bar.bar] end test "initializers only get run once" do - Foo.initialize! - Foo.initialize! + Foo.run_initializers + Foo.run_initializers assert_equal 1, Foo.foo end test "running initializers on children does not effect the parent" do - Bar.initialize! + Bar.run_initializers assert_nil Foo.foo assert_nil Foo.bar end test "initializing with modules" do - Word.initialize! + Word.run_initializers assert_equal "bird", $word end end @@ -115,13 +115,13 @@ module InitializableTests class BeforeAfter < ActiveSupport::TestCase test "running on parent" do $arr = [] - Parent.initialize! + Parent.run_initializers assert_equal [5, 1, 2], $arr end test "running on child" do $arr = [] - Child.initialize! + Child.run_initializers assert_equal [5, 3, 1, 4, 2], $arr end end @@ -130,13 +130,13 @@ module InitializableTests test "running locals" do $arr = [] instance = Instance.new - instance.initialize! + instance.run_initializers assert_equal [1, 2], $arr end test "running globals" do $arr = [] - Instance.initialize! + Instance.run_initializers assert_equal [3, 4], $arr end end -- cgit v1.2.3 From 37c9ec3add88a85bd7b6fc43ebc3aa5ecd221fef Mon Sep 17 00:00:00 2001 From: Geoff Buesing Date: Tue, 27 Oct 2009 20:53:07 -0500 Subject: Tzinfo bundling task: unpack tzinfo with lib directory preserved --- activesupport/Rakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/activesupport/Rakefile b/activesupport/Rakefile index d923dce3a4..2ada91830f 100644 --- a/activesupport/Rakefile +++ b/activesupport/Rakefile @@ -104,21 +104,21 @@ namespace :tzinfo do end task :copy_classes => :unpack_gem do - mkdir_p "#{destination_path}/tzinfo" - cp "#{tmp_path}/lib/tzinfo.rb", destination_path - comment_requires_for_excluded_classes!('tzinfo.rb') + mkdir_p "#{destination_path}/lib/tzinfo" + cp "#{tmp_path}/lib/tzinfo.rb", "#{destination_path}/lib" + comment_requires_for_excluded_classes!('lib/tzinfo.rb') files = FileList["#{tmp_path}/lib/tzinfo/*.rb"] files.each do |file| filename = File.basename(file) unless excluded_classes.include? filename.sub(/.rb$/, '') - cp "#{tmp_path}/lib/tzinfo/#{filename}", "#{destination_path}/tzinfo" - comment_requires_for_excluded_classes!("tzinfo/#{filename}") + cp "#{tmp_path}/lib/tzinfo/#{filename}", "#{destination_path}/lib/tzinfo" + comment_requires_for_excluded_classes!("lib/tzinfo/#{filename}") end end end task :copy_definitions => :unpack_gem do - definitions_path = "#{destination_path}/tzinfo/definitions/" + definitions_path = "#{destination_path}/lib/tzinfo/definitions/" mkdir_p definitions_path ActiveSupport::TimeZone::MAPPING.values.each do |zone| subdir = nil -- cgit v1.2.3 From 057f0d3c16d533aea1a98ea3d7f4c2a09274e5c4 Mon Sep 17 00:00:00 2001 From: Geoff Buesing Date: Tue, 27 Oct 2009 20:54:24 -0500 Subject: Bundle Tzinfo 0.3.15 --- activesupport/CHANGELOG | 2 + activesupport/lib/active_support/vendor.rb | 2 +- .../vendor/tzinfo-0.3.13/lib/tzinfo.rb | 33 -- .../tzinfo-0.3.13/lib/tzinfo/data_timezone.rb | 47 -- .../tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb | 228 --------- .../lib/tzinfo/definitions/Africa/Algiers.rb | 55 --- .../lib/tzinfo/definitions/Africa/Cairo.rb | 219 --------- .../lib/tzinfo/definitions/Africa/Casablanca.rb | 42 -- .../lib/tzinfo/definitions/Africa/Harare.rb | 18 - .../lib/tzinfo/definitions/Africa/Johannesburg.rb | 25 - .../lib/tzinfo/definitions/Africa/Monrovia.rb | 22 - .../lib/tzinfo/definitions/Africa/Nairobi.rb | 23 - .../definitions/America/Argentina/Buenos_Aires.rb | 166 ------- .../definitions/America/Argentina/San_Juan.rb | 86 ---- .../lib/tzinfo/definitions/America/Bogota.rb | 23 - .../lib/tzinfo/definitions/America/Caracas.rb | 23 - .../lib/tzinfo/definitions/America/Chicago.rb | 283 ------------ .../lib/tzinfo/definitions/America/Chihuahua.rb | 136 ------ .../lib/tzinfo/definitions/America/Denver.rb | 204 --------- .../lib/tzinfo/definitions/America/Godthab.rb | 161 ------- .../lib/tzinfo/definitions/America/Guatemala.rb | 27 -- .../lib/tzinfo/definitions/America/Halifax.rb | 274 ----------- .../definitions/America/Indiana/Indianapolis.rb | 149 ------ .../lib/tzinfo/definitions/America/Juneau.rb | 194 -------- .../lib/tzinfo/definitions/America/La_Paz.rb | 22 - .../lib/tzinfo/definitions/America/Lima.rb | 35 -- .../lib/tzinfo/definitions/America/Los_Angeles.rb | 232 ---------- .../lib/tzinfo/definitions/America/Mazatlan.rb | 139 ------ .../lib/tzinfo/definitions/America/Mexico_City.rb | 144 ------ .../lib/tzinfo/definitions/America/Monterrey.rb | 131 ------ .../lib/tzinfo/definitions/America/New_York.rb | 282 ------------ .../lib/tzinfo/definitions/America/Phoenix.rb | 30 -- .../lib/tzinfo/definitions/America/Regina.rb | 74 --- .../lib/tzinfo/definitions/America/Santiago.rb | 205 --------- .../lib/tzinfo/definitions/America/Sao_Paulo.rb | 171 ------- .../lib/tzinfo/definitions/America/St_Johns.rb | 288 ------------ .../lib/tzinfo/definitions/America/Tijuana.rb | 196 -------- .../lib/tzinfo/definitions/Asia/Almaty.rb | 67 --- .../lib/tzinfo/definitions/Asia/Baghdad.rb | 73 --- .../lib/tzinfo/definitions/Asia/Baku.rb | 161 ------- .../lib/tzinfo/definitions/Asia/Bangkok.rb | 20 - .../lib/tzinfo/definitions/Asia/Chongqing.rb | 33 -- .../lib/tzinfo/definitions/Asia/Colombo.rb | 30 -- .../lib/tzinfo/definitions/Asia/Dhaka.rb | 27 -- .../lib/tzinfo/definitions/Asia/Hong_Kong.rb | 87 ---- .../lib/tzinfo/definitions/Asia/Irkutsk.rb | 165 ------- .../lib/tzinfo/definitions/Asia/Jakarta.rb | 30 -- .../lib/tzinfo/definitions/Asia/Jerusalem.rb | 163 ------- .../lib/tzinfo/definitions/Asia/Kabul.rb | 20 - .../lib/tzinfo/definitions/Asia/Kamchatka.rb | 163 ------- .../lib/tzinfo/definitions/Asia/Karachi.rb | 32 -- .../lib/tzinfo/definitions/Asia/Kathmandu.rb | 20 - .../lib/tzinfo/definitions/Asia/Kolkata.rb | 25 - .../lib/tzinfo/definitions/Asia/Krasnoyarsk.rb | 163 ------- .../lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb | 31 -- .../lib/tzinfo/definitions/Asia/Kuwait.rb | 18 - .../lib/tzinfo/definitions/Asia/Magadan.rb | 163 ------- .../lib/tzinfo/definitions/Asia/Muscat.rb | 18 - .../lib/tzinfo/definitions/Asia/Novosibirsk.rb | 164 ------- .../lib/tzinfo/definitions/Asia/Rangoon.rb | 24 - .../lib/tzinfo/definitions/Asia/Riyadh.rb | 18 - .../lib/tzinfo/definitions/Asia/Seoul.rb | 34 -- .../lib/tzinfo/definitions/Asia/Shanghai.rb | 35 -- .../lib/tzinfo/definitions/Asia/Singapore.rb | 33 -- .../lib/tzinfo/definitions/Asia/Taipei.rb | 59 --- .../lib/tzinfo/definitions/Asia/Tashkent.rb | 47 -- .../lib/tzinfo/definitions/Asia/Tbilisi.rb | 78 ---- .../lib/tzinfo/definitions/Asia/Tehran.rb | 121 ----- .../lib/tzinfo/definitions/Asia/Tokyo.rb | 30 -- .../lib/tzinfo/definitions/Asia/Ulaanbaatar.rb | 65 --- .../lib/tzinfo/definitions/Asia/Urumqi.rb | 33 -- .../lib/tzinfo/definitions/Asia/Vladivostok.rb | 164 ------- .../lib/tzinfo/definitions/Asia/Yakutsk.rb | 163 ------- .../lib/tzinfo/definitions/Asia/Yekaterinburg.rb | 165 ------- .../lib/tzinfo/definitions/Asia/Yerevan.rb | 165 ------- .../lib/tzinfo/definitions/Atlantic/Azores.rb | 270 ----------- .../lib/tzinfo/definitions/Atlantic/Cape_Verde.rb | 23 - .../tzinfo/definitions/Atlantic/South_Georgia.rb | 18 - .../lib/tzinfo/definitions/Australia/Adelaide.rb | 187 -------- .../lib/tzinfo/definitions/Australia/Brisbane.rb | 35 -- .../lib/tzinfo/definitions/Australia/Darwin.rb | 29 -- .../lib/tzinfo/definitions/Australia/Hobart.rb | 193 -------- .../lib/tzinfo/definitions/Australia/Melbourne.rb | 185 -------- .../lib/tzinfo/definitions/Australia/Perth.rb | 37 -- .../lib/tzinfo/definitions/Australia/Sydney.rb | 185 -------- .../lib/tzinfo/definitions/Etc/UTC.rb | 16 - .../lib/tzinfo/definitions/Europe/Amsterdam.rb | 228 --------- .../lib/tzinfo/definitions/Europe/Athens.rb | 185 -------- .../lib/tzinfo/definitions/Europe/Belgrade.rb | 163 ------- .../lib/tzinfo/definitions/Europe/Berlin.rb | 188 -------- .../lib/tzinfo/definitions/Europe/Bratislava.rb | 13 - .../lib/tzinfo/definitions/Europe/Brussels.rb | 232 ---------- .../lib/tzinfo/definitions/Europe/Bucharest.rb | 181 -------- .../lib/tzinfo/definitions/Europe/Budapest.rb | 197 -------- .../lib/tzinfo/definitions/Europe/Copenhagen.rb | 179 -------- .../lib/tzinfo/definitions/Europe/Dublin.rb | 276 ----------- .../lib/tzinfo/definitions/Europe/Helsinki.rb | 163 ------- .../lib/tzinfo/definitions/Europe/Istanbul.rb | 218 --------- .../lib/tzinfo/definitions/Europe/Kiev.rb | 168 ------- .../lib/tzinfo/definitions/Europe/Lisbon.rb | 268 ----------- .../lib/tzinfo/definitions/Europe/Ljubljana.rb | 13 - .../lib/tzinfo/definitions/Europe/London.rb | 288 ------------ .../lib/tzinfo/definitions/Europe/Madrid.rb | 211 --------- .../lib/tzinfo/definitions/Europe/Minsk.rb | 170 ------- .../lib/tzinfo/definitions/Europe/Moscow.rb | 181 -------- .../lib/tzinfo/definitions/Europe/Paris.rb | 232 ---------- .../lib/tzinfo/definitions/Europe/Prague.rb | 187 -------- .../lib/tzinfo/definitions/Europe/Riga.rb | 176 ------- .../lib/tzinfo/definitions/Europe/Rome.rb | 215 --------- .../lib/tzinfo/definitions/Europe/Sarajevo.rb | 13 - .../lib/tzinfo/definitions/Europe/Skopje.rb | 13 - .../lib/tzinfo/definitions/Europe/Sofia.rb | 173 ------- .../lib/tzinfo/definitions/Europe/Stockholm.rb | 165 ------- .../lib/tzinfo/definitions/Europe/Tallinn.rb | 172 ------- .../lib/tzinfo/definitions/Europe/Vienna.rb | 183 -------- .../lib/tzinfo/definitions/Europe/Vilnius.rb | 170 ------- .../lib/tzinfo/definitions/Europe/Warsaw.rb | 212 --------- .../lib/tzinfo/definitions/Europe/Zagreb.rb | 13 - .../lib/tzinfo/definitions/Pacific/Auckland.rb | 202 -------- .../lib/tzinfo/definitions/Pacific/Fiji.rb | 23 - .../lib/tzinfo/definitions/Pacific/Guam.rb | 22 - .../lib/tzinfo/definitions/Pacific/Honolulu.rb | 28 -- .../lib/tzinfo/definitions/Pacific/Majuro.rb | 20 - .../lib/tzinfo/definitions/Pacific/Midway.rb | 25 - .../lib/tzinfo/definitions/Pacific/Noumea.rb | 25 - .../lib/tzinfo/definitions/Pacific/Pago_Pago.rb | 26 -- .../lib/tzinfo/definitions/Pacific/Port_Moresby.rb | 20 - .../lib/tzinfo/definitions/Pacific/Tongatapu.rb | 27 -- .../tzinfo-0.3.13/lib/tzinfo/info_timezone.rb | 52 --- .../tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb | 51 --- .../lib/tzinfo/linked_timezone_info.rb | 44 -- .../tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb | 98 ---- .../tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb | 56 --- .../tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb | 292 ------------ .../vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb | 508 --------------------- .../lib/tzinfo/timezone_definition.rb | 56 --- .../tzinfo-0.3.13/lib/tzinfo/timezone_info.rb | 40 -- .../lib/tzinfo/timezone_offset_info.rb | 94 ---- .../tzinfo-0.3.13/lib/tzinfo/timezone_period.rb | 198 -------- .../lib/tzinfo/timezone_transition_info.rb | 129 ------ .../vendor/tzinfo-0.3.15/lib/tzinfo.rb | 33 ++ .../tzinfo-0.3.15/lib/tzinfo/data_timezone.rb | 47 ++ .../tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb | 228 +++++++++ .../lib/tzinfo/definitions/Africa/Algiers.rb | 55 +++ .../lib/tzinfo/definitions/Africa/Cairo.rb | 219 +++++++++ .../lib/tzinfo/definitions/Africa/Casablanca.rb | 42 ++ .../lib/tzinfo/definitions/Africa/Harare.rb | 18 + .../lib/tzinfo/definitions/Africa/Johannesburg.rb | 25 + .../lib/tzinfo/definitions/Africa/Monrovia.rb | 22 + .../lib/tzinfo/definitions/Africa/Nairobi.rb | 23 + .../definitions/America/Argentina/Buenos_Aires.rb | 84 ++++ .../definitions/America/Argentina/San_Juan.rb | 86 ++++ .../lib/tzinfo/definitions/America/Bogota.rb | 23 + .../lib/tzinfo/definitions/America/Caracas.rb | 23 + .../lib/tzinfo/definitions/America/Chicago.rb | 283 ++++++++++++ .../lib/tzinfo/definitions/America/Chihuahua.rb | 136 ++++++ .../lib/tzinfo/definitions/America/Denver.rb | 204 +++++++++ .../lib/tzinfo/definitions/America/Godthab.rb | 161 +++++++ .../lib/tzinfo/definitions/America/Guatemala.rb | 27 ++ .../lib/tzinfo/definitions/America/Halifax.rb | 274 +++++++++++ .../definitions/America/Indiana/Indianapolis.rb | 149 ++++++ .../lib/tzinfo/definitions/America/Juneau.rb | 194 ++++++++ .../lib/tzinfo/definitions/America/La_Paz.rb | 22 + .../lib/tzinfo/definitions/America/Lima.rb | 35 ++ .../lib/tzinfo/definitions/America/Los_Angeles.rb | 232 ++++++++++ .../lib/tzinfo/definitions/America/Mazatlan.rb | 139 ++++++ .../lib/tzinfo/definitions/America/Mexico_City.rb | 144 ++++++ .../lib/tzinfo/definitions/America/Monterrey.rb | 131 ++++++ .../lib/tzinfo/definitions/America/New_York.rb | 282 ++++++++++++ .../lib/tzinfo/definitions/America/Phoenix.rb | 30 ++ .../lib/tzinfo/definitions/America/Regina.rb | 74 +++ .../lib/tzinfo/definitions/America/Santiago.rb | 205 +++++++++ .../lib/tzinfo/definitions/America/Sao_Paulo.rb | 171 +++++++ .../lib/tzinfo/definitions/America/St_Johns.rb | 288 ++++++++++++ .../lib/tzinfo/definitions/America/Tijuana.rb | 196 ++++++++ .../lib/tzinfo/definitions/Asia/Almaty.rb | 67 +++ .../lib/tzinfo/definitions/Asia/Baghdad.rb | 73 +++ .../lib/tzinfo/definitions/Asia/Baku.rb | 161 +++++++ .../lib/tzinfo/definitions/Asia/Bangkok.rb | 20 + .../lib/tzinfo/definitions/Asia/Chongqing.rb | 33 ++ .../lib/tzinfo/definitions/Asia/Colombo.rb | 30 ++ .../lib/tzinfo/definitions/Asia/Dhaka.rb | 29 ++ .../lib/tzinfo/definitions/Asia/Hong_Kong.rb | 87 ++++ .../lib/tzinfo/definitions/Asia/Irkutsk.rb | 165 +++++++ .../lib/tzinfo/definitions/Asia/Jakarta.rb | 30 ++ .../lib/tzinfo/definitions/Asia/Jerusalem.rb | 163 +++++++ .../lib/tzinfo/definitions/Asia/Kabul.rb | 20 + .../lib/tzinfo/definitions/Asia/Kamchatka.rb | 163 +++++++ .../lib/tzinfo/definitions/Asia/Karachi.rb | 114 +++++ .../lib/tzinfo/definitions/Asia/Kathmandu.rb | 20 + .../lib/tzinfo/definitions/Asia/Kolkata.rb | 25 + .../lib/tzinfo/definitions/Asia/Krasnoyarsk.rb | 163 +++++++ .../lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb | 31 ++ .../lib/tzinfo/definitions/Asia/Kuwait.rb | 18 + .../lib/tzinfo/definitions/Asia/Magadan.rb | 163 +++++++ .../lib/tzinfo/definitions/Asia/Muscat.rb | 18 + .../lib/tzinfo/definitions/Asia/Novosibirsk.rb | 164 +++++++ .../lib/tzinfo/definitions/Asia/Rangoon.rb | 24 + .../lib/tzinfo/definitions/Asia/Riyadh.rb | 18 + .../lib/tzinfo/definitions/Asia/Seoul.rb | 34 ++ .../lib/tzinfo/definitions/Asia/Shanghai.rb | 35 ++ .../lib/tzinfo/definitions/Asia/Singapore.rb | 33 ++ .../lib/tzinfo/definitions/Asia/Taipei.rb | 59 +++ .../lib/tzinfo/definitions/Asia/Tashkent.rb | 47 ++ .../lib/tzinfo/definitions/Asia/Tbilisi.rb | 78 ++++ .../lib/tzinfo/definitions/Asia/Tehran.rb | 121 +++++ .../lib/tzinfo/definitions/Asia/Tokyo.rb | 30 ++ .../lib/tzinfo/definitions/Asia/Ulaanbaatar.rb | 65 +++ .../lib/tzinfo/definitions/Asia/Urumqi.rb | 33 ++ .../lib/tzinfo/definitions/Asia/Vladivostok.rb | 164 +++++++ .../lib/tzinfo/definitions/Asia/Yakutsk.rb | 163 +++++++ .../lib/tzinfo/definitions/Asia/Yekaterinburg.rb | 165 +++++++ .../lib/tzinfo/definitions/Asia/Yerevan.rb | 165 +++++++ .../lib/tzinfo/definitions/Atlantic/Azores.rb | 270 +++++++++++ .../lib/tzinfo/definitions/Atlantic/Cape_Verde.rb | 23 + .../tzinfo/definitions/Atlantic/South_Georgia.rb | 18 + .../lib/tzinfo/definitions/Australia/Adelaide.rb | 187 ++++++++ .../lib/tzinfo/definitions/Australia/Brisbane.rb | 35 ++ .../lib/tzinfo/definitions/Australia/Darwin.rb | 29 ++ .../lib/tzinfo/definitions/Australia/Hobart.rb | 193 ++++++++ .../lib/tzinfo/definitions/Australia/Melbourne.rb | 185 ++++++++ .../lib/tzinfo/definitions/Australia/Perth.rb | 37 ++ .../lib/tzinfo/definitions/Australia/Sydney.rb | 185 ++++++++ .../lib/tzinfo/definitions/Etc/UTC.rb | 16 + .../lib/tzinfo/definitions/Europe/Amsterdam.rb | 228 +++++++++ .../lib/tzinfo/definitions/Europe/Athens.rb | 185 ++++++++ .../lib/tzinfo/definitions/Europe/Belgrade.rb | 163 +++++++ .../lib/tzinfo/definitions/Europe/Berlin.rb | 188 ++++++++ .../lib/tzinfo/definitions/Europe/Bratislava.rb | 13 + .../lib/tzinfo/definitions/Europe/Brussels.rb | 232 ++++++++++ .../lib/tzinfo/definitions/Europe/Bucharest.rb | 181 ++++++++ .../lib/tzinfo/definitions/Europe/Budapest.rb | 197 ++++++++ .../lib/tzinfo/definitions/Europe/Copenhagen.rb | 179 ++++++++ .../lib/tzinfo/definitions/Europe/Dublin.rb | 276 +++++++++++ .../lib/tzinfo/definitions/Europe/Helsinki.rb | 163 +++++++ .../lib/tzinfo/definitions/Europe/Istanbul.rb | 218 +++++++++ .../lib/tzinfo/definitions/Europe/Kiev.rb | 168 +++++++ .../lib/tzinfo/definitions/Europe/Lisbon.rb | 268 +++++++++++ .../lib/tzinfo/definitions/Europe/Ljubljana.rb | 13 + .../lib/tzinfo/definitions/Europe/London.rb | 288 ++++++++++++ .../lib/tzinfo/definitions/Europe/Madrid.rb | 211 +++++++++ .../lib/tzinfo/definitions/Europe/Minsk.rb | 170 +++++++ .../lib/tzinfo/definitions/Europe/Moscow.rb | 181 ++++++++ .../lib/tzinfo/definitions/Europe/Paris.rb | 232 ++++++++++ .../lib/tzinfo/definitions/Europe/Prague.rb | 187 ++++++++ .../lib/tzinfo/definitions/Europe/Riga.rb | 176 +++++++ .../lib/tzinfo/definitions/Europe/Rome.rb | 215 +++++++++ .../lib/tzinfo/definitions/Europe/Sarajevo.rb | 13 + .../lib/tzinfo/definitions/Europe/Skopje.rb | 13 + .../lib/tzinfo/definitions/Europe/Sofia.rb | 173 +++++++ .../lib/tzinfo/definitions/Europe/Stockholm.rb | 165 +++++++ .../lib/tzinfo/definitions/Europe/Tallinn.rb | 172 +++++++ .../lib/tzinfo/definitions/Europe/Vienna.rb | 183 ++++++++ .../lib/tzinfo/definitions/Europe/Vilnius.rb | 170 +++++++ .../lib/tzinfo/definitions/Europe/Warsaw.rb | 212 +++++++++ .../lib/tzinfo/definitions/Europe/Zagreb.rb | 13 + .../lib/tzinfo/definitions/Pacific/Auckland.rb | 202 ++++++++ .../lib/tzinfo/definitions/Pacific/Fiji.rb | 23 + .../lib/tzinfo/definitions/Pacific/Guam.rb | 22 + .../lib/tzinfo/definitions/Pacific/Honolulu.rb | 28 ++ .../lib/tzinfo/definitions/Pacific/Majuro.rb | 20 + .../lib/tzinfo/definitions/Pacific/Midway.rb | 25 + .../lib/tzinfo/definitions/Pacific/Noumea.rb | 25 + .../lib/tzinfo/definitions/Pacific/Pago_Pago.rb | 26 ++ .../lib/tzinfo/definitions/Pacific/Port_Moresby.rb | 20 + .../lib/tzinfo/definitions/Pacific/Tongatapu.rb | 27 ++ .../tzinfo-0.3.15/lib/tzinfo/info_timezone.rb | 52 +++ .../tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb | 51 +++ .../lib/tzinfo/linked_timezone_info.rb | 44 ++ .../tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb | 98 ++++ .../tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb | 56 +++ .../tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb | 292 ++++++++++++ .../vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb | 508 +++++++++++++++++++++ .../lib/tzinfo/timezone_definition.rb | 56 +++ .../tzinfo-0.3.15/lib/tzinfo/timezone_info.rb | 40 ++ .../lib/tzinfo/timezone_offset_info.rb | 94 ++++ .../tzinfo-0.3.15/lib/tzinfo/timezone_period.rb | 198 ++++++++ .../lib/tzinfo/timezone_transition_info.rb | 129 ++++++ 278 files changed, 15959 insertions(+), 15955 deletions(-) delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb delete mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb create mode 100644 activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 9c5803c52a..fd45a248bb 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *Edge* +* Update bundled TZInfo to v0.3.15 [Geoff Buesing] + * JSON: +Object#to_json+ calls +as_json+ to coerce itself into something natively encodable like +Hash+, +Integer+, or +String+. Override +as_json+ instead of +to_json+ so you're JSON library agnostic. [Jeremy Kemper] * String #to_time and #to_datetime: handle fractional seconds #864 [Jason Frey] diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index 0f9b0c7554..4a711b7e25 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -4,7 +4,7 @@ def ActiveSupport.requirable?(file) $LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? } end -[%w(builder 2.1.2), %w(i18n 0.1.3), %w(memcache-client 1.7.5), %w(tzinfo 0.3.13)].each do |lib, version| +[%w(builder 2.1.2), %w(i18n 0.1.3), %w(memcache-client 1.7.5), %w(tzinfo 0.3.15)].each do |lib, version| # If the lib is not already requirable unless ActiveSupport.requirable? lib # Try to activate a gem ~> satisfying the requested version first. diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb deleted file mode 100644 index c8bdbeec5d..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb +++ /dev/null @@ -1,33 +0,0 @@ -#-- -# Copyright (c) 2005-2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -# Add the directory containing this file to the start of the load path if it -# isn't there already. -$:.unshift(File.dirname(__FILE__)) unless - $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) - -require 'tzinfo/timezone' -# require 'tzinfo/country' -# require 'tzinfo/tzdataparser' -# require 'tzinfo/timezone_proxy' -require 'tzinfo/data_timezone' -require 'tzinfo/linked_timezone' \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb deleted file mode 100644 index 5eccbdf0db..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb +++ /dev/null @@ -1,47 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/info_timezone' - -module TZInfo - - # A Timezone based on a DataTimezoneInfo. - class DataTimezone < InfoTimezone #:nodoc: - - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - # - # If no TimezonePeriod could be found, PeriodNotFound is raised. - def period_for_utc(utc) - info.period_for_utc(utc) - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how abiguities should be resolved. - # Raises PeriodNotFound if no periods are found for the given time. - def periods_for_local(local) - info.periods_for_local(local) - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb deleted file mode 100644 index a45d94554b..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb +++ /dev/null @@ -1,228 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/time_or_datetime' -require 'tzinfo/timezone_info' -require 'tzinfo/timezone_offset_info' -require 'tzinfo/timezone_period' -require 'tzinfo/timezone_transition_info' - -module TZInfo - # Thrown if no offsets have been defined when calling period_for_utc or - # periods_for_local. Indicates an error in the timezone data. - class NoOffsetsDefined < StandardError - end - - # Represents a (non-linked) timezone defined in a data module. - class DataTimezoneInfo < TimezoneInfo #:nodoc: - - # Constructs a new TimezoneInfo with its identifier. - def initialize(identifier) - super(identifier) - @offsets = {} - @transitions = [] - @previous_offset = nil - @transitions_index = nil - end - - # Defines a offset. The id uniquely identifies this offset within the - # timezone. utc_offset and std_offset define the offset in seconds of - # standard time from UTC and daylight savings from standard time - # respectively. abbreviation describes the timezone offset (e.g. GMT, BST, - # EST or EDT). - # - # The first offset to be defined is treated as the offset that applies - # until the first transition. This will usually be in Local Mean Time (LMT). - # - # ArgumentError will be raised if the id is already defined. - def offset(id, utc_offset, std_offset, abbreviation) - raise ArgumentError, 'Offset already defined' if @offsets.has_key?(id) - - offset = TimezoneOffsetInfo.new(utc_offset, std_offset, abbreviation) - @offsets[id] = offset - @previous_offset = offset unless @previous_offset - end - - # Defines a transition. Transitions must be defined in chronological order. - # ArgumentError will be raised if a transition is added out of order. - # offset_id refers to an id defined with offset. ArgumentError will be - # raised if the offset_id cannot be found. numerator_or_time and - # denomiator specify the time the transition occurs as. See - # TimezoneTransitionInfo for more detail about specifying times. - def transition(year, month, offset_id, numerator_or_time, denominator = nil) - offset = @offsets[offset_id] - raise ArgumentError, 'Offset not found' unless offset - - if @transitions_index - if year < @last_year || (year == @last_year && month < @last_month) - raise ArgumentError, 'Transitions must be increasing date order' - end - - # Record the position of the first transition with this index. - index = transition_index(year, month) - @transitions_index[index] ||= @transitions.length - - # Fill in any gaps - (index - 1).downto(0) do |i| - break if @transitions_index[i] - @transitions_index[i] = @transitions.length - end - else - @transitions_index = [@transitions.length] - @start_year = year - @start_month = month - end - - @transitions << TimezoneTransitionInfo.new(offset, @previous_offset, - numerator_or_time, denominator) - @last_year = year - @last_month = month - @previous_offset = offset - end - - # Returns the TimezonePeriod for the given UTC time. - # Raises NoOffsetsDefined if no offsets have been defined. - def period_for_utc(utc) - unless @transitions.empty? - utc = TimeOrDateTime.wrap(utc) - index = transition_index(utc.year, utc.mon) - - start_transition = nil - start = transition_before_end(index) - if start - start.downto(0) do |i| - if @transitions[i].at <= utc - start_transition = @transitions[i] - break - end - end - end - - end_transition = nil - start = transition_after_start(index) - if start - start.upto(@transitions.length - 1) do |i| - if @transitions[i].at > utc - end_transition = @transitions[i] - break - end - end - end - - if start_transition || end_transition - TimezonePeriod.new(start_transition, end_transition) - else - # Won't happen since there are transitions. Must always find one - # transition that is either >= or < the specified time. - raise 'No transitions found in search' - end - else - raise NoOffsetsDefined, 'No offsets have been defined' unless @previous_offset - TimezonePeriod.new(nil, nil, @previous_offset) - end - end - - # Returns the set of TimezonePeriods for the given local time as an array. - # Results returned are ordered by increasing UTC start date. - # Returns an empty array if no periods are found for the given time. - # Raises NoOffsetsDefined if no offsets have been defined. - def periods_for_local(local) - unless @transitions.empty? - local = TimeOrDateTime.wrap(local) - index = transition_index(local.year, local.mon) - - result = [] - - start_index = transition_after_start(index - 1) - if start_index && @transitions[start_index].local_end > local - if start_index > 0 - if @transitions[start_index - 1].local_start <= local - result << TimezonePeriod.new(@transitions[start_index - 1], @transitions[start_index]) - end - else - result << TimezonePeriod.new(nil, @transitions[start_index]) - end - end - - end_index = transition_before_end(index + 1) - - if end_index - start_index = end_index unless start_index - - start_index.upto(transition_before_end(index + 1)) do |i| - if @transitions[i].local_start <= local - if i + 1 < @transitions.length - if @transitions[i + 1].local_end > local - result << TimezonePeriod.new(@transitions[i], @transitions[i + 1]) - end - else - result << TimezonePeriod.new(@transitions[i], nil) - end - end - end - end - - result - else - raise NoOffsetsDefined, 'No offsets have been defined' unless @previous_offset - [TimezonePeriod.new(nil, nil, @previous_offset)] - end - end - - private - # Returns the index into the @transitions_index array for a given year - # and month. - def transition_index(year, month) - index = (year - @start_year) * 2 - index += 1 if month > 6 - index -= 1 if @start_month > 6 - index - end - - # Returns the index into @transitions of the first transition that occurs - # on or after the start of the given index into @transitions_index. - # Returns nil if there are no such transitions. - def transition_after_start(index) - if index >= @transitions_index.length - nil - else - index = 0 if index < 0 - @transitions_index[index] - end - end - - # Returns the index into @transitions of the first transition that occurs - # before the end of the given index into @transitions_index. - # Returns nil if there are no such transitions. - def transition_before_end(index) - index = index + 1 - - if index <= 0 - nil - elsif index >= @transitions_index.length - @transitions.length - 1 - else - @transitions_index[index] - 1 - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb deleted file mode 100644 index 8c5f25577f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Algiers - include TimezoneDefinition - - timezone 'Africa/Algiers' do |tz| - tz.offset :o0, 732, 0, :LMT - tz.offset :o1, 561, 0, :PMT - tz.offset :o2, 0, 0, :WET - tz.offset :o3, 0, 3600, :WEST - tz.offset :o4, 3600, 0, :CET - tz.offset :o5, 3600, 3600, :CEST - - tz.transition 1891, 3, :o1, 2170625843, 900 - tz.transition 1911, 3, :o2, 69670267013, 28800 - tz.transition 1916, 6, :o3, 58104707, 24 - tz.transition 1916, 10, :o2, 58107323, 24 - tz.transition 1917, 3, :o3, 58111499, 24 - tz.transition 1917, 10, :o2, 58116227, 24 - tz.transition 1918, 3, :o3, 58119899, 24 - tz.transition 1918, 10, :o2, 58124963, 24 - tz.transition 1919, 3, :o3, 58128467, 24 - tz.transition 1919, 10, :o2, 58133699, 24 - tz.transition 1920, 2, :o3, 58136867, 24 - tz.transition 1920, 10, :o2, 58142915, 24 - tz.transition 1921, 3, :o3, 58146323, 24 - tz.transition 1921, 6, :o2, 58148699, 24 - tz.transition 1939, 9, :o3, 58308443, 24 - tz.transition 1939, 11, :o2, 4859173, 2 - tz.transition 1940, 2, :o4, 29156215, 12 - tz.transition 1944, 4, :o5, 58348405, 24 - tz.transition 1944, 10, :o4, 4862743, 2 - tz.transition 1945, 4, :o5, 58357141, 24 - tz.transition 1945, 9, :o4, 58361147, 24 - tz.transition 1946, 10, :o2, 58370411, 24 - tz.transition 1956, 1, :o4, 4871003, 2 - tz.transition 1963, 4, :o2, 58515203, 24 - tz.transition 1971, 4, :o3, 41468400 - tz.transition 1971, 9, :o2, 54774000 - tz.transition 1977, 5, :o3, 231724800 - tz.transition 1977, 10, :o4, 246236400 - tz.transition 1978, 3, :o5, 259545600 - tz.transition 1978, 9, :o4, 275274000 - tz.transition 1979, 10, :o2, 309740400 - tz.transition 1980, 4, :o3, 325468800 - tz.transition 1980, 10, :o2, 341802000 - tz.transition 1981, 5, :o4, 357523200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb deleted file mode 100644 index 6e6daf3522..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Cairo - include TimezoneDefinition - - timezone 'Africa/Cairo' do |tz| - tz.offset :o0, 7500, 0, :LMT - tz.offset :o1, 7200, 0, :EET - tz.offset :o2, 7200, 3600, :EEST - - tz.transition 1900, 9, :o1, 695604503, 288 - tz.transition 1940, 7, :o2, 29157905, 12 - tz.transition 1940, 9, :o1, 19439227, 8 - tz.transition 1941, 4, :o2, 29161193, 12 - tz.transition 1941, 9, :o1, 19442027, 8 - tz.transition 1942, 3, :o2, 29165405, 12 - tz.transition 1942, 10, :o1, 19445275, 8 - tz.transition 1943, 3, :o2, 29169785, 12 - tz.transition 1943, 10, :o1, 19448235, 8 - tz.transition 1944, 3, :o2, 29174177, 12 - tz.transition 1944, 10, :o1, 19451163, 8 - tz.transition 1945, 4, :o2, 29178737, 12 - tz.transition 1945, 10, :o1, 19454083, 8 - tz.transition 1957, 5, :o2, 29231621, 12 - tz.transition 1957, 9, :o1, 19488899, 8 - tz.transition 1958, 4, :o2, 29235893, 12 - tz.transition 1958, 9, :o1, 19491819, 8 - tz.transition 1959, 4, :o2, 58480547, 24 - tz.transition 1959, 9, :o1, 4873683, 2 - tz.transition 1960, 4, :o2, 58489331, 24 - tz.transition 1960, 9, :o1, 4874415, 2 - tz.transition 1961, 4, :o2, 58498091, 24 - tz.transition 1961, 9, :o1, 4875145, 2 - tz.transition 1962, 4, :o2, 58506851, 24 - tz.transition 1962, 9, :o1, 4875875, 2 - tz.transition 1963, 4, :o2, 58515611, 24 - tz.transition 1963, 9, :o1, 4876605, 2 - tz.transition 1964, 4, :o2, 58524395, 24 - tz.transition 1964, 9, :o1, 4877337, 2 - tz.transition 1965, 4, :o2, 58533155, 24 - tz.transition 1965, 9, :o1, 4878067, 2 - tz.transition 1966, 4, :o2, 58541915, 24 - tz.transition 1966, 10, :o1, 4878799, 2 - tz.transition 1967, 4, :o2, 58550675, 24 - tz.transition 1967, 10, :o1, 4879529, 2 - tz.transition 1968, 4, :o2, 58559459, 24 - tz.transition 1968, 10, :o1, 4880261, 2 - tz.transition 1969, 4, :o2, 58568219, 24 - tz.transition 1969, 10, :o1, 4880991, 2 - tz.transition 1970, 4, :o2, 10364400 - tz.transition 1970, 10, :o1, 23587200 - tz.transition 1971, 4, :o2, 41900400 - tz.transition 1971, 10, :o1, 55123200 - tz.transition 1972, 4, :o2, 73522800 - tz.transition 1972, 10, :o1, 86745600 - tz.transition 1973, 4, :o2, 105058800 - tz.transition 1973, 10, :o1, 118281600 - tz.transition 1974, 4, :o2, 136594800 - tz.transition 1974, 10, :o1, 149817600 - tz.transition 1975, 4, :o2, 168130800 - tz.transition 1975, 10, :o1, 181353600 - tz.transition 1976, 4, :o2, 199753200 - tz.transition 1976, 10, :o1, 212976000 - tz.transition 1977, 4, :o2, 231289200 - tz.transition 1977, 10, :o1, 244512000 - tz.transition 1978, 4, :o2, 262825200 - tz.transition 1978, 10, :o1, 276048000 - tz.transition 1979, 4, :o2, 294361200 - tz.transition 1979, 10, :o1, 307584000 - tz.transition 1980, 4, :o2, 325983600 - tz.transition 1980, 10, :o1, 339206400 - tz.transition 1981, 4, :o2, 357519600 - tz.transition 1981, 10, :o1, 370742400 - tz.transition 1982, 7, :o2, 396399600 - tz.transition 1982, 10, :o1, 402278400 - tz.transition 1983, 7, :o2, 426812400 - tz.transition 1983, 10, :o1, 433814400 - tz.transition 1984, 4, :o2, 452214000 - tz.transition 1984, 10, :o1, 465436800 - tz.transition 1985, 4, :o2, 483750000 - tz.transition 1985, 10, :o1, 496972800 - tz.transition 1986, 4, :o2, 515286000 - tz.transition 1986, 10, :o1, 528508800 - tz.transition 1987, 4, :o2, 546822000 - tz.transition 1987, 10, :o1, 560044800 - tz.transition 1988, 4, :o2, 578444400 - tz.transition 1988, 10, :o1, 591667200 - tz.transition 1989, 5, :o2, 610412400 - tz.transition 1989, 10, :o1, 623203200 - tz.transition 1990, 4, :o2, 641516400 - tz.transition 1990, 10, :o1, 654739200 - tz.transition 1991, 4, :o2, 673052400 - tz.transition 1991, 10, :o1, 686275200 - tz.transition 1992, 4, :o2, 704674800 - tz.transition 1992, 10, :o1, 717897600 - tz.transition 1993, 4, :o2, 736210800 - tz.transition 1993, 10, :o1, 749433600 - tz.transition 1994, 4, :o2, 767746800 - tz.transition 1994, 10, :o1, 780969600 - tz.transition 1995, 4, :o2, 799020000 - tz.transition 1995, 9, :o1, 812322000 - tz.transition 1996, 4, :o2, 830469600 - tz.transition 1996, 9, :o1, 843771600 - tz.transition 1997, 4, :o2, 861919200 - tz.transition 1997, 9, :o1, 875221200 - tz.transition 1998, 4, :o2, 893368800 - tz.transition 1998, 9, :o1, 906670800 - tz.transition 1999, 4, :o2, 925423200 - tz.transition 1999, 9, :o1, 938725200 - tz.transition 2000, 4, :o2, 956872800 - tz.transition 2000, 9, :o1, 970174800 - tz.transition 2001, 4, :o2, 988322400 - tz.transition 2001, 9, :o1, 1001624400 - tz.transition 2002, 4, :o2, 1019772000 - tz.transition 2002, 9, :o1, 1033074000 - tz.transition 2003, 4, :o2, 1051221600 - tz.transition 2003, 9, :o1, 1064523600 - tz.transition 2004, 4, :o2, 1083276000 - tz.transition 2004, 9, :o1, 1096578000 - tz.transition 2005, 4, :o2, 1114725600 - tz.transition 2005, 9, :o1, 1128027600 - tz.transition 2006, 4, :o2, 1146175200 - tz.transition 2006, 9, :o1, 1158872400 - tz.transition 2007, 4, :o2, 1177624800 - tz.transition 2007, 9, :o1, 1189112400 - tz.transition 2008, 4, :o2, 1209074400 - tz.transition 2008, 8, :o1, 1219957200 - tz.transition 2009, 4, :o2, 1240524000 - tz.transition 2009, 8, :o1, 1251406800 - tz.transition 2010, 4, :o2, 1272578400 - tz.transition 2010, 8, :o1, 1282856400 - tz.transition 2011, 4, :o2, 1304028000 - tz.transition 2011, 8, :o1, 1314306000 - tz.transition 2012, 4, :o2, 1335477600 - tz.transition 2012, 8, :o1, 1346360400 - tz.transition 2013, 4, :o2, 1366927200 - tz.transition 2013, 8, :o1, 1377810000 - tz.transition 2014, 4, :o2, 1398376800 - tz.transition 2014, 8, :o1, 1409259600 - tz.transition 2015, 4, :o2, 1429826400 - tz.transition 2015, 8, :o1, 1440709200 - tz.transition 2016, 4, :o2, 1461880800 - tz.transition 2016, 8, :o1, 1472158800 - tz.transition 2017, 4, :o2, 1493330400 - tz.transition 2017, 8, :o1, 1504213200 - tz.transition 2018, 4, :o2, 1524780000 - tz.transition 2018, 8, :o1, 1535662800 - tz.transition 2019, 4, :o2, 1556229600 - tz.transition 2019, 8, :o1, 1567112400 - tz.transition 2020, 4, :o2, 1587679200 - tz.transition 2020, 8, :o1, 1598562000 - tz.transition 2021, 4, :o2, 1619733600 - tz.transition 2021, 8, :o1, 1630011600 - tz.transition 2022, 4, :o2, 1651183200 - tz.transition 2022, 8, :o1, 1661461200 - tz.transition 2023, 4, :o2, 1682632800 - tz.transition 2023, 8, :o1, 1693515600 - tz.transition 2024, 4, :o2, 1714082400 - tz.transition 2024, 8, :o1, 1724965200 - tz.transition 2025, 4, :o2, 1745532000 - tz.transition 2025, 8, :o1, 1756414800 - tz.transition 2026, 4, :o2, 1776981600 - tz.transition 2026, 8, :o1, 1787864400 - tz.transition 2027, 4, :o2, 1809036000 - tz.transition 2027, 8, :o1, 1819314000 - tz.transition 2028, 4, :o2, 1840485600 - tz.transition 2028, 8, :o1, 1851368400 - tz.transition 2029, 4, :o2, 1871935200 - tz.transition 2029, 8, :o1, 1882818000 - tz.transition 2030, 4, :o2, 1903384800 - tz.transition 2030, 8, :o1, 1914267600 - tz.transition 2031, 4, :o2, 1934834400 - tz.transition 2031, 8, :o1, 1945717200 - tz.transition 2032, 4, :o2, 1966888800 - tz.transition 2032, 8, :o1, 1977166800 - tz.transition 2033, 4, :o2, 1998338400 - tz.transition 2033, 8, :o1, 2008616400 - tz.transition 2034, 4, :o2, 2029788000 - tz.transition 2034, 8, :o1, 2040670800 - tz.transition 2035, 4, :o2, 2061237600 - tz.transition 2035, 8, :o1, 2072120400 - tz.transition 2036, 4, :o2, 2092687200 - tz.transition 2036, 8, :o1, 2103570000 - tz.transition 2037, 4, :o2, 2124136800 - tz.transition 2037, 8, :o1, 2135019600 - tz.transition 2038, 4, :o2, 29586521, 12 - tz.transition 2038, 8, :o1, 19725299, 8 - tz.transition 2039, 4, :o2, 29590889, 12 - tz.transition 2039, 8, :o1, 19728211, 8 - tz.transition 2040, 4, :o2, 29595257, 12 - tz.transition 2040, 8, :o1, 19731179, 8 - tz.transition 2041, 4, :o2, 29599625, 12 - tz.transition 2041, 8, :o1, 19734091, 8 - tz.transition 2042, 4, :o2, 29603993, 12 - tz.transition 2042, 8, :o1, 19737003, 8 - tz.transition 2043, 4, :o2, 29608361, 12 - tz.transition 2043, 8, :o1, 19739915, 8 - tz.transition 2044, 4, :o2, 29612813, 12 - tz.transition 2044, 8, :o1, 19742827, 8 - tz.transition 2045, 4, :o2, 29617181, 12 - tz.transition 2045, 8, :o1, 19745795, 8 - tz.transition 2046, 4, :o2, 29621549, 12 - tz.transition 2046, 8, :o1, 19748707, 8 - tz.transition 2047, 4, :o2, 29625917, 12 - tz.transition 2047, 8, :o1, 19751619, 8 - tz.transition 2048, 4, :o2, 29630285, 12 - tz.transition 2048, 8, :o1, 19754531, 8 - tz.transition 2049, 4, :o2, 29634737, 12 - tz.transition 2049, 8, :o1, 19757443, 8 - tz.transition 2050, 4, :o2, 29639105, 12 - tz.transition 2050, 8, :o1, 19760355, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb deleted file mode 100644 index 18d73c93a0..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Casablanca - include TimezoneDefinition - - timezone 'Africa/Casablanca' do |tz| - tz.offset :o0, -1820, 0, :LMT - tz.offset :o1, 0, 0, :WET - tz.offset :o2, 0, 3600, :WEST - tz.offset :o3, 3600, 0, :CET - - tz.transition 1913, 10, :o1, 10454687371, 4320 - tz.transition 1939, 9, :o2, 4859037, 2 - tz.transition 1939, 11, :o1, 58310075, 24 - tz.transition 1940, 2, :o2, 4859369, 2 - tz.transition 1945, 11, :o1, 58362659, 24 - tz.transition 1950, 6, :o2, 4866887, 2 - tz.transition 1950, 10, :o1, 58406003, 24 - tz.transition 1967, 6, :o2, 2439645, 1 - tz.transition 1967, 9, :o1, 58554347, 24 - tz.transition 1974, 6, :o2, 141264000 - tz.transition 1974, 8, :o1, 147222000 - tz.transition 1976, 5, :o2, 199756800 - tz.transition 1976, 7, :o1, 207702000 - tz.transition 1977, 5, :o2, 231292800 - tz.transition 1977, 9, :o1, 244249200 - tz.transition 1978, 6, :o2, 265507200 - tz.transition 1978, 8, :o1, 271033200 - tz.transition 1984, 3, :o3, 448243200 - tz.transition 1985, 12, :o1, 504918000 - tz.transition 2008, 6, :o2, 1212278400 - tz.transition 2008, 8, :o1, 1220223600 - tz.transition 2009, 6, :o2, 1243814400 - tz.transition 2009, 8, :o1, 1250809200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb deleted file mode 100644 index 070c95ae0f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Harare - include TimezoneDefinition - - timezone 'Africa/Harare' do |tz| - tz.offset :o0, 7452, 0, :LMT - tz.offset :o1, 7200, 0, :CAT - - tz.transition 1903, 2, :o1, 1932939531, 800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb deleted file mode 100644 index f0af0d8e33..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Johannesburg - include TimezoneDefinition - - timezone 'Africa/Johannesburg' do |tz| - tz.offset :o0, 6720, 0, :LMT - tz.offset :o1, 5400, 0, :SAST - tz.offset :o2, 7200, 0, :SAST - tz.offset :o3, 7200, 3600, :SAST - - tz.transition 1892, 2, :o1, 108546139, 45 - tz.transition 1903, 2, :o2, 38658791, 16 - tz.transition 1942, 9, :o3, 4861245, 2 - tz.transition 1943, 3, :o2, 58339307, 24 - tz.transition 1943, 9, :o3, 4861973, 2 - tz.transition 1944, 3, :o2, 58348043, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb deleted file mode 100644 index 40e711fa44..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Monrovia - include TimezoneDefinition - - timezone 'Africa/Monrovia' do |tz| - tz.offset :o0, -2588, 0, :LMT - tz.offset :o1, -2588, 0, :MMT - tz.offset :o2, -2670, 0, :LRT - tz.offset :o3, 0, 0, :GMT - - tz.transition 1882, 1, :o1, 52022445047, 21600 - tz.transition 1919, 3, :o2, 52315600247, 21600 - tz.transition 1972, 5, :o3, 73529070 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb deleted file mode 100644 index 7b0a2f43be..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Africa - module Nairobi - include TimezoneDefinition - - timezone 'Africa/Nairobi' do |tz| - tz.offset :o0, 8836, 0, :LMT - tz.offset :o1, 10800, 0, :EAT - tz.offset :o2, 9000, 0, :BEAT - tz.offset :o3, 9885, 0, :BEAUT - - tz.transition 1928, 6, :o1, 52389253391, 21600 - tz.transition 1929, 12, :o2, 19407819, 8 - tz.transition 1939, 12, :o3, 116622211, 48 - tz.transition 1959, 12, :o1, 14036742061, 5760 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb deleted file mode 100644 index 8f4dd31dbb..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +++ /dev/null @@ -1,166 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Argentina - module Buenos_Aires - include TimezoneDefinition - - timezone 'America/Argentina/Buenos_Aires' do |tz| - tz.offset :o0, -14028, 0, :LMT - tz.offset :o1, -15408, 0, :CMT - tz.offset :o2, -14400, 0, :ART - tz.offset :o3, -14400, 3600, :ARST - tz.offset :o4, -10800, 0, :ART - tz.offset :o5, -10800, 3600, :ARST - - tz.transition 1894, 10, :o1, 17374555169, 7200 - tz.transition 1920, 5, :o2, 1453467407, 600 - tz.transition 1930, 12, :o3, 7278935, 3 - tz.transition 1931, 4, :o2, 19411461, 8 - tz.transition 1931, 10, :o3, 7279889, 3 - tz.transition 1932, 3, :o2, 19414141, 8 - tz.transition 1932, 11, :o3, 7281038, 3 - tz.transition 1933, 3, :o2, 19417061, 8 - tz.transition 1933, 11, :o3, 7282133, 3 - tz.transition 1934, 3, :o2, 19419981, 8 - tz.transition 1934, 11, :o3, 7283228, 3 - tz.transition 1935, 3, :o2, 19422901, 8 - tz.transition 1935, 11, :o3, 7284323, 3 - tz.transition 1936, 3, :o2, 19425829, 8 - tz.transition 1936, 11, :o3, 7285421, 3 - tz.transition 1937, 3, :o2, 19428749, 8 - tz.transition 1937, 11, :o3, 7286516, 3 - tz.transition 1938, 3, :o2, 19431669, 8 - tz.transition 1938, 11, :o3, 7287611, 3 - tz.transition 1939, 3, :o2, 19434589, 8 - tz.transition 1939, 11, :o3, 7288706, 3 - tz.transition 1940, 3, :o2, 19437517, 8 - tz.transition 1940, 7, :o3, 7289435, 3 - tz.transition 1941, 6, :o2, 19441285, 8 - tz.transition 1941, 10, :o3, 7290848, 3 - tz.transition 1943, 8, :o2, 19447501, 8 - tz.transition 1943, 10, :o3, 7293038, 3 - tz.transition 1946, 3, :o2, 19455045, 8 - tz.transition 1946, 10, :o3, 7296284, 3 - tz.transition 1963, 10, :o2, 19506429, 8 - tz.transition 1963, 12, :o3, 7315136, 3 - tz.transition 1964, 3, :o2, 19507645, 8 - tz.transition 1964, 10, :o3, 7316051, 3 - tz.transition 1965, 3, :o2, 19510565, 8 - tz.transition 1965, 10, :o3, 7317146, 3 - tz.transition 1966, 3, :o2, 19513485, 8 - tz.transition 1966, 10, :o3, 7318241, 3 - tz.transition 1967, 4, :o2, 19516661, 8 - tz.transition 1967, 10, :o3, 7319294, 3 - tz.transition 1968, 4, :o2, 19519629, 8 - tz.transition 1968, 10, :o3, 7320407, 3 - tz.transition 1969, 4, :o2, 19522541, 8 - tz.transition 1969, 10, :o4, 7321499, 3 - tz.transition 1974, 1, :o5, 128142000 - tz.transition 1974, 5, :o4, 136605600 - tz.transition 1988, 12, :o5, 596948400 - tz.transition 1989, 3, :o4, 605066400 - tz.transition 1989, 10, :o5, 624423600 - tz.transition 1990, 3, :o4, 636516000 - tz.transition 1990, 10, :o5, 656478000 - tz.transition 1991, 3, :o4, 667965600 - tz.transition 1991, 10, :o5, 687927600 - tz.transition 1992, 3, :o4, 699415200 - tz.transition 1992, 10, :o5, 719377200 - tz.transition 1993, 3, :o4, 731469600 - tz.transition 1999, 10, :o3, 938919600 - tz.transition 2000, 3, :o4, 952052400 - tz.transition 2007, 12, :o5, 1198983600 - tz.transition 2008, 3, :o4, 1205632800 - tz.transition 2008, 10, :o5, 1224385200 - tz.transition 2009, 3, :o4, 1237082400 - tz.transition 2009, 10, :o5, 1255834800 - tz.transition 2010, 3, :o4, 1269136800 - tz.transition 2010, 10, :o5, 1287284400 - tz.transition 2011, 3, :o4, 1300586400 - tz.transition 2011, 10, :o5, 1318734000 - tz.transition 2012, 3, :o4, 1332036000 - tz.transition 2012, 10, :o5, 1350788400 - tz.transition 2013, 3, :o4, 1363485600 - tz.transition 2013, 10, :o5, 1382238000 - tz.transition 2014, 3, :o4, 1394935200 - tz.transition 2014, 10, :o5, 1413687600 - tz.transition 2015, 3, :o4, 1426384800 - tz.transition 2015, 10, :o5, 1445137200 - tz.transition 2016, 3, :o4, 1458439200 - tz.transition 2016, 10, :o5, 1476586800 - tz.transition 2017, 3, :o4, 1489888800 - tz.transition 2017, 10, :o5, 1508036400 - tz.transition 2018, 3, :o4, 1521338400 - tz.transition 2018, 10, :o5, 1540090800 - tz.transition 2019, 3, :o4, 1552788000 - tz.transition 2019, 10, :o5, 1571540400 - tz.transition 2020, 3, :o4, 1584237600 - tz.transition 2020, 10, :o5, 1602990000 - tz.transition 2021, 3, :o4, 1616292000 - tz.transition 2021, 10, :o5, 1634439600 - tz.transition 2022, 3, :o4, 1647741600 - tz.transition 2022, 10, :o5, 1665889200 - tz.transition 2023, 3, :o4, 1679191200 - tz.transition 2023, 10, :o5, 1697338800 - tz.transition 2024, 3, :o4, 1710640800 - tz.transition 2024, 10, :o5, 1729393200 - tz.transition 2025, 3, :o4, 1742090400 - tz.transition 2025, 10, :o5, 1760842800 - tz.transition 2026, 3, :o4, 1773540000 - tz.transition 2026, 10, :o5, 1792292400 - tz.transition 2027, 3, :o4, 1805594400 - tz.transition 2027, 10, :o5, 1823742000 - tz.transition 2028, 3, :o4, 1837044000 - tz.transition 2028, 10, :o5, 1855191600 - tz.transition 2029, 3, :o4, 1868493600 - tz.transition 2029, 10, :o5, 1887246000 - tz.transition 2030, 3, :o4, 1899943200 - tz.transition 2030, 10, :o5, 1918695600 - tz.transition 2031, 3, :o4, 1931392800 - tz.transition 2031, 10, :o5, 1950145200 - tz.transition 2032, 3, :o4, 1963447200 - tz.transition 2032, 10, :o5, 1981594800 - tz.transition 2033, 3, :o4, 1994896800 - tz.transition 2033, 10, :o5, 2013044400 - tz.transition 2034, 3, :o4, 2026346400 - tz.transition 2034, 10, :o5, 2044494000 - tz.transition 2035, 3, :o4, 2057796000 - tz.transition 2035, 10, :o5, 2076548400 - tz.transition 2036, 3, :o4, 2089245600 - tz.transition 2036, 10, :o5, 2107998000 - tz.transition 2037, 3, :o4, 2120695200 - tz.transition 2037, 10, :o5, 2139447600 - tz.transition 2038, 3, :o4, 29586043, 12 - tz.transition 2038, 10, :o5, 19725709, 8 - tz.transition 2039, 3, :o4, 29590411, 12 - tz.transition 2039, 10, :o5, 19728621, 8 - tz.transition 2040, 3, :o4, 29594779, 12 - tz.transition 2040, 10, :o5, 19731589, 8 - tz.transition 2041, 3, :o4, 29599147, 12 - tz.transition 2041, 10, :o5, 19734501, 8 - tz.transition 2042, 3, :o4, 29603515, 12 - tz.transition 2042, 10, :o5, 19737413, 8 - tz.transition 2043, 3, :o4, 29607883, 12 - tz.transition 2043, 10, :o5, 19740325, 8 - tz.transition 2044, 3, :o4, 29612335, 12 - tz.transition 2044, 10, :o5, 19743237, 8 - tz.transition 2045, 3, :o4, 29616703, 12 - tz.transition 2045, 10, :o5, 19746149, 8 - tz.transition 2046, 3, :o4, 29621071, 12 - tz.transition 2046, 10, :o5, 19749117, 8 - tz.transition 2047, 3, :o4, 29625439, 12 - tz.transition 2047, 10, :o5, 19752029, 8 - tz.transition 2048, 3, :o4, 29629807, 12 - tz.transition 2048, 10, :o5, 19754941, 8 - tz.transition 2049, 3, :o4, 29634259, 12 - tz.transition 2049, 10, :o5, 19757853, 8 - tz.transition 2050, 3, :o4, 29638627, 12 - end - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb deleted file mode 100644 index ba8be4705f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb +++ /dev/null @@ -1,86 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Argentina - module San_Juan - include TimezoneDefinition - - timezone 'America/Argentina/San_Juan' do |tz| - tz.offset :o0, -16444, 0, :LMT - tz.offset :o1, -15408, 0, :CMT - tz.offset :o2, -14400, 0, :ART - tz.offset :o3, -14400, 3600, :ARST - tz.offset :o4, -10800, 0, :ART - tz.offset :o5, -10800, 3600, :ARST - tz.offset :o6, -14400, 0, :WART - - tz.transition 1894, 10, :o1, 52123666111, 21600 - tz.transition 1920, 5, :o2, 1453467407, 600 - tz.transition 1930, 12, :o3, 7278935, 3 - tz.transition 1931, 4, :o2, 19411461, 8 - tz.transition 1931, 10, :o3, 7279889, 3 - tz.transition 1932, 3, :o2, 19414141, 8 - tz.transition 1932, 11, :o3, 7281038, 3 - tz.transition 1933, 3, :o2, 19417061, 8 - tz.transition 1933, 11, :o3, 7282133, 3 - tz.transition 1934, 3, :o2, 19419981, 8 - tz.transition 1934, 11, :o3, 7283228, 3 - tz.transition 1935, 3, :o2, 19422901, 8 - tz.transition 1935, 11, :o3, 7284323, 3 - tz.transition 1936, 3, :o2, 19425829, 8 - tz.transition 1936, 11, :o3, 7285421, 3 - tz.transition 1937, 3, :o2, 19428749, 8 - tz.transition 1937, 11, :o3, 7286516, 3 - tz.transition 1938, 3, :o2, 19431669, 8 - tz.transition 1938, 11, :o3, 7287611, 3 - tz.transition 1939, 3, :o2, 19434589, 8 - tz.transition 1939, 11, :o3, 7288706, 3 - tz.transition 1940, 3, :o2, 19437517, 8 - tz.transition 1940, 7, :o3, 7289435, 3 - tz.transition 1941, 6, :o2, 19441285, 8 - tz.transition 1941, 10, :o3, 7290848, 3 - tz.transition 1943, 8, :o2, 19447501, 8 - tz.transition 1943, 10, :o3, 7293038, 3 - tz.transition 1946, 3, :o2, 19455045, 8 - tz.transition 1946, 10, :o3, 7296284, 3 - tz.transition 1963, 10, :o2, 19506429, 8 - tz.transition 1963, 12, :o3, 7315136, 3 - tz.transition 1964, 3, :o2, 19507645, 8 - tz.transition 1964, 10, :o3, 7316051, 3 - tz.transition 1965, 3, :o2, 19510565, 8 - tz.transition 1965, 10, :o3, 7317146, 3 - tz.transition 1966, 3, :o2, 19513485, 8 - tz.transition 1966, 10, :o3, 7318241, 3 - tz.transition 1967, 4, :o2, 19516661, 8 - tz.transition 1967, 10, :o3, 7319294, 3 - tz.transition 1968, 4, :o2, 19519629, 8 - tz.transition 1968, 10, :o3, 7320407, 3 - tz.transition 1969, 4, :o2, 19522541, 8 - tz.transition 1969, 10, :o4, 7321499, 3 - tz.transition 1974, 1, :o5, 128142000 - tz.transition 1974, 5, :o4, 136605600 - tz.transition 1988, 12, :o5, 596948400 - tz.transition 1989, 3, :o4, 605066400 - tz.transition 1989, 10, :o5, 624423600 - tz.transition 1990, 3, :o4, 636516000 - tz.transition 1990, 10, :o5, 656478000 - tz.transition 1991, 3, :o6, 667792800 - tz.transition 1991, 5, :o4, 673588800 - tz.transition 1991, 10, :o5, 687927600 - tz.transition 1992, 3, :o4, 699415200 - tz.transition 1992, 10, :o5, 719377200 - tz.transition 1993, 3, :o4, 731469600 - tz.transition 1999, 10, :o3, 938919600 - tz.transition 2000, 3, :o4, 952052400 - tz.transition 2004, 5, :o6, 1085972400 - tz.transition 2004, 7, :o4, 1090728000 - tz.transition 2007, 12, :o5, 1198983600 - tz.transition 2008, 3, :o4, 1205632800 - end - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb deleted file mode 100644 index ef96435c6a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Bogota - include TimezoneDefinition - - timezone 'America/Bogota' do |tz| - tz.offset :o0, -17780, 0, :LMT - tz.offset :o1, -17780, 0, :BMT - tz.offset :o2, -18000, 0, :COT - tz.offset :o3, -18000, 3600, :COST - - tz.transition 1884, 3, :o1, 10407954409, 4320 - tz.transition 1914, 11, :o2, 10456385929, 4320 - tz.transition 1992, 5, :o3, 704869200 - tz.transition 1993, 4, :o2, 733896000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb deleted file mode 100644 index 27392a540a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Caracas - include TimezoneDefinition - - timezone 'America/Caracas' do |tz| - tz.offset :o0, -16064, 0, :LMT - tz.offset :o1, -16060, 0, :CMT - tz.offset :o2, -16200, 0, :VET - tz.offset :o3, -14400, 0, :VET - - tz.transition 1890, 1, :o1, 1627673863, 675 - tz.transition 1912, 2, :o2, 10452001043, 4320 - tz.transition 1965, 1, :o3, 39020187, 16 - tz.transition 2007, 12, :o2, 1197183600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb deleted file mode 100644 index 0996857cf0..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb +++ /dev/null @@ -1,283 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Chicago - include TimezoneDefinition - - timezone 'America/Chicago' do |tz| - tz.offset :o0, -21036, 0, :LMT - tz.offset :o1, -21600, 0, :CST - tz.offset :o2, -21600, 3600, :CDT - tz.offset :o3, -18000, 0, :EST - tz.offset :o4, -21600, 3600, :CWT - tz.offset :o5, -21600, 3600, :CPT - - tz.transition 1883, 11, :o1, 9636533, 4 - tz.transition 1918, 3, :o2, 14530103, 6 - tz.transition 1918, 10, :o1, 58125451, 24 - tz.transition 1919, 3, :o2, 14532287, 6 - tz.transition 1919, 10, :o1, 58134187, 24 - tz.transition 1920, 6, :o2, 14534933, 6 - tz.transition 1920, 10, :o1, 58143091, 24 - tz.transition 1921, 3, :o2, 14536655, 6 - tz.transition 1921, 10, :o1, 58151827, 24 - tz.transition 1922, 4, :o2, 14539049, 6 - tz.transition 1922, 9, :o1, 58159723, 24 - tz.transition 1923, 4, :o2, 14541233, 6 - tz.transition 1923, 9, :o1, 58168627, 24 - tz.transition 1924, 4, :o2, 14543417, 6 - tz.transition 1924, 9, :o1, 58177363, 24 - tz.transition 1925, 4, :o2, 14545601, 6 - tz.transition 1925, 9, :o1, 58186099, 24 - tz.transition 1926, 4, :o2, 14547785, 6 - tz.transition 1926, 9, :o1, 58194835, 24 - tz.transition 1927, 4, :o2, 14549969, 6 - tz.transition 1927, 9, :o1, 58203571, 24 - tz.transition 1928, 4, :o2, 14552195, 6 - tz.transition 1928, 9, :o1, 58212475, 24 - tz.transition 1929, 4, :o2, 14554379, 6 - tz.transition 1929, 9, :o1, 58221211, 24 - tz.transition 1930, 4, :o2, 14556563, 6 - tz.transition 1930, 9, :o1, 58229947, 24 - tz.transition 1931, 4, :o2, 14558747, 6 - tz.transition 1931, 9, :o1, 58238683, 24 - tz.transition 1932, 4, :o2, 14560931, 6 - tz.transition 1932, 9, :o1, 58247419, 24 - tz.transition 1933, 4, :o2, 14563157, 6 - tz.transition 1933, 9, :o1, 58256155, 24 - tz.transition 1934, 4, :o2, 14565341, 6 - tz.transition 1934, 9, :o1, 58265059, 24 - tz.transition 1935, 4, :o2, 14567525, 6 - tz.transition 1935, 9, :o1, 58273795, 24 - tz.transition 1936, 3, :o3, 14569373, 6 - tz.transition 1936, 11, :o1, 58283707, 24 - tz.transition 1937, 4, :o2, 14571893, 6 - tz.transition 1937, 9, :o1, 58291267, 24 - tz.transition 1938, 4, :o2, 14574077, 6 - tz.transition 1938, 9, :o1, 58300003, 24 - tz.transition 1939, 4, :o2, 14576303, 6 - tz.transition 1939, 9, :o1, 58308739, 24 - tz.transition 1940, 4, :o2, 14578487, 6 - tz.transition 1940, 9, :o1, 58317643, 24 - tz.transition 1941, 4, :o2, 14580671, 6 - tz.transition 1941, 9, :o1, 58326379, 24 - tz.transition 1942, 2, :o4, 14582399, 6 - tz.transition 1945, 8, :o5, 58360379, 24 - tz.transition 1945, 9, :o1, 58361491, 24 - tz.transition 1946, 4, :o2, 14591633, 6 - tz.transition 1946, 9, :o1, 58370227, 24 - tz.transition 1947, 4, :o2, 14593817, 6 - tz.transition 1947, 9, :o1, 58378963, 24 - tz.transition 1948, 4, :o2, 14596001, 6 - tz.transition 1948, 9, :o1, 58387699, 24 - tz.transition 1949, 4, :o2, 14598185, 6 - tz.transition 1949, 9, :o1, 58396435, 24 - tz.transition 1950, 4, :o2, 14600411, 6 - tz.transition 1950, 9, :o1, 58405171, 24 - tz.transition 1951, 4, :o2, 14602595, 6 - tz.transition 1951, 9, :o1, 58414075, 24 - tz.transition 1952, 4, :o2, 14604779, 6 - tz.transition 1952, 9, :o1, 58422811, 24 - tz.transition 1953, 4, :o2, 14606963, 6 - tz.transition 1953, 9, :o1, 58431547, 24 - tz.transition 1954, 4, :o2, 14609147, 6 - tz.transition 1954, 9, :o1, 58440283, 24 - tz.transition 1955, 4, :o2, 14611331, 6 - tz.transition 1955, 10, :o1, 58449859, 24 - tz.transition 1956, 4, :o2, 14613557, 6 - tz.transition 1956, 10, :o1, 58458595, 24 - tz.transition 1957, 4, :o2, 14615741, 6 - tz.transition 1957, 10, :o1, 58467331, 24 - tz.transition 1958, 4, :o2, 14617925, 6 - tz.transition 1958, 10, :o1, 58476067, 24 - tz.transition 1959, 4, :o2, 14620109, 6 - tz.transition 1959, 10, :o1, 58484803, 24 - tz.transition 1960, 4, :o2, 14622293, 6 - tz.transition 1960, 10, :o1, 58493707, 24 - tz.transition 1961, 4, :o2, 14624519, 6 - tz.transition 1961, 10, :o1, 58502443, 24 - tz.transition 1962, 4, :o2, 14626703, 6 - tz.transition 1962, 10, :o1, 58511179, 24 - tz.transition 1963, 4, :o2, 14628887, 6 - tz.transition 1963, 10, :o1, 58519915, 24 - tz.transition 1964, 4, :o2, 14631071, 6 - tz.transition 1964, 10, :o1, 58528651, 24 - tz.transition 1965, 4, :o2, 14633255, 6 - tz.transition 1965, 10, :o1, 58537555, 24 - tz.transition 1966, 4, :o2, 14635439, 6 - tz.transition 1966, 10, :o1, 58546291, 24 - tz.transition 1967, 4, :o2, 14637665, 6 - tz.transition 1967, 10, :o1, 58555027, 24 - tz.transition 1968, 4, :o2, 14639849, 6 - tz.transition 1968, 10, :o1, 58563763, 24 - tz.transition 1969, 4, :o2, 14642033, 6 - tz.transition 1969, 10, :o1, 58572499, 24 - tz.transition 1970, 4, :o2, 9964800 - tz.transition 1970, 10, :o1, 25686000 - tz.transition 1971, 4, :o2, 41414400 - tz.transition 1971, 10, :o1, 57740400 - tz.transition 1972, 4, :o2, 73468800 - tz.transition 1972, 10, :o1, 89190000 - tz.transition 1973, 4, :o2, 104918400 - tz.transition 1973, 10, :o1, 120639600 - tz.transition 1974, 1, :o2, 126691200 - tz.transition 1974, 10, :o1, 152089200 - tz.transition 1975, 2, :o2, 162374400 - tz.transition 1975, 10, :o1, 183538800 - tz.transition 1976, 4, :o2, 199267200 - tz.transition 1976, 10, :o1, 215593200 - tz.transition 1977, 4, :o2, 230716800 - tz.transition 1977, 10, :o1, 247042800 - tz.transition 1978, 4, :o2, 262771200 - tz.transition 1978, 10, :o1, 278492400 - tz.transition 1979, 4, :o2, 294220800 - tz.transition 1979, 10, :o1, 309942000 - tz.transition 1980, 4, :o2, 325670400 - tz.transition 1980, 10, :o1, 341391600 - tz.transition 1981, 4, :o2, 357120000 - tz.transition 1981, 10, :o1, 372841200 - tz.transition 1982, 4, :o2, 388569600 - tz.transition 1982, 10, :o1, 404895600 - tz.transition 1983, 4, :o2, 420019200 - tz.transition 1983, 10, :o1, 436345200 - tz.transition 1984, 4, :o2, 452073600 - tz.transition 1984, 10, :o1, 467794800 - tz.transition 1985, 4, :o2, 483523200 - tz.transition 1985, 10, :o1, 499244400 - tz.transition 1986, 4, :o2, 514972800 - tz.transition 1986, 10, :o1, 530694000 - tz.transition 1987, 4, :o2, 544608000 - tz.transition 1987, 10, :o1, 562143600 - tz.transition 1988, 4, :o2, 576057600 - tz.transition 1988, 10, :o1, 594198000 - tz.transition 1989, 4, :o2, 607507200 - tz.transition 1989, 10, :o1, 625647600 - tz.transition 1990, 4, :o2, 638956800 - tz.transition 1990, 10, :o1, 657097200 - tz.transition 1991, 4, :o2, 671011200 - tz.transition 1991, 10, :o1, 688546800 - tz.transition 1992, 4, :o2, 702460800 - tz.transition 1992, 10, :o1, 719996400 - tz.transition 1993, 4, :o2, 733910400 - tz.transition 1993, 10, :o1, 752050800 - tz.transition 1994, 4, :o2, 765360000 - tz.transition 1994, 10, :o1, 783500400 - tz.transition 1995, 4, :o2, 796809600 - tz.transition 1995, 10, :o1, 814950000 - tz.transition 1996, 4, :o2, 828864000 - tz.transition 1996, 10, :o1, 846399600 - tz.transition 1997, 4, :o2, 860313600 - tz.transition 1997, 10, :o1, 877849200 - tz.transition 1998, 4, :o2, 891763200 - tz.transition 1998, 10, :o1, 909298800 - tz.transition 1999, 4, :o2, 923212800 - tz.transition 1999, 10, :o1, 941353200 - tz.transition 2000, 4, :o2, 954662400 - tz.transition 2000, 10, :o1, 972802800 - tz.transition 2001, 4, :o2, 986112000 - tz.transition 2001, 10, :o1, 1004252400 - tz.transition 2002, 4, :o2, 1018166400 - tz.transition 2002, 10, :o1, 1035702000 - tz.transition 2003, 4, :o2, 1049616000 - tz.transition 2003, 10, :o1, 1067151600 - tz.transition 2004, 4, :o2, 1081065600 - tz.transition 2004, 10, :o1, 1099206000 - tz.transition 2005, 4, :o2, 1112515200 - tz.transition 2005, 10, :o1, 1130655600 - tz.transition 2006, 4, :o2, 1143964800 - tz.transition 2006, 10, :o1, 1162105200 - tz.transition 2007, 3, :o2, 1173600000 - tz.transition 2007, 11, :o1, 1194159600 - tz.transition 2008, 3, :o2, 1205049600 - tz.transition 2008, 11, :o1, 1225609200 - tz.transition 2009, 3, :o2, 1236499200 - tz.transition 2009, 11, :o1, 1257058800 - tz.transition 2010, 3, :o2, 1268553600 - tz.transition 2010, 11, :o1, 1289113200 - tz.transition 2011, 3, :o2, 1300003200 - tz.transition 2011, 11, :o1, 1320562800 - tz.transition 2012, 3, :o2, 1331452800 - tz.transition 2012, 11, :o1, 1352012400 - tz.transition 2013, 3, :o2, 1362902400 - tz.transition 2013, 11, :o1, 1383462000 - tz.transition 2014, 3, :o2, 1394352000 - tz.transition 2014, 11, :o1, 1414911600 - tz.transition 2015, 3, :o2, 1425801600 - tz.transition 2015, 11, :o1, 1446361200 - tz.transition 2016, 3, :o2, 1457856000 - tz.transition 2016, 11, :o1, 1478415600 - tz.transition 2017, 3, :o2, 1489305600 - tz.transition 2017, 11, :o1, 1509865200 - tz.transition 2018, 3, :o2, 1520755200 - tz.transition 2018, 11, :o1, 1541314800 - tz.transition 2019, 3, :o2, 1552204800 - tz.transition 2019, 11, :o1, 1572764400 - tz.transition 2020, 3, :o2, 1583654400 - tz.transition 2020, 11, :o1, 1604214000 - tz.transition 2021, 3, :o2, 1615708800 - tz.transition 2021, 11, :o1, 1636268400 - tz.transition 2022, 3, :o2, 1647158400 - tz.transition 2022, 11, :o1, 1667718000 - tz.transition 2023, 3, :o2, 1678608000 - tz.transition 2023, 11, :o1, 1699167600 - tz.transition 2024, 3, :o2, 1710057600 - tz.transition 2024, 11, :o1, 1730617200 - tz.transition 2025, 3, :o2, 1741507200 - tz.transition 2025, 11, :o1, 1762066800 - tz.transition 2026, 3, :o2, 1772956800 - tz.transition 2026, 11, :o1, 1793516400 - tz.transition 2027, 3, :o2, 1805011200 - tz.transition 2027, 11, :o1, 1825570800 - tz.transition 2028, 3, :o2, 1836460800 - tz.transition 2028, 11, :o1, 1857020400 - tz.transition 2029, 3, :o2, 1867910400 - tz.transition 2029, 11, :o1, 1888470000 - tz.transition 2030, 3, :o2, 1899360000 - tz.transition 2030, 11, :o1, 1919919600 - tz.transition 2031, 3, :o2, 1930809600 - tz.transition 2031, 11, :o1, 1951369200 - tz.transition 2032, 3, :o2, 1962864000 - tz.transition 2032, 11, :o1, 1983423600 - tz.transition 2033, 3, :o2, 1994313600 - tz.transition 2033, 11, :o1, 2014873200 - tz.transition 2034, 3, :o2, 2025763200 - tz.transition 2034, 11, :o1, 2046322800 - tz.transition 2035, 3, :o2, 2057212800 - tz.transition 2035, 11, :o1, 2077772400 - tz.transition 2036, 3, :o2, 2088662400 - tz.transition 2036, 11, :o1, 2109222000 - tz.transition 2037, 3, :o2, 2120112000 - tz.transition 2037, 11, :o1, 2140671600 - tz.transition 2038, 3, :o2, 14792981, 6 - tz.transition 2038, 11, :o1, 59177635, 24 - tz.transition 2039, 3, :o2, 14795165, 6 - tz.transition 2039, 11, :o1, 59186371, 24 - tz.transition 2040, 3, :o2, 14797349, 6 - tz.transition 2040, 11, :o1, 59195107, 24 - tz.transition 2041, 3, :o2, 14799533, 6 - tz.transition 2041, 11, :o1, 59203843, 24 - tz.transition 2042, 3, :o2, 14801717, 6 - tz.transition 2042, 11, :o1, 59212579, 24 - tz.transition 2043, 3, :o2, 14803901, 6 - tz.transition 2043, 11, :o1, 59221315, 24 - tz.transition 2044, 3, :o2, 14806127, 6 - tz.transition 2044, 11, :o1, 59230219, 24 - tz.transition 2045, 3, :o2, 14808311, 6 - tz.transition 2045, 11, :o1, 59238955, 24 - tz.transition 2046, 3, :o2, 14810495, 6 - tz.transition 2046, 11, :o1, 59247691, 24 - tz.transition 2047, 3, :o2, 14812679, 6 - tz.transition 2047, 11, :o1, 59256427, 24 - tz.transition 2048, 3, :o2, 14814863, 6 - tz.transition 2048, 11, :o1, 59265163, 24 - tz.transition 2049, 3, :o2, 14817089, 6 - tz.transition 2049, 11, :o1, 59274067, 24 - tz.transition 2050, 3, :o2, 14819273, 6 - tz.transition 2050, 11, :o1, 59282803, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb deleted file mode 100644 index 1710b57c79..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Chihuahua - include TimezoneDefinition - - timezone 'America/Chihuahua' do |tz| - tz.offset :o0, -25460, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -21600, 0, :CST - tz.offset :o3, -21600, 3600, :CDT - tz.offset :o4, -25200, 3600, :MDT - - tz.transition 1922, 1, :o1, 58153339, 24 - tz.transition 1927, 6, :o2, 9700171, 4 - tz.transition 1930, 11, :o1, 9705183, 4 - tz.transition 1931, 5, :o2, 9705855, 4 - tz.transition 1931, 10, :o1, 9706463, 4 - tz.transition 1932, 4, :o2, 58243171, 24 - tz.transition 1996, 4, :o3, 828864000 - tz.transition 1996, 10, :o2, 846399600 - tz.transition 1997, 4, :o3, 860313600 - tz.transition 1997, 10, :o2, 877849200 - tz.transition 1998, 4, :o4, 891766800 - tz.transition 1998, 10, :o1, 909302400 - tz.transition 1999, 4, :o4, 923216400 - tz.transition 1999, 10, :o1, 941356800 - tz.transition 2000, 4, :o4, 954666000 - tz.transition 2000, 10, :o1, 972806400 - tz.transition 2001, 5, :o4, 989139600 - tz.transition 2001, 9, :o1, 1001836800 - tz.transition 2002, 4, :o4, 1018170000 - tz.transition 2002, 10, :o1, 1035705600 - tz.transition 2003, 4, :o4, 1049619600 - tz.transition 2003, 10, :o1, 1067155200 - tz.transition 2004, 4, :o4, 1081069200 - tz.transition 2004, 10, :o1, 1099209600 - tz.transition 2005, 4, :o4, 1112518800 - tz.transition 2005, 10, :o1, 1130659200 - tz.transition 2006, 4, :o4, 1143968400 - tz.transition 2006, 10, :o1, 1162108800 - tz.transition 2007, 4, :o4, 1175418000 - tz.transition 2007, 10, :o1, 1193558400 - tz.transition 2008, 4, :o4, 1207472400 - tz.transition 2008, 10, :o1, 1225008000 - tz.transition 2009, 4, :o4, 1238922000 - tz.transition 2009, 10, :o1, 1256457600 - tz.transition 2010, 4, :o4, 1270371600 - tz.transition 2010, 10, :o1, 1288512000 - tz.transition 2011, 4, :o4, 1301821200 - tz.transition 2011, 10, :o1, 1319961600 - tz.transition 2012, 4, :o4, 1333270800 - tz.transition 2012, 10, :o1, 1351411200 - tz.transition 2013, 4, :o4, 1365325200 - tz.transition 2013, 10, :o1, 1382860800 - tz.transition 2014, 4, :o4, 1396774800 - tz.transition 2014, 10, :o1, 1414310400 - tz.transition 2015, 4, :o4, 1428224400 - tz.transition 2015, 10, :o1, 1445760000 - tz.transition 2016, 4, :o4, 1459674000 - tz.transition 2016, 10, :o1, 1477814400 - tz.transition 2017, 4, :o4, 1491123600 - tz.transition 2017, 10, :o1, 1509264000 - tz.transition 2018, 4, :o4, 1522573200 - tz.transition 2018, 10, :o1, 1540713600 - tz.transition 2019, 4, :o4, 1554627600 - tz.transition 2019, 10, :o1, 1572163200 - tz.transition 2020, 4, :o4, 1586077200 - tz.transition 2020, 10, :o1, 1603612800 - tz.transition 2021, 4, :o4, 1617526800 - tz.transition 2021, 10, :o1, 1635667200 - tz.transition 2022, 4, :o4, 1648976400 - tz.transition 2022, 10, :o1, 1667116800 - tz.transition 2023, 4, :o4, 1680426000 - tz.transition 2023, 10, :o1, 1698566400 - tz.transition 2024, 4, :o4, 1712480400 - tz.transition 2024, 10, :o1, 1730016000 - tz.transition 2025, 4, :o4, 1743930000 - tz.transition 2025, 10, :o1, 1761465600 - tz.transition 2026, 4, :o4, 1775379600 - tz.transition 2026, 10, :o1, 1792915200 - tz.transition 2027, 4, :o4, 1806829200 - tz.transition 2027, 10, :o1, 1824969600 - tz.transition 2028, 4, :o4, 1838278800 - tz.transition 2028, 10, :o1, 1856419200 - tz.transition 2029, 4, :o4, 1869728400 - tz.transition 2029, 10, :o1, 1887868800 - tz.transition 2030, 4, :o4, 1901782800 - tz.transition 2030, 10, :o1, 1919318400 - tz.transition 2031, 4, :o4, 1933232400 - tz.transition 2031, 10, :o1, 1950768000 - tz.transition 2032, 4, :o4, 1964682000 - tz.transition 2032, 10, :o1, 1982822400 - tz.transition 2033, 4, :o4, 1996131600 - tz.transition 2033, 10, :o1, 2014272000 - tz.transition 2034, 4, :o4, 2027581200 - tz.transition 2034, 10, :o1, 2045721600 - tz.transition 2035, 4, :o4, 2059030800 - tz.transition 2035, 10, :o1, 2077171200 - tz.transition 2036, 4, :o4, 2091085200 - tz.transition 2036, 10, :o1, 2108620800 - tz.transition 2037, 4, :o4, 2122534800 - tz.transition 2037, 10, :o1, 2140070400 - tz.transition 2038, 4, :o4, 19724143, 8 - tz.transition 2038, 10, :o1, 14794367, 6 - tz.transition 2039, 4, :o4, 19727055, 8 - tz.transition 2039, 10, :o1, 14796551, 6 - tz.transition 2040, 4, :o4, 19729967, 8 - tz.transition 2040, 10, :o1, 14798735, 6 - tz.transition 2041, 4, :o4, 19732935, 8 - tz.transition 2041, 10, :o1, 14800919, 6 - tz.transition 2042, 4, :o4, 19735847, 8 - tz.transition 2042, 10, :o1, 14803103, 6 - tz.transition 2043, 4, :o4, 19738759, 8 - tz.transition 2043, 10, :o1, 14805287, 6 - tz.transition 2044, 4, :o4, 19741671, 8 - tz.transition 2044, 10, :o1, 14807513, 6 - tz.transition 2045, 4, :o4, 19744583, 8 - tz.transition 2045, 10, :o1, 14809697, 6 - tz.transition 2046, 4, :o4, 19747495, 8 - tz.transition 2046, 10, :o1, 14811881, 6 - tz.transition 2047, 4, :o4, 19750463, 8 - tz.transition 2047, 10, :o1, 14814065, 6 - tz.transition 2048, 4, :o4, 19753375, 8 - tz.transition 2048, 10, :o1, 14816249, 6 - tz.transition 2049, 4, :o4, 19756287, 8 - tz.transition 2049, 10, :o1, 14818475, 6 - tz.transition 2050, 4, :o4, 19759199, 8 - tz.transition 2050, 10, :o1, 14820659, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb deleted file mode 100644 index 1c1efb5ff3..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb +++ /dev/null @@ -1,204 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Denver - include TimezoneDefinition - - timezone 'America/Denver' do |tz| - tz.offset :o0, -25196, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -25200, 3600, :MDT - tz.offset :o3, -25200, 3600, :MWT - tz.offset :o4, -25200, 3600, :MPT - - tz.transition 1883, 11, :o1, 57819199, 24 - tz.transition 1918, 3, :o2, 19373471, 8 - tz.transition 1918, 10, :o1, 14531363, 6 - tz.transition 1919, 3, :o2, 19376383, 8 - tz.transition 1919, 10, :o1, 14533547, 6 - tz.transition 1920, 3, :o2, 19379295, 8 - tz.transition 1920, 10, :o1, 14535773, 6 - tz.transition 1921, 3, :o2, 19382207, 8 - tz.transition 1921, 5, :o1, 14536991, 6 - tz.transition 1942, 2, :o3, 19443199, 8 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 14590373, 6 - tz.transition 1965, 4, :o2, 19511007, 8 - tz.transition 1965, 10, :o1, 14634389, 6 - tz.transition 1966, 4, :o2, 19513919, 8 - tz.transition 1966, 10, :o1, 14636573, 6 - tz.transition 1967, 4, :o2, 19516887, 8 - tz.transition 1967, 10, :o1, 14638757, 6 - tz.transition 1968, 4, :o2, 19519799, 8 - tz.transition 1968, 10, :o1, 14640941, 6 - tz.transition 1969, 4, :o2, 19522711, 8 - tz.transition 1969, 10, :o1, 14643125, 6 - tz.transition 1970, 4, :o2, 9968400 - tz.transition 1970, 10, :o1, 25689600 - tz.transition 1971, 4, :o2, 41418000 - tz.transition 1971, 10, :o1, 57744000 - tz.transition 1972, 4, :o2, 73472400 - tz.transition 1972, 10, :o1, 89193600 - tz.transition 1973, 4, :o2, 104922000 - tz.transition 1973, 10, :o1, 120643200 - tz.transition 1974, 1, :o2, 126694800 - tz.transition 1974, 10, :o1, 152092800 - tz.transition 1975, 2, :o2, 162378000 - tz.transition 1975, 10, :o1, 183542400 - tz.transition 1976, 4, :o2, 199270800 - tz.transition 1976, 10, :o1, 215596800 - tz.transition 1977, 4, :o2, 230720400 - tz.transition 1977, 10, :o1, 247046400 - tz.transition 1978, 4, :o2, 262774800 - tz.transition 1978, 10, :o1, 278496000 - tz.transition 1979, 4, :o2, 294224400 - tz.transition 1979, 10, :o1, 309945600 - tz.transition 1980, 4, :o2, 325674000 - tz.transition 1980, 10, :o1, 341395200 - tz.transition 1981, 4, :o2, 357123600 - tz.transition 1981, 10, :o1, 372844800 - tz.transition 1982, 4, :o2, 388573200 - tz.transition 1982, 10, :o1, 404899200 - tz.transition 1983, 4, :o2, 420022800 - tz.transition 1983, 10, :o1, 436348800 - tz.transition 1984, 4, :o2, 452077200 - tz.transition 1984, 10, :o1, 467798400 - tz.transition 1985, 4, :o2, 483526800 - tz.transition 1985, 10, :o1, 499248000 - tz.transition 1986, 4, :o2, 514976400 - tz.transition 1986, 10, :o1, 530697600 - tz.transition 1987, 4, :o2, 544611600 - tz.transition 1987, 10, :o1, 562147200 - tz.transition 1988, 4, :o2, 576061200 - tz.transition 1988, 10, :o1, 594201600 - tz.transition 1989, 4, :o2, 607510800 - tz.transition 1989, 10, :o1, 625651200 - tz.transition 1990, 4, :o2, 638960400 - tz.transition 1990, 10, :o1, 657100800 - tz.transition 1991, 4, :o2, 671014800 - tz.transition 1991, 10, :o1, 688550400 - tz.transition 1992, 4, :o2, 702464400 - tz.transition 1992, 10, :o1, 720000000 - tz.transition 1993, 4, :o2, 733914000 - tz.transition 1993, 10, :o1, 752054400 - tz.transition 1994, 4, :o2, 765363600 - tz.transition 1994, 10, :o1, 783504000 - tz.transition 1995, 4, :o2, 796813200 - tz.transition 1995, 10, :o1, 814953600 - tz.transition 1996, 4, :o2, 828867600 - tz.transition 1996, 10, :o1, 846403200 - tz.transition 1997, 4, :o2, 860317200 - tz.transition 1997, 10, :o1, 877852800 - tz.transition 1998, 4, :o2, 891766800 - tz.transition 1998, 10, :o1, 909302400 - tz.transition 1999, 4, :o2, 923216400 - tz.transition 1999, 10, :o1, 941356800 - tz.transition 2000, 4, :o2, 954666000 - tz.transition 2000, 10, :o1, 972806400 - tz.transition 2001, 4, :o2, 986115600 - tz.transition 2001, 10, :o1, 1004256000 - tz.transition 2002, 4, :o2, 1018170000 - tz.transition 2002, 10, :o1, 1035705600 - tz.transition 2003, 4, :o2, 1049619600 - tz.transition 2003, 10, :o1, 1067155200 - tz.transition 2004, 4, :o2, 1081069200 - tz.transition 2004, 10, :o1, 1099209600 - tz.transition 2005, 4, :o2, 1112518800 - tz.transition 2005, 10, :o1, 1130659200 - tz.transition 2006, 4, :o2, 1143968400 - tz.transition 2006, 10, :o1, 1162108800 - tz.transition 2007, 3, :o2, 1173603600 - tz.transition 2007, 11, :o1, 1194163200 - tz.transition 2008, 3, :o2, 1205053200 - tz.transition 2008, 11, :o1, 1225612800 - tz.transition 2009, 3, :o2, 1236502800 - tz.transition 2009, 11, :o1, 1257062400 - tz.transition 2010, 3, :o2, 1268557200 - tz.transition 2010, 11, :o1, 1289116800 - tz.transition 2011, 3, :o2, 1300006800 - tz.transition 2011, 11, :o1, 1320566400 - tz.transition 2012, 3, :o2, 1331456400 - tz.transition 2012, 11, :o1, 1352016000 - tz.transition 2013, 3, :o2, 1362906000 - tz.transition 2013, 11, :o1, 1383465600 - tz.transition 2014, 3, :o2, 1394355600 - tz.transition 2014, 11, :o1, 1414915200 - tz.transition 2015, 3, :o2, 1425805200 - tz.transition 2015, 11, :o1, 1446364800 - tz.transition 2016, 3, :o2, 1457859600 - tz.transition 2016, 11, :o1, 1478419200 - tz.transition 2017, 3, :o2, 1489309200 - tz.transition 2017, 11, :o1, 1509868800 - tz.transition 2018, 3, :o2, 1520758800 - tz.transition 2018, 11, :o1, 1541318400 - tz.transition 2019, 3, :o2, 1552208400 - tz.transition 2019, 11, :o1, 1572768000 - tz.transition 2020, 3, :o2, 1583658000 - tz.transition 2020, 11, :o1, 1604217600 - tz.transition 2021, 3, :o2, 1615712400 - tz.transition 2021, 11, :o1, 1636272000 - tz.transition 2022, 3, :o2, 1647162000 - tz.transition 2022, 11, :o1, 1667721600 - tz.transition 2023, 3, :o2, 1678611600 - tz.transition 2023, 11, :o1, 1699171200 - tz.transition 2024, 3, :o2, 1710061200 - tz.transition 2024, 11, :o1, 1730620800 - tz.transition 2025, 3, :o2, 1741510800 - tz.transition 2025, 11, :o1, 1762070400 - tz.transition 2026, 3, :o2, 1772960400 - tz.transition 2026, 11, :o1, 1793520000 - tz.transition 2027, 3, :o2, 1805014800 - tz.transition 2027, 11, :o1, 1825574400 - tz.transition 2028, 3, :o2, 1836464400 - tz.transition 2028, 11, :o1, 1857024000 - tz.transition 2029, 3, :o2, 1867914000 - tz.transition 2029, 11, :o1, 1888473600 - tz.transition 2030, 3, :o2, 1899363600 - tz.transition 2030, 11, :o1, 1919923200 - tz.transition 2031, 3, :o2, 1930813200 - tz.transition 2031, 11, :o1, 1951372800 - tz.transition 2032, 3, :o2, 1962867600 - tz.transition 2032, 11, :o1, 1983427200 - tz.transition 2033, 3, :o2, 1994317200 - tz.transition 2033, 11, :o1, 2014876800 - tz.transition 2034, 3, :o2, 2025766800 - tz.transition 2034, 11, :o1, 2046326400 - tz.transition 2035, 3, :o2, 2057216400 - tz.transition 2035, 11, :o1, 2077776000 - tz.transition 2036, 3, :o2, 2088666000 - tz.transition 2036, 11, :o1, 2109225600 - tz.transition 2037, 3, :o2, 2120115600 - tz.transition 2037, 11, :o1, 2140675200 - tz.transition 2038, 3, :o2, 19723975, 8 - tz.transition 2038, 11, :o1, 14794409, 6 - tz.transition 2039, 3, :o2, 19726887, 8 - tz.transition 2039, 11, :o1, 14796593, 6 - tz.transition 2040, 3, :o2, 19729799, 8 - tz.transition 2040, 11, :o1, 14798777, 6 - tz.transition 2041, 3, :o2, 19732711, 8 - tz.transition 2041, 11, :o1, 14800961, 6 - tz.transition 2042, 3, :o2, 19735623, 8 - tz.transition 2042, 11, :o1, 14803145, 6 - tz.transition 2043, 3, :o2, 19738535, 8 - tz.transition 2043, 11, :o1, 14805329, 6 - tz.transition 2044, 3, :o2, 19741503, 8 - tz.transition 2044, 11, :o1, 14807555, 6 - tz.transition 2045, 3, :o2, 19744415, 8 - tz.transition 2045, 11, :o1, 14809739, 6 - tz.transition 2046, 3, :o2, 19747327, 8 - tz.transition 2046, 11, :o1, 14811923, 6 - tz.transition 2047, 3, :o2, 19750239, 8 - tz.transition 2047, 11, :o1, 14814107, 6 - tz.transition 2048, 3, :o2, 19753151, 8 - tz.transition 2048, 11, :o1, 14816291, 6 - tz.transition 2049, 3, :o2, 19756119, 8 - tz.transition 2049, 11, :o1, 14818517, 6 - tz.transition 2050, 3, :o2, 19759031, 8 - tz.transition 2050, 11, :o1, 14820701, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb deleted file mode 100644 index 1e05518b0d..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb +++ /dev/null @@ -1,161 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Godthab - include TimezoneDefinition - - timezone 'America/Godthab' do |tz| - tz.offset :o0, -12416, 0, :LMT - tz.offset :o1, -10800, 0, :WGT - tz.offset :o2, -10800, 3600, :WGST - - tz.transition 1916, 7, :o1, 3268448069, 1350 - tz.transition 1980, 4, :o2, 323845200 - tz.transition 1980, 9, :o1, 338950800 - tz.transition 1981, 3, :o2, 354675600 - tz.transition 1981, 9, :o1, 370400400 - tz.transition 1982, 3, :o2, 386125200 - tz.transition 1982, 9, :o1, 401850000 - tz.transition 1983, 3, :o2, 417574800 - tz.transition 1983, 9, :o1, 433299600 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 9, :o1, 465354000 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 9, :o1, 496803600 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 9, :o1, 528253200 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 9, :o1, 559702800 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 9, :o1, 591152400 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 9, :o1, 622602000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 9, :o1, 654656400 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 9, :o1, 686106000 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 9, :o1, 717555600 - tz.transition 1993, 3, :o2, 733280400 - tz.transition 1993, 9, :o1, 749005200 - tz.transition 1994, 3, :o2, 764730000 - tz.transition 1994, 9, :o1, 780454800 - tz.transition 1995, 3, :o2, 796179600 - tz.transition 1995, 9, :o1, 811904400 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb deleted file mode 100644 index a2bf73401c..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Guatemala - include TimezoneDefinition - - timezone 'America/Guatemala' do |tz| - tz.offset :o0, -21724, 0, :LMT - tz.offset :o1, -21600, 0, :CST - tz.offset :o2, -21600, 3600, :CDT - - tz.transition 1918, 10, :o1, 52312429831, 21600 - tz.transition 1973, 11, :o2, 123055200 - tz.transition 1974, 2, :o1, 130914000 - tz.transition 1983, 5, :o2, 422344800 - tz.transition 1983, 9, :o1, 433054800 - tz.transition 1991, 3, :o2, 669708000 - tz.transition 1991, 9, :o1, 684219600 - tz.transition 2006, 4, :o2, 1146376800 - tz.transition 2006, 10, :o1, 1159678800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb deleted file mode 100644 index d25ae775b3..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb +++ /dev/null @@ -1,274 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Halifax - include TimezoneDefinition - - timezone 'America/Halifax' do |tz| - tz.offset :o0, -15264, 0, :LMT - tz.offset :o1, -14400, 0, :AST - tz.offset :o2, -14400, 3600, :ADT - tz.offset :o3, -14400, 3600, :AWT - tz.offset :o4, -14400, 3600, :APT - - tz.transition 1902, 6, :o1, 724774703, 300 - tz.transition 1916, 4, :o2, 7262864, 3 - tz.transition 1916, 10, :o1, 19369101, 8 - tz.transition 1918, 4, :o2, 9686791, 4 - tz.transition 1918, 10, :o1, 58125545, 24 - tz.transition 1920, 5, :o2, 7267361, 3 - tz.transition 1920, 8, :o1, 19380525, 8 - tz.transition 1921, 5, :o2, 7268447, 3 - tz.transition 1921, 9, :o1, 19383501, 8 - tz.transition 1922, 4, :o2, 7269524, 3 - tz.transition 1922, 9, :o1, 19386421, 8 - tz.transition 1923, 5, :o2, 7270637, 3 - tz.transition 1923, 9, :o1, 19389333, 8 - tz.transition 1924, 5, :o2, 7271729, 3 - tz.transition 1924, 9, :o1, 19392349, 8 - tz.transition 1925, 5, :o2, 7272821, 3 - tz.transition 1925, 9, :o1, 19395373, 8 - tz.transition 1926, 5, :o2, 7273955, 3 - tz.transition 1926, 9, :o1, 19398173, 8 - tz.transition 1927, 5, :o2, 7275005, 3 - tz.transition 1927, 9, :o1, 19401197, 8 - tz.transition 1928, 5, :o2, 7276139, 3 - tz.transition 1928, 9, :o1, 19403989, 8 - tz.transition 1929, 5, :o2, 7277231, 3 - tz.transition 1929, 9, :o1, 19406861, 8 - tz.transition 1930, 5, :o2, 7278323, 3 - tz.transition 1930, 9, :o1, 19409877, 8 - tz.transition 1931, 5, :o2, 7279415, 3 - tz.transition 1931, 9, :o1, 19412901, 8 - tz.transition 1932, 5, :o2, 7280486, 3 - tz.transition 1932, 9, :o1, 19415813, 8 - tz.transition 1933, 4, :o2, 7281578, 3 - tz.transition 1933, 10, :o1, 19418781, 8 - tz.transition 1934, 5, :o2, 7282733, 3 - tz.transition 1934, 9, :o1, 19421573, 8 - tz.transition 1935, 6, :o2, 7283867, 3 - tz.transition 1935, 9, :o1, 19424605, 8 - tz.transition 1936, 6, :o2, 7284962, 3 - tz.transition 1936, 9, :o1, 19427405, 8 - tz.transition 1937, 5, :o2, 7285967, 3 - tz.transition 1937, 9, :o1, 19430429, 8 - tz.transition 1938, 5, :o2, 7287059, 3 - tz.transition 1938, 9, :o1, 19433341, 8 - tz.transition 1939, 5, :o2, 7288235, 3 - tz.transition 1939, 9, :o1, 19436253, 8 - tz.transition 1940, 5, :o2, 7289264, 3 - tz.transition 1940, 9, :o1, 19439221, 8 - tz.transition 1941, 5, :o2, 7290356, 3 - tz.transition 1941, 9, :o1, 19442133, 8 - tz.transition 1942, 2, :o3, 9721599, 4 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 58361489, 24 - tz.transition 1946, 4, :o2, 9727755, 4 - tz.transition 1946, 9, :o1, 58370225, 24 - tz.transition 1947, 4, :o2, 9729211, 4 - tz.transition 1947, 9, :o1, 58378961, 24 - tz.transition 1948, 4, :o2, 9730667, 4 - tz.transition 1948, 9, :o1, 58387697, 24 - tz.transition 1949, 4, :o2, 9732123, 4 - tz.transition 1949, 9, :o1, 58396433, 24 - tz.transition 1951, 4, :o2, 9735063, 4 - tz.transition 1951, 9, :o1, 58414073, 24 - tz.transition 1952, 4, :o2, 9736519, 4 - tz.transition 1952, 9, :o1, 58422809, 24 - tz.transition 1953, 4, :o2, 9737975, 4 - tz.transition 1953, 9, :o1, 58431545, 24 - tz.transition 1954, 4, :o2, 9739431, 4 - tz.transition 1954, 9, :o1, 58440281, 24 - tz.transition 1956, 4, :o2, 9742371, 4 - tz.transition 1956, 9, :o1, 58457921, 24 - tz.transition 1957, 4, :o2, 9743827, 4 - tz.transition 1957, 9, :o1, 58466657, 24 - tz.transition 1958, 4, :o2, 9745283, 4 - tz.transition 1958, 9, :o1, 58475393, 24 - tz.transition 1959, 4, :o2, 9746739, 4 - tz.transition 1959, 9, :o1, 58484129, 24 - tz.transition 1962, 4, :o2, 9751135, 4 - tz.transition 1962, 10, :o1, 58511177, 24 - tz.transition 1963, 4, :o2, 9752591, 4 - tz.transition 1963, 10, :o1, 58519913, 24 - tz.transition 1964, 4, :o2, 9754047, 4 - tz.transition 1964, 10, :o1, 58528649, 24 - tz.transition 1965, 4, :o2, 9755503, 4 - tz.transition 1965, 10, :o1, 58537553, 24 - tz.transition 1966, 4, :o2, 9756959, 4 - tz.transition 1966, 10, :o1, 58546289, 24 - tz.transition 1967, 4, :o2, 9758443, 4 - tz.transition 1967, 10, :o1, 58555025, 24 - tz.transition 1968, 4, :o2, 9759899, 4 - tz.transition 1968, 10, :o1, 58563761, 24 - tz.transition 1969, 4, :o2, 9761355, 4 - tz.transition 1969, 10, :o1, 58572497, 24 - tz.transition 1970, 4, :o2, 9957600 - tz.transition 1970, 10, :o1, 25678800 - tz.transition 1971, 4, :o2, 41407200 - tz.transition 1971, 10, :o1, 57733200 - tz.transition 1972, 4, :o2, 73461600 - tz.transition 1972, 10, :o1, 89182800 - tz.transition 1973, 4, :o2, 104911200 - tz.transition 1973, 10, :o1, 120632400 - tz.transition 1974, 4, :o2, 136360800 - tz.transition 1974, 10, :o1, 152082000 - tz.transition 1975, 4, :o2, 167810400 - tz.transition 1975, 10, :o1, 183531600 - tz.transition 1976, 4, :o2, 199260000 - tz.transition 1976, 10, :o1, 215586000 - tz.transition 1977, 4, :o2, 230709600 - tz.transition 1977, 10, :o1, 247035600 - tz.transition 1978, 4, :o2, 262764000 - tz.transition 1978, 10, :o1, 278485200 - tz.transition 1979, 4, :o2, 294213600 - tz.transition 1979, 10, :o1, 309934800 - tz.transition 1980, 4, :o2, 325663200 - tz.transition 1980, 10, :o1, 341384400 - tz.transition 1981, 4, :o2, 357112800 - tz.transition 1981, 10, :o1, 372834000 - tz.transition 1982, 4, :o2, 388562400 - tz.transition 1982, 10, :o1, 404888400 - tz.transition 1983, 4, :o2, 420012000 - tz.transition 1983, 10, :o1, 436338000 - tz.transition 1984, 4, :o2, 452066400 - tz.transition 1984, 10, :o1, 467787600 - tz.transition 1985, 4, :o2, 483516000 - tz.transition 1985, 10, :o1, 499237200 - tz.transition 1986, 4, :o2, 514965600 - tz.transition 1986, 10, :o1, 530686800 - tz.transition 1987, 4, :o2, 544600800 - tz.transition 1987, 10, :o1, 562136400 - tz.transition 1988, 4, :o2, 576050400 - tz.transition 1988, 10, :o1, 594190800 - tz.transition 1989, 4, :o2, 607500000 - tz.transition 1989, 10, :o1, 625640400 - tz.transition 1990, 4, :o2, 638949600 - tz.transition 1990, 10, :o1, 657090000 - tz.transition 1991, 4, :o2, 671004000 - tz.transition 1991, 10, :o1, 688539600 - tz.transition 1992, 4, :o2, 702453600 - tz.transition 1992, 10, :o1, 719989200 - tz.transition 1993, 4, :o2, 733903200 - tz.transition 1993, 10, :o1, 752043600 - tz.transition 1994, 4, :o2, 765352800 - tz.transition 1994, 10, :o1, 783493200 - tz.transition 1995, 4, :o2, 796802400 - tz.transition 1995, 10, :o1, 814942800 - tz.transition 1996, 4, :o2, 828856800 - tz.transition 1996, 10, :o1, 846392400 - tz.transition 1997, 4, :o2, 860306400 - tz.transition 1997, 10, :o1, 877842000 - tz.transition 1998, 4, :o2, 891756000 - tz.transition 1998, 10, :o1, 909291600 - tz.transition 1999, 4, :o2, 923205600 - tz.transition 1999, 10, :o1, 941346000 - tz.transition 2000, 4, :o2, 954655200 - tz.transition 2000, 10, :o1, 972795600 - tz.transition 2001, 4, :o2, 986104800 - tz.transition 2001, 10, :o1, 1004245200 - tz.transition 2002, 4, :o2, 1018159200 - tz.transition 2002, 10, :o1, 1035694800 - tz.transition 2003, 4, :o2, 1049608800 - tz.transition 2003, 10, :o1, 1067144400 - tz.transition 2004, 4, :o2, 1081058400 - tz.transition 2004, 10, :o1, 1099198800 - tz.transition 2005, 4, :o2, 1112508000 - tz.transition 2005, 10, :o1, 1130648400 - tz.transition 2006, 4, :o2, 1143957600 - tz.transition 2006, 10, :o1, 1162098000 - tz.transition 2007, 3, :o2, 1173592800 - tz.transition 2007, 11, :o1, 1194152400 - tz.transition 2008, 3, :o2, 1205042400 - tz.transition 2008, 11, :o1, 1225602000 - tz.transition 2009, 3, :o2, 1236492000 - tz.transition 2009, 11, :o1, 1257051600 - tz.transition 2010, 3, :o2, 1268546400 - tz.transition 2010, 11, :o1, 1289106000 - tz.transition 2011, 3, :o2, 1299996000 - tz.transition 2011, 11, :o1, 1320555600 - tz.transition 2012, 3, :o2, 1331445600 - tz.transition 2012, 11, :o1, 1352005200 - tz.transition 2013, 3, :o2, 1362895200 - tz.transition 2013, 11, :o1, 1383454800 - tz.transition 2014, 3, :o2, 1394344800 - tz.transition 2014, 11, :o1, 1414904400 - tz.transition 2015, 3, :o2, 1425794400 - tz.transition 2015, 11, :o1, 1446354000 - tz.transition 2016, 3, :o2, 1457848800 - tz.transition 2016, 11, :o1, 1478408400 - tz.transition 2017, 3, :o2, 1489298400 - tz.transition 2017, 11, :o1, 1509858000 - tz.transition 2018, 3, :o2, 1520748000 - tz.transition 2018, 11, :o1, 1541307600 - tz.transition 2019, 3, :o2, 1552197600 - tz.transition 2019, 11, :o1, 1572757200 - tz.transition 2020, 3, :o2, 1583647200 - tz.transition 2020, 11, :o1, 1604206800 - tz.transition 2021, 3, :o2, 1615701600 - tz.transition 2021, 11, :o1, 1636261200 - tz.transition 2022, 3, :o2, 1647151200 - tz.transition 2022, 11, :o1, 1667710800 - tz.transition 2023, 3, :o2, 1678600800 - tz.transition 2023, 11, :o1, 1699160400 - tz.transition 2024, 3, :o2, 1710050400 - tz.transition 2024, 11, :o1, 1730610000 - tz.transition 2025, 3, :o2, 1741500000 - tz.transition 2025, 11, :o1, 1762059600 - tz.transition 2026, 3, :o2, 1772949600 - tz.transition 2026, 11, :o1, 1793509200 - tz.transition 2027, 3, :o2, 1805004000 - tz.transition 2027, 11, :o1, 1825563600 - tz.transition 2028, 3, :o2, 1836453600 - tz.transition 2028, 11, :o1, 1857013200 - tz.transition 2029, 3, :o2, 1867903200 - tz.transition 2029, 11, :o1, 1888462800 - tz.transition 2030, 3, :o2, 1899352800 - tz.transition 2030, 11, :o1, 1919912400 - tz.transition 2031, 3, :o2, 1930802400 - tz.transition 2031, 11, :o1, 1951362000 - tz.transition 2032, 3, :o2, 1962856800 - tz.transition 2032, 11, :o1, 1983416400 - tz.transition 2033, 3, :o2, 1994306400 - tz.transition 2033, 11, :o1, 2014866000 - tz.transition 2034, 3, :o2, 2025756000 - tz.transition 2034, 11, :o1, 2046315600 - tz.transition 2035, 3, :o2, 2057205600 - tz.transition 2035, 11, :o1, 2077765200 - tz.transition 2036, 3, :o2, 2088655200 - tz.transition 2036, 11, :o1, 2109214800 - tz.transition 2037, 3, :o2, 2120104800 - tz.transition 2037, 11, :o1, 2140664400 - tz.transition 2038, 3, :o2, 9861987, 4 - tz.transition 2038, 11, :o1, 59177633, 24 - tz.transition 2039, 3, :o2, 9863443, 4 - tz.transition 2039, 11, :o1, 59186369, 24 - tz.transition 2040, 3, :o2, 9864899, 4 - tz.transition 2040, 11, :o1, 59195105, 24 - tz.transition 2041, 3, :o2, 9866355, 4 - tz.transition 2041, 11, :o1, 59203841, 24 - tz.transition 2042, 3, :o2, 9867811, 4 - tz.transition 2042, 11, :o1, 59212577, 24 - tz.transition 2043, 3, :o2, 9869267, 4 - tz.transition 2043, 11, :o1, 59221313, 24 - tz.transition 2044, 3, :o2, 9870751, 4 - tz.transition 2044, 11, :o1, 59230217, 24 - tz.transition 2045, 3, :o2, 9872207, 4 - tz.transition 2045, 11, :o1, 59238953, 24 - tz.transition 2046, 3, :o2, 9873663, 4 - tz.transition 2046, 11, :o1, 59247689, 24 - tz.transition 2047, 3, :o2, 9875119, 4 - tz.transition 2047, 11, :o1, 59256425, 24 - tz.transition 2048, 3, :o2, 9876575, 4 - tz.transition 2048, 11, :o1, 59265161, 24 - tz.transition 2049, 3, :o2, 9878059, 4 - tz.transition 2049, 11, :o1, 59274065, 24 - tz.transition 2050, 3, :o2, 9879515, 4 - tz.transition 2050, 11, :o1, 59282801, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb deleted file mode 100644 index f1430f6c24..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb +++ /dev/null @@ -1,149 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Indiana - module Indianapolis - include TimezoneDefinition - - timezone 'America/Indiana/Indianapolis' do |tz| - tz.offset :o0, -20678, 0, :LMT - tz.offset :o1, -21600, 0, :CST - tz.offset :o2, -21600, 3600, :CDT - tz.offset :o3, -21600, 3600, :CWT - tz.offset :o4, -21600, 3600, :CPT - tz.offset :o5, -18000, 0, :EST - tz.offset :o6, -18000, 3600, :EDT - - tz.transition 1883, 11, :o1, 9636533, 4 - tz.transition 1918, 3, :o2, 14530103, 6 - tz.transition 1918, 10, :o1, 58125451, 24 - tz.transition 1919, 3, :o2, 14532287, 6 - tz.transition 1919, 10, :o1, 58134187, 24 - tz.transition 1941, 6, :o2, 14581007, 6 - tz.transition 1941, 9, :o1, 58326379, 24 - tz.transition 1942, 2, :o3, 14582399, 6 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 58361491, 24 - tz.transition 1946, 4, :o2, 14591633, 6 - tz.transition 1946, 9, :o1, 58370227, 24 - tz.transition 1947, 4, :o2, 14593817, 6 - tz.transition 1947, 9, :o1, 58378963, 24 - tz.transition 1948, 4, :o2, 14596001, 6 - tz.transition 1948, 9, :o1, 58387699, 24 - tz.transition 1949, 4, :o2, 14598185, 6 - tz.transition 1949, 9, :o1, 58396435, 24 - tz.transition 1950, 4, :o2, 14600411, 6 - tz.transition 1950, 9, :o1, 58405171, 24 - tz.transition 1951, 4, :o2, 14602595, 6 - tz.transition 1951, 9, :o1, 58414075, 24 - tz.transition 1952, 4, :o2, 14604779, 6 - tz.transition 1952, 9, :o1, 58422811, 24 - tz.transition 1953, 4, :o2, 14606963, 6 - tz.transition 1953, 9, :o1, 58431547, 24 - tz.transition 1954, 4, :o2, 14609147, 6 - tz.transition 1954, 9, :o1, 58440283, 24 - tz.transition 1955, 4, :o5, 14611331, 6 - tz.transition 1957, 9, :o1, 58466659, 24 - tz.transition 1958, 4, :o5, 14617925, 6 - tz.transition 1969, 4, :o6, 58568131, 24 - tz.transition 1969, 10, :o5, 9762083, 4 - tz.transition 1970, 4, :o6, 9961200 - tz.transition 1970, 10, :o5, 25682400 - tz.transition 2006, 4, :o6, 1143961200 - tz.transition 2006, 10, :o5, 1162101600 - tz.transition 2007, 3, :o6, 1173596400 - tz.transition 2007, 11, :o5, 1194156000 - tz.transition 2008, 3, :o6, 1205046000 - tz.transition 2008, 11, :o5, 1225605600 - tz.transition 2009, 3, :o6, 1236495600 - tz.transition 2009, 11, :o5, 1257055200 - tz.transition 2010, 3, :o6, 1268550000 - tz.transition 2010, 11, :o5, 1289109600 - tz.transition 2011, 3, :o6, 1299999600 - tz.transition 2011, 11, :o5, 1320559200 - tz.transition 2012, 3, :o6, 1331449200 - tz.transition 2012, 11, :o5, 1352008800 - tz.transition 2013, 3, :o6, 1362898800 - tz.transition 2013, 11, :o5, 1383458400 - tz.transition 2014, 3, :o6, 1394348400 - tz.transition 2014, 11, :o5, 1414908000 - tz.transition 2015, 3, :o6, 1425798000 - tz.transition 2015, 11, :o5, 1446357600 - tz.transition 2016, 3, :o6, 1457852400 - tz.transition 2016, 11, :o5, 1478412000 - tz.transition 2017, 3, :o6, 1489302000 - tz.transition 2017, 11, :o5, 1509861600 - tz.transition 2018, 3, :o6, 1520751600 - tz.transition 2018, 11, :o5, 1541311200 - tz.transition 2019, 3, :o6, 1552201200 - tz.transition 2019, 11, :o5, 1572760800 - tz.transition 2020, 3, :o6, 1583650800 - tz.transition 2020, 11, :o5, 1604210400 - tz.transition 2021, 3, :o6, 1615705200 - tz.transition 2021, 11, :o5, 1636264800 - tz.transition 2022, 3, :o6, 1647154800 - tz.transition 2022, 11, :o5, 1667714400 - tz.transition 2023, 3, :o6, 1678604400 - tz.transition 2023, 11, :o5, 1699164000 - tz.transition 2024, 3, :o6, 1710054000 - tz.transition 2024, 11, :o5, 1730613600 - tz.transition 2025, 3, :o6, 1741503600 - tz.transition 2025, 11, :o5, 1762063200 - tz.transition 2026, 3, :o6, 1772953200 - tz.transition 2026, 11, :o5, 1793512800 - tz.transition 2027, 3, :o6, 1805007600 - tz.transition 2027, 11, :o5, 1825567200 - tz.transition 2028, 3, :o6, 1836457200 - tz.transition 2028, 11, :o5, 1857016800 - tz.transition 2029, 3, :o6, 1867906800 - tz.transition 2029, 11, :o5, 1888466400 - tz.transition 2030, 3, :o6, 1899356400 - tz.transition 2030, 11, :o5, 1919916000 - tz.transition 2031, 3, :o6, 1930806000 - tz.transition 2031, 11, :o5, 1951365600 - tz.transition 2032, 3, :o6, 1962860400 - tz.transition 2032, 11, :o5, 1983420000 - tz.transition 2033, 3, :o6, 1994310000 - tz.transition 2033, 11, :o5, 2014869600 - tz.transition 2034, 3, :o6, 2025759600 - tz.transition 2034, 11, :o5, 2046319200 - tz.transition 2035, 3, :o6, 2057209200 - tz.transition 2035, 11, :o5, 2077768800 - tz.transition 2036, 3, :o6, 2088658800 - tz.transition 2036, 11, :o5, 2109218400 - tz.transition 2037, 3, :o6, 2120108400 - tz.transition 2037, 11, :o5, 2140668000 - tz.transition 2038, 3, :o6, 59171923, 24 - tz.transition 2038, 11, :o5, 9862939, 4 - tz.transition 2039, 3, :o6, 59180659, 24 - tz.transition 2039, 11, :o5, 9864395, 4 - tz.transition 2040, 3, :o6, 59189395, 24 - tz.transition 2040, 11, :o5, 9865851, 4 - tz.transition 2041, 3, :o6, 59198131, 24 - tz.transition 2041, 11, :o5, 9867307, 4 - tz.transition 2042, 3, :o6, 59206867, 24 - tz.transition 2042, 11, :o5, 9868763, 4 - tz.transition 2043, 3, :o6, 59215603, 24 - tz.transition 2043, 11, :o5, 9870219, 4 - tz.transition 2044, 3, :o6, 59224507, 24 - tz.transition 2044, 11, :o5, 9871703, 4 - tz.transition 2045, 3, :o6, 59233243, 24 - tz.transition 2045, 11, :o5, 9873159, 4 - tz.transition 2046, 3, :o6, 59241979, 24 - tz.transition 2046, 11, :o5, 9874615, 4 - tz.transition 2047, 3, :o6, 59250715, 24 - tz.transition 2047, 11, :o5, 9876071, 4 - tz.transition 2048, 3, :o6, 59259451, 24 - tz.transition 2048, 11, :o5, 9877527, 4 - tz.transition 2049, 3, :o6, 59268355, 24 - tz.transition 2049, 11, :o5, 9879011, 4 - tz.transition 2050, 3, :o6, 59277091, 24 - tz.transition 2050, 11, :o5, 9880467, 4 - end - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb deleted file mode 100644 index f646f3f54a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb +++ /dev/null @@ -1,194 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Juneau - include TimezoneDefinition - - timezone 'America/Juneau' do |tz| - tz.offset :o0, 54139, 0, :LMT - tz.offset :o1, -32261, 0, :LMT - tz.offset :o2, -28800, 0, :PST - tz.offset :o3, -28800, 3600, :PWT - tz.offset :o4, -28800, 3600, :PPT - tz.offset :o5, -28800, 3600, :PDT - tz.offset :o6, -32400, 0, :YST - tz.offset :o7, -32400, 0, :AKST - tz.offset :o8, -32400, 3600, :AKDT - - tz.transition 1867, 10, :o1, 207641393861, 86400 - tz.transition 1900, 8, :o2, 208677805061, 86400 - tz.transition 1942, 2, :o3, 29164799, 12 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o2, 19453831, 8 - tz.transition 1969, 4, :o5, 29284067, 12 - tz.transition 1969, 10, :o2, 19524167, 8 - tz.transition 1970, 4, :o5, 9972000 - tz.transition 1970, 10, :o2, 25693200 - tz.transition 1971, 4, :o5, 41421600 - tz.transition 1971, 10, :o2, 57747600 - tz.transition 1972, 4, :o5, 73476000 - tz.transition 1972, 10, :o2, 89197200 - tz.transition 1973, 4, :o5, 104925600 - tz.transition 1973, 10, :o2, 120646800 - tz.transition 1974, 1, :o5, 126698400 - tz.transition 1974, 10, :o2, 152096400 - tz.transition 1975, 2, :o5, 162381600 - tz.transition 1975, 10, :o2, 183546000 - tz.transition 1976, 4, :o5, 199274400 - tz.transition 1976, 10, :o2, 215600400 - tz.transition 1977, 4, :o5, 230724000 - tz.transition 1977, 10, :o2, 247050000 - tz.transition 1978, 4, :o5, 262778400 - tz.transition 1978, 10, :o2, 278499600 - tz.transition 1979, 4, :o5, 294228000 - tz.transition 1979, 10, :o2, 309949200 - tz.transition 1980, 4, :o5, 325677600 - tz.transition 1980, 10, :o2, 341398800 - tz.transition 1981, 4, :o5, 357127200 - tz.transition 1981, 10, :o2, 372848400 - tz.transition 1982, 4, :o5, 388576800 - tz.transition 1982, 10, :o2, 404902800 - tz.transition 1983, 4, :o5, 420026400 - tz.transition 1983, 10, :o6, 436352400 - tz.transition 1983, 11, :o7, 439030800 - tz.transition 1984, 4, :o8, 452084400 - tz.transition 1984, 10, :o7, 467805600 - tz.transition 1985, 4, :o8, 483534000 - tz.transition 1985, 10, :o7, 499255200 - tz.transition 1986, 4, :o8, 514983600 - tz.transition 1986, 10, :o7, 530704800 - tz.transition 1987, 4, :o8, 544618800 - tz.transition 1987, 10, :o7, 562154400 - tz.transition 1988, 4, :o8, 576068400 - tz.transition 1988, 10, :o7, 594208800 - tz.transition 1989, 4, :o8, 607518000 - tz.transition 1989, 10, :o7, 625658400 - tz.transition 1990, 4, :o8, 638967600 - tz.transition 1990, 10, :o7, 657108000 - tz.transition 1991, 4, :o8, 671022000 - tz.transition 1991, 10, :o7, 688557600 - tz.transition 1992, 4, :o8, 702471600 - tz.transition 1992, 10, :o7, 720007200 - tz.transition 1993, 4, :o8, 733921200 - tz.transition 1993, 10, :o7, 752061600 - tz.transition 1994, 4, :o8, 765370800 - tz.transition 1994, 10, :o7, 783511200 - tz.transition 1995, 4, :o8, 796820400 - tz.transition 1995, 10, :o7, 814960800 - tz.transition 1996, 4, :o8, 828874800 - tz.transition 1996, 10, :o7, 846410400 - tz.transition 1997, 4, :o8, 860324400 - tz.transition 1997, 10, :o7, 877860000 - tz.transition 1998, 4, :o8, 891774000 - tz.transition 1998, 10, :o7, 909309600 - tz.transition 1999, 4, :o8, 923223600 - tz.transition 1999, 10, :o7, 941364000 - tz.transition 2000, 4, :o8, 954673200 - tz.transition 2000, 10, :o7, 972813600 - tz.transition 2001, 4, :o8, 986122800 - tz.transition 2001, 10, :o7, 1004263200 - tz.transition 2002, 4, :o8, 1018177200 - tz.transition 2002, 10, :o7, 1035712800 - tz.transition 2003, 4, :o8, 1049626800 - tz.transition 2003, 10, :o7, 1067162400 - tz.transition 2004, 4, :o8, 1081076400 - tz.transition 2004, 10, :o7, 1099216800 - tz.transition 2005, 4, :o8, 1112526000 - tz.transition 2005, 10, :o7, 1130666400 - tz.transition 2006, 4, :o8, 1143975600 - tz.transition 2006, 10, :o7, 1162116000 - tz.transition 2007, 3, :o8, 1173610800 - tz.transition 2007, 11, :o7, 1194170400 - tz.transition 2008, 3, :o8, 1205060400 - tz.transition 2008, 11, :o7, 1225620000 - tz.transition 2009, 3, :o8, 1236510000 - tz.transition 2009, 11, :o7, 1257069600 - tz.transition 2010, 3, :o8, 1268564400 - tz.transition 2010, 11, :o7, 1289124000 - tz.transition 2011, 3, :o8, 1300014000 - tz.transition 2011, 11, :o7, 1320573600 - tz.transition 2012, 3, :o8, 1331463600 - tz.transition 2012, 11, :o7, 1352023200 - tz.transition 2013, 3, :o8, 1362913200 - tz.transition 2013, 11, :o7, 1383472800 - tz.transition 2014, 3, :o8, 1394362800 - tz.transition 2014, 11, :o7, 1414922400 - tz.transition 2015, 3, :o8, 1425812400 - tz.transition 2015, 11, :o7, 1446372000 - tz.transition 2016, 3, :o8, 1457866800 - tz.transition 2016, 11, :o7, 1478426400 - tz.transition 2017, 3, :o8, 1489316400 - tz.transition 2017, 11, :o7, 1509876000 - tz.transition 2018, 3, :o8, 1520766000 - tz.transition 2018, 11, :o7, 1541325600 - tz.transition 2019, 3, :o8, 1552215600 - tz.transition 2019, 11, :o7, 1572775200 - tz.transition 2020, 3, :o8, 1583665200 - tz.transition 2020, 11, :o7, 1604224800 - tz.transition 2021, 3, :o8, 1615719600 - tz.transition 2021, 11, :o7, 1636279200 - tz.transition 2022, 3, :o8, 1647169200 - tz.transition 2022, 11, :o7, 1667728800 - tz.transition 2023, 3, :o8, 1678618800 - tz.transition 2023, 11, :o7, 1699178400 - tz.transition 2024, 3, :o8, 1710068400 - tz.transition 2024, 11, :o7, 1730628000 - tz.transition 2025, 3, :o8, 1741518000 - tz.transition 2025, 11, :o7, 1762077600 - tz.transition 2026, 3, :o8, 1772967600 - tz.transition 2026, 11, :o7, 1793527200 - tz.transition 2027, 3, :o8, 1805022000 - tz.transition 2027, 11, :o7, 1825581600 - tz.transition 2028, 3, :o8, 1836471600 - tz.transition 2028, 11, :o7, 1857031200 - tz.transition 2029, 3, :o8, 1867921200 - tz.transition 2029, 11, :o7, 1888480800 - tz.transition 2030, 3, :o8, 1899370800 - tz.transition 2030, 11, :o7, 1919930400 - tz.transition 2031, 3, :o8, 1930820400 - tz.transition 2031, 11, :o7, 1951380000 - tz.transition 2032, 3, :o8, 1962874800 - tz.transition 2032, 11, :o7, 1983434400 - tz.transition 2033, 3, :o8, 1994324400 - tz.transition 2033, 11, :o7, 2014884000 - tz.transition 2034, 3, :o8, 2025774000 - tz.transition 2034, 11, :o7, 2046333600 - tz.transition 2035, 3, :o8, 2057223600 - tz.transition 2035, 11, :o7, 2077783200 - tz.transition 2036, 3, :o8, 2088673200 - tz.transition 2036, 11, :o7, 2109232800 - tz.transition 2037, 3, :o8, 2120122800 - tz.transition 2037, 11, :o7, 2140682400 - tz.transition 2038, 3, :o8, 59171927, 24 - tz.transition 2038, 11, :o7, 29588819, 12 - tz.transition 2039, 3, :o8, 59180663, 24 - tz.transition 2039, 11, :o7, 29593187, 12 - tz.transition 2040, 3, :o8, 59189399, 24 - tz.transition 2040, 11, :o7, 29597555, 12 - tz.transition 2041, 3, :o8, 59198135, 24 - tz.transition 2041, 11, :o7, 29601923, 12 - tz.transition 2042, 3, :o8, 59206871, 24 - tz.transition 2042, 11, :o7, 29606291, 12 - tz.transition 2043, 3, :o8, 59215607, 24 - tz.transition 2043, 11, :o7, 29610659, 12 - tz.transition 2044, 3, :o8, 59224511, 24 - tz.transition 2044, 11, :o7, 29615111, 12 - tz.transition 2045, 3, :o8, 59233247, 24 - tz.transition 2045, 11, :o7, 29619479, 12 - tz.transition 2046, 3, :o8, 59241983, 24 - tz.transition 2046, 11, :o7, 29623847, 12 - tz.transition 2047, 3, :o8, 59250719, 24 - tz.transition 2047, 11, :o7, 29628215, 12 - tz.transition 2048, 3, :o8, 59259455, 24 - tz.transition 2048, 11, :o7, 29632583, 12 - tz.transition 2049, 3, :o8, 59268359, 24 - tz.transition 2049, 11, :o7, 29637035, 12 - tz.transition 2050, 3, :o8, 59277095, 24 - tz.transition 2050, 11, :o7, 29641403, 12 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb deleted file mode 100644 index 45c907899f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module La_Paz - include TimezoneDefinition - - timezone 'America/La_Paz' do |tz| - tz.offset :o0, -16356, 0, :LMT - tz.offset :o1, -16356, 0, :CMT - tz.offset :o2, -16356, 3600, :BOST - tz.offset :o3, -14400, 0, :BOT - - tz.transition 1890, 1, :o1, 17361854563, 7200 - tz.transition 1931, 10, :o2, 17471733763, 7200 - tz.transition 1932, 3, :o3, 17472871063, 7200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb deleted file mode 100644 index af68ac29f7..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Lima - include TimezoneDefinition - - timezone 'America/Lima' do |tz| - tz.offset :o0, -18492, 0, :LMT - tz.offset :o1, -18516, 0, :LMT - tz.offset :o2, -18000, 0, :PET - tz.offset :o3, -18000, 3600, :PEST - - tz.transition 1890, 1, :o1, 17361854741, 7200 - tz.transition 1908, 7, :o2, 17410685143, 7200 - tz.transition 1938, 1, :o3, 58293593, 24 - tz.transition 1938, 4, :o2, 7286969, 3 - tz.transition 1938, 9, :o3, 58300001, 24 - tz.transition 1939, 3, :o2, 7288046, 3 - tz.transition 1939, 9, :o3, 58308737, 24 - tz.transition 1940, 3, :o2, 7289138, 3 - tz.transition 1986, 1, :o3, 504939600 - tz.transition 1986, 4, :o2, 512712000 - tz.transition 1987, 1, :o3, 536475600 - tz.transition 1987, 4, :o2, 544248000 - tz.transition 1990, 1, :o3, 631170000 - tz.transition 1990, 4, :o2, 638942400 - tz.transition 1994, 1, :o3, 757400400 - tz.transition 1994, 4, :o2, 765172800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb deleted file mode 100644 index 16007fd675..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb +++ /dev/null @@ -1,232 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Los_Angeles - include TimezoneDefinition - - timezone 'America/Los_Angeles' do |tz| - tz.offset :o0, -28378, 0, :LMT - tz.offset :o1, -28800, 0, :PST - tz.offset :o2, -28800, 3600, :PDT - tz.offset :o3, -28800, 3600, :PWT - tz.offset :o4, -28800, 3600, :PPT - - tz.transition 1883, 11, :o1, 7227400, 3 - tz.transition 1918, 3, :o2, 29060207, 12 - tz.transition 1918, 10, :o1, 19375151, 8 - tz.transition 1919, 3, :o2, 29064575, 12 - tz.transition 1919, 10, :o1, 19378063, 8 - tz.transition 1942, 2, :o3, 29164799, 12 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 19453831, 8 - tz.transition 1948, 3, :o2, 29191499, 12 - tz.transition 1949, 1, :o1, 19463343, 8 - tz.transition 1950, 4, :o2, 29200823, 12 - tz.transition 1950, 9, :o1, 19468391, 8 - tz.transition 1951, 4, :o2, 29205191, 12 - tz.transition 1951, 9, :o1, 19471359, 8 - tz.transition 1952, 4, :o2, 29209559, 12 - tz.transition 1952, 9, :o1, 19474271, 8 - tz.transition 1953, 4, :o2, 29213927, 12 - tz.transition 1953, 9, :o1, 19477183, 8 - tz.transition 1954, 4, :o2, 29218295, 12 - tz.transition 1954, 9, :o1, 19480095, 8 - tz.transition 1955, 4, :o2, 29222663, 12 - tz.transition 1955, 9, :o1, 19483007, 8 - tz.transition 1956, 4, :o2, 29227115, 12 - tz.transition 1956, 9, :o1, 19485975, 8 - tz.transition 1957, 4, :o2, 29231483, 12 - tz.transition 1957, 9, :o1, 19488887, 8 - tz.transition 1958, 4, :o2, 29235851, 12 - tz.transition 1958, 9, :o1, 19491799, 8 - tz.transition 1959, 4, :o2, 29240219, 12 - tz.transition 1959, 9, :o1, 19494711, 8 - tz.transition 1960, 4, :o2, 29244587, 12 - tz.transition 1960, 9, :o1, 19497623, 8 - tz.transition 1961, 4, :o2, 29249039, 12 - tz.transition 1961, 9, :o1, 19500535, 8 - tz.transition 1962, 4, :o2, 29253407, 12 - tz.transition 1962, 10, :o1, 19503727, 8 - tz.transition 1963, 4, :o2, 29257775, 12 - tz.transition 1963, 10, :o1, 19506639, 8 - tz.transition 1964, 4, :o2, 29262143, 12 - tz.transition 1964, 10, :o1, 19509551, 8 - tz.transition 1965, 4, :o2, 29266511, 12 - tz.transition 1965, 10, :o1, 19512519, 8 - tz.transition 1966, 4, :o2, 29270879, 12 - tz.transition 1966, 10, :o1, 19515431, 8 - tz.transition 1967, 4, :o2, 29275331, 12 - tz.transition 1967, 10, :o1, 19518343, 8 - tz.transition 1968, 4, :o2, 29279699, 12 - tz.transition 1968, 10, :o1, 19521255, 8 - tz.transition 1969, 4, :o2, 29284067, 12 - tz.transition 1969, 10, :o1, 19524167, 8 - tz.transition 1970, 4, :o2, 9972000 - tz.transition 1970, 10, :o1, 25693200 - tz.transition 1971, 4, :o2, 41421600 - tz.transition 1971, 10, :o1, 57747600 - tz.transition 1972, 4, :o2, 73476000 - tz.transition 1972, 10, :o1, 89197200 - tz.transition 1973, 4, :o2, 104925600 - tz.transition 1973, 10, :o1, 120646800 - tz.transition 1974, 1, :o2, 126698400 - tz.transition 1974, 10, :o1, 152096400 - tz.transition 1975, 2, :o2, 162381600 - tz.transition 1975, 10, :o1, 183546000 - tz.transition 1976, 4, :o2, 199274400 - tz.transition 1976, 10, :o1, 215600400 - tz.transition 1977, 4, :o2, 230724000 - tz.transition 1977, 10, :o1, 247050000 - tz.transition 1978, 4, :o2, 262778400 - tz.transition 1978, 10, :o1, 278499600 - tz.transition 1979, 4, :o2, 294228000 - tz.transition 1979, 10, :o1, 309949200 - tz.transition 1980, 4, :o2, 325677600 - tz.transition 1980, 10, :o1, 341398800 - tz.transition 1981, 4, :o2, 357127200 - tz.transition 1981, 10, :o1, 372848400 - tz.transition 1982, 4, :o2, 388576800 - tz.transition 1982, 10, :o1, 404902800 - tz.transition 1983, 4, :o2, 420026400 - tz.transition 1983, 10, :o1, 436352400 - tz.transition 1984, 4, :o2, 452080800 - tz.transition 1984, 10, :o1, 467802000 - tz.transition 1985, 4, :o2, 483530400 - tz.transition 1985, 10, :o1, 499251600 - tz.transition 1986, 4, :o2, 514980000 - tz.transition 1986, 10, :o1, 530701200 - tz.transition 1987, 4, :o2, 544615200 - tz.transition 1987, 10, :o1, 562150800 - tz.transition 1988, 4, :o2, 576064800 - tz.transition 1988, 10, :o1, 594205200 - tz.transition 1989, 4, :o2, 607514400 - tz.transition 1989, 10, :o1, 625654800 - tz.transition 1990, 4, :o2, 638964000 - tz.transition 1990, 10, :o1, 657104400 - tz.transition 1991, 4, :o2, 671018400 - tz.transition 1991, 10, :o1, 688554000 - tz.transition 1992, 4, :o2, 702468000 - tz.transition 1992, 10, :o1, 720003600 - tz.transition 1993, 4, :o2, 733917600 - tz.transition 1993, 10, :o1, 752058000 - tz.transition 1994, 4, :o2, 765367200 - tz.transition 1994, 10, :o1, 783507600 - tz.transition 1995, 4, :o2, 796816800 - tz.transition 1995, 10, :o1, 814957200 - tz.transition 1996, 4, :o2, 828871200 - tz.transition 1996, 10, :o1, 846406800 - tz.transition 1997, 4, :o2, 860320800 - tz.transition 1997, 10, :o1, 877856400 - tz.transition 1998, 4, :o2, 891770400 - tz.transition 1998, 10, :o1, 909306000 - tz.transition 1999, 4, :o2, 923220000 - tz.transition 1999, 10, :o1, 941360400 - tz.transition 2000, 4, :o2, 954669600 - tz.transition 2000, 10, :o1, 972810000 - tz.transition 2001, 4, :o2, 986119200 - tz.transition 2001, 10, :o1, 1004259600 - tz.transition 2002, 4, :o2, 1018173600 - tz.transition 2002, 10, :o1, 1035709200 - tz.transition 2003, 4, :o2, 1049623200 - tz.transition 2003, 10, :o1, 1067158800 - tz.transition 2004, 4, :o2, 1081072800 - tz.transition 2004, 10, :o1, 1099213200 - tz.transition 2005, 4, :o2, 1112522400 - tz.transition 2005, 10, :o1, 1130662800 - tz.transition 2006, 4, :o2, 1143972000 - tz.transition 2006, 10, :o1, 1162112400 - tz.transition 2007, 3, :o2, 1173607200 - tz.transition 2007, 11, :o1, 1194166800 - tz.transition 2008, 3, :o2, 1205056800 - tz.transition 2008, 11, :o1, 1225616400 - tz.transition 2009, 3, :o2, 1236506400 - tz.transition 2009, 11, :o1, 1257066000 - tz.transition 2010, 3, :o2, 1268560800 - tz.transition 2010, 11, :o1, 1289120400 - tz.transition 2011, 3, :o2, 1300010400 - tz.transition 2011, 11, :o1, 1320570000 - tz.transition 2012, 3, :o2, 1331460000 - tz.transition 2012, 11, :o1, 1352019600 - tz.transition 2013, 3, :o2, 1362909600 - tz.transition 2013, 11, :o1, 1383469200 - tz.transition 2014, 3, :o2, 1394359200 - tz.transition 2014, 11, :o1, 1414918800 - tz.transition 2015, 3, :o2, 1425808800 - tz.transition 2015, 11, :o1, 1446368400 - tz.transition 2016, 3, :o2, 1457863200 - tz.transition 2016, 11, :o1, 1478422800 - tz.transition 2017, 3, :o2, 1489312800 - tz.transition 2017, 11, :o1, 1509872400 - tz.transition 2018, 3, :o2, 1520762400 - tz.transition 2018, 11, :o1, 1541322000 - tz.transition 2019, 3, :o2, 1552212000 - tz.transition 2019, 11, :o1, 1572771600 - tz.transition 2020, 3, :o2, 1583661600 - tz.transition 2020, 11, :o1, 1604221200 - tz.transition 2021, 3, :o2, 1615716000 - tz.transition 2021, 11, :o1, 1636275600 - tz.transition 2022, 3, :o2, 1647165600 - tz.transition 2022, 11, :o1, 1667725200 - tz.transition 2023, 3, :o2, 1678615200 - tz.transition 2023, 11, :o1, 1699174800 - tz.transition 2024, 3, :o2, 1710064800 - tz.transition 2024, 11, :o1, 1730624400 - tz.transition 2025, 3, :o2, 1741514400 - tz.transition 2025, 11, :o1, 1762074000 - tz.transition 2026, 3, :o2, 1772964000 - tz.transition 2026, 11, :o1, 1793523600 - tz.transition 2027, 3, :o2, 1805018400 - tz.transition 2027, 11, :o1, 1825578000 - tz.transition 2028, 3, :o2, 1836468000 - tz.transition 2028, 11, :o1, 1857027600 - tz.transition 2029, 3, :o2, 1867917600 - tz.transition 2029, 11, :o1, 1888477200 - tz.transition 2030, 3, :o2, 1899367200 - tz.transition 2030, 11, :o1, 1919926800 - tz.transition 2031, 3, :o2, 1930816800 - tz.transition 2031, 11, :o1, 1951376400 - tz.transition 2032, 3, :o2, 1962871200 - tz.transition 2032, 11, :o1, 1983430800 - tz.transition 2033, 3, :o2, 1994320800 - tz.transition 2033, 11, :o1, 2014880400 - tz.transition 2034, 3, :o2, 2025770400 - tz.transition 2034, 11, :o1, 2046330000 - tz.transition 2035, 3, :o2, 2057220000 - tz.transition 2035, 11, :o1, 2077779600 - tz.transition 2036, 3, :o2, 2088669600 - tz.transition 2036, 11, :o1, 2109229200 - tz.transition 2037, 3, :o2, 2120119200 - tz.transition 2037, 11, :o1, 2140678800 - tz.transition 2038, 3, :o2, 29585963, 12 - tz.transition 2038, 11, :o1, 19725879, 8 - tz.transition 2039, 3, :o2, 29590331, 12 - tz.transition 2039, 11, :o1, 19728791, 8 - tz.transition 2040, 3, :o2, 29594699, 12 - tz.transition 2040, 11, :o1, 19731703, 8 - tz.transition 2041, 3, :o2, 29599067, 12 - tz.transition 2041, 11, :o1, 19734615, 8 - tz.transition 2042, 3, :o2, 29603435, 12 - tz.transition 2042, 11, :o1, 19737527, 8 - tz.transition 2043, 3, :o2, 29607803, 12 - tz.transition 2043, 11, :o1, 19740439, 8 - tz.transition 2044, 3, :o2, 29612255, 12 - tz.transition 2044, 11, :o1, 19743407, 8 - tz.transition 2045, 3, :o2, 29616623, 12 - tz.transition 2045, 11, :o1, 19746319, 8 - tz.transition 2046, 3, :o2, 29620991, 12 - tz.transition 2046, 11, :o1, 19749231, 8 - tz.transition 2047, 3, :o2, 29625359, 12 - tz.transition 2047, 11, :o1, 19752143, 8 - tz.transition 2048, 3, :o2, 29629727, 12 - tz.transition 2048, 11, :o1, 19755055, 8 - tz.transition 2049, 3, :o2, 29634179, 12 - tz.transition 2049, 11, :o1, 19758023, 8 - tz.transition 2050, 3, :o2, 29638547, 12 - tz.transition 2050, 11, :o1, 19760935, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb deleted file mode 100644 index ba9e6efcf1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Mazatlan - include TimezoneDefinition - - timezone 'America/Mazatlan' do |tz| - tz.offset :o0, -25540, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -21600, 0, :CST - tz.offset :o3, -28800, 0, :PST - tz.offset :o4, -25200, 3600, :MDT - - tz.transition 1922, 1, :o1, 58153339, 24 - tz.transition 1927, 6, :o2, 9700171, 4 - tz.transition 1930, 11, :o1, 9705183, 4 - tz.transition 1931, 5, :o2, 9705855, 4 - tz.transition 1931, 10, :o1, 9706463, 4 - tz.transition 1932, 4, :o2, 58243171, 24 - tz.transition 1942, 4, :o1, 9721895, 4 - tz.transition 1949, 1, :o3, 58390339, 24 - tz.transition 1970, 1, :o1, 28800 - tz.transition 1996, 4, :o4, 828867600 - tz.transition 1996, 10, :o1, 846403200 - tz.transition 1997, 4, :o4, 860317200 - tz.transition 1997, 10, :o1, 877852800 - tz.transition 1998, 4, :o4, 891766800 - tz.transition 1998, 10, :o1, 909302400 - tz.transition 1999, 4, :o4, 923216400 - tz.transition 1999, 10, :o1, 941356800 - tz.transition 2000, 4, :o4, 954666000 - tz.transition 2000, 10, :o1, 972806400 - tz.transition 2001, 5, :o4, 989139600 - tz.transition 2001, 9, :o1, 1001836800 - tz.transition 2002, 4, :o4, 1018170000 - tz.transition 2002, 10, :o1, 1035705600 - tz.transition 2003, 4, :o4, 1049619600 - tz.transition 2003, 10, :o1, 1067155200 - tz.transition 2004, 4, :o4, 1081069200 - tz.transition 2004, 10, :o1, 1099209600 - tz.transition 2005, 4, :o4, 1112518800 - tz.transition 2005, 10, :o1, 1130659200 - tz.transition 2006, 4, :o4, 1143968400 - tz.transition 2006, 10, :o1, 1162108800 - tz.transition 2007, 4, :o4, 1175418000 - tz.transition 2007, 10, :o1, 1193558400 - tz.transition 2008, 4, :o4, 1207472400 - tz.transition 2008, 10, :o1, 1225008000 - tz.transition 2009, 4, :o4, 1238922000 - tz.transition 2009, 10, :o1, 1256457600 - tz.transition 2010, 4, :o4, 1270371600 - tz.transition 2010, 10, :o1, 1288512000 - tz.transition 2011, 4, :o4, 1301821200 - tz.transition 2011, 10, :o1, 1319961600 - tz.transition 2012, 4, :o4, 1333270800 - tz.transition 2012, 10, :o1, 1351411200 - tz.transition 2013, 4, :o4, 1365325200 - tz.transition 2013, 10, :o1, 1382860800 - tz.transition 2014, 4, :o4, 1396774800 - tz.transition 2014, 10, :o1, 1414310400 - tz.transition 2015, 4, :o4, 1428224400 - tz.transition 2015, 10, :o1, 1445760000 - tz.transition 2016, 4, :o4, 1459674000 - tz.transition 2016, 10, :o1, 1477814400 - tz.transition 2017, 4, :o4, 1491123600 - tz.transition 2017, 10, :o1, 1509264000 - tz.transition 2018, 4, :o4, 1522573200 - tz.transition 2018, 10, :o1, 1540713600 - tz.transition 2019, 4, :o4, 1554627600 - tz.transition 2019, 10, :o1, 1572163200 - tz.transition 2020, 4, :o4, 1586077200 - tz.transition 2020, 10, :o1, 1603612800 - tz.transition 2021, 4, :o4, 1617526800 - tz.transition 2021, 10, :o1, 1635667200 - tz.transition 2022, 4, :o4, 1648976400 - tz.transition 2022, 10, :o1, 1667116800 - tz.transition 2023, 4, :o4, 1680426000 - tz.transition 2023, 10, :o1, 1698566400 - tz.transition 2024, 4, :o4, 1712480400 - tz.transition 2024, 10, :o1, 1730016000 - tz.transition 2025, 4, :o4, 1743930000 - tz.transition 2025, 10, :o1, 1761465600 - tz.transition 2026, 4, :o4, 1775379600 - tz.transition 2026, 10, :o1, 1792915200 - tz.transition 2027, 4, :o4, 1806829200 - tz.transition 2027, 10, :o1, 1824969600 - tz.transition 2028, 4, :o4, 1838278800 - tz.transition 2028, 10, :o1, 1856419200 - tz.transition 2029, 4, :o4, 1869728400 - tz.transition 2029, 10, :o1, 1887868800 - tz.transition 2030, 4, :o4, 1901782800 - tz.transition 2030, 10, :o1, 1919318400 - tz.transition 2031, 4, :o4, 1933232400 - tz.transition 2031, 10, :o1, 1950768000 - tz.transition 2032, 4, :o4, 1964682000 - tz.transition 2032, 10, :o1, 1982822400 - tz.transition 2033, 4, :o4, 1996131600 - tz.transition 2033, 10, :o1, 2014272000 - tz.transition 2034, 4, :o4, 2027581200 - tz.transition 2034, 10, :o1, 2045721600 - tz.transition 2035, 4, :o4, 2059030800 - tz.transition 2035, 10, :o1, 2077171200 - tz.transition 2036, 4, :o4, 2091085200 - tz.transition 2036, 10, :o1, 2108620800 - tz.transition 2037, 4, :o4, 2122534800 - tz.transition 2037, 10, :o1, 2140070400 - tz.transition 2038, 4, :o4, 19724143, 8 - tz.transition 2038, 10, :o1, 14794367, 6 - tz.transition 2039, 4, :o4, 19727055, 8 - tz.transition 2039, 10, :o1, 14796551, 6 - tz.transition 2040, 4, :o4, 19729967, 8 - tz.transition 2040, 10, :o1, 14798735, 6 - tz.transition 2041, 4, :o4, 19732935, 8 - tz.transition 2041, 10, :o1, 14800919, 6 - tz.transition 2042, 4, :o4, 19735847, 8 - tz.transition 2042, 10, :o1, 14803103, 6 - tz.transition 2043, 4, :o4, 19738759, 8 - tz.transition 2043, 10, :o1, 14805287, 6 - tz.transition 2044, 4, :o4, 19741671, 8 - tz.transition 2044, 10, :o1, 14807513, 6 - tz.transition 2045, 4, :o4, 19744583, 8 - tz.transition 2045, 10, :o1, 14809697, 6 - tz.transition 2046, 4, :o4, 19747495, 8 - tz.transition 2046, 10, :o1, 14811881, 6 - tz.transition 2047, 4, :o4, 19750463, 8 - tz.transition 2047, 10, :o1, 14814065, 6 - tz.transition 2048, 4, :o4, 19753375, 8 - tz.transition 2048, 10, :o1, 14816249, 6 - tz.transition 2049, 4, :o4, 19756287, 8 - tz.transition 2049, 10, :o1, 14818475, 6 - tz.transition 2050, 4, :o4, 19759199, 8 - tz.transition 2050, 10, :o1, 14820659, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb deleted file mode 100644 index 2347fce647..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb +++ /dev/null @@ -1,144 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Mexico_City - include TimezoneDefinition - - timezone 'America/Mexico_City' do |tz| - tz.offset :o0, -23796, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -21600, 0, :CST - tz.offset :o3, -21600, 3600, :CDT - tz.offset :o4, -21600, 3600, :CWT - - tz.transition 1922, 1, :o1, 58153339, 24 - tz.transition 1927, 6, :o2, 9700171, 4 - tz.transition 1930, 11, :o1, 9705183, 4 - tz.transition 1931, 5, :o2, 9705855, 4 - tz.transition 1931, 10, :o1, 9706463, 4 - tz.transition 1932, 4, :o2, 58243171, 24 - tz.transition 1939, 2, :o3, 9717199, 4 - tz.transition 1939, 6, :o2, 58306553, 24 - tz.transition 1940, 12, :o3, 9719891, 4 - tz.transition 1941, 4, :o2, 58322057, 24 - tz.transition 1943, 12, :o4, 9724299, 4 - tz.transition 1944, 5, :o2, 58349081, 24 - tz.transition 1950, 2, :o3, 9733299, 4 - tz.transition 1950, 7, :o2, 58403825, 24 - tz.transition 1996, 4, :o3, 828864000 - tz.transition 1996, 10, :o2, 846399600 - tz.transition 1997, 4, :o3, 860313600 - tz.transition 1997, 10, :o2, 877849200 - tz.transition 1998, 4, :o3, 891763200 - tz.transition 1998, 10, :o2, 909298800 - tz.transition 1999, 4, :o3, 923212800 - tz.transition 1999, 10, :o2, 941353200 - tz.transition 2000, 4, :o3, 954662400 - tz.transition 2000, 10, :o2, 972802800 - tz.transition 2001, 5, :o3, 989136000 - tz.transition 2001, 9, :o2, 1001833200 - tz.transition 2002, 4, :o3, 1018166400 - tz.transition 2002, 10, :o2, 1035702000 - tz.transition 2003, 4, :o3, 1049616000 - tz.transition 2003, 10, :o2, 1067151600 - tz.transition 2004, 4, :o3, 1081065600 - tz.transition 2004, 10, :o2, 1099206000 - tz.transition 2005, 4, :o3, 1112515200 - tz.transition 2005, 10, :o2, 1130655600 - tz.transition 2006, 4, :o3, 1143964800 - tz.transition 2006, 10, :o2, 1162105200 - tz.transition 2007, 4, :o3, 1175414400 - tz.transition 2007, 10, :o2, 1193554800 - tz.transition 2008, 4, :o3, 1207468800 - tz.transition 2008, 10, :o2, 1225004400 - tz.transition 2009, 4, :o3, 1238918400 - tz.transition 2009, 10, :o2, 1256454000 - tz.transition 2010, 4, :o3, 1270368000 - tz.transition 2010, 10, :o2, 1288508400 - tz.transition 2011, 4, :o3, 1301817600 - tz.transition 2011, 10, :o2, 1319958000 - tz.transition 2012, 4, :o3, 1333267200 - tz.transition 2012, 10, :o2, 1351407600 - tz.transition 2013, 4, :o3, 1365321600 - tz.transition 2013, 10, :o2, 1382857200 - tz.transition 2014, 4, :o3, 1396771200 - tz.transition 2014, 10, :o2, 1414306800 - tz.transition 2015, 4, :o3, 1428220800 - tz.transition 2015, 10, :o2, 1445756400 - tz.transition 2016, 4, :o3, 1459670400 - tz.transition 2016, 10, :o2, 1477810800 - tz.transition 2017, 4, :o3, 1491120000 - tz.transition 2017, 10, :o2, 1509260400 - tz.transition 2018, 4, :o3, 1522569600 - tz.transition 2018, 10, :o2, 1540710000 - tz.transition 2019, 4, :o3, 1554624000 - tz.transition 2019, 10, :o2, 1572159600 - tz.transition 2020, 4, :o3, 1586073600 - tz.transition 2020, 10, :o2, 1603609200 - tz.transition 2021, 4, :o3, 1617523200 - tz.transition 2021, 10, :o2, 1635663600 - tz.transition 2022, 4, :o3, 1648972800 - tz.transition 2022, 10, :o2, 1667113200 - tz.transition 2023, 4, :o3, 1680422400 - tz.transition 2023, 10, :o2, 1698562800 - tz.transition 2024, 4, :o3, 1712476800 - tz.transition 2024, 10, :o2, 1730012400 - tz.transition 2025, 4, :o3, 1743926400 - tz.transition 2025, 10, :o2, 1761462000 - tz.transition 2026, 4, :o3, 1775376000 - tz.transition 2026, 10, :o2, 1792911600 - tz.transition 2027, 4, :o3, 1806825600 - tz.transition 2027, 10, :o2, 1824966000 - tz.transition 2028, 4, :o3, 1838275200 - tz.transition 2028, 10, :o2, 1856415600 - tz.transition 2029, 4, :o3, 1869724800 - tz.transition 2029, 10, :o2, 1887865200 - tz.transition 2030, 4, :o3, 1901779200 - tz.transition 2030, 10, :o2, 1919314800 - tz.transition 2031, 4, :o3, 1933228800 - tz.transition 2031, 10, :o2, 1950764400 - tz.transition 2032, 4, :o3, 1964678400 - tz.transition 2032, 10, :o2, 1982818800 - tz.transition 2033, 4, :o3, 1996128000 - tz.transition 2033, 10, :o2, 2014268400 - tz.transition 2034, 4, :o3, 2027577600 - tz.transition 2034, 10, :o2, 2045718000 - tz.transition 2035, 4, :o3, 2059027200 - tz.transition 2035, 10, :o2, 2077167600 - tz.transition 2036, 4, :o3, 2091081600 - tz.transition 2036, 10, :o2, 2108617200 - tz.transition 2037, 4, :o3, 2122531200 - tz.transition 2037, 10, :o2, 2140066800 - tz.transition 2038, 4, :o3, 14793107, 6 - tz.transition 2038, 10, :o2, 59177467, 24 - tz.transition 2039, 4, :o3, 14795291, 6 - tz.transition 2039, 10, :o2, 59186203, 24 - tz.transition 2040, 4, :o3, 14797475, 6 - tz.transition 2040, 10, :o2, 59194939, 24 - tz.transition 2041, 4, :o3, 14799701, 6 - tz.transition 2041, 10, :o2, 59203675, 24 - tz.transition 2042, 4, :o3, 14801885, 6 - tz.transition 2042, 10, :o2, 59212411, 24 - tz.transition 2043, 4, :o3, 14804069, 6 - tz.transition 2043, 10, :o2, 59221147, 24 - tz.transition 2044, 4, :o3, 14806253, 6 - tz.transition 2044, 10, :o2, 59230051, 24 - tz.transition 2045, 4, :o3, 14808437, 6 - tz.transition 2045, 10, :o2, 59238787, 24 - tz.transition 2046, 4, :o3, 14810621, 6 - tz.transition 2046, 10, :o2, 59247523, 24 - tz.transition 2047, 4, :o3, 14812847, 6 - tz.transition 2047, 10, :o2, 59256259, 24 - tz.transition 2048, 4, :o3, 14815031, 6 - tz.transition 2048, 10, :o2, 59264995, 24 - tz.transition 2049, 4, :o3, 14817215, 6 - tz.transition 2049, 10, :o2, 59273899, 24 - tz.transition 2050, 4, :o3, 14819399, 6 - tz.transition 2050, 10, :o2, 59282635, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb deleted file mode 100644 index 5816a9eab1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb +++ /dev/null @@ -1,131 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Monterrey - include TimezoneDefinition - - timezone 'America/Monterrey' do |tz| - tz.offset :o0, -24076, 0, :LMT - tz.offset :o1, -21600, 0, :CST - tz.offset :o2, -21600, 3600, :CDT - - tz.transition 1922, 1, :o1, 9692223, 4 - tz.transition 1988, 4, :o2, 576057600 - tz.transition 1988, 10, :o1, 594198000 - tz.transition 1996, 4, :o2, 828864000 - tz.transition 1996, 10, :o1, 846399600 - tz.transition 1997, 4, :o2, 860313600 - tz.transition 1997, 10, :o1, 877849200 - tz.transition 1998, 4, :o2, 891763200 - tz.transition 1998, 10, :o1, 909298800 - tz.transition 1999, 4, :o2, 923212800 - tz.transition 1999, 10, :o1, 941353200 - tz.transition 2000, 4, :o2, 954662400 - tz.transition 2000, 10, :o1, 972802800 - tz.transition 2001, 5, :o2, 989136000 - tz.transition 2001, 9, :o1, 1001833200 - tz.transition 2002, 4, :o2, 1018166400 - tz.transition 2002, 10, :o1, 1035702000 - tz.transition 2003, 4, :o2, 1049616000 - tz.transition 2003, 10, :o1, 1067151600 - tz.transition 2004, 4, :o2, 1081065600 - tz.transition 2004, 10, :o1, 1099206000 - tz.transition 2005, 4, :o2, 1112515200 - tz.transition 2005, 10, :o1, 1130655600 - tz.transition 2006, 4, :o2, 1143964800 - tz.transition 2006, 10, :o1, 1162105200 - tz.transition 2007, 4, :o2, 1175414400 - tz.transition 2007, 10, :o1, 1193554800 - tz.transition 2008, 4, :o2, 1207468800 - tz.transition 2008, 10, :o1, 1225004400 - tz.transition 2009, 4, :o2, 1238918400 - tz.transition 2009, 10, :o1, 1256454000 - tz.transition 2010, 4, :o2, 1270368000 - tz.transition 2010, 10, :o1, 1288508400 - tz.transition 2011, 4, :o2, 1301817600 - tz.transition 2011, 10, :o1, 1319958000 - tz.transition 2012, 4, :o2, 1333267200 - tz.transition 2012, 10, :o1, 1351407600 - tz.transition 2013, 4, :o2, 1365321600 - tz.transition 2013, 10, :o1, 1382857200 - tz.transition 2014, 4, :o2, 1396771200 - tz.transition 2014, 10, :o1, 1414306800 - tz.transition 2015, 4, :o2, 1428220800 - tz.transition 2015, 10, :o1, 1445756400 - tz.transition 2016, 4, :o2, 1459670400 - tz.transition 2016, 10, :o1, 1477810800 - tz.transition 2017, 4, :o2, 1491120000 - tz.transition 2017, 10, :o1, 1509260400 - tz.transition 2018, 4, :o2, 1522569600 - tz.transition 2018, 10, :o1, 1540710000 - tz.transition 2019, 4, :o2, 1554624000 - tz.transition 2019, 10, :o1, 1572159600 - tz.transition 2020, 4, :o2, 1586073600 - tz.transition 2020, 10, :o1, 1603609200 - tz.transition 2021, 4, :o2, 1617523200 - tz.transition 2021, 10, :o1, 1635663600 - tz.transition 2022, 4, :o2, 1648972800 - tz.transition 2022, 10, :o1, 1667113200 - tz.transition 2023, 4, :o2, 1680422400 - tz.transition 2023, 10, :o1, 1698562800 - tz.transition 2024, 4, :o2, 1712476800 - tz.transition 2024, 10, :o1, 1730012400 - tz.transition 2025, 4, :o2, 1743926400 - tz.transition 2025, 10, :o1, 1761462000 - tz.transition 2026, 4, :o2, 1775376000 - tz.transition 2026, 10, :o1, 1792911600 - tz.transition 2027, 4, :o2, 1806825600 - tz.transition 2027, 10, :o1, 1824966000 - tz.transition 2028, 4, :o2, 1838275200 - tz.transition 2028, 10, :o1, 1856415600 - tz.transition 2029, 4, :o2, 1869724800 - tz.transition 2029, 10, :o1, 1887865200 - tz.transition 2030, 4, :o2, 1901779200 - tz.transition 2030, 10, :o1, 1919314800 - tz.transition 2031, 4, :o2, 1933228800 - tz.transition 2031, 10, :o1, 1950764400 - tz.transition 2032, 4, :o2, 1964678400 - tz.transition 2032, 10, :o1, 1982818800 - tz.transition 2033, 4, :o2, 1996128000 - tz.transition 2033, 10, :o1, 2014268400 - tz.transition 2034, 4, :o2, 2027577600 - tz.transition 2034, 10, :o1, 2045718000 - tz.transition 2035, 4, :o2, 2059027200 - tz.transition 2035, 10, :o1, 2077167600 - tz.transition 2036, 4, :o2, 2091081600 - tz.transition 2036, 10, :o1, 2108617200 - tz.transition 2037, 4, :o2, 2122531200 - tz.transition 2037, 10, :o1, 2140066800 - tz.transition 2038, 4, :o2, 14793107, 6 - tz.transition 2038, 10, :o1, 59177467, 24 - tz.transition 2039, 4, :o2, 14795291, 6 - tz.transition 2039, 10, :o1, 59186203, 24 - tz.transition 2040, 4, :o2, 14797475, 6 - tz.transition 2040, 10, :o1, 59194939, 24 - tz.transition 2041, 4, :o2, 14799701, 6 - tz.transition 2041, 10, :o1, 59203675, 24 - tz.transition 2042, 4, :o2, 14801885, 6 - tz.transition 2042, 10, :o1, 59212411, 24 - tz.transition 2043, 4, :o2, 14804069, 6 - tz.transition 2043, 10, :o1, 59221147, 24 - tz.transition 2044, 4, :o2, 14806253, 6 - tz.transition 2044, 10, :o1, 59230051, 24 - tz.transition 2045, 4, :o2, 14808437, 6 - tz.transition 2045, 10, :o1, 59238787, 24 - tz.transition 2046, 4, :o2, 14810621, 6 - tz.transition 2046, 10, :o1, 59247523, 24 - tz.transition 2047, 4, :o2, 14812847, 6 - tz.transition 2047, 10, :o1, 59256259, 24 - tz.transition 2048, 4, :o2, 14815031, 6 - tz.transition 2048, 10, :o1, 59264995, 24 - tz.transition 2049, 4, :o2, 14817215, 6 - tz.transition 2049, 10, :o1, 59273899, 24 - tz.transition 2050, 4, :o2, 14819399, 6 - tz.transition 2050, 10, :o1, 59282635, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb deleted file mode 100644 index 7d802bd2de..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb +++ /dev/null @@ -1,282 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module New_York - include TimezoneDefinition - - timezone 'America/New_York' do |tz| - tz.offset :o0, -17762, 0, :LMT - tz.offset :o1, -18000, 0, :EST - tz.offset :o2, -18000, 3600, :EDT - tz.offset :o3, -18000, 3600, :EWT - tz.offset :o4, -18000, 3600, :EPT - - tz.transition 1883, 11, :o1, 57819197, 24 - tz.transition 1918, 3, :o2, 58120411, 24 - tz.transition 1918, 10, :o1, 9687575, 4 - tz.transition 1919, 3, :o2, 58129147, 24 - tz.transition 1919, 10, :o1, 9689031, 4 - tz.transition 1920, 3, :o2, 58137883, 24 - tz.transition 1920, 10, :o1, 9690515, 4 - tz.transition 1921, 4, :o2, 58147291, 24 - tz.transition 1921, 9, :o1, 9691831, 4 - tz.transition 1922, 4, :o2, 58156195, 24 - tz.transition 1922, 9, :o1, 9693287, 4 - tz.transition 1923, 4, :o2, 58164931, 24 - tz.transition 1923, 9, :o1, 9694771, 4 - tz.transition 1924, 4, :o2, 58173667, 24 - tz.transition 1924, 9, :o1, 9696227, 4 - tz.transition 1925, 4, :o2, 58182403, 24 - tz.transition 1925, 9, :o1, 9697683, 4 - tz.transition 1926, 4, :o2, 58191139, 24 - tz.transition 1926, 9, :o1, 9699139, 4 - tz.transition 1927, 4, :o2, 58199875, 24 - tz.transition 1927, 9, :o1, 9700595, 4 - tz.transition 1928, 4, :o2, 58208779, 24 - tz.transition 1928, 9, :o1, 9702079, 4 - tz.transition 1929, 4, :o2, 58217515, 24 - tz.transition 1929, 9, :o1, 9703535, 4 - tz.transition 1930, 4, :o2, 58226251, 24 - tz.transition 1930, 9, :o1, 9704991, 4 - tz.transition 1931, 4, :o2, 58234987, 24 - tz.transition 1931, 9, :o1, 9706447, 4 - tz.transition 1932, 4, :o2, 58243723, 24 - tz.transition 1932, 9, :o1, 9707903, 4 - tz.transition 1933, 4, :o2, 58252627, 24 - tz.transition 1933, 9, :o1, 9709359, 4 - tz.transition 1934, 4, :o2, 58261363, 24 - tz.transition 1934, 9, :o1, 9710843, 4 - tz.transition 1935, 4, :o2, 58270099, 24 - tz.transition 1935, 9, :o1, 9712299, 4 - tz.transition 1936, 4, :o2, 58278835, 24 - tz.transition 1936, 9, :o1, 9713755, 4 - tz.transition 1937, 4, :o2, 58287571, 24 - tz.transition 1937, 9, :o1, 9715211, 4 - tz.transition 1938, 4, :o2, 58296307, 24 - tz.transition 1938, 9, :o1, 9716667, 4 - tz.transition 1939, 4, :o2, 58305211, 24 - tz.transition 1939, 9, :o1, 9718123, 4 - tz.transition 1940, 4, :o2, 58313947, 24 - tz.transition 1940, 9, :o1, 9719607, 4 - tz.transition 1941, 4, :o2, 58322683, 24 - tz.transition 1941, 9, :o1, 9721063, 4 - tz.transition 1942, 2, :o3, 58329595, 24 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 9726915, 4 - tz.transition 1946, 4, :o2, 58366531, 24 - tz.transition 1946, 9, :o1, 9728371, 4 - tz.transition 1947, 4, :o2, 58375267, 24 - tz.transition 1947, 9, :o1, 9729827, 4 - tz.transition 1948, 4, :o2, 58384003, 24 - tz.transition 1948, 9, :o1, 9731283, 4 - tz.transition 1949, 4, :o2, 58392739, 24 - tz.transition 1949, 9, :o1, 9732739, 4 - tz.transition 1950, 4, :o2, 58401643, 24 - tz.transition 1950, 9, :o1, 9734195, 4 - tz.transition 1951, 4, :o2, 58410379, 24 - tz.transition 1951, 9, :o1, 9735679, 4 - tz.transition 1952, 4, :o2, 58419115, 24 - tz.transition 1952, 9, :o1, 9737135, 4 - tz.transition 1953, 4, :o2, 58427851, 24 - tz.transition 1953, 9, :o1, 9738591, 4 - tz.transition 1954, 4, :o2, 58436587, 24 - tz.transition 1954, 9, :o1, 9740047, 4 - tz.transition 1955, 4, :o2, 58445323, 24 - tz.transition 1955, 10, :o1, 9741643, 4 - tz.transition 1956, 4, :o2, 58454227, 24 - tz.transition 1956, 10, :o1, 9743099, 4 - tz.transition 1957, 4, :o2, 58462963, 24 - tz.transition 1957, 10, :o1, 9744555, 4 - tz.transition 1958, 4, :o2, 58471699, 24 - tz.transition 1958, 10, :o1, 9746011, 4 - tz.transition 1959, 4, :o2, 58480435, 24 - tz.transition 1959, 10, :o1, 9747467, 4 - tz.transition 1960, 4, :o2, 58489171, 24 - tz.transition 1960, 10, :o1, 9748951, 4 - tz.transition 1961, 4, :o2, 58498075, 24 - tz.transition 1961, 10, :o1, 9750407, 4 - tz.transition 1962, 4, :o2, 58506811, 24 - tz.transition 1962, 10, :o1, 9751863, 4 - tz.transition 1963, 4, :o2, 58515547, 24 - tz.transition 1963, 10, :o1, 9753319, 4 - tz.transition 1964, 4, :o2, 58524283, 24 - tz.transition 1964, 10, :o1, 9754775, 4 - tz.transition 1965, 4, :o2, 58533019, 24 - tz.transition 1965, 10, :o1, 9756259, 4 - tz.transition 1966, 4, :o2, 58541755, 24 - tz.transition 1966, 10, :o1, 9757715, 4 - tz.transition 1967, 4, :o2, 58550659, 24 - tz.transition 1967, 10, :o1, 9759171, 4 - tz.transition 1968, 4, :o2, 58559395, 24 - tz.transition 1968, 10, :o1, 9760627, 4 - tz.transition 1969, 4, :o2, 58568131, 24 - tz.transition 1969, 10, :o1, 9762083, 4 - tz.transition 1970, 4, :o2, 9961200 - tz.transition 1970, 10, :o1, 25682400 - tz.transition 1971, 4, :o2, 41410800 - tz.transition 1971, 10, :o1, 57736800 - tz.transition 1972, 4, :o2, 73465200 - tz.transition 1972, 10, :o1, 89186400 - tz.transition 1973, 4, :o2, 104914800 - tz.transition 1973, 10, :o1, 120636000 - tz.transition 1974, 1, :o2, 126687600 - tz.transition 1974, 10, :o1, 152085600 - tz.transition 1975, 2, :o2, 162370800 - tz.transition 1975, 10, :o1, 183535200 - tz.transition 1976, 4, :o2, 199263600 - tz.transition 1976, 10, :o1, 215589600 - tz.transition 1977, 4, :o2, 230713200 - tz.transition 1977, 10, :o1, 247039200 - tz.transition 1978, 4, :o2, 262767600 - tz.transition 1978, 10, :o1, 278488800 - tz.transition 1979, 4, :o2, 294217200 - tz.transition 1979, 10, :o1, 309938400 - tz.transition 1980, 4, :o2, 325666800 - tz.transition 1980, 10, :o1, 341388000 - tz.transition 1981, 4, :o2, 357116400 - tz.transition 1981, 10, :o1, 372837600 - tz.transition 1982, 4, :o2, 388566000 - tz.transition 1982, 10, :o1, 404892000 - tz.transition 1983, 4, :o2, 420015600 - tz.transition 1983, 10, :o1, 436341600 - tz.transition 1984, 4, :o2, 452070000 - tz.transition 1984, 10, :o1, 467791200 - tz.transition 1985, 4, :o2, 483519600 - tz.transition 1985, 10, :o1, 499240800 - tz.transition 1986, 4, :o2, 514969200 - tz.transition 1986, 10, :o1, 530690400 - tz.transition 1987, 4, :o2, 544604400 - tz.transition 1987, 10, :o1, 562140000 - tz.transition 1988, 4, :o2, 576054000 - tz.transition 1988, 10, :o1, 594194400 - tz.transition 1989, 4, :o2, 607503600 - tz.transition 1989, 10, :o1, 625644000 - tz.transition 1990, 4, :o2, 638953200 - tz.transition 1990, 10, :o1, 657093600 - tz.transition 1991, 4, :o2, 671007600 - tz.transition 1991, 10, :o1, 688543200 - tz.transition 1992, 4, :o2, 702457200 - tz.transition 1992, 10, :o1, 719992800 - tz.transition 1993, 4, :o2, 733906800 - tz.transition 1993, 10, :o1, 752047200 - tz.transition 1994, 4, :o2, 765356400 - tz.transition 1994, 10, :o1, 783496800 - tz.transition 1995, 4, :o2, 796806000 - tz.transition 1995, 10, :o1, 814946400 - tz.transition 1996, 4, :o2, 828860400 - tz.transition 1996, 10, :o1, 846396000 - tz.transition 1997, 4, :o2, 860310000 - tz.transition 1997, 10, :o1, 877845600 - tz.transition 1998, 4, :o2, 891759600 - tz.transition 1998, 10, :o1, 909295200 - tz.transition 1999, 4, :o2, 923209200 - tz.transition 1999, 10, :o1, 941349600 - tz.transition 2000, 4, :o2, 954658800 - tz.transition 2000, 10, :o1, 972799200 - tz.transition 2001, 4, :o2, 986108400 - tz.transition 2001, 10, :o1, 1004248800 - tz.transition 2002, 4, :o2, 1018162800 - tz.transition 2002, 10, :o1, 1035698400 - tz.transition 2003, 4, :o2, 1049612400 - tz.transition 2003, 10, :o1, 1067148000 - tz.transition 2004, 4, :o2, 1081062000 - tz.transition 2004, 10, :o1, 1099202400 - tz.transition 2005, 4, :o2, 1112511600 - tz.transition 2005, 10, :o1, 1130652000 - tz.transition 2006, 4, :o2, 1143961200 - tz.transition 2006, 10, :o1, 1162101600 - tz.transition 2007, 3, :o2, 1173596400 - tz.transition 2007, 11, :o1, 1194156000 - tz.transition 2008, 3, :o2, 1205046000 - tz.transition 2008, 11, :o1, 1225605600 - tz.transition 2009, 3, :o2, 1236495600 - tz.transition 2009, 11, :o1, 1257055200 - tz.transition 2010, 3, :o2, 1268550000 - tz.transition 2010, 11, :o1, 1289109600 - tz.transition 2011, 3, :o2, 1299999600 - tz.transition 2011, 11, :o1, 1320559200 - tz.transition 2012, 3, :o2, 1331449200 - tz.transition 2012, 11, :o1, 1352008800 - tz.transition 2013, 3, :o2, 1362898800 - tz.transition 2013, 11, :o1, 1383458400 - tz.transition 2014, 3, :o2, 1394348400 - tz.transition 2014, 11, :o1, 1414908000 - tz.transition 2015, 3, :o2, 1425798000 - tz.transition 2015, 11, :o1, 1446357600 - tz.transition 2016, 3, :o2, 1457852400 - tz.transition 2016, 11, :o1, 1478412000 - tz.transition 2017, 3, :o2, 1489302000 - tz.transition 2017, 11, :o1, 1509861600 - tz.transition 2018, 3, :o2, 1520751600 - tz.transition 2018, 11, :o1, 1541311200 - tz.transition 2019, 3, :o2, 1552201200 - tz.transition 2019, 11, :o1, 1572760800 - tz.transition 2020, 3, :o2, 1583650800 - tz.transition 2020, 11, :o1, 1604210400 - tz.transition 2021, 3, :o2, 1615705200 - tz.transition 2021, 11, :o1, 1636264800 - tz.transition 2022, 3, :o2, 1647154800 - tz.transition 2022, 11, :o1, 1667714400 - tz.transition 2023, 3, :o2, 1678604400 - tz.transition 2023, 11, :o1, 1699164000 - tz.transition 2024, 3, :o2, 1710054000 - tz.transition 2024, 11, :o1, 1730613600 - tz.transition 2025, 3, :o2, 1741503600 - tz.transition 2025, 11, :o1, 1762063200 - tz.transition 2026, 3, :o2, 1772953200 - tz.transition 2026, 11, :o1, 1793512800 - tz.transition 2027, 3, :o2, 1805007600 - tz.transition 2027, 11, :o1, 1825567200 - tz.transition 2028, 3, :o2, 1836457200 - tz.transition 2028, 11, :o1, 1857016800 - tz.transition 2029, 3, :o2, 1867906800 - tz.transition 2029, 11, :o1, 1888466400 - tz.transition 2030, 3, :o2, 1899356400 - tz.transition 2030, 11, :o1, 1919916000 - tz.transition 2031, 3, :o2, 1930806000 - tz.transition 2031, 11, :o1, 1951365600 - tz.transition 2032, 3, :o2, 1962860400 - tz.transition 2032, 11, :o1, 1983420000 - tz.transition 2033, 3, :o2, 1994310000 - tz.transition 2033, 11, :o1, 2014869600 - tz.transition 2034, 3, :o2, 2025759600 - tz.transition 2034, 11, :o1, 2046319200 - tz.transition 2035, 3, :o2, 2057209200 - tz.transition 2035, 11, :o1, 2077768800 - tz.transition 2036, 3, :o2, 2088658800 - tz.transition 2036, 11, :o1, 2109218400 - tz.transition 2037, 3, :o2, 2120108400 - tz.transition 2037, 11, :o1, 2140668000 - tz.transition 2038, 3, :o2, 59171923, 24 - tz.transition 2038, 11, :o1, 9862939, 4 - tz.transition 2039, 3, :o2, 59180659, 24 - tz.transition 2039, 11, :o1, 9864395, 4 - tz.transition 2040, 3, :o2, 59189395, 24 - tz.transition 2040, 11, :o1, 9865851, 4 - tz.transition 2041, 3, :o2, 59198131, 24 - tz.transition 2041, 11, :o1, 9867307, 4 - tz.transition 2042, 3, :o2, 59206867, 24 - tz.transition 2042, 11, :o1, 9868763, 4 - tz.transition 2043, 3, :o2, 59215603, 24 - tz.transition 2043, 11, :o1, 9870219, 4 - tz.transition 2044, 3, :o2, 59224507, 24 - tz.transition 2044, 11, :o1, 9871703, 4 - tz.transition 2045, 3, :o2, 59233243, 24 - tz.transition 2045, 11, :o1, 9873159, 4 - tz.transition 2046, 3, :o2, 59241979, 24 - tz.transition 2046, 11, :o1, 9874615, 4 - tz.transition 2047, 3, :o2, 59250715, 24 - tz.transition 2047, 11, :o1, 9876071, 4 - tz.transition 2048, 3, :o2, 59259451, 24 - tz.transition 2048, 11, :o1, 9877527, 4 - tz.transition 2049, 3, :o2, 59268355, 24 - tz.transition 2049, 11, :o1, 9879011, 4 - tz.transition 2050, 3, :o2, 59277091, 24 - tz.transition 2050, 11, :o1, 9880467, 4 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb deleted file mode 100644 index b514e0c0f9..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Phoenix - include TimezoneDefinition - - timezone 'America/Phoenix' do |tz| - tz.offset :o0, -26898, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -25200, 3600, :MDT - tz.offset :o3, -25200, 3600, :MWT - - tz.transition 1883, 11, :o1, 57819199, 24 - tz.transition 1918, 3, :o2, 19373471, 8 - tz.transition 1918, 10, :o1, 14531363, 6 - tz.transition 1919, 3, :o2, 19376383, 8 - tz.transition 1919, 10, :o1, 14533547, 6 - tz.transition 1942, 2, :o3, 19443199, 8 - tz.transition 1944, 1, :o1, 3500770681, 1440 - tz.transition 1944, 4, :o3, 3500901781, 1440 - tz.transition 1944, 10, :o1, 3501165241, 1440 - tz.transition 1967, 4, :o2, 19516887, 8 - tz.transition 1967, 10, :o1, 14638757, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb deleted file mode 100644 index ebdb68814a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Regina - include TimezoneDefinition - - timezone 'America/Regina' do |tz| - tz.offset :o0, -25116, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -25200, 3600, :MDT - tz.offset :o3, -25200, 3600, :MWT - tz.offset :o4, -25200, 3600, :MPT - tz.offset :o5, -21600, 0, :CST - - tz.transition 1905, 9, :o1, 17403046493, 7200 - tz.transition 1918, 4, :o2, 19373583, 8 - tz.transition 1918, 10, :o1, 14531387, 6 - tz.transition 1930, 5, :o2, 58226419, 24 - tz.transition 1930, 10, :o1, 9705019, 4 - tz.transition 1931, 5, :o2, 58235155, 24 - tz.transition 1931, 10, :o1, 9706475, 4 - tz.transition 1932, 5, :o2, 58243891, 24 - tz.transition 1932, 10, :o1, 9707931, 4 - tz.transition 1933, 5, :o2, 58252795, 24 - tz.transition 1933, 10, :o1, 9709387, 4 - tz.transition 1934, 5, :o2, 58261531, 24 - tz.transition 1934, 10, :o1, 9710871, 4 - tz.transition 1937, 4, :o2, 58287235, 24 - tz.transition 1937, 10, :o1, 9715267, 4 - tz.transition 1938, 4, :o2, 58295971, 24 - tz.transition 1938, 10, :o1, 9716695, 4 - tz.transition 1939, 4, :o2, 58304707, 24 - tz.transition 1939, 10, :o1, 9718179, 4 - tz.transition 1940, 4, :o2, 58313611, 24 - tz.transition 1940, 10, :o1, 9719663, 4 - tz.transition 1941, 4, :o2, 58322347, 24 - tz.transition 1941, 10, :o1, 9721119, 4 - tz.transition 1942, 2, :o3, 19443199, 8 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 14590373, 6 - tz.transition 1946, 4, :o2, 19455399, 8 - tz.transition 1946, 10, :o1, 14592641, 6 - tz.transition 1947, 4, :o2, 19458423, 8 - tz.transition 1947, 9, :o1, 14594741, 6 - tz.transition 1948, 4, :o2, 19461335, 8 - tz.transition 1948, 9, :o1, 14596925, 6 - tz.transition 1949, 4, :o2, 19464247, 8 - tz.transition 1949, 9, :o1, 14599109, 6 - tz.transition 1950, 4, :o2, 19467215, 8 - tz.transition 1950, 9, :o1, 14601293, 6 - tz.transition 1951, 4, :o2, 19470127, 8 - tz.transition 1951, 9, :o1, 14603519, 6 - tz.transition 1952, 4, :o2, 19473039, 8 - tz.transition 1952, 9, :o1, 14605703, 6 - tz.transition 1953, 4, :o2, 19475951, 8 - tz.transition 1953, 9, :o1, 14607887, 6 - tz.transition 1954, 4, :o2, 19478863, 8 - tz.transition 1954, 9, :o1, 14610071, 6 - tz.transition 1955, 4, :o2, 19481775, 8 - tz.transition 1955, 9, :o1, 14612255, 6 - tz.transition 1956, 4, :o2, 19484743, 8 - tz.transition 1956, 9, :o1, 14614481, 6 - tz.transition 1957, 4, :o2, 19487655, 8 - tz.transition 1957, 9, :o1, 14616665, 6 - tz.transition 1959, 4, :o2, 19493479, 8 - tz.transition 1959, 10, :o1, 14621201, 6 - tz.transition 1960, 4, :o5, 19496391, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb deleted file mode 100644 index 0287c9ebc4..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb +++ /dev/null @@ -1,205 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Santiago - include TimezoneDefinition - - timezone 'America/Santiago' do |tz| - tz.offset :o0, -16966, 0, :LMT - tz.offset :o1, -16966, 0, :SMT - tz.offset :o2, -18000, 0, :CLT - tz.offset :o3, -14400, 0, :CLT - tz.offset :o4, -18000, 3600, :CLST - tz.offset :o5, -14400, 3600, :CLST - - tz.transition 1890, 1, :o1, 104171127683, 43200 - tz.transition 1910, 1, :o2, 104486660483, 43200 - tz.transition 1916, 7, :o1, 58105097, 24 - tz.transition 1918, 9, :o3, 104623388483, 43200 - tz.transition 1919, 7, :o1, 7266422, 3 - tz.transition 1927, 9, :o4, 104765386883, 43200 - tz.transition 1928, 4, :o2, 7276013, 3 - tz.transition 1928, 9, :o4, 58211777, 24 - tz.transition 1929, 4, :o2, 7277108, 3 - tz.transition 1929, 9, :o4, 58220537, 24 - tz.transition 1930, 4, :o2, 7278203, 3 - tz.transition 1930, 9, :o4, 58229297, 24 - tz.transition 1931, 4, :o2, 7279298, 3 - tz.transition 1931, 9, :o4, 58238057, 24 - tz.transition 1932, 4, :o2, 7280396, 3 - tz.transition 1932, 9, :o4, 58246841, 24 - tz.transition 1942, 6, :o2, 7291535, 3 - tz.transition 1942, 8, :o4, 58333745, 24 - tz.transition 1946, 9, :o2, 19456517, 8 - tz.transition 1947, 5, :o3, 58375865, 24 - tz.transition 1968, 11, :o5, 7320491, 3 - tz.transition 1969, 3, :o3, 19522485, 8 - tz.transition 1969, 11, :o5, 7321646, 3 - tz.transition 1970, 3, :o3, 7527600 - tz.transition 1970, 10, :o5, 24465600 - tz.transition 1971, 3, :o3, 37767600 - tz.transition 1971, 10, :o5, 55915200 - tz.transition 1972, 3, :o3, 69217200 - tz.transition 1972, 10, :o5, 87969600 - tz.transition 1973, 3, :o3, 100666800 - tz.transition 1973, 9, :o5, 118209600 - tz.transition 1974, 3, :o3, 132116400 - tz.transition 1974, 10, :o5, 150868800 - tz.transition 1975, 3, :o3, 163566000 - tz.transition 1975, 10, :o5, 182318400 - tz.transition 1976, 3, :o3, 195620400 - tz.transition 1976, 10, :o5, 213768000 - tz.transition 1977, 3, :o3, 227070000 - tz.transition 1977, 10, :o5, 245217600 - tz.transition 1978, 3, :o3, 258519600 - tz.transition 1978, 10, :o5, 277272000 - tz.transition 1979, 3, :o3, 289969200 - tz.transition 1979, 10, :o5, 308721600 - tz.transition 1980, 3, :o3, 321418800 - tz.transition 1980, 10, :o5, 340171200 - tz.transition 1981, 3, :o3, 353473200 - tz.transition 1981, 10, :o5, 371620800 - tz.transition 1982, 3, :o3, 384922800 - tz.transition 1982, 10, :o5, 403070400 - tz.transition 1983, 3, :o3, 416372400 - tz.transition 1983, 10, :o5, 434520000 - tz.transition 1984, 3, :o3, 447822000 - tz.transition 1984, 10, :o5, 466574400 - tz.transition 1985, 3, :o3, 479271600 - tz.transition 1985, 10, :o5, 498024000 - tz.transition 1986, 3, :o3, 510721200 - tz.transition 1986, 10, :o5, 529473600 - tz.transition 1987, 4, :o3, 545194800 - tz.transition 1987, 10, :o5, 560923200 - tz.transition 1988, 3, :o3, 574225200 - tz.transition 1988, 10, :o5, 591768000 - tz.transition 1989, 3, :o3, 605674800 - tz.transition 1989, 10, :o5, 624427200 - tz.transition 1990, 3, :o3, 637729200 - tz.transition 1990, 9, :o5, 653457600 - tz.transition 1991, 3, :o3, 668574000 - tz.transition 1991, 10, :o5, 687326400 - tz.transition 1992, 3, :o3, 700628400 - tz.transition 1992, 10, :o5, 718776000 - tz.transition 1993, 3, :o3, 732078000 - tz.transition 1993, 10, :o5, 750225600 - tz.transition 1994, 3, :o3, 763527600 - tz.transition 1994, 10, :o5, 781675200 - tz.transition 1995, 3, :o3, 794977200 - tz.transition 1995, 10, :o5, 813729600 - tz.transition 1996, 3, :o3, 826426800 - tz.transition 1996, 10, :o5, 845179200 - tz.transition 1997, 3, :o3, 859690800 - tz.transition 1997, 10, :o5, 876628800 - tz.transition 1998, 3, :o3, 889930800 - tz.transition 1998, 9, :o5, 906868800 - tz.transition 1999, 4, :o3, 923194800 - tz.transition 1999, 10, :o5, 939528000 - tz.transition 2000, 3, :o3, 952830000 - tz.transition 2000, 10, :o5, 971582400 - tz.transition 2001, 3, :o3, 984279600 - tz.transition 2001, 10, :o5, 1003032000 - tz.transition 2002, 3, :o3, 1015729200 - tz.transition 2002, 10, :o5, 1034481600 - tz.transition 2003, 3, :o3, 1047178800 - tz.transition 2003, 10, :o5, 1065931200 - tz.transition 2004, 3, :o3, 1079233200 - tz.transition 2004, 10, :o5, 1097380800 - tz.transition 2005, 3, :o3, 1110682800 - tz.transition 2005, 10, :o5, 1128830400 - tz.transition 2006, 3, :o3, 1142132400 - tz.transition 2006, 10, :o5, 1160884800 - tz.transition 2007, 3, :o3, 1173582000 - tz.transition 2007, 10, :o5, 1192334400 - tz.transition 2008, 3, :o3, 1206846000 - tz.transition 2008, 10, :o5, 1223784000 - tz.transition 2009, 3, :o3, 1237086000 - tz.transition 2009, 10, :o5, 1255233600 - tz.transition 2010, 3, :o3, 1268535600 - tz.transition 2010, 10, :o5, 1286683200 - tz.transition 2011, 3, :o3, 1299985200 - tz.transition 2011, 10, :o5, 1318132800 - tz.transition 2012, 3, :o3, 1331434800 - tz.transition 2012, 10, :o5, 1350187200 - tz.transition 2013, 3, :o3, 1362884400 - tz.transition 2013, 10, :o5, 1381636800 - tz.transition 2014, 3, :o3, 1394334000 - tz.transition 2014, 10, :o5, 1413086400 - tz.transition 2015, 3, :o3, 1426388400 - tz.transition 2015, 10, :o5, 1444536000 - tz.transition 2016, 3, :o3, 1457838000 - tz.transition 2016, 10, :o5, 1475985600 - tz.transition 2017, 3, :o3, 1489287600 - tz.transition 2017, 10, :o5, 1508040000 - tz.transition 2018, 3, :o3, 1520737200 - tz.transition 2018, 10, :o5, 1539489600 - tz.transition 2019, 3, :o3, 1552186800 - tz.transition 2019, 10, :o5, 1570939200 - tz.transition 2020, 3, :o3, 1584241200 - tz.transition 2020, 10, :o5, 1602388800 - tz.transition 2021, 3, :o3, 1615690800 - tz.transition 2021, 10, :o5, 1633838400 - tz.transition 2022, 3, :o3, 1647140400 - tz.transition 2022, 10, :o5, 1665288000 - tz.transition 2023, 3, :o3, 1678590000 - tz.transition 2023, 10, :o5, 1697342400 - tz.transition 2024, 3, :o3, 1710039600 - tz.transition 2024, 10, :o5, 1728792000 - tz.transition 2025, 3, :o3, 1741489200 - tz.transition 2025, 10, :o5, 1760241600 - tz.transition 2026, 3, :o3, 1773543600 - tz.transition 2026, 10, :o5, 1791691200 - tz.transition 2027, 3, :o3, 1804993200 - tz.transition 2027, 10, :o5, 1823140800 - tz.transition 2028, 3, :o3, 1836442800 - tz.transition 2028, 10, :o5, 1855195200 - tz.transition 2029, 3, :o3, 1867892400 - tz.transition 2029, 10, :o5, 1886644800 - tz.transition 2030, 3, :o3, 1899342000 - tz.transition 2030, 10, :o5, 1918094400 - tz.transition 2031, 3, :o3, 1930791600 - tz.transition 2031, 10, :o5, 1949544000 - tz.transition 2032, 3, :o3, 1962846000 - tz.transition 2032, 10, :o5, 1980993600 - tz.transition 2033, 3, :o3, 1994295600 - tz.transition 2033, 10, :o5, 2012443200 - tz.transition 2034, 3, :o3, 2025745200 - tz.transition 2034, 10, :o5, 2044497600 - tz.transition 2035, 3, :o3, 2057194800 - tz.transition 2035, 10, :o5, 2075947200 - tz.transition 2036, 3, :o3, 2088644400 - tz.transition 2036, 10, :o5, 2107396800 - tz.transition 2037, 3, :o3, 2120698800 - tz.transition 2037, 10, :o5, 2138846400 - tz.transition 2038, 3, :o3, 19723973, 8 - tz.transition 2038, 10, :o5, 7397120, 3 - tz.transition 2039, 3, :o3, 19726885, 8 - tz.transition 2039, 10, :o5, 7398212, 3 - tz.transition 2040, 3, :o3, 19729797, 8 - tz.transition 2040, 10, :o5, 7399325, 3 - tz.transition 2041, 3, :o3, 19732709, 8 - tz.transition 2041, 10, :o5, 7400417, 3 - tz.transition 2042, 3, :o3, 19735621, 8 - tz.transition 2042, 10, :o5, 7401509, 3 - tz.transition 2043, 3, :o3, 19738589, 8 - tz.transition 2043, 10, :o5, 7402601, 3 - tz.transition 2044, 3, :o3, 19741501, 8 - tz.transition 2044, 10, :o5, 7403693, 3 - tz.transition 2045, 3, :o3, 19744413, 8 - tz.transition 2045, 10, :o5, 7404806, 3 - tz.transition 2046, 3, :o3, 19747325, 8 - tz.transition 2046, 10, :o5, 7405898, 3 - tz.transition 2047, 3, :o3, 19750237, 8 - tz.transition 2047, 10, :o5, 7406990, 3 - tz.transition 2048, 3, :o3, 19753205, 8 - tz.transition 2048, 10, :o5, 7408082, 3 - tz.transition 2049, 3, :o3, 19756117, 8 - tz.transition 2049, 10, :o5, 7409174, 3 - tz.transition 2050, 3, :o3, 19759029, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb deleted file mode 100644 index 0524f81c04..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Sao_Paulo - include TimezoneDefinition - - timezone 'America/Sao_Paulo' do |tz| - tz.offset :o0, -11188, 0, :LMT - tz.offset :o1, -10800, 0, :BRT - tz.offset :o2, -10800, 3600, :BRST - - tz.transition 1914, 1, :o1, 52274886397, 21600 - tz.transition 1931, 10, :o2, 29119417, 12 - tz.transition 1932, 4, :o1, 29121583, 12 - tz.transition 1932, 10, :o2, 19415869, 8 - tz.transition 1933, 4, :o1, 29125963, 12 - tz.transition 1949, 12, :o2, 19466013, 8 - tz.transition 1950, 4, :o1, 19467101, 8 - tz.transition 1950, 12, :o2, 19468933, 8 - tz.transition 1951, 4, :o1, 29204851, 12 - tz.transition 1951, 12, :o2, 19471853, 8 - tz.transition 1952, 4, :o1, 29209243, 12 - tz.transition 1952, 12, :o2, 19474781, 8 - tz.transition 1953, 3, :o1, 29213251, 12 - tz.transition 1963, 10, :o2, 19506605, 8 - tz.transition 1964, 3, :o1, 29261467, 12 - tz.transition 1965, 1, :o2, 19510333, 8 - tz.transition 1965, 3, :o1, 29266207, 12 - tz.transition 1965, 12, :o2, 19512765, 8 - tz.transition 1966, 3, :o1, 29270227, 12 - tz.transition 1966, 11, :o2, 19515445, 8 - tz.transition 1967, 3, :o1, 29274607, 12 - tz.transition 1967, 11, :o2, 19518365, 8 - tz.transition 1968, 3, :o1, 29278999, 12 - tz.transition 1985, 11, :o2, 499748400 - tz.transition 1986, 3, :o1, 511236000 - tz.transition 1986, 10, :o2, 530593200 - tz.transition 1987, 2, :o1, 540266400 - tz.transition 1987, 10, :o2, 562129200 - tz.transition 1988, 2, :o1, 571197600 - tz.transition 1988, 10, :o2, 592974000 - tz.transition 1989, 1, :o1, 602042400 - tz.transition 1989, 10, :o2, 624423600 - tz.transition 1990, 2, :o1, 634701600 - tz.transition 1990, 10, :o2, 656478000 - tz.transition 1991, 2, :o1, 666756000 - tz.transition 1991, 10, :o2, 687927600 - tz.transition 1992, 2, :o1, 697600800 - tz.transition 1992, 10, :o2, 719982000 - tz.transition 1993, 1, :o1, 728445600 - tz.transition 1993, 10, :o2, 750826800 - tz.transition 1994, 2, :o1, 761709600 - tz.transition 1994, 10, :o2, 782276400 - tz.transition 1995, 2, :o1, 793159200 - tz.transition 1995, 10, :o2, 813726000 - tz.transition 1996, 2, :o1, 824004000 - tz.transition 1996, 10, :o2, 844570800 - tz.transition 1997, 2, :o1, 856058400 - tz.transition 1997, 10, :o2, 876106800 - tz.transition 1998, 3, :o1, 888717600 - tz.transition 1998, 10, :o2, 908074800 - tz.transition 1999, 2, :o1, 919562400 - tz.transition 1999, 10, :o2, 938919600 - tz.transition 2000, 2, :o1, 951616800 - tz.transition 2000, 10, :o2, 970974000 - tz.transition 2001, 2, :o1, 982461600 - tz.transition 2001, 10, :o2, 1003028400 - tz.transition 2002, 2, :o1, 1013911200 - tz.transition 2002, 11, :o2, 1036292400 - tz.transition 2003, 2, :o1, 1045360800 - tz.transition 2003, 10, :o2, 1066532400 - tz.transition 2004, 2, :o1, 1076810400 - tz.transition 2004, 11, :o2, 1099364400 - tz.transition 2005, 2, :o1, 1108864800 - tz.transition 2005, 10, :o2, 1129431600 - tz.transition 2006, 2, :o1, 1140314400 - tz.transition 2006, 11, :o2, 1162695600 - tz.transition 2007, 2, :o1, 1172368800 - tz.transition 2007, 10, :o2, 1192330800 - tz.transition 2008, 2, :o1, 1203213600 - tz.transition 2008, 10, :o2, 1224385200 - tz.transition 2009, 2, :o1, 1234663200 - tz.transition 2009, 10, :o2, 1255834800 - tz.transition 2010, 2, :o1, 1266717600 - tz.transition 2010, 10, :o2, 1287284400 - tz.transition 2011, 2, :o1, 1298167200 - tz.transition 2011, 10, :o2, 1318734000 - tz.transition 2012, 2, :o1, 1330221600 - tz.transition 2012, 10, :o2, 1350788400 - tz.transition 2013, 2, :o1, 1361066400 - tz.transition 2013, 10, :o2, 1382238000 - tz.transition 2014, 2, :o1, 1392516000 - tz.transition 2014, 10, :o2, 1413687600 - tz.transition 2015, 2, :o1, 1424570400 - tz.transition 2015, 10, :o2, 1445137200 - tz.transition 2016, 2, :o1, 1456020000 - tz.transition 2016, 10, :o2, 1476586800 - tz.transition 2017, 2, :o1, 1487469600 - tz.transition 2017, 10, :o2, 1508036400 - tz.transition 2018, 2, :o1, 1518919200 - tz.transition 2018, 10, :o2, 1540090800 - tz.transition 2019, 2, :o1, 1550368800 - tz.transition 2019, 10, :o2, 1571540400 - tz.transition 2020, 2, :o1, 1581818400 - tz.transition 2020, 10, :o2, 1602990000 - tz.transition 2021, 2, :o1, 1613872800 - tz.transition 2021, 10, :o2, 1634439600 - tz.transition 2022, 2, :o1, 1645322400 - tz.transition 2022, 10, :o2, 1665889200 - tz.transition 2023, 2, :o1, 1677376800 - tz.transition 2023, 10, :o2, 1697338800 - tz.transition 2024, 2, :o1, 1708221600 - tz.transition 2024, 10, :o2, 1729393200 - tz.transition 2025, 2, :o1, 1739671200 - tz.transition 2025, 10, :o2, 1760842800 - tz.transition 2026, 2, :o1, 1771725600 - tz.transition 2026, 10, :o2, 1792292400 - tz.transition 2027, 2, :o1, 1803175200 - tz.transition 2027, 10, :o2, 1823742000 - tz.transition 2028, 2, :o1, 1834624800 - tz.transition 2028, 10, :o2, 1855191600 - tz.transition 2029, 2, :o1, 1866074400 - tz.transition 2029, 10, :o2, 1887246000 - tz.transition 2030, 2, :o1, 1897524000 - tz.transition 2030, 10, :o2, 1918695600 - tz.transition 2031, 2, :o1, 1928973600 - tz.transition 2031, 10, :o2, 1950145200 - tz.transition 2032, 2, :o1, 1960423200 - tz.transition 2032, 10, :o2, 1981594800 - tz.transition 2033, 2, :o1, 1992477600 - tz.transition 2033, 10, :o2, 2013044400 - tz.transition 2034, 2, :o1, 2024532000 - tz.transition 2034, 10, :o2, 2044494000 - tz.transition 2035, 2, :o1, 2055376800 - tz.transition 2035, 10, :o2, 2076548400 - tz.transition 2036, 2, :o1, 2086826400 - tz.transition 2036, 10, :o2, 2107998000 - tz.transition 2037, 2, :o1, 2118880800 - tz.transition 2037, 10, :o2, 2139447600 - tz.transition 2038, 2, :o1, 29585707, 12 - tz.transition 2038, 10, :o2, 19725709, 8 - tz.transition 2039, 2, :o1, 29590075, 12 - tz.transition 2039, 10, :o2, 19728621, 8 - tz.transition 2040, 2, :o1, 29594443, 12 - tz.transition 2040, 10, :o2, 19731589, 8 - tz.transition 2041, 2, :o1, 29598811, 12 - tz.transition 2041, 10, :o2, 19734501, 8 - tz.transition 2042, 2, :o1, 29603179, 12 - tz.transition 2042, 10, :o2, 19737413, 8 - tz.transition 2043, 2, :o1, 29607547, 12 - tz.transition 2043, 10, :o2, 19740325, 8 - tz.transition 2044, 2, :o1, 29611999, 12 - tz.transition 2044, 10, :o2, 19743237, 8 - tz.transition 2045, 2, :o1, 29616367, 12 - tz.transition 2045, 10, :o2, 19746149, 8 - tz.transition 2046, 2, :o1, 29620735, 12 - tz.transition 2046, 10, :o2, 19749117, 8 - tz.transition 2047, 2, :o1, 29625103, 12 - tz.transition 2047, 10, :o2, 19752029, 8 - tz.transition 2048, 2, :o1, 29629471, 12 - tz.transition 2048, 10, :o2, 19754941, 8 - tz.transition 2049, 2, :o1, 29633923, 12 - tz.transition 2049, 10, :o2, 19757853, 8 - tz.transition 2050, 2, :o1, 29638291, 12 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb deleted file mode 100644 index e4a3599d35..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb +++ /dev/null @@ -1,288 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module St_Johns - include TimezoneDefinition - - timezone 'America/St_Johns' do |tz| - tz.offset :o0, -12652, 0, :LMT - tz.offset :o1, -12652, 0, :NST - tz.offset :o2, -12652, 3600, :NDT - tz.offset :o3, -12600, 0, :NST - tz.offset :o4, -12600, 3600, :NDT - tz.offset :o5, -12600, 3600, :NWT - tz.offset :o6, -12600, 3600, :NPT - tz.offset :o7, -12600, 7200, :NDDT - - tz.transition 1884, 1, :o1, 52038215563, 21600 - tz.transition 1917, 4, :o2, 52300657363, 21600 - tz.transition 1917, 9, :o1, 52304155663, 21600 - tz.transition 1918, 4, :o2, 52308670963, 21600 - tz.transition 1918, 10, :o1, 52312990063, 21600 - tz.transition 1919, 5, :o2, 52317027463, 21600 - tz.transition 1919, 8, :o1, 52319164963, 21600 - tz.transition 1920, 5, :o2, 52324868263, 21600 - tz.transition 1920, 11, :o1, 52328798563, 21600 - tz.transition 1921, 5, :o2, 52332730663, 21600 - tz.transition 1921, 10, :o1, 52336660963, 21600 - tz.transition 1922, 5, :o2, 52340744263, 21600 - tz.transition 1922, 10, :o1, 52344523363, 21600 - tz.transition 1923, 5, :o2, 52348606663, 21600 - tz.transition 1923, 10, :o1, 52352385763, 21600 - tz.transition 1924, 5, :o2, 52356469063, 21600 - tz.transition 1924, 10, :o1, 52360248163, 21600 - tz.transition 1925, 5, :o2, 52364331463, 21600 - tz.transition 1925, 10, :o1, 52368110563, 21600 - tz.transition 1926, 5, :o2, 52372193863, 21600 - tz.transition 1926, 11, :o1, 52376124163, 21600 - tz.transition 1927, 5, :o2, 52380056263, 21600 - tz.transition 1927, 10, :o1, 52383986563, 21600 - tz.transition 1928, 5, :o2, 52388069863, 21600 - tz.transition 1928, 10, :o1, 52391848963, 21600 - tz.transition 1929, 5, :o2, 52395932263, 21600 - tz.transition 1929, 10, :o1, 52399711363, 21600 - tz.transition 1930, 5, :o2, 52403794663, 21600 - tz.transition 1930, 10, :o1, 52407573763, 21600 - tz.transition 1931, 5, :o2, 52411657063, 21600 - tz.transition 1931, 10, :o1, 52415436163, 21600 - tz.transition 1932, 5, :o2, 52419519463, 21600 - tz.transition 1932, 10, :o1, 52423449763, 21600 - tz.transition 1933, 5, :o2, 52427533063, 21600 - tz.transition 1933, 10, :o1, 52431312163, 21600 - tz.transition 1934, 5, :o2, 52435395463, 21600 - tz.transition 1934, 10, :o1, 52439174563, 21600 - tz.transition 1935, 3, :o3, 52442459563, 21600 - tz.transition 1935, 5, :o4, 116540573, 48 - tz.transition 1935, 10, :o3, 38849657, 16 - tz.transition 1936, 5, :o4, 116558383, 48 - tz.transition 1936, 10, :o3, 116565437, 48 - tz.transition 1937, 5, :o4, 116575855, 48 - tz.transition 1937, 10, :o3, 116582909, 48 - tz.transition 1938, 5, :o4, 116593327, 48 - tz.transition 1938, 10, :o3, 116600381, 48 - tz.transition 1939, 5, :o4, 116611135, 48 - tz.transition 1939, 10, :o3, 116617853, 48 - tz.transition 1940, 5, :o4, 116628607, 48 - tz.transition 1940, 10, :o3, 116635661, 48 - tz.transition 1941, 5, :o4, 116646079, 48 - tz.transition 1941, 10, :o3, 116653133, 48 - tz.transition 1942, 5, :o5, 116663551, 48 - tz.transition 1945, 8, :o6, 58360379, 24 - tz.transition 1945, 9, :o3, 38907659, 16 - tz.transition 1946, 5, :o4, 116733731, 48 - tz.transition 1946, 10, :o3, 38913595, 16 - tz.transition 1947, 5, :o4, 116751203, 48 - tz.transition 1947, 10, :o3, 38919419, 16 - tz.transition 1948, 5, :o4, 116768675, 48 - tz.transition 1948, 10, :o3, 38925243, 16 - tz.transition 1949, 5, :o4, 116786147, 48 - tz.transition 1949, 10, :o3, 38931067, 16 - tz.transition 1950, 5, :o4, 116803955, 48 - tz.transition 1950, 10, :o3, 38937003, 16 - tz.transition 1951, 4, :o4, 116820755, 48 - tz.transition 1951, 9, :o3, 38942715, 16 - tz.transition 1952, 4, :o4, 116838227, 48 - tz.transition 1952, 9, :o3, 38948539, 16 - tz.transition 1953, 4, :o4, 116855699, 48 - tz.transition 1953, 9, :o3, 38954363, 16 - tz.transition 1954, 4, :o4, 116873171, 48 - tz.transition 1954, 9, :o3, 38960187, 16 - tz.transition 1955, 4, :o4, 116890643, 48 - tz.transition 1955, 9, :o3, 38966011, 16 - tz.transition 1956, 4, :o4, 116908451, 48 - tz.transition 1956, 9, :o3, 38971947, 16 - tz.transition 1957, 4, :o4, 116925923, 48 - tz.transition 1957, 9, :o3, 38977771, 16 - tz.transition 1958, 4, :o4, 116943395, 48 - tz.transition 1958, 9, :o3, 38983595, 16 - tz.transition 1959, 4, :o4, 116960867, 48 - tz.transition 1959, 9, :o3, 38989419, 16 - tz.transition 1960, 4, :o4, 116978339, 48 - tz.transition 1960, 10, :o3, 38995803, 16 - tz.transition 1961, 4, :o4, 116996147, 48 - tz.transition 1961, 10, :o3, 39001627, 16 - tz.transition 1962, 4, :o4, 117013619, 48 - tz.transition 1962, 10, :o3, 39007451, 16 - tz.transition 1963, 4, :o4, 117031091, 48 - tz.transition 1963, 10, :o3, 39013275, 16 - tz.transition 1964, 4, :o4, 117048563, 48 - tz.transition 1964, 10, :o3, 39019099, 16 - tz.transition 1965, 4, :o4, 117066035, 48 - tz.transition 1965, 10, :o3, 39025035, 16 - tz.transition 1966, 4, :o4, 117083507, 48 - tz.transition 1966, 10, :o3, 39030859, 16 - tz.transition 1967, 4, :o4, 117101315, 48 - tz.transition 1967, 10, :o3, 39036683, 16 - tz.transition 1968, 4, :o4, 117118787, 48 - tz.transition 1968, 10, :o3, 39042507, 16 - tz.transition 1969, 4, :o4, 117136259, 48 - tz.transition 1969, 10, :o3, 39048331, 16 - tz.transition 1970, 4, :o4, 9955800 - tz.transition 1970, 10, :o3, 25677000 - tz.transition 1971, 4, :o4, 41405400 - tz.transition 1971, 10, :o3, 57731400 - tz.transition 1972, 4, :o4, 73459800 - tz.transition 1972, 10, :o3, 89181000 - tz.transition 1973, 4, :o4, 104909400 - tz.transition 1973, 10, :o3, 120630600 - tz.transition 1974, 4, :o4, 136359000 - tz.transition 1974, 10, :o3, 152080200 - tz.transition 1975, 4, :o4, 167808600 - tz.transition 1975, 10, :o3, 183529800 - tz.transition 1976, 4, :o4, 199258200 - tz.transition 1976, 10, :o3, 215584200 - tz.transition 1977, 4, :o4, 230707800 - tz.transition 1977, 10, :o3, 247033800 - tz.transition 1978, 4, :o4, 262762200 - tz.transition 1978, 10, :o3, 278483400 - tz.transition 1979, 4, :o4, 294211800 - tz.transition 1979, 10, :o3, 309933000 - tz.transition 1980, 4, :o4, 325661400 - tz.transition 1980, 10, :o3, 341382600 - tz.transition 1981, 4, :o4, 357111000 - tz.transition 1981, 10, :o3, 372832200 - tz.transition 1982, 4, :o4, 388560600 - tz.transition 1982, 10, :o3, 404886600 - tz.transition 1983, 4, :o4, 420010200 - tz.transition 1983, 10, :o3, 436336200 - tz.transition 1984, 4, :o4, 452064600 - tz.transition 1984, 10, :o3, 467785800 - tz.transition 1985, 4, :o4, 483514200 - tz.transition 1985, 10, :o3, 499235400 - tz.transition 1986, 4, :o4, 514963800 - tz.transition 1986, 10, :o3, 530685000 - tz.transition 1987, 4, :o4, 544591860 - tz.transition 1987, 10, :o3, 562127460 - tz.transition 1988, 4, :o7, 576041460 - tz.transition 1988, 10, :o3, 594178260 - tz.transition 1989, 4, :o4, 607491060 - tz.transition 1989, 10, :o3, 625631460 - tz.transition 1990, 4, :o4, 638940660 - tz.transition 1990, 10, :o3, 657081060 - tz.transition 1991, 4, :o4, 670995060 - tz.transition 1991, 10, :o3, 688530660 - tz.transition 1992, 4, :o4, 702444660 - tz.transition 1992, 10, :o3, 719980260 - tz.transition 1993, 4, :o4, 733894260 - tz.transition 1993, 10, :o3, 752034660 - tz.transition 1994, 4, :o4, 765343860 - tz.transition 1994, 10, :o3, 783484260 - tz.transition 1995, 4, :o4, 796793460 - tz.transition 1995, 10, :o3, 814933860 - tz.transition 1996, 4, :o4, 828847860 - tz.transition 1996, 10, :o3, 846383460 - tz.transition 1997, 4, :o4, 860297460 - tz.transition 1997, 10, :o3, 877833060 - tz.transition 1998, 4, :o4, 891747060 - tz.transition 1998, 10, :o3, 909282660 - tz.transition 1999, 4, :o4, 923196660 - tz.transition 1999, 10, :o3, 941337060 - tz.transition 2000, 4, :o4, 954646260 - tz.transition 2000, 10, :o3, 972786660 - tz.transition 2001, 4, :o4, 986095860 - tz.transition 2001, 10, :o3, 1004236260 - tz.transition 2002, 4, :o4, 1018150260 - tz.transition 2002, 10, :o3, 1035685860 - tz.transition 2003, 4, :o4, 1049599860 - tz.transition 2003, 10, :o3, 1067135460 - tz.transition 2004, 4, :o4, 1081049460 - tz.transition 2004, 10, :o3, 1099189860 - tz.transition 2005, 4, :o4, 1112499060 - tz.transition 2005, 10, :o3, 1130639460 - tz.transition 2006, 4, :o4, 1143948660 - tz.transition 2006, 10, :o3, 1162089060 - tz.transition 2007, 3, :o4, 1173583860 - tz.transition 2007, 11, :o3, 1194143460 - tz.transition 2008, 3, :o4, 1205033460 - tz.transition 2008, 11, :o3, 1225593060 - tz.transition 2009, 3, :o4, 1236483060 - tz.transition 2009, 11, :o3, 1257042660 - tz.transition 2010, 3, :o4, 1268537460 - tz.transition 2010, 11, :o3, 1289097060 - tz.transition 2011, 3, :o4, 1299987060 - tz.transition 2011, 11, :o3, 1320546660 - tz.transition 2012, 3, :o4, 1331436660 - tz.transition 2012, 11, :o3, 1351996260 - tz.transition 2013, 3, :o4, 1362886260 - tz.transition 2013, 11, :o3, 1383445860 - tz.transition 2014, 3, :o4, 1394335860 - tz.transition 2014, 11, :o3, 1414895460 - tz.transition 2015, 3, :o4, 1425785460 - tz.transition 2015, 11, :o3, 1446345060 - tz.transition 2016, 3, :o4, 1457839860 - tz.transition 2016, 11, :o3, 1478399460 - tz.transition 2017, 3, :o4, 1489289460 - tz.transition 2017, 11, :o3, 1509849060 - tz.transition 2018, 3, :o4, 1520739060 - tz.transition 2018, 11, :o3, 1541298660 - tz.transition 2019, 3, :o4, 1552188660 - tz.transition 2019, 11, :o3, 1572748260 - tz.transition 2020, 3, :o4, 1583638260 - tz.transition 2020, 11, :o3, 1604197860 - tz.transition 2021, 3, :o4, 1615692660 - tz.transition 2021, 11, :o3, 1636252260 - tz.transition 2022, 3, :o4, 1647142260 - tz.transition 2022, 11, :o3, 1667701860 - tz.transition 2023, 3, :o4, 1678591860 - tz.transition 2023, 11, :o3, 1699151460 - tz.transition 2024, 3, :o4, 1710041460 - tz.transition 2024, 11, :o3, 1730601060 - tz.transition 2025, 3, :o4, 1741491060 - tz.transition 2025, 11, :o3, 1762050660 - tz.transition 2026, 3, :o4, 1772940660 - tz.transition 2026, 11, :o3, 1793500260 - tz.transition 2027, 3, :o4, 1804995060 - tz.transition 2027, 11, :o3, 1825554660 - tz.transition 2028, 3, :o4, 1836444660 - tz.transition 2028, 11, :o3, 1857004260 - tz.transition 2029, 3, :o4, 1867894260 - tz.transition 2029, 11, :o3, 1888453860 - tz.transition 2030, 3, :o4, 1899343860 - tz.transition 2030, 11, :o3, 1919903460 - tz.transition 2031, 3, :o4, 1930793460 - tz.transition 2031, 11, :o3, 1951353060 - tz.transition 2032, 3, :o4, 1962847860 - tz.transition 2032, 11, :o3, 1983407460 - tz.transition 2033, 3, :o4, 1994297460 - tz.transition 2033, 11, :o3, 2014857060 - tz.transition 2034, 3, :o4, 2025747060 - tz.transition 2034, 11, :o3, 2046306660 - tz.transition 2035, 3, :o4, 2057196660 - tz.transition 2035, 11, :o3, 2077756260 - tz.transition 2036, 3, :o4, 2088646260 - tz.transition 2036, 11, :o3, 2109205860 - tz.transition 2037, 3, :o4, 2120095860 - tz.transition 2037, 11, :o3, 2140655460 - tz.transition 2038, 3, :o4, 3550315171, 1440 - tz.transition 2038, 11, :o3, 3550657831, 1440 - tz.transition 2039, 3, :o4, 3550839331, 1440 - tz.transition 2039, 11, :o3, 3551181991, 1440 - tz.transition 2040, 3, :o4, 3551363491, 1440 - tz.transition 2040, 11, :o3, 3551706151, 1440 - tz.transition 2041, 3, :o4, 3551887651, 1440 - tz.transition 2041, 11, :o3, 3552230311, 1440 - tz.transition 2042, 3, :o4, 3552411811, 1440 - tz.transition 2042, 11, :o3, 3552754471, 1440 - tz.transition 2043, 3, :o4, 3552935971, 1440 - tz.transition 2043, 11, :o3, 3553278631, 1440 - tz.transition 2044, 3, :o4, 3553470211, 1440 - tz.transition 2044, 11, :o3, 3553812871, 1440 - tz.transition 2045, 3, :o4, 3553994371, 1440 - tz.transition 2045, 11, :o3, 3554337031, 1440 - tz.transition 2046, 3, :o4, 3554518531, 1440 - tz.transition 2046, 11, :o3, 3554861191, 1440 - tz.transition 2047, 3, :o4, 3555042691, 1440 - tz.transition 2047, 11, :o3, 3555385351, 1440 - tz.transition 2048, 3, :o4, 3555566851, 1440 - tz.transition 2048, 11, :o3, 3555909511, 1440 - tz.transition 2049, 3, :o4, 3556101091, 1440 - tz.transition 2049, 11, :o3, 3556443751, 1440 - tz.transition 2050, 3, :o4, 3556625251, 1440 - tz.transition 2050, 11, :o3, 3556967911, 1440 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb deleted file mode 100644 index 423059da46..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb +++ /dev/null @@ -1,196 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Tijuana - include TimezoneDefinition - - timezone 'America/Tijuana' do |tz| - tz.offset :o0, -28084, 0, :LMT - tz.offset :o1, -25200, 0, :MST - tz.offset :o2, -28800, 0, :PST - tz.offset :o3, -28800, 3600, :PDT - tz.offset :o4, -28800, 3600, :PWT - tz.offset :o5, -28800, 3600, :PPT - - tz.transition 1922, 1, :o1, 14538335, 6 - tz.transition 1924, 1, :o2, 58170859, 24 - tz.transition 1927, 6, :o1, 58201027, 24 - tz.transition 1930, 11, :o2, 58231099, 24 - tz.transition 1931, 4, :o3, 14558597, 6 - tz.transition 1931, 9, :o2, 58238755, 24 - tz.transition 1942, 4, :o4, 14582843, 6 - tz.transition 1945, 8, :o5, 58360379, 24 - tz.transition 1945, 11, :o2, 58362523, 24 - tz.transition 1948, 4, :o3, 14595881, 6 - tz.transition 1949, 1, :o2, 58390339, 24 - tz.transition 1954, 4, :o3, 29218295, 12 - tz.transition 1954, 9, :o2, 19480095, 8 - tz.transition 1955, 4, :o3, 29222663, 12 - tz.transition 1955, 9, :o2, 19483007, 8 - tz.transition 1956, 4, :o3, 29227115, 12 - tz.transition 1956, 9, :o2, 19485975, 8 - tz.transition 1957, 4, :o3, 29231483, 12 - tz.transition 1957, 9, :o2, 19488887, 8 - tz.transition 1958, 4, :o3, 29235851, 12 - tz.transition 1958, 9, :o2, 19491799, 8 - tz.transition 1959, 4, :o3, 29240219, 12 - tz.transition 1959, 9, :o2, 19494711, 8 - tz.transition 1960, 4, :o3, 29244587, 12 - tz.transition 1960, 9, :o2, 19497623, 8 - tz.transition 1976, 4, :o3, 199274400 - tz.transition 1976, 10, :o2, 215600400 - tz.transition 1977, 4, :o3, 230724000 - tz.transition 1977, 10, :o2, 247050000 - tz.transition 1978, 4, :o3, 262778400 - tz.transition 1978, 10, :o2, 278499600 - tz.transition 1979, 4, :o3, 294228000 - tz.transition 1979, 10, :o2, 309949200 - tz.transition 1980, 4, :o3, 325677600 - tz.transition 1980, 10, :o2, 341398800 - tz.transition 1981, 4, :o3, 357127200 - tz.transition 1981, 10, :o2, 372848400 - tz.transition 1982, 4, :o3, 388576800 - tz.transition 1982, 10, :o2, 404902800 - tz.transition 1983, 4, :o3, 420026400 - tz.transition 1983, 10, :o2, 436352400 - tz.transition 1984, 4, :o3, 452080800 - tz.transition 1984, 10, :o2, 467802000 - tz.transition 1985, 4, :o3, 483530400 - tz.transition 1985, 10, :o2, 499251600 - tz.transition 1986, 4, :o3, 514980000 - tz.transition 1986, 10, :o2, 530701200 - tz.transition 1987, 4, :o3, 544615200 - tz.transition 1987, 10, :o2, 562150800 - tz.transition 1988, 4, :o3, 576064800 - tz.transition 1988, 10, :o2, 594205200 - tz.transition 1989, 4, :o3, 607514400 - tz.transition 1989, 10, :o2, 625654800 - tz.transition 1990, 4, :o3, 638964000 - tz.transition 1990, 10, :o2, 657104400 - tz.transition 1991, 4, :o3, 671018400 - tz.transition 1991, 10, :o2, 688554000 - tz.transition 1992, 4, :o3, 702468000 - tz.transition 1992, 10, :o2, 720003600 - tz.transition 1993, 4, :o3, 733917600 - tz.transition 1993, 10, :o2, 752058000 - tz.transition 1994, 4, :o3, 765367200 - tz.transition 1994, 10, :o2, 783507600 - tz.transition 1995, 4, :o3, 796816800 - tz.transition 1995, 10, :o2, 814957200 - tz.transition 1996, 4, :o3, 828871200 - tz.transition 1996, 10, :o2, 846406800 - tz.transition 1997, 4, :o3, 860320800 - tz.transition 1997, 10, :o2, 877856400 - tz.transition 1998, 4, :o3, 891770400 - tz.transition 1998, 10, :o2, 909306000 - tz.transition 1999, 4, :o3, 923220000 - tz.transition 1999, 10, :o2, 941360400 - tz.transition 2000, 4, :o3, 954669600 - tz.transition 2000, 10, :o2, 972810000 - tz.transition 2001, 4, :o3, 986119200 - tz.transition 2001, 10, :o2, 1004259600 - tz.transition 2002, 4, :o3, 1018173600 - tz.transition 2002, 10, :o2, 1035709200 - tz.transition 2003, 4, :o3, 1049623200 - tz.transition 2003, 10, :o2, 1067158800 - tz.transition 2004, 4, :o3, 1081072800 - tz.transition 2004, 10, :o2, 1099213200 - tz.transition 2005, 4, :o3, 1112522400 - tz.transition 2005, 10, :o2, 1130662800 - tz.transition 2006, 4, :o3, 1143972000 - tz.transition 2006, 10, :o2, 1162112400 - tz.transition 2007, 4, :o3, 1175421600 - tz.transition 2007, 10, :o2, 1193562000 - tz.transition 2008, 4, :o3, 1207476000 - tz.transition 2008, 10, :o2, 1225011600 - tz.transition 2009, 4, :o3, 1238925600 - tz.transition 2009, 10, :o2, 1256461200 - tz.transition 2010, 4, :o3, 1270375200 - tz.transition 2010, 10, :o2, 1288515600 - tz.transition 2011, 4, :o3, 1301824800 - tz.transition 2011, 10, :o2, 1319965200 - tz.transition 2012, 4, :o3, 1333274400 - tz.transition 2012, 10, :o2, 1351414800 - tz.transition 2013, 4, :o3, 1365328800 - tz.transition 2013, 10, :o2, 1382864400 - tz.transition 2014, 4, :o3, 1396778400 - tz.transition 2014, 10, :o2, 1414314000 - tz.transition 2015, 4, :o3, 1428228000 - tz.transition 2015, 10, :o2, 1445763600 - tz.transition 2016, 4, :o3, 1459677600 - tz.transition 2016, 10, :o2, 1477818000 - tz.transition 2017, 4, :o3, 1491127200 - tz.transition 2017, 10, :o2, 1509267600 - tz.transition 2018, 4, :o3, 1522576800 - tz.transition 2018, 10, :o2, 1540717200 - tz.transition 2019, 4, :o3, 1554631200 - tz.transition 2019, 10, :o2, 1572166800 - tz.transition 2020, 4, :o3, 1586080800 - tz.transition 2020, 10, :o2, 1603616400 - tz.transition 2021, 4, :o3, 1617530400 - tz.transition 2021, 10, :o2, 1635670800 - tz.transition 2022, 4, :o3, 1648980000 - tz.transition 2022, 10, :o2, 1667120400 - tz.transition 2023, 4, :o3, 1680429600 - tz.transition 2023, 10, :o2, 1698570000 - tz.transition 2024, 4, :o3, 1712484000 - tz.transition 2024, 10, :o2, 1730019600 - tz.transition 2025, 4, :o3, 1743933600 - tz.transition 2025, 10, :o2, 1761469200 - tz.transition 2026, 4, :o3, 1775383200 - tz.transition 2026, 10, :o2, 1792918800 - tz.transition 2027, 4, :o3, 1806832800 - tz.transition 2027, 10, :o2, 1824973200 - tz.transition 2028, 4, :o3, 1838282400 - tz.transition 2028, 10, :o2, 1856422800 - tz.transition 2029, 4, :o3, 1869732000 - tz.transition 2029, 10, :o2, 1887872400 - tz.transition 2030, 4, :o3, 1901786400 - tz.transition 2030, 10, :o2, 1919322000 - tz.transition 2031, 4, :o3, 1933236000 - tz.transition 2031, 10, :o2, 1950771600 - tz.transition 2032, 4, :o3, 1964685600 - tz.transition 2032, 10, :o2, 1982826000 - tz.transition 2033, 4, :o3, 1996135200 - tz.transition 2033, 10, :o2, 2014275600 - tz.transition 2034, 4, :o3, 2027584800 - tz.transition 2034, 10, :o2, 2045725200 - tz.transition 2035, 4, :o3, 2059034400 - tz.transition 2035, 10, :o2, 2077174800 - tz.transition 2036, 4, :o3, 2091088800 - tz.transition 2036, 10, :o2, 2108624400 - tz.transition 2037, 4, :o3, 2122538400 - tz.transition 2037, 10, :o2, 2140074000 - tz.transition 2038, 4, :o3, 29586215, 12 - tz.transition 2038, 10, :o2, 19725823, 8 - tz.transition 2039, 4, :o3, 29590583, 12 - tz.transition 2039, 10, :o2, 19728735, 8 - tz.transition 2040, 4, :o3, 29594951, 12 - tz.transition 2040, 10, :o2, 19731647, 8 - tz.transition 2041, 4, :o3, 29599403, 12 - tz.transition 2041, 10, :o2, 19734559, 8 - tz.transition 2042, 4, :o3, 29603771, 12 - tz.transition 2042, 10, :o2, 19737471, 8 - tz.transition 2043, 4, :o3, 29608139, 12 - tz.transition 2043, 10, :o2, 19740383, 8 - tz.transition 2044, 4, :o3, 29612507, 12 - tz.transition 2044, 10, :o2, 19743351, 8 - tz.transition 2045, 4, :o3, 29616875, 12 - tz.transition 2045, 10, :o2, 19746263, 8 - tz.transition 2046, 4, :o3, 29621243, 12 - tz.transition 2046, 10, :o2, 19749175, 8 - tz.transition 2047, 4, :o3, 29625695, 12 - tz.transition 2047, 10, :o2, 19752087, 8 - tz.transition 2048, 4, :o3, 29630063, 12 - tz.transition 2048, 10, :o2, 19754999, 8 - tz.transition 2049, 4, :o3, 29634431, 12 - tz.transition 2049, 10, :o2, 19757967, 8 - tz.transition 2050, 4, :o3, 29638799, 12 - tz.transition 2050, 10, :o2, 19760879, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb deleted file mode 100644 index 9ee18970f1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Almaty - include TimezoneDefinition - - timezone 'Asia/Almaty' do |tz| - tz.offset :o0, 18468, 0, :LMT - tz.offset :o1, 18000, 0, :ALMT - tz.offset :o2, 21600, 0, :ALMT - tz.offset :o3, 21600, 3600, :ALMST - - tz.transition 1924, 5, :o1, 1939125829, 800 - tz.transition 1930, 6, :o2, 58227559, 24 - tz.transition 1981, 3, :o3, 354909600 - tz.transition 1981, 9, :o2, 370717200 - tz.transition 1982, 3, :o3, 386445600 - tz.transition 1982, 9, :o2, 402253200 - tz.transition 1983, 3, :o3, 417981600 - tz.transition 1983, 9, :o2, 433789200 - tz.transition 1984, 3, :o3, 449604000 - tz.transition 1984, 9, :o2, 465336000 - tz.transition 1985, 3, :o3, 481060800 - tz.transition 1985, 9, :o2, 496785600 - tz.transition 1986, 3, :o3, 512510400 - tz.transition 1986, 9, :o2, 528235200 - tz.transition 1987, 3, :o3, 543960000 - tz.transition 1987, 9, :o2, 559684800 - tz.transition 1988, 3, :o3, 575409600 - tz.transition 1988, 9, :o2, 591134400 - tz.transition 1989, 3, :o3, 606859200 - tz.transition 1989, 9, :o2, 622584000 - tz.transition 1990, 3, :o3, 638308800 - tz.transition 1990, 9, :o2, 654638400 - tz.transition 1992, 3, :o3, 701802000 - tz.transition 1992, 9, :o2, 717523200 - tz.transition 1993, 3, :o3, 733262400 - tz.transition 1993, 9, :o2, 748987200 - tz.transition 1994, 3, :o3, 764712000 - tz.transition 1994, 9, :o2, 780436800 - tz.transition 1995, 3, :o3, 796161600 - tz.transition 1995, 9, :o2, 811886400 - tz.transition 1996, 3, :o3, 828216000 - tz.transition 1996, 10, :o2, 846360000 - tz.transition 1997, 3, :o3, 859665600 - tz.transition 1997, 10, :o2, 877809600 - tz.transition 1998, 3, :o3, 891115200 - tz.transition 1998, 10, :o2, 909259200 - tz.transition 1999, 3, :o3, 922564800 - tz.transition 1999, 10, :o2, 941313600 - tz.transition 2000, 3, :o3, 954014400 - tz.transition 2000, 10, :o2, 972763200 - tz.transition 2001, 3, :o3, 985464000 - tz.transition 2001, 10, :o2, 1004212800 - tz.transition 2002, 3, :o3, 1017518400 - tz.transition 2002, 10, :o2, 1035662400 - tz.transition 2003, 3, :o3, 1048968000 - tz.transition 2003, 10, :o2, 1067112000 - tz.transition 2004, 3, :o3, 1080417600 - tz.transition 2004, 10, :o2, 1099166400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb deleted file mode 100644 index 774dca1587..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb +++ /dev/null @@ -1,73 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Baghdad - include TimezoneDefinition - - timezone 'Asia/Baghdad' do |tz| - tz.offset :o0, 10660, 0, :LMT - tz.offset :o1, 10656, 0, :BMT - tz.offset :o2, 10800, 0, :AST - tz.offset :o3, 10800, 3600, :ADT - - tz.transition 1889, 12, :o1, 10417111387, 4320 - tz.transition 1917, 12, :o2, 726478313, 300 - tz.transition 1982, 4, :o3, 389048400 - tz.transition 1982, 9, :o2, 402264000 - tz.transition 1983, 3, :o3, 417906000 - tz.transition 1983, 9, :o2, 433800000 - tz.transition 1984, 3, :o3, 449614800 - tz.transition 1984, 9, :o2, 465422400 - tz.transition 1985, 3, :o3, 481150800 - tz.transition 1985, 9, :o2, 496792800 - tz.transition 1986, 3, :o3, 512517600 - tz.transition 1986, 9, :o2, 528242400 - tz.transition 1987, 3, :o3, 543967200 - tz.transition 1987, 9, :o2, 559692000 - tz.transition 1988, 3, :o3, 575416800 - tz.transition 1988, 9, :o2, 591141600 - tz.transition 1989, 3, :o3, 606866400 - tz.transition 1989, 9, :o2, 622591200 - tz.transition 1990, 3, :o3, 638316000 - tz.transition 1990, 9, :o2, 654645600 - tz.transition 1991, 4, :o3, 670464000 - tz.transition 1991, 10, :o2, 686275200 - tz.transition 1992, 4, :o3, 702086400 - tz.transition 1992, 10, :o2, 717897600 - tz.transition 1993, 4, :o3, 733622400 - tz.transition 1993, 10, :o2, 749433600 - tz.transition 1994, 4, :o3, 765158400 - tz.transition 1994, 10, :o2, 780969600 - tz.transition 1995, 4, :o3, 796694400 - tz.transition 1995, 10, :o2, 812505600 - tz.transition 1996, 4, :o3, 828316800 - tz.transition 1996, 10, :o2, 844128000 - tz.transition 1997, 4, :o3, 859852800 - tz.transition 1997, 10, :o2, 875664000 - tz.transition 1998, 4, :o3, 891388800 - tz.transition 1998, 10, :o2, 907200000 - tz.transition 1999, 4, :o3, 922924800 - tz.transition 1999, 10, :o2, 938736000 - tz.transition 2000, 4, :o3, 954547200 - tz.transition 2000, 10, :o2, 970358400 - tz.transition 2001, 4, :o3, 986083200 - tz.transition 2001, 10, :o2, 1001894400 - tz.transition 2002, 4, :o3, 1017619200 - tz.transition 2002, 10, :o2, 1033430400 - tz.transition 2003, 4, :o3, 1049155200 - tz.transition 2003, 10, :o2, 1064966400 - tz.transition 2004, 4, :o3, 1080777600 - tz.transition 2004, 10, :o2, 1096588800 - tz.transition 2005, 4, :o3, 1112313600 - tz.transition 2005, 10, :o2, 1128124800 - tz.transition 2006, 4, :o3, 1143849600 - tz.transition 2006, 10, :o2, 1159660800 - tz.transition 2007, 4, :o3, 1175385600 - tz.transition 2007, 10, :o2, 1191196800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb deleted file mode 100644 index e86340ebfa..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb +++ /dev/null @@ -1,161 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Baku - include TimezoneDefinition - - timezone 'Asia/Baku' do |tz| - tz.offset :o0, 11964, 0, :LMT - tz.offset :o1, 10800, 0, :BAKT - tz.offset :o2, 14400, 0, :BAKT - tz.offset :o3, 14400, 3600, :BAKST - tz.offset :o4, 10800, 3600, :BAKST - tz.offset :o5, 10800, 3600, :AZST - tz.offset :o6, 10800, 0, :AZT - tz.offset :o7, 14400, 0, :AZT - tz.offset :o8, 14400, 3600, :AZST - - tz.transition 1924, 5, :o1, 17452133003, 7200 - tz.transition 1957, 2, :o2, 19487187, 8 - tz.transition 1981, 3, :o3, 354916800 - tz.transition 1981, 9, :o2, 370724400 - tz.transition 1982, 3, :o3, 386452800 - tz.transition 1982, 9, :o2, 402260400 - tz.transition 1983, 3, :o3, 417988800 - tz.transition 1983, 9, :o2, 433796400 - tz.transition 1984, 3, :o3, 449611200 - tz.transition 1984, 9, :o2, 465343200 - tz.transition 1985, 3, :o3, 481068000 - tz.transition 1985, 9, :o2, 496792800 - tz.transition 1986, 3, :o3, 512517600 - tz.transition 1986, 9, :o2, 528242400 - tz.transition 1987, 3, :o3, 543967200 - tz.transition 1987, 9, :o2, 559692000 - tz.transition 1988, 3, :o3, 575416800 - tz.transition 1988, 9, :o2, 591141600 - tz.transition 1989, 3, :o3, 606866400 - tz.transition 1989, 9, :o2, 622591200 - tz.transition 1990, 3, :o3, 638316000 - tz.transition 1990, 9, :o2, 654645600 - tz.transition 1991, 3, :o4, 670370400 - tz.transition 1991, 8, :o5, 683496000 - tz.transition 1991, 9, :o6, 686098800 - tz.transition 1992, 3, :o5, 701812800 - tz.transition 1992, 9, :o7, 717534000 - tz.transition 1996, 3, :o8, 828234000 - tz.transition 1996, 10, :o7, 846378000 - tz.transition 1997, 3, :o8, 859680000 - tz.transition 1997, 10, :o7, 877824000 - tz.transition 1998, 3, :o8, 891129600 - tz.transition 1998, 10, :o7, 909273600 - tz.transition 1999, 3, :o8, 922579200 - tz.transition 1999, 10, :o7, 941328000 - tz.transition 2000, 3, :o8, 954028800 - tz.transition 2000, 10, :o7, 972777600 - tz.transition 2001, 3, :o8, 985478400 - tz.transition 2001, 10, :o7, 1004227200 - tz.transition 2002, 3, :o8, 1017532800 - tz.transition 2002, 10, :o7, 1035676800 - tz.transition 2003, 3, :o8, 1048982400 - tz.transition 2003, 10, :o7, 1067126400 - tz.transition 2004, 3, :o8, 1080432000 - tz.transition 2004, 10, :o7, 1099180800 - tz.transition 2005, 3, :o8, 1111881600 - tz.transition 2005, 10, :o7, 1130630400 - tz.transition 2006, 3, :o8, 1143331200 - tz.transition 2006, 10, :o7, 1162080000 - tz.transition 2007, 3, :o8, 1174780800 - tz.transition 2007, 10, :o7, 1193529600 - tz.transition 2008, 3, :o8, 1206835200 - tz.transition 2008, 10, :o7, 1224979200 - tz.transition 2009, 3, :o8, 1238284800 - tz.transition 2009, 10, :o7, 1256428800 - tz.transition 2010, 3, :o8, 1269734400 - tz.transition 2010, 10, :o7, 1288483200 - tz.transition 2011, 3, :o8, 1301184000 - tz.transition 2011, 10, :o7, 1319932800 - tz.transition 2012, 3, :o8, 1332633600 - tz.transition 2012, 10, :o7, 1351382400 - tz.transition 2013, 3, :o8, 1364688000 - tz.transition 2013, 10, :o7, 1382832000 - tz.transition 2014, 3, :o8, 1396137600 - tz.transition 2014, 10, :o7, 1414281600 - tz.transition 2015, 3, :o8, 1427587200 - tz.transition 2015, 10, :o7, 1445731200 - tz.transition 2016, 3, :o8, 1459036800 - tz.transition 2016, 10, :o7, 1477785600 - tz.transition 2017, 3, :o8, 1490486400 - tz.transition 2017, 10, :o7, 1509235200 - tz.transition 2018, 3, :o8, 1521936000 - tz.transition 2018, 10, :o7, 1540684800 - tz.transition 2019, 3, :o8, 1553990400 - tz.transition 2019, 10, :o7, 1572134400 - tz.transition 2020, 3, :o8, 1585440000 - tz.transition 2020, 10, :o7, 1603584000 - tz.transition 2021, 3, :o8, 1616889600 - tz.transition 2021, 10, :o7, 1635638400 - tz.transition 2022, 3, :o8, 1648339200 - tz.transition 2022, 10, :o7, 1667088000 - tz.transition 2023, 3, :o8, 1679788800 - tz.transition 2023, 10, :o7, 1698537600 - tz.transition 2024, 3, :o8, 1711843200 - tz.transition 2024, 10, :o7, 1729987200 - tz.transition 2025, 3, :o8, 1743292800 - tz.transition 2025, 10, :o7, 1761436800 - tz.transition 2026, 3, :o8, 1774742400 - tz.transition 2026, 10, :o7, 1792886400 - tz.transition 2027, 3, :o8, 1806192000 - tz.transition 2027, 10, :o7, 1824940800 - tz.transition 2028, 3, :o8, 1837641600 - tz.transition 2028, 10, :o7, 1856390400 - tz.transition 2029, 3, :o8, 1869091200 - tz.transition 2029, 10, :o7, 1887840000 - tz.transition 2030, 3, :o8, 1901145600 - tz.transition 2030, 10, :o7, 1919289600 - tz.transition 2031, 3, :o8, 1932595200 - tz.transition 2031, 10, :o7, 1950739200 - tz.transition 2032, 3, :o8, 1964044800 - tz.transition 2032, 10, :o7, 1982793600 - tz.transition 2033, 3, :o8, 1995494400 - tz.transition 2033, 10, :o7, 2014243200 - tz.transition 2034, 3, :o8, 2026944000 - tz.transition 2034, 10, :o7, 2045692800 - tz.transition 2035, 3, :o8, 2058393600 - tz.transition 2035, 10, :o7, 2077142400 - tz.transition 2036, 3, :o8, 2090448000 - tz.transition 2036, 10, :o7, 2108592000 - tz.transition 2037, 3, :o8, 2121897600 - tz.transition 2037, 10, :o7, 2140041600 - tz.transition 2038, 3, :o8, 4931021, 2 - tz.transition 2038, 10, :o7, 4931455, 2 - tz.transition 2039, 3, :o8, 4931749, 2 - tz.transition 2039, 10, :o7, 4932183, 2 - tz.transition 2040, 3, :o8, 4932477, 2 - tz.transition 2040, 10, :o7, 4932911, 2 - tz.transition 2041, 3, :o8, 4933219, 2 - tz.transition 2041, 10, :o7, 4933639, 2 - tz.transition 2042, 3, :o8, 4933947, 2 - tz.transition 2042, 10, :o7, 4934367, 2 - tz.transition 2043, 3, :o8, 4934675, 2 - tz.transition 2043, 10, :o7, 4935095, 2 - tz.transition 2044, 3, :o8, 4935403, 2 - tz.transition 2044, 10, :o7, 4935837, 2 - tz.transition 2045, 3, :o8, 4936131, 2 - tz.transition 2045, 10, :o7, 4936565, 2 - tz.transition 2046, 3, :o8, 4936859, 2 - tz.transition 2046, 10, :o7, 4937293, 2 - tz.transition 2047, 3, :o8, 4937601, 2 - tz.transition 2047, 10, :o7, 4938021, 2 - tz.transition 2048, 3, :o8, 4938329, 2 - tz.transition 2048, 10, :o7, 4938749, 2 - tz.transition 2049, 3, :o8, 4939057, 2 - tz.transition 2049, 10, :o7, 4939491, 2 - tz.transition 2050, 3, :o8, 4939785, 2 - tz.transition 2050, 10, :o7, 4940219, 2 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb deleted file mode 100644 index 139194e5e5..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Bangkok - include TimezoneDefinition - - timezone 'Asia/Bangkok' do |tz| - tz.offset :o0, 24124, 0, :LMT - tz.offset :o1, 24124, 0, :BMT - tz.offset :o2, 25200, 0, :ICT - - tz.transition 1879, 12, :o1, 52006648769, 21600 - tz.transition 1920, 3, :o2, 52324168769, 21600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb deleted file mode 100644 index 8c94b4ba86..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Chongqing - include TimezoneDefinition - - timezone 'Asia/Chongqing' do |tz| - tz.offset :o0, 25580, 0, :LMT - tz.offset :o1, 25200, 0, :LONT - tz.offset :o2, 28800, 0, :CST - tz.offset :o3, 28800, 3600, :CDT - - tz.transition 1927, 12, :o1, 10477063601, 4320 - tz.transition 1980, 4, :o2, 325962000 - tz.transition 1986, 5, :o3, 515520000 - tz.transition 1986, 9, :o2, 527007600 - tz.transition 1987, 4, :o3, 545155200 - tz.transition 1987, 9, :o2, 558457200 - tz.transition 1988, 4, :o3, 576604800 - tz.transition 1988, 9, :o2, 589906800 - tz.transition 1989, 4, :o3, 608659200 - tz.transition 1989, 9, :o2, 621961200 - tz.transition 1990, 4, :o3, 640108800 - tz.transition 1990, 9, :o2, 653410800 - tz.transition 1991, 4, :o3, 671558400 - tz.transition 1991, 9, :o2, 684860400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb deleted file mode 100644 index f6531fa819..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Colombo - include TimezoneDefinition - - timezone 'Asia/Colombo' do |tz| - tz.offset :o0, 19164, 0, :LMT - tz.offset :o1, 19172, 0, :MMT - tz.offset :o2, 19800, 0, :IST - tz.offset :o3, 19800, 1800, :IHST - tz.offset :o4, 19800, 3600, :IST - tz.offset :o5, 23400, 0, :LKT - tz.offset :o6, 21600, 0, :LKT - - tz.transition 1879, 12, :o1, 17335550003, 7200 - tz.transition 1905, 12, :o2, 52211763607, 21600 - tz.transition 1942, 1, :o3, 116657485, 48 - tz.transition 1942, 8, :o4, 9722413, 4 - tz.transition 1945, 10, :o2, 38907909, 16 - tz.transition 1996, 5, :o5, 832962600 - tz.transition 1996, 10, :o6, 846266400 - tz.transition 2006, 4, :o2, 1145039400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb deleted file mode 100644 index ccd0265503..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Dhaka - include TimezoneDefinition - - timezone 'Asia/Dhaka' do |tz| - tz.offset :o0, 21700, 0, :LMT - tz.offset :o1, 21200, 0, :HMT - tz.offset :o2, 23400, 0, :BURT - tz.offset :o3, 19800, 0, :IST - tz.offset :o4, 21600, 0, :DACT - tz.offset :o5, 21600, 0, :BDT - - tz.transition 1889, 12, :o1, 2083422167, 864 - tz.transition 1941, 9, :o2, 524937943, 216 - tz.transition 1942, 5, :o3, 116663723, 48 - tz.transition 1942, 8, :o2, 116668957, 48 - tz.transition 1951, 9, :o4, 116828123, 48 - tz.transition 1971, 3, :o5, 38772000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb deleted file mode 100644 index f1edd75ac8..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb +++ /dev/null @@ -1,87 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Hong_Kong - include TimezoneDefinition - - timezone 'Asia/Hong_Kong' do |tz| - tz.offset :o0, 27396, 0, :LMT - tz.offset :o1, 28800, 0, :HKT - tz.offset :o2, 28800, 3600, :HKST - - tz.transition 1904, 10, :o1, 5800279639, 2400 - tz.transition 1946, 4, :o2, 38910885, 16 - tz.transition 1946, 11, :o1, 116743453, 48 - tz.transition 1947, 4, :o2, 38916613, 16 - tz.transition 1947, 12, :o1, 116762365, 48 - tz.transition 1948, 5, :o2, 38922773, 16 - tz.transition 1948, 10, :o1, 116777053, 48 - tz.transition 1949, 4, :o2, 38928149, 16 - tz.transition 1949, 10, :o1, 116794525, 48 - tz.transition 1950, 4, :o2, 38933973, 16 - tz.transition 1950, 10, :o1, 116811997, 48 - tz.transition 1951, 3, :o2, 38939797, 16 - tz.transition 1951, 10, :o1, 116829469, 48 - tz.transition 1952, 4, :o2, 38945733, 16 - tz.transition 1952, 10, :o1, 116846941, 48 - tz.transition 1953, 4, :o2, 38951557, 16 - tz.transition 1953, 10, :o1, 116864749, 48 - tz.transition 1954, 3, :o2, 38957157, 16 - tz.transition 1954, 10, :o1, 116882221, 48 - tz.transition 1955, 3, :o2, 38962981, 16 - tz.transition 1955, 11, :o1, 116900029, 48 - tz.transition 1956, 3, :o2, 38968805, 16 - tz.transition 1956, 11, :o1, 116917501, 48 - tz.transition 1957, 3, :o2, 38974741, 16 - tz.transition 1957, 11, :o1, 116934973, 48 - tz.transition 1958, 3, :o2, 38980565, 16 - tz.transition 1958, 11, :o1, 116952445, 48 - tz.transition 1959, 3, :o2, 38986389, 16 - tz.transition 1959, 10, :o1, 116969917, 48 - tz.transition 1960, 3, :o2, 38992213, 16 - tz.transition 1960, 11, :o1, 116987725, 48 - tz.transition 1961, 3, :o2, 38998037, 16 - tz.transition 1961, 11, :o1, 117005197, 48 - tz.transition 1962, 3, :o2, 39003861, 16 - tz.transition 1962, 11, :o1, 117022669, 48 - tz.transition 1963, 3, :o2, 39009797, 16 - tz.transition 1963, 11, :o1, 117040141, 48 - tz.transition 1964, 3, :o2, 39015621, 16 - tz.transition 1964, 10, :o1, 117057613, 48 - tz.transition 1965, 4, :o2, 39021893, 16 - tz.transition 1965, 10, :o1, 117074413, 48 - tz.transition 1966, 4, :o2, 39027717, 16 - tz.transition 1966, 10, :o1, 117091885, 48 - tz.transition 1967, 4, :o2, 39033541, 16 - tz.transition 1967, 10, :o1, 117109693, 48 - tz.transition 1968, 4, :o2, 39039477, 16 - tz.transition 1968, 10, :o1, 117127165, 48 - tz.transition 1969, 4, :o2, 39045301, 16 - tz.transition 1969, 10, :o1, 117144637, 48 - tz.transition 1970, 4, :o2, 9315000 - tz.transition 1970, 10, :o1, 25036200 - tz.transition 1971, 4, :o2, 40764600 - tz.transition 1971, 10, :o1, 56485800 - tz.transition 1972, 4, :o2, 72214200 - tz.transition 1972, 10, :o1, 88540200 - tz.transition 1973, 4, :o2, 104268600 - tz.transition 1973, 10, :o1, 119989800 - tz.transition 1974, 4, :o2, 135718200 - tz.transition 1974, 10, :o1, 151439400 - tz.transition 1975, 4, :o2, 167167800 - tz.transition 1975, 10, :o1, 182889000 - tz.transition 1976, 4, :o2, 198617400 - tz.transition 1976, 10, :o1, 214338600 - tz.transition 1977, 4, :o2, 230067000 - tz.transition 1977, 10, :o1, 245788200 - tz.transition 1979, 5, :o2, 295385400 - tz.transition 1979, 10, :o1, 309292200 - tz.transition 1980, 5, :o2, 326835000 - tz.transition 1980, 10, :o1, 340741800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb deleted file mode 100644 index 2d47d9580b..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Irkutsk - include TimezoneDefinition - - timezone 'Asia/Irkutsk' do |tz| - tz.offset :o0, 25040, 0, :LMT - tz.offset :o1, 25040, 0, :IMT - tz.offset :o2, 25200, 0, :IRKT - tz.offset :o3, 28800, 0, :IRKT - tz.offset :o4, 28800, 3600, :IRKST - tz.offset :o5, 25200, 3600, :IRKST - - tz.transition 1879, 12, :o1, 2600332427, 1080 - tz.transition 1920, 1, :o2, 2616136067, 1080 - tz.transition 1930, 6, :o3, 58227557, 24 - tz.transition 1981, 3, :o4, 354902400 - tz.transition 1981, 9, :o3, 370710000 - tz.transition 1982, 3, :o4, 386438400 - tz.transition 1982, 9, :o3, 402246000 - tz.transition 1983, 3, :o4, 417974400 - tz.transition 1983, 9, :o3, 433782000 - tz.transition 1984, 3, :o4, 449596800 - tz.transition 1984, 9, :o3, 465328800 - tz.transition 1985, 3, :o4, 481053600 - tz.transition 1985, 9, :o3, 496778400 - tz.transition 1986, 3, :o4, 512503200 - tz.transition 1986, 9, :o3, 528228000 - tz.transition 1987, 3, :o4, 543952800 - tz.transition 1987, 9, :o3, 559677600 - tz.transition 1988, 3, :o4, 575402400 - tz.transition 1988, 9, :o3, 591127200 - tz.transition 1989, 3, :o4, 606852000 - tz.transition 1989, 9, :o3, 622576800 - tz.transition 1990, 3, :o4, 638301600 - tz.transition 1990, 9, :o3, 654631200 - tz.transition 1991, 3, :o5, 670356000 - tz.transition 1991, 9, :o2, 686084400 - tz.transition 1992, 1, :o3, 695761200 - tz.transition 1992, 3, :o4, 701794800 - tz.transition 1992, 9, :o3, 717516000 - tz.transition 1993, 3, :o4, 733255200 - tz.transition 1993, 9, :o3, 748980000 - tz.transition 1994, 3, :o4, 764704800 - tz.transition 1994, 9, :o3, 780429600 - tz.transition 1995, 3, :o4, 796154400 - tz.transition 1995, 9, :o3, 811879200 - tz.transition 1996, 3, :o4, 828208800 - tz.transition 1996, 10, :o3, 846352800 - tz.transition 1997, 3, :o4, 859658400 - tz.transition 1997, 10, :o3, 877802400 - tz.transition 1998, 3, :o4, 891108000 - tz.transition 1998, 10, :o3, 909252000 - tz.transition 1999, 3, :o4, 922557600 - tz.transition 1999, 10, :o3, 941306400 - tz.transition 2000, 3, :o4, 954007200 - tz.transition 2000, 10, :o3, 972756000 - tz.transition 2001, 3, :o4, 985456800 - tz.transition 2001, 10, :o3, 1004205600 - tz.transition 2002, 3, :o4, 1017511200 - tz.transition 2002, 10, :o3, 1035655200 - tz.transition 2003, 3, :o4, 1048960800 - tz.transition 2003, 10, :o3, 1067104800 - tz.transition 2004, 3, :o4, 1080410400 - tz.transition 2004, 10, :o3, 1099159200 - tz.transition 2005, 3, :o4, 1111860000 - tz.transition 2005, 10, :o3, 1130608800 - tz.transition 2006, 3, :o4, 1143309600 - tz.transition 2006, 10, :o3, 1162058400 - tz.transition 2007, 3, :o4, 1174759200 - tz.transition 2007, 10, :o3, 1193508000 - tz.transition 2008, 3, :o4, 1206813600 - tz.transition 2008, 10, :o3, 1224957600 - tz.transition 2009, 3, :o4, 1238263200 - tz.transition 2009, 10, :o3, 1256407200 - tz.transition 2010, 3, :o4, 1269712800 - tz.transition 2010, 10, :o3, 1288461600 - tz.transition 2011, 3, :o4, 1301162400 - tz.transition 2011, 10, :o3, 1319911200 - tz.transition 2012, 3, :o4, 1332612000 - tz.transition 2012, 10, :o3, 1351360800 - tz.transition 2013, 3, :o4, 1364666400 - tz.transition 2013, 10, :o3, 1382810400 - tz.transition 2014, 3, :o4, 1396116000 - tz.transition 2014, 10, :o3, 1414260000 - tz.transition 2015, 3, :o4, 1427565600 - tz.transition 2015, 10, :o3, 1445709600 - tz.transition 2016, 3, :o4, 1459015200 - tz.transition 2016, 10, :o3, 1477764000 - tz.transition 2017, 3, :o4, 1490464800 - tz.transition 2017, 10, :o3, 1509213600 - tz.transition 2018, 3, :o4, 1521914400 - tz.transition 2018, 10, :o3, 1540663200 - tz.transition 2019, 3, :o4, 1553968800 - tz.transition 2019, 10, :o3, 1572112800 - tz.transition 2020, 3, :o4, 1585418400 - tz.transition 2020, 10, :o3, 1603562400 - tz.transition 2021, 3, :o4, 1616868000 - tz.transition 2021, 10, :o3, 1635616800 - tz.transition 2022, 3, :o4, 1648317600 - tz.transition 2022, 10, :o3, 1667066400 - tz.transition 2023, 3, :o4, 1679767200 - tz.transition 2023, 10, :o3, 1698516000 - tz.transition 2024, 3, :o4, 1711821600 - tz.transition 2024, 10, :o3, 1729965600 - tz.transition 2025, 3, :o4, 1743271200 - tz.transition 2025, 10, :o3, 1761415200 - tz.transition 2026, 3, :o4, 1774720800 - tz.transition 2026, 10, :o3, 1792864800 - tz.transition 2027, 3, :o4, 1806170400 - tz.transition 2027, 10, :o3, 1824919200 - tz.transition 2028, 3, :o4, 1837620000 - tz.transition 2028, 10, :o3, 1856368800 - tz.transition 2029, 3, :o4, 1869069600 - tz.transition 2029, 10, :o3, 1887818400 - tz.transition 2030, 3, :o4, 1901124000 - tz.transition 2030, 10, :o3, 1919268000 - tz.transition 2031, 3, :o4, 1932573600 - tz.transition 2031, 10, :o3, 1950717600 - tz.transition 2032, 3, :o4, 1964023200 - tz.transition 2032, 10, :o3, 1982772000 - tz.transition 2033, 3, :o4, 1995472800 - tz.transition 2033, 10, :o3, 2014221600 - tz.transition 2034, 3, :o4, 2026922400 - tz.transition 2034, 10, :o3, 2045671200 - tz.transition 2035, 3, :o4, 2058372000 - tz.transition 2035, 10, :o3, 2077120800 - tz.transition 2036, 3, :o4, 2090426400 - tz.transition 2036, 10, :o3, 2108570400 - tz.transition 2037, 3, :o4, 2121876000 - tz.transition 2037, 10, :o3, 2140020000 - tz.transition 2038, 3, :o4, 9862041, 4 - tz.transition 2038, 10, :o3, 9862909, 4 - tz.transition 2039, 3, :o4, 9863497, 4 - tz.transition 2039, 10, :o3, 9864365, 4 - tz.transition 2040, 3, :o4, 9864953, 4 - tz.transition 2040, 10, :o3, 9865821, 4 - tz.transition 2041, 3, :o4, 9866437, 4 - tz.transition 2041, 10, :o3, 9867277, 4 - tz.transition 2042, 3, :o4, 9867893, 4 - tz.transition 2042, 10, :o3, 9868733, 4 - tz.transition 2043, 3, :o4, 9869349, 4 - tz.transition 2043, 10, :o3, 9870189, 4 - tz.transition 2044, 3, :o4, 9870805, 4 - tz.transition 2044, 10, :o3, 9871673, 4 - tz.transition 2045, 3, :o4, 9872261, 4 - tz.transition 2045, 10, :o3, 9873129, 4 - tz.transition 2046, 3, :o4, 9873717, 4 - tz.transition 2046, 10, :o3, 9874585, 4 - tz.transition 2047, 3, :o4, 9875201, 4 - tz.transition 2047, 10, :o3, 9876041, 4 - tz.transition 2048, 3, :o4, 9876657, 4 - tz.transition 2048, 10, :o3, 9877497, 4 - tz.transition 2049, 3, :o4, 9878113, 4 - tz.transition 2049, 10, :o3, 9878981, 4 - tz.transition 2050, 3, :o4, 9879569, 4 - tz.transition 2050, 10, :o3, 9880437, 4 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb deleted file mode 100644 index cc58fa173b..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Jakarta - include TimezoneDefinition - - timezone 'Asia/Jakarta' do |tz| - tz.offset :o0, 25632, 0, :LMT - tz.offset :o1, 25632, 0, :JMT - tz.offset :o2, 26400, 0, :JAVT - tz.offset :o3, 27000, 0, :WIT - tz.offset :o4, 32400, 0, :JST - tz.offset :o5, 28800, 0, :WIT - tz.offset :o6, 25200, 0, :WIT - - tz.transition 1867, 8, :o1, 720956461, 300 - tz.transition 1923, 12, :o2, 87256267, 36 - tz.transition 1932, 10, :o3, 87372439, 36 - tz.transition 1942, 3, :o4, 38887059, 16 - tz.transition 1945, 9, :o3, 19453769, 8 - tz.transition 1948, 4, :o5, 38922755, 16 - tz.transition 1950, 4, :o3, 14600413, 6 - tz.transition 1963, 12, :o6, 39014323, 16 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb deleted file mode 100644 index 9b737b899e..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Jerusalem - include TimezoneDefinition - - timezone 'Asia/Jerusalem' do |tz| - tz.offset :o0, 8456, 0, :LMT - tz.offset :o1, 8440, 0, :JMT - tz.offset :o2, 7200, 0, :IST - tz.offset :o3, 7200, 3600, :IDT - tz.offset :o4, 7200, 7200, :IDDT - - tz.transition 1879, 12, :o1, 26003326343, 10800 - tz.transition 1917, 12, :o2, 5230643909, 2160 - tz.transition 1940, 5, :o3, 29157377, 12 - tz.transition 1942, 10, :o2, 19445315, 8 - tz.transition 1943, 4, :o3, 4861631, 2 - tz.transition 1943, 10, :o2, 19448235, 8 - tz.transition 1944, 3, :o3, 29174177, 12 - tz.transition 1944, 10, :o2, 19451163, 8 - tz.transition 1945, 4, :o3, 29178737, 12 - tz.transition 1945, 10, :o2, 58362251, 24 - tz.transition 1946, 4, :o3, 4863853, 2 - tz.transition 1946, 10, :o2, 19457003, 8 - tz.transition 1948, 5, :o4, 29192333, 12 - tz.transition 1948, 8, :o3, 7298386, 3 - tz.transition 1948, 10, :o2, 58388555, 24 - tz.transition 1949, 4, :o3, 29196449, 12 - tz.transition 1949, 10, :o2, 58397315, 24 - tz.transition 1950, 4, :o3, 29200649, 12 - tz.transition 1950, 9, :o2, 4867079, 2 - tz.transition 1951, 3, :o3, 29204849, 12 - tz.transition 1951, 11, :o2, 4867923, 2 - tz.transition 1952, 4, :o3, 4868245, 2 - tz.transition 1952, 10, :o2, 4868609, 2 - tz.transition 1953, 4, :o3, 4868959, 2 - tz.transition 1953, 9, :o2, 4869267, 2 - tz.transition 1954, 6, :o3, 29218877, 12 - tz.transition 1954, 9, :o2, 19479979, 8 - tz.transition 1955, 6, :o3, 4870539, 2 - tz.transition 1955, 9, :o2, 19482891, 8 - tz.transition 1956, 6, :o3, 29227529, 12 - tz.transition 1956, 9, :o2, 4871493, 2 - tz.transition 1957, 4, :o3, 4871915, 2 - tz.transition 1957, 9, :o2, 19488827, 8 - tz.transition 1974, 7, :o3, 142380000 - tz.transition 1974, 10, :o2, 150843600 - tz.transition 1975, 4, :o3, 167176800 - tz.transition 1975, 8, :o2, 178664400 - tz.transition 1985, 4, :o3, 482277600 - tz.transition 1985, 9, :o2, 495579600 - tz.transition 1986, 5, :o3, 516751200 - tz.transition 1986, 9, :o2, 526424400 - tz.transition 1987, 4, :o3, 545436000 - tz.transition 1987, 9, :o2, 558478800 - tz.transition 1988, 4, :o3, 576540000 - tz.transition 1988, 9, :o2, 589237200 - tz.transition 1989, 4, :o3, 609890400 - tz.transition 1989, 9, :o2, 620773200 - tz.transition 1990, 3, :o3, 638316000 - tz.transition 1990, 8, :o2, 651618000 - tz.transition 1991, 3, :o3, 669765600 - tz.transition 1991, 8, :o2, 683672400 - tz.transition 1992, 3, :o3, 701820000 - tz.transition 1992, 9, :o2, 715726800 - tz.transition 1993, 4, :o3, 733701600 - tz.transition 1993, 9, :o2, 747176400 - tz.transition 1994, 3, :o3, 765151200 - tz.transition 1994, 8, :o2, 778021200 - tz.transition 1995, 3, :o3, 796600800 - tz.transition 1995, 9, :o2, 810075600 - tz.transition 1996, 3, :o3, 826840800 - tz.transition 1996, 9, :o2, 842821200 - tz.transition 1997, 3, :o3, 858895200 - tz.transition 1997, 9, :o2, 874184400 - tz.transition 1998, 3, :o3, 890344800 - tz.transition 1998, 9, :o2, 905029200 - tz.transition 1999, 4, :o3, 923011200 - tz.transition 1999, 9, :o2, 936313200 - tz.transition 2000, 4, :o3, 955670400 - tz.transition 2000, 10, :o2, 970783200 - tz.transition 2001, 4, :o3, 986770800 - tz.transition 2001, 9, :o2, 1001282400 - tz.transition 2002, 3, :o3, 1017356400 - tz.transition 2002, 10, :o2, 1033941600 - tz.transition 2003, 3, :o3, 1048806000 - tz.transition 2003, 10, :o2, 1065132000 - tz.transition 2004, 4, :o3, 1081292400 - tz.transition 2004, 9, :o2, 1095804000 - tz.transition 2005, 4, :o3, 1112313600 - tz.transition 2005, 10, :o2, 1128812400 - tz.transition 2006, 3, :o3, 1143763200 - tz.transition 2006, 9, :o2, 1159657200 - tz.transition 2007, 3, :o3, 1175212800 - tz.transition 2007, 9, :o2, 1189897200 - tz.transition 2008, 3, :o3, 1206662400 - tz.transition 2008, 10, :o2, 1223161200 - tz.transition 2009, 3, :o3, 1238112000 - tz.transition 2009, 9, :o2, 1254006000 - tz.transition 2010, 3, :o3, 1269561600 - tz.transition 2010, 9, :o2, 1284246000 - tz.transition 2011, 4, :o3, 1301616000 - tz.transition 2011, 10, :o2, 1317510000 - tz.transition 2012, 3, :o3, 1333065600 - tz.transition 2012, 9, :o2, 1348354800 - tz.transition 2013, 3, :o3, 1364515200 - tz.transition 2013, 9, :o2, 1378594800 - tz.transition 2014, 3, :o3, 1395964800 - tz.transition 2014, 9, :o2, 1411858800 - tz.transition 2015, 3, :o3, 1427414400 - tz.transition 2015, 9, :o2, 1442703600 - tz.transition 2016, 4, :o3, 1459468800 - tz.transition 2016, 10, :o2, 1475967600 - tz.transition 2017, 3, :o3, 1490918400 - tz.transition 2017, 9, :o2, 1506207600 - tz.transition 2018, 3, :o3, 1522368000 - tz.transition 2018, 9, :o2, 1537052400 - tz.transition 2019, 3, :o3, 1553817600 - tz.transition 2019, 10, :o2, 1570316400 - tz.transition 2020, 3, :o3, 1585267200 - tz.transition 2020, 9, :o2, 1601161200 - tz.transition 2021, 3, :o3, 1616716800 - tz.transition 2021, 9, :o2, 1631401200 - tz.transition 2022, 4, :o3, 1648771200 - tz.transition 2022, 10, :o2, 1664665200 - tz.transition 2023, 3, :o3, 1680220800 - tz.transition 2023, 9, :o2, 1695510000 - tz.transition 2024, 3, :o3, 1711670400 - tz.transition 2024, 10, :o2, 1728169200 - tz.transition 2025, 3, :o3, 1743120000 - tz.transition 2025, 9, :o2, 1759014000 - tz.transition 2026, 3, :o3, 1774569600 - tz.transition 2026, 9, :o2, 1789858800 - tz.transition 2027, 3, :o3, 1806019200 - tz.transition 2027, 10, :o2, 1823122800 - tz.transition 2028, 3, :o3, 1838073600 - tz.transition 2028, 9, :o2, 1853362800 - tz.transition 2029, 3, :o3, 1869523200 - tz.transition 2029, 9, :o2, 1884207600 - tz.transition 2030, 3, :o3, 1900972800 - tz.transition 2030, 10, :o2, 1917471600 - tz.transition 2031, 3, :o3, 1932422400 - tz.transition 2031, 9, :o2, 1947711600 - tz.transition 2032, 3, :o3, 1963872000 - tz.transition 2032, 9, :o2, 1978556400 - tz.transition 2033, 4, :o3, 1995926400 - tz.transition 2033, 10, :o2, 2011820400 - tz.transition 2034, 3, :o3, 2027376000 - tz.transition 2034, 9, :o2, 2042060400 - tz.transition 2035, 3, :o3, 2058825600 - tz.transition 2035, 10, :o2, 2075324400 - tz.transition 2036, 3, :o3, 2090275200 - tz.transition 2036, 9, :o2, 2106169200 - tz.transition 2037, 3, :o3, 2121724800 - tz.transition 2037, 9, :o2, 2136409200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb deleted file mode 100644 index 669c09790a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Kabul - include TimezoneDefinition - - timezone 'Asia/Kabul' do |tz| - tz.offset :o0, 16608, 0, :LMT - tz.offset :o1, 14400, 0, :AFT - tz.offset :o2, 16200, 0, :AFT - - tz.transition 1889, 12, :o1, 2170231477, 900 - tz.transition 1944, 12, :o2, 7294369, 3 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb deleted file mode 100644 index 2f1690b3a9..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Kamchatka - include TimezoneDefinition - - timezone 'Asia/Kamchatka' do |tz| - tz.offset :o0, 38076, 0, :LMT - tz.offset :o1, 39600, 0, :PETT - tz.offset :o2, 43200, 0, :PETT - tz.offset :o3, 43200, 3600, :PETST - tz.offset :o4, 39600, 3600, :PETST - - tz.transition 1922, 11, :o1, 17448250027, 7200 - tz.transition 1930, 6, :o2, 58227553, 24 - tz.transition 1981, 3, :o3, 354888000 - tz.transition 1981, 9, :o2, 370695600 - tz.transition 1982, 3, :o3, 386424000 - tz.transition 1982, 9, :o2, 402231600 - tz.transition 1983, 3, :o3, 417960000 - tz.transition 1983, 9, :o2, 433767600 - tz.transition 1984, 3, :o3, 449582400 - tz.transition 1984, 9, :o2, 465314400 - tz.transition 1985, 3, :o3, 481039200 - tz.transition 1985, 9, :o2, 496764000 - tz.transition 1986, 3, :o3, 512488800 - tz.transition 1986, 9, :o2, 528213600 - tz.transition 1987, 3, :o3, 543938400 - tz.transition 1987, 9, :o2, 559663200 - tz.transition 1988, 3, :o3, 575388000 - tz.transition 1988, 9, :o2, 591112800 - tz.transition 1989, 3, :o3, 606837600 - tz.transition 1989, 9, :o2, 622562400 - tz.transition 1990, 3, :o3, 638287200 - tz.transition 1990, 9, :o2, 654616800 - tz.transition 1991, 3, :o4, 670341600 - tz.transition 1991, 9, :o1, 686070000 - tz.transition 1992, 1, :o2, 695746800 - tz.transition 1992, 3, :o3, 701780400 - tz.transition 1992, 9, :o2, 717501600 - tz.transition 1993, 3, :o3, 733240800 - tz.transition 1993, 9, :o2, 748965600 - tz.transition 1994, 3, :o3, 764690400 - tz.transition 1994, 9, :o2, 780415200 - tz.transition 1995, 3, :o3, 796140000 - tz.transition 1995, 9, :o2, 811864800 - tz.transition 1996, 3, :o3, 828194400 - tz.transition 1996, 10, :o2, 846338400 - tz.transition 1997, 3, :o3, 859644000 - tz.transition 1997, 10, :o2, 877788000 - tz.transition 1998, 3, :o3, 891093600 - tz.transition 1998, 10, :o2, 909237600 - tz.transition 1999, 3, :o3, 922543200 - tz.transition 1999, 10, :o2, 941292000 - tz.transition 2000, 3, :o3, 953992800 - tz.transition 2000, 10, :o2, 972741600 - tz.transition 2001, 3, :o3, 985442400 - tz.transition 2001, 10, :o2, 1004191200 - tz.transition 2002, 3, :o3, 1017496800 - tz.transition 2002, 10, :o2, 1035640800 - tz.transition 2003, 3, :o3, 1048946400 - tz.transition 2003, 10, :o2, 1067090400 - tz.transition 2004, 3, :o3, 1080396000 - tz.transition 2004, 10, :o2, 1099144800 - tz.transition 2005, 3, :o3, 1111845600 - tz.transition 2005, 10, :o2, 1130594400 - tz.transition 2006, 3, :o3, 1143295200 - tz.transition 2006, 10, :o2, 1162044000 - tz.transition 2007, 3, :o3, 1174744800 - tz.transition 2007, 10, :o2, 1193493600 - tz.transition 2008, 3, :o3, 1206799200 - tz.transition 2008, 10, :o2, 1224943200 - tz.transition 2009, 3, :o3, 1238248800 - tz.transition 2009, 10, :o2, 1256392800 - tz.transition 2010, 3, :o3, 1269698400 - tz.transition 2010, 10, :o2, 1288447200 - tz.transition 2011, 3, :o3, 1301148000 - tz.transition 2011, 10, :o2, 1319896800 - tz.transition 2012, 3, :o3, 1332597600 - tz.transition 2012, 10, :o2, 1351346400 - tz.transition 2013, 3, :o3, 1364652000 - tz.transition 2013, 10, :o2, 1382796000 - tz.transition 2014, 3, :o3, 1396101600 - tz.transition 2014, 10, :o2, 1414245600 - tz.transition 2015, 3, :o3, 1427551200 - tz.transition 2015, 10, :o2, 1445695200 - tz.transition 2016, 3, :o3, 1459000800 - tz.transition 2016, 10, :o2, 1477749600 - tz.transition 2017, 3, :o3, 1490450400 - tz.transition 2017, 10, :o2, 1509199200 - tz.transition 2018, 3, :o3, 1521900000 - tz.transition 2018, 10, :o2, 1540648800 - tz.transition 2019, 3, :o3, 1553954400 - tz.transition 2019, 10, :o2, 1572098400 - tz.transition 2020, 3, :o3, 1585404000 - tz.transition 2020, 10, :o2, 1603548000 - tz.transition 2021, 3, :o3, 1616853600 - tz.transition 2021, 10, :o2, 1635602400 - tz.transition 2022, 3, :o3, 1648303200 - tz.transition 2022, 10, :o2, 1667052000 - tz.transition 2023, 3, :o3, 1679752800 - tz.transition 2023, 10, :o2, 1698501600 - tz.transition 2024, 3, :o3, 1711807200 - tz.transition 2024, 10, :o2, 1729951200 - tz.transition 2025, 3, :o3, 1743256800 - tz.transition 2025, 10, :o2, 1761400800 - tz.transition 2026, 3, :o3, 1774706400 - tz.transition 2026, 10, :o2, 1792850400 - tz.transition 2027, 3, :o3, 1806156000 - tz.transition 2027, 10, :o2, 1824904800 - tz.transition 2028, 3, :o3, 1837605600 - tz.transition 2028, 10, :o2, 1856354400 - tz.transition 2029, 3, :o3, 1869055200 - tz.transition 2029, 10, :o2, 1887804000 - tz.transition 2030, 3, :o3, 1901109600 - tz.transition 2030, 10, :o2, 1919253600 - tz.transition 2031, 3, :o3, 1932559200 - tz.transition 2031, 10, :o2, 1950703200 - tz.transition 2032, 3, :o3, 1964008800 - tz.transition 2032, 10, :o2, 1982757600 - tz.transition 2033, 3, :o3, 1995458400 - tz.transition 2033, 10, :o2, 2014207200 - tz.transition 2034, 3, :o3, 2026908000 - tz.transition 2034, 10, :o2, 2045656800 - tz.transition 2035, 3, :o3, 2058357600 - tz.transition 2035, 10, :o2, 2077106400 - tz.transition 2036, 3, :o3, 2090412000 - tz.transition 2036, 10, :o2, 2108556000 - tz.transition 2037, 3, :o3, 2121861600 - tz.transition 2037, 10, :o2, 2140005600 - tz.transition 2038, 3, :o3, 29586121, 12 - tz.transition 2038, 10, :o2, 29588725, 12 - tz.transition 2039, 3, :o3, 29590489, 12 - tz.transition 2039, 10, :o2, 29593093, 12 - tz.transition 2040, 3, :o3, 29594857, 12 - tz.transition 2040, 10, :o2, 29597461, 12 - tz.transition 2041, 3, :o3, 29599309, 12 - tz.transition 2041, 10, :o2, 29601829, 12 - tz.transition 2042, 3, :o3, 29603677, 12 - tz.transition 2042, 10, :o2, 29606197, 12 - tz.transition 2043, 3, :o3, 29608045, 12 - tz.transition 2043, 10, :o2, 29610565, 12 - tz.transition 2044, 3, :o3, 29612413, 12 - tz.transition 2044, 10, :o2, 29615017, 12 - tz.transition 2045, 3, :o3, 29616781, 12 - tz.transition 2045, 10, :o2, 29619385, 12 - tz.transition 2046, 3, :o3, 29621149, 12 - tz.transition 2046, 10, :o2, 29623753, 12 - tz.transition 2047, 3, :o3, 29625601, 12 - tz.transition 2047, 10, :o2, 29628121, 12 - tz.transition 2048, 3, :o3, 29629969, 12 - tz.transition 2048, 10, :o2, 29632489, 12 - tz.transition 2049, 3, :o3, 29634337, 12 - tz.transition 2049, 10, :o2, 29636941, 12 - tz.transition 2050, 3, :o3, 29638705, 12 - tz.transition 2050, 10, :o2, 29641309, 12 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb deleted file mode 100644 index 4f187b4ad4..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Karachi - include TimezoneDefinition - - timezone 'Asia/Karachi' do |tz| - tz.offset :o0, 16092, 0, :LMT - tz.offset :o1, 19800, 0, :IST - tz.offset :o2, 19800, 3600, :IST - tz.offset :o3, 18000, 0, :KART - tz.offset :o4, 18000, 0, :PKT - tz.offset :o5, 18000, 3600, :PKST - - tz.transition 1906, 12, :o1, 1934061051, 800 - tz.transition 1942, 8, :o2, 116668957, 48 - tz.transition 1945, 10, :o1, 116723675, 48 - tz.transition 1951, 9, :o3, 116828125, 48 - tz.transition 1971, 3, :o4, 38775600 - tz.transition 2002, 4, :o5, 1018119660 - tz.transition 2002, 10, :o4, 1033840860 - tz.transition 2008, 5, :o5, 1212260400 - tz.transition 2008, 10, :o4, 1225476000 - tz.transition 2009, 4, :o5, 1239735600 - tz.transition 2009, 10, :o4, 1257012000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb deleted file mode 100644 index 37b241612e..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Kathmandu - include TimezoneDefinition - - timezone 'Asia/Kathmandu' do |tz| - tz.offset :o0, 20476, 0, :LMT - tz.offset :o1, 19800, 0, :IST - tz.offset :o2, 20700, 0, :NPT - - tz.transition 1919, 12, :o1, 52322204081, 21600 - tz.transition 1985, 12, :o2, 504901800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb deleted file mode 100644 index 1b6ffbd59d..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Kolkata - include TimezoneDefinition - - timezone 'Asia/Kolkata' do |tz| - tz.offset :o0, 21208, 0, :LMT - tz.offset :o1, 21200, 0, :HMT - tz.offset :o2, 23400, 0, :BURT - tz.offset :o3, 19800, 0, :IST - tz.offset :o4, 19800, 3600, :IST - - tz.transition 1879, 12, :o1, 26003324749, 10800 - tz.transition 1941, 9, :o2, 524937943, 216 - tz.transition 1942, 5, :o3, 116663723, 48 - tz.transition 1942, 8, :o4, 116668957, 48 - tz.transition 1945, 10, :o3, 116723675, 48 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb deleted file mode 100644 index d6c503c155..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Krasnoyarsk - include TimezoneDefinition - - timezone 'Asia/Krasnoyarsk' do |tz| - tz.offset :o0, 22280, 0, :LMT - tz.offset :o1, 21600, 0, :KRAT - tz.offset :o2, 25200, 0, :KRAT - tz.offset :o3, 25200, 3600, :KRAST - tz.offset :o4, 21600, 3600, :KRAST - - tz.transition 1920, 1, :o1, 5232231163, 2160 - tz.transition 1930, 6, :o2, 9704593, 4 - tz.transition 1981, 3, :o3, 354906000 - tz.transition 1981, 9, :o2, 370713600 - tz.transition 1982, 3, :o3, 386442000 - tz.transition 1982, 9, :o2, 402249600 - tz.transition 1983, 3, :o3, 417978000 - tz.transition 1983, 9, :o2, 433785600 - tz.transition 1984, 3, :o3, 449600400 - tz.transition 1984, 9, :o2, 465332400 - tz.transition 1985, 3, :o3, 481057200 - tz.transition 1985, 9, :o2, 496782000 - tz.transition 1986, 3, :o3, 512506800 - tz.transition 1986, 9, :o2, 528231600 - tz.transition 1987, 3, :o3, 543956400 - tz.transition 1987, 9, :o2, 559681200 - tz.transition 1988, 3, :o3, 575406000 - tz.transition 1988, 9, :o2, 591130800 - tz.transition 1989, 3, :o3, 606855600 - tz.transition 1989, 9, :o2, 622580400 - tz.transition 1990, 3, :o3, 638305200 - tz.transition 1990, 9, :o2, 654634800 - tz.transition 1991, 3, :o4, 670359600 - tz.transition 1991, 9, :o1, 686088000 - tz.transition 1992, 1, :o2, 695764800 - tz.transition 1992, 3, :o3, 701798400 - tz.transition 1992, 9, :o2, 717519600 - tz.transition 1993, 3, :o3, 733258800 - tz.transition 1993, 9, :o2, 748983600 - tz.transition 1994, 3, :o3, 764708400 - tz.transition 1994, 9, :o2, 780433200 - tz.transition 1995, 3, :o3, 796158000 - tz.transition 1995, 9, :o2, 811882800 - tz.transition 1996, 3, :o3, 828212400 - tz.transition 1996, 10, :o2, 846356400 - tz.transition 1997, 3, :o3, 859662000 - tz.transition 1997, 10, :o2, 877806000 - tz.transition 1998, 3, :o3, 891111600 - tz.transition 1998, 10, :o2, 909255600 - tz.transition 1999, 3, :o3, 922561200 - tz.transition 1999, 10, :o2, 941310000 - tz.transition 2000, 3, :o3, 954010800 - tz.transition 2000, 10, :o2, 972759600 - tz.transition 2001, 3, :o3, 985460400 - tz.transition 2001, 10, :o2, 1004209200 - tz.transition 2002, 3, :o3, 1017514800 - tz.transition 2002, 10, :o2, 1035658800 - tz.transition 2003, 3, :o3, 1048964400 - tz.transition 2003, 10, :o2, 1067108400 - tz.transition 2004, 3, :o3, 1080414000 - tz.transition 2004, 10, :o2, 1099162800 - tz.transition 2005, 3, :o3, 1111863600 - tz.transition 2005, 10, :o2, 1130612400 - tz.transition 2006, 3, :o3, 1143313200 - tz.transition 2006, 10, :o2, 1162062000 - tz.transition 2007, 3, :o3, 1174762800 - tz.transition 2007, 10, :o2, 1193511600 - tz.transition 2008, 3, :o3, 1206817200 - tz.transition 2008, 10, :o2, 1224961200 - tz.transition 2009, 3, :o3, 1238266800 - tz.transition 2009, 10, :o2, 1256410800 - tz.transition 2010, 3, :o3, 1269716400 - tz.transition 2010, 10, :o2, 1288465200 - tz.transition 2011, 3, :o3, 1301166000 - tz.transition 2011, 10, :o2, 1319914800 - tz.transition 2012, 3, :o3, 1332615600 - tz.transition 2012, 10, :o2, 1351364400 - tz.transition 2013, 3, :o3, 1364670000 - tz.transition 2013, 10, :o2, 1382814000 - tz.transition 2014, 3, :o3, 1396119600 - tz.transition 2014, 10, :o2, 1414263600 - tz.transition 2015, 3, :o3, 1427569200 - tz.transition 2015, 10, :o2, 1445713200 - tz.transition 2016, 3, :o3, 1459018800 - tz.transition 2016, 10, :o2, 1477767600 - tz.transition 2017, 3, :o3, 1490468400 - tz.transition 2017, 10, :o2, 1509217200 - tz.transition 2018, 3, :o3, 1521918000 - tz.transition 2018, 10, :o2, 1540666800 - tz.transition 2019, 3, :o3, 1553972400 - tz.transition 2019, 10, :o2, 1572116400 - tz.transition 2020, 3, :o3, 1585422000 - tz.transition 2020, 10, :o2, 1603566000 - tz.transition 2021, 3, :o3, 1616871600 - tz.transition 2021, 10, :o2, 1635620400 - tz.transition 2022, 3, :o3, 1648321200 - tz.transition 2022, 10, :o2, 1667070000 - tz.transition 2023, 3, :o3, 1679770800 - tz.transition 2023, 10, :o2, 1698519600 - tz.transition 2024, 3, :o3, 1711825200 - tz.transition 2024, 10, :o2, 1729969200 - tz.transition 2025, 3, :o3, 1743274800 - tz.transition 2025, 10, :o2, 1761418800 - tz.transition 2026, 3, :o3, 1774724400 - tz.transition 2026, 10, :o2, 1792868400 - tz.transition 2027, 3, :o3, 1806174000 - tz.transition 2027, 10, :o2, 1824922800 - tz.transition 2028, 3, :o3, 1837623600 - tz.transition 2028, 10, :o2, 1856372400 - tz.transition 2029, 3, :o3, 1869073200 - tz.transition 2029, 10, :o2, 1887822000 - tz.transition 2030, 3, :o3, 1901127600 - tz.transition 2030, 10, :o2, 1919271600 - tz.transition 2031, 3, :o3, 1932577200 - tz.transition 2031, 10, :o2, 1950721200 - tz.transition 2032, 3, :o3, 1964026800 - tz.transition 2032, 10, :o2, 1982775600 - tz.transition 2033, 3, :o3, 1995476400 - tz.transition 2033, 10, :o2, 2014225200 - tz.transition 2034, 3, :o3, 2026926000 - tz.transition 2034, 10, :o2, 2045674800 - tz.transition 2035, 3, :o3, 2058375600 - tz.transition 2035, 10, :o2, 2077124400 - tz.transition 2036, 3, :o3, 2090430000 - tz.transition 2036, 10, :o2, 2108574000 - tz.transition 2037, 3, :o3, 2121879600 - tz.transition 2037, 10, :o2, 2140023600 - tz.transition 2038, 3, :o3, 59172247, 24 - tz.transition 2038, 10, :o2, 59177455, 24 - tz.transition 2039, 3, :o3, 59180983, 24 - tz.transition 2039, 10, :o2, 59186191, 24 - tz.transition 2040, 3, :o3, 59189719, 24 - tz.transition 2040, 10, :o2, 59194927, 24 - tz.transition 2041, 3, :o3, 59198623, 24 - tz.transition 2041, 10, :o2, 59203663, 24 - tz.transition 2042, 3, :o3, 59207359, 24 - tz.transition 2042, 10, :o2, 59212399, 24 - tz.transition 2043, 3, :o3, 59216095, 24 - tz.transition 2043, 10, :o2, 59221135, 24 - tz.transition 2044, 3, :o3, 59224831, 24 - tz.transition 2044, 10, :o2, 59230039, 24 - tz.transition 2045, 3, :o3, 59233567, 24 - tz.transition 2045, 10, :o2, 59238775, 24 - tz.transition 2046, 3, :o3, 59242303, 24 - tz.transition 2046, 10, :o2, 59247511, 24 - tz.transition 2047, 3, :o3, 59251207, 24 - tz.transition 2047, 10, :o2, 59256247, 24 - tz.transition 2048, 3, :o3, 59259943, 24 - tz.transition 2048, 10, :o2, 59264983, 24 - tz.transition 2049, 3, :o3, 59268679, 24 - tz.transition 2049, 10, :o2, 59273887, 24 - tz.transition 2050, 3, :o3, 59277415, 24 - tz.transition 2050, 10, :o2, 59282623, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb deleted file mode 100644 index 77a0c206fa..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Kuala_Lumpur - include TimezoneDefinition - - timezone 'Asia/Kuala_Lumpur' do |tz| - tz.offset :o0, 24406, 0, :LMT - tz.offset :o1, 24925, 0, :SMT - tz.offset :o2, 25200, 0, :MALT - tz.offset :o3, 25200, 1200, :MALST - tz.offset :o4, 26400, 0, :MALT - tz.offset :o5, 27000, 0, :MALT - tz.offset :o6, 32400, 0, :JST - tz.offset :o7, 28800, 0, :MYT - - tz.transition 1900, 12, :o1, 104344641397, 43200 - tz.transition 1905, 5, :o2, 8353142363, 3456 - tz.transition 1932, 12, :o3, 58249757, 24 - tz.transition 1935, 12, :o4, 87414055, 36 - tz.transition 1941, 8, :o5, 87488575, 36 - tz.transition 1942, 2, :o6, 38886499, 16 - tz.transition 1945, 9, :o5, 19453681, 8 - tz.transition 1981, 12, :o7, 378664200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb deleted file mode 100644 index 5bd5283197..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Kuwait - include TimezoneDefinition - - timezone 'Asia/Kuwait' do |tz| - tz.offset :o0, 11516, 0, :LMT - tz.offset :o1, 10800, 0, :AST - - tz.transition 1949, 12, :o1, 52558899121, 21600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb deleted file mode 100644 index 302093693e..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Magadan - include TimezoneDefinition - - timezone 'Asia/Magadan' do |tz| - tz.offset :o0, 36192, 0, :LMT - tz.offset :o1, 36000, 0, :MAGT - tz.offset :o2, 39600, 0, :MAGT - tz.offset :o3, 39600, 3600, :MAGST - tz.offset :o4, 36000, 3600, :MAGST - - tz.transition 1924, 5, :o1, 2181516373, 900 - tz.transition 1930, 6, :o2, 29113777, 12 - tz.transition 1981, 3, :o3, 354891600 - tz.transition 1981, 9, :o2, 370699200 - tz.transition 1982, 3, :o3, 386427600 - tz.transition 1982, 9, :o2, 402235200 - tz.transition 1983, 3, :o3, 417963600 - tz.transition 1983, 9, :o2, 433771200 - tz.transition 1984, 3, :o3, 449586000 - tz.transition 1984, 9, :o2, 465318000 - tz.transition 1985, 3, :o3, 481042800 - tz.transition 1985, 9, :o2, 496767600 - tz.transition 1986, 3, :o3, 512492400 - tz.transition 1986, 9, :o2, 528217200 - tz.transition 1987, 3, :o3, 543942000 - tz.transition 1987, 9, :o2, 559666800 - tz.transition 1988, 3, :o3, 575391600 - tz.transition 1988, 9, :o2, 591116400 - tz.transition 1989, 3, :o3, 606841200 - tz.transition 1989, 9, :o2, 622566000 - tz.transition 1990, 3, :o3, 638290800 - tz.transition 1990, 9, :o2, 654620400 - tz.transition 1991, 3, :o4, 670345200 - tz.transition 1991, 9, :o1, 686073600 - tz.transition 1992, 1, :o2, 695750400 - tz.transition 1992, 3, :o3, 701784000 - tz.transition 1992, 9, :o2, 717505200 - tz.transition 1993, 3, :o3, 733244400 - tz.transition 1993, 9, :o2, 748969200 - tz.transition 1994, 3, :o3, 764694000 - tz.transition 1994, 9, :o2, 780418800 - tz.transition 1995, 3, :o3, 796143600 - tz.transition 1995, 9, :o2, 811868400 - tz.transition 1996, 3, :o3, 828198000 - tz.transition 1996, 10, :o2, 846342000 - tz.transition 1997, 3, :o3, 859647600 - tz.transition 1997, 10, :o2, 877791600 - tz.transition 1998, 3, :o3, 891097200 - tz.transition 1998, 10, :o2, 909241200 - tz.transition 1999, 3, :o3, 922546800 - tz.transition 1999, 10, :o2, 941295600 - tz.transition 2000, 3, :o3, 953996400 - tz.transition 2000, 10, :o2, 972745200 - tz.transition 2001, 3, :o3, 985446000 - tz.transition 2001, 10, :o2, 1004194800 - tz.transition 2002, 3, :o3, 1017500400 - tz.transition 2002, 10, :o2, 1035644400 - tz.transition 2003, 3, :o3, 1048950000 - tz.transition 2003, 10, :o2, 1067094000 - tz.transition 2004, 3, :o3, 1080399600 - tz.transition 2004, 10, :o2, 1099148400 - tz.transition 2005, 3, :o3, 1111849200 - tz.transition 2005, 10, :o2, 1130598000 - tz.transition 2006, 3, :o3, 1143298800 - tz.transition 2006, 10, :o2, 1162047600 - tz.transition 2007, 3, :o3, 1174748400 - tz.transition 2007, 10, :o2, 1193497200 - tz.transition 2008, 3, :o3, 1206802800 - tz.transition 2008, 10, :o2, 1224946800 - tz.transition 2009, 3, :o3, 1238252400 - tz.transition 2009, 10, :o2, 1256396400 - tz.transition 2010, 3, :o3, 1269702000 - tz.transition 2010, 10, :o2, 1288450800 - tz.transition 2011, 3, :o3, 1301151600 - tz.transition 2011, 10, :o2, 1319900400 - tz.transition 2012, 3, :o3, 1332601200 - tz.transition 2012, 10, :o2, 1351350000 - tz.transition 2013, 3, :o3, 1364655600 - tz.transition 2013, 10, :o2, 1382799600 - tz.transition 2014, 3, :o3, 1396105200 - tz.transition 2014, 10, :o2, 1414249200 - tz.transition 2015, 3, :o3, 1427554800 - tz.transition 2015, 10, :o2, 1445698800 - tz.transition 2016, 3, :o3, 1459004400 - tz.transition 2016, 10, :o2, 1477753200 - tz.transition 2017, 3, :o3, 1490454000 - tz.transition 2017, 10, :o2, 1509202800 - tz.transition 2018, 3, :o3, 1521903600 - tz.transition 2018, 10, :o2, 1540652400 - tz.transition 2019, 3, :o3, 1553958000 - tz.transition 2019, 10, :o2, 1572102000 - tz.transition 2020, 3, :o3, 1585407600 - tz.transition 2020, 10, :o2, 1603551600 - tz.transition 2021, 3, :o3, 1616857200 - tz.transition 2021, 10, :o2, 1635606000 - tz.transition 2022, 3, :o3, 1648306800 - tz.transition 2022, 10, :o2, 1667055600 - tz.transition 2023, 3, :o3, 1679756400 - tz.transition 2023, 10, :o2, 1698505200 - tz.transition 2024, 3, :o3, 1711810800 - tz.transition 2024, 10, :o2, 1729954800 - tz.transition 2025, 3, :o3, 1743260400 - tz.transition 2025, 10, :o2, 1761404400 - tz.transition 2026, 3, :o3, 1774710000 - tz.transition 2026, 10, :o2, 1792854000 - tz.transition 2027, 3, :o3, 1806159600 - tz.transition 2027, 10, :o2, 1824908400 - tz.transition 2028, 3, :o3, 1837609200 - tz.transition 2028, 10, :o2, 1856358000 - tz.transition 2029, 3, :o3, 1869058800 - tz.transition 2029, 10, :o2, 1887807600 - tz.transition 2030, 3, :o3, 1901113200 - tz.transition 2030, 10, :o2, 1919257200 - tz.transition 2031, 3, :o3, 1932562800 - tz.transition 2031, 10, :o2, 1950706800 - tz.transition 2032, 3, :o3, 1964012400 - tz.transition 2032, 10, :o2, 1982761200 - tz.transition 2033, 3, :o3, 1995462000 - tz.transition 2033, 10, :o2, 2014210800 - tz.transition 2034, 3, :o3, 2026911600 - tz.transition 2034, 10, :o2, 2045660400 - tz.transition 2035, 3, :o3, 2058361200 - tz.transition 2035, 10, :o2, 2077110000 - tz.transition 2036, 3, :o3, 2090415600 - tz.transition 2036, 10, :o2, 2108559600 - tz.transition 2037, 3, :o3, 2121865200 - tz.transition 2037, 10, :o2, 2140009200 - tz.transition 2038, 3, :o3, 19724081, 8 - tz.transition 2038, 10, :o2, 19725817, 8 - tz.transition 2039, 3, :o3, 19726993, 8 - tz.transition 2039, 10, :o2, 19728729, 8 - tz.transition 2040, 3, :o3, 19729905, 8 - tz.transition 2040, 10, :o2, 19731641, 8 - tz.transition 2041, 3, :o3, 19732873, 8 - tz.transition 2041, 10, :o2, 19734553, 8 - tz.transition 2042, 3, :o3, 19735785, 8 - tz.transition 2042, 10, :o2, 19737465, 8 - tz.transition 2043, 3, :o3, 19738697, 8 - tz.transition 2043, 10, :o2, 19740377, 8 - tz.transition 2044, 3, :o3, 19741609, 8 - tz.transition 2044, 10, :o2, 19743345, 8 - tz.transition 2045, 3, :o3, 19744521, 8 - tz.transition 2045, 10, :o2, 19746257, 8 - tz.transition 2046, 3, :o3, 19747433, 8 - tz.transition 2046, 10, :o2, 19749169, 8 - tz.transition 2047, 3, :o3, 19750401, 8 - tz.transition 2047, 10, :o2, 19752081, 8 - tz.transition 2048, 3, :o3, 19753313, 8 - tz.transition 2048, 10, :o2, 19754993, 8 - tz.transition 2049, 3, :o3, 19756225, 8 - tz.transition 2049, 10, :o2, 19757961, 8 - tz.transition 2050, 3, :o3, 19759137, 8 - tz.transition 2050, 10, :o2, 19760873, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb deleted file mode 100644 index 604f651dfa..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Muscat - include TimezoneDefinition - - timezone 'Asia/Muscat' do |tz| - tz.offset :o0, 14060, 0, :LMT - tz.offset :o1, 14400, 0, :GST - - tz.transition 1919, 12, :o1, 10464441137, 4320 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb deleted file mode 100644 index a4e7796e75..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb +++ /dev/null @@ -1,164 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Novosibirsk - include TimezoneDefinition - - timezone 'Asia/Novosibirsk' do |tz| - tz.offset :o0, 19900, 0, :LMT - tz.offset :o1, 21600, 0, :NOVT - tz.offset :o2, 25200, 0, :NOVT - tz.offset :o3, 25200, 3600, :NOVST - tz.offset :o4, 21600, 3600, :NOVST - - tz.transition 1919, 12, :o1, 2092872833, 864 - tz.transition 1930, 6, :o2, 9704593, 4 - tz.transition 1981, 3, :o3, 354906000 - tz.transition 1981, 9, :o2, 370713600 - tz.transition 1982, 3, :o3, 386442000 - tz.transition 1982, 9, :o2, 402249600 - tz.transition 1983, 3, :o3, 417978000 - tz.transition 1983, 9, :o2, 433785600 - tz.transition 1984, 3, :o3, 449600400 - tz.transition 1984, 9, :o2, 465332400 - tz.transition 1985, 3, :o3, 481057200 - tz.transition 1985, 9, :o2, 496782000 - tz.transition 1986, 3, :o3, 512506800 - tz.transition 1986, 9, :o2, 528231600 - tz.transition 1987, 3, :o3, 543956400 - tz.transition 1987, 9, :o2, 559681200 - tz.transition 1988, 3, :o3, 575406000 - tz.transition 1988, 9, :o2, 591130800 - tz.transition 1989, 3, :o3, 606855600 - tz.transition 1989, 9, :o2, 622580400 - tz.transition 1990, 3, :o3, 638305200 - tz.transition 1990, 9, :o2, 654634800 - tz.transition 1991, 3, :o4, 670359600 - tz.transition 1991, 9, :o1, 686088000 - tz.transition 1992, 1, :o2, 695764800 - tz.transition 1992, 3, :o3, 701798400 - tz.transition 1992, 9, :o2, 717519600 - tz.transition 1993, 3, :o3, 733258800 - tz.transition 1993, 5, :o4, 738086400 - tz.transition 1993, 9, :o1, 748987200 - tz.transition 1994, 3, :o4, 764712000 - tz.transition 1994, 9, :o1, 780436800 - tz.transition 1995, 3, :o4, 796161600 - tz.transition 1995, 9, :o1, 811886400 - tz.transition 1996, 3, :o4, 828216000 - tz.transition 1996, 10, :o1, 846360000 - tz.transition 1997, 3, :o4, 859665600 - tz.transition 1997, 10, :o1, 877809600 - tz.transition 1998, 3, :o4, 891115200 - tz.transition 1998, 10, :o1, 909259200 - tz.transition 1999, 3, :o4, 922564800 - tz.transition 1999, 10, :o1, 941313600 - tz.transition 2000, 3, :o4, 954014400 - tz.transition 2000, 10, :o1, 972763200 - tz.transition 2001, 3, :o4, 985464000 - tz.transition 2001, 10, :o1, 1004212800 - tz.transition 2002, 3, :o4, 1017518400 - tz.transition 2002, 10, :o1, 1035662400 - tz.transition 2003, 3, :o4, 1048968000 - tz.transition 2003, 10, :o1, 1067112000 - tz.transition 2004, 3, :o4, 1080417600 - tz.transition 2004, 10, :o1, 1099166400 - tz.transition 2005, 3, :o4, 1111867200 - tz.transition 2005, 10, :o1, 1130616000 - tz.transition 2006, 3, :o4, 1143316800 - tz.transition 2006, 10, :o1, 1162065600 - tz.transition 2007, 3, :o4, 1174766400 - tz.transition 2007, 10, :o1, 1193515200 - tz.transition 2008, 3, :o4, 1206820800 - tz.transition 2008, 10, :o1, 1224964800 - tz.transition 2009, 3, :o4, 1238270400 - tz.transition 2009, 10, :o1, 1256414400 - tz.transition 2010, 3, :o4, 1269720000 - tz.transition 2010, 10, :o1, 1288468800 - tz.transition 2011, 3, :o4, 1301169600 - tz.transition 2011, 10, :o1, 1319918400 - tz.transition 2012, 3, :o4, 1332619200 - tz.transition 2012, 10, :o1, 1351368000 - tz.transition 2013, 3, :o4, 1364673600 - tz.transition 2013, 10, :o1, 1382817600 - tz.transition 2014, 3, :o4, 1396123200 - tz.transition 2014, 10, :o1, 1414267200 - tz.transition 2015, 3, :o4, 1427572800 - tz.transition 2015, 10, :o1, 1445716800 - tz.transition 2016, 3, :o4, 1459022400 - tz.transition 2016, 10, :o1, 1477771200 - tz.transition 2017, 3, :o4, 1490472000 - tz.transition 2017, 10, :o1, 1509220800 - tz.transition 2018, 3, :o4, 1521921600 - tz.transition 2018, 10, :o1, 1540670400 - tz.transition 2019, 3, :o4, 1553976000 - tz.transition 2019, 10, :o1, 1572120000 - tz.transition 2020, 3, :o4, 1585425600 - tz.transition 2020, 10, :o1, 1603569600 - tz.transition 2021, 3, :o4, 1616875200 - tz.transition 2021, 10, :o1, 1635624000 - tz.transition 2022, 3, :o4, 1648324800 - tz.transition 2022, 10, :o1, 1667073600 - tz.transition 2023, 3, :o4, 1679774400 - tz.transition 2023, 10, :o1, 1698523200 - tz.transition 2024, 3, :o4, 1711828800 - tz.transition 2024, 10, :o1, 1729972800 - tz.transition 2025, 3, :o4, 1743278400 - tz.transition 2025, 10, :o1, 1761422400 - tz.transition 2026, 3, :o4, 1774728000 - tz.transition 2026, 10, :o1, 1792872000 - tz.transition 2027, 3, :o4, 1806177600 - tz.transition 2027, 10, :o1, 1824926400 - tz.transition 2028, 3, :o4, 1837627200 - tz.transition 2028, 10, :o1, 1856376000 - tz.transition 2029, 3, :o4, 1869076800 - tz.transition 2029, 10, :o1, 1887825600 - tz.transition 2030, 3, :o4, 1901131200 - tz.transition 2030, 10, :o1, 1919275200 - tz.transition 2031, 3, :o4, 1932580800 - tz.transition 2031, 10, :o1, 1950724800 - tz.transition 2032, 3, :o4, 1964030400 - tz.transition 2032, 10, :o1, 1982779200 - tz.transition 2033, 3, :o4, 1995480000 - tz.transition 2033, 10, :o1, 2014228800 - tz.transition 2034, 3, :o4, 2026929600 - tz.transition 2034, 10, :o1, 2045678400 - tz.transition 2035, 3, :o4, 2058379200 - tz.transition 2035, 10, :o1, 2077128000 - tz.transition 2036, 3, :o4, 2090433600 - tz.transition 2036, 10, :o1, 2108577600 - tz.transition 2037, 3, :o4, 2121883200 - tz.transition 2037, 10, :o1, 2140027200 - tz.transition 2038, 3, :o4, 7396531, 3 - tz.transition 2038, 10, :o1, 7397182, 3 - tz.transition 2039, 3, :o4, 7397623, 3 - tz.transition 2039, 10, :o1, 7398274, 3 - tz.transition 2040, 3, :o4, 7398715, 3 - tz.transition 2040, 10, :o1, 7399366, 3 - tz.transition 2041, 3, :o4, 7399828, 3 - tz.transition 2041, 10, :o1, 7400458, 3 - tz.transition 2042, 3, :o4, 7400920, 3 - tz.transition 2042, 10, :o1, 7401550, 3 - tz.transition 2043, 3, :o4, 7402012, 3 - tz.transition 2043, 10, :o1, 7402642, 3 - tz.transition 2044, 3, :o4, 7403104, 3 - tz.transition 2044, 10, :o1, 7403755, 3 - tz.transition 2045, 3, :o4, 7404196, 3 - tz.transition 2045, 10, :o1, 7404847, 3 - tz.transition 2046, 3, :o4, 7405288, 3 - tz.transition 2046, 10, :o1, 7405939, 3 - tz.transition 2047, 3, :o4, 7406401, 3 - tz.transition 2047, 10, :o1, 7407031, 3 - tz.transition 2048, 3, :o4, 7407493, 3 - tz.transition 2048, 10, :o1, 7408123, 3 - tz.transition 2049, 3, :o4, 7408585, 3 - tz.transition 2049, 10, :o1, 7409236, 3 - tz.transition 2050, 3, :o4, 7409677, 3 - tz.transition 2050, 10, :o1, 7410328, 3 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb deleted file mode 100644 index 759b82d77a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Rangoon - include TimezoneDefinition - - timezone 'Asia/Rangoon' do |tz| - tz.offset :o0, 23080, 0, :LMT - tz.offset :o1, 23076, 0, :RMT - tz.offset :o2, 23400, 0, :BURT - tz.offset :o3, 32400, 0, :JST - tz.offset :o4, 23400, 0, :MMT - - tz.transition 1879, 12, :o1, 5200664903, 2160 - tz.transition 1919, 12, :o2, 5813578159, 2400 - tz.transition 1942, 4, :o3, 116663051, 48 - tz.transition 1945, 5, :o4, 19452625, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb deleted file mode 100644 index 7add410620..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Riyadh - include TimezoneDefinition - - timezone 'Asia/Riyadh' do |tz| - tz.offset :o0, 11212, 0, :LMT - tz.offset :o1, 10800, 0, :AST - - tz.transition 1949, 12, :o1, 52558899197, 21600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb deleted file mode 100644 index 795d2a75df..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Seoul - include TimezoneDefinition - - timezone 'Asia/Seoul' do |tz| - tz.offset :o0, 30472, 0, :LMT - tz.offset :o1, 30600, 0, :KST - tz.offset :o2, 32400, 0, :KST - tz.offset :o3, 28800, 0, :KST - tz.offset :o4, 28800, 3600, :KDT - tz.offset :o5, 32400, 3600, :KDT - - tz.transition 1889, 12, :o1, 26042775991, 10800 - tz.transition 1904, 11, :o2, 116007127, 48 - tz.transition 1927, 12, :o1, 19401969, 8 - tz.transition 1931, 12, :o2, 116481943, 48 - tz.transition 1954, 3, :o3, 19478577, 8 - tz.transition 1960, 5, :o4, 14622415, 6 - tz.transition 1960, 9, :o3, 19497521, 8 - tz.transition 1961, 8, :o1, 14625127, 6 - tz.transition 1968, 9, :o2, 117126247, 48 - tz.transition 1987, 5, :o5, 547570800 - tz.transition 1987, 10, :o2, 560872800 - tz.transition 1988, 5, :o5, 579020400 - tz.transition 1988, 10, :o2, 592322400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb deleted file mode 100644 index 34b13d59ae..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Shanghai - include TimezoneDefinition - - timezone 'Asia/Shanghai' do |tz| - tz.offset :o0, 29152, 0, :LMT - tz.offset :o1, 28800, 0, :CST - tz.offset :o2, 28800, 3600, :CDT - - tz.transition 1927, 12, :o1, 6548164639, 2700 - tz.transition 1940, 6, :o2, 14578699, 6 - tz.transition 1940, 9, :o1, 19439225, 8 - tz.transition 1941, 3, :o2, 14580415, 6 - tz.transition 1941, 9, :o1, 19442145, 8 - tz.transition 1986, 5, :o2, 515520000 - tz.transition 1986, 9, :o1, 527007600 - tz.transition 1987, 4, :o2, 545155200 - tz.transition 1987, 9, :o1, 558457200 - tz.transition 1988, 4, :o2, 576604800 - tz.transition 1988, 9, :o1, 589906800 - tz.transition 1989, 4, :o2, 608659200 - tz.transition 1989, 9, :o1, 621961200 - tz.transition 1990, 4, :o2, 640108800 - tz.transition 1990, 9, :o1, 653410800 - tz.transition 1991, 4, :o2, 671558400 - tz.transition 1991, 9, :o1, 684860400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb deleted file mode 100644 index b323a78f74..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Singapore - include TimezoneDefinition - - timezone 'Asia/Singapore' do |tz| - tz.offset :o0, 24925, 0, :LMT - tz.offset :o1, 24925, 0, :SMT - tz.offset :o2, 25200, 0, :MALT - tz.offset :o3, 25200, 1200, :MALST - tz.offset :o4, 26400, 0, :MALT - tz.offset :o5, 27000, 0, :MALT - tz.offset :o6, 32400, 0, :JST - tz.offset :o7, 27000, 0, :SGT - tz.offset :o8, 28800, 0, :SGT - - tz.transition 1900, 12, :o1, 8347571291, 3456 - tz.transition 1905, 5, :o2, 8353142363, 3456 - tz.transition 1932, 12, :o3, 58249757, 24 - tz.transition 1935, 12, :o4, 87414055, 36 - tz.transition 1941, 8, :o5, 87488575, 36 - tz.transition 1942, 2, :o6, 38886499, 16 - tz.transition 1945, 9, :o5, 19453681, 8 - tz.transition 1965, 8, :o7, 39023699, 16 - tz.transition 1981, 12, :o8, 378664200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb deleted file mode 100644 index 3ba12108fb..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Taipei - include TimezoneDefinition - - timezone 'Asia/Taipei' do |tz| - tz.offset :o0, 29160, 0, :LMT - tz.offset :o1, 28800, 0, :CST - tz.offset :o2, 28800, 3600, :CDT - - tz.transition 1895, 12, :o1, 193084733, 80 - tz.transition 1945, 4, :o2, 14589457, 6 - tz.transition 1945, 9, :o1, 19453833, 8 - tz.transition 1946, 4, :o2, 14591647, 6 - tz.transition 1946, 9, :o1, 19456753, 8 - tz.transition 1947, 4, :o2, 14593837, 6 - tz.transition 1947, 9, :o1, 19459673, 8 - tz.transition 1948, 4, :o2, 14596033, 6 - tz.transition 1948, 9, :o1, 19462601, 8 - tz.transition 1949, 4, :o2, 14598223, 6 - tz.transition 1949, 9, :o1, 19465521, 8 - tz.transition 1950, 4, :o2, 14600413, 6 - tz.transition 1950, 9, :o1, 19468441, 8 - tz.transition 1951, 4, :o2, 14602603, 6 - tz.transition 1951, 9, :o1, 19471361, 8 - tz.transition 1952, 2, :o2, 14604433, 6 - tz.transition 1952, 10, :o1, 19474537, 8 - tz.transition 1953, 3, :o2, 14606809, 6 - tz.transition 1953, 10, :o1, 19477457, 8 - tz.transition 1954, 3, :o2, 14608999, 6 - tz.transition 1954, 10, :o1, 19480377, 8 - tz.transition 1955, 3, :o2, 14611189, 6 - tz.transition 1955, 9, :o1, 19483049, 8 - tz.transition 1956, 3, :o2, 14613385, 6 - tz.transition 1956, 9, :o1, 19485977, 8 - tz.transition 1957, 3, :o2, 14615575, 6 - tz.transition 1957, 9, :o1, 19488897, 8 - tz.transition 1958, 3, :o2, 14617765, 6 - tz.transition 1958, 9, :o1, 19491817, 8 - tz.transition 1959, 3, :o2, 14619955, 6 - tz.transition 1959, 9, :o1, 19494737, 8 - tz.transition 1960, 5, :o2, 14622517, 6 - tz.transition 1960, 9, :o1, 19497665, 8 - tz.transition 1961, 5, :o2, 14624707, 6 - tz.transition 1961, 9, :o1, 19500585, 8 - tz.transition 1974, 3, :o2, 133977600 - tz.transition 1974, 9, :o1, 149785200 - tz.transition 1975, 3, :o2, 165513600 - tz.transition 1975, 9, :o1, 181321200 - tz.transition 1980, 6, :o2, 331142400 - tz.transition 1980, 9, :o1, 339087600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb deleted file mode 100644 index c205c7934d..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Tashkent - include TimezoneDefinition - - timezone 'Asia/Tashkent' do |tz| - tz.offset :o0, 16632, 0, :LMT - tz.offset :o1, 18000, 0, :TAST - tz.offset :o2, 21600, 0, :TAST - tz.offset :o3, 21600, 3600, :TASST - tz.offset :o4, 18000, 3600, :TASST - tz.offset :o5, 18000, 3600, :UZST - tz.offset :o6, 18000, 0, :UZT - - tz.transition 1924, 5, :o1, 969562923, 400 - tz.transition 1930, 6, :o2, 58227559, 24 - tz.transition 1981, 3, :o3, 354909600 - tz.transition 1981, 9, :o2, 370717200 - tz.transition 1982, 3, :o3, 386445600 - tz.transition 1982, 9, :o2, 402253200 - tz.transition 1983, 3, :o3, 417981600 - tz.transition 1983, 9, :o2, 433789200 - tz.transition 1984, 3, :o3, 449604000 - tz.transition 1984, 9, :o2, 465336000 - tz.transition 1985, 3, :o3, 481060800 - tz.transition 1985, 9, :o2, 496785600 - tz.transition 1986, 3, :o3, 512510400 - tz.transition 1986, 9, :o2, 528235200 - tz.transition 1987, 3, :o3, 543960000 - tz.transition 1987, 9, :o2, 559684800 - tz.transition 1988, 3, :o3, 575409600 - tz.transition 1988, 9, :o2, 591134400 - tz.transition 1989, 3, :o3, 606859200 - tz.transition 1989, 9, :o2, 622584000 - tz.transition 1990, 3, :o3, 638308800 - tz.transition 1990, 9, :o2, 654638400 - tz.transition 1991, 3, :o4, 670363200 - tz.transition 1991, 8, :o5, 683661600 - tz.transition 1991, 9, :o6, 686091600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb deleted file mode 100644 index 15792a5651..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb +++ /dev/null @@ -1,78 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Tbilisi - include TimezoneDefinition - - timezone 'Asia/Tbilisi' do |tz| - tz.offset :o0, 10756, 0, :LMT - tz.offset :o1, 10756, 0, :TBMT - tz.offset :o2, 10800, 0, :TBIT - tz.offset :o3, 14400, 0, :TBIT - tz.offset :o4, 14400, 3600, :TBIST - tz.offset :o5, 10800, 3600, :TBIST - tz.offset :o6, 10800, 3600, :GEST - tz.offset :o7, 10800, 0, :GET - tz.offset :o8, 14400, 0, :GET - tz.offset :o9, 14400, 3600, :GEST - - tz.transition 1879, 12, :o1, 52006652111, 21600 - tz.transition 1924, 5, :o2, 52356399311, 21600 - tz.transition 1957, 2, :o3, 19487187, 8 - tz.transition 1981, 3, :o4, 354916800 - tz.transition 1981, 9, :o3, 370724400 - tz.transition 1982, 3, :o4, 386452800 - tz.transition 1982, 9, :o3, 402260400 - tz.transition 1983, 3, :o4, 417988800 - tz.transition 1983, 9, :o3, 433796400 - tz.transition 1984, 3, :o4, 449611200 - tz.transition 1984, 9, :o3, 465343200 - tz.transition 1985, 3, :o4, 481068000 - tz.transition 1985, 9, :o3, 496792800 - tz.transition 1986, 3, :o4, 512517600 - tz.transition 1986, 9, :o3, 528242400 - tz.transition 1987, 3, :o4, 543967200 - tz.transition 1987, 9, :o3, 559692000 - tz.transition 1988, 3, :o4, 575416800 - tz.transition 1988, 9, :o3, 591141600 - tz.transition 1989, 3, :o4, 606866400 - tz.transition 1989, 9, :o3, 622591200 - tz.transition 1990, 3, :o4, 638316000 - tz.transition 1990, 9, :o3, 654645600 - tz.transition 1991, 3, :o5, 670370400 - tz.transition 1991, 4, :o6, 671140800 - tz.transition 1991, 9, :o7, 686098800 - tz.transition 1992, 3, :o6, 701816400 - tz.transition 1992, 9, :o7, 717537600 - tz.transition 1993, 3, :o6, 733266000 - tz.transition 1993, 9, :o7, 748987200 - tz.transition 1994, 3, :o6, 764715600 - tz.transition 1994, 9, :o8, 780436800 - tz.transition 1995, 3, :o9, 796161600 - tz.transition 1995, 9, :o8, 811882800 - tz.transition 1996, 3, :o9, 828216000 - tz.transition 1997, 3, :o9, 859662000 - tz.transition 1997, 10, :o8, 877806000 - tz.transition 1998, 3, :o9, 891115200 - tz.transition 1998, 10, :o8, 909255600 - tz.transition 1999, 3, :o9, 922564800 - tz.transition 1999, 10, :o8, 941310000 - tz.transition 2000, 3, :o9, 954014400 - tz.transition 2000, 10, :o8, 972759600 - tz.transition 2001, 3, :o9, 985464000 - tz.transition 2001, 10, :o8, 1004209200 - tz.transition 2002, 3, :o9, 1017518400 - tz.transition 2002, 10, :o8, 1035658800 - tz.transition 2003, 3, :o9, 1048968000 - tz.transition 2003, 10, :o8, 1067108400 - tz.transition 2004, 3, :o9, 1080417600 - tz.transition 2004, 6, :o6, 1088276400 - tz.transition 2004, 10, :o7, 1099177200 - tz.transition 2005, 3, :o8, 1111878000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb deleted file mode 100644 index d8df964a46..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Tehran - include TimezoneDefinition - - timezone 'Asia/Tehran' do |tz| - tz.offset :o0, 12344, 0, :LMT - tz.offset :o1, 12344, 0, :TMT - tz.offset :o2, 12600, 0, :IRST - tz.offset :o3, 14400, 0, :IRST - tz.offset :o4, 14400, 3600, :IRDT - tz.offset :o5, 12600, 3600, :IRDT - - tz.transition 1915, 12, :o1, 26145324257, 10800 - tz.transition 1945, 12, :o2, 26263670657, 10800 - tz.transition 1977, 10, :o3, 247177800 - tz.transition 1978, 3, :o4, 259272000 - tz.transition 1978, 10, :o3, 277758000 - tz.transition 1978, 12, :o2, 283982400 - tz.transition 1979, 3, :o5, 290809800 - tz.transition 1979, 9, :o2, 306531000 - tz.transition 1980, 3, :o5, 322432200 - tz.transition 1980, 9, :o2, 338499000 - tz.transition 1991, 5, :o5, 673216200 - tz.transition 1991, 9, :o2, 685481400 - tz.transition 1992, 3, :o5, 701209800 - tz.transition 1992, 9, :o2, 717103800 - tz.transition 1993, 3, :o5, 732745800 - tz.transition 1993, 9, :o2, 748639800 - tz.transition 1994, 3, :o5, 764281800 - tz.transition 1994, 9, :o2, 780175800 - tz.transition 1995, 3, :o5, 795817800 - tz.transition 1995, 9, :o2, 811711800 - tz.transition 1996, 3, :o5, 827353800 - tz.transition 1996, 9, :o2, 843247800 - tz.transition 1997, 3, :o5, 858976200 - tz.transition 1997, 9, :o2, 874870200 - tz.transition 1998, 3, :o5, 890512200 - tz.transition 1998, 9, :o2, 906406200 - tz.transition 1999, 3, :o5, 922048200 - tz.transition 1999, 9, :o2, 937942200 - tz.transition 2000, 3, :o5, 953584200 - tz.transition 2000, 9, :o2, 969478200 - tz.transition 2001, 3, :o5, 985206600 - tz.transition 2001, 9, :o2, 1001100600 - tz.transition 2002, 3, :o5, 1016742600 - tz.transition 2002, 9, :o2, 1032636600 - tz.transition 2003, 3, :o5, 1048278600 - tz.transition 2003, 9, :o2, 1064172600 - tz.transition 2004, 3, :o5, 1079814600 - tz.transition 2004, 9, :o2, 1095708600 - tz.transition 2005, 3, :o5, 1111437000 - tz.transition 2005, 9, :o2, 1127331000 - tz.transition 2008, 3, :o5, 1206045000 - tz.transition 2008, 9, :o2, 1221939000 - tz.transition 2009, 3, :o5, 1237667400 - tz.transition 2009, 9, :o2, 1253561400 - tz.transition 2010, 3, :o5, 1269203400 - tz.transition 2010, 9, :o2, 1285097400 - tz.transition 2011, 3, :o5, 1300739400 - tz.transition 2011, 9, :o2, 1316633400 - tz.transition 2012, 3, :o5, 1332275400 - tz.transition 2012, 9, :o2, 1348169400 - tz.transition 2013, 3, :o5, 1363897800 - tz.transition 2013, 9, :o2, 1379791800 - tz.transition 2014, 3, :o5, 1395433800 - tz.transition 2014, 9, :o2, 1411327800 - tz.transition 2015, 3, :o5, 1426969800 - tz.transition 2015, 9, :o2, 1442863800 - tz.transition 2016, 3, :o5, 1458505800 - tz.transition 2016, 9, :o2, 1474399800 - tz.transition 2017, 3, :o5, 1490128200 - tz.transition 2017, 9, :o2, 1506022200 - tz.transition 2018, 3, :o5, 1521664200 - tz.transition 2018, 9, :o2, 1537558200 - tz.transition 2019, 3, :o5, 1553200200 - tz.transition 2019, 9, :o2, 1569094200 - tz.transition 2020, 3, :o5, 1584736200 - tz.transition 2020, 9, :o2, 1600630200 - tz.transition 2021, 3, :o5, 1616358600 - tz.transition 2021, 9, :o2, 1632252600 - tz.transition 2022, 3, :o5, 1647894600 - tz.transition 2022, 9, :o2, 1663788600 - tz.transition 2023, 3, :o5, 1679430600 - tz.transition 2023, 9, :o2, 1695324600 - tz.transition 2024, 3, :o5, 1710966600 - tz.transition 2024, 9, :o2, 1726860600 - tz.transition 2025, 3, :o5, 1742589000 - tz.transition 2025, 9, :o2, 1758483000 - tz.transition 2026, 3, :o5, 1774125000 - tz.transition 2026, 9, :o2, 1790019000 - tz.transition 2027, 3, :o5, 1805661000 - tz.transition 2027, 9, :o2, 1821555000 - tz.transition 2028, 3, :o5, 1837197000 - tz.transition 2028, 9, :o2, 1853091000 - tz.transition 2029, 3, :o5, 1868733000 - tz.transition 2029, 9, :o2, 1884627000 - tz.transition 2030, 3, :o5, 1900355400 - tz.transition 2030, 9, :o2, 1916249400 - tz.transition 2031, 3, :o5, 1931891400 - tz.transition 2031, 9, :o2, 1947785400 - tz.transition 2032, 3, :o5, 1963427400 - tz.transition 2032, 9, :o2, 1979321400 - tz.transition 2033, 3, :o5, 1994963400 - tz.transition 2033, 9, :o2, 2010857400 - tz.transition 2034, 3, :o5, 2026585800 - tz.transition 2034, 9, :o2, 2042479800 - tz.transition 2035, 3, :o5, 2058121800 - tz.transition 2035, 9, :o2, 2074015800 - tz.transition 2036, 3, :o5, 2089657800 - tz.transition 2036, 9, :o2, 2105551800 - tz.transition 2037, 3, :o5, 2121193800 - tz.transition 2037, 9, :o2, 2137087800 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb deleted file mode 100644 index 51c9e16421..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Tokyo - include TimezoneDefinition - - timezone 'Asia/Tokyo' do |tz| - tz.offset :o0, 33539, 0, :LMT - tz.offset :o1, 32400, 0, :JST - tz.offset :o2, 32400, 0, :CJT - tz.offset :o3, 32400, 3600, :JDT - - tz.transition 1887, 12, :o1, 19285097, 8 - tz.transition 1895, 12, :o2, 19308473, 8 - tz.transition 1937, 12, :o1, 19431193, 8 - tz.transition 1948, 5, :o3, 58384157, 24 - tz.transition 1948, 9, :o1, 14596831, 6 - tz.transition 1949, 4, :o3, 58392221, 24 - tz.transition 1949, 9, :o1, 14599015, 6 - tz.transition 1950, 5, :o3, 58401797, 24 - tz.transition 1950, 9, :o1, 14601199, 6 - tz.transition 1951, 5, :o3, 58410533, 24 - tz.transition 1951, 9, :o1, 14603383, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb deleted file mode 100644 index 2854f5c5fd..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Ulaanbaatar - include TimezoneDefinition - - timezone 'Asia/Ulaanbaatar' do |tz| - tz.offset :o0, 25652, 0, :LMT - tz.offset :o1, 25200, 0, :ULAT - tz.offset :o2, 28800, 0, :ULAT - tz.offset :o3, 28800, 3600, :ULAST - - tz.transition 1905, 7, :o1, 52208457187, 21600 - tz.transition 1977, 12, :o2, 252435600 - tz.transition 1983, 3, :o3, 417974400 - tz.transition 1983, 9, :o2, 433782000 - tz.transition 1984, 3, :o3, 449596800 - tz.transition 1984, 9, :o2, 465318000 - tz.transition 1985, 3, :o3, 481046400 - tz.transition 1985, 9, :o2, 496767600 - tz.transition 1986, 3, :o3, 512496000 - tz.transition 1986, 9, :o2, 528217200 - tz.transition 1987, 3, :o3, 543945600 - tz.transition 1987, 9, :o2, 559666800 - tz.transition 1988, 3, :o3, 575395200 - tz.transition 1988, 9, :o2, 591116400 - tz.transition 1989, 3, :o3, 606844800 - tz.transition 1989, 9, :o2, 622566000 - tz.transition 1990, 3, :o3, 638294400 - tz.transition 1990, 9, :o2, 654620400 - tz.transition 1991, 3, :o3, 670348800 - tz.transition 1991, 9, :o2, 686070000 - tz.transition 1992, 3, :o3, 701798400 - tz.transition 1992, 9, :o2, 717519600 - tz.transition 1993, 3, :o3, 733248000 - tz.transition 1993, 9, :o2, 748969200 - tz.transition 1994, 3, :o3, 764697600 - tz.transition 1994, 9, :o2, 780418800 - tz.transition 1995, 3, :o3, 796147200 - tz.transition 1995, 9, :o2, 811868400 - tz.transition 1996, 3, :o3, 828201600 - tz.transition 1996, 9, :o2, 843922800 - tz.transition 1997, 3, :o3, 859651200 - tz.transition 1997, 9, :o2, 875372400 - tz.transition 1998, 3, :o3, 891100800 - tz.transition 1998, 9, :o2, 906822000 - tz.transition 2001, 4, :o3, 988394400 - tz.transition 2001, 9, :o2, 1001696400 - tz.transition 2002, 3, :o3, 1017424800 - tz.transition 2002, 9, :o2, 1033146000 - tz.transition 2003, 3, :o3, 1048874400 - tz.transition 2003, 9, :o2, 1064595600 - tz.transition 2004, 3, :o3, 1080324000 - tz.transition 2004, 9, :o2, 1096045200 - tz.transition 2005, 3, :o3, 1111773600 - tz.transition 2005, 9, :o2, 1127494800 - tz.transition 2006, 3, :o3, 1143223200 - tz.transition 2006, 9, :o2, 1159549200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb deleted file mode 100644 index d793ff1341..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Urumqi - include TimezoneDefinition - - timezone 'Asia/Urumqi' do |tz| - tz.offset :o0, 21020, 0, :LMT - tz.offset :o1, 21600, 0, :URUT - tz.offset :o2, 28800, 0, :CST - tz.offset :o3, 28800, 3600, :CDT - - tz.transition 1927, 12, :o1, 10477063829, 4320 - tz.transition 1980, 4, :o2, 325965600 - tz.transition 1986, 5, :o3, 515520000 - tz.transition 1986, 9, :o2, 527007600 - tz.transition 1987, 4, :o3, 545155200 - tz.transition 1987, 9, :o2, 558457200 - tz.transition 1988, 4, :o3, 576604800 - tz.transition 1988, 9, :o2, 589906800 - tz.transition 1989, 4, :o3, 608659200 - tz.transition 1989, 9, :o2, 621961200 - tz.transition 1990, 4, :o3, 640108800 - tz.transition 1990, 9, :o2, 653410800 - tz.transition 1991, 4, :o3, 671558400 - tz.transition 1991, 9, :o2, 684860400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb deleted file mode 100644 index bd9e3d60ec..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb +++ /dev/null @@ -1,164 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Vladivostok - include TimezoneDefinition - - timezone 'Asia/Vladivostok' do |tz| - tz.offset :o0, 31664, 0, :LMT - tz.offset :o1, 32400, 0, :VLAT - tz.offset :o2, 36000, 0, :VLAT - tz.offset :o3, 36000, 3600, :VLAST - tz.offset :o4, 32400, 3600, :VLASST - tz.offset :o5, 32400, 0, :VLAST - - tz.transition 1922, 11, :o1, 13086214921, 5400 - tz.transition 1930, 6, :o2, 19409185, 8 - tz.transition 1981, 3, :o3, 354895200 - tz.transition 1981, 9, :o2, 370702800 - tz.transition 1982, 3, :o3, 386431200 - tz.transition 1982, 9, :o2, 402238800 - tz.transition 1983, 3, :o3, 417967200 - tz.transition 1983, 9, :o2, 433774800 - tz.transition 1984, 3, :o3, 449589600 - tz.transition 1984, 9, :o2, 465321600 - tz.transition 1985, 3, :o3, 481046400 - tz.transition 1985, 9, :o2, 496771200 - tz.transition 1986, 3, :o3, 512496000 - tz.transition 1986, 9, :o2, 528220800 - tz.transition 1987, 3, :o3, 543945600 - tz.transition 1987, 9, :o2, 559670400 - tz.transition 1988, 3, :o3, 575395200 - tz.transition 1988, 9, :o2, 591120000 - tz.transition 1989, 3, :o3, 606844800 - tz.transition 1989, 9, :o2, 622569600 - tz.transition 1990, 3, :o3, 638294400 - tz.transition 1990, 9, :o2, 654624000 - tz.transition 1991, 3, :o4, 670348800 - tz.transition 1991, 9, :o5, 686077200 - tz.transition 1992, 1, :o2, 695754000 - tz.transition 1992, 3, :o3, 701787600 - tz.transition 1992, 9, :o2, 717508800 - tz.transition 1993, 3, :o3, 733248000 - tz.transition 1993, 9, :o2, 748972800 - tz.transition 1994, 3, :o3, 764697600 - tz.transition 1994, 9, :o2, 780422400 - tz.transition 1995, 3, :o3, 796147200 - tz.transition 1995, 9, :o2, 811872000 - tz.transition 1996, 3, :o3, 828201600 - tz.transition 1996, 10, :o2, 846345600 - tz.transition 1997, 3, :o3, 859651200 - tz.transition 1997, 10, :o2, 877795200 - tz.transition 1998, 3, :o3, 891100800 - tz.transition 1998, 10, :o2, 909244800 - tz.transition 1999, 3, :o3, 922550400 - tz.transition 1999, 10, :o2, 941299200 - tz.transition 2000, 3, :o3, 954000000 - tz.transition 2000, 10, :o2, 972748800 - tz.transition 2001, 3, :o3, 985449600 - tz.transition 2001, 10, :o2, 1004198400 - tz.transition 2002, 3, :o3, 1017504000 - tz.transition 2002, 10, :o2, 1035648000 - tz.transition 2003, 3, :o3, 1048953600 - tz.transition 2003, 10, :o2, 1067097600 - tz.transition 2004, 3, :o3, 1080403200 - tz.transition 2004, 10, :o2, 1099152000 - tz.transition 2005, 3, :o3, 1111852800 - tz.transition 2005, 10, :o2, 1130601600 - tz.transition 2006, 3, :o3, 1143302400 - tz.transition 2006, 10, :o2, 1162051200 - tz.transition 2007, 3, :o3, 1174752000 - tz.transition 2007, 10, :o2, 1193500800 - tz.transition 2008, 3, :o3, 1206806400 - tz.transition 2008, 10, :o2, 1224950400 - tz.transition 2009, 3, :o3, 1238256000 - tz.transition 2009, 10, :o2, 1256400000 - tz.transition 2010, 3, :o3, 1269705600 - tz.transition 2010, 10, :o2, 1288454400 - tz.transition 2011, 3, :o3, 1301155200 - tz.transition 2011, 10, :o2, 1319904000 - tz.transition 2012, 3, :o3, 1332604800 - tz.transition 2012, 10, :o2, 1351353600 - tz.transition 2013, 3, :o3, 1364659200 - tz.transition 2013, 10, :o2, 1382803200 - tz.transition 2014, 3, :o3, 1396108800 - tz.transition 2014, 10, :o2, 1414252800 - tz.transition 2015, 3, :o3, 1427558400 - tz.transition 2015, 10, :o2, 1445702400 - tz.transition 2016, 3, :o3, 1459008000 - tz.transition 2016, 10, :o2, 1477756800 - tz.transition 2017, 3, :o3, 1490457600 - tz.transition 2017, 10, :o2, 1509206400 - tz.transition 2018, 3, :o3, 1521907200 - tz.transition 2018, 10, :o2, 1540656000 - tz.transition 2019, 3, :o3, 1553961600 - tz.transition 2019, 10, :o2, 1572105600 - tz.transition 2020, 3, :o3, 1585411200 - tz.transition 2020, 10, :o2, 1603555200 - tz.transition 2021, 3, :o3, 1616860800 - tz.transition 2021, 10, :o2, 1635609600 - tz.transition 2022, 3, :o3, 1648310400 - tz.transition 2022, 10, :o2, 1667059200 - tz.transition 2023, 3, :o3, 1679760000 - tz.transition 2023, 10, :o2, 1698508800 - tz.transition 2024, 3, :o3, 1711814400 - tz.transition 2024, 10, :o2, 1729958400 - tz.transition 2025, 3, :o3, 1743264000 - tz.transition 2025, 10, :o2, 1761408000 - tz.transition 2026, 3, :o3, 1774713600 - tz.transition 2026, 10, :o2, 1792857600 - tz.transition 2027, 3, :o3, 1806163200 - tz.transition 2027, 10, :o2, 1824912000 - tz.transition 2028, 3, :o3, 1837612800 - tz.transition 2028, 10, :o2, 1856361600 - tz.transition 2029, 3, :o3, 1869062400 - tz.transition 2029, 10, :o2, 1887811200 - tz.transition 2030, 3, :o3, 1901116800 - tz.transition 2030, 10, :o2, 1919260800 - tz.transition 2031, 3, :o3, 1932566400 - tz.transition 2031, 10, :o2, 1950710400 - tz.transition 2032, 3, :o3, 1964016000 - tz.transition 2032, 10, :o2, 1982764800 - tz.transition 2033, 3, :o3, 1995465600 - tz.transition 2033, 10, :o2, 2014214400 - tz.transition 2034, 3, :o3, 2026915200 - tz.transition 2034, 10, :o2, 2045664000 - tz.transition 2035, 3, :o3, 2058364800 - tz.transition 2035, 10, :o2, 2077113600 - tz.transition 2036, 3, :o3, 2090419200 - tz.transition 2036, 10, :o2, 2108563200 - tz.transition 2037, 3, :o3, 2121868800 - tz.transition 2037, 10, :o2, 2140012800 - tz.transition 2038, 3, :o3, 14793061, 6 - tz.transition 2038, 10, :o2, 14794363, 6 - tz.transition 2039, 3, :o3, 14795245, 6 - tz.transition 2039, 10, :o2, 14796547, 6 - tz.transition 2040, 3, :o3, 14797429, 6 - tz.transition 2040, 10, :o2, 14798731, 6 - tz.transition 2041, 3, :o3, 14799655, 6 - tz.transition 2041, 10, :o2, 14800915, 6 - tz.transition 2042, 3, :o3, 14801839, 6 - tz.transition 2042, 10, :o2, 14803099, 6 - tz.transition 2043, 3, :o3, 14804023, 6 - tz.transition 2043, 10, :o2, 14805283, 6 - tz.transition 2044, 3, :o3, 14806207, 6 - tz.transition 2044, 10, :o2, 14807509, 6 - tz.transition 2045, 3, :o3, 14808391, 6 - tz.transition 2045, 10, :o2, 14809693, 6 - tz.transition 2046, 3, :o3, 14810575, 6 - tz.transition 2046, 10, :o2, 14811877, 6 - tz.transition 2047, 3, :o3, 14812801, 6 - tz.transition 2047, 10, :o2, 14814061, 6 - tz.transition 2048, 3, :o3, 14814985, 6 - tz.transition 2048, 10, :o2, 14816245, 6 - tz.transition 2049, 3, :o3, 14817169, 6 - tz.transition 2049, 10, :o2, 14818471, 6 - tz.transition 2050, 3, :o3, 14819353, 6 - tz.transition 2050, 10, :o2, 14820655, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb deleted file mode 100644 index 56435a788f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Yakutsk - include TimezoneDefinition - - timezone 'Asia/Yakutsk' do |tz| - tz.offset :o0, 31120, 0, :LMT - tz.offset :o1, 28800, 0, :YAKT - tz.offset :o2, 32400, 0, :YAKT - tz.offset :o3, 32400, 3600, :YAKST - tz.offset :o4, 28800, 3600, :YAKST - - tz.transition 1919, 12, :o1, 2616091711, 1080 - tz.transition 1930, 6, :o2, 14556889, 6 - tz.transition 1981, 3, :o3, 354898800 - tz.transition 1981, 9, :o2, 370706400 - tz.transition 1982, 3, :o3, 386434800 - tz.transition 1982, 9, :o2, 402242400 - tz.transition 1983, 3, :o3, 417970800 - tz.transition 1983, 9, :o2, 433778400 - tz.transition 1984, 3, :o3, 449593200 - tz.transition 1984, 9, :o2, 465325200 - tz.transition 1985, 3, :o3, 481050000 - tz.transition 1985, 9, :o2, 496774800 - tz.transition 1986, 3, :o3, 512499600 - tz.transition 1986, 9, :o2, 528224400 - tz.transition 1987, 3, :o3, 543949200 - tz.transition 1987, 9, :o2, 559674000 - tz.transition 1988, 3, :o3, 575398800 - tz.transition 1988, 9, :o2, 591123600 - tz.transition 1989, 3, :o3, 606848400 - tz.transition 1989, 9, :o2, 622573200 - tz.transition 1990, 3, :o3, 638298000 - tz.transition 1990, 9, :o2, 654627600 - tz.transition 1991, 3, :o4, 670352400 - tz.transition 1991, 9, :o1, 686080800 - tz.transition 1992, 1, :o2, 695757600 - tz.transition 1992, 3, :o3, 701791200 - tz.transition 1992, 9, :o2, 717512400 - tz.transition 1993, 3, :o3, 733251600 - tz.transition 1993, 9, :o2, 748976400 - tz.transition 1994, 3, :o3, 764701200 - tz.transition 1994, 9, :o2, 780426000 - tz.transition 1995, 3, :o3, 796150800 - tz.transition 1995, 9, :o2, 811875600 - tz.transition 1996, 3, :o3, 828205200 - tz.transition 1996, 10, :o2, 846349200 - tz.transition 1997, 3, :o3, 859654800 - tz.transition 1997, 10, :o2, 877798800 - tz.transition 1998, 3, :o3, 891104400 - tz.transition 1998, 10, :o2, 909248400 - tz.transition 1999, 3, :o3, 922554000 - tz.transition 1999, 10, :o2, 941302800 - tz.transition 2000, 3, :o3, 954003600 - tz.transition 2000, 10, :o2, 972752400 - tz.transition 2001, 3, :o3, 985453200 - tz.transition 2001, 10, :o2, 1004202000 - tz.transition 2002, 3, :o3, 1017507600 - tz.transition 2002, 10, :o2, 1035651600 - tz.transition 2003, 3, :o3, 1048957200 - tz.transition 2003, 10, :o2, 1067101200 - tz.transition 2004, 3, :o3, 1080406800 - tz.transition 2004, 10, :o2, 1099155600 - tz.transition 2005, 3, :o3, 1111856400 - tz.transition 2005, 10, :o2, 1130605200 - tz.transition 2006, 3, :o3, 1143306000 - tz.transition 2006, 10, :o2, 1162054800 - tz.transition 2007, 3, :o3, 1174755600 - tz.transition 2007, 10, :o2, 1193504400 - tz.transition 2008, 3, :o3, 1206810000 - tz.transition 2008, 10, :o2, 1224954000 - tz.transition 2009, 3, :o3, 1238259600 - tz.transition 2009, 10, :o2, 1256403600 - tz.transition 2010, 3, :o3, 1269709200 - tz.transition 2010, 10, :o2, 1288458000 - tz.transition 2011, 3, :o3, 1301158800 - tz.transition 2011, 10, :o2, 1319907600 - tz.transition 2012, 3, :o3, 1332608400 - tz.transition 2012, 10, :o2, 1351357200 - tz.transition 2013, 3, :o3, 1364662800 - tz.transition 2013, 10, :o2, 1382806800 - tz.transition 2014, 3, :o3, 1396112400 - tz.transition 2014, 10, :o2, 1414256400 - tz.transition 2015, 3, :o3, 1427562000 - tz.transition 2015, 10, :o2, 1445706000 - tz.transition 2016, 3, :o3, 1459011600 - tz.transition 2016, 10, :o2, 1477760400 - tz.transition 2017, 3, :o3, 1490461200 - tz.transition 2017, 10, :o2, 1509210000 - tz.transition 2018, 3, :o3, 1521910800 - tz.transition 2018, 10, :o2, 1540659600 - tz.transition 2019, 3, :o3, 1553965200 - tz.transition 2019, 10, :o2, 1572109200 - tz.transition 2020, 3, :o3, 1585414800 - tz.transition 2020, 10, :o2, 1603558800 - tz.transition 2021, 3, :o3, 1616864400 - tz.transition 2021, 10, :o2, 1635613200 - tz.transition 2022, 3, :o3, 1648314000 - tz.transition 2022, 10, :o2, 1667062800 - tz.transition 2023, 3, :o3, 1679763600 - tz.transition 2023, 10, :o2, 1698512400 - tz.transition 2024, 3, :o3, 1711818000 - tz.transition 2024, 10, :o2, 1729962000 - tz.transition 2025, 3, :o3, 1743267600 - tz.transition 2025, 10, :o2, 1761411600 - tz.transition 2026, 3, :o3, 1774717200 - tz.transition 2026, 10, :o2, 1792861200 - tz.transition 2027, 3, :o3, 1806166800 - tz.transition 2027, 10, :o2, 1824915600 - tz.transition 2028, 3, :o3, 1837616400 - tz.transition 2028, 10, :o2, 1856365200 - tz.transition 2029, 3, :o3, 1869066000 - tz.transition 2029, 10, :o2, 1887814800 - tz.transition 2030, 3, :o3, 1901120400 - tz.transition 2030, 10, :o2, 1919264400 - tz.transition 2031, 3, :o3, 1932570000 - tz.transition 2031, 10, :o2, 1950714000 - tz.transition 2032, 3, :o3, 1964019600 - tz.transition 2032, 10, :o2, 1982768400 - tz.transition 2033, 3, :o3, 1995469200 - tz.transition 2033, 10, :o2, 2014218000 - tz.transition 2034, 3, :o3, 2026918800 - tz.transition 2034, 10, :o2, 2045667600 - tz.transition 2035, 3, :o3, 2058368400 - tz.transition 2035, 10, :o2, 2077117200 - tz.transition 2036, 3, :o3, 2090422800 - tz.transition 2036, 10, :o2, 2108566800 - tz.transition 2037, 3, :o3, 2121872400 - tz.transition 2037, 10, :o2, 2140016400 - tz.transition 2038, 3, :o3, 59172245, 24 - tz.transition 2038, 10, :o2, 59177453, 24 - tz.transition 2039, 3, :o3, 59180981, 24 - tz.transition 2039, 10, :o2, 59186189, 24 - tz.transition 2040, 3, :o3, 59189717, 24 - tz.transition 2040, 10, :o2, 59194925, 24 - tz.transition 2041, 3, :o3, 59198621, 24 - tz.transition 2041, 10, :o2, 59203661, 24 - tz.transition 2042, 3, :o3, 59207357, 24 - tz.transition 2042, 10, :o2, 59212397, 24 - tz.transition 2043, 3, :o3, 59216093, 24 - tz.transition 2043, 10, :o2, 59221133, 24 - tz.transition 2044, 3, :o3, 59224829, 24 - tz.transition 2044, 10, :o2, 59230037, 24 - tz.transition 2045, 3, :o3, 59233565, 24 - tz.transition 2045, 10, :o2, 59238773, 24 - tz.transition 2046, 3, :o3, 59242301, 24 - tz.transition 2046, 10, :o2, 59247509, 24 - tz.transition 2047, 3, :o3, 59251205, 24 - tz.transition 2047, 10, :o2, 59256245, 24 - tz.transition 2048, 3, :o3, 59259941, 24 - tz.transition 2048, 10, :o2, 59264981, 24 - tz.transition 2049, 3, :o3, 59268677, 24 - tz.transition 2049, 10, :o2, 59273885, 24 - tz.transition 2050, 3, :o3, 59277413, 24 - tz.transition 2050, 10, :o2, 59282621, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb deleted file mode 100644 index 8ef8df4a41..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Yekaterinburg - include TimezoneDefinition - - timezone 'Asia/Yekaterinburg' do |tz| - tz.offset :o0, 14544, 0, :LMT - tz.offset :o1, 14400, 0, :SVET - tz.offset :o2, 18000, 0, :SVET - tz.offset :o3, 18000, 3600, :SVEST - tz.offset :o4, 14400, 3600, :SVEST - tz.offset :o5, 18000, 0, :YEKT - tz.offset :o6, 18000, 3600, :YEKST - - tz.transition 1919, 7, :o1, 1453292699, 600 - tz.transition 1930, 6, :o2, 7278445, 3 - tz.transition 1981, 3, :o3, 354913200 - tz.transition 1981, 9, :o2, 370720800 - tz.transition 1982, 3, :o3, 386449200 - tz.transition 1982, 9, :o2, 402256800 - tz.transition 1983, 3, :o3, 417985200 - tz.transition 1983, 9, :o2, 433792800 - tz.transition 1984, 3, :o3, 449607600 - tz.transition 1984, 9, :o2, 465339600 - tz.transition 1985, 3, :o3, 481064400 - tz.transition 1985, 9, :o2, 496789200 - tz.transition 1986, 3, :o3, 512514000 - tz.transition 1986, 9, :o2, 528238800 - tz.transition 1987, 3, :o3, 543963600 - tz.transition 1987, 9, :o2, 559688400 - tz.transition 1988, 3, :o3, 575413200 - tz.transition 1988, 9, :o2, 591138000 - tz.transition 1989, 3, :o3, 606862800 - tz.transition 1989, 9, :o2, 622587600 - tz.transition 1990, 3, :o3, 638312400 - tz.transition 1990, 9, :o2, 654642000 - tz.transition 1991, 3, :o4, 670366800 - tz.transition 1991, 9, :o1, 686095200 - tz.transition 1992, 1, :o5, 695772000 - tz.transition 1992, 3, :o6, 701805600 - tz.transition 1992, 9, :o5, 717526800 - tz.transition 1993, 3, :o6, 733266000 - tz.transition 1993, 9, :o5, 748990800 - tz.transition 1994, 3, :o6, 764715600 - tz.transition 1994, 9, :o5, 780440400 - tz.transition 1995, 3, :o6, 796165200 - tz.transition 1995, 9, :o5, 811890000 - tz.transition 1996, 3, :o6, 828219600 - tz.transition 1996, 10, :o5, 846363600 - tz.transition 1997, 3, :o6, 859669200 - tz.transition 1997, 10, :o5, 877813200 - tz.transition 1998, 3, :o6, 891118800 - tz.transition 1998, 10, :o5, 909262800 - tz.transition 1999, 3, :o6, 922568400 - tz.transition 1999, 10, :o5, 941317200 - tz.transition 2000, 3, :o6, 954018000 - tz.transition 2000, 10, :o5, 972766800 - tz.transition 2001, 3, :o6, 985467600 - tz.transition 2001, 10, :o5, 1004216400 - tz.transition 2002, 3, :o6, 1017522000 - tz.transition 2002, 10, :o5, 1035666000 - tz.transition 2003, 3, :o6, 1048971600 - tz.transition 2003, 10, :o5, 1067115600 - tz.transition 2004, 3, :o6, 1080421200 - tz.transition 2004, 10, :o5, 1099170000 - tz.transition 2005, 3, :o6, 1111870800 - tz.transition 2005, 10, :o5, 1130619600 - tz.transition 2006, 3, :o6, 1143320400 - tz.transition 2006, 10, :o5, 1162069200 - tz.transition 2007, 3, :o6, 1174770000 - tz.transition 2007, 10, :o5, 1193518800 - tz.transition 2008, 3, :o6, 1206824400 - tz.transition 2008, 10, :o5, 1224968400 - tz.transition 2009, 3, :o6, 1238274000 - tz.transition 2009, 10, :o5, 1256418000 - tz.transition 2010, 3, :o6, 1269723600 - tz.transition 2010, 10, :o5, 1288472400 - tz.transition 2011, 3, :o6, 1301173200 - tz.transition 2011, 10, :o5, 1319922000 - tz.transition 2012, 3, :o6, 1332622800 - tz.transition 2012, 10, :o5, 1351371600 - tz.transition 2013, 3, :o6, 1364677200 - tz.transition 2013, 10, :o5, 1382821200 - tz.transition 2014, 3, :o6, 1396126800 - tz.transition 2014, 10, :o5, 1414270800 - tz.transition 2015, 3, :o6, 1427576400 - tz.transition 2015, 10, :o5, 1445720400 - tz.transition 2016, 3, :o6, 1459026000 - tz.transition 2016, 10, :o5, 1477774800 - tz.transition 2017, 3, :o6, 1490475600 - tz.transition 2017, 10, :o5, 1509224400 - tz.transition 2018, 3, :o6, 1521925200 - tz.transition 2018, 10, :o5, 1540674000 - tz.transition 2019, 3, :o6, 1553979600 - tz.transition 2019, 10, :o5, 1572123600 - tz.transition 2020, 3, :o6, 1585429200 - tz.transition 2020, 10, :o5, 1603573200 - tz.transition 2021, 3, :o6, 1616878800 - tz.transition 2021, 10, :o5, 1635627600 - tz.transition 2022, 3, :o6, 1648328400 - tz.transition 2022, 10, :o5, 1667077200 - tz.transition 2023, 3, :o6, 1679778000 - tz.transition 2023, 10, :o5, 1698526800 - tz.transition 2024, 3, :o6, 1711832400 - tz.transition 2024, 10, :o5, 1729976400 - tz.transition 2025, 3, :o6, 1743282000 - tz.transition 2025, 10, :o5, 1761426000 - tz.transition 2026, 3, :o6, 1774731600 - tz.transition 2026, 10, :o5, 1792875600 - tz.transition 2027, 3, :o6, 1806181200 - tz.transition 2027, 10, :o5, 1824930000 - tz.transition 2028, 3, :o6, 1837630800 - tz.transition 2028, 10, :o5, 1856379600 - tz.transition 2029, 3, :o6, 1869080400 - tz.transition 2029, 10, :o5, 1887829200 - tz.transition 2030, 3, :o6, 1901134800 - tz.transition 2030, 10, :o5, 1919278800 - tz.transition 2031, 3, :o6, 1932584400 - tz.transition 2031, 10, :o5, 1950728400 - tz.transition 2032, 3, :o6, 1964034000 - tz.transition 2032, 10, :o5, 1982782800 - tz.transition 2033, 3, :o6, 1995483600 - tz.transition 2033, 10, :o5, 2014232400 - tz.transition 2034, 3, :o6, 2026933200 - tz.transition 2034, 10, :o5, 2045682000 - tz.transition 2035, 3, :o6, 2058382800 - tz.transition 2035, 10, :o5, 2077131600 - tz.transition 2036, 3, :o6, 2090437200 - tz.transition 2036, 10, :o5, 2108581200 - tz.transition 2037, 3, :o6, 2121886800 - tz.transition 2037, 10, :o5, 2140030800 - tz.transition 2038, 3, :o6, 19724083, 8 - tz.transition 2038, 10, :o5, 19725819, 8 - tz.transition 2039, 3, :o6, 19726995, 8 - tz.transition 2039, 10, :o5, 19728731, 8 - tz.transition 2040, 3, :o6, 19729907, 8 - tz.transition 2040, 10, :o5, 19731643, 8 - tz.transition 2041, 3, :o6, 19732875, 8 - tz.transition 2041, 10, :o5, 19734555, 8 - tz.transition 2042, 3, :o6, 19735787, 8 - tz.transition 2042, 10, :o5, 19737467, 8 - tz.transition 2043, 3, :o6, 19738699, 8 - tz.transition 2043, 10, :o5, 19740379, 8 - tz.transition 2044, 3, :o6, 19741611, 8 - tz.transition 2044, 10, :o5, 19743347, 8 - tz.transition 2045, 3, :o6, 19744523, 8 - tz.transition 2045, 10, :o5, 19746259, 8 - tz.transition 2046, 3, :o6, 19747435, 8 - tz.transition 2046, 10, :o5, 19749171, 8 - tz.transition 2047, 3, :o6, 19750403, 8 - tz.transition 2047, 10, :o5, 19752083, 8 - tz.transition 2048, 3, :o6, 19753315, 8 - tz.transition 2048, 10, :o5, 19754995, 8 - tz.transition 2049, 3, :o6, 19756227, 8 - tz.transition 2049, 10, :o5, 19757963, 8 - tz.transition 2050, 3, :o6, 19759139, 8 - tz.transition 2050, 10, :o5, 19760875, 8 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb deleted file mode 100644 index e7f160861f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Asia - module Yerevan - include TimezoneDefinition - - timezone 'Asia/Yerevan' do |tz| - tz.offset :o0, 10680, 0, :LMT - tz.offset :o1, 10800, 0, :YERT - tz.offset :o2, 14400, 0, :YERT - tz.offset :o3, 14400, 3600, :YERST - tz.offset :o4, 10800, 3600, :YERST - tz.offset :o5, 10800, 3600, :AMST - tz.offset :o6, 10800, 0, :AMT - tz.offset :o7, 14400, 0, :AMT - tz.offset :o8, 14400, 3600, :AMST - - tz.transition 1924, 5, :o1, 1745213311, 720 - tz.transition 1957, 2, :o2, 19487187, 8 - tz.transition 1981, 3, :o3, 354916800 - tz.transition 1981, 9, :o2, 370724400 - tz.transition 1982, 3, :o3, 386452800 - tz.transition 1982, 9, :o2, 402260400 - tz.transition 1983, 3, :o3, 417988800 - tz.transition 1983, 9, :o2, 433796400 - tz.transition 1984, 3, :o3, 449611200 - tz.transition 1984, 9, :o2, 465343200 - tz.transition 1985, 3, :o3, 481068000 - tz.transition 1985, 9, :o2, 496792800 - tz.transition 1986, 3, :o3, 512517600 - tz.transition 1986, 9, :o2, 528242400 - tz.transition 1987, 3, :o3, 543967200 - tz.transition 1987, 9, :o2, 559692000 - tz.transition 1988, 3, :o3, 575416800 - tz.transition 1988, 9, :o2, 591141600 - tz.transition 1989, 3, :o3, 606866400 - tz.transition 1989, 9, :o2, 622591200 - tz.transition 1990, 3, :o3, 638316000 - tz.transition 1990, 9, :o2, 654645600 - tz.transition 1991, 3, :o4, 670370400 - tz.transition 1991, 9, :o5, 685569600 - tz.transition 1991, 9, :o6, 686098800 - tz.transition 1992, 3, :o5, 701812800 - tz.transition 1992, 9, :o6, 717534000 - tz.transition 1993, 3, :o5, 733273200 - tz.transition 1993, 9, :o6, 748998000 - tz.transition 1994, 3, :o5, 764722800 - tz.transition 1994, 9, :o6, 780447600 - tz.transition 1995, 3, :o5, 796172400 - tz.transition 1995, 9, :o7, 811897200 - tz.transition 1997, 3, :o8, 859672800 - tz.transition 1997, 10, :o7, 877816800 - tz.transition 1998, 3, :o8, 891122400 - tz.transition 1998, 10, :o7, 909266400 - tz.transition 1999, 3, :o8, 922572000 - tz.transition 1999, 10, :o7, 941320800 - tz.transition 2000, 3, :o8, 954021600 - tz.transition 2000, 10, :o7, 972770400 - tz.transition 2001, 3, :o8, 985471200 - tz.transition 2001, 10, :o7, 1004220000 - tz.transition 2002, 3, :o8, 1017525600 - tz.transition 2002, 10, :o7, 1035669600 - tz.transition 2003, 3, :o8, 1048975200 - tz.transition 2003, 10, :o7, 1067119200 - tz.transition 2004, 3, :o8, 1080424800 - tz.transition 2004, 10, :o7, 1099173600 - tz.transition 2005, 3, :o8, 1111874400 - tz.transition 2005, 10, :o7, 1130623200 - tz.transition 2006, 3, :o8, 1143324000 - tz.transition 2006, 10, :o7, 1162072800 - tz.transition 2007, 3, :o8, 1174773600 - tz.transition 2007, 10, :o7, 1193522400 - tz.transition 2008, 3, :o8, 1206828000 - tz.transition 2008, 10, :o7, 1224972000 - tz.transition 2009, 3, :o8, 1238277600 - tz.transition 2009, 10, :o7, 1256421600 - tz.transition 2010, 3, :o8, 1269727200 - tz.transition 2010, 10, :o7, 1288476000 - tz.transition 2011, 3, :o8, 1301176800 - tz.transition 2011, 10, :o7, 1319925600 - tz.transition 2012, 3, :o8, 1332626400 - tz.transition 2012, 10, :o7, 1351375200 - tz.transition 2013, 3, :o8, 1364680800 - tz.transition 2013, 10, :o7, 1382824800 - tz.transition 2014, 3, :o8, 1396130400 - tz.transition 2014, 10, :o7, 1414274400 - tz.transition 2015, 3, :o8, 1427580000 - tz.transition 2015, 10, :o7, 1445724000 - tz.transition 2016, 3, :o8, 1459029600 - tz.transition 2016, 10, :o7, 1477778400 - tz.transition 2017, 3, :o8, 1490479200 - tz.transition 2017, 10, :o7, 1509228000 - tz.transition 2018, 3, :o8, 1521928800 - tz.transition 2018, 10, :o7, 1540677600 - tz.transition 2019, 3, :o8, 1553983200 - tz.transition 2019, 10, :o7, 1572127200 - tz.transition 2020, 3, :o8, 1585432800 - tz.transition 2020, 10, :o7, 1603576800 - tz.transition 2021, 3, :o8, 1616882400 - tz.transition 2021, 10, :o7, 1635631200 - tz.transition 2022, 3, :o8, 1648332000 - tz.transition 2022, 10, :o7, 1667080800 - tz.transition 2023, 3, :o8, 1679781600 - tz.transition 2023, 10, :o7, 1698530400 - tz.transition 2024, 3, :o8, 1711836000 - tz.transition 2024, 10, :o7, 1729980000 - tz.transition 2025, 3, :o8, 1743285600 - tz.transition 2025, 10, :o7, 1761429600 - tz.transition 2026, 3, :o8, 1774735200 - tz.transition 2026, 10, :o7, 1792879200 - tz.transition 2027, 3, :o8, 1806184800 - tz.transition 2027, 10, :o7, 1824933600 - tz.transition 2028, 3, :o8, 1837634400 - tz.transition 2028, 10, :o7, 1856383200 - tz.transition 2029, 3, :o8, 1869084000 - tz.transition 2029, 10, :o7, 1887832800 - tz.transition 2030, 3, :o8, 1901138400 - tz.transition 2030, 10, :o7, 1919282400 - tz.transition 2031, 3, :o8, 1932588000 - tz.transition 2031, 10, :o7, 1950732000 - tz.transition 2032, 3, :o8, 1964037600 - tz.transition 2032, 10, :o7, 1982786400 - tz.transition 2033, 3, :o8, 1995487200 - tz.transition 2033, 10, :o7, 2014236000 - tz.transition 2034, 3, :o8, 2026936800 - tz.transition 2034, 10, :o7, 2045685600 - tz.transition 2035, 3, :o8, 2058386400 - tz.transition 2035, 10, :o7, 2077135200 - tz.transition 2036, 3, :o8, 2090440800 - tz.transition 2036, 10, :o7, 2108584800 - tz.transition 2037, 3, :o8, 2121890400 - tz.transition 2037, 10, :o7, 2140034400 - tz.transition 2038, 3, :o8, 29586125, 12 - tz.transition 2038, 10, :o7, 29588729, 12 - tz.transition 2039, 3, :o8, 29590493, 12 - tz.transition 2039, 10, :o7, 29593097, 12 - tz.transition 2040, 3, :o8, 29594861, 12 - tz.transition 2040, 10, :o7, 29597465, 12 - tz.transition 2041, 3, :o8, 29599313, 12 - tz.transition 2041, 10, :o7, 29601833, 12 - tz.transition 2042, 3, :o8, 29603681, 12 - tz.transition 2042, 10, :o7, 29606201, 12 - tz.transition 2043, 3, :o8, 29608049, 12 - tz.transition 2043, 10, :o7, 29610569, 12 - tz.transition 2044, 3, :o8, 29612417, 12 - tz.transition 2044, 10, :o7, 29615021, 12 - tz.transition 2045, 3, :o8, 29616785, 12 - tz.transition 2045, 10, :o7, 29619389, 12 - tz.transition 2046, 3, :o8, 29621153, 12 - tz.transition 2046, 10, :o7, 29623757, 12 - tz.transition 2047, 3, :o8, 29625605, 12 - tz.transition 2047, 10, :o7, 29628125, 12 - tz.transition 2048, 3, :o8, 29629973, 12 - tz.transition 2048, 10, :o7, 29632493, 12 - tz.transition 2049, 3, :o8, 29634341, 12 - tz.transition 2049, 10, :o7, 29636945, 12 - tz.transition 2050, 3, :o8, 29638709, 12 - tz.transition 2050, 10, :o7, 29641313, 12 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb deleted file mode 100644 index 1bd16a75ac..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb +++ /dev/null @@ -1,270 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Atlantic - module Azores - include TimezoneDefinition - - timezone 'Atlantic/Azores' do |tz| - tz.offset :o0, -6160, 0, :LMT - tz.offset :o1, -6872, 0, :HMT - tz.offset :o2, -7200, 0, :AZOT - tz.offset :o3, -7200, 3600, :AZOST - tz.offset :o4, -7200, 7200, :AZOMT - tz.offset :o5, -3600, 0, :AZOT - tz.offset :o6, -3600, 3600, :AZOST - tz.offset :o7, 0, 0, :WET - - tz.transition 1884, 1, :o1, 2601910697, 1080 - tz.transition 1911, 5, :o2, 26127150259, 10800 - tz.transition 1916, 6, :o3, 58104781, 24 - tz.transition 1916, 11, :o2, 29054023, 12 - tz.transition 1917, 3, :o3, 58110925, 24 - tz.transition 1917, 10, :o2, 58116397, 24 - tz.transition 1918, 3, :o3, 58119709, 24 - tz.transition 1918, 10, :o2, 58125157, 24 - tz.transition 1919, 3, :o3, 58128445, 24 - tz.transition 1919, 10, :o2, 58133917, 24 - tz.transition 1920, 3, :o3, 58137229, 24 - tz.transition 1920, 10, :o2, 58142701, 24 - tz.transition 1921, 3, :o3, 58145989, 24 - tz.transition 1921, 10, :o2, 58151461, 24 - tz.transition 1924, 4, :o3, 58173421, 24 - tz.transition 1924, 10, :o2, 58177765, 24 - tz.transition 1926, 4, :o3, 58190965, 24 - tz.transition 1926, 10, :o2, 58194997, 24 - tz.transition 1927, 4, :o3, 58199533, 24 - tz.transition 1927, 10, :o2, 58203733, 24 - tz.transition 1928, 4, :o3, 58208437, 24 - tz.transition 1928, 10, :o2, 58212637, 24 - tz.transition 1929, 4, :o3, 58217341, 24 - tz.transition 1929, 10, :o2, 58221373, 24 - tz.transition 1931, 4, :o3, 58234813, 24 - tz.transition 1931, 10, :o2, 58238845, 24 - tz.transition 1932, 4, :o3, 58243213, 24 - tz.transition 1932, 10, :o2, 58247581, 24 - tz.transition 1934, 4, :o3, 58260853, 24 - tz.transition 1934, 10, :o2, 58265221, 24 - tz.transition 1935, 3, :o3, 58269421, 24 - tz.transition 1935, 10, :o2, 58273957, 24 - tz.transition 1936, 4, :o3, 58278661, 24 - tz.transition 1936, 10, :o2, 58282693, 24 - tz.transition 1937, 4, :o3, 58287061, 24 - tz.transition 1937, 10, :o2, 58291429, 24 - tz.transition 1938, 3, :o3, 58295629, 24 - tz.transition 1938, 10, :o2, 58300165, 24 - tz.transition 1939, 4, :o3, 58304869, 24 - tz.transition 1939, 11, :o2, 58310077, 24 - tz.transition 1940, 2, :o3, 58312429, 24 - tz.transition 1940, 10, :o2, 58317805, 24 - tz.transition 1941, 4, :o3, 58322173, 24 - tz.transition 1941, 10, :o2, 58326565, 24 - tz.transition 1942, 3, :o3, 58330405, 24 - tz.transition 1942, 4, :o4, 4860951, 2 - tz.transition 1942, 8, :o3, 4861175, 2 - tz.transition 1942, 10, :o2, 58335781, 24 - tz.transition 1943, 3, :o3, 58339141, 24 - tz.transition 1943, 4, :o4, 4861665, 2 - tz.transition 1943, 8, :o3, 4861931, 2 - tz.transition 1943, 10, :o2, 58344685, 24 - tz.transition 1944, 3, :o3, 58347877, 24 - tz.transition 1944, 4, :o4, 4862407, 2 - tz.transition 1944, 8, :o3, 4862659, 2 - tz.transition 1944, 10, :o2, 58353421, 24 - tz.transition 1945, 3, :o3, 58356613, 24 - tz.transition 1945, 4, :o4, 4863135, 2 - tz.transition 1945, 8, :o3, 4863387, 2 - tz.transition 1945, 10, :o2, 58362157, 24 - tz.transition 1946, 4, :o3, 58366021, 24 - tz.transition 1946, 10, :o2, 58370389, 24 - tz.transition 1947, 4, :o3, 7296845, 3 - tz.transition 1947, 10, :o2, 7297391, 3 - tz.transition 1948, 4, :o3, 7297937, 3 - tz.transition 1948, 10, :o2, 7298483, 3 - tz.transition 1949, 4, :o3, 7299029, 3 - tz.transition 1949, 10, :o2, 7299575, 3 - tz.transition 1951, 4, :o3, 7301213, 3 - tz.transition 1951, 10, :o2, 7301780, 3 - tz.transition 1952, 4, :o3, 7302326, 3 - tz.transition 1952, 10, :o2, 7302872, 3 - tz.transition 1953, 4, :o3, 7303418, 3 - tz.transition 1953, 10, :o2, 7303964, 3 - tz.transition 1954, 4, :o3, 7304510, 3 - tz.transition 1954, 10, :o2, 7305056, 3 - tz.transition 1955, 4, :o3, 7305602, 3 - tz.transition 1955, 10, :o2, 7306148, 3 - tz.transition 1956, 4, :o3, 7306694, 3 - tz.transition 1956, 10, :o2, 7307261, 3 - tz.transition 1957, 4, :o3, 7307807, 3 - tz.transition 1957, 10, :o2, 7308353, 3 - tz.transition 1958, 4, :o3, 7308899, 3 - tz.transition 1958, 10, :o2, 7309445, 3 - tz.transition 1959, 4, :o3, 7309991, 3 - tz.transition 1959, 10, :o2, 7310537, 3 - tz.transition 1960, 4, :o3, 7311083, 3 - tz.transition 1960, 10, :o2, 7311629, 3 - tz.transition 1961, 4, :o3, 7312175, 3 - tz.transition 1961, 10, :o2, 7312721, 3 - tz.transition 1962, 4, :o3, 7313267, 3 - tz.transition 1962, 10, :o2, 7313834, 3 - tz.transition 1963, 4, :o3, 7314380, 3 - tz.transition 1963, 10, :o2, 7314926, 3 - tz.transition 1964, 4, :o3, 7315472, 3 - tz.transition 1964, 10, :o2, 7316018, 3 - tz.transition 1965, 4, :o3, 7316564, 3 - tz.transition 1965, 10, :o2, 7317110, 3 - tz.transition 1966, 4, :o5, 7317656, 3 - tz.transition 1977, 3, :o6, 228272400 - tz.transition 1977, 9, :o5, 243997200 - tz.transition 1978, 4, :o6, 260326800 - tz.transition 1978, 10, :o5, 276051600 - tz.transition 1979, 4, :o6, 291776400 - tz.transition 1979, 9, :o5, 307504800 - tz.transition 1980, 3, :o6, 323226000 - tz.transition 1980, 9, :o5, 338954400 - tz.transition 1981, 3, :o6, 354679200 - tz.transition 1981, 9, :o5, 370404000 - tz.transition 1982, 3, :o6, 386128800 - tz.transition 1982, 9, :o5, 401853600 - tz.transition 1983, 3, :o6, 417582000 - tz.transition 1983, 9, :o5, 433303200 - tz.transition 1984, 3, :o6, 449028000 - tz.transition 1984, 9, :o5, 465357600 - tz.transition 1985, 3, :o6, 481082400 - tz.transition 1985, 9, :o5, 496807200 - tz.transition 1986, 3, :o6, 512532000 - tz.transition 1986, 9, :o5, 528256800 - tz.transition 1987, 3, :o6, 543981600 - tz.transition 1987, 9, :o5, 559706400 - tz.transition 1988, 3, :o6, 575431200 - tz.transition 1988, 9, :o5, 591156000 - tz.transition 1989, 3, :o6, 606880800 - tz.transition 1989, 9, :o5, 622605600 - tz.transition 1990, 3, :o6, 638330400 - tz.transition 1990, 9, :o5, 654660000 - tz.transition 1991, 3, :o6, 670384800 - tz.transition 1991, 9, :o5, 686109600 - tz.transition 1992, 3, :o6, 701834400 - tz.transition 1992, 9, :o7, 717559200 - tz.transition 1993, 3, :o6, 733280400 - tz.transition 1993, 9, :o5, 749005200 - tz.transition 1994, 3, :o6, 764730000 - tz.transition 1994, 9, :o5, 780454800 - tz.transition 1995, 3, :o6, 796179600 - tz.transition 1995, 9, :o5, 811904400 - tz.transition 1996, 3, :o6, 828234000 - tz.transition 1996, 10, :o5, 846378000 - tz.transition 1997, 3, :o6, 859683600 - tz.transition 1997, 10, :o5, 877827600 - tz.transition 1998, 3, :o6, 891133200 - tz.transition 1998, 10, :o5, 909277200 - tz.transition 1999, 3, :o6, 922582800 - tz.transition 1999, 10, :o5, 941331600 - tz.transition 2000, 3, :o6, 954032400 - tz.transition 2000, 10, :o5, 972781200 - tz.transition 2001, 3, :o6, 985482000 - tz.transition 2001, 10, :o5, 1004230800 - tz.transition 2002, 3, :o6, 1017536400 - tz.transition 2002, 10, :o5, 1035680400 - tz.transition 2003, 3, :o6, 1048986000 - tz.transition 2003, 10, :o5, 1067130000 - tz.transition 2004, 3, :o6, 1080435600 - tz.transition 2004, 10, :o5, 1099184400 - tz.transition 2005, 3, :o6, 1111885200 - tz.transition 2005, 10, :o5, 1130634000 - tz.transition 2006, 3, :o6, 1143334800 - tz.transition 2006, 10, :o5, 1162083600 - tz.transition 2007, 3, :o6, 1174784400 - tz.transition 2007, 10, :o5, 1193533200 - tz.transition 2008, 3, :o6, 1206838800 - tz.transition 2008, 10, :o5, 1224982800 - tz.transition 2009, 3, :o6, 1238288400 - tz.transition 2009, 10, :o5, 1256432400 - tz.transition 2010, 3, :o6, 1269738000 - tz.transition 2010, 10, :o5, 1288486800 - tz.transition 2011, 3, :o6, 1301187600 - tz.transition 2011, 10, :o5, 1319936400 - tz.transition 2012, 3, :o6, 1332637200 - tz.transition 2012, 10, :o5, 1351386000 - tz.transition 2013, 3, :o6, 1364691600 - tz.transition 2013, 10, :o5, 1382835600 - tz.transition 2014, 3, :o6, 1396141200 - tz.transition 2014, 10, :o5, 1414285200 - tz.transition 2015, 3, :o6, 1427590800 - tz.transition 2015, 10, :o5, 1445734800 - tz.transition 2016, 3, :o6, 1459040400 - tz.transition 2016, 10, :o5, 1477789200 - tz.transition 2017, 3, :o6, 1490490000 - tz.transition 2017, 10, :o5, 1509238800 - tz.transition 2018, 3, :o6, 1521939600 - tz.transition 2018, 10, :o5, 1540688400 - tz.transition 2019, 3, :o6, 1553994000 - tz.transition 2019, 10, :o5, 1572138000 - tz.transition 2020, 3, :o6, 1585443600 - tz.transition 2020, 10, :o5, 1603587600 - tz.transition 2021, 3, :o6, 1616893200 - tz.transition 2021, 10, :o5, 1635642000 - tz.transition 2022, 3, :o6, 1648342800 - tz.transition 2022, 10, :o5, 1667091600 - tz.transition 2023, 3, :o6, 1679792400 - tz.transition 2023, 10, :o5, 1698541200 - tz.transition 2024, 3, :o6, 1711846800 - tz.transition 2024, 10, :o5, 1729990800 - tz.transition 2025, 3, :o6, 1743296400 - tz.transition 2025, 10, :o5, 1761440400 - tz.transition 2026, 3, :o6, 1774746000 - tz.transition 2026, 10, :o5, 1792890000 - tz.transition 2027, 3, :o6, 1806195600 - tz.transition 2027, 10, :o5, 1824944400 - tz.transition 2028, 3, :o6, 1837645200 - tz.transition 2028, 10, :o5, 1856394000 - tz.transition 2029, 3, :o6, 1869094800 - tz.transition 2029, 10, :o5, 1887843600 - tz.transition 2030, 3, :o6, 1901149200 - tz.transition 2030, 10, :o5, 1919293200 - tz.transition 2031, 3, :o6, 1932598800 - tz.transition 2031, 10, :o5, 1950742800 - tz.transition 2032, 3, :o6, 1964048400 - tz.transition 2032, 10, :o5, 1982797200 - tz.transition 2033, 3, :o6, 1995498000 - tz.transition 2033, 10, :o5, 2014246800 - tz.transition 2034, 3, :o6, 2026947600 - tz.transition 2034, 10, :o5, 2045696400 - tz.transition 2035, 3, :o6, 2058397200 - tz.transition 2035, 10, :o5, 2077146000 - tz.transition 2036, 3, :o6, 2090451600 - tz.transition 2036, 10, :o5, 2108595600 - tz.transition 2037, 3, :o6, 2121901200 - tz.transition 2037, 10, :o5, 2140045200 - tz.transition 2038, 3, :o6, 59172253, 24 - tz.transition 2038, 10, :o5, 59177461, 24 - tz.transition 2039, 3, :o6, 59180989, 24 - tz.transition 2039, 10, :o5, 59186197, 24 - tz.transition 2040, 3, :o6, 59189725, 24 - tz.transition 2040, 10, :o5, 59194933, 24 - tz.transition 2041, 3, :o6, 59198629, 24 - tz.transition 2041, 10, :o5, 59203669, 24 - tz.transition 2042, 3, :o6, 59207365, 24 - tz.transition 2042, 10, :o5, 59212405, 24 - tz.transition 2043, 3, :o6, 59216101, 24 - tz.transition 2043, 10, :o5, 59221141, 24 - tz.transition 2044, 3, :o6, 59224837, 24 - tz.transition 2044, 10, :o5, 59230045, 24 - tz.transition 2045, 3, :o6, 59233573, 24 - tz.transition 2045, 10, :o5, 59238781, 24 - tz.transition 2046, 3, :o6, 59242309, 24 - tz.transition 2046, 10, :o5, 59247517, 24 - tz.transition 2047, 3, :o6, 59251213, 24 - tz.transition 2047, 10, :o5, 59256253, 24 - tz.transition 2048, 3, :o6, 59259949, 24 - tz.transition 2048, 10, :o5, 59264989, 24 - tz.transition 2049, 3, :o6, 59268685, 24 - tz.transition 2049, 10, :o5, 59273893, 24 - tz.transition 2050, 3, :o6, 59277421, 24 - tz.transition 2050, 10, :o5, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb deleted file mode 100644 index 61c8c15043..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Atlantic - module Cape_Verde - include TimezoneDefinition - - timezone 'Atlantic/Cape_Verde' do |tz| - tz.offset :o0, -5644, 0, :LMT - tz.offset :o1, -7200, 0, :CVT - tz.offset :o2, -7200, 3600, :CVST - tz.offset :o3, -3600, 0, :CVT - - tz.transition 1907, 1, :o1, 52219653811, 21600 - tz.transition 1942, 9, :o2, 29167243, 12 - tz.transition 1945, 10, :o1, 58361845, 24 - tz.transition 1975, 11, :o3, 186120000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb deleted file mode 100644 index 6a4cbafb9f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Atlantic - module South_Georgia - include TimezoneDefinition - - timezone 'Atlantic/South_Georgia' do |tz| - tz.offset :o0, -8768, 0, :LMT - tz.offset :o1, -7200, 0, :GST - - tz.transition 1890, 1, :o1, 1627673806, 675 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb deleted file mode 100644 index c5d561cc1e..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Adelaide - include TimezoneDefinition - - timezone 'Australia/Adelaide' do |tz| - tz.offset :o0, 33260, 0, :LMT - tz.offset :o1, 32400, 0, :CST - tz.offset :o2, 34200, 0, :CST - tz.offset :o3, 34200, 3600, :CST - - tz.transition 1895, 1, :o1, 10425132497, 4320 - tz.transition 1899, 4, :o2, 19318201, 8 - tz.transition 1916, 12, :o3, 3486569911, 1440 - tz.transition 1917, 3, :o2, 116222983, 48 - tz.transition 1941, 12, :o3, 38885763, 16 - tz.transition 1942, 3, :o2, 116661463, 48 - tz.transition 1942, 9, :o3, 38890067, 16 - tz.transition 1943, 3, :o2, 116678935, 48 - tz.transition 1943, 10, :o3, 38896003, 16 - tz.transition 1944, 3, :o2, 116696407, 48 - tz.transition 1971, 10, :o3, 57688200 - tz.transition 1972, 2, :o2, 67969800 - tz.transition 1972, 10, :o3, 89137800 - tz.transition 1973, 3, :o2, 100024200 - tz.transition 1973, 10, :o3, 120587400 - tz.transition 1974, 3, :o2, 131473800 - tz.transition 1974, 10, :o3, 152037000 - tz.transition 1975, 3, :o2, 162923400 - tz.transition 1975, 10, :o3, 183486600 - tz.transition 1976, 3, :o2, 194977800 - tz.transition 1976, 10, :o3, 215541000 - tz.transition 1977, 3, :o2, 226427400 - tz.transition 1977, 10, :o3, 246990600 - tz.transition 1978, 3, :o2, 257877000 - tz.transition 1978, 10, :o3, 278440200 - tz.transition 1979, 3, :o2, 289326600 - tz.transition 1979, 10, :o3, 309889800 - tz.transition 1980, 3, :o2, 320776200 - tz.transition 1980, 10, :o3, 341339400 - tz.transition 1981, 2, :o2, 352225800 - tz.transition 1981, 10, :o3, 372789000 - tz.transition 1982, 3, :o2, 384280200 - tz.transition 1982, 10, :o3, 404843400 - tz.transition 1983, 3, :o2, 415729800 - tz.transition 1983, 10, :o3, 436293000 - tz.transition 1984, 3, :o2, 447179400 - tz.transition 1984, 10, :o3, 467742600 - tz.transition 1985, 3, :o2, 478629000 - tz.transition 1985, 10, :o3, 499192200 - tz.transition 1986, 3, :o2, 511288200 - tz.transition 1986, 10, :o3, 530037000 - tz.transition 1987, 3, :o2, 542737800 - tz.transition 1987, 10, :o3, 562091400 - tz.transition 1988, 3, :o2, 574792200 - tz.transition 1988, 10, :o3, 594145800 - tz.transition 1989, 3, :o2, 606241800 - tz.transition 1989, 10, :o3, 625595400 - tz.transition 1990, 3, :o2, 637691400 - tz.transition 1990, 10, :o3, 657045000 - tz.transition 1991, 3, :o2, 667931400 - tz.transition 1991, 10, :o3, 688494600 - tz.transition 1992, 3, :o2, 701195400 - tz.transition 1992, 10, :o3, 719944200 - tz.transition 1993, 3, :o2, 731435400 - tz.transition 1993, 10, :o3, 751998600 - tz.transition 1994, 3, :o2, 764094600 - tz.transition 1994, 10, :o3, 783448200 - tz.transition 1995, 3, :o2, 796149000 - tz.transition 1995, 10, :o3, 814897800 - tz.transition 1996, 3, :o2, 828203400 - tz.transition 1996, 10, :o3, 846347400 - tz.transition 1997, 3, :o2, 859653000 - tz.transition 1997, 10, :o3, 877797000 - tz.transition 1998, 3, :o2, 891102600 - tz.transition 1998, 10, :o3, 909246600 - tz.transition 1999, 3, :o2, 922552200 - tz.transition 1999, 10, :o3, 941301000 - tz.transition 2000, 3, :o2, 954001800 - tz.transition 2000, 10, :o3, 972750600 - tz.transition 2001, 3, :o2, 985451400 - tz.transition 2001, 10, :o3, 1004200200 - tz.transition 2002, 3, :o2, 1017505800 - tz.transition 2002, 10, :o3, 1035649800 - tz.transition 2003, 3, :o2, 1048955400 - tz.transition 2003, 10, :o3, 1067099400 - tz.transition 2004, 3, :o2, 1080405000 - tz.transition 2004, 10, :o3, 1099153800 - tz.transition 2005, 3, :o2, 1111854600 - tz.transition 2005, 10, :o3, 1130603400 - tz.transition 2006, 4, :o2, 1143909000 - tz.transition 2006, 10, :o3, 1162053000 - tz.transition 2007, 3, :o2, 1174753800 - tz.transition 2007, 10, :o3, 1193502600 - tz.transition 2008, 4, :o2, 1207413000 - tz.transition 2008, 10, :o3, 1223137800 - tz.transition 2009, 4, :o2, 1238862600 - tz.transition 2009, 10, :o3, 1254587400 - tz.transition 2010, 4, :o2, 1270312200 - tz.transition 2010, 10, :o3, 1286037000 - tz.transition 2011, 4, :o2, 1301761800 - tz.transition 2011, 10, :o3, 1317486600 - tz.transition 2012, 3, :o2, 1333211400 - tz.transition 2012, 10, :o3, 1349541000 - tz.transition 2013, 4, :o2, 1365265800 - tz.transition 2013, 10, :o3, 1380990600 - tz.transition 2014, 4, :o2, 1396715400 - tz.transition 2014, 10, :o3, 1412440200 - tz.transition 2015, 4, :o2, 1428165000 - tz.transition 2015, 10, :o3, 1443889800 - tz.transition 2016, 4, :o2, 1459614600 - tz.transition 2016, 10, :o3, 1475339400 - tz.transition 2017, 4, :o2, 1491064200 - tz.transition 2017, 9, :o3, 1506789000 - tz.transition 2018, 3, :o2, 1522513800 - tz.transition 2018, 10, :o3, 1538843400 - tz.transition 2019, 4, :o2, 1554568200 - tz.transition 2019, 10, :o3, 1570293000 - tz.transition 2020, 4, :o2, 1586017800 - tz.transition 2020, 10, :o3, 1601742600 - tz.transition 2021, 4, :o2, 1617467400 - tz.transition 2021, 10, :o3, 1633192200 - tz.transition 2022, 4, :o2, 1648917000 - tz.transition 2022, 10, :o3, 1664641800 - tz.transition 2023, 4, :o2, 1680366600 - tz.transition 2023, 9, :o3, 1696091400 - tz.transition 2024, 4, :o2, 1712421000 - tz.transition 2024, 10, :o3, 1728145800 - tz.transition 2025, 4, :o2, 1743870600 - tz.transition 2025, 10, :o3, 1759595400 - tz.transition 2026, 4, :o2, 1775320200 - tz.transition 2026, 10, :o3, 1791045000 - tz.transition 2027, 4, :o2, 1806769800 - tz.transition 2027, 10, :o3, 1822494600 - tz.transition 2028, 4, :o2, 1838219400 - tz.transition 2028, 9, :o3, 1853944200 - tz.transition 2029, 3, :o2, 1869669000 - tz.transition 2029, 10, :o3, 1885998600 - tz.transition 2030, 4, :o2, 1901723400 - tz.transition 2030, 10, :o3, 1917448200 - tz.transition 2031, 4, :o2, 1933173000 - tz.transition 2031, 10, :o3, 1948897800 - tz.transition 2032, 4, :o2, 1964622600 - tz.transition 2032, 10, :o3, 1980347400 - tz.transition 2033, 4, :o2, 1996072200 - tz.transition 2033, 10, :o3, 2011797000 - tz.transition 2034, 4, :o2, 2027521800 - tz.transition 2034, 9, :o3, 2043246600 - tz.transition 2035, 3, :o2, 2058971400 - tz.transition 2035, 10, :o3, 2075301000 - tz.transition 2036, 4, :o2, 2091025800 - tz.transition 2036, 10, :o3, 2106750600 - tz.transition 2037, 4, :o2, 2122475400 - tz.transition 2037, 10, :o3, 2138200200 - tz.transition 2038, 4, :o2, 39448275, 16 - tz.transition 2038, 10, :o3, 39451187, 16 - tz.transition 2039, 4, :o2, 39454099, 16 - tz.transition 2039, 10, :o3, 39457011, 16 - tz.transition 2040, 3, :o2, 39459923, 16 - tz.transition 2040, 10, :o3, 39462947, 16 - tz.transition 2041, 4, :o2, 39465859, 16 - tz.transition 2041, 10, :o3, 39468771, 16 - tz.transition 2042, 4, :o2, 39471683, 16 - tz.transition 2042, 10, :o3, 39474595, 16 - tz.transition 2043, 4, :o2, 39477507, 16 - tz.transition 2043, 10, :o3, 39480419, 16 - tz.transition 2044, 4, :o2, 39483331, 16 - tz.transition 2044, 10, :o3, 39486243, 16 - tz.transition 2045, 4, :o2, 39489155, 16 - tz.transition 2045, 9, :o3, 39492067, 16 - tz.transition 2046, 3, :o2, 39494979, 16 - tz.transition 2046, 10, :o3, 39498003, 16 - tz.transition 2047, 4, :o2, 39500915, 16 - tz.transition 2047, 10, :o3, 39503827, 16 - tz.transition 2048, 4, :o2, 39506739, 16 - tz.transition 2048, 10, :o3, 39509651, 16 - tz.transition 2049, 4, :o2, 39512563, 16 - tz.transition 2049, 10, :o3, 39515475, 16 - tz.transition 2050, 4, :o2, 39518387, 16 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb deleted file mode 100644 index dd85ddae94..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Brisbane - include TimezoneDefinition - - timezone 'Australia/Brisbane' do |tz| - tz.offset :o0, 36728, 0, :LMT - tz.offset :o1, 36000, 0, :EST - tz.offset :o2, 36000, 3600, :EST - - tz.transition 1894, 12, :o1, 26062496009, 10800 - tz.transition 1916, 12, :o2, 3486569881, 1440 - tz.transition 1917, 3, :o1, 19370497, 8 - tz.transition 1941, 12, :o2, 14582161, 6 - tz.transition 1942, 3, :o1, 19443577, 8 - tz.transition 1942, 9, :o2, 14583775, 6 - tz.transition 1943, 3, :o1, 19446489, 8 - tz.transition 1943, 10, :o2, 14586001, 6 - tz.transition 1944, 3, :o1, 19449401, 8 - tz.transition 1971, 10, :o2, 57686400 - tz.transition 1972, 2, :o1, 67968000 - tz.transition 1989, 10, :o2, 625593600 - tz.transition 1990, 3, :o1, 636480000 - tz.transition 1990, 10, :o2, 657043200 - tz.transition 1991, 3, :o1, 667929600 - tz.transition 1991, 10, :o2, 688492800 - tz.transition 1992, 2, :o1, 699379200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb deleted file mode 100644 index 17de88124d..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Darwin - include TimezoneDefinition - - timezone 'Australia/Darwin' do |tz| - tz.offset :o0, 31400, 0, :LMT - tz.offset :o1, 32400, 0, :CST - tz.offset :o2, 34200, 0, :CST - tz.offset :o3, 34200, 3600, :CST - - tz.transition 1895, 1, :o1, 1042513259, 432 - tz.transition 1899, 4, :o2, 19318201, 8 - tz.transition 1916, 12, :o3, 3486569911, 1440 - tz.transition 1917, 3, :o2, 116222983, 48 - tz.transition 1941, 12, :o3, 38885763, 16 - tz.transition 1942, 3, :o2, 116661463, 48 - tz.transition 1942, 9, :o3, 38890067, 16 - tz.transition 1943, 3, :o2, 116678935, 48 - tz.transition 1943, 10, :o3, 38896003, 16 - tz.transition 1944, 3, :o2, 116696407, 48 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb deleted file mode 100644 index 11384b9840..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb +++ /dev/null @@ -1,193 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Hobart - include TimezoneDefinition - - timezone 'Australia/Hobart' do |tz| - tz.offset :o0, 35356, 0, :LMT - tz.offset :o1, 36000, 0, :EST - tz.offset :o2, 36000, 3600, :EST - - tz.transition 1895, 8, :o1, 52130241161, 21600 - tz.transition 1916, 9, :o2, 14526823, 6 - tz.transition 1917, 3, :o1, 19370497, 8 - tz.transition 1941, 12, :o2, 14582161, 6 - tz.transition 1942, 3, :o1, 19443577, 8 - tz.transition 1942, 9, :o2, 14583775, 6 - tz.transition 1943, 3, :o1, 19446489, 8 - tz.transition 1943, 10, :o2, 14586001, 6 - tz.transition 1944, 3, :o1, 19449401, 8 - tz.transition 1967, 9, :o2, 14638585, 6 - tz.transition 1968, 3, :o1, 14639677, 6 - tz.transition 1968, 10, :o2, 14640937, 6 - tz.transition 1969, 3, :o1, 14641735, 6 - tz.transition 1969, 10, :o2, 14643121, 6 - tz.transition 1970, 3, :o1, 5673600 - tz.transition 1970, 10, :o2, 25632000 - tz.transition 1971, 3, :o1, 37728000 - tz.transition 1971, 10, :o2, 57686400 - tz.transition 1972, 2, :o1, 67968000 - tz.transition 1972, 10, :o2, 89136000 - tz.transition 1973, 3, :o1, 100022400 - tz.transition 1973, 10, :o2, 120585600 - tz.transition 1974, 3, :o1, 131472000 - tz.transition 1974, 10, :o2, 152035200 - tz.transition 1975, 3, :o1, 162921600 - tz.transition 1975, 10, :o2, 183484800 - tz.transition 1976, 3, :o1, 194976000 - tz.transition 1976, 10, :o2, 215539200 - tz.transition 1977, 3, :o1, 226425600 - tz.transition 1977, 10, :o2, 246988800 - tz.transition 1978, 3, :o1, 257875200 - tz.transition 1978, 10, :o2, 278438400 - tz.transition 1979, 3, :o1, 289324800 - tz.transition 1979, 10, :o2, 309888000 - tz.transition 1980, 3, :o1, 320774400 - tz.transition 1980, 10, :o2, 341337600 - tz.transition 1981, 2, :o1, 352224000 - tz.transition 1981, 10, :o2, 372787200 - tz.transition 1982, 3, :o1, 386092800 - tz.transition 1982, 10, :o2, 404841600 - tz.transition 1983, 3, :o1, 417542400 - tz.transition 1983, 10, :o2, 436291200 - tz.transition 1984, 3, :o1, 447177600 - tz.transition 1984, 10, :o2, 467740800 - tz.transition 1985, 3, :o1, 478627200 - tz.transition 1985, 10, :o2, 499190400 - tz.transition 1986, 3, :o1, 510076800 - tz.transition 1986, 10, :o2, 530035200 - tz.transition 1987, 3, :o1, 542736000 - tz.transition 1987, 10, :o2, 562089600 - tz.transition 1988, 3, :o1, 574790400 - tz.transition 1988, 10, :o2, 594144000 - tz.transition 1989, 3, :o1, 606240000 - tz.transition 1989, 10, :o2, 625593600 - tz.transition 1990, 3, :o1, 637689600 - tz.transition 1990, 10, :o2, 657043200 - tz.transition 1991, 3, :o1, 670348800 - tz.transition 1991, 10, :o2, 686678400 - tz.transition 1992, 3, :o1, 701798400 - tz.transition 1992, 10, :o2, 718128000 - tz.transition 1993, 3, :o1, 733248000 - tz.transition 1993, 10, :o2, 749577600 - tz.transition 1994, 3, :o1, 764697600 - tz.transition 1994, 10, :o2, 781027200 - tz.transition 1995, 3, :o1, 796147200 - tz.transition 1995, 9, :o2, 812476800 - tz.transition 1996, 3, :o1, 828201600 - tz.transition 1996, 10, :o2, 844531200 - tz.transition 1997, 3, :o1, 859651200 - tz.transition 1997, 10, :o2, 875980800 - tz.transition 1998, 3, :o1, 891100800 - tz.transition 1998, 10, :o2, 907430400 - tz.transition 1999, 3, :o1, 922550400 - tz.transition 1999, 10, :o2, 938880000 - tz.transition 2000, 3, :o1, 954000000 - tz.transition 2000, 8, :o2, 967305600 - tz.transition 2001, 3, :o1, 985449600 - tz.transition 2001, 10, :o2, 1002384000 - tz.transition 2002, 3, :o1, 1017504000 - tz.transition 2002, 10, :o2, 1033833600 - tz.transition 2003, 3, :o1, 1048953600 - tz.transition 2003, 10, :o2, 1065283200 - tz.transition 2004, 3, :o1, 1080403200 - tz.transition 2004, 10, :o2, 1096732800 - tz.transition 2005, 3, :o1, 1111852800 - tz.transition 2005, 10, :o2, 1128182400 - tz.transition 2006, 4, :o1, 1143907200 - tz.transition 2006, 9, :o2, 1159632000 - tz.transition 2007, 3, :o1, 1174752000 - tz.transition 2007, 10, :o2, 1191686400 - tz.transition 2008, 4, :o1, 1207411200 - tz.transition 2008, 10, :o2, 1223136000 - tz.transition 2009, 4, :o1, 1238860800 - tz.transition 2009, 10, :o2, 1254585600 - tz.transition 2010, 4, :o1, 1270310400 - tz.transition 2010, 10, :o2, 1286035200 - tz.transition 2011, 4, :o1, 1301760000 - tz.transition 2011, 10, :o2, 1317484800 - tz.transition 2012, 3, :o1, 1333209600 - tz.transition 2012, 10, :o2, 1349539200 - tz.transition 2013, 4, :o1, 1365264000 - tz.transition 2013, 10, :o2, 1380988800 - tz.transition 2014, 4, :o1, 1396713600 - tz.transition 2014, 10, :o2, 1412438400 - tz.transition 2015, 4, :o1, 1428163200 - tz.transition 2015, 10, :o2, 1443888000 - tz.transition 2016, 4, :o1, 1459612800 - tz.transition 2016, 10, :o2, 1475337600 - tz.transition 2017, 4, :o1, 1491062400 - tz.transition 2017, 9, :o2, 1506787200 - tz.transition 2018, 3, :o1, 1522512000 - tz.transition 2018, 10, :o2, 1538841600 - tz.transition 2019, 4, :o1, 1554566400 - tz.transition 2019, 10, :o2, 1570291200 - tz.transition 2020, 4, :o1, 1586016000 - tz.transition 2020, 10, :o2, 1601740800 - tz.transition 2021, 4, :o1, 1617465600 - tz.transition 2021, 10, :o2, 1633190400 - tz.transition 2022, 4, :o1, 1648915200 - tz.transition 2022, 10, :o2, 1664640000 - tz.transition 2023, 4, :o1, 1680364800 - tz.transition 2023, 9, :o2, 1696089600 - tz.transition 2024, 4, :o1, 1712419200 - tz.transition 2024, 10, :o2, 1728144000 - tz.transition 2025, 4, :o1, 1743868800 - tz.transition 2025, 10, :o2, 1759593600 - tz.transition 2026, 4, :o1, 1775318400 - tz.transition 2026, 10, :o2, 1791043200 - tz.transition 2027, 4, :o1, 1806768000 - tz.transition 2027, 10, :o2, 1822492800 - tz.transition 2028, 4, :o1, 1838217600 - tz.transition 2028, 9, :o2, 1853942400 - tz.transition 2029, 3, :o1, 1869667200 - tz.transition 2029, 10, :o2, 1885996800 - tz.transition 2030, 4, :o1, 1901721600 - tz.transition 2030, 10, :o2, 1917446400 - tz.transition 2031, 4, :o1, 1933171200 - tz.transition 2031, 10, :o2, 1948896000 - tz.transition 2032, 4, :o1, 1964620800 - tz.transition 2032, 10, :o2, 1980345600 - tz.transition 2033, 4, :o1, 1996070400 - tz.transition 2033, 10, :o2, 2011795200 - tz.transition 2034, 4, :o1, 2027520000 - tz.transition 2034, 9, :o2, 2043244800 - tz.transition 2035, 3, :o1, 2058969600 - tz.transition 2035, 10, :o2, 2075299200 - tz.transition 2036, 4, :o1, 2091024000 - tz.transition 2036, 10, :o2, 2106748800 - tz.transition 2037, 4, :o1, 2122473600 - tz.transition 2037, 10, :o2, 2138198400 - tz.transition 2038, 4, :o1, 14793103, 6 - tz.transition 2038, 10, :o2, 14794195, 6 - tz.transition 2039, 4, :o1, 14795287, 6 - tz.transition 2039, 10, :o2, 14796379, 6 - tz.transition 2040, 3, :o1, 14797471, 6 - tz.transition 2040, 10, :o2, 14798605, 6 - tz.transition 2041, 4, :o1, 14799697, 6 - tz.transition 2041, 10, :o2, 14800789, 6 - tz.transition 2042, 4, :o1, 14801881, 6 - tz.transition 2042, 10, :o2, 14802973, 6 - tz.transition 2043, 4, :o1, 14804065, 6 - tz.transition 2043, 10, :o2, 14805157, 6 - tz.transition 2044, 4, :o1, 14806249, 6 - tz.transition 2044, 10, :o2, 14807341, 6 - tz.transition 2045, 4, :o1, 14808433, 6 - tz.transition 2045, 9, :o2, 14809525, 6 - tz.transition 2046, 3, :o1, 14810617, 6 - tz.transition 2046, 10, :o2, 14811751, 6 - tz.transition 2047, 4, :o1, 14812843, 6 - tz.transition 2047, 10, :o2, 14813935, 6 - tz.transition 2048, 4, :o1, 14815027, 6 - tz.transition 2048, 10, :o2, 14816119, 6 - tz.transition 2049, 4, :o1, 14817211, 6 - tz.transition 2049, 10, :o2, 14818303, 6 - tz.transition 2050, 4, :o1, 14819395, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb deleted file mode 100644 index c1304488ea..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Melbourne - include TimezoneDefinition - - timezone 'Australia/Melbourne' do |tz| - tz.offset :o0, 34792, 0, :LMT - tz.offset :o1, 36000, 0, :EST - tz.offset :o2, 36000, 3600, :EST - - tz.transition 1895, 1, :o1, 26062831051, 10800 - tz.transition 1916, 12, :o2, 3486569881, 1440 - tz.transition 1917, 3, :o1, 19370497, 8 - tz.transition 1941, 12, :o2, 14582161, 6 - tz.transition 1942, 3, :o1, 19443577, 8 - tz.transition 1942, 9, :o2, 14583775, 6 - tz.transition 1943, 3, :o1, 19446489, 8 - tz.transition 1943, 10, :o2, 14586001, 6 - tz.transition 1944, 3, :o1, 19449401, 8 - tz.transition 1971, 10, :o2, 57686400 - tz.transition 1972, 2, :o1, 67968000 - tz.transition 1972, 10, :o2, 89136000 - tz.transition 1973, 3, :o1, 100022400 - tz.transition 1973, 10, :o2, 120585600 - tz.transition 1974, 3, :o1, 131472000 - tz.transition 1974, 10, :o2, 152035200 - tz.transition 1975, 3, :o1, 162921600 - tz.transition 1975, 10, :o2, 183484800 - tz.transition 1976, 3, :o1, 194976000 - tz.transition 1976, 10, :o2, 215539200 - tz.transition 1977, 3, :o1, 226425600 - tz.transition 1977, 10, :o2, 246988800 - tz.transition 1978, 3, :o1, 257875200 - tz.transition 1978, 10, :o2, 278438400 - tz.transition 1979, 3, :o1, 289324800 - tz.transition 1979, 10, :o2, 309888000 - tz.transition 1980, 3, :o1, 320774400 - tz.transition 1980, 10, :o2, 341337600 - tz.transition 1981, 2, :o1, 352224000 - tz.transition 1981, 10, :o2, 372787200 - tz.transition 1982, 3, :o1, 384278400 - tz.transition 1982, 10, :o2, 404841600 - tz.transition 1983, 3, :o1, 415728000 - tz.transition 1983, 10, :o2, 436291200 - tz.transition 1984, 3, :o1, 447177600 - tz.transition 1984, 10, :o2, 467740800 - tz.transition 1985, 3, :o1, 478627200 - tz.transition 1985, 10, :o2, 499190400 - tz.transition 1986, 3, :o1, 511286400 - tz.transition 1986, 10, :o2, 530035200 - tz.transition 1987, 3, :o1, 542736000 - tz.transition 1987, 10, :o2, 561484800 - tz.transition 1988, 3, :o1, 574790400 - tz.transition 1988, 10, :o2, 594144000 - tz.transition 1989, 3, :o1, 606240000 - tz.transition 1989, 10, :o2, 625593600 - tz.transition 1990, 3, :o1, 637689600 - tz.transition 1990, 10, :o2, 657043200 - tz.transition 1991, 3, :o1, 667929600 - tz.transition 1991, 10, :o2, 688492800 - tz.transition 1992, 2, :o1, 699379200 - tz.transition 1992, 10, :o2, 719942400 - tz.transition 1993, 3, :o1, 731433600 - tz.transition 1993, 10, :o2, 751996800 - tz.transition 1994, 3, :o1, 762883200 - tz.transition 1994, 10, :o2, 783446400 - tz.transition 1995, 3, :o1, 796147200 - tz.transition 1995, 10, :o2, 814896000 - tz.transition 1996, 3, :o1, 828201600 - tz.transition 1996, 10, :o2, 846345600 - tz.transition 1997, 3, :o1, 859651200 - tz.transition 1997, 10, :o2, 877795200 - tz.transition 1998, 3, :o1, 891100800 - tz.transition 1998, 10, :o2, 909244800 - tz.transition 1999, 3, :o1, 922550400 - tz.transition 1999, 10, :o2, 941299200 - tz.transition 2000, 3, :o1, 954000000 - tz.transition 2000, 8, :o2, 967305600 - tz.transition 2001, 3, :o1, 985449600 - tz.transition 2001, 10, :o2, 1004198400 - tz.transition 2002, 3, :o1, 1017504000 - tz.transition 2002, 10, :o2, 1035648000 - tz.transition 2003, 3, :o1, 1048953600 - tz.transition 2003, 10, :o2, 1067097600 - tz.transition 2004, 3, :o1, 1080403200 - tz.transition 2004, 10, :o2, 1099152000 - tz.transition 2005, 3, :o1, 1111852800 - tz.transition 2005, 10, :o2, 1130601600 - tz.transition 2006, 4, :o1, 1143907200 - tz.transition 2006, 10, :o2, 1162051200 - tz.transition 2007, 3, :o1, 1174752000 - tz.transition 2007, 10, :o2, 1193500800 - tz.transition 2008, 4, :o1, 1207411200 - tz.transition 2008, 10, :o2, 1223136000 - tz.transition 2009, 4, :o1, 1238860800 - tz.transition 2009, 10, :o2, 1254585600 - tz.transition 2010, 4, :o1, 1270310400 - tz.transition 2010, 10, :o2, 1286035200 - tz.transition 2011, 4, :o1, 1301760000 - tz.transition 2011, 10, :o2, 1317484800 - tz.transition 2012, 3, :o1, 1333209600 - tz.transition 2012, 10, :o2, 1349539200 - tz.transition 2013, 4, :o1, 1365264000 - tz.transition 2013, 10, :o2, 1380988800 - tz.transition 2014, 4, :o1, 1396713600 - tz.transition 2014, 10, :o2, 1412438400 - tz.transition 2015, 4, :o1, 1428163200 - tz.transition 2015, 10, :o2, 1443888000 - tz.transition 2016, 4, :o1, 1459612800 - tz.transition 2016, 10, :o2, 1475337600 - tz.transition 2017, 4, :o1, 1491062400 - tz.transition 2017, 9, :o2, 1506787200 - tz.transition 2018, 3, :o1, 1522512000 - tz.transition 2018, 10, :o2, 1538841600 - tz.transition 2019, 4, :o1, 1554566400 - tz.transition 2019, 10, :o2, 1570291200 - tz.transition 2020, 4, :o1, 1586016000 - tz.transition 2020, 10, :o2, 1601740800 - tz.transition 2021, 4, :o1, 1617465600 - tz.transition 2021, 10, :o2, 1633190400 - tz.transition 2022, 4, :o1, 1648915200 - tz.transition 2022, 10, :o2, 1664640000 - tz.transition 2023, 4, :o1, 1680364800 - tz.transition 2023, 9, :o2, 1696089600 - tz.transition 2024, 4, :o1, 1712419200 - tz.transition 2024, 10, :o2, 1728144000 - tz.transition 2025, 4, :o1, 1743868800 - tz.transition 2025, 10, :o2, 1759593600 - tz.transition 2026, 4, :o1, 1775318400 - tz.transition 2026, 10, :o2, 1791043200 - tz.transition 2027, 4, :o1, 1806768000 - tz.transition 2027, 10, :o2, 1822492800 - tz.transition 2028, 4, :o1, 1838217600 - tz.transition 2028, 9, :o2, 1853942400 - tz.transition 2029, 3, :o1, 1869667200 - tz.transition 2029, 10, :o2, 1885996800 - tz.transition 2030, 4, :o1, 1901721600 - tz.transition 2030, 10, :o2, 1917446400 - tz.transition 2031, 4, :o1, 1933171200 - tz.transition 2031, 10, :o2, 1948896000 - tz.transition 2032, 4, :o1, 1964620800 - tz.transition 2032, 10, :o2, 1980345600 - tz.transition 2033, 4, :o1, 1996070400 - tz.transition 2033, 10, :o2, 2011795200 - tz.transition 2034, 4, :o1, 2027520000 - tz.transition 2034, 9, :o2, 2043244800 - tz.transition 2035, 3, :o1, 2058969600 - tz.transition 2035, 10, :o2, 2075299200 - tz.transition 2036, 4, :o1, 2091024000 - tz.transition 2036, 10, :o2, 2106748800 - tz.transition 2037, 4, :o1, 2122473600 - tz.transition 2037, 10, :o2, 2138198400 - tz.transition 2038, 4, :o1, 14793103, 6 - tz.transition 2038, 10, :o2, 14794195, 6 - tz.transition 2039, 4, :o1, 14795287, 6 - tz.transition 2039, 10, :o2, 14796379, 6 - tz.transition 2040, 3, :o1, 14797471, 6 - tz.transition 2040, 10, :o2, 14798605, 6 - tz.transition 2041, 4, :o1, 14799697, 6 - tz.transition 2041, 10, :o2, 14800789, 6 - tz.transition 2042, 4, :o1, 14801881, 6 - tz.transition 2042, 10, :o2, 14802973, 6 - tz.transition 2043, 4, :o1, 14804065, 6 - tz.transition 2043, 10, :o2, 14805157, 6 - tz.transition 2044, 4, :o1, 14806249, 6 - tz.transition 2044, 10, :o2, 14807341, 6 - tz.transition 2045, 4, :o1, 14808433, 6 - tz.transition 2045, 9, :o2, 14809525, 6 - tz.transition 2046, 3, :o1, 14810617, 6 - tz.transition 2046, 10, :o2, 14811751, 6 - tz.transition 2047, 4, :o1, 14812843, 6 - tz.transition 2047, 10, :o2, 14813935, 6 - tz.transition 2048, 4, :o1, 14815027, 6 - tz.transition 2048, 10, :o2, 14816119, 6 - tz.transition 2049, 4, :o1, 14817211, 6 - tz.transition 2049, 10, :o2, 14818303, 6 - tz.transition 2050, 4, :o1, 14819395, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb deleted file mode 100644 index d9e66f14a8..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Perth - include TimezoneDefinition - - timezone 'Australia/Perth' do |tz| - tz.offset :o0, 27804, 0, :LMT - tz.offset :o1, 28800, 0, :WST - tz.offset :o2, 28800, 3600, :WST - - tz.transition 1895, 11, :o1, 17377402883, 7200 - tz.transition 1916, 12, :o2, 3486570001, 1440 - tz.transition 1917, 3, :o1, 58111493, 24 - tz.transition 1941, 12, :o2, 9721441, 4 - tz.transition 1942, 3, :o1, 58330733, 24 - tz.transition 1942, 9, :o2, 9722517, 4 - tz.transition 1943, 3, :o1, 58339469, 24 - tz.transition 1974, 10, :o2, 152042400 - tz.transition 1975, 3, :o1, 162928800 - tz.transition 1983, 10, :o2, 436298400 - tz.transition 1984, 3, :o1, 447184800 - tz.transition 1991, 11, :o2, 690314400 - tz.transition 1992, 2, :o1, 699386400 - tz.transition 2006, 12, :o2, 1165082400 - tz.transition 2007, 3, :o1, 1174759200 - tz.transition 2007, 10, :o2, 1193508000 - tz.transition 2008, 3, :o1, 1206813600 - tz.transition 2008, 10, :o2, 1224957600 - tz.transition 2009, 3, :o1, 1238263200 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb deleted file mode 100644 index 9062bd7c3c..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Australia - module Sydney - include TimezoneDefinition - - timezone 'Australia/Sydney' do |tz| - tz.offset :o0, 36292, 0, :LMT - tz.offset :o1, 36000, 0, :EST - tz.offset :o2, 36000, 3600, :EST - - tz.transition 1895, 1, :o1, 52125661727, 21600 - tz.transition 1916, 12, :o2, 3486569881, 1440 - tz.transition 1917, 3, :o1, 19370497, 8 - tz.transition 1941, 12, :o2, 14582161, 6 - tz.transition 1942, 3, :o1, 19443577, 8 - tz.transition 1942, 9, :o2, 14583775, 6 - tz.transition 1943, 3, :o1, 19446489, 8 - tz.transition 1943, 10, :o2, 14586001, 6 - tz.transition 1944, 3, :o1, 19449401, 8 - tz.transition 1971, 10, :o2, 57686400 - tz.transition 1972, 2, :o1, 67968000 - tz.transition 1972, 10, :o2, 89136000 - tz.transition 1973, 3, :o1, 100022400 - tz.transition 1973, 10, :o2, 120585600 - tz.transition 1974, 3, :o1, 131472000 - tz.transition 1974, 10, :o2, 152035200 - tz.transition 1975, 3, :o1, 162921600 - tz.transition 1975, 10, :o2, 183484800 - tz.transition 1976, 3, :o1, 194976000 - tz.transition 1976, 10, :o2, 215539200 - tz.transition 1977, 3, :o1, 226425600 - tz.transition 1977, 10, :o2, 246988800 - tz.transition 1978, 3, :o1, 257875200 - tz.transition 1978, 10, :o2, 278438400 - tz.transition 1979, 3, :o1, 289324800 - tz.transition 1979, 10, :o2, 309888000 - tz.transition 1980, 3, :o1, 320774400 - tz.transition 1980, 10, :o2, 341337600 - tz.transition 1981, 2, :o1, 352224000 - tz.transition 1981, 10, :o2, 372787200 - tz.transition 1982, 4, :o1, 386697600 - tz.transition 1982, 10, :o2, 404841600 - tz.transition 1983, 3, :o1, 415728000 - tz.transition 1983, 10, :o2, 436291200 - tz.transition 1984, 3, :o1, 447177600 - tz.transition 1984, 10, :o2, 467740800 - tz.transition 1985, 3, :o1, 478627200 - tz.transition 1985, 10, :o2, 499190400 - tz.transition 1986, 3, :o1, 511286400 - tz.transition 1986, 10, :o2, 530035200 - tz.transition 1987, 3, :o1, 542736000 - tz.transition 1987, 10, :o2, 562089600 - tz.transition 1988, 3, :o1, 574790400 - tz.transition 1988, 10, :o2, 594144000 - tz.transition 1989, 3, :o1, 606240000 - tz.transition 1989, 10, :o2, 625593600 - tz.transition 1990, 3, :o1, 636480000 - tz.transition 1990, 10, :o2, 657043200 - tz.transition 1991, 3, :o1, 667929600 - tz.transition 1991, 10, :o2, 688492800 - tz.transition 1992, 2, :o1, 699379200 - tz.transition 1992, 10, :o2, 719942400 - tz.transition 1993, 3, :o1, 731433600 - tz.transition 1993, 10, :o2, 751996800 - tz.transition 1994, 3, :o1, 762883200 - tz.transition 1994, 10, :o2, 783446400 - tz.transition 1995, 3, :o1, 794332800 - tz.transition 1995, 10, :o2, 814896000 - tz.transition 1996, 3, :o1, 828201600 - tz.transition 1996, 10, :o2, 846345600 - tz.transition 1997, 3, :o1, 859651200 - tz.transition 1997, 10, :o2, 877795200 - tz.transition 1998, 3, :o1, 891100800 - tz.transition 1998, 10, :o2, 909244800 - tz.transition 1999, 3, :o1, 922550400 - tz.transition 1999, 10, :o2, 941299200 - tz.transition 2000, 3, :o1, 954000000 - tz.transition 2000, 8, :o2, 967305600 - tz.transition 2001, 3, :o1, 985449600 - tz.transition 2001, 10, :o2, 1004198400 - tz.transition 2002, 3, :o1, 1017504000 - tz.transition 2002, 10, :o2, 1035648000 - tz.transition 2003, 3, :o1, 1048953600 - tz.transition 2003, 10, :o2, 1067097600 - tz.transition 2004, 3, :o1, 1080403200 - tz.transition 2004, 10, :o2, 1099152000 - tz.transition 2005, 3, :o1, 1111852800 - tz.transition 2005, 10, :o2, 1130601600 - tz.transition 2006, 4, :o1, 1143907200 - tz.transition 2006, 10, :o2, 1162051200 - tz.transition 2007, 3, :o1, 1174752000 - tz.transition 2007, 10, :o2, 1193500800 - tz.transition 2008, 4, :o1, 1207411200 - tz.transition 2008, 10, :o2, 1223136000 - tz.transition 2009, 4, :o1, 1238860800 - tz.transition 2009, 10, :o2, 1254585600 - tz.transition 2010, 4, :o1, 1270310400 - tz.transition 2010, 10, :o2, 1286035200 - tz.transition 2011, 4, :o1, 1301760000 - tz.transition 2011, 10, :o2, 1317484800 - tz.transition 2012, 3, :o1, 1333209600 - tz.transition 2012, 10, :o2, 1349539200 - tz.transition 2013, 4, :o1, 1365264000 - tz.transition 2013, 10, :o2, 1380988800 - tz.transition 2014, 4, :o1, 1396713600 - tz.transition 2014, 10, :o2, 1412438400 - tz.transition 2015, 4, :o1, 1428163200 - tz.transition 2015, 10, :o2, 1443888000 - tz.transition 2016, 4, :o1, 1459612800 - tz.transition 2016, 10, :o2, 1475337600 - tz.transition 2017, 4, :o1, 1491062400 - tz.transition 2017, 9, :o2, 1506787200 - tz.transition 2018, 3, :o1, 1522512000 - tz.transition 2018, 10, :o2, 1538841600 - tz.transition 2019, 4, :o1, 1554566400 - tz.transition 2019, 10, :o2, 1570291200 - tz.transition 2020, 4, :o1, 1586016000 - tz.transition 2020, 10, :o2, 1601740800 - tz.transition 2021, 4, :o1, 1617465600 - tz.transition 2021, 10, :o2, 1633190400 - tz.transition 2022, 4, :o1, 1648915200 - tz.transition 2022, 10, :o2, 1664640000 - tz.transition 2023, 4, :o1, 1680364800 - tz.transition 2023, 9, :o2, 1696089600 - tz.transition 2024, 4, :o1, 1712419200 - tz.transition 2024, 10, :o2, 1728144000 - tz.transition 2025, 4, :o1, 1743868800 - tz.transition 2025, 10, :o2, 1759593600 - tz.transition 2026, 4, :o1, 1775318400 - tz.transition 2026, 10, :o2, 1791043200 - tz.transition 2027, 4, :o1, 1806768000 - tz.transition 2027, 10, :o2, 1822492800 - tz.transition 2028, 4, :o1, 1838217600 - tz.transition 2028, 9, :o2, 1853942400 - tz.transition 2029, 3, :o1, 1869667200 - tz.transition 2029, 10, :o2, 1885996800 - tz.transition 2030, 4, :o1, 1901721600 - tz.transition 2030, 10, :o2, 1917446400 - tz.transition 2031, 4, :o1, 1933171200 - tz.transition 2031, 10, :o2, 1948896000 - tz.transition 2032, 4, :o1, 1964620800 - tz.transition 2032, 10, :o2, 1980345600 - tz.transition 2033, 4, :o1, 1996070400 - tz.transition 2033, 10, :o2, 2011795200 - tz.transition 2034, 4, :o1, 2027520000 - tz.transition 2034, 9, :o2, 2043244800 - tz.transition 2035, 3, :o1, 2058969600 - tz.transition 2035, 10, :o2, 2075299200 - tz.transition 2036, 4, :o1, 2091024000 - tz.transition 2036, 10, :o2, 2106748800 - tz.transition 2037, 4, :o1, 2122473600 - tz.transition 2037, 10, :o2, 2138198400 - tz.transition 2038, 4, :o1, 14793103, 6 - tz.transition 2038, 10, :o2, 14794195, 6 - tz.transition 2039, 4, :o1, 14795287, 6 - tz.transition 2039, 10, :o2, 14796379, 6 - tz.transition 2040, 3, :o1, 14797471, 6 - tz.transition 2040, 10, :o2, 14798605, 6 - tz.transition 2041, 4, :o1, 14799697, 6 - tz.transition 2041, 10, :o2, 14800789, 6 - tz.transition 2042, 4, :o1, 14801881, 6 - tz.transition 2042, 10, :o2, 14802973, 6 - tz.transition 2043, 4, :o1, 14804065, 6 - tz.transition 2043, 10, :o2, 14805157, 6 - tz.transition 2044, 4, :o1, 14806249, 6 - tz.transition 2044, 10, :o2, 14807341, 6 - tz.transition 2045, 4, :o1, 14808433, 6 - tz.transition 2045, 9, :o2, 14809525, 6 - tz.transition 2046, 3, :o1, 14810617, 6 - tz.transition 2046, 10, :o2, 14811751, 6 - tz.transition 2047, 4, :o1, 14812843, 6 - tz.transition 2047, 10, :o2, 14813935, 6 - tz.transition 2048, 4, :o1, 14815027, 6 - tz.transition 2048, 10, :o2, 14816119, 6 - tz.transition 2049, 4, :o1, 14817211, 6 - tz.transition 2049, 10, :o2, 14818303, 6 - tz.transition 2050, 4, :o1, 14819395, 6 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb deleted file mode 100644 index 28b2c6a04c..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Etc - module UTC - include TimezoneDefinition - - timezone 'Etc/UTC' do |tz| - tz.offset :o0, 0, 0, :UTC - - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb deleted file mode 100644 index 2d0c95c4bc..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb +++ /dev/null @@ -1,228 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Amsterdam - include TimezoneDefinition - - timezone 'Europe/Amsterdam' do |tz| - tz.offset :o0, 1172, 0, :LMT - tz.offset :o1, 1172, 0, :AMT - tz.offset :o2, 1172, 3600, :NST - tz.offset :o3, 1200, 3600, :NEST - tz.offset :o4, 1200, 0, :NET - tz.offset :o5, 3600, 3600, :CEST - tz.offset :o6, 3600, 0, :CET - - tz.transition 1834, 12, :o1, 51651636907, 21600 - tz.transition 1916, 4, :o2, 52293264907, 21600 - tz.transition 1916, 9, :o1, 52296568807, 21600 - tz.transition 1917, 4, :o2, 52300826707, 21600 - tz.transition 1917, 9, :o1, 52304153107, 21600 - tz.transition 1918, 4, :o2, 52308386707, 21600 - tz.transition 1918, 9, :o1, 52312317907, 21600 - tz.transition 1919, 4, :o2, 52316400307, 21600 - tz.transition 1919, 9, :o1, 52320180307, 21600 - tz.transition 1920, 4, :o2, 52324262707, 21600 - tz.transition 1920, 9, :o1, 52328042707, 21600 - tz.transition 1921, 4, :o2, 52332125107, 21600 - tz.transition 1921, 9, :o1, 52335905107, 21600 - tz.transition 1922, 3, :o2, 52339814707, 21600 - tz.transition 1922, 10, :o1, 52344048307, 21600 - tz.transition 1923, 6, :o2, 52349145907, 21600 - tz.transition 1923, 10, :o1, 52351910707, 21600 - tz.transition 1924, 3, :o2, 52355690707, 21600 - tz.transition 1924, 10, :o1, 52359773107, 21600 - tz.transition 1925, 6, :o2, 52365021907, 21600 - tz.transition 1925, 10, :o1, 52367635507, 21600 - tz.transition 1926, 5, :o2, 52372452307, 21600 - tz.transition 1926, 10, :o1, 52375497907, 21600 - tz.transition 1927, 5, :o2, 52380336307, 21600 - tz.transition 1927, 10, :o1, 52383360307, 21600 - tz.transition 1928, 5, :o2, 52388241907, 21600 - tz.transition 1928, 10, :o1, 52391373907, 21600 - tz.transition 1929, 5, :o2, 52396125907, 21600 - tz.transition 1929, 10, :o1, 52399236307, 21600 - tz.transition 1930, 5, :o2, 52404009907, 21600 - tz.transition 1930, 10, :o1, 52407098707, 21600 - tz.transition 1931, 5, :o2, 52411893907, 21600 - tz.transition 1931, 10, :o1, 52414961107, 21600 - tz.transition 1932, 5, :o2, 52419950707, 21600 - tz.transition 1932, 10, :o1, 52422823507, 21600 - tz.transition 1933, 5, :o2, 52427683507, 21600 - tz.transition 1933, 10, :o1, 52430837107, 21600 - tz.transition 1934, 5, :o2, 52435567507, 21600 - tz.transition 1934, 10, :o1, 52438699507, 21600 - tz.transition 1935, 5, :o2, 52443451507, 21600 - tz.transition 1935, 10, :o1, 52446561907, 21600 - tz.transition 1936, 5, :o2, 52451357107, 21600 - tz.transition 1936, 10, :o1, 52454424307, 21600 - tz.transition 1937, 5, :o2, 52459392307, 21600 - tz.transition 1937, 6, :o3, 52460253607, 21600 - tz.transition 1937, 10, :o4, 174874289, 72 - tz.transition 1938, 5, :o3, 174890417, 72 - tz.transition 1938, 10, :o4, 174900497, 72 - tz.transition 1939, 5, :o3, 174916697, 72 - tz.transition 1939, 10, :o4, 174927209, 72 - tz.transition 1940, 5, :o5, 174943115, 72 - tz.transition 1942, 11, :o6, 58335973, 24 - tz.transition 1943, 3, :o5, 58339501, 24 - tz.transition 1943, 10, :o6, 58344037, 24 - tz.transition 1944, 4, :o5, 58348405, 24 - tz.transition 1944, 10, :o6, 58352773, 24 - tz.transition 1945, 4, :o5, 58357141, 24 - tz.transition 1945, 9, :o6, 58361149, 24 - tz.transition 1977, 4, :o5, 228877200 - tz.transition 1977, 9, :o6, 243997200 - tz.transition 1978, 4, :o5, 260326800 - tz.transition 1978, 10, :o6, 276051600 - tz.transition 1979, 4, :o5, 291776400 - tz.transition 1979, 9, :o6, 307501200 - tz.transition 1980, 4, :o5, 323830800 - tz.transition 1980, 9, :o6, 338950800 - tz.transition 1981, 3, :o5, 354675600 - tz.transition 1981, 9, :o6, 370400400 - tz.transition 1982, 3, :o5, 386125200 - tz.transition 1982, 9, :o6, 401850000 - tz.transition 1983, 3, :o5, 417574800 - tz.transition 1983, 9, :o6, 433299600 - tz.transition 1984, 3, :o5, 449024400 - tz.transition 1984, 9, :o6, 465354000 - tz.transition 1985, 3, :o5, 481078800 - tz.transition 1985, 9, :o6, 496803600 - tz.transition 1986, 3, :o5, 512528400 - tz.transition 1986, 9, :o6, 528253200 - tz.transition 1987, 3, :o5, 543978000 - tz.transition 1987, 9, :o6, 559702800 - tz.transition 1988, 3, :o5, 575427600 - tz.transition 1988, 9, :o6, 591152400 - tz.transition 1989, 3, :o5, 606877200 - tz.transition 1989, 9, :o6, 622602000 - tz.transition 1990, 3, :o5, 638326800 - tz.transition 1990, 9, :o6, 654656400 - tz.transition 1991, 3, :o5, 670381200 - tz.transition 1991, 9, :o6, 686106000 - tz.transition 1992, 3, :o5, 701830800 - tz.transition 1992, 9, :o6, 717555600 - tz.transition 1993, 3, :o5, 733280400 - tz.transition 1993, 9, :o6, 749005200 - tz.transition 1994, 3, :o5, 764730000 - tz.transition 1994, 9, :o6, 780454800 - tz.transition 1995, 3, :o5, 796179600 - tz.transition 1995, 9, :o6, 811904400 - tz.transition 1996, 3, :o5, 828234000 - tz.transition 1996, 10, :o6, 846378000 - tz.transition 1997, 3, :o5, 859683600 - tz.transition 1997, 10, :o6, 877827600 - tz.transition 1998, 3, :o5, 891133200 - tz.transition 1998, 10, :o6, 909277200 - tz.transition 1999, 3, :o5, 922582800 - tz.transition 1999, 10, :o6, 941331600 - tz.transition 2000, 3, :o5, 954032400 - tz.transition 2000, 10, :o6, 972781200 - tz.transition 2001, 3, :o5, 985482000 - tz.transition 2001, 10, :o6, 1004230800 - tz.transition 2002, 3, :o5, 1017536400 - tz.transition 2002, 10, :o6, 1035680400 - tz.transition 2003, 3, :o5, 1048986000 - tz.transition 2003, 10, :o6, 1067130000 - tz.transition 2004, 3, :o5, 1080435600 - tz.transition 2004, 10, :o6, 1099184400 - tz.transition 2005, 3, :o5, 1111885200 - tz.transition 2005, 10, :o6, 1130634000 - tz.transition 2006, 3, :o5, 1143334800 - tz.transition 2006, 10, :o6, 1162083600 - tz.transition 2007, 3, :o5, 1174784400 - tz.transition 2007, 10, :o6, 1193533200 - tz.transition 2008, 3, :o5, 1206838800 - tz.transition 2008, 10, :o6, 1224982800 - tz.transition 2009, 3, :o5, 1238288400 - tz.transition 2009, 10, :o6, 1256432400 - tz.transition 2010, 3, :o5, 1269738000 - tz.transition 2010, 10, :o6, 1288486800 - tz.transition 2011, 3, :o5, 1301187600 - tz.transition 2011, 10, :o6, 1319936400 - tz.transition 2012, 3, :o5, 1332637200 - tz.transition 2012, 10, :o6, 1351386000 - tz.transition 2013, 3, :o5, 1364691600 - tz.transition 2013, 10, :o6, 1382835600 - tz.transition 2014, 3, :o5, 1396141200 - tz.transition 2014, 10, :o6, 1414285200 - tz.transition 2015, 3, :o5, 1427590800 - tz.transition 2015, 10, :o6, 1445734800 - tz.transition 2016, 3, :o5, 1459040400 - tz.transition 2016, 10, :o6, 1477789200 - tz.transition 2017, 3, :o5, 1490490000 - tz.transition 2017, 10, :o6, 1509238800 - tz.transition 2018, 3, :o5, 1521939600 - tz.transition 2018, 10, :o6, 1540688400 - tz.transition 2019, 3, :o5, 1553994000 - tz.transition 2019, 10, :o6, 1572138000 - tz.transition 2020, 3, :o5, 1585443600 - tz.transition 2020, 10, :o6, 1603587600 - tz.transition 2021, 3, :o5, 1616893200 - tz.transition 2021, 10, :o6, 1635642000 - tz.transition 2022, 3, :o5, 1648342800 - tz.transition 2022, 10, :o6, 1667091600 - tz.transition 2023, 3, :o5, 1679792400 - tz.transition 2023, 10, :o6, 1698541200 - tz.transition 2024, 3, :o5, 1711846800 - tz.transition 2024, 10, :o6, 1729990800 - tz.transition 2025, 3, :o5, 1743296400 - tz.transition 2025, 10, :o6, 1761440400 - tz.transition 2026, 3, :o5, 1774746000 - tz.transition 2026, 10, :o6, 1792890000 - tz.transition 2027, 3, :o5, 1806195600 - tz.transition 2027, 10, :o6, 1824944400 - tz.transition 2028, 3, :o5, 1837645200 - tz.transition 2028, 10, :o6, 1856394000 - tz.transition 2029, 3, :o5, 1869094800 - tz.transition 2029, 10, :o6, 1887843600 - tz.transition 2030, 3, :o5, 1901149200 - tz.transition 2030, 10, :o6, 1919293200 - tz.transition 2031, 3, :o5, 1932598800 - tz.transition 2031, 10, :o6, 1950742800 - tz.transition 2032, 3, :o5, 1964048400 - tz.transition 2032, 10, :o6, 1982797200 - tz.transition 2033, 3, :o5, 1995498000 - tz.transition 2033, 10, :o6, 2014246800 - tz.transition 2034, 3, :o5, 2026947600 - tz.transition 2034, 10, :o6, 2045696400 - tz.transition 2035, 3, :o5, 2058397200 - tz.transition 2035, 10, :o6, 2077146000 - tz.transition 2036, 3, :o5, 2090451600 - tz.transition 2036, 10, :o6, 2108595600 - tz.transition 2037, 3, :o5, 2121901200 - tz.transition 2037, 10, :o6, 2140045200 - tz.transition 2038, 3, :o5, 59172253, 24 - tz.transition 2038, 10, :o6, 59177461, 24 - tz.transition 2039, 3, :o5, 59180989, 24 - tz.transition 2039, 10, :o6, 59186197, 24 - tz.transition 2040, 3, :o5, 59189725, 24 - tz.transition 2040, 10, :o6, 59194933, 24 - tz.transition 2041, 3, :o5, 59198629, 24 - tz.transition 2041, 10, :o6, 59203669, 24 - tz.transition 2042, 3, :o5, 59207365, 24 - tz.transition 2042, 10, :o6, 59212405, 24 - tz.transition 2043, 3, :o5, 59216101, 24 - tz.transition 2043, 10, :o6, 59221141, 24 - tz.transition 2044, 3, :o5, 59224837, 24 - tz.transition 2044, 10, :o6, 59230045, 24 - tz.transition 2045, 3, :o5, 59233573, 24 - tz.transition 2045, 10, :o6, 59238781, 24 - tz.transition 2046, 3, :o5, 59242309, 24 - tz.transition 2046, 10, :o6, 59247517, 24 - tz.transition 2047, 3, :o5, 59251213, 24 - tz.transition 2047, 10, :o6, 59256253, 24 - tz.transition 2048, 3, :o5, 59259949, 24 - tz.transition 2048, 10, :o6, 59264989, 24 - tz.transition 2049, 3, :o5, 59268685, 24 - tz.transition 2049, 10, :o6, 59273893, 24 - tz.transition 2050, 3, :o5, 59277421, 24 - tz.transition 2050, 10, :o6, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb deleted file mode 100644 index 4e21e535ca..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Athens - include TimezoneDefinition - - timezone 'Europe/Athens' do |tz| - tz.offset :o0, 5692, 0, :LMT - tz.offset :o1, 5692, 0, :AMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 7200, 3600, :EEST - tz.offset :o4, 3600, 3600, :CEST - tz.offset :o5, 3600, 0, :CET - - tz.transition 1895, 9, :o1, 52130529377, 21600 - tz.transition 1916, 7, :o2, 3268447787, 1350 - tz.transition 1932, 7, :o3, 29122745, 12 - tz.transition 1932, 8, :o2, 19415611, 8 - tz.transition 1941, 4, :o3, 29161097, 12 - tz.transition 1941, 4, :o4, 19440915, 8 - tz.transition 1942, 11, :o5, 58335973, 24 - tz.transition 1943, 3, :o4, 58339523, 24 - tz.transition 1943, 10, :o5, 29172017, 12 - tz.transition 1944, 4, :o2, 58348427, 24 - tz.transition 1952, 6, :o3, 29210333, 12 - tz.transition 1952, 11, :o2, 19474547, 8 - tz.transition 1975, 4, :o3, 166485600 - tz.transition 1975, 11, :o2, 186184800 - tz.transition 1976, 4, :o3, 198028800 - tz.transition 1976, 10, :o2, 213753600 - tz.transition 1977, 4, :o3, 228873600 - tz.transition 1977, 9, :o2, 244080000 - tz.transition 1978, 4, :o3, 260323200 - tz.transition 1978, 9, :o2, 275446800 - tz.transition 1979, 4, :o3, 291798000 - tz.transition 1979, 9, :o2, 307407600 - tz.transition 1980, 3, :o3, 323388000 - tz.transition 1980, 9, :o2, 338936400 - tz.transition 1981, 3, :o3, 354675600 - tz.transition 1981, 9, :o2, 370400400 - tz.transition 1982, 3, :o3, 386125200 - tz.transition 1982, 9, :o2, 401850000 - tz.transition 1983, 3, :o3, 417574800 - tz.transition 1983, 9, :o2, 433299600 - tz.transition 1984, 3, :o3, 449024400 - tz.transition 1984, 9, :o2, 465354000 - tz.transition 1985, 3, :o3, 481078800 - tz.transition 1985, 9, :o2, 496803600 - tz.transition 1986, 3, :o3, 512528400 - tz.transition 1986, 9, :o2, 528253200 - tz.transition 1987, 3, :o3, 543978000 - tz.transition 1987, 9, :o2, 559702800 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb deleted file mode 100644 index 4dbd893d75..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Belgrade - include TimezoneDefinition - - timezone 'Europe/Belgrade' do |tz| - tz.offset :o0, 4920, 0, :LMT - tz.offset :o1, 3600, 0, :CET - tz.offset :o2, 3600, 3600, :CEST - - tz.transition 1883, 12, :o1, 1734607039, 720 - tz.transition 1941, 4, :o2, 29161241, 12 - tz.transition 1942, 11, :o1, 58335973, 24 - tz.transition 1943, 3, :o2, 58339501, 24 - tz.transition 1943, 10, :o1, 58344037, 24 - tz.transition 1944, 4, :o2, 58348405, 24 - tz.transition 1944, 10, :o1, 58352773, 24 - tz.transition 1945, 5, :o2, 58358005, 24 - tz.transition 1945, 9, :o1, 58361149, 24 - tz.transition 1983, 3, :o2, 417574800 - tz.transition 1983, 9, :o1, 433299600 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 9, :o1, 465354000 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 9, :o1, 496803600 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 9, :o1, 528253200 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 9, :o1, 559702800 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 9, :o1, 591152400 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 9, :o1, 622602000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 9, :o1, 654656400 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 9, :o1, 686106000 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 9, :o1, 717555600 - tz.transition 1993, 3, :o2, 733280400 - tz.transition 1993, 9, :o1, 749005200 - tz.transition 1994, 3, :o2, 764730000 - tz.transition 1994, 9, :o1, 780454800 - tz.transition 1995, 3, :o2, 796179600 - tz.transition 1995, 9, :o1, 811904400 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb deleted file mode 100644 index 721054236c..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb +++ /dev/null @@ -1,188 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Berlin - include TimezoneDefinition - - timezone 'Europe/Berlin' do |tz| - tz.offset :o0, 3208, 0, :LMT - tz.offset :o1, 3600, 0, :CET - tz.offset :o2, 3600, 3600, :CEST - tz.offset :o3, 3600, 7200, :CEMT - - tz.transition 1893, 3, :o1, 26055588199, 10800 - tz.transition 1916, 4, :o2, 29051813, 12 - tz.transition 1916, 9, :o1, 58107299, 24 - tz.transition 1917, 4, :o2, 58112029, 24 - tz.transition 1917, 9, :o1, 58115725, 24 - tz.transition 1918, 4, :o2, 58120765, 24 - tz.transition 1918, 9, :o1, 58124461, 24 - tz.transition 1940, 4, :o2, 58313293, 24 - tz.transition 1942, 11, :o1, 58335973, 24 - tz.transition 1943, 3, :o2, 58339501, 24 - tz.transition 1943, 10, :o1, 58344037, 24 - tz.transition 1944, 4, :o2, 58348405, 24 - tz.transition 1944, 10, :o1, 58352773, 24 - tz.transition 1945, 4, :o2, 58357141, 24 - tz.transition 1945, 5, :o3, 4863199, 2 - tz.transition 1945, 9, :o2, 4863445, 2 - tz.transition 1945, 11, :o1, 58362661, 24 - tz.transition 1946, 4, :o2, 58366189, 24 - tz.transition 1946, 10, :o1, 58370413, 24 - tz.transition 1947, 4, :o2, 29187379, 12 - tz.transition 1947, 5, :o3, 58375597, 24 - tz.transition 1947, 6, :o2, 4864731, 2 - tz.transition 1947, 10, :o1, 58379125, 24 - tz.transition 1948, 4, :o2, 58383829, 24 - tz.transition 1948, 10, :o1, 58387861, 24 - tz.transition 1949, 4, :o2, 58392397, 24 - tz.transition 1949, 10, :o1, 58396597, 24 - tz.transition 1980, 4, :o2, 323830800 - tz.transition 1980, 9, :o1, 338950800 - tz.transition 1981, 3, :o2, 354675600 - tz.transition 1981, 9, :o1, 370400400 - tz.transition 1982, 3, :o2, 386125200 - tz.transition 1982, 9, :o1, 401850000 - tz.transition 1983, 3, :o2, 417574800 - tz.transition 1983, 9, :o1, 433299600 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 9, :o1, 465354000 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 9, :o1, 496803600 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 9, :o1, 528253200 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 9, :o1, 559702800 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 9, :o1, 591152400 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 9, :o1, 622602000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 9, :o1, 654656400 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 9, :o1, 686106000 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 9, :o1, 717555600 - tz.transition 1993, 3, :o2, 733280400 - tz.transition 1993, 9, :o1, 749005200 - tz.transition 1994, 3, :o2, 764730000 - tz.transition 1994, 9, :o1, 780454800 - tz.transition 1995, 3, :o2, 796179600 - tz.transition 1995, 9, :o1, 811904400 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb deleted file mode 100644 index 7a731a0b6a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Bratislava - include TimezoneDefinition - - linked_timezone 'Europe/Bratislava', 'Europe/Prague' - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb deleted file mode 100644 index 6b0a242944..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb +++ /dev/null @@ -1,232 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Brussels - include TimezoneDefinition - - timezone 'Europe/Brussels' do |tz| - tz.offset :o0, 1050, 0, :LMT - tz.offset :o1, 1050, 0, :BMT - tz.offset :o2, 0, 0, :WET - tz.offset :o3, 3600, 0, :CET - tz.offset :o4, 3600, 3600, :CEST - tz.offset :o5, 0, 3600, :WEST - - tz.transition 1879, 12, :o1, 1386844121, 576 - tz.transition 1892, 5, :o2, 1389438713, 576 - tz.transition 1914, 11, :o3, 4840889, 2 - tz.transition 1916, 4, :o4, 58103627, 24 - tz.transition 1916, 9, :o3, 58107299, 24 - tz.transition 1917, 4, :o4, 58112029, 24 - tz.transition 1917, 9, :o3, 58115725, 24 - tz.transition 1918, 4, :o4, 58120765, 24 - tz.transition 1918, 9, :o3, 58124461, 24 - tz.transition 1918, 11, :o2, 58125815, 24 - tz.transition 1919, 3, :o5, 58128467, 24 - tz.transition 1919, 10, :o2, 58133675, 24 - tz.transition 1920, 2, :o5, 58136867, 24 - tz.transition 1920, 10, :o2, 58142915, 24 - tz.transition 1921, 3, :o5, 58146323, 24 - tz.transition 1921, 10, :o2, 58151723, 24 - tz.transition 1922, 3, :o5, 58155347, 24 - tz.transition 1922, 10, :o2, 58160051, 24 - tz.transition 1923, 4, :o5, 58164755, 24 - tz.transition 1923, 10, :o2, 58168787, 24 - tz.transition 1924, 3, :o5, 58172987, 24 - tz.transition 1924, 10, :o2, 58177523, 24 - tz.transition 1925, 4, :o5, 58181891, 24 - tz.transition 1925, 10, :o2, 58186259, 24 - tz.transition 1926, 4, :o5, 58190963, 24 - tz.transition 1926, 10, :o2, 58194995, 24 - tz.transition 1927, 4, :o5, 58199531, 24 - tz.transition 1927, 10, :o2, 58203731, 24 - tz.transition 1928, 4, :o5, 58208435, 24 - tz.transition 1928, 10, :o2, 29106319, 12 - tz.transition 1929, 4, :o5, 29108671, 12 - tz.transition 1929, 10, :o2, 29110687, 12 - tz.transition 1930, 4, :o5, 29112955, 12 - tz.transition 1930, 10, :o2, 29115055, 12 - tz.transition 1931, 4, :o5, 29117407, 12 - tz.transition 1931, 10, :o2, 29119423, 12 - tz.transition 1932, 4, :o5, 29121607, 12 - tz.transition 1932, 10, :o2, 29123791, 12 - tz.transition 1933, 3, :o5, 29125891, 12 - tz.transition 1933, 10, :o2, 29128243, 12 - tz.transition 1934, 4, :o5, 29130427, 12 - tz.transition 1934, 10, :o2, 29132611, 12 - tz.transition 1935, 3, :o5, 29134711, 12 - tz.transition 1935, 10, :o2, 29136979, 12 - tz.transition 1936, 4, :o5, 29139331, 12 - tz.transition 1936, 10, :o2, 29141347, 12 - tz.transition 1937, 4, :o5, 29143531, 12 - tz.transition 1937, 10, :o2, 29145715, 12 - tz.transition 1938, 3, :o5, 29147815, 12 - tz.transition 1938, 10, :o2, 29150083, 12 - tz.transition 1939, 4, :o5, 29152435, 12 - tz.transition 1939, 11, :o2, 29155039, 12 - tz.transition 1940, 2, :o5, 29156215, 12 - tz.transition 1940, 5, :o4, 29157235, 12 - tz.transition 1942, 11, :o3, 58335973, 24 - tz.transition 1943, 3, :o4, 58339501, 24 - tz.transition 1943, 10, :o3, 58344037, 24 - tz.transition 1944, 4, :o4, 58348405, 24 - tz.transition 1944, 9, :o3, 58352413, 24 - tz.transition 1945, 4, :o4, 58357141, 24 - tz.transition 1945, 9, :o3, 58361149, 24 - tz.transition 1946, 5, :o4, 58367029, 24 - tz.transition 1946, 10, :o3, 58370413, 24 - tz.transition 1977, 4, :o4, 228877200 - tz.transition 1977, 9, :o3, 243997200 - tz.transition 1978, 4, :o4, 260326800 - tz.transition 1978, 10, :o3, 276051600 - tz.transition 1979, 4, :o4, 291776400 - tz.transition 1979, 9, :o3, 307501200 - tz.transition 1980, 4, :o4, 323830800 - tz.transition 1980, 9, :o3, 338950800 - tz.transition 1981, 3, :o4, 354675600 - tz.transition 1981, 9, :o3, 370400400 - tz.transition 1982, 3, :o4, 386125200 - tz.transition 1982, 9, :o3, 401850000 - tz.transition 1983, 3, :o4, 417574800 - tz.transition 1983, 9, :o3, 433299600 - tz.transition 1984, 3, :o4, 449024400 - tz.transition 1984, 9, :o3, 465354000 - tz.transition 1985, 3, :o4, 481078800 - tz.transition 1985, 9, :o3, 496803600 - tz.transition 1986, 3, :o4, 512528400 - tz.transition 1986, 9, :o3, 528253200 - tz.transition 1987, 3, :o4, 543978000 - tz.transition 1987, 9, :o3, 559702800 - tz.transition 1988, 3, :o4, 575427600 - tz.transition 1988, 9, :o3, 591152400 - tz.transition 1989, 3, :o4, 606877200 - tz.transition 1989, 9, :o3, 622602000 - tz.transition 1990, 3, :o4, 638326800 - tz.transition 1990, 9, :o3, 654656400 - tz.transition 1991, 3, :o4, 670381200 - tz.transition 1991, 9, :o3, 686106000 - tz.transition 1992, 3, :o4, 701830800 - tz.transition 1992, 9, :o3, 717555600 - tz.transition 1993, 3, :o4, 733280400 - tz.transition 1993, 9, :o3, 749005200 - tz.transition 1994, 3, :o4, 764730000 - tz.transition 1994, 9, :o3, 780454800 - tz.transition 1995, 3, :o4, 796179600 - tz.transition 1995, 9, :o3, 811904400 - tz.transition 1996, 3, :o4, 828234000 - tz.transition 1996, 10, :o3, 846378000 - tz.transition 1997, 3, :o4, 859683600 - tz.transition 1997, 10, :o3, 877827600 - tz.transition 1998, 3, :o4, 891133200 - tz.transition 1998, 10, :o3, 909277200 - tz.transition 1999, 3, :o4, 922582800 - tz.transition 1999, 10, :o3, 941331600 - tz.transition 2000, 3, :o4, 954032400 - tz.transition 2000, 10, :o3, 972781200 - tz.transition 2001, 3, :o4, 985482000 - tz.transition 2001, 10, :o3, 1004230800 - tz.transition 2002, 3, :o4, 1017536400 - tz.transition 2002, 10, :o3, 1035680400 - tz.transition 2003, 3, :o4, 1048986000 - tz.transition 2003, 10, :o3, 1067130000 - tz.transition 2004, 3, :o4, 1080435600 - tz.transition 2004, 10, :o3, 1099184400 - tz.transition 2005, 3, :o4, 1111885200 - tz.transition 2005, 10, :o3, 1130634000 - tz.transition 2006, 3, :o4, 1143334800 - tz.transition 2006, 10, :o3, 1162083600 - tz.transition 2007, 3, :o4, 1174784400 - tz.transition 2007, 10, :o3, 1193533200 - tz.transition 2008, 3, :o4, 1206838800 - tz.transition 2008, 10, :o3, 1224982800 - tz.transition 2009, 3, :o4, 1238288400 - tz.transition 2009, 10, :o3, 1256432400 - tz.transition 2010, 3, :o4, 1269738000 - tz.transition 2010, 10, :o3, 1288486800 - tz.transition 2011, 3, :o4, 1301187600 - tz.transition 2011, 10, :o3, 1319936400 - tz.transition 2012, 3, :o4, 1332637200 - tz.transition 2012, 10, :o3, 1351386000 - tz.transition 2013, 3, :o4, 1364691600 - tz.transition 2013, 10, :o3, 1382835600 - tz.transition 2014, 3, :o4, 1396141200 - tz.transition 2014, 10, :o3, 1414285200 - tz.transition 2015, 3, :o4, 1427590800 - tz.transition 2015, 10, :o3, 1445734800 - tz.transition 2016, 3, :o4, 1459040400 - tz.transition 2016, 10, :o3, 1477789200 - tz.transition 2017, 3, :o4, 1490490000 - tz.transition 2017, 10, :o3, 1509238800 - tz.transition 2018, 3, :o4, 1521939600 - tz.transition 2018, 10, :o3, 1540688400 - tz.transition 2019, 3, :o4, 1553994000 - tz.transition 2019, 10, :o3, 1572138000 - tz.transition 2020, 3, :o4, 1585443600 - tz.transition 2020, 10, :o3, 1603587600 - tz.transition 2021, 3, :o4, 1616893200 - tz.transition 2021, 10, :o3, 1635642000 - tz.transition 2022, 3, :o4, 1648342800 - tz.transition 2022, 10, :o3, 1667091600 - tz.transition 2023, 3, :o4, 1679792400 - tz.transition 2023, 10, :o3, 1698541200 - tz.transition 2024, 3, :o4, 1711846800 - tz.transition 2024, 10, :o3, 1729990800 - tz.transition 2025, 3, :o4, 1743296400 - tz.transition 2025, 10, :o3, 1761440400 - tz.transition 2026, 3, :o4, 1774746000 - tz.transition 2026, 10, :o3, 1792890000 - tz.transition 2027, 3, :o4, 1806195600 - tz.transition 2027, 10, :o3, 1824944400 - tz.transition 2028, 3, :o4, 1837645200 - tz.transition 2028, 10, :o3, 1856394000 - tz.transition 2029, 3, :o4, 1869094800 - tz.transition 2029, 10, :o3, 1887843600 - tz.transition 2030, 3, :o4, 1901149200 - tz.transition 2030, 10, :o3, 1919293200 - tz.transition 2031, 3, :o4, 1932598800 - tz.transition 2031, 10, :o3, 1950742800 - tz.transition 2032, 3, :o4, 1964048400 - tz.transition 2032, 10, :o3, 1982797200 - tz.transition 2033, 3, :o4, 1995498000 - tz.transition 2033, 10, :o3, 2014246800 - tz.transition 2034, 3, :o4, 2026947600 - tz.transition 2034, 10, :o3, 2045696400 - tz.transition 2035, 3, :o4, 2058397200 - tz.transition 2035, 10, :o3, 2077146000 - tz.transition 2036, 3, :o4, 2090451600 - tz.transition 2036, 10, :o3, 2108595600 - tz.transition 2037, 3, :o4, 2121901200 - tz.transition 2037, 10, :o3, 2140045200 - tz.transition 2038, 3, :o4, 59172253, 24 - tz.transition 2038, 10, :o3, 59177461, 24 - tz.transition 2039, 3, :o4, 59180989, 24 - tz.transition 2039, 10, :o3, 59186197, 24 - tz.transition 2040, 3, :o4, 59189725, 24 - tz.transition 2040, 10, :o3, 59194933, 24 - tz.transition 2041, 3, :o4, 59198629, 24 - tz.transition 2041, 10, :o3, 59203669, 24 - tz.transition 2042, 3, :o4, 59207365, 24 - tz.transition 2042, 10, :o3, 59212405, 24 - tz.transition 2043, 3, :o4, 59216101, 24 - tz.transition 2043, 10, :o3, 59221141, 24 - tz.transition 2044, 3, :o4, 59224837, 24 - tz.transition 2044, 10, :o3, 59230045, 24 - tz.transition 2045, 3, :o4, 59233573, 24 - tz.transition 2045, 10, :o3, 59238781, 24 - tz.transition 2046, 3, :o4, 59242309, 24 - tz.transition 2046, 10, :o3, 59247517, 24 - tz.transition 2047, 3, :o4, 59251213, 24 - tz.transition 2047, 10, :o3, 59256253, 24 - tz.transition 2048, 3, :o4, 59259949, 24 - tz.transition 2048, 10, :o3, 59264989, 24 - tz.transition 2049, 3, :o4, 59268685, 24 - tz.transition 2049, 10, :o3, 59273893, 24 - tz.transition 2050, 3, :o4, 59277421, 24 - tz.transition 2050, 10, :o3, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb deleted file mode 100644 index 521c3c932e..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Bucharest - include TimezoneDefinition - - timezone 'Europe/Bucharest' do |tz| - tz.offset :o0, 6264, 0, :LMT - tz.offset :o1, 6264, 0, :BMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 7200, 3600, :EEST - - tz.transition 1891, 9, :o1, 964802571, 400 - tz.transition 1931, 7, :o2, 970618571, 400 - tz.transition 1932, 5, :o3, 29122181, 12 - tz.transition 1932, 10, :o2, 29123789, 12 - tz.transition 1933, 4, :o3, 29125973, 12 - tz.transition 1933, 9, :o2, 29128157, 12 - tz.transition 1934, 4, :o3, 29130425, 12 - tz.transition 1934, 10, :o2, 29132609, 12 - tz.transition 1935, 4, :o3, 29134793, 12 - tz.transition 1935, 10, :o2, 29136977, 12 - tz.transition 1936, 4, :o3, 29139161, 12 - tz.transition 1936, 10, :o2, 29141345, 12 - tz.transition 1937, 4, :o3, 29143529, 12 - tz.transition 1937, 10, :o2, 29145713, 12 - tz.transition 1938, 4, :o3, 29147897, 12 - tz.transition 1938, 10, :o2, 29150081, 12 - tz.transition 1939, 4, :o3, 29152265, 12 - tz.transition 1939, 9, :o2, 29154449, 12 - tz.transition 1979, 5, :o3, 296604000 - tz.transition 1979, 9, :o2, 307486800 - tz.transition 1980, 4, :o3, 323816400 - tz.transition 1980, 9, :o2, 338940000 - tz.transition 1981, 3, :o3, 354672000 - tz.transition 1981, 9, :o2, 370396800 - tz.transition 1982, 3, :o3, 386121600 - tz.transition 1982, 9, :o2, 401846400 - tz.transition 1983, 3, :o3, 417571200 - tz.transition 1983, 9, :o2, 433296000 - tz.transition 1984, 3, :o3, 449020800 - tz.transition 1984, 9, :o2, 465350400 - tz.transition 1985, 3, :o3, 481075200 - tz.transition 1985, 9, :o2, 496800000 - tz.transition 1986, 3, :o3, 512524800 - tz.transition 1986, 9, :o2, 528249600 - tz.transition 1987, 3, :o3, 543974400 - tz.transition 1987, 9, :o2, 559699200 - tz.transition 1988, 3, :o3, 575424000 - tz.transition 1988, 9, :o2, 591148800 - tz.transition 1989, 3, :o3, 606873600 - tz.transition 1989, 9, :o2, 622598400 - tz.transition 1990, 3, :o3, 638323200 - tz.transition 1990, 9, :o2, 654652800 - tz.transition 1991, 3, :o3, 670370400 - tz.transition 1991, 9, :o2, 686095200 - tz.transition 1992, 3, :o3, 701820000 - tz.transition 1992, 9, :o2, 717544800 - tz.transition 1993, 3, :o3, 733269600 - tz.transition 1993, 9, :o2, 748994400 - tz.transition 1994, 3, :o3, 764719200 - tz.transition 1994, 9, :o2, 780440400 - tz.transition 1995, 3, :o3, 796168800 - tz.transition 1995, 9, :o2, 811890000 - tz.transition 1996, 3, :o3, 828223200 - tz.transition 1996, 10, :o2, 846363600 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb deleted file mode 100644 index 1f3a9738b7..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb +++ /dev/null @@ -1,197 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Budapest - include TimezoneDefinition - - timezone 'Europe/Budapest' do |tz| - tz.offset :o0, 4580, 0, :LMT - tz.offset :o1, 3600, 0, :CET - tz.offset :o2, 3600, 3600, :CEST - - tz.transition 1890, 9, :o1, 10418291051, 4320 - tz.transition 1916, 4, :o2, 29051813, 12 - tz.transition 1916, 9, :o1, 58107299, 24 - tz.transition 1917, 4, :o2, 58112029, 24 - tz.transition 1917, 9, :o1, 58115725, 24 - tz.transition 1918, 4, :o2, 29060215, 12 - tz.transition 1918, 9, :o1, 58124773, 24 - tz.transition 1919, 4, :o2, 29064763, 12 - tz.transition 1919, 9, :o1, 58133197, 24 - tz.transition 1920, 4, :o2, 29069035, 12 - tz.transition 1920, 9, :o1, 58142341, 24 - tz.transition 1941, 4, :o2, 58322173, 24 - tz.transition 1942, 11, :o1, 58335973, 24 - tz.transition 1943, 3, :o2, 58339501, 24 - tz.transition 1943, 10, :o1, 58344037, 24 - tz.transition 1944, 4, :o2, 58348405, 24 - tz.transition 1944, 10, :o1, 58352773, 24 - tz.transition 1945, 5, :o2, 29178929, 12 - tz.transition 1945, 11, :o1, 29181149, 12 - tz.transition 1946, 3, :o2, 58365853, 24 - tz.transition 1946, 10, :o1, 58370389, 24 - tz.transition 1947, 4, :o2, 58374757, 24 - tz.transition 1947, 10, :o1, 58379125, 24 - tz.transition 1948, 4, :o2, 58383493, 24 - tz.transition 1948, 10, :o1, 58387861, 24 - tz.transition 1949, 4, :o2, 58392397, 24 - tz.transition 1949, 10, :o1, 58396597, 24 - tz.transition 1950, 4, :o2, 58401325, 24 - tz.transition 1950, 10, :o1, 58405861, 24 - tz.transition 1954, 5, :o2, 58437251, 24 - tz.transition 1954, 10, :o1, 29220221, 12 - tz.transition 1955, 5, :o2, 58446011, 24 - tz.transition 1955, 10, :o1, 29224601, 12 - tz.transition 1956, 6, :o2, 58455059, 24 - tz.transition 1956, 9, :o1, 29228957, 12 - tz.transition 1957, 6, :o2, 4871983, 2 - tz.transition 1957, 9, :o1, 58466653, 24 - tz.transition 1980, 4, :o2, 323827200 - tz.transition 1980, 9, :o1, 338950800 - tz.transition 1981, 3, :o2, 354675600 - tz.transition 1981, 9, :o1, 370400400 - tz.transition 1982, 3, :o2, 386125200 - tz.transition 1982, 9, :o1, 401850000 - tz.transition 1983, 3, :o2, 417574800 - tz.transition 1983, 9, :o1, 433299600 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 9, :o1, 465354000 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 9, :o1, 496803600 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 9, :o1, 528253200 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 9, :o1, 559702800 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 9, :o1, 591152400 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 9, :o1, 622602000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 9, :o1, 654656400 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 9, :o1, 686106000 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 9, :o1, 717555600 - tz.transition 1993, 3, :o2, 733280400 - tz.transition 1993, 9, :o1, 749005200 - tz.transition 1994, 3, :o2, 764730000 - tz.transition 1994, 9, :o1, 780454800 - tz.transition 1995, 3, :o2, 796179600 - tz.transition 1995, 9, :o1, 811904400 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb deleted file mode 100644 index 47cbaf14a7..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb +++ /dev/null @@ -1,179 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Copenhagen - include TimezoneDefinition - - timezone 'Europe/Copenhagen' do |tz| - tz.offset :o0, 3020, 0, :LMT - tz.offset :o1, 3020, 0, :CMT - tz.offset :o2, 3600, 0, :CET - tz.offset :o3, 3600, 3600, :CEST - - tz.transition 1889, 12, :o1, 10417111769, 4320 - tz.transition 1893, 12, :o2, 10423423289, 4320 - tz.transition 1916, 5, :o3, 29051981, 12 - tz.transition 1916, 9, :o2, 19369099, 8 - tz.transition 1940, 5, :o3, 58314347, 24 - tz.transition 1942, 11, :o2, 58335973, 24 - tz.transition 1943, 3, :o3, 58339501, 24 - tz.transition 1943, 10, :o2, 58344037, 24 - tz.transition 1944, 4, :o3, 58348405, 24 - tz.transition 1944, 10, :o2, 58352773, 24 - tz.transition 1945, 4, :o3, 58357141, 24 - tz.transition 1945, 8, :o2, 58360381, 24 - tz.transition 1946, 5, :o3, 58366597, 24 - tz.transition 1946, 9, :o2, 58369549, 24 - tz.transition 1947, 5, :o3, 58375429, 24 - tz.transition 1947, 8, :o2, 58377781, 24 - tz.transition 1948, 5, :o3, 58384333, 24 - tz.transition 1948, 8, :o2, 58386517, 24 - tz.transition 1980, 4, :o3, 323830800 - tz.transition 1980, 9, :o2, 338950800 - tz.transition 1981, 3, :o3, 354675600 - tz.transition 1981, 9, :o2, 370400400 - tz.transition 1982, 3, :o3, 386125200 - tz.transition 1982, 9, :o2, 401850000 - tz.transition 1983, 3, :o3, 417574800 - tz.transition 1983, 9, :o2, 433299600 - tz.transition 1984, 3, :o3, 449024400 - tz.transition 1984, 9, :o2, 465354000 - tz.transition 1985, 3, :o3, 481078800 - tz.transition 1985, 9, :o2, 496803600 - tz.transition 1986, 3, :o3, 512528400 - tz.transition 1986, 9, :o2, 528253200 - tz.transition 1987, 3, :o3, 543978000 - tz.transition 1987, 9, :o2, 559702800 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb deleted file mode 100644 index 0560bb5436..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb +++ /dev/null @@ -1,276 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Dublin - include TimezoneDefinition - - timezone 'Europe/Dublin' do |tz| - tz.offset :o0, -1500, 0, :LMT - tz.offset :o1, -1521, 0, :DMT - tz.offset :o2, -1521, 3600, :IST - tz.offset :o3, 0, 0, :GMT - tz.offset :o4, 0, 3600, :BST - tz.offset :o5, 0, 3600, :IST - tz.offset :o6, 3600, 0, :IST - - tz.transition 1880, 8, :o1, 693483701, 288 - tz.transition 1916, 5, :o2, 7747214723, 3200 - tz.transition 1916, 10, :o3, 7747640323, 3200 - tz.transition 1917, 4, :o4, 29055919, 12 - tz.transition 1917, 9, :o3, 29057863, 12 - tz.transition 1918, 3, :o4, 29060119, 12 - tz.transition 1918, 9, :o3, 29062399, 12 - tz.transition 1919, 3, :o4, 29064571, 12 - tz.transition 1919, 9, :o3, 29066767, 12 - tz.transition 1920, 3, :o4, 29068939, 12 - tz.transition 1920, 10, :o3, 29071471, 12 - tz.transition 1921, 4, :o4, 29073391, 12 - tz.transition 1921, 10, :o3, 29075587, 12 - tz.transition 1922, 3, :o5, 29077675, 12 - tz.transition 1922, 10, :o3, 29080027, 12 - tz.transition 1923, 4, :o5, 29082379, 12 - tz.transition 1923, 9, :o3, 29084143, 12 - tz.transition 1924, 4, :o5, 29086663, 12 - tz.transition 1924, 9, :o3, 29088595, 12 - tz.transition 1925, 4, :o5, 29091115, 12 - tz.transition 1925, 10, :o3, 29093131, 12 - tz.transition 1926, 4, :o5, 29095483, 12 - tz.transition 1926, 10, :o3, 29097499, 12 - tz.transition 1927, 4, :o5, 29099767, 12 - tz.transition 1927, 10, :o3, 29101867, 12 - tz.transition 1928, 4, :o5, 29104303, 12 - tz.transition 1928, 10, :o3, 29106319, 12 - tz.transition 1929, 4, :o5, 29108671, 12 - tz.transition 1929, 10, :o3, 29110687, 12 - tz.transition 1930, 4, :o5, 29112955, 12 - tz.transition 1930, 10, :o3, 29115055, 12 - tz.transition 1931, 4, :o5, 29117407, 12 - tz.transition 1931, 10, :o3, 29119423, 12 - tz.transition 1932, 4, :o5, 29121775, 12 - tz.transition 1932, 10, :o3, 29123791, 12 - tz.transition 1933, 4, :o5, 29126059, 12 - tz.transition 1933, 10, :o3, 29128243, 12 - tz.transition 1934, 4, :o5, 29130595, 12 - tz.transition 1934, 10, :o3, 29132611, 12 - tz.transition 1935, 4, :o5, 29134879, 12 - tz.transition 1935, 10, :o3, 29136979, 12 - tz.transition 1936, 4, :o5, 29139331, 12 - tz.transition 1936, 10, :o3, 29141347, 12 - tz.transition 1937, 4, :o5, 29143699, 12 - tz.transition 1937, 10, :o3, 29145715, 12 - tz.transition 1938, 4, :o5, 29147983, 12 - tz.transition 1938, 10, :o3, 29150083, 12 - tz.transition 1939, 4, :o5, 29152435, 12 - tz.transition 1939, 11, :o3, 29155039, 12 - tz.transition 1940, 2, :o5, 29156215, 12 - tz.transition 1946, 10, :o3, 58370389, 24 - tz.transition 1947, 3, :o5, 29187127, 12 - tz.transition 1947, 11, :o3, 58379797, 24 - tz.transition 1948, 4, :o5, 29191915, 12 - tz.transition 1948, 10, :o3, 29194267, 12 - tz.transition 1949, 4, :o5, 29196115, 12 - tz.transition 1949, 10, :o3, 29198635, 12 - tz.transition 1950, 4, :o5, 29200651, 12 - tz.transition 1950, 10, :o3, 29202919, 12 - tz.transition 1951, 4, :o5, 29205019, 12 - tz.transition 1951, 10, :o3, 29207287, 12 - tz.transition 1952, 4, :o5, 29209471, 12 - tz.transition 1952, 10, :o3, 29211739, 12 - tz.transition 1953, 4, :o5, 29213839, 12 - tz.transition 1953, 10, :o3, 29215855, 12 - tz.transition 1954, 4, :o5, 29218123, 12 - tz.transition 1954, 10, :o3, 29220223, 12 - tz.transition 1955, 4, :o5, 29222575, 12 - tz.transition 1955, 10, :o3, 29224591, 12 - tz.transition 1956, 4, :o5, 29227027, 12 - tz.transition 1956, 10, :o3, 29229043, 12 - tz.transition 1957, 4, :o5, 29231311, 12 - tz.transition 1957, 10, :o3, 29233411, 12 - tz.transition 1958, 4, :o5, 29235763, 12 - tz.transition 1958, 10, :o3, 29237779, 12 - tz.transition 1959, 4, :o5, 29240131, 12 - tz.transition 1959, 10, :o3, 29242147, 12 - tz.transition 1960, 4, :o5, 29244415, 12 - tz.transition 1960, 10, :o3, 29246515, 12 - tz.transition 1961, 3, :o5, 29248615, 12 - tz.transition 1961, 10, :o3, 29251219, 12 - tz.transition 1962, 3, :o5, 29252983, 12 - tz.transition 1962, 10, :o3, 29255587, 12 - tz.transition 1963, 3, :o5, 29257435, 12 - tz.transition 1963, 10, :o3, 29259955, 12 - tz.transition 1964, 3, :o5, 29261719, 12 - tz.transition 1964, 10, :o3, 29264323, 12 - tz.transition 1965, 3, :o5, 29266087, 12 - tz.transition 1965, 10, :o3, 29268691, 12 - tz.transition 1966, 3, :o5, 29270455, 12 - tz.transition 1966, 10, :o3, 29273059, 12 - tz.transition 1967, 3, :o5, 29274823, 12 - tz.transition 1967, 10, :o3, 29277511, 12 - tz.transition 1968, 2, :o5, 29278855, 12 - tz.transition 1968, 10, :o6, 58563755, 24 - tz.transition 1971, 10, :o3, 57722400 - tz.transition 1972, 3, :o5, 69818400 - tz.transition 1972, 10, :o3, 89172000 - tz.transition 1973, 3, :o5, 101268000 - tz.transition 1973, 10, :o3, 120621600 - tz.transition 1974, 3, :o5, 132717600 - tz.transition 1974, 10, :o3, 152071200 - tz.transition 1975, 3, :o5, 164167200 - tz.transition 1975, 10, :o3, 183520800 - tz.transition 1976, 3, :o5, 196221600 - tz.transition 1976, 10, :o3, 214970400 - tz.transition 1977, 3, :o5, 227671200 - tz.transition 1977, 10, :o3, 246420000 - tz.transition 1978, 3, :o5, 259120800 - tz.transition 1978, 10, :o3, 278474400 - tz.transition 1979, 3, :o5, 290570400 - tz.transition 1979, 10, :o3, 309924000 - tz.transition 1980, 3, :o5, 322020000 - tz.transition 1980, 10, :o3, 341373600 - tz.transition 1981, 3, :o5, 354675600 - tz.transition 1981, 10, :o3, 372819600 - tz.transition 1982, 3, :o5, 386125200 - tz.transition 1982, 10, :o3, 404269200 - tz.transition 1983, 3, :o5, 417574800 - tz.transition 1983, 10, :o3, 435718800 - tz.transition 1984, 3, :o5, 449024400 - tz.transition 1984, 10, :o3, 467773200 - tz.transition 1985, 3, :o5, 481078800 - tz.transition 1985, 10, :o3, 499222800 - tz.transition 1986, 3, :o5, 512528400 - tz.transition 1986, 10, :o3, 530672400 - tz.transition 1987, 3, :o5, 543978000 - tz.transition 1987, 10, :o3, 562122000 - tz.transition 1988, 3, :o5, 575427600 - tz.transition 1988, 10, :o3, 593571600 - tz.transition 1989, 3, :o5, 606877200 - tz.transition 1989, 10, :o3, 625626000 - tz.transition 1990, 3, :o5, 638326800 - tz.transition 1990, 10, :o3, 657075600 - tz.transition 1991, 3, :o5, 670381200 - tz.transition 1991, 10, :o3, 688525200 - tz.transition 1992, 3, :o5, 701830800 - tz.transition 1992, 10, :o3, 719974800 - tz.transition 1993, 3, :o5, 733280400 - tz.transition 1993, 10, :o3, 751424400 - tz.transition 1994, 3, :o5, 764730000 - tz.transition 1994, 10, :o3, 782874000 - tz.transition 1995, 3, :o5, 796179600 - tz.transition 1995, 10, :o3, 814323600 - tz.transition 1996, 3, :o5, 828234000 - tz.transition 1996, 10, :o3, 846378000 - tz.transition 1997, 3, :o5, 859683600 - tz.transition 1997, 10, :o3, 877827600 - tz.transition 1998, 3, :o5, 891133200 - tz.transition 1998, 10, :o3, 909277200 - tz.transition 1999, 3, :o5, 922582800 - tz.transition 1999, 10, :o3, 941331600 - tz.transition 2000, 3, :o5, 954032400 - tz.transition 2000, 10, :o3, 972781200 - tz.transition 2001, 3, :o5, 985482000 - tz.transition 2001, 10, :o3, 1004230800 - tz.transition 2002, 3, :o5, 1017536400 - tz.transition 2002, 10, :o3, 1035680400 - tz.transition 2003, 3, :o5, 1048986000 - tz.transition 2003, 10, :o3, 1067130000 - tz.transition 2004, 3, :o5, 1080435600 - tz.transition 2004, 10, :o3, 1099184400 - tz.transition 2005, 3, :o5, 1111885200 - tz.transition 2005, 10, :o3, 1130634000 - tz.transition 2006, 3, :o5, 1143334800 - tz.transition 2006, 10, :o3, 1162083600 - tz.transition 2007, 3, :o5, 1174784400 - tz.transition 2007, 10, :o3, 1193533200 - tz.transition 2008, 3, :o5, 1206838800 - tz.transition 2008, 10, :o3, 1224982800 - tz.transition 2009, 3, :o5, 1238288400 - tz.transition 2009, 10, :o3, 1256432400 - tz.transition 2010, 3, :o5, 1269738000 - tz.transition 2010, 10, :o3, 1288486800 - tz.transition 2011, 3, :o5, 1301187600 - tz.transition 2011, 10, :o3, 1319936400 - tz.transition 2012, 3, :o5, 1332637200 - tz.transition 2012, 10, :o3, 1351386000 - tz.transition 2013, 3, :o5, 1364691600 - tz.transition 2013, 10, :o3, 1382835600 - tz.transition 2014, 3, :o5, 1396141200 - tz.transition 2014, 10, :o3, 1414285200 - tz.transition 2015, 3, :o5, 1427590800 - tz.transition 2015, 10, :o3, 1445734800 - tz.transition 2016, 3, :o5, 1459040400 - tz.transition 2016, 10, :o3, 1477789200 - tz.transition 2017, 3, :o5, 1490490000 - tz.transition 2017, 10, :o3, 1509238800 - tz.transition 2018, 3, :o5, 1521939600 - tz.transition 2018, 10, :o3, 1540688400 - tz.transition 2019, 3, :o5, 1553994000 - tz.transition 2019, 10, :o3, 1572138000 - tz.transition 2020, 3, :o5, 1585443600 - tz.transition 2020, 10, :o3, 1603587600 - tz.transition 2021, 3, :o5, 1616893200 - tz.transition 2021, 10, :o3, 1635642000 - tz.transition 2022, 3, :o5, 1648342800 - tz.transition 2022, 10, :o3, 1667091600 - tz.transition 2023, 3, :o5, 1679792400 - tz.transition 2023, 10, :o3, 1698541200 - tz.transition 2024, 3, :o5, 1711846800 - tz.transition 2024, 10, :o3, 1729990800 - tz.transition 2025, 3, :o5, 1743296400 - tz.transition 2025, 10, :o3, 1761440400 - tz.transition 2026, 3, :o5, 1774746000 - tz.transition 2026, 10, :o3, 1792890000 - tz.transition 2027, 3, :o5, 1806195600 - tz.transition 2027, 10, :o3, 1824944400 - tz.transition 2028, 3, :o5, 1837645200 - tz.transition 2028, 10, :o3, 1856394000 - tz.transition 2029, 3, :o5, 1869094800 - tz.transition 2029, 10, :o3, 1887843600 - tz.transition 2030, 3, :o5, 1901149200 - tz.transition 2030, 10, :o3, 1919293200 - tz.transition 2031, 3, :o5, 1932598800 - tz.transition 2031, 10, :o3, 1950742800 - tz.transition 2032, 3, :o5, 1964048400 - tz.transition 2032, 10, :o3, 1982797200 - tz.transition 2033, 3, :o5, 1995498000 - tz.transition 2033, 10, :o3, 2014246800 - tz.transition 2034, 3, :o5, 2026947600 - tz.transition 2034, 10, :o3, 2045696400 - tz.transition 2035, 3, :o5, 2058397200 - tz.transition 2035, 10, :o3, 2077146000 - tz.transition 2036, 3, :o5, 2090451600 - tz.transition 2036, 10, :o3, 2108595600 - tz.transition 2037, 3, :o5, 2121901200 - tz.transition 2037, 10, :o3, 2140045200 - tz.transition 2038, 3, :o5, 59172253, 24 - tz.transition 2038, 10, :o3, 59177461, 24 - tz.transition 2039, 3, :o5, 59180989, 24 - tz.transition 2039, 10, :o3, 59186197, 24 - tz.transition 2040, 3, :o5, 59189725, 24 - tz.transition 2040, 10, :o3, 59194933, 24 - tz.transition 2041, 3, :o5, 59198629, 24 - tz.transition 2041, 10, :o3, 59203669, 24 - tz.transition 2042, 3, :o5, 59207365, 24 - tz.transition 2042, 10, :o3, 59212405, 24 - tz.transition 2043, 3, :o5, 59216101, 24 - tz.transition 2043, 10, :o3, 59221141, 24 - tz.transition 2044, 3, :o5, 59224837, 24 - tz.transition 2044, 10, :o3, 59230045, 24 - tz.transition 2045, 3, :o5, 59233573, 24 - tz.transition 2045, 10, :o3, 59238781, 24 - tz.transition 2046, 3, :o5, 59242309, 24 - tz.transition 2046, 10, :o3, 59247517, 24 - tz.transition 2047, 3, :o5, 59251213, 24 - tz.transition 2047, 10, :o3, 59256253, 24 - tz.transition 2048, 3, :o5, 59259949, 24 - tz.transition 2048, 10, :o3, 59264989, 24 - tz.transition 2049, 3, :o5, 59268685, 24 - tz.transition 2049, 10, :o3, 59273893, 24 - tz.transition 2050, 3, :o5, 59277421, 24 - tz.transition 2050, 10, :o3, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb deleted file mode 100644 index 13a806bcc7..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Helsinki - include TimezoneDefinition - - timezone 'Europe/Helsinki' do |tz| - tz.offset :o0, 5992, 0, :LMT - tz.offset :o1, 5992, 0, :HMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 7200, 3600, :EEST - - tz.transition 1878, 5, :o1, 25997062651, 10800 - tz.transition 1921, 4, :o2, 26166352651, 10800 - tz.transition 1942, 4, :o3, 29165429, 12 - tz.transition 1942, 10, :o2, 19445083, 8 - tz.transition 1981, 3, :o3, 354675600 - tz.transition 1981, 9, :o2, 370400400 - tz.transition 1982, 3, :o3, 386125200 - tz.transition 1982, 9, :o2, 401850000 - tz.transition 1983, 3, :o3, 417574800 - tz.transition 1983, 9, :o2, 433299600 - tz.transition 1984, 3, :o3, 449024400 - tz.transition 1984, 9, :o2, 465354000 - tz.transition 1985, 3, :o3, 481078800 - tz.transition 1985, 9, :o2, 496803600 - tz.transition 1986, 3, :o3, 512528400 - tz.transition 1986, 9, :o2, 528253200 - tz.transition 1987, 3, :o3, 543978000 - tz.transition 1987, 9, :o2, 559702800 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb deleted file mode 100644 index 8306c47536..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb +++ /dev/null @@ -1,218 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Istanbul - include TimezoneDefinition - - timezone 'Europe/Istanbul' do |tz| - tz.offset :o0, 6952, 0, :LMT - tz.offset :o1, 7016, 0, :IMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 7200, 3600, :EEST - tz.offset :o4, 10800, 3600, :TRST - tz.offset :o5, 10800, 0, :TRT - - tz.transition 1879, 12, :o1, 26003326531, 10800 - tz.transition 1910, 9, :o2, 26124610523, 10800 - tz.transition 1916, 4, :o3, 29051813, 12 - tz.transition 1916, 9, :o2, 19369099, 8 - tz.transition 1920, 3, :o3, 29068937, 12 - tz.transition 1920, 10, :o2, 19380979, 8 - tz.transition 1921, 4, :o3, 29073389, 12 - tz.transition 1921, 10, :o2, 19383723, 8 - tz.transition 1922, 3, :o3, 29077673, 12 - tz.transition 1922, 10, :o2, 19386683, 8 - tz.transition 1924, 5, :o3, 29087021, 12 - tz.transition 1924, 9, :o2, 19392475, 8 - tz.transition 1925, 4, :o3, 29091257, 12 - tz.transition 1925, 9, :o2, 19395395, 8 - tz.transition 1940, 6, :o3, 29157725, 12 - tz.transition 1940, 10, :o2, 19439259, 8 - tz.transition 1940, 11, :o3, 29159573, 12 - tz.transition 1941, 9, :o2, 19442067, 8 - tz.transition 1942, 3, :o3, 29165405, 12 - tz.transition 1942, 10, :o2, 19445315, 8 - tz.transition 1945, 4, :o3, 29178569, 12 - tz.transition 1945, 10, :o2, 19453891, 8 - tz.transition 1946, 5, :o3, 29183669, 12 - tz.transition 1946, 9, :o2, 19456755, 8 - tz.transition 1947, 4, :o3, 29187545, 12 - tz.transition 1947, 10, :o2, 19459707, 8 - tz.transition 1948, 4, :o3, 29191913, 12 - tz.transition 1948, 10, :o2, 19462619, 8 - tz.transition 1949, 4, :o3, 29196197, 12 - tz.transition 1949, 10, :o2, 19465531, 8 - tz.transition 1950, 4, :o3, 29200685, 12 - tz.transition 1950, 10, :o2, 19468499, 8 - tz.transition 1951, 4, :o3, 29205101, 12 - tz.transition 1951, 10, :o2, 19471419, 8 - tz.transition 1962, 7, :o3, 29254325, 12 - tz.transition 1962, 10, :o2, 19503563, 8 - tz.transition 1964, 5, :o3, 29262365, 12 - tz.transition 1964, 9, :o2, 19509355, 8 - tz.transition 1970, 5, :o3, 10533600 - tz.transition 1970, 10, :o2, 23835600 - tz.transition 1971, 5, :o3, 41983200 - tz.transition 1971, 10, :o2, 55285200 - tz.transition 1972, 5, :o3, 74037600 - tz.transition 1972, 10, :o2, 87339600 - tz.transition 1973, 6, :o3, 107910000 - tz.transition 1973, 11, :o2, 121219200 - tz.transition 1974, 3, :o3, 133920000 - tz.transition 1974, 11, :o2, 152676000 - tz.transition 1975, 3, :o3, 165362400 - tz.transition 1975, 10, :o2, 183502800 - tz.transition 1976, 5, :o3, 202428000 - tz.transition 1976, 10, :o2, 215557200 - tz.transition 1977, 4, :o3, 228866400 - tz.transition 1977, 10, :o2, 245797200 - tz.transition 1978, 4, :o3, 260316000 - tz.transition 1978, 10, :o4, 277246800 - tz.transition 1979, 10, :o5, 308779200 - tz.transition 1980, 4, :o4, 323827200 - tz.transition 1980, 10, :o5, 340228800 - tz.transition 1981, 3, :o4, 354672000 - tz.transition 1981, 10, :o5, 371678400 - tz.transition 1982, 3, :o4, 386121600 - tz.transition 1982, 10, :o5, 403128000 - tz.transition 1983, 7, :o4, 428446800 - tz.transition 1983, 10, :o5, 433886400 - tz.transition 1985, 4, :o3, 482792400 - tz.transition 1985, 9, :o2, 496702800 - tz.transition 1986, 3, :o3, 512524800 - tz.transition 1986, 9, :o2, 528249600 - tz.transition 1987, 3, :o3, 543974400 - tz.transition 1987, 9, :o2, 559699200 - tz.transition 1988, 3, :o3, 575424000 - tz.transition 1988, 9, :o2, 591148800 - tz.transition 1989, 3, :o3, 606873600 - tz.transition 1989, 9, :o2, 622598400 - tz.transition 1990, 3, :o3, 638323200 - tz.transition 1990, 9, :o2, 654652800 - tz.transition 1991, 3, :o3, 670374000 - tz.transition 1991, 9, :o2, 686098800 - tz.transition 1992, 3, :o3, 701823600 - tz.transition 1992, 9, :o2, 717548400 - tz.transition 1993, 3, :o3, 733273200 - tz.transition 1993, 9, :o2, 748998000 - tz.transition 1994, 3, :o3, 764722800 - tz.transition 1994, 9, :o2, 780447600 - tz.transition 1995, 3, :o3, 796172400 - tz.transition 1995, 9, :o2, 811897200 - tz.transition 1996, 3, :o3, 828226800 - tz.transition 1996, 10, :o2, 846370800 - tz.transition 1997, 3, :o3, 859676400 - tz.transition 1997, 10, :o2, 877820400 - tz.transition 1998, 3, :o3, 891126000 - tz.transition 1998, 10, :o2, 909270000 - tz.transition 1999, 3, :o3, 922575600 - tz.transition 1999, 10, :o2, 941324400 - tz.transition 2000, 3, :o3, 954025200 - tz.transition 2000, 10, :o2, 972774000 - tz.transition 2001, 3, :o3, 985474800 - tz.transition 2001, 10, :o2, 1004223600 - tz.transition 2002, 3, :o3, 1017529200 - tz.transition 2002, 10, :o2, 1035673200 - tz.transition 2003, 3, :o3, 1048978800 - tz.transition 2003, 10, :o2, 1067122800 - tz.transition 2004, 3, :o3, 1080428400 - tz.transition 2004, 10, :o2, 1099177200 - tz.transition 2005, 3, :o3, 1111878000 - tz.transition 2005, 10, :o2, 1130626800 - tz.transition 2006, 3, :o3, 1143327600 - tz.transition 2006, 10, :o2, 1162076400 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb deleted file mode 100644 index 513d3308be..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb +++ /dev/null @@ -1,168 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Kiev - include TimezoneDefinition - - timezone 'Europe/Kiev' do |tz| - tz.offset :o0, 7324, 0, :LMT - tz.offset :o1, 7324, 0, :KMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 10800, 0, :MSK - tz.offset :o4, 3600, 3600, :CEST - tz.offset :o5, 3600, 0, :CET - tz.offset :o6, 10800, 3600, :MSD - tz.offset :o7, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 52006652969, 21600 - tz.transition 1924, 5, :o2, 52356400169, 21600 - tz.transition 1930, 6, :o3, 29113781, 12 - tz.transition 1941, 9, :o4, 19442059, 8 - tz.transition 1942, 11, :o5, 58335973, 24 - tz.transition 1943, 3, :o4, 58339501, 24 - tz.transition 1943, 10, :o5, 58344037, 24 - tz.transition 1943, 11, :o3, 58344827, 24 - tz.transition 1981, 3, :o6, 354920400 - tz.transition 1981, 9, :o3, 370728000 - tz.transition 1982, 3, :o6, 386456400 - tz.transition 1982, 9, :o3, 402264000 - tz.transition 1983, 3, :o6, 417992400 - tz.transition 1983, 9, :o3, 433800000 - tz.transition 1984, 3, :o6, 449614800 - tz.transition 1984, 9, :o3, 465346800 - tz.transition 1985, 3, :o6, 481071600 - tz.transition 1985, 9, :o3, 496796400 - tz.transition 1986, 3, :o6, 512521200 - tz.transition 1986, 9, :o3, 528246000 - tz.transition 1987, 3, :o6, 543970800 - tz.transition 1987, 9, :o3, 559695600 - tz.transition 1988, 3, :o6, 575420400 - tz.transition 1988, 9, :o3, 591145200 - tz.transition 1989, 3, :o6, 606870000 - tz.transition 1989, 9, :o3, 622594800 - tz.transition 1990, 6, :o2, 646786800 - tz.transition 1992, 3, :o7, 701820000 - tz.transition 1992, 9, :o2, 717541200 - tz.transition 1993, 3, :o7, 733269600 - tz.transition 1993, 9, :o2, 748990800 - tz.transition 1994, 3, :o7, 764719200 - tz.transition 1994, 9, :o2, 780440400 - tz.transition 1995, 3, :o7, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o7, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o7, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o7, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o7, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o7, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o7, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o7, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o7, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o7, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o7, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o7, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o7, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o7, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o7, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o7, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o7, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o7, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o7, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o7, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o7, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o7, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o7, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o7, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o7, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o7, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o7, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o7, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o7, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o7, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o7, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o7, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o7, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o7, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o7, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o7, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o7, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o7, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o7, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o7, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o7, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o7, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o7, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o7, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o7, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o7, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o7, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o7, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o7, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o7, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o7, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o7, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o7, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o7, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o7, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o7, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb deleted file mode 100644 index 1c6d2a3d30..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb +++ /dev/null @@ -1,268 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Lisbon - include TimezoneDefinition - - timezone 'Europe/Lisbon' do |tz| - tz.offset :o0, -2192, 0, :LMT - tz.offset :o1, 0, 0, :WET - tz.offset :o2, 0, 3600, :WEST - tz.offset :o3, 0, 7200, :WEMT - tz.offset :o4, 3600, 0, :CET - tz.offset :o5, 3600, 3600, :CEST - - tz.transition 1912, 1, :o1, 13064773637, 5400 - tz.transition 1916, 6, :o2, 58104779, 24 - tz.transition 1916, 11, :o1, 4842337, 2 - tz.transition 1917, 2, :o2, 58110923, 24 - tz.transition 1917, 10, :o1, 58116395, 24 - tz.transition 1918, 3, :o2, 58119707, 24 - tz.transition 1918, 10, :o1, 58125155, 24 - tz.transition 1919, 2, :o2, 58128443, 24 - tz.transition 1919, 10, :o1, 58133915, 24 - tz.transition 1920, 2, :o2, 58137227, 24 - tz.transition 1920, 10, :o1, 58142699, 24 - tz.transition 1921, 2, :o2, 58145987, 24 - tz.transition 1921, 10, :o1, 58151459, 24 - tz.transition 1924, 4, :o2, 58173419, 24 - tz.transition 1924, 10, :o1, 58177763, 24 - tz.transition 1926, 4, :o2, 58190963, 24 - tz.transition 1926, 10, :o1, 58194995, 24 - tz.transition 1927, 4, :o2, 58199531, 24 - tz.transition 1927, 10, :o1, 58203731, 24 - tz.transition 1928, 4, :o2, 58208435, 24 - tz.transition 1928, 10, :o1, 58212635, 24 - tz.transition 1929, 4, :o2, 58217339, 24 - tz.transition 1929, 10, :o1, 58221371, 24 - tz.transition 1931, 4, :o2, 58234811, 24 - tz.transition 1931, 10, :o1, 58238843, 24 - tz.transition 1932, 4, :o2, 58243211, 24 - tz.transition 1932, 10, :o1, 58247579, 24 - tz.transition 1934, 4, :o2, 58260851, 24 - tz.transition 1934, 10, :o1, 58265219, 24 - tz.transition 1935, 3, :o2, 58269419, 24 - tz.transition 1935, 10, :o1, 58273955, 24 - tz.transition 1936, 4, :o2, 58278659, 24 - tz.transition 1936, 10, :o1, 58282691, 24 - tz.transition 1937, 4, :o2, 58287059, 24 - tz.transition 1937, 10, :o1, 58291427, 24 - tz.transition 1938, 3, :o2, 58295627, 24 - tz.transition 1938, 10, :o1, 58300163, 24 - tz.transition 1939, 4, :o2, 58304867, 24 - tz.transition 1939, 11, :o1, 58310075, 24 - tz.transition 1940, 2, :o2, 58312427, 24 - tz.transition 1940, 10, :o1, 58317803, 24 - tz.transition 1941, 4, :o2, 58322171, 24 - tz.transition 1941, 10, :o1, 58326563, 24 - tz.transition 1942, 3, :o2, 58330403, 24 - tz.transition 1942, 4, :o3, 29165705, 12 - tz.transition 1942, 8, :o2, 29167049, 12 - tz.transition 1942, 10, :o1, 58335779, 24 - tz.transition 1943, 3, :o2, 58339139, 24 - tz.transition 1943, 4, :o3, 29169989, 12 - tz.transition 1943, 8, :o2, 29171585, 12 - tz.transition 1943, 10, :o1, 58344683, 24 - tz.transition 1944, 3, :o2, 58347875, 24 - tz.transition 1944, 4, :o3, 29174441, 12 - tz.transition 1944, 8, :o2, 29175953, 12 - tz.transition 1944, 10, :o1, 58353419, 24 - tz.transition 1945, 3, :o2, 58356611, 24 - tz.transition 1945, 4, :o3, 29178809, 12 - tz.transition 1945, 8, :o2, 29180321, 12 - tz.transition 1945, 10, :o1, 58362155, 24 - tz.transition 1946, 4, :o2, 58366019, 24 - tz.transition 1946, 10, :o1, 58370387, 24 - tz.transition 1947, 4, :o2, 29187379, 12 - tz.transition 1947, 10, :o1, 29189563, 12 - tz.transition 1948, 4, :o2, 29191747, 12 - tz.transition 1948, 10, :o1, 29193931, 12 - tz.transition 1949, 4, :o2, 29196115, 12 - tz.transition 1949, 10, :o1, 29198299, 12 - tz.transition 1951, 4, :o2, 29204851, 12 - tz.transition 1951, 10, :o1, 29207119, 12 - tz.transition 1952, 4, :o2, 29209303, 12 - tz.transition 1952, 10, :o1, 29211487, 12 - tz.transition 1953, 4, :o2, 29213671, 12 - tz.transition 1953, 10, :o1, 29215855, 12 - tz.transition 1954, 4, :o2, 29218039, 12 - tz.transition 1954, 10, :o1, 29220223, 12 - tz.transition 1955, 4, :o2, 29222407, 12 - tz.transition 1955, 10, :o1, 29224591, 12 - tz.transition 1956, 4, :o2, 29226775, 12 - tz.transition 1956, 10, :o1, 29229043, 12 - tz.transition 1957, 4, :o2, 29231227, 12 - tz.transition 1957, 10, :o1, 29233411, 12 - tz.transition 1958, 4, :o2, 29235595, 12 - tz.transition 1958, 10, :o1, 29237779, 12 - tz.transition 1959, 4, :o2, 29239963, 12 - tz.transition 1959, 10, :o1, 29242147, 12 - tz.transition 1960, 4, :o2, 29244331, 12 - tz.transition 1960, 10, :o1, 29246515, 12 - tz.transition 1961, 4, :o2, 29248699, 12 - tz.transition 1961, 10, :o1, 29250883, 12 - tz.transition 1962, 4, :o2, 29253067, 12 - tz.transition 1962, 10, :o1, 29255335, 12 - tz.transition 1963, 4, :o2, 29257519, 12 - tz.transition 1963, 10, :o1, 29259703, 12 - tz.transition 1964, 4, :o2, 29261887, 12 - tz.transition 1964, 10, :o1, 29264071, 12 - tz.transition 1965, 4, :o2, 29266255, 12 - tz.transition 1965, 10, :o1, 29268439, 12 - tz.transition 1966, 4, :o4, 29270623, 12 - tz.transition 1976, 9, :o1, 212544000 - tz.transition 1977, 3, :o2, 228268800 - tz.transition 1977, 9, :o1, 243993600 - tz.transition 1978, 4, :o2, 260323200 - tz.transition 1978, 10, :o1, 276048000 - tz.transition 1979, 4, :o2, 291772800 - tz.transition 1979, 9, :o1, 307501200 - tz.transition 1980, 3, :o2, 323222400 - tz.transition 1980, 9, :o1, 338950800 - tz.transition 1981, 3, :o2, 354675600 - tz.transition 1981, 9, :o1, 370400400 - tz.transition 1982, 3, :o2, 386125200 - tz.transition 1982, 9, :o1, 401850000 - tz.transition 1983, 3, :o2, 417578400 - tz.transition 1983, 9, :o1, 433299600 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 9, :o1, 465354000 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 9, :o1, 496803600 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 9, :o1, 528253200 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 9, :o1, 559702800 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 9, :o1, 591152400 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 9, :o1, 622602000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 9, :o1, 654656400 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 9, :o1, 686106000 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 9, :o4, 717555600 - tz.transition 1993, 3, :o5, 733280400 - tz.transition 1993, 9, :o4, 749005200 - tz.transition 1994, 3, :o5, 764730000 - tz.transition 1994, 9, :o4, 780454800 - tz.transition 1995, 3, :o5, 796179600 - tz.transition 1995, 9, :o4, 811904400 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb deleted file mode 100644 index a9828e6ef8..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Ljubljana - include TimezoneDefinition - - linked_timezone 'Europe/Ljubljana', 'Europe/Belgrade' - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb deleted file mode 100644 index 64ce41e900..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb +++ /dev/null @@ -1,288 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module London - include TimezoneDefinition - - timezone 'Europe/London' do |tz| - tz.offset :o0, -75, 0, :LMT - tz.offset :o1, 0, 0, :GMT - tz.offset :o2, 0, 3600, :BST - tz.offset :o3, 0, 7200, :BDST - tz.offset :o4, 3600, 0, :BST - - tz.transition 1847, 12, :o1, 2760187969, 1152 - tz.transition 1916, 5, :o2, 29052055, 12 - tz.transition 1916, 10, :o1, 29053651, 12 - tz.transition 1917, 4, :o2, 29055919, 12 - tz.transition 1917, 9, :o1, 29057863, 12 - tz.transition 1918, 3, :o2, 29060119, 12 - tz.transition 1918, 9, :o1, 29062399, 12 - tz.transition 1919, 3, :o2, 29064571, 12 - tz.transition 1919, 9, :o1, 29066767, 12 - tz.transition 1920, 3, :o2, 29068939, 12 - tz.transition 1920, 10, :o1, 29071471, 12 - tz.transition 1921, 4, :o2, 29073391, 12 - tz.transition 1921, 10, :o1, 29075587, 12 - tz.transition 1922, 3, :o2, 29077675, 12 - tz.transition 1922, 10, :o1, 29080027, 12 - tz.transition 1923, 4, :o2, 29082379, 12 - tz.transition 1923, 9, :o1, 29084143, 12 - tz.transition 1924, 4, :o2, 29086663, 12 - tz.transition 1924, 9, :o1, 29088595, 12 - tz.transition 1925, 4, :o2, 29091115, 12 - tz.transition 1925, 10, :o1, 29093131, 12 - tz.transition 1926, 4, :o2, 29095483, 12 - tz.transition 1926, 10, :o1, 29097499, 12 - tz.transition 1927, 4, :o2, 29099767, 12 - tz.transition 1927, 10, :o1, 29101867, 12 - tz.transition 1928, 4, :o2, 29104303, 12 - tz.transition 1928, 10, :o1, 29106319, 12 - tz.transition 1929, 4, :o2, 29108671, 12 - tz.transition 1929, 10, :o1, 29110687, 12 - tz.transition 1930, 4, :o2, 29112955, 12 - tz.transition 1930, 10, :o1, 29115055, 12 - tz.transition 1931, 4, :o2, 29117407, 12 - tz.transition 1931, 10, :o1, 29119423, 12 - tz.transition 1932, 4, :o2, 29121775, 12 - tz.transition 1932, 10, :o1, 29123791, 12 - tz.transition 1933, 4, :o2, 29126059, 12 - tz.transition 1933, 10, :o1, 29128243, 12 - tz.transition 1934, 4, :o2, 29130595, 12 - tz.transition 1934, 10, :o1, 29132611, 12 - tz.transition 1935, 4, :o2, 29134879, 12 - tz.transition 1935, 10, :o1, 29136979, 12 - tz.transition 1936, 4, :o2, 29139331, 12 - tz.transition 1936, 10, :o1, 29141347, 12 - tz.transition 1937, 4, :o2, 29143699, 12 - tz.transition 1937, 10, :o1, 29145715, 12 - tz.transition 1938, 4, :o2, 29147983, 12 - tz.transition 1938, 10, :o1, 29150083, 12 - tz.transition 1939, 4, :o2, 29152435, 12 - tz.transition 1939, 11, :o1, 29155039, 12 - tz.transition 1940, 2, :o2, 29156215, 12 - tz.transition 1941, 5, :o3, 58322845, 24 - tz.transition 1941, 8, :o2, 58325197, 24 - tz.transition 1942, 4, :o3, 58330909, 24 - tz.transition 1942, 8, :o2, 58333933, 24 - tz.transition 1943, 4, :o3, 58339645, 24 - tz.transition 1943, 8, :o2, 58342837, 24 - tz.transition 1944, 4, :o3, 58348381, 24 - tz.transition 1944, 9, :o2, 58352413, 24 - tz.transition 1945, 4, :o3, 58357141, 24 - tz.transition 1945, 7, :o2, 58359637, 24 - tz.transition 1945, 10, :o1, 29180827, 12 - tz.transition 1946, 4, :o2, 29183095, 12 - tz.transition 1946, 10, :o1, 29185195, 12 - tz.transition 1947, 3, :o2, 29187127, 12 - tz.transition 1947, 4, :o3, 58374925, 24 - tz.transition 1947, 8, :o2, 58377781, 24 - tz.transition 1947, 11, :o1, 29189899, 12 - tz.transition 1948, 3, :o2, 29191495, 12 - tz.transition 1948, 10, :o1, 29194267, 12 - tz.transition 1949, 4, :o2, 29196115, 12 - tz.transition 1949, 10, :o1, 29198635, 12 - tz.transition 1950, 4, :o2, 29200651, 12 - tz.transition 1950, 10, :o1, 29202919, 12 - tz.transition 1951, 4, :o2, 29205019, 12 - tz.transition 1951, 10, :o1, 29207287, 12 - tz.transition 1952, 4, :o2, 29209471, 12 - tz.transition 1952, 10, :o1, 29211739, 12 - tz.transition 1953, 4, :o2, 29213839, 12 - tz.transition 1953, 10, :o1, 29215855, 12 - tz.transition 1954, 4, :o2, 29218123, 12 - tz.transition 1954, 10, :o1, 29220223, 12 - tz.transition 1955, 4, :o2, 29222575, 12 - tz.transition 1955, 10, :o1, 29224591, 12 - tz.transition 1956, 4, :o2, 29227027, 12 - tz.transition 1956, 10, :o1, 29229043, 12 - tz.transition 1957, 4, :o2, 29231311, 12 - tz.transition 1957, 10, :o1, 29233411, 12 - tz.transition 1958, 4, :o2, 29235763, 12 - tz.transition 1958, 10, :o1, 29237779, 12 - tz.transition 1959, 4, :o2, 29240131, 12 - tz.transition 1959, 10, :o1, 29242147, 12 - tz.transition 1960, 4, :o2, 29244415, 12 - tz.transition 1960, 10, :o1, 29246515, 12 - tz.transition 1961, 3, :o2, 29248615, 12 - tz.transition 1961, 10, :o1, 29251219, 12 - tz.transition 1962, 3, :o2, 29252983, 12 - tz.transition 1962, 10, :o1, 29255587, 12 - tz.transition 1963, 3, :o2, 29257435, 12 - tz.transition 1963, 10, :o1, 29259955, 12 - tz.transition 1964, 3, :o2, 29261719, 12 - tz.transition 1964, 10, :o1, 29264323, 12 - tz.transition 1965, 3, :o2, 29266087, 12 - tz.transition 1965, 10, :o1, 29268691, 12 - tz.transition 1966, 3, :o2, 29270455, 12 - tz.transition 1966, 10, :o1, 29273059, 12 - tz.transition 1967, 3, :o2, 29274823, 12 - tz.transition 1967, 10, :o1, 29277511, 12 - tz.transition 1968, 2, :o2, 29278855, 12 - tz.transition 1968, 10, :o4, 58563755, 24 - tz.transition 1971, 10, :o1, 57722400 - tz.transition 1972, 3, :o2, 69818400 - tz.transition 1972, 10, :o1, 89172000 - tz.transition 1973, 3, :o2, 101268000 - tz.transition 1973, 10, :o1, 120621600 - tz.transition 1974, 3, :o2, 132717600 - tz.transition 1974, 10, :o1, 152071200 - tz.transition 1975, 3, :o2, 164167200 - tz.transition 1975, 10, :o1, 183520800 - tz.transition 1976, 3, :o2, 196221600 - tz.transition 1976, 10, :o1, 214970400 - tz.transition 1977, 3, :o2, 227671200 - tz.transition 1977, 10, :o1, 246420000 - tz.transition 1978, 3, :o2, 259120800 - tz.transition 1978, 10, :o1, 278474400 - tz.transition 1979, 3, :o2, 290570400 - tz.transition 1979, 10, :o1, 309924000 - tz.transition 1980, 3, :o2, 322020000 - tz.transition 1980, 10, :o1, 341373600 - tz.transition 1981, 3, :o2, 354675600 - tz.transition 1981, 10, :o1, 372819600 - tz.transition 1982, 3, :o2, 386125200 - tz.transition 1982, 10, :o1, 404269200 - tz.transition 1983, 3, :o2, 417574800 - tz.transition 1983, 10, :o1, 435718800 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 10, :o1, 467773200 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 10, :o1, 499222800 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 10, :o1, 530672400 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 10, :o1, 562122000 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 10, :o1, 593571600 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 10, :o1, 625626000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 10, :o1, 657075600 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 10, :o1, 688525200 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 10, :o1, 719974800 - tz.transition 1993, 3, :o2, 733280400 - tz.transition 1993, 10, :o1, 751424400 - tz.transition 1994, 3, :o2, 764730000 - tz.transition 1994, 10, :o1, 782874000 - tz.transition 1995, 3, :o2, 796179600 - tz.transition 1995, 10, :o1, 814323600 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb deleted file mode 100644 index 1fb568239a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb +++ /dev/null @@ -1,211 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Madrid - include TimezoneDefinition - - timezone 'Europe/Madrid' do |tz| - tz.offset :o0, -884, 0, :LMT - tz.offset :o1, 0, 0, :WET - tz.offset :o2, 0, 3600, :WEST - tz.offset :o3, 0, 7200, :WEMT - tz.offset :o4, 3600, 0, :CET - tz.offset :o5, 3600, 3600, :CEST - - tz.transition 1901, 1, :o1, 52172327021, 21600 - tz.transition 1917, 5, :o2, 58112507, 24 - tz.transition 1917, 10, :o1, 58116203, 24 - tz.transition 1918, 4, :o2, 58120787, 24 - tz.transition 1918, 10, :o1, 58124963, 24 - tz.transition 1919, 4, :o2, 58129307, 24 - tz.transition 1919, 10, :o1, 58133723, 24 - tz.transition 1924, 4, :o2, 58173419, 24 - tz.transition 1924, 10, :o1, 58177523, 24 - tz.transition 1926, 4, :o2, 58190963, 24 - tz.transition 1926, 10, :o1, 58194995, 24 - tz.transition 1927, 4, :o2, 58199531, 24 - tz.transition 1927, 10, :o1, 58203731, 24 - tz.transition 1928, 4, :o2, 58208435, 24 - tz.transition 1928, 10, :o1, 58212635, 24 - tz.transition 1929, 4, :o2, 58217339, 24 - tz.transition 1929, 10, :o1, 58221371, 24 - tz.transition 1937, 5, :o2, 58288235, 24 - tz.transition 1937, 10, :o1, 58291427, 24 - tz.transition 1938, 3, :o2, 58295531, 24 - tz.transition 1938, 10, :o1, 58300163, 24 - tz.transition 1939, 4, :o2, 58304867, 24 - tz.transition 1939, 10, :o1, 58309067, 24 - tz.transition 1940, 3, :o2, 58312931, 24 - tz.transition 1942, 5, :o3, 29165789, 12 - tz.transition 1942, 9, :o2, 29167253, 12 - tz.transition 1943, 4, :o3, 29169989, 12 - tz.transition 1943, 10, :o2, 29172017, 12 - tz.transition 1944, 4, :o3, 29174357, 12 - tz.transition 1944, 10, :o2, 29176493, 12 - tz.transition 1945, 4, :o3, 29178725, 12 - tz.transition 1945, 9, :o2, 58361483, 24 - tz.transition 1946, 4, :o3, 29183093, 12 - tz.transition 1946, 9, :o4, 29185121, 12 - tz.transition 1949, 4, :o5, 29196449, 12 - tz.transition 1949, 9, :o4, 58396547, 24 - tz.transition 1974, 4, :o5, 135122400 - tz.transition 1974, 10, :o4, 150246000 - tz.transition 1975, 4, :o5, 167176800 - tz.transition 1975, 10, :o4, 181695600 - tz.transition 1976, 3, :o5, 196812000 - tz.transition 1976, 9, :o4, 212540400 - tz.transition 1977, 4, :o5, 228866400 - tz.transition 1977, 9, :o4, 243990000 - tz.transition 1978, 4, :o5, 260402400 - tz.transition 1978, 9, :o4, 276044400 - tz.transition 1979, 4, :o5, 291776400 - tz.transition 1979, 9, :o4, 307501200 - tz.transition 1980, 4, :o5, 323830800 - tz.transition 1980, 9, :o4, 338950800 - tz.transition 1981, 3, :o5, 354675600 - tz.transition 1981, 9, :o4, 370400400 - tz.transition 1982, 3, :o5, 386125200 - tz.transition 1982, 9, :o4, 401850000 - tz.transition 1983, 3, :o5, 417574800 - tz.transition 1983, 9, :o4, 433299600 - tz.transition 1984, 3, :o5, 449024400 - tz.transition 1984, 9, :o4, 465354000 - tz.transition 1985, 3, :o5, 481078800 - tz.transition 1985, 9, :o4, 496803600 - tz.transition 1986, 3, :o5, 512528400 - tz.transition 1986, 9, :o4, 528253200 - tz.transition 1987, 3, :o5, 543978000 - tz.transition 1987, 9, :o4, 559702800 - tz.transition 1988, 3, :o5, 575427600 - tz.transition 1988, 9, :o4, 591152400 - tz.transition 1989, 3, :o5, 606877200 - tz.transition 1989, 9, :o4, 622602000 - tz.transition 1990, 3, :o5, 638326800 - tz.transition 1990, 9, :o4, 654656400 - tz.transition 1991, 3, :o5, 670381200 - tz.transition 1991, 9, :o4, 686106000 - tz.transition 1992, 3, :o5, 701830800 - tz.transition 1992, 9, :o4, 717555600 - tz.transition 1993, 3, :o5, 733280400 - tz.transition 1993, 9, :o4, 749005200 - tz.transition 1994, 3, :o5, 764730000 - tz.transition 1994, 9, :o4, 780454800 - tz.transition 1995, 3, :o5, 796179600 - tz.transition 1995, 9, :o4, 811904400 - tz.transition 1996, 3, :o5, 828234000 - tz.transition 1996, 10, :o4, 846378000 - tz.transition 1997, 3, :o5, 859683600 - tz.transition 1997, 10, :o4, 877827600 - tz.transition 1998, 3, :o5, 891133200 - tz.transition 1998, 10, :o4, 909277200 - tz.transition 1999, 3, :o5, 922582800 - tz.transition 1999, 10, :o4, 941331600 - tz.transition 2000, 3, :o5, 954032400 - tz.transition 2000, 10, :o4, 972781200 - tz.transition 2001, 3, :o5, 985482000 - tz.transition 2001, 10, :o4, 1004230800 - tz.transition 2002, 3, :o5, 1017536400 - tz.transition 2002, 10, :o4, 1035680400 - tz.transition 2003, 3, :o5, 1048986000 - tz.transition 2003, 10, :o4, 1067130000 - tz.transition 2004, 3, :o5, 1080435600 - tz.transition 2004, 10, :o4, 1099184400 - tz.transition 2005, 3, :o5, 1111885200 - tz.transition 2005, 10, :o4, 1130634000 - tz.transition 2006, 3, :o5, 1143334800 - tz.transition 2006, 10, :o4, 1162083600 - tz.transition 2007, 3, :o5, 1174784400 - tz.transition 2007, 10, :o4, 1193533200 - tz.transition 2008, 3, :o5, 1206838800 - tz.transition 2008, 10, :o4, 1224982800 - tz.transition 2009, 3, :o5, 1238288400 - tz.transition 2009, 10, :o4, 1256432400 - tz.transition 2010, 3, :o5, 1269738000 - tz.transition 2010, 10, :o4, 1288486800 - tz.transition 2011, 3, :o5, 1301187600 - tz.transition 2011, 10, :o4, 1319936400 - tz.transition 2012, 3, :o5, 1332637200 - tz.transition 2012, 10, :o4, 1351386000 - tz.transition 2013, 3, :o5, 1364691600 - tz.transition 2013, 10, :o4, 1382835600 - tz.transition 2014, 3, :o5, 1396141200 - tz.transition 2014, 10, :o4, 1414285200 - tz.transition 2015, 3, :o5, 1427590800 - tz.transition 2015, 10, :o4, 1445734800 - tz.transition 2016, 3, :o5, 1459040400 - tz.transition 2016, 10, :o4, 1477789200 - tz.transition 2017, 3, :o5, 1490490000 - tz.transition 2017, 10, :o4, 1509238800 - tz.transition 2018, 3, :o5, 1521939600 - tz.transition 2018, 10, :o4, 1540688400 - tz.transition 2019, 3, :o5, 1553994000 - tz.transition 2019, 10, :o4, 1572138000 - tz.transition 2020, 3, :o5, 1585443600 - tz.transition 2020, 10, :o4, 1603587600 - tz.transition 2021, 3, :o5, 1616893200 - tz.transition 2021, 10, :o4, 1635642000 - tz.transition 2022, 3, :o5, 1648342800 - tz.transition 2022, 10, :o4, 1667091600 - tz.transition 2023, 3, :o5, 1679792400 - tz.transition 2023, 10, :o4, 1698541200 - tz.transition 2024, 3, :o5, 1711846800 - tz.transition 2024, 10, :o4, 1729990800 - tz.transition 2025, 3, :o5, 1743296400 - tz.transition 2025, 10, :o4, 1761440400 - tz.transition 2026, 3, :o5, 1774746000 - tz.transition 2026, 10, :o4, 1792890000 - tz.transition 2027, 3, :o5, 1806195600 - tz.transition 2027, 10, :o4, 1824944400 - tz.transition 2028, 3, :o5, 1837645200 - tz.transition 2028, 10, :o4, 1856394000 - tz.transition 2029, 3, :o5, 1869094800 - tz.transition 2029, 10, :o4, 1887843600 - tz.transition 2030, 3, :o5, 1901149200 - tz.transition 2030, 10, :o4, 1919293200 - tz.transition 2031, 3, :o5, 1932598800 - tz.transition 2031, 10, :o4, 1950742800 - tz.transition 2032, 3, :o5, 1964048400 - tz.transition 2032, 10, :o4, 1982797200 - tz.transition 2033, 3, :o5, 1995498000 - tz.transition 2033, 10, :o4, 2014246800 - tz.transition 2034, 3, :o5, 2026947600 - tz.transition 2034, 10, :o4, 2045696400 - tz.transition 2035, 3, :o5, 2058397200 - tz.transition 2035, 10, :o4, 2077146000 - tz.transition 2036, 3, :o5, 2090451600 - tz.transition 2036, 10, :o4, 2108595600 - tz.transition 2037, 3, :o5, 2121901200 - tz.transition 2037, 10, :o4, 2140045200 - tz.transition 2038, 3, :o5, 59172253, 24 - tz.transition 2038, 10, :o4, 59177461, 24 - tz.transition 2039, 3, :o5, 59180989, 24 - tz.transition 2039, 10, :o4, 59186197, 24 - tz.transition 2040, 3, :o5, 59189725, 24 - tz.transition 2040, 10, :o4, 59194933, 24 - tz.transition 2041, 3, :o5, 59198629, 24 - tz.transition 2041, 10, :o4, 59203669, 24 - tz.transition 2042, 3, :o5, 59207365, 24 - tz.transition 2042, 10, :o4, 59212405, 24 - tz.transition 2043, 3, :o5, 59216101, 24 - tz.transition 2043, 10, :o4, 59221141, 24 - tz.transition 2044, 3, :o5, 59224837, 24 - tz.transition 2044, 10, :o4, 59230045, 24 - tz.transition 2045, 3, :o5, 59233573, 24 - tz.transition 2045, 10, :o4, 59238781, 24 - tz.transition 2046, 3, :o5, 59242309, 24 - tz.transition 2046, 10, :o4, 59247517, 24 - tz.transition 2047, 3, :o5, 59251213, 24 - tz.transition 2047, 10, :o4, 59256253, 24 - tz.transition 2048, 3, :o5, 59259949, 24 - tz.transition 2048, 10, :o4, 59264989, 24 - tz.transition 2049, 3, :o5, 59268685, 24 - tz.transition 2049, 10, :o4, 59273893, 24 - tz.transition 2050, 3, :o5, 59277421, 24 - tz.transition 2050, 10, :o4, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb deleted file mode 100644 index fa15816cc8..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Minsk - include TimezoneDefinition - - timezone 'Europe/Minsk' do |tz| - tz.offset :o0, 6616, 0, :LMT - tz.offset :o1, 6600, 0, :MMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 10800, 0, :MSK - tz.offset :o4, 3600, 3600, :CEST - tz.offset :o5, 3600, 0, :CET - tz.offset :o6, 10800, 3600, :MSD - tz.offset :o7, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 26003326573, 10800 - tz.transition 1924, 5, :o2, 349042669, 144 - tz.transition 1930, 6, :o3, 29113781, 12 - tz.transition 1941, 6, :o4, 19441387, 8 - tz.transition 1942, 11, :o5, 58335973, 24 - tz.transition 1943, 3, :o4, 58339501, 24 - tz.transition 1943, 10, :o5, 58344037, 24 - tz.transition 1944, 4, :o4, 58348405, 24 - tz.transition 1944, 7, :o3, 29175293, 12 - tz.transition 1981, 3, :o6, 354920400 - tz.transition 1981, 9, :o3, 370728000 - tz.transition 1982, 3, :o6, 386456400 - tz.transition 1982, 9, :o3, 402264000 - tz.transition 1983, 3, :o6, 417992400 - tz.transition 1983, 9, :o3, 433800000 - tz.transition 1984, 3, :o6, 449614800 - tz.transition 1984, 9, :o3, 465346800 - tz.transition 1985, 3, :o6, 481071600 - tz.transition 1985, 9, :o3, 496796400 - tz.transition 1986, 3, :o6, 512521200 - tz.transition 1986, 9, :o3, 528246000 - tz.transition 1987, 3, :o6, 543970800 - tz.transition 1987, 9, :o3, 559695600 - tz.transition 1988, 3, :o6, 575420400 - tz.transition 1988, 9, :o3, 591145200 - tz.transition 1989, 3, :o6, 606870000 - tz.transition 1989, 9, :o3, 622594800 - tz.transition 1991, 3, :o7, 670374000 - tz.transition 1991, 9, :o2, 686102400 - tz.transition 1992, 3, :o7, 701820000 - tz.transition 1992, 9, :o2, 717544800 - tz.transition 1993, 3, :o7, 733276800 - tz.transition 1993, 9, :o2, 749001600 - tz.transition 1994, 3, :o7, 764726400 - tz.transition 1994, 9, :o2, 780451200 - tz.transition 1995, 3, :o7, 796176000 - tz.transition 1995, 9, :o2, 811900800 - tz.transition 1996, 3, :o7, 828230400 - tz.transition 1996, 10, :o2, 846374400 - tz.transition 1997, 3, :o7, 859680000 - tz.transition 1997, 10, :o2, 877824000 - tz.transition 1998, 3, :o7, 891129600 - tz.transition 1998, 10, :o2, 909273600 - tz.transition 1999, 3, :o7, 922579200 - tz.transition 1999, 10, :o2, 941328000 - tz.transition 2000, 3, :o7, 954028800 - tz.transition 2000, 10, :o2, 972777600 - tz.transition 2001, 3, :o7, 985478400 - tz.transition 2001, 10, :o2, 1004227200 - tz.transition 2002, 3, :o7, 1017532800 - tz.transition 2002, 10, :o2, 1035676800 - tz.transition 2003, 3, :o7, 1048982400 - tz.transition 2003, 10, :o2, 1067126400 - tz.transition 2004, 3, :o7, 1080432000 - tz.transition 2004, 10, :o2, 1099180800 - tz.transition 2005, 3, :o7, 1111881600 - tz.transition 2005, 10, :o2, 1130630400 - tz.transition 2006, 3, :o7, 1143331200 - tz.transition 2006, 10, :o2, 1162080000 - tz.transition 2007, 3, :o7, 1174780800 - tz.transition 2007, 10, :o2, 1193529600 - tz.transition 2008, 3, :o7, 1206835200 - tz.transition 2008, 10, :o2, 1224979200 - tz.transition 2009, 3, :o7, 1238284800 - tz.transition 2009, 10, :o2, 1256428800 - tz.transition 2010, 3, :o7, 1269734400 - tz.transition 2010, 10, :o2, 1288483200 - tz.transition 2011, 3, :o7, 1301184000 - tz.transition 2011, 10, :o2, 1319932800 - tz.transition 2012, 3, :o7, 1332633600 - tz.transition 2012, 10, :o2, 1351382400 - tz.transition 2013, 3, :o7, 1364688000 - tz.transition 2013, 10, :o2, 1382832000 - tz.transition 2014, 3, :o7, 1396137600 - tz.transition 2014, 10, :o2, 1414281600 - tz.transition 2015, 3, :o7, 1427587200 - tz.transition 2015, 10, :o2, 1445731200 - tz.transition 2016, 3, :o7, 1459036800 - tz.transition 2016, 10, :o2, 1477785600 - tz.transition 2017, 3, :o7, 1490486400 - tz.transition 2017, 10, :o2, 1509235200 - tz.transition 2018, 3, :o7, 1521936000 - tz.transition 2018, 10, :o2, 1540684800 - tz.transition 2019, 3, :o7, 1553990400 - tz.transition 2019, 10, :o2, 1572134400 - tz.transition 2020, 3, :o7, 1585440000 - tz.transition 2020, 10, :o2, 1603584000 - tz.transition 2021, 3, :o7, 1616889600 - tz.transition 2021, 10, :o2, 1635638400 - tz.transition 2022, 3, :o7, 1648339200 - tz.transition 2022, 10, :o2, 1667088000 - tz.transition 2023, 3, :o7, 1679788800 - tz.transition 2023, 10, :o2, 1698537600 - tz.transition 2024, 3, :o7, 1711843200 - tz.transition 2024, 10, :o2, 1729987200 - tz.transition 2025, 3, :o7, 1743292800 - tz.transition 2025, 10, :o2, 1761436800 - tz.transition 2026, 3, :o7, 1774742400 - tz.transition 2026, 10, :o2, 1792886400 - tz.transition 2027, 3, :o7, 1806192000 - tz.transition 2027, 10, :o2, 1824940800 - tz.transition 2028, 3, :o7, 1837641600 - tz.transition 2028, 10, :o2, 1856390400 - tz.transition 2029, 3, :o7, 1869091200 - tz.transition 2029, 10, :o2, 1887840000 - tz.transition 2030, 3, :o7, 1901145600 - tz.transition 2030, 10, :o2, 1919289600 - tz.transition 2031, 3, :o7, 1932595200 - tz.transition 2031, 10, :o2, 1950739200 - tz.transition 2032, 3, :o7, 1964044800 - tz.transition 2032, 10, :o2, 1982793600 - tz.transition 2033, 3, :o7, 1995494400 - tz.transition 2033, 10, :o2, 2014243200 - tz.transition 2034, 3, :o7, 2026944000 - tz.transition 2034, 10, :o2, 2045692800 - tz.transition 2035, 3, :o7, 2058393600 - tz.transition 2035, 10, :o2, 2077142400 - tz.transition 2036, 3, :o7, 2090448000 - tz.transition 2036, 10, :o2, 2108592000 - tz.transition 2037, 3, :o7, 2121897600 - tz.transition 2037, 10, :o2, 2140041600 - tz.transition 2038, 3, :o7, 4931021, 2 - tz.transition 2038, 10, :o2, 4931455, 2 - tz.transition 2039, 3, :o7, 4931749, 2 - tz.transition 2039, 10, :o2, 4932183, 2 - tz.transition 2040, 3, :o7, 4932477, 2 - tz.transition 2040, 10, :o2, 4932911, 2 - tz.transition 2041, 3, :o7, 4933219, 2 - tz.transition 2041, 10, :o2, 4933639, 2 - tz.transition 2042, 3, :o7, 4933947, 2 - tz.transition 2042, 10, :o2, 4934367, 2 - tz.transition 2043, 3, :o7, 4934675, 2 - tz.transition 2043, 10, :o2, 4935095, 2 - tz.transition 2044, 3, :o7, 4935403, 2 - tz.transition 2044, 10, :o2, 4935837, 2 - tz.transition 2045, 3, :o7, 4936131, 2 - tz.transition 2045, 10, :o2, 4936565, 2 - tz.transition 2046, 3, :o7, 4936859, 2 - tz.transition 2046, 10, :o2, 4937293, 2 - tz.transition 2047, 3, :o7, 4937601, 2 - tz.transition 2047, 10, :o2, 4938021, 2 - tz.transition 2048, 3, :o7, 4938329, 2 - tz.transition 2048, 10, :o2, 4938749, 2 - tz.transition 2049, 3, :o7, 4939057, 2 - tz.transition 2049, 10, :o2, 4939491, 2 - tz.transition 2050, 3, :o7, 4939785, 2 - tz.transition 2050, 10, :o2, 4940219, 2 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb deleted file mode 100644 index ef269b675b..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Moscow - include TimezoneDefinition - - timezone 'Europe/Moscow' do |tz| - tz.offset :o0, 9020, 0, :LMT - tz.offset :o1, 9000, 0, :MMT - tz.offset :o2, 9048, 0, :MMT - tz.offset :o3, 9048, 3600, :MST - tz.offset :o4, 9048, 7200, :MDST - tz.offset :o5, 10800, 3600, :MSD - tz.offset :o6, 10800, 0, :MSK - tz.offset :o7, 10800, 7200, :MSD - tz.offset :o8, 7200, 0, :EET - tz.offset :o9, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 10401330509, 4320 - tz.transition 1916, 7, :o2, 116210275, 48 - tz.transition 1917, 7, :o3, 8717080873, 3600 - tz.transition 1917, 12, :o2, 8717725273, 3600 - tz.transition 1918, 5, :o4, 8718283123, 3600 - tz.transition 1918, 9, :o3, 8718668473, 3600 - tz.transition 1919, 5, :o4, 8719597123, 3600 - tz.transition 1919, 6, :o5, 8719705423, 3600 - tz.transition 1919, 8, :o6, 7266559, 3 - tz.transition 1921, 2, :o5, 7268206, 3 - tz.transition 1921, 3, :o7, 58146463, 24 - tz.transition 1921, 8, :o5, 58150399, 24 - tz.transition 1921, 9, :o6, 7268890, 3 - tz.transition 1922, 9, :o8, 19386627, 8 - tz.transition 1930, 6, :o6, 29113781, 12 - tz.transition 1981, 3, :o5, 354920400 - tz.transition 1981, 9, :o6, 370728000 - tz.transition 1982, 3, :o5, 386456400 - tz.transition 1982, 9, :o6, 402264000 - tz.transition 1983, 3, :o5, 417992400 - tz.transition 1983, 9, :o6, 433800000 - tz.transition 1984, 3, :o5, 449614800 - tz.transition 1984, 9, :o6, 465346800 - tz.transition 1985, 3, :o5, 481071600 - tz.transition 1985, 9, :o6, 496796400 - tz.transition 1986, 3, :o5, 512521200 - tz.transition 1986, 9, :o6, 528246000 - tz.transition 1987, 3, :o5, 543970800 - tz.transition 1987, 9, :o6, 559695600 - tz.transition 1988, 3, :o5, 575420400 - tz.transition 1988, 9, :o6, 591145200 - tz.transition 1989, 3, :o5, 606870000 - tz.transition 1989, 9, :o6, 622594800 - tz.transition 1990, 3, :o5, 638319600 - tz.transition 1990, 9, :o6, 654649200 - tz.transition 1991, 3, :o9, 670374000 - tz.transition 1991, 9, :o8, 686102400 - tz.transition 1992, 1, :o6, 695779200 - tz.transition 1992, 3, :o5, 701812800 - tz.transition 1992, 9, :o6, 717534000 - tz.transition 1993, 3, :o5, 733273200 - tz.transition 1993, 9, :o6, 748998000 - tz.transition 1994, 3, :o5, 764722800 - tz.transition 1994, 9, :o6, 780447600 - tz.transition 1995, 3, :o5, 796172400 - tz.transition 1995, 9, :o6, 811897200 - tz.transition 1996, 3, :o5, 828226800 - tz.transition 1996, 10, :o6, 846370800 - tz.transition 1997, 3, :o5, 859676400 - tz.transition 1997, 10, :o6, 877820400 - tz.transition 1998, 3, :o5, 891126000 - tz.transition 1998, 10, :o6, 909270000 - tz.transition 1999, 3, :o5, 922575600 - tz.transition 1999, 10, :o6, 941324400 - tz.transition 2000, 3, :o5, 954025200 - tz.transition 2000, 10, :o6, 972774000 - tz.transition 2001, 3, :o5, 985474800 - tz.transition 2001, 10, :o6, 1004223600 - tz.transition 2002, 3, :o5, 1017529200 - tz.transition 2002, 10, :o6, 1035673200 - tz.transition 2003, 3, :o5, 1048978800 - tz.transition 2003, 10, :o6, 1067122800 - tz.transition 2004, 3, :o5, 1080428400 - tz.transition 2004, 10, :o6, 1099177200 - tz.transition 2005, 3, :o5, 1111878000 - tz.transition 2005, 10, :o6, 1130626800 - tz.transition 2006, 3, :o5, 1143327600 - tz.transition 2006, 10, :o6, 1162076400 - tz.transition 2007, 3, :o5, 1174777200 - tz.transition 2007, 10, :o6, 1193526000 - tz.transition 2008, 3, :o5, 1206831600 - tz.transition 2008, 10, :o6, 1224975600 - tz.transition 2009, 3, :o5, 1238281200 - tz.transition 2009, 10, :o6, 1256425200 - tz.transition 2010, 3, :o5, 1269730800 - tz.transition 2010, 10, :o6, 1288479600 - tz.transition 2011, 3, :o5, 1301180400 - tz.transition 2011, 10, :o6, 1319929200 - tz.transition 2012, 3, :o5, 1332630000 - tz.transition 2012, 10, :o6, 1351378800 - tz.transition 2013, 3, :o5, 1364684400 - tz.transition 2013, 10, :o6, 1382828400 - tz.transition 2014, 3, :o5, 1396134000 - tz.transition 2014, 10, :o6, 1414278000 - tz.transition 2015, 3, :o5, 1427583600 - tz.transition 2015, 10, :o6, 1445727600 - tz.transition 2016, 3, :o5, 1459033200 - tz.transition 2016, 10, :o6, 1477782000 - tz.transition 2017, 3, :o5, 1490482800 - tz.transition 2017, 10, :o6, 1509231600 - tz.transition 2018, 3, :o5, 1521932400 - tz.transition 2018, 10, :o6, 1540681200 - tz.transition 2019, 3, :o5, 1553986800 - tz.transition 2019, 10, :o6, 1572130800 - tz.transition 2020, 3, :o5, 1585436400 - tz.transition 2020, 10, :o6, 1603580400 - tz.transition 2021, 3, :o5, 1616886000 - tz.transition 2021, 10, :o6, 1635634800 - tz.transition 2022, 3, :o5, 1648335600 - tz.transition 2022, 10, :o6, 1667084400 - tz.transition 2023, 3, :o5, 1679785200 - tz.transition 2023, 10, :o6, 1698534000 - tz.transition 2024, 3, :o5, 1711839600 - tz.transition 2024, 10, :o6, 1729983600 - tz.transition 2025, 3, :o5, 1743289200 - tz.transition 2025, 10, :o6, 1761433200 - tz.transition 2026, 3, :o5, 1774738800 - tz.transition 2026, 10, :o6, 1792882800 - tz.transition 2027, 3, :o5, 1806188400 - tz.transition 2027, 10, :o6, 1824937200 - tz.transition 2028, 3, :o5, 1837638000 - tz.transition 2028, 10, :o6, 1856386800 - tz.transition 2029, 3, :o5, 1869087600 - tz.transition 2029, 10, :o6, 1887836400 - tz.transition 2030, 3, :o5, 1901142000 - tz.transition 2030, 10, :o6, 1919286000 - tz.transition 2031, 3, :o5, 1932591600 - tz.transition 2031, 10, :o6, 1950735600 - tz.transition 2032, 3, :o5, 1964041200 - tz.transition 2032, 10, :o6, 1982790000 - tz.transition 2033, 3, :o5, 1995490800 - tz.transition 2033, 10, :o6, 2014239600 - tz.transition 2034, 3, :o5, 2026940400 - tz.transition 2034, 10, :o6, 2045689200 - tz.transition 2035, 3, :o5, 2058390000 - tz.transition 2035, 10, :o6, 2077138800 - tz.transition 2036, 3, :o5, 2090444400 - tz.transition 2036, 10, :o6, 2108588400 - tz.transition 2037, 3, :o5, 2121894000 - tz.transition 2037, 10, :o6, 2140038000 - tz.transition 2038, 3, :o5, 59172251, 24 - tz.transition 2038, 10, :o6, 59177459, 24 - tz.transition 2039, 3, :o5, 59180987, 24 - tz.transition 2039, 10, :o6, 59186195, 24 - tz.transition 2040, 3, :o5, 59189723, 24 - tz.transition 2040, 10, :o6, 59194931, 24 - tz.transition 2041, 3, :o5, 59198627, 24 - tz.transition 2041, 10, :o6, 59203667, 24 - tz.transition 2042, 3, :o5, 59207363, 24 - tz.transition 2042, 10, :o6, 59212403, 24 - tz.transition 2043, 3, :o5, 59216099, 24 - tz.transition 2043, 10, :o6, 59221139, 24 - tz.transition 2044, 3, :o5, 59224835, 24 - tz.transition 2044, 10, :o6, 59230043, 24 - tz.transition 2045, 3, :o5, 59233571, 24 - tz.transition 2045, 10, :o6, 59238779, 24 - tz.transition 2046, 3, :o5, 59242307, 24 - tz.transition 2046, 10, :o6, 59247515, 24 - tz.transition 2047, 3, :o5, 59251211, 24 - tz.transition 2047, 10, :o6, 59256251, 24 - tz.transition 2048, 3, :o5, 59259947, 24 - tz.transition 2048, 10, :o6, 59264987, 24 - tz.transition 2049, 3, :o5, 59268683, 24 - tz.transition 2049, 10, :o6, 59273891, 24 - tz.transition 2050, 3, :o5, 59277419, 24 - tz.transition 2050, 10, :o6, 59282627, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb deleted file mode 100644 index e3236c0ba1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb +++ /dev/null @@ -1,232 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Paris - include TimezoneDefinition - - timezone 'Europe/Paris' do |tz| - tz.offset :o0, 561, 0, :LMT - tz.offset :o1, 561, 0, :PMT - tz.offset :o2, 0, 0, :WET - tz.offset :o3, 0, 3600, :WEST - tz.offset :o4, 3600, 3600, :CEST - tz.offset :o5, 3600, 0, :CET - tz.offset :o6, 0, 7200, :WEMT - - tz.transition 1891, 3, :o1, 69460027033, 28800 - tz.transition 1911, 3, :o2, 69670267033, 28800 - tz.transition 1916, 6, :o3, 58104707, 24 - tz.transition 1916, 10, :o2, 58107323, 24 - tz.transition 1917, 3, :o3, 58111499, 24 - tz.transition 1917, 10, :o2, 58116227, 24 - tz.transition 1918, 3, :o3, 58119899, 24 - tz.transition 1918, 10, :o2, 58124963, 24 - tz.transition 1919, 3, :o3, 58128467, 24 - tz.transition 1919, 10, :o2, 58133699, 24 - tz.transition 1920, 2, :o3, 58136867, 24 - tz.transition 1920, 10, :o2, 58142915, 24 - tz.transition 1921, 3, :o3, 58146323, 24 - tz.transition 1921, 10, :o2, 58151723, 24 - tz.transition 1922, 3, :o3, 58155347, 24 - tz.transition 1922, 10, :o2, 58160051, 24 - tz.transition 1923, 5, :o3, 58165595, 24 - tz.transition 1923, 10, :o2, 58168787, 24 - tz.transition 1924, 3, :o3, 58172987, 24 - tz.transition 1924, 10, :o2, 58177523, 24 - tz.transition 1925, 4, :o3, 58181891, 24 - tz.transition 1925, 10, :o2, 58186259, 24 - tz.transition 1926, 4, :o3, 58190963, 24 - tz.transition 1926, 10, :o2, 58194995, 24 - tz.transition 1927, 4, :o3, 58199531, 24 - tz.transition 1927, 10, :o2, 58203731, 24 - tz.transition 1928, 4, :o3, 58208435, 24 - tz.transition 1928, 10, :o2, 58212635, 24 - tz.transition 1929, 4, :o3, 58217339, 24 - tz.transition 1929, 10, :o2, 58221371, 24 - tz.transition 1930, 4, :o3, 58225907, 24 - tz.transition 1930, 10, :o2, 58230107, 24 - tz.transition 1931, 4, :o3, 58234811, 24 - tz.transition 1931, 10, :o2, 58238843, 24 - tz.transition 1932, 4, :o3, 58243211, 24 - tz.transition 1932, 10, :o2, 58247579, 24 - tz.transition 1933, 3, :o3, 58251779, 24 - tz.transition 1933, 10, :o2, 58256483, 24 - tz.transition 1934, 4, :o3, 58260851, 24 - tz.transition 1934, 10, :o2, 58265219, 24 - tz.transition 1935, 3, :o3, 58269419, 24 - tz.transition 1935, 10, :o2, 58273955, 24 - tz.transition 1936, 4, :o3, 58278659, 24 - tz.transition 1936, 10, :o2, 58282691, 24 - tz.transition 1937, 4, :o3, 58287059, 24 - tz.transition 1937, 10, :o2, 58291427, 24 - tz.transition 1938, 3, :o3, 58295627, 24 - tz.transition 1938, 10, :o2, 58300163, 24 - tz.transition 1939, 4, :o3, 58304867, 24 - tz.transition 1939, 11, :o2, 58310075, 24 - tz.transition 1940, 2, :o3, 29156215, 12 - tz.transition 1940, 6, :o4, 29157545, 12 - tz.transition 1942, 11, :o5, 58335973, 24 - tz.transition 1943, 3, :o4, 58339501, 24 - tz.transition 1943, 10, :o5, 58344037, 24 - tz.transition 1944, 4, :o4, 58348405, 24 - tz.transition 1944, 8, :o6, 29175929, 12 - tz.transition 1944, 10, :o3, 58352915, 24 - tz.transition 1945, 4, :o6, 58357141, 24 - tz.transition 1945, 9, :o5, 58361149, 24 - tz.transition 1976, 3, :o4, 196819200 - tz.transition 1976, 9, :o5, 212540400 - tz.transition 1977, 4, :o4, 228877200 - tz.transition 1977, 9, :o5, 243997200 - tz.transition 1978, 4, :o4, 260326800 - tz.transition 1978, 10, :o5, 276051600 - tz.transition 1979, 4, :o4, 291776400 - tz.transition 1979, 9, :o5, 307501200 - tz.transition 1980, 4, :o4, 323830800 - tz.transition 1980, 9, :o5, 338950800 - tz.transition 1981, 3, :o4, 354675600 - tz.transition 1981, 9, :o5, 370400400 - tz.transition 1982, 3, :o4, 386125200 - tz.transition 1982, 9, :o5, 401850000 - tz.transition 1983, 3, :o4, 417574800 - tz.transition 1983, 9, :o5, 433299600 - tz.transition 1984, 3, :o4, 449024400 - tz.transition 1984, 9, :o5, 465354000 - tz.transition 1985, 3, :o4, 481078800 - tz.transition 1985, 9, :o5, 496803600 - tz.transition 1986, 3, :o4, 512528400 - tz.transition 1986, 9, :o5, 528253200 - tz.transition 1987, 3, :o4, 543978000 - tz.transition 1987, 9, :o5, 559702800 - tz.transition 1988, 3, :o4, 575427600 - tz.transition 1988, 9, :o5, 591152400 - tz.transition 1989, 3, :o4, 606877200 - tz.transition 1989, 9, :o5, 622602000 - tz.transition 1990, 3, :o4, 638326800 - tz.transition 1990, 9, :o5, 654656400 - tz.transition 1991, 3, :o4, 670381200 - tz.transition 1991, 9, :o5, 686106000 - tz.transition 1992, 3, :o4, 701830800 - tz.transition 1992, 9, :o5, 717555600 - tz.transition 1993, 3, :o4, 733280400 - tz.transition 1993, 9, :o5, 749005200 - tz.transition 1994, 3, :o4, 764730000 - tz.transition 1994, 9, :o5, 780454800 - tz.transition 1995, 3, :o4, 796179600 - tz.transition 1995, 9, :o5, 811904400 - tz.transition 1996, 3, :o4, 828234000 - tz.transition 1996, 10, :o5, 846378000 - tz.transition 1997, 3, :o4, 859683600 - tz.transition 1997, 10, :o5, 877827600 - tz.transition 1998, 3, :o4, 891133200 - tz.transition 1998, 10, :o5, 909277200 - tz.transition 1999, 3, :o4, 922582800 - tz.transition 1999, 10, :o5, 941331600 - tz.transition 2000, 3, :o4, 954032400 - tz.transition 2000, 10, :o5, 972781200 - tz.transition 2001, 3, :o4, 985482000 - tz.transition 2001, 10, :o5, 1004230800 - tz.transition 2002, 3, :o4, 1017536400 - tz.transition 2002, 10, :o5, 1035680400 - tz.transition 2003, 3, :o4, 1048986000 - tz.transition 2003, 10, :o5, 1067130000 - tz.transition 2004, 3, :o4, 1080435600 - tz.transition 2004, 10, :o5, 1099184400 - tz.transition 2005, 3, :o4, 1111885200 - tz.transition 2005, 10, :o5, 1130634000 - tz.transition 2006, 3, :o4, 1143334800 - tz.transition 2006, 10, :o5, 1162083600 - tz.transition 2007, 3, :o4, 1174784400 - tz.transition 2007, 10, :o5, 1193533200 - tz.transition 2008, 3, :o4, 1206838800 - tz.transition 2008, 10, :o5, 1224982800 - tz.transition 2009, 3, :o4, 1238288400 - tz.transition 2009, 10, :o5, 1256432400 - tz.transition 2010, 3, :o4, 1269738000 - tz.transition 2010, 10, :o5, 1288486800 - tz.transition 2011, 3, :o4, 1301187600 - tz.transition 2011, 10, :o5, 1319936400 - tz.transition 2012, 3, :o4, 1332637200 - tz.transition 2012, 10, :o5, 1351386000 - tz.transition 2013, 3, :o4, 1364691600 - tz.transition 2013, 10, :o5, 1382835600 - tz.transition 2014, 3, :o4, 1396141200 - tz.transition 2014, 10, :o5, 1414285200 - tz.transition 2015, 3, :o4, 1427590800 - tz.transition 2015, 10, :o5, 1445734800 - tz.transition 2016, 3, :o4, 1459040400 - tz.transition 2016, 10, :o5, 1477789200 - tz.transition 2017, 3, :o4, 1490490000 - tz.transition 2017, 10, :o5, 1509238800 - tz.transition 2018, 3, :o4, 1521939600 - tz.transition 2018, 10, :o5, 1540688400 - tz.transition 2019, 3, :o4, 1553994000 - tz.transition 2019, 10, :o5, 1572138000 - tz.transition 2020, 3, :o4, 1585443600 - tz.transition 2020, 10, :o5, 1603587600 - tz.transition 2021, 3, :o4, 1616893200 - tz.transition 2021, 10, :o5, 1635642000 - tz.transition 2022, 3, :o4, 1648342800 - tz.transition 2022, 10, :o5, 1667091600 - tz.transition 2023, 3, :o4, 1679792400 - tz.transition 2023, 10, :o5, 1698541200 - tz.transition 2024, 3, :o4, 1711846800 - tz.transition 2024, 10, :o5, 1729990800 - tz.transition 2025, 3, :o4, 1743296400 - tz.transition 2025, 10, :o5, 1761440400 - tz.transition 2026, 3, :o4, 1774746000 - tz.transition 2026, 10, :o5, 1792890000 - tz.transition 2027, 3, :o4, 1806195600 - tz.transition 2027, 10, :o5, 1824944400 - tz.transition 2028, 3, :o4, 1837645200 - tz.transition 2028, 10, :o5, 1856394000 - tz.transition 2029, 3, :o4, 1869094800 - tz.transition 2029, 10, :o5, 1887843600 - tz.transition 2030, 3, :o4, 1901149200 - tz.transition 2030, 10, :o5, 1919293200 - tz.transition 2031, 3, :o4, 1932598800 - tz.transition 2031, 10, :o5, 1950742800 - tz.transition 2032, 3, :o4, 1964048400 - tz.transition 2032, 10, :o5, 1982797200 - tz.transition 2033, 3, :o4, 1995498000 - tz.transition 2033, 10, :o5, 2014246800 - tz.transition 2034, 3, :o4, 2026947600 - tz.transition 2034, 10, :o5, 2045696400 - tz.transition 2035, 3, :o4, 2058397200 - tz.transition 2035, 10, :o5, 2077146000 - tz.transition 2036, 3, :o4, 2090451600 - tz.transition 2036, 10, :o5, 2108595600 - tz.transition 2037, 3, :o4, 2121901200 - tz.transition 2037, 10, :o5, 2140045200 - tz.transition 2038, 3, :o4, 59172253, 24 - tz.transition 2038, 10, :o5, 59177461, 24 - tz.transition 2039, 3, :o4, 59180989, 24 - tz.transition 2039, 10, :o5, 59186197, 24 - tz.transition 2040, 3, :o4, 59189725, 24 - tz.transition 2040, 10, :o5, 59194933, 24 - tz.transition 2041, 3, :o4, 59198629, 24 - tz.transition 2041, 10, :o5, 59203669, 24 - tz.transition 2042, 3, :o4, 59207365, 24 - tz.transition 2042, 10, :o5, 59212405, 24 - tz.transition 2043, 3, :o4, 59216101, 24 - tz.transition 2043, 10, :o5, 59221141, 24 - tz.transition 2044, 3, :o4, 59224837, 24 - tz.transition 2044, 10, :o5, 59230045, 24 - tz.transition 2045, 3, :o4, 59233573, 24 - tz.transition 2045, 10, :o5, 59238781, 24 - tz.transition 2046, 3, :o4, 59242309, 24 - tz.transition 2046, 10, :o5, 59247517, 24 - tz.transition 2047, 3, :o4, 59251213, 24 - tz.transition 2047, 10, :o5, 59256253, 24 - tz.transition 2048, 3, :o4, 59259949, 24 - tz.transition 2048, 10, :o5, 59264989, 24 - tz.transition 2049, 3, :o4, 59268685, 24 - tz.transition 2049, 10, :o5, 59273893, 24 - tz.transition 2050, 3, :o4, 59277421, 24 - tz.transition 2050, 10, :o5, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb deleted file mode 100644 index bcabee96c1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Prague - include TimezoneDefinition - - timezone 'Europe/Prague' do |tz| - tz.offset :o0, 3464, 0, :LMT - tz.offset :o1, 3464, 0, :PMT - tz.offset :o2, 3600, 0, :CET - tz.offset :o3, 3600, 3600, :CEST - - tz.transition 1849, 12, :o1, 25884991367, 10800 - tz.transition 1891, 9, :o2, 26049669767, 10800 - tz.transition 1916, 4, :o3, 29051813, 12 - tz.transition 1916, 9, :o2, 58107299, 24 - tz.transition 1917, 4, :o3, 58112029, 24 - tz.transition 1917, 9, :o2, 58115725, 24 - tz.transition 1918, 4, :o3, 58120765, 24 - tz.transition 1918, 9, :o2, 58124461, 24 - tz.transition 1940, 4, :o3, 58313293, 24 - tz.transition 1942, 11, :o2, 58335973, 24 - tz.transition 1943, 3, :o3, 58339501, 24 - tz.transition 1943, 10, :o2, 58344037, 24 - tz.transition 1944, 4, :o3, 58348405, 24 - tz.transition 1944, 9, :o2, 58352413, 24 - tz.transition 1945, 4, :o3, 58357285, 24 - tz.transition 1945, 11, :o2, 58362661, 24 - tz.transition 1946, 5, :o3, 58366717, 24 - tz.transition 1946, 10, :o2, 58370389, 24 - tz.transition 1947, 4, :o3, 58375093, 24 - tz.transition 1947, 10, :o2, 58379125, 24 - tz.transition 1948, 4, :o3, 58383829, 24 - tz.transition 1948, 10, :o2, 58387861, 24 - tz.transition 1949, 4, :o3, 58392373, 24 - tz.transition 1949, 10, :o2, 58396597, 24 - tz.transition 1979, 4, :o3, 291776400 - tz.transition 1979, 9, :o2, 307501200 - tz.transition 1980, 4, :o3, 323830800 - tz.transition 1980, 9, :o2, 338950800 - tz.transition 1981, 3, :o3, 354675600 - tz.transition 1981, 9, :o2, 370400400 - tz.transition 1982, 3, :o3, 386125200 - tz.transition 1982, 9, :o2, 401850000 - tz.transition 1983, 3, :o3, 417574800 - tz.transition 1983, 9, :o2, 433299600 - tz.transition 1984, 3, :o3, 449024400 - tz.transition 1984, 9, :o2, 465354000 - tz.transition 1985, 3, :o3, 481078800 - tz.transition 1985, 9, :o2, 496803600 - tz.transition 1986, 3, :o3, 512528400 - tz.transition 1986, 9, :o2, 528253200 - tz.transition 1987, 3, :o3, 543978000 - tz.transition 1987, 9, :o2, 559702800 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb deleted file mode 100644 index 784837f758..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb +++ /dev/null @@ -1,176 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Riga - include TimezoneDefinition - - timezone 'Europe/Riga' do |tz| - tz.offset :o0, 5784, 0, :LMT - tz.offset :o1, 5784, 0, :RMT - tz.offset :o2, 5784, 3600, :LST - tz.offset :o3, 7200, 0, :EET - tz.offset :o4, 10800, 0, :MSK - tz.offset :o5, 3600, 3600, :CEST - tz.offset :o6, 3600, 0, :CET - tz.offset :o7, 10800, 3600, :MSD - tz.offset :o8, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 8667775559, 3600 - tz.transition 1918, 4, :o2, 8718114659, 3600 - tz.transition 1918, 9, :o1, 8718669059, 3600 - tz.transition 1919, 4, :o2, 8719378259, 3600 - tz.transition 1919, 5, :o1, 8719561859, 3600 - tz.transition 1926, 5, :o3, 8728727159, 3600 - tz.transition 1940, 8, :o4, 29158157, 12 - tz.transition 1941, 6, :o5, 19441411, 8 - tz.transition 1942, 11, :o6, 58335973, 24 - tz.transition 1943, 3, :o5, 58339501, 24 - tz.transition 1943, 10, :o6, 58344037, 24 - tz.transition 1944, 4, :o5, 58348405, 24 - tz.transition 1944, 10, :o6, 58352773, 24 - tz.transition 1944, 10, :o4, 58353035, 24 - tz.transition 1981, 3, :o7, 354920400 - tz.transition 1981, 9, :o4, 370728000 - tz.transition 1982, 3, :o7, 386456400 - tz.transition 1982, 9, :o4, 402264000 - tz.transition 1983, 3, :o7, 417992400 - tz.transition 1983, 9, :o4, 433800000 - tz.transition 1984, 3, :o7, 449614800 - tz.transition 1984, 9, :o4, 465346800 - tz.transition 1985, 3, :o7, 481071600 - tz.transition 1985, 9, :o4, 496796400 - tz.transition 1986, 3, :o7, 512521200 - tz.transition 1986, 9, :o4, 528246000 - tz.transition 1987, 3, :o7, 543970800 - tz.transition 1987, 9, :o4, 559695600 - tz.transition 1988, 3, :o7, 575420400 - tz.transition 1988, 9, :o4, 591145200 - tz.transition 1989, 3, :o8, 606870000 - tz.transition 1989, 9, :o3, 622598400 - tz.transition 1990, 3, :o8, 638323200 - tz.transition 1990, 9, :o3, 654652800 - tz.transition 1991, 3, :o8, 670377600 - tz.transition 1991, 9, :o3, 686102400 - tz.transition 1992, 3, :o8, 701827200 - tz.transition 1992, 9, :o3, 717552000 - tz.transition 1993, 3, :o8, 733276800 - tz.transition 1993, 9, :o3, 749001600 - tz.transition 1994, 3, :o8, 764726400 - tz.transition 1994, 9, :o3, 780451200 - tz.transition 1995, 3, :o8, 796176000 - tz.transition 1995, 9, :o3, 811900800 - tz.transition 1996, 3, :o8, 828230400 - tz.transition 1996, 9, :o3, 843955200 - tz.transition 1997, 3, :o8, 859683600 - tz.transition 1997, 10, :o3, 877827600 - tz.transition 1998, 3, :o8, 891133200 - tz.transition 1998, 10, :o3, 909277200 - tz.transition 1999, 3, :o8, 922582800 - tz.transition 1999, 10, :o3, 941331600 - tz.transition 2001, 3, :o8, 985482000 - tz.transition 2001, 10, :o3, 1004230800 - tz.transition 2002, 3, :o8, 1017536400 - tz.transition 2002, 10, :o3, 1035680400 - tz.transition 2003, 3, :o8, 1048986000 - tz.transition 2003, 10, :o3, 1067130000 - tz.transition 2004, 3, :o8, 1080435600 - tz.transition 2004, 10, :o3, 1099184400 - tz.transition 2005, 3, :o8, 1111885200 - tz.transition 2005, 10, :o3, 1130634000 - tz.transition 2006, 3, :o8, 1143334800 - tz.transition 2006, 10, :o3, 1162083600 - tz.transition 2007, 3, :o8, 1174784400 - tz.transition 2007, 10, :o3, 1193533200 - tz.transition 2008, 3, :o8, 1206838800 - tz.transition 2008, 10, :o3, 1224982800 - tz.transition 2009, 3, :o8, 1238288400 - tz.transition 2009, 10, :o3, 1256432400 - tz.transition 2010, 3, :o8, 1269738000 - tz.transition 2010, 10, :o3, 1288486800 - tz.transition 2011, 3, :o8, 1301187600 - tz.transition 2011, 10, :o3, 1319936400 - tz.transition 2012, 3, :o8, 1332637200 - tz.transition 2012, 10, :o3, 1351386000 - tz.transition 2013, 3, :o8, 1364691600 - tz.transition 2013, 10, :o3, 1382835600 - tz.transition 2014, 3, :o8, 1396141200 - tz.transition 2014, 10, :o3, 1414285200 - tz.transition 2015, 3, :o8, 1427590800 - tz.transition 2015, 10, :o3, 1445734800 - tz.transition 2016, 3, :o8, 1459040400 - tz.transition 2016, 10, :o3, 1477789200 - tz.transition 2017, 3, :o8, 1490490000 - tz.transition 2017, 10, :o3, 1509238800 - tz.transition 2018, 3, :o8, 1521939600 - tz.transition 2018, 10, :o3, 1540688400 - tz.transition 2019, 3, :o8, 1553994000 - tz.transition 2019, 10, :o3, 1572138000 - tz.transition 2020, 3, :o8, 1585443600 - tz.transition 2020, 10, :o3, 1603587600 - tz.transition 2021, 3, :o8, 1616893200 - tz.transition 2021, 10, :o3, 1635642000 - tz.transition 2022, 3, :o8, 1648342800 - tz.transition 2022, 10, :o3, 1667091600 - tz.transition 2023, 3, :o8, 1679792400 - tz.transition 2023, 10, :o3, 1698541200 - tz.transition 2024, 3, :o8, 1711846800 - tz.transition 2024, 10, :o3, 1729990800 - tz.transition 2025, 3, :o8, 1743296400 - tz.transition 2025, 10, :o3, 1761440400 - tz.transition 2026, 3, :o8, 1774746000 - tz.transition 2026, 10, :o3, 1792890000 - tz.transition 2027, 3, :o8, 1806195600 - tz.transition 2027, 10, :o3, 1824944400 - tz.transition 2028, 3, :o8, 1837645200 - tz.transition 2028, 10, :o3, 1856394000 - tz.transition 2029, 3, :o8, 1869094800 - tz.transition 2029, 10, :o3, 1887843600 - tz.transition 2030, 3, :o8, 1901149200 - tz.transition 2030, 10, :o3, 1919293200 - tz.transition 2031, 3, :o8, 1932598800 - tz.transition 2031, 10, :o3, 1950742800 - tz.transition 2032, 3, :o8, 1964048400 - tz.transition 2032, 10, :o3, 1982797200 - tz.transition 2033, 3, :o8, 1995498000 - tz.transition 2033, 10, :o3, 2014246800 - tz.transition 2034, 3, :o8, 2026947600 - tz.transition 2034, 10, :o3, 2045696400 - tz.transition 2035, 3, :o8, 2058397200 - tz.transition 2035, 10, :o3, 2077146000 - tz.transition 2036, 3, :o8, 2090451600 - tz.transition 2036, 10, :o3, 2108595600 - tz.transition 2037, 3, :o8, 2121901200 - tz.transition 2037, 10, :o3, 2140045200 - tz.transition 2038, 3, :o8, 59172253, 24 - tz.transition 2038, 10, :o3, 59177461, 24 - tz.transition 2039, 3, :o8, 59180989, 24 - tz.transition 2039, 10, :o3, 59186197, 24 - tz.transition 2040, 3, :o8, 59189725, 24 - tz.transition 2040, 10, :o3, 59194933, 24 - tz.transition 2041, 3, :o8, 59198629, 24 - tz.transition 2041, 10, :o3, 59203669, 24 - tz.transition 2042, 3, :o8, 59207365, 24 - tz.transition 2042, 10, :o3, 59212405, 24 - tz.transition 2043, 3, :o8, 59216101, 24 - tz.transition 2043, 10, :o3, 59221141, 24 - tz.transition 2044, 3, :o8, 59224837, 24 - tz.transition 2044, 10, :o3, 59230045, 24 - tz.transition 2045, 3, :o8, 59233573, 24 - tz.transition 2045, 10, :o3, 59238781, 24 - tz.transition 2046, 3, :o8, 59242309, 24 - tz.transition 2046, 10, :o3, 59247517, 24 - tz.transition 2047, 3, :o8, 59251213, 24 - tz.transition 2047, 10, :o3, 59256253, 24 - tz.transition 2048, 3, :o8, 59259949, 24 - tz.transition 2048, 10, :o3, 59264989, 24 - tz.transition 2049, 3, :o8, 59268685, 24 - tz.transition 2049, 10, :o3, 59273893, 24 - tz.transition 2050, 3, :o8, 59277421, 24 - tz.transition 2050, 10, :o3, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb deleted file mode 100644 index aa7b43d9d2..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb +++ /dev/null @@ -1,215 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Rome - include TimezoneDefinition - - timezone 'Europe/Rome' do |tz| - tz.offset :o0, 2996, 0, :LMT - tz.offset :o1, 2996, 0, :RMT - tz.offset :o2, 3600, 0, :CET - tz.offset :o3, 3600, 3600, :CEST - - tz.transition 1866, 9, :o1, 51901915651, 21600 - tz.transition 1893, 10, :o2, 52115798851, 21600 - tz.transition 1916, 6, :o3, 58104419, 24 - tz.transition 1916, 9, :o2, 58107299, 24 - tz.transition 1917, 3, :o3, 58111667, 24 - tz.transition 1917, 9, :o2, 58116035, 24 - tz.transition 1918, 3, :o3, 58119899, 24 - tz.transition 1918, 10, :o2, 58124939, 24 - tz.transition 1919, 3, :o3, 58128467, 24 - tz.transition 1919, 10, :o2, 58133675, 24 - tz.transition 1920, 3, :o3, 58137707, 24 - tz.transition 1920, 9, :o2, 58142075, 24 - tz.transition 1940, 6, :o3, 58315091, 24 - tz.transition 1942, 11, :o2, 58335973, 24 - tz.transition 1943, 3, :o3, 58339501, 24 - tz.transition 1943, 10, :o2, 58344037, 24 - tz.transition 1944, 4, :o3, 58348405, 24 - tz.transition 1944, 9, :o2, 58352411, 24 - tz.transition 1945, 4, :o3, 58357141, 24 - tz.transition 1945, 9, :o2, 58361123, 24 - tz.transition 1946, 3, :o3, 58365517, 24 - tz.transition 1946, 10, :o2, 58370389, 24 - tz.transition 1947, 3, :o3, 58374251, 24 - tz.transition 1947, 10, :o2, 58379123, 24 - tz.transition 1948, 2, :o3, 58382653, 24 - tz.transition 1948, 10, :o2, 58387861, 24 - tz.transition 1966, 5, :o3, 58542419, 24 - tz.transition 1966, 9, :o2, 29272721, 12 - tz.transition 1967, 5, :o3, 58551323, 24 - tz.transition 1967, 9, :o2, 29277089, 12 - tz.transition 1968, 5, :o3, 58560059, 24 - tz.transition 1968, 9, :o2, 29281457, 12 - tz.transition 1969, 5, :o3, 58568963, 24 - tz.transition 1969, 9, :o2, 29285909, 12 - tz.transition 1970, 5, :o3, 12956400 - tz.transition 1970, 9, :o2, 23234400 - tz.transition 1971, 5, :o3, 43801200 - tz.transition 1971, 9, :o2, 54687600 - tz.transition 1972, 5, :o3, 75855600 - tz.transition 1972, 9, :o2, 86738400 - tz.transition 1973, 6, :o3, 107910000 - tz.transition 1973, 9, :o2, 118188000 - tz.transition 1974, 5, :o3, 138754800 - tz.transition 1974, 9, :o2, 149637600 - tz.transition 1975, 5, :o3, 170809200 - tz.transition 1975, 9, :o2, 181090800 - tz.transition 1976, 5, :o3, 202258800 - tz.transition 1976, 9, :o2, 212540400 - tz.transition 1977, 5, :o3, 233103600 - tz.transition 1977, 9, :o2, 243990000 - tz.transition 1978, 5, :o3, 265158000 - tz.transition 1978, 9, :o2, 276044400 - tz.transition 1979, 5, :o3, 296607600 - tz.transition 1979, 9, :o2, 307494000 - tz.transition 1980, 4, :o3, 323830800 - tz.transition 1980, 9, :o2, 338950800 - tz.transition 1981, 3, :o3, 354675600 - tz.transition 1981, 9, :o2, 370400400 - tz.transition 1982, 3, :o3, 386125200 - tz.transition 1982, 9, :o2, 401850000 - tz.transition 1983, 3, :o3, 417574800 - tz.transition 1983, 9, :o2, 433299600 - tz.transition 1984, 3, :o3, 449024400 - tz.transition 1984, 9, :o2, 465354000 - tz.transition 1985, 3, :o3, 481078800 - tz.transition 1985, 9, :o2, 496803600 - tz.transition 1986, 3, :o3, 512528400 - tz.transition 1986, 9, :o2, 528253200 - tz.transition 1987, 3, :o3, 543978000 - tz.transition 1987, 9, :o2, 559702800 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb deleted file mode 100644 index 068c5fe6ad..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Sarajevo - include TimezoneDefinition - - linked_timezone 'Europe/Sarajevo', 'Europe/Belgrade' - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb deleted file mode 100644 index 10b71f285e..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Skopje - include TimezoneDefinition - - linked_timezone 'Europe/Skopje', 'Europe/Belgrade' - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb deleted file mode 100644 index 38a70eceb9..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb +++ /dev/null @@ -1,173 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Sofia - include TimezoneDefinition - - timezone 'Europe/Sofia' do |tz| - tz.offset :o0, 5596, 0, :LMT - tz.offset :o1, 7016, 0, :IMT - tz.offset :o2, 7200, 0, :EET - tz.offset :o3, 3600, 0, :CET - tz.offset :o4, 3600, 3600, :CEST - tz.offset :o5, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 52006653401, 21600 - tz.transition 1894, 11, :o2, 26062154123, 10800 - tz.transition 1942, 11, :o3, 58335973, 24 - tz.transition 1943, 3, :o4, 58339501, 24 - tz.transition 1943, 10, :o3, 58344037, 24 - tz.transition 1944, 4, :o4, 58348405, 24 - tz.transition 1944, 10, :o3, 58352773, 24 - tz.transition 1945, 4, :o2, 29178571, 12 - tz.transition 1979, 3, :o5, 291762000 - tz.transition 1979, 9, :o2, 307576800 - tz.transition 1980, 4, :o5, 323816400 - tz.transition 1980, 9, :o2, 339026400 - tz.transition 1981, 4, :o5, 355266000 - tz.transition 1981, 9, :o2, 370393200 - tz.transition 1982, 4, :o5, 386715600 - tz.transition 1982, 9, :o2, 401846400 - tz.transition 1983, 3, :o5, 417571200 - tz.transition 1983, 9, :o2, 433296000 - tz.transition 1984, 3, :o5, 449020800 - tz.transition 1984, 9, :o2, 465350400 - tz.transition 1985, 3, :o5, 481075200 - tz.transition 1985, 9, :o2, 496800000 - tz.transition 1986, 3, :o5, 512524800 - tz.transition 1986, 9, :o2, 528249600 - tz.transition 1987, 3, :o5, 543974400 - tz.transition 1987, 9, :o2, 559699200 - tz.transition 1988, 3, :o5, 575424000 - tz.transition 1988, 9, :o2, 591148800 - tz.transition 1989, 3, :o5, 606873600 - tz.transition 1989, 9, :o2, 622598400 - tz.transition 1990, 3, :o5, 638323200 - tz.transition 1990, 9, :o2, 654652800 - tz.transition 1991, 3, :o5, 670370400 - tz.transition 1991, 9, :o2, 686091600 - tz.transition 1992, 3, :o5, 701820000 - tz.transition 1992, 9, :o2, 717541200 - tz.transition 1993, 3, :o5, 733269600 - tz.transition 1993, 9, :o2, 748990800 - tz.transition 1994, 3, :o5, 764719200 - tz.transition 1994, 9, :o2, 780440400 - tz.transition 1995, 3, :o5, 796168800 - tz.transition 1995, 9, :o2, 811890000 - tz.transition 1996, 3, :o5, 828223200 - tz.transition 1996, 10, :o2, 846363600 - tz.transition 1997, 3, :o5, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o5, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o5, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o5, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o5, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o5, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o5, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o5, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o5, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o5, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o5, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o5, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o5, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o5, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o5, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o5, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o5, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o5, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o5, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o5, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o5, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o5, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o5, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o5, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o5, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o5, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o5, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o5, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o5, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o5, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o5, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o5, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o5, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o5, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o5, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o5, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o5, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o5, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o5, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o5, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o5, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o5, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o5, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o5, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o5, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o5, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o5, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o5, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o5, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o5, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o5, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o5, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o5, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o5, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb deleted file mode 100644 index 43db70fa61..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Stockholm - include TimezoneDefinition - - timezone 'Europe/Stockholm' do |tz| - tz.offset :o0, 4332, 0, :LMT - tz.offset :o1, 3614, 0, :SET - tz.offset :o2, 3600, 0, :CET - tz.offset :o3, 3600, 3600, :CEST - - tz.transition 1878, 12, :o1, 17332923239, 7200 - tz.transition 1899, 12, :o2, 104328883793, 43200 - tz.transition 1916, 5, :o3, 29051981, 12 - tz.transition 1916, 9, :o2, 58107299, 24 - tz.transition 1980, 4, :o3, 323830800 - tz.transition 1980, 9, :o2, 338950800 - tz.transition 1981, 3, :o3, 354675600 - tz.transition 1981, 9, :o2, 370400400 - tz.transition 1982, 3, :o3, 386125200 - tz.transition 1982, 9, :o2, 401850000 - tz.transition 1983, 3, :o3, 417574800 - tz.transition 1983, 9, :o2, 433299600 - tz.transition 1984, 3, :o3, 449024400 - tz.transition 1984, 9, :o2, 465354000 - tz.transition 1985, 3, :o3, 481078800 - tz.transition 1985, 9, :o2, 496803600 - tz.transition 1986, 3, :o3, 512528400 - tz.transition 1986, 9, :o2, 528253200 - tz.transition 1987, 3, :o3, 543978000 - tz.transition 1987, 9, :o2, 559702800 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb deleted file mode 100644 index de5a8569f3..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb +++ /dev/null @@ -1,172 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Tallinn - include TimezoneDefinition - - timezone 'Europe/Tallinn' do |tz| - tz.offset :o0, 5940, 0, :LMT - tz.offset :o1, 5940, 0, :TMT - tz.offset :o2, 3600, 0, :CET - tz.offset :o3, 3600, 3600, :CEST - tz.offset :o4, 7200, 0, :EET - tz.offset :o5, 10800, 0, :MSK - tz.offset :o6, 10800, 3600, :MSD - tz.offset :o7, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 385234469, 160 - tz.transition 1918, 1, :o2, 387460069, 160 - tz.transition 1918, 4, :o3, 58120765, 24 - tz.transition 1918, 9, :o2, 58124461, 24 - tz.transition 1919, 6, :o1, 58131371, 24 - tz.transition 1921, 4, :o4, 387649669, 160 - tz.transition 1940, 8, :o5, 29158169, 12 - tz.transition 1941, 9, :o3, 19442019, 8 - tz.transition 1942, 11, :o2, 58335973, 24 - tz.transition 1943, 3, :o3, 58339501, 24 - tz.transition 1943, 10, :o2, 58344037, 24 - tz.transition 1944, 4, :o3, 58348405, 24 - tz.transition 1944, 9, :o5, 29176265, 12 - tz.transition 1981, 3, :o6, 354920400 - tz.transition 1981, 9, :o5, 370728000 - tz.transition 1982, 3, :o6, 386456400 - tz.transition 1982, 9, :o5, 402264000 - tz.transition 1983, 3, :o6, 417992400 - tz.transition 1983, 9, :o5, 433800000 - tz.transition 1984, 3, :o6, 449614800 - tz.transition 1984, 9, :o5, 465346800 - tz.transition 1985, 3, :o6, 481071600 - tz.transition 1985, 9, :o5, 496796400 - tz.transition 1986, 3, :o6, 512521200 - tz.transition 1986, 9, :o5, 528246000 - tz.transition 1987, 3, :o6, 543970800 - tz.transition 1987, 9, :o5, 559695600 - tz.transition 1988, 3, :o6, 575420400 - tz.transition 1988, 9, :o5, 591145200 - tz.transition 1989, 3, :o7, 606870000 - tz.transition 1989, 9, :o4, 622598400 - tz.transition 1990, 3, :o7, 638323200 - tz.transition 1990, 9, :o4, 654652800 - tz.transition 1991, 3, :o7, 670377600 - tz.transition 1991, 9, :o4, 686102400 - tz.transition 1992, 3, :o7, 701827200 - tz.transition 1992, 9, :o4, 717552000 - tz.transition 1993, 3, :o7, 733276800 - tz.transition 1993, 9, :o4, 749001600 - tz.transition 1994, 3, :o7, 764726400 - tz.transition 1994, 9, :o4, 780451200 - tz.transition 1995, 3, :o7, 796176000 - tz.transition 1995, 9, :o4, 811900800 - tz.transition 1996, 3, :o7, 828230400 - tz.transition 1996, 10, :o4, 846374400 - tz.transition 1997, 3, :o7, 859680000 - tz.transition 1997, 10, :o4, 877824000 - tz.transition 1998, 3, :o7, 891129600 - tz.transition 1998, 10, :o4, 909277200 - tz.transition 1999, 3, :o7, 922582800 - tz.transition 1999, 10, :o4, 941331600 - tz.transition 2002, 3, :o7, 1017536400 - tz.transition 2002, 10, :o4, 1035680400 - tz.transition 2003, 3, :o7, 1048986000 - tz.transition 2003, 10, :o4, 1067130000 - tz.transition 2004, 3, :o7, 1080435600 - tz.transition 2004, 10, :o4, 1099184400 - tz.transition 2005, 3, :o7, 1111885200 - tz.transition 2005, 10, :o4, 1130634000 - tz.transition 2006, 3, :o7, 1143334800 - tz.transition 2006, 10, :o4, 1162083600 - tz.transition 2007, 3, :o7, 1174784400 - tz.transition 2007, 10, :o4, 1193533200 - tz.transition 2008, 3, :o7, 1206838800 - tz.transition 2008, 10, :o4, 1224982800 - tz.transition 2009, 3, :o7, 1238288400 - tz.transition 2009, 10, :o4, 1256432400 - tz.transition 2010, 3, :o7, 1269738000 - tz.transition 2010, 10, :o4, 1288486800 - tz.transition 2011, 3, :o7, 1301187600 - tz.transition 2011, 10, :o4, 1319936400 - tz.transition 2012, 3, :o7, 1332637200 - tz.transition 2012, 10, :o4, 1351386000 - tz.transition 2013, 3, :o7, 1364691600 - tz.transition 2013, 10, :o4, 1382835600 - tz.transition 2014, 3, :o7, 1396141200 - tz.transition 2014, 10, :o4, 1414285200 - tz.transition 2015, 3, :o7, 1427590800 - tz.transition 2015, 10, :o4, 1445734800 - tz.transition 2016, 3, :o7, 1459040400 - tz.transition 2016, 10, :o4, 1477789200 - tz.transition 2017, 3, :o7, 1490490000 - tz.transition 2017, 10, :o4, 1509238800 - tz.transition 2018, 3, :o7, 1521939600 - tz.transition 2018, 10, :o4, 1540688400 - tz.transition 2019, 3, :o7, 1553994000 - tz.transition 2019, 10, :o4, 1572138000 - tz.transition 2020, 3, :o7, 1585443600 - tz.transition 2020, 10, :o4, 1603587600 - tz.transition 2021, 3, :o7, 1616893200 - tz.transition 2021, 10, :o4, 1635642000 - tz.transition 2022, 3, :o7, 1648342800 - tz.transition 2022, 10, :o4, 1667091600 - tz.transition 2023, 3, :o7, 1679792400 - tz.transition 2023, 10, :o4, 1698541200 - tz.transition 2024, 3, :o7, 1711846800 - tz.transition 2024, 10, :o4, 1729990800 - tz.transition 2025, 3, :o7, 1743296400 - tz.transition 2025, 10, :o4, 1761440400 - tz.transition 2026, 3, :o7, 1774746000 - tz.transition 2026, 10, :o4, 1792890000 - tz.transition 2027, 3, :o7, 1806195600 - tz.transition 2027, 10, :o4, 1824944400 - tz.transition 2028, 3, :o7, 1837645200 - tz.transition 2028, 10, :o4, 1856394000 - tz.transition 2029, 3, :o7, 1869094800 - tz.transition 2029, 10, :o4, 1887843600 - tz.transition 2030, 3, :o7, 1901149200 - tz.transition 2030, 10, :o4, 1919293200 - tz.transition 2031, 3, :o7, 1932598800 - tz.transition 2031, 10, :o4, 1950742800 - tz.transition 2032, 3, :o7, 1964048400 - tz.transition 2032, 10, :o4, 1982797200 - tz.transition 2033, 3, :o7, 1995498000 - tz.transition 2033, 10, :o4, 2014246800 - tz.transition 2034, 3, :o7, 2026947600 - tz.transition 2034, 10, :o4, 2045696400 - tz.transition 2035, 3, :o7, 2058397200 - tz.transition 2035, 10, :o4, 2077146000 - tz.transition 2036, 3, :o7, 2090451600 - tz.transition 2036, 10, :o4, 2108595600 - tz.transition 2037, 3, :o7, 2121901200 - tz.transition 2037, 10, :o4, 2140045200 - tz.transition 2038, 3, :o7, 59172253, 24 - tz.transition 2038, 10, :o4, 59177461, 24 - tz.transition 2039, 3, :o7, 59180989, 24 - tz.transition 2039, 10, :o4, 59186197, 24 - tz.transition 2040, 3, :o7, 59189725, 24 - tz.transition 2040, 10, :o4, 59194933, 24 - tz.transition 2041, 3, :o7, 59198629, 24 - tz.transition 2041, 10, :o4, 59203669, 24 - tz.transition 2042, 3, :o7, 59207365, 24 - tz.transition 2042, 10, :o4, 59212405, 24 - tz.transition 2043, 3, :o7, 59216101, 24 - tz.transition 2043, 10, :o4, 59221141, 24 - tz.transition 2044, 3, :o7, 59224837, 24 - tz.transition 2044, 10, :o4, 59230045, 24 - tz.transition 2045, 3, :o7, 59233573, 24 - tz.transition 2045, 10, :o4, 59238781, 24 - tz.transition 2046, 3, :o7, 59242309, 24 - tz.transition 2046, 10, :o4, 59247517, 24 - tz.transition 2047, 3, :o7, 59251213, 24 - tz.transition 2047, 10, :o4, 59256253, 24 - tz.transition 2048, 3, :o7, 59259949, 24 - tz.transition 2048, 10, :o4, 59264989, 24 - tz.transition 2049, 3, :o7, 59268685, 24 - tz.transition 2049, 10, :o4, 59273893, 24 - tz.transition 2050, 3, :o7, 59277421, 24 - tz.transition 2050, 10, :o4, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb deleted file mode 100644 index 990aabab66..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Vienna - include TimezoneDefinition - - timezone 'Europe/Vienna' do |tz| - tz.offset :o0, 3920, 0, :LMT - tz.offset :o1, 3600, 0, :CET - tz.offset :o2, 3600, 3600, :CEST - - tz.transition 1893, 3, :o1, 2605558811, 1080 - tz.transition 1916, 4, :o2, 29051813, 12 - tz.transition 1916, 9, :o1, 58107299, 24 - tz.transition 1917, 4, :o2, 58112029, 24 - tz.transition 1917, 9, :o1, 58115725, 24 - tz.transition 1918, 4, :o2, 58120765, 24 - tz.transition 1918, 9, :o1, 58124461, 24 - tz.transition 1920, 4, :o2, 58138069, 24 - tz.transition 1920, 9, :o1, 58141933, 24 - tz.transition 1940, 4, :o2, 58313293, 24 - tz.transition 1942, 11, :o1, 58335973, 24 - tz.transition 1943, 3, :o2, 58339501, 24 - tz.transition 1943, 10, :o1, 58344037, 24 - tz.transition 1944, 4, :o2, 58348405, 24 - tz.transition 1944, 10, :o1, 58352773, 24 - tz.transition 1945, 4, :o2, 58357141, 24 - tz.transition 1945, 4, :o1, 58357381, 24 - tz.transition 1946, 4, :o2, 58366189, 24 - tz.transition 1946, 10, :o1, 58370389, 24 - tz.transition 1947, 4, :o2, 58374757, 24 - tz.transition 1947, 10, :o1, 58379125, 24 - tz.transition 1948, 4, :o2, 58383829, 24 - tz.transition 1948, 10, :o1, 58387861, 24 - tz.transition 1980, 4, :o2, 323823600 - tz.transition 1980, 9, :o1, 338940000 - tz.transition 1981, 3, :o2, 354675600 - tz.transition 1981, 9, :o1, 370400400 - tz.transition 1982, 3, :o2, 386125200 - tz.transition 1982, 9, :o1, 401850000 - tz.transition 1983, 3, :o2, 417574800 - tz.transition 1983, 9, :o1, 433299600 - tz.transition 1984, 3, :o2, 449024400 - tz.transition 1984, 9, :o1, 465354000 - tz.transition 1985, 3, :o2, 481078800 - tz.transition 1985, 9, :o1, 496803600 - tz.transition 1986, 3, :o2, 512528400 - tz.transition 1986, 9, :o1, 528253200 - tz.transition 1987, 3, :o2, 543978000 - tz.transition 1987, 9, :o1, 559702800 - tz.transition 1988, 3, :o2, 575427600 - tz.transition 1988, 9, :o1, 591152400 - tz.transition 1989, 3, :o2, 606877200 - tz.transition 1989, 9, :o1, 622602000 - tz.transition 1990, 3, :o2, 638326800 - tz.transition 1990, 9, :o1, 654656400 - tz.transition 1991, 3, :o2, 670381200 - tz.transition 1991, 9, :o1, 686106000 - tz.transition 1992, 3, :o2, 701830800 - tz.transition 1992, 9, :o1, 717555600 - tz.transition 1993, 3, :o2, 733280400 - tz.transition 1993, 9, :o1, 749005200 - tz.transition 1994, 3, :o2, 764730000 - tz.transition 1994, 9, :o1, 780454800 - tz.transition 1995, 3, :o2, 796179600 - tz.transition 1995, 9, :o1, 811904400 - tz.transition 1996, 3, :o2, 828234000 - tz.transition 1996, 10, :o1, 846378000 - tz.transition 1997, 3, :o2, 859683600 - tz.transition 1997, 10, :o1, 877827600 - tz.transition 1998, 3, :o2, 891133200 - tz.transition 1998, 10, :o1, 909277200 - tz.transition 1999, 3, :o2, 922582800 - tz.transition 1999, 10, :o1, 941331600 - tz.transition 2000, 3, :o2, 954032400 - tz.transition 2000, 10, :o1, 972781200 - tz.transition 2001, 3, :o2, 985482000 - tz.transition 2001, 10, :o1, 1004230800 - tz.transition 2002, 3, :o2, 1017536400 - tz.transition 2002, 10, :o1, 1035680400 - tz.transition 2003, 3, :o2, 1048986000 - tz.transition 2003, 10, :o1, 1067130000 - tz.transition 2004, 3, :o2, 1080435600 - tz.transition 2004, 10, :o1, 1099184400 - tz.transition 2005, 3, :o2, 1111885200 - tz.transition 2005, 10, :o1, 1130634000 - tz.transition 2006, 3, :o2, 1143334800 - tz.transition 2006, 10, :o1, 1162083600 - tz.transition 2007, 3, :o2, 1174784400 - tz.transition 2007, 10, :o1, 1193533200 - tz.transition 2008, 3, :o2, 1206838800 - tz.transition 2008, 10, :o1, 1224982800 - tz.transition 2009, 3, :o2, 1238288400 - tz.transition 2009, 10, :o1, 1256432400 - tz.transition 2010, 3, :o2, 1269738000 - tz.transition 2010, 10, :o1, 1288486800 - tz.transition 2011, 3, :o2, 1301187600 - tz.transition 2011, 10, :o1, 1319936400 - tz.transition 2012, 3, :o2, 1332637200 - tz.transition 2012, 10, :o1, 1351386000 - tz.transition 2013, 3, :o2, 1364691600 - tz.transition 2013, 10, :o1, 1382835600 - tz.transition 2014, 3, :o2, 1396141200 - tz.transition 2014, 10, :o1, 1414285200 - tz.transition 2015, 3, :o2, 1427590800 - tz.transition 2015, 10, :o1, 1445734800 - tz.transition 2016, 3, :o2, 1459040400 - tz.transition 2016, 10, :o1, 1477789200 - tz.transition 2017, 3, :o2, 1490490000 - tz.transition 2017, 10, :o1, 1509238800 - tz.transition 2018, 3, :o2, 1521939600 - tz.transition 2018, 10, :o1, 1540688400 - tz.transition 2019, 3, :o2, 1553994000 - tz.transition 2019, 10, :o1, 1572138000 - tz.transition 2020, 3, :o2, 1585443600 - tz.transition 2020, 10, :o1, 1603587600 - tz.transition 2021, 3, :o2, 1616893200 - tz.transition 2021, 10, :o1, 1635642000 - tz.transition 2022, 3, :o2, 1648342800 - tz.transition 2022, 10, :o1, 1667091600 - tz.transition 2023, 3, :o2, 1679792400 - tz.transition 2023, 10, :o1, 1698541200 - tz.transition 2024, 3, :o2, 1711846800 - tz.transition 2024, 10, :o1, 1729990800 - tz.transition 2025, 3, :o2, 1743296400 - tz.transition 2025, 10, :o1, 1761440400 - tz.transition 2026, 3, :o2, 1774746000 - tz.transition 2026, 10, :o1, 1792890000 - tz.transition 2027, 3, :o2, 1806195600 - tz.transition 2027, 10, :o1, 1824944400 - tz.transition 2028, 3, :o2, 1837645200 - tz.transition 2028, 10, :o1, 1856394000 - tz.transition 2029, 3, :o2, 1869094800 - tz.transition 2029, 10, :o1, 1887843600 - tz.transition 2030, 3, :o2, 1901149200 - tz.transition 2030, 10, :o1, 1919293200 - tz.transition 2031, 3, :o2, 1932598800 - tz.transition 2031, 10, :o1, 1950742800 - tz.transition 2032, 3, :o2, 1964048400 - tz.transition 2032, 10, :o1, 1982797200 - tz.transition 2033, 3, :o2, 1995498000 - tz.transition 2033, 10, :o1, 2014246800 - tz.transition 2034, 3, :o2, 2026947600 - tz.transition 2034, 10, :o1, 2045696400 - tz.transition 2035, 3, :o2, 2058397200 - tz.transition 2035, 10, :o1, 2077146000 - tz.transition 2036, 3, :o2, 2090451600 - tz.transition 2036, 10, :o1, 2108595600 - tz.transition 2037, 3, :o2, 2121901200 - tz.transition 2037, 10, :o1, 2140045200 - tz.transition 2038, 3, :o2, 59172253, 24 - tz.transition 2038, 10, :o1, 59177461, 24 - tz.transition 2039, 3, :o2, 59180989, 24 - tz.transition 2039, 10, :o1, 59186197, 24 - tz.transition 2040, 3, :o2, 59189725, 24 - tz.transition 2040, 10, :o1, 59194933, 24 - tz.transition 2041, 3, :o2, 59198629, 24 - tz.transition 2041, 10, :o1, 59203669, 24 - tz.transition 2042, 3, :o2, 59207365, 24 - tz.transition 2042, 10, :o1, 59212405, 24 - tz.transition 2043, 3, :o2, 59216101, 24 - tz.transition 2043, 10, :o1, 59221141, 24 - tz.transition 2044, 3, :o2, 59224837, 24 - tz.transition 2044, 10, :o1, 59230045, 24 - tz.transition 2045, 3, :o2, 59233573, 24 - tz.transition 2045, 10, :o1, 59238781, 24 - tz.transition 2046, 3, :o2, 59242309, 24 - tz.transition 2046, 10, :o1, 59247517, 24 - tz.transition 2047, 3, :o2, 59251213, 24 - tz.transition 2047, 10, :o1, 59256253, 24 - tz.transition 2048, 3, :o2, 59259949, 24 - tz.transition 2048, 10, :o1, 59264989, 24 - tz.transition 2049, 3, :o2, 59268685, 24 - tz.transition 2049, 10, :o1, 59273893, 24 - tz.transition 2050, 3, :o2, 59277421, 24 - tz.transition 2050, 10, :o1, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb deleted file mode 100644 index d89d095a75..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Vilnius - include TimezoneDefinition - - timezone 'Europe/Vilnius' do |tz| - tz.offset :o0, 6076, 0, :LMT - tz.offset :o1, 5040, 0, :WMT - tz.offset :o2, 5736, 0, :KMT - tz.offset :o3, 3600, 0, :CET - tz.offset :o4, 7200, 0, :EET - tz.offset :o5, 10800, 0, :MSK - tz.offset :o6, 3600, 3600, :CEST - tz.offset :o7, 10800, 3600, :MSD - tz.offset :o8, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 52006653281, 21600 - tz.transition 1916, 12, :o2, 290547533, 120 - tz.transition 1919, 10, :o3, 8720069161, 3600 - tz.transition 1920, 7, :o4, 58140419, 24 - tz.transition 1920, 10, :o3, 29071277, 12 - tz.transition 1940, 8, :o5, 58316267, 24 - tz.transition 1941, 6, :o6, 19441355, 8 - tz.transition 1942, 11, :o3, 58335973, 24 - tz.transition 1943, 3, :o6, 58339501, 24 - tz.transition 1943, 10, :o3, 58344037, 24 - tz.transition 1944, 4, :o6, 58348405, 24 - tz.transition 1944, 7, :o5, 29175641, 12 - tz.transition 1981, 3, :o7, 354920400 - tz.transition 1981, 9, :o5, 370728000 - tz.transition 1982, 3, :o7, 386456400 - tz.transition 1982, 9, :o5, 402264000 - tz.transition 1983, 3, :o7, 417992400 - tz.transition 1983, 9, :o5, 433800000 - tz.transition 1984, 3, :o7, 449614800 - tz.transition 1984, 9, :o5, 465346800 - tz.transition 1985, 3, :o7, 481071600 - tz.transition 1985, 9, :o5, 496796400 - tz.transition 1986, 3, :o7, 512521200 - tz.transition 1986, 9, :o5, 528246000 - tz.transition 1987, 3, :o7, 543970800 - tz.transition 1987, 9, :o5, 559695600 - tz.transition 1988, 3, :o7, 575420400 - tz.transition 1988, 9, :o5, 591145200 - tz.transition 1989, 3, :o7, 606870000 - tz.transition 1989, 9, :o5, 622594800 - tz.transition 1990, 3, :o7, 638319600 - tz.transition 1990, 9, :o5, 654649200 - tz.transition 1991, 3, :o8, 670374000 - tz.transition 1991, 9, :o4, 686102400 - tz.transition 1992, 3, :o8, 701827200 - tz.transition 1992, 9, :o4, 717552000 - tz.transition 1993, 3, :o8, 733276800 - tz.transition 1993, 9, :o4, 749001600 - tz.transition 1994, 3, :o8, 764726400 - tz.transition 1994, 9, :o4, 780451200 - tz.transition 1995, 3, :o8, 796176000 - tz.transition 1995, 9, :o4, 811900800 - tz.transition 1996, 3, :o8, 828230400 - tz.transition 1996, 10, :o4, 846374400 - tz.transition 1997, 3, :o8, 859680000 - tz.transition 1997, 10, :o4, 877824000 - tz.transition 1998, 3, :o6, 891133200 - tz.transition 1998, 10, :o3, 909277200 - tz.transition 1999, 3, :o6, 922582800 - tz.transition 1999, 10, :o4, 941331600 - tz.transition 2003, 3, :o8, 1048986000 - tz.transition 2003, 10, :o4, 1067130000 - tz.transition 2004, 3, :o8, 1080435600 - tz.transition 2004, 10, :o4, 1099184400 - tz.transition 2005, 3, :o8, 1111885200 - tz.transition 2005, 10, :o4, 1130634000 - tz.transition 2006, 3, :o8, 1143334800 - tz.transition 2006, 10, :o4, 1162083600 - tz.transition 2007, 3, :o8, 1174784400 - tz.transition 2007, 10, :o4, 1193533200 - tz.transition 2008, 3, :o8, 1206838800 - tz.transition 2008, 10, :o4, 1224982800 - tz.transition 2009, 3, :o8, 1238288400 - tz.transition 2009, 10, :o4, 1256432400 - tz.transition 2010, 3, :o8, 1269738000 - tz.transition 2010, 10, :o4, 1288486800 - tz.transition 2011, 3, :o8, 1301187600 - tz.transition 2011, 10, :o4, 1319936400 - tz.transition 2012, 3, :o8, 1332637200 - tz.transition 2012, 10, :o4, 1351386000 - tz.transition 2013, 3, :o8, 1364691600 - tz.transition 2013, 10, :o4, 1382835600 - tz.transition 2014, 3, :o8, 1396141200 - tz.transition 2014, 10, :o4, 1414285200 - tz.transition 2015, 3, :o8, 1427590800 - tz.transition 2015, 10, :o4, 1445734800 - tz.transition 2016, 3, :o8, 1459040400 - tz.transition 2016, 10, :o4, 1477789200 - tz.transition 2017, 3, :o8, 1490490000 - tz.transition 2017, 10, :o4, 1509238800 - tz.transition 2018, 3, :o8, 1521939600 - tz.transition 2018, 10, :o4, 1540688400 - tz.transition 2019, 3, :o8, 1553994000 - tz.transition 2019, 10, :o4, 1572138000 - tz.transition 2020, 3, :o8, 1585443600 - tz.transition 2020, 10, :o4, 1603587600 - tz.transition 2021, 3, :o8, 1616893200 - tz.transition 2021, 10, :o4, 1635642000 - tz.transition 2022, 3, :o8, 1648342800 - tz.transition 2022, 10, :o4, 1667091600 - tz.transition 2023, 3, :o8, 1679792400 - tz.transition 2023, 10, :o4, 1698541200 - tz.transition 2024, 3, :o8, 1711846800 - tz.transition 2024, 10, :o4, 1729990800 - tz.transition 2025, 3, :o8, 1743296400 - tz.transition 2025, 10, :o4, 1761440400 - tz.transition 2026, 3, :o8, 1774746000 - tz.transition 2026, 10, :o4, 1792890000 - tz.transition 2027, 3, :o8, 1806195600 - tz.transition 2027, 10, :o4, 1824944400 - tz.transition 2028, 3, :o8, 1837645200 - tz.transition 2028, 10, :o4, 1856394000 - tz.transition 2029, 3, :o8, 1869094800 - tz.transition 2029, 10, :o4, 1887843600 - tz.transition 2030, 3, :o8, 1901149200 - tz.transition 2030, 10, :o4, 1919293200 - tz.transition 2031, 3, :o8, 1932598800 - tz.transition 2031, 10, :o4, 1950742800 - tz.transition 2032, 3, :o8, 1964048400 - tz.transition 2032, 10, :o4, 1982797200 - tz.transition 2033, 3, :o8, 1995498000 - tz.transition 2033, 10, :o4, 2014246800 - tz.transition 2034, 3, :o8, 2026947600 - tz.transition 2034, 10, :o4, 2045696400 - tz.transition 2035, 3, :o8, 2058397200 - tz.transition 2035, 10, :o4, 2077146000 - tz.transition 2036, 3, :o8, 2090451600 - tz.transition 2036, 10, :o4, 2108595600 - tz.transition 2037, 3, :o8, 2121901200 - tz.transition 2037, 10, :o4, 2140045200 - tz.transition 2038, 3, :o8, 59172253, 24 - tz.transition 2038, 10, :o4, 59177461, 24 - tz.transition 2039, 3, :o8, 59180989, 24 - tz.transition 2039, 10, :o4, 59186197, 24 - tz.transition 2040, 3, :o8, 59189725, 24 - tz.transition 2040, 10, :o4, 59194933, 24 - tz.transition 2041, 3, :o8, 59198629, 24 - tz.transition 2041, 10, :o4, 59203669, 24 - tz.transition 2042, 3, :o8, 59207365, 24 - tz.transition 2042, 10, :o4, 59212405, 24 - tz.transition 2043, 3, :o8, 59216101, 24 - tz.transition 2043, 10, :o4, 59221141, 24 - tz.transition 2044, 3, :o8, 59224837, 24 - tz.transition 2044, 10, :o4, 59230045, 24 - tz.transition 2045, 3, :o8, 59233573, 24 - tz.transition 2045, 10, :o4, 59238781, 24 - tz.transition 2046, 3, :o8, 59242309, 24 - tz.transition 2046, 10, :o4, 59247517, 24 - tz.transition 2047, 3, :o8, 59251213, 24 - tz.transition 2047, 10, :o4, 59256253, 24 - tz.transition 2048, 3, :o8, 59259949, 24 - tz.transition 2048, 10, :o4, 59264989, 24 - tz.transition 2049, 3, :o8, 59268685, 24 - tz.transition 2049, 10, :o4, 59273893, 24 - tz.transition 2050, 3, :o8, 59277421, 24 - tz.transition 2050, 10, :o4, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb deleted file mode 100644 index 7fa51c2691..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb +++ /dev/null @@ -1,212 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Warsaw - include TimezoneDefinition - - timezone 'Europe/Warsaw' do |tz| - tz.offset :o0, 5040, 0, :LMT - tz.offset :o1, 5040, 0, :WMT - tz.offset :o2, 3600, 0, :CET - tz.offset :o3, 3600, 3600, :CEST - tz.offset :o4, 7200, 0, :EET - tz.offset :o5, 7200, 3600, :EEST - - tz.transition 1879, 12, :o1, 288925853, 120 - tz.transition 1915, 8, :o2, 290485733, 120 - tz.transition 1916, 4, :o3, 29051813, 12 - tz.transition 1916, 9, :o2, 58107299, 24 - tz.transition 1917, 4, :o3, 58112029, 24 - tz.transition 1917, 9, :o2, 58115725, 24 - tz.transition 1918, 4, :o3, 58120765, 24 - tz.transition 1918, 9, :o4, 58124461, 24 - tz.transition 1919, 4, :o5, 4844127, 2 - tz.transition 1919, 9, :o4, 4844435, 2 - tz.transition 1922, 5, :o2, 29078477, 12 - tz.transition 1940, 6, :o3, 58315285, 24 - tz.transition 1942, 11, :o2, 58335973, 24 - tz.transition 1943, 3, :o3, 58339501, 24 - tz.transition 1943, 10, :o2, 58344037, 24 - tz.transition 1944, 4, :o3, 58348405, 24 - tz.transition 1944, 10, :o2, 4862735, 2 - tz.transition 1945, 4, :o3, 58357787, 24 - tz.transition 1945, 10, :o2, 29181125, 12 - tz.transition 1946, 4, :o3, 58366187, 24 - tz.transition 1946, 10, :o2, 58370413, 24 - tz.transition 1947, 5, :o3, 58375429, 24 - tz.transition 1947, 10, :o2, 58379125, 24 - tz.transition 1948, 4, :o3, 58383829, 24 - tz.transition 1948, 10, :o2, 58387861, 24 - tz.transition 1949, 4, :o3, 58392397, 24 - tz.transition 1949, 10, :o2, 58396597, 24 - tz.transition 1957, 6, :o3, 4871983, 2 - tz.transition 1957, 9, :o2, 4872221, 2 - tz.transition 1958, 3, :o3, 4872585, 2 - tz.transition 1958, 9, :o2, 4872949, 2 - tz.transition 1959, 5, :o3, 4873439, 2 - tz.transition 1959, 10, :o2, 4873691, 2 - tz.transition 1960, 4, :o3, 4874055, 2 - tz.transition 1960, 10, :o2, 4874419, 2 - tz.transition 1961, 5, :o3, 4874895, 2 - tz.transition 1961, 10, :o2, 4875147, 2 - tz.transition 1962, 5, :o3, 4875623, 2 - tz.transition 1962, 9, :o2, 4875875, 2 - tz.transition 1963, 5, :o3, 4876351, 2 - tz.transition 1963, 9, :o2, 4876603, 2 - tz.transition 1964, 5, :o3, 4877093, 2 - tz.transition 1964, 9, :o2, 4877331, 2 - tz.transition 1977, 4, :o3, 228873600 - tz.transition 1977, 9, :o2, 243993600 - tz.transition 1978, 4, :o3, 260323200 - tz.transition 1978, 10, :o2, 276048000 - tz.transition 1979, 4, :o3, 291772800 - tz.transition 1979, 9, :o2, 307497600 - tz.transition 1980, 4, :o3, 323827200 - tz.transition 1980, 9, :o2, 338947200 - tz.transition 1981, 3, :o3, 354672000 - tz.transition 1981, 9, :o2, 370396800 - tz.transition 1982, 3, :o3, 386121600 - tz.transition 1982, 9, :o2, 401846400 - tz.transition 1983, 3, :o3, 417571200 - tz.transition 1983, 9, :o2, 433296000 - tz.transition 1984, 3, :o3, 449020800 - tz.transition 1984, 9, :o2, 465350400 - tz.transition 1985, 3, :o3, 481075200 - tz.transition 1985, 9, :o2, 496800000 - tz.transition 1986, 3, :o3, 512524800 - tz.transition 1986, 9, :o2, 528249600 - tz.transition 1987, 3, :o3, 543974400 - tz.transition 1987, 9, :o2, 559699200 - tz.transition 1988, 3, :o3, 575427600 - tz.transition 1988, 9, :o2, 591152400 - tz.transition 1989, 3, :o3, 606877200 - tz.transition 1989, 9, :o2, 622602000 - tz.transition 1990, 3, :o3, 638326800 - tz.transition 1990, 9, :o2, 654656400 - tz.transition 1991, 3, :o3, 670381200 - tz.transition 1991, 9, :o2, 686106000 - tz.transition 1992, 3, :o3, 701830800 - tz.transition 1992, 9, :o2, 717555600 - tz.transition 1993, 3, :o3, 733280400 - tz.transition 1993, 9, :o2, 749005200 - tz.transition 1994, 3, :o3, 764730000 - tz.transition 1994, 9, :o2, 780454800 - tz.transition 1995, 3, :o3, 796179600 - tz.transition 1995, 9, :o2, 811904400 - tz.transition 1996, 3, :o3, 828234000 - tz.transition 1996, 10, :o2, 846378000 - tz.transition 1997, 3, :o3, 859683600 - tz.transition 1997, 10, :o2, 877827600 - tz.transition 1998, 3, :o3, 891133200 - tz.transition 1998, 10, :o2, 909277200 - tz.transition 1999, 3, :o3, 922582800 - tz.transition 1999, 10, :o2, 941331600 - tz.transition 2000, 3, :o3, 954032400 - tz.transition 2000, 10, :o2, 972781200 - tz.transition 2001, 3, :o3, 985482000 - tz.transition 2001, 10, :o2, 1004230800 - tz.transition 2002, 3, :o3, 1017536400 - tz.transition 2002, 10, :o2, 1035680400 - tz.transition 2003, 3, :o3, 1048986000 - tz.transition 2003, 10, :o2, 1067130000 - tz.transition 2004, 3, :o3, 1080435600 - tz.transition 2004, 10, :o2, 1099184400 - tz.transition 2005, 3, :o3, 1111885200 - tz.transition 2005, 10, :o2, 1130634000 - tz.transition 2006, 3, :o3, 1143334800 - tz.transition 2006, 10, :o2, 1162083600 - tz.transition 2007, 3, :o3, 1174784400 - tz.transition 2007, 10, :o2, 1193533200 - tz.transition 2008, 3, :o3, 1206838800 - tz.transition 2008, 10, :o2, 1224982800 - tz.transition 2009, 3, :o3, 1238288400 - tz.transition 2009, 10, :o2, 1256432400 - tz.transition 2010, 3, :o3, 1269738000 - tz.transition 2010, 10, :o2, 1288486800 - tz.transition 2011, 3, :o3, 1301187600 - tz.transition 2011, 10, :o2, 1319936400 - tz.transition 2012, 3, :o3, 1332637200 - tz.transition 2012, 10, :o2, 1351386000 - tz.transition 2013, 3, :o3, 1364691600 - tz.transition 2013, 10, :o2, 1382835600 - tz.transition 2014, 3, :o3, 1396141200 - tz.transition 2014, 10, :o2, 1414285200 - tz.transition 2015, 3, :o3, 1427590800 - tz.transition 2015, 10, :o2, 1445734800 - tz.transition 2016, 3, :o3, 1459040400 - tz.transition 2016, 10, :o2, 1477789200 - tz.transition 2017, 3, :o3, 1490490000 - tz.transition 2017, 10, :o2, 1509238800 - tz.transition 2018, 3, :o3, 1521939600 - tz.transition 2018, 10, :o2, 1540688400 - tz.transition 2019, 3, :o3, 1553994000 - tz.transition 2019, 10, :o2, 1572138000 - tz.transition 2020, 3, :o3, 1585443600 - tz.transition 2020, 10, :o2, 1603587600 - tz.transition 2021, 3, :o3, 1616893200 - tz.transition 2021, 10, :o2, 1635642000 - tz.transition 2022, 3, :o3, 1648342800 - tz.transition 2022, 10, :o2, 1667091600 - tz.transition 2023, 3, :o3, 1679792400 - tz.transition 2023, 10, :o2, 1698541200 - tz.transition 2024, 3, :o3, 1711846800 - tz.transition 2024, 10, :o2, 1729990800 - tz.transition 2025, 3, :o3, 1743296400 - tz.transition 2025, 10, :o2, 1761440400 - tz.transition 2026, 3, :o3, 1774746000 - tz.transition 2026, 10, :o2, 1792890000 - tz.transition 2027, 3, :o3, 1806195600 - tz.transition 2027, 10, :o2, 1824944400 - tz.transition 2028, 3, :o3, 1837645200 - tz.transition 2028, 10, :o2, 1856394000 - tz.transition 2029, 3, :o3, 1869094800 - tz.transition 2029, 10, :o2, 1887843600 - tz.transition 2030, 3, :o3, 1901149200 - tz.transition 2030, 10, :o2, 1919293200 - tz.transition 2031, 3, :o3, 1932598800 - tz.transition 2031, 10, :o2, 1950742800 - tz.transition 2032, 3, :o3, 1964048400 - tz.transition 2032, 10, :o2, 1982797200 - tz.transition 2033, 3, :o3, 1995498000 - tz.transition 2033, 10, :o2, 2014246800 - tz.transition 2034, 3, :o3, 2026947600 - tz.transition 2034, 10, :o2, 2045696400 - tz.transition 2035, 3, :o3, 2058397200 - tz.transition 2035, 10, :o2, 2077146000 - tz.transition 2036, 3, :o3, 2090451600 - tz.transition 2036, 10, :o2, 2108595600 - tz.transition 2037, 3, :o3, 2121901200 - tz.transition 2037, 10, :o2, 2140045200 - tz.transition 2038, 3, :o3, 59172253, 24 - tz.transition 2038, 10, :o2, 59177461, 24 - tz.transition 2039, 3, :o3, 59180989, 24 - tz.transition 2039, 10, :o2, 59186197, 24 - tz.transition 2040, 3, :o3, 59189725, 24 - tz.transition 2040, 10, :o2, 59194933, 24 - tz.transition 2041, 3, :o3, 59198629, 24 - tz.transition 2041, 10, :o2, 59203669, 24 - tz.transition 2042, 3, :o3, 59207365, 24 - tz.transition 2042, 10, :o2, 59212405, 24 - tz.transition 2043, 3, :o3, 59216101, 24 - tz.transition 2043, 10, :o2, 59221141, 24 - tz.transition 2044, 3, :o3, 59224837, 24 - tz.transition 2044, 10, :o2, 59230045, 24 - tz.transition 2045, 3, :o3, 59233573, 24 - tz.transition 2045, 10, :o2, 59238781, 24 - tz.transition 2046, 3, :o3, 59242309, 24 - tz.transition 2046, 10, :o2, 59247517, 24 - tz.transition 2047, 3, :o3, 59251213, 24 - tz.transition 2047, 10, :o2, 59256253, 24 - tz.transition 2048, 3, :o3, 59259949, 24 - tz.transition 2048, 10, :o2, 59264989, 24 - tz.transition 2049, 3, :o3, 59268685, 24 - tz.transition 2049, 10, :o2, 59273893, 24 - tz.transition 2050, 3, :o3, 59277421, 24 - tz.transition 2050, 10, :o2, 59282629, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb deleted file mode 100644 index ecdd903d28..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Europe - module Zagreb - include TimezoneDefinition - - linked_timezone 'Europe/Zagreb', 'Europe/Belgrade' - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb deleted file mode 100644 index a524fd6b6b..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb +++ /dev/null @@ -1,202 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Auckland - include TimezoneDefinition - - timezone 'Pacific/Auckland' do |tz| - tz.offset :o0, 41944, 0, :LMT - tz.offset :o1, 41400, 0, :NZMT - tz.offset :o2, 41400, 3600, :NZST - tz.offset :o3, 41400, 1800, :NZST - tz.offset :o4, 43200, 0, :NZST - tz.offset :o5, 43200, 3600, :NZDT - - tz.transition 1868, 11, :o1, 25959290557, 10800 - tz.transition 1927, 11, :o2, 116409125, 48 - tz.transition 1928, 3, :o1, 38804945, 16 - tz.transition 1928, 10, :o3, 116425589, 48 - tz.transition 1929, 3, :o1, 29108245, 12 - tz.transition 1929, 10, :o3, 116443061, 48 - tz.transition 1930, 3, :o1, 29112613, 12 - tz.transition 1930, 10, :o3, 116460533, 48 - tz.transition 1931, 3, :o1, 29116981, 12 - tz.transition 1931, 10, :o3, 116478005, 48 - tz.transition 1932, 3, :o1, 29121433, 12 - tz.transition 1932, 10, :o3, 116495477, 48 - tz.transition 1933, 3, :o1, 29125801, 12 - tz.transition 1933, 10, :o3, 116512949, 48 - tz.transition 1934, 4, :o1, 29130673, 12 - tz.transition 1934, 9, :o3, 116530085, 48 - tz.transition 1935, 4, :o1, 29135041, 12 - tz.transition 1935, 9, :o3, 116547557, 48 - tz.transition 1936, 4, :o1, 29139409, 12 - tz.transition 1936, 9, :o3, 116565029, 48 - tz.transition 1937, 4, :o1, 29143777, 12 - tz.transition 1937, 9, :o3, 116582501, 48 - tz.transition 1938, 4, :o1, 29148145, 12 - tz.transition 1938, 9, :o3, 116599973, 48 - tz.transition 1939, 4, :o1, 29152597, 12 - tz.transition 1939, 9, :o3, 116617445, 48 - tz.transition 1940, 4, :o1, 29156965, 12 - tz.transition 1940, 9, :o3, 116635253, 48 - tz.transition 1945, 12, :o4, 2431821, 1 - tz.transition 1974, 11, :o5, 152632800 - tz.transition 1975, 2, :o4, 162309600 - tz.transition 1975, 10, :o5, 183477600 - tz.transition 1976, 3, :o4, 194968800 - tz.transition 1976, 10, :o5, 215532000 - tz.transition 1977, 3, :o4, 226418400 - tz.transition 1977, 10, :o5, 246981600 - tz.transition 1978, 3, :o4, 257868000 - tz.transition 1978, 10, :o5, 278431200 - tz.transition 1979, 3, :o4, 289317600 - tz.transition 1979, 10, :o5, 309880800 - tz.transition 1980, 3, :o4, 320767200 - tz.transition 1980, 10, :o5, 341330400 - tz.transition 1981, 2, :o4, 352216800 - tz.transition 1981, 10, :o5, 372780000 - tz.transition 1982, 3, :o4, 384271200 - tz.transition 1982, 10, :o5, 404834400 - tz.transition 1983, 3, :o4, 415720800 - tz.transition 1983, 10, :o5, 436284000 - tz.transition 1984, 3, :o4, 447170400 - tz.transition 1984, 10, :o5, 467733600 - tz.transition 1985, 3, :o4, 478620000 - tz.transition 1985, 10, :o5, 499183200 - tz.transition 1986, 3, :o4, 510069600 - tz.transition 1986, 10, :o5, 530632800 - tz.transition 1987, 2, :o4, 541519200 - tz.transition 1987, 10, :o5, 562082400 - tz.transition 1988, 3, :o4, 573573600 - tz.transition 1988, 10, :o5, 594136800 - tz.transition 1989, 3, :o4, 605023200 - tz.transition 1989, 10, :o5, 623772000 - tz.transition 1990, 3, :o4, 637682400 - tz.transition 1990, 10, :o5, 655221600 - tz.transition 1991, 3, :o4, 669132000 - tz.transition 1991, 10, :o5, 686671200 - tz.transition 1992, 3, :o4, 700581600 - tz.transition 1992, 10, :o5, 718120800 - tz.transition 1993, 3, :o4, 732636000 - tz.transition 1993, 10, :o5, 749570400 - tz.transition 1994, 3, :o4, 764085600 - tz.transition 1994, 10, :o5, 781020000 - tz.transition 1995, 3, :o4, 795535200 - tz.transition 1995, 9, :o5, 812469600 - tz.transition 1996, 3, :o4, 826984800 - tz.transition 1996, 10, :o5, 844524000 - tz.transition 1997, 3, :o4, 858434400 - tz.transition 1997, 10, :o5, 875973600 - tz.transition 1998, 3, :o4, 889884000 - tz.transition 1998, 10, :o5, 907423200 - tz.transition 1999, 3, :o4, 921938400 - tz.transition 1999, 10, :o5, 938872800 - tz.transition 2000, 3, :o4, 953388000 - tz.transition 2000, 9, :o5, 970322400 - tz.transition 2001, 3, :o4, 984837600 - tz.transition 2001, 10, :o5, 1002376800 - tz.transition 2002, 3, :o4, 1016287200 - tz.transition 2002, 10, :o5, 1033826400 - tz.transition 2003, 3, :o4, 1047736800 - tz.transition 2003, 10, :o5, 1065276000 - tz.transition 2004, 3, :o4, 1079791200 - tz.transition 2004, 10, :o5, 1096725600 - tz.transition 2005, 3, :o4, 1111240800 - tz.transition 2005, 10, :o5, 1128175200 - tz.transition 2006, 3, :o4, 1142690400 - tz.transition 2006, 9, :o5, 1159624800 - tz.transition 2007, 3, :o4, 1174140000 - tz.transition 2007, 9, :o5, 1191074400 - tz.transition 2008, 4, :o4, 1207404000 - tz.transition 2008, 9, :o5, 1222524000 - tz.transition 2009, 4, :o4, 1238853600 - tz.transition 2009, 9, :o5, 1253973600 - tz.transition 2010, 4, :o4, 1270303200 - tz.transition 2010, 9, :o5, 1285423200 - tz.transition 2011, 4, :o4, 1301752800 - tz.transition 2011, 9, :o5, 1316872800 - tz.transition 2012, 3, :o4, 1333202400 - tz.transition 2012, 9, :o5, 1348927200 - tz.transition 2013, 4, :o4, 1365256800 - tz.transition 2013, 9, :o5, 1380376800 - tz.transition 2014, 4, :o4, 1396706400 - tz.transition 2014, 9, :o5, 1411826400 - tz.transition 2015, 4, :o4, 1428156000 - tz.transition 2015, 9, :o5, 1443276000 - tz.transition 2016, 4, :o4, 1459605600 - tz.transition 2016, 9, :o5, 1474725600 - tz.transition 2017, 4, :o4, 1491055200 - tz.transition 2017, 9, :o5, 1506175200 - tz.transition 2018, 3, :o4, 1522504800 - tz.transition 2018, 9, :o5, 1538229600 - tz.transition 2019, 4, :o4, 1554559200 - tz.transition 2019, 9, :o5, 1569679200 - tz.transition 2020, 4, :o4, 1586008800 - tz.transition 2020, 9, :o5, 1601128800 - tz.transition 2021, 4, :o4, 1617458400 - tz.transition 2021, 9, :o5, 1632578400 - tz.transition 2022, 4, :o4, 1648908000 - tz.transition 2022, 9, :o5, 1664028000 - tz.transition 2023, 4, :o4, 1680357600 - tz.transition 2023, 9, :o5, 1695477600 - tz.transition 2024, 4, :o4, 1712412000 - tz.transition 2024, 9, :o5, 1727532000 - tz.transition 2025, 4, :o4, 1743861600 - tz.transition 2025, 9, :o5, 1758981600 - tz.transition 2026, 4, :o4, 1775311200 - tz.transition 2026, 9, :o5, 1790431200 - tz.transition 2027, 4, :o4, 1806760800 - tz.transition 2027, 9, :o5, 1821880800 - tz.transition 2028, 4, :o4, 1838210400 - tz.transition 2028, 9, :o5, 1853330400 - tz.transition 2029, 3, :o4, 1869660000 - tz.transition 2029, 9, :o5, 1885384800 - tz.transition 2030, 4, :o4, 1901714400 - tz.transition 2030, 9, :o5, 1916834400 - tz.transition 2031, 4, :o4, 1933164000 - tz.transition 2031, 9, :o5, 1948284000 - tz.transition 2032, 4, :o4, 1964613600 - tz.transition 2032, 9, :o5, 1979733600 - tz.transition 2033, 4, :o4, 1996063200 - tz.transition 2033, 9, :o5, 2011183200 - tz.transition 2034, 4, :o4, 2027512800 - tz.transition 2034, 9, :o5, 2042632800 - tz.transition 2035, 3, :o4, 2058962400 - tz.transition 2035, 9, :o5, 2074687200 - tz.transition 2036, 4, :o4, 2091016800 - tz.transition 2036, 9, :o5, 2106136800 - tz.transition 2037, 4, :o4, 2122466400 - tz.transition 2037, 9, :o5, 2137586400 - tz.transition 2038, 4, :o4, 29586205, 12 - tz.transition 2038, 9, :o5, 29588305, 12 - tz.transition 2039, 4, :o4, 29590573, 12 - tz.transition 2039, 9, :o5, 29592673, 12 - tz.transition 2040, 3, :o4, 29594941, 12 - tz.transition 2040, 9, :o5, 29597125, 12 - tz.transition 2041, 4, :o4, 29599393, 12 - tz.transition 2041, 9, :o5, 29601493, 12 - tz.transition 2042, 4, :o4, 29603761, 12 - tz.transition 2042, 9, :o5, 29605861, 12 - tz.transition 2043, 4, :o4, 29608129, 12 - tz.transition 2043, 9, :o5, 29610229, 12 - tz.transition 2044, 4, :o4, 29612497, 12 - tz.transition 2044, 9, :o5, 29614597, 12 - tz.transition 2045, 4, :o4, 29616865, 12 - tz.transition 2045, 9, :o5, 29618965, 12 - tz.transition 2046, 3, :o4, 29621233, 12 - tz.transition 2046, 9, :o5, 29623417, 12 - tz.transition 2047, 4, :o4, 29625685, 12 - tz.transition 2047, 9, :o5, 29627785, 12 - tz.transition 2048, 4, :o4, 29630053, 12 - tz.transition 2048, 9, :o5, 29632153, 12 - tz.transition 2049, 4, :o4, 29634421, 12 - tz.transition 2049, 9, :o5, 29636521, 12 - tz.transition 2050, 4, :o4, 29638789, 12 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb deleted file mode 100644 index 5fe9bbd9a6..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Fiji - include TimezoneDefinition - - timezone 'Pacific/Fiji' do |tz| - tz.offset :o0, 42820, 0, :LMT - tz.offset :o1, 43200, 0, :FJT - tz.offset :o2, 43200, 3600, :FJST - - tz.transition 1915, 10, :o1, 10457838739, 4320 - tz.transition 1998, 10, :o2, 909842400 - tz.transition 1999, 2, :o1, 920124000 - tz.transition 1999, 11, :o2, 941896800 - tz.transition 2000, 2, :o1, 951573600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb deleted file mode 100644 index d4c1a0a682..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Guam - include TimezoneDefinition - - timezone 'Pacific/Guam' do |tz| - tz.offset :o0, -51660, 0, :LMT - tz.offset :o1, 34740, 0, :LMT - tz.offset :o2, 36000, 0, :GST - tz.offset :o3, 36000, 0, :ChST - - tz.transition 1844, 12, :o1, 1149567407, 480 - tz.transition 1900, 12, :o2, 1159384847, 480 - tz.transition 2000, 12, :o3, 977493600 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb deleted file mode 100644 index 204b226537..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Honolulu - include TimezoneDefinition - - timezone 'Pacific/Honolulu' do |tz| - tz.offset :o0, -37886, 0, :LMT - tz.offset :o1, -37800, 0, :HST - tz.offset :o2, -37800, 3600, :HDT - tz.offset :o3, -37800, 3600, :HWT - tz.offset :o4, -37800, 3600, :HPT - tz.offset :o5, -36000, 0, :HST - - tz.transition 1900, 1, :o1, 104328926143, 43200 - tz.transition 1933, 4, :o2, 116505265, 48 - tz.transition 1933, 5, :o1, 116506271, 48 - tz.transition 1942, 2, :o3, 116659201, 48 - tz.transition 1945, 8, :o4, 58360379, 24 - tz.transition 1945, 9, :o1, 116722991, 48 - tz.transition 1947, 6, :o5, 116752561, 48 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb deleted file mode 100644 index 32adad92c1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Majuro - include TimezoneDefinition - - timezone 'Pacific/Majuro' do |tz| - tz.offset :o0, 41088, 0, :LMT - tz.offset :o1, 39600, 0, :MHT - tz.offset :o2, 43200, 0, :MHT - - tz.transition 1900, 12, :o1, 1086923261, 450 - tz.transition 1969, 9, :o2, 58571881, 24 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb deleted file mode 100644 index 97784fcc10..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Midway - include TimezoneDefinition - - timezone 'Pacific/Midway' do |tz| - tz.offset :o0, -42568, 0, :LMT - tz.offset :o1, -39600, 0, :NST - tz.offset :o2, -39600, 3600, :NDT - tz.offset :o3, -39600, 0, :BST - tz.offset :o4, -39600, 0, :SST - - tz.transition 1901, 1, :o1, 26086168721, 10800 - tz.transition 1956, 6, :o2, 58455071, 24 - tz.transition 1956, 9, :o1, 29228627, 12 - tz.transition 1967, 4, :o3, 58549967, 24 - tz.transition 1983, 11, :o4, 439038000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb deleted file mode 100644 index 70173db8ab..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Noumea - include TimezoneDefinition - - timezone 'Pacific/Noumea' do |tz| - tz.offset :o0, 39948, 0, :LMT - tz.offset :o1, 39600, 0, :NCT - tz.offset :o2, 39600, 3600, :NCST - - tz.transition 1912, 1, :o1, 17419781071, 7200 - tz.transition 1977, 12, :o2, 250002000 - tz.transition 1978, 2, :o1, 257342400 - tz.transition 1978, 12, :o2, 281451600 - tz.transition 1979, 2, :o1, 288878400 - tz.transition 1996, 11, :o2, 849366000 - tz.transition 1997, 3, :o1, 857228400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb deleted file mode 100644 index c8fcd7d527..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Pago_Pago - include TimezoneDefinition - - timezone 'Pacific/Pago_Pago' do |tz| - tz.offset :o0, 45432, 0, :LMT - tz.offset :o1, -40968, 0, :LMT - tz.offset :o2, -41400, 0, :SAMT - tz.offset :o3, -39600, 0, :NST - tz.offset :o4, -39600, 0, :BST - tz.offset :o5, -39600, 0, :SST - - tz.transition 1879, 7, :o1, 2889041969, 1200 - tz.transition 1911, 1, :o2, 2902845569, 1200 - tz.transition 1950, 1, :o3, 116797583, 48 - tz.transition 1967, 4, :o4, 58549967, 24 - tz.transition 1983, 11, :o5, 439038000 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb deleted file mode 100644 index f06cf6d54f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Port_Moresby - include TimezoneDefinition - - timezone 'Pacific/Port_Moresby' do |tz| - tz.offset :o0, 35320, 0, :LMT - tz.offset :o1, 35312, 0, :PMMT - tz.offset :o2, 36000, 0, :PGT - - tz.transition 1879, 12, :o1, 5200664597, 2160 - tz.transition 1894, 12, :o2, 13031248093, 5400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb deleted file mode 100644 index 7578d92f38..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module Pacific - module Tongatapu - include TimezoneDefinition - - timezone 'Pacific/Tongatapu' do |tz| - tz.offset :o0, 44360, 0, :LMT - tz.offset :o1, 44400, 0, :TOT - tz.offset :o2, 46800, 0, :TOT - tz.offset :o3, 46800, 3600, :TOST - - tz.transition 1900, 12, :o1, 5217231571, 2160 - tz.transition 1940, 12, :o2, 174959639, 72 - tz.transition 1999, 10, :o3, 939214800 - tz.transition 2000, 3, :o2, 953384400 - tz.transition 2000, 11, :o3, 973342800 - tz.transition 2001, 1, :o2, 980596800 - tz.transition 2001, 11, :o3, 1004792400 - tz.transition 2002, 1, :o2, 1012046400 - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb deleted file mode 100644 index 001303c594..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb +++ /dev/null @@ -1,52 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/timezone' - -module TZInfo - - # A Timezone based on a TimezoneInfo. - class InfoTimezone < Timezone #:nodoc: - - # Constructs a new InfoTimezone with a TimezoneInfo instance. - def self.new(info) - tz = super() - tz.send(:setup, info) - tz - end - - # The identifier of the timezone, e.g. "Europe/Paris". - def identifier - @info.identifier - end - - protected - # The TimezoneInfo for this Timezone. - def info - @info - end - - def setup(info) - @info = info - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb deleted file mode 100644 index f8ec4fca87..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb +++ /dev/null @@ -1,51 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/info_timezone' - -module TZInfo - - class LinkedTimezone < InfoTimezone #:nodoc: - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - # - # If no TimezonePeriod could be found, PeriodNotFound is raised. - def period_for_utc(utc) - @linked_timezone.period_for_utc(utc) - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how abiguities should be resolved. - # Raises PeriodNotFound if no periods are found for the given time. - def periods_for_local(local) - @linked_timezone.periods_for_local(local) - end - - protected - def setup(info) - super(info) - @linked_timezone = Timezone.get(info.link_to_identifier) - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb deleted file mode 100644 index 8197ff3e81..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb +++ /dev/null @@ -1,44 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/timezone_info' - -module TZInfo - # Represents a linked timezone defined in a data module. - class LinkedTimezoneInfo < TimezoneInfo #:nodoc: - - # The zone that provides the data (that this zone is an alias for). - attr_reader :link_to_identifier - - # Constructs a new TimezoneInfo with an identifier and the identifier - # of the zone linked to. - def initialize(identifier, link_to_identifier) - super(identifier) - @link_to_identifier = link_to_identifier - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@identifier,#@link_to_identifier>" - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb deleted file mode 100644 index b1f10b2b63..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb +++ /dev/null @@ -1,98 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'rational' -require 'tzinfo/ruby_core_support' - -module TZInfo - - # Provides a method for getting Rationals for a timezone offset in seconds. - # Pre-reduced rationals are returned for all the half-hour intervals between - # -14 and +14 hours to avoid having to call gcd at runtime. - module OffsetRationals #:nodoc: - @@rational_cache = { - -50400 => RubyCoreSupport.rational_new!(-7,12), - -48600 => RubyCoreSupport.rational_new!(-9,16), - -46800 => RubyCoreSupport.rational_new!(-13,24), - -45000 => RubyCoreSupport.rational_new!(-25,48), - -43200 => RubyCoreSupport.rational_new!(-1,2), - -41400 => RubyCoreSupport.rational_new!(-23,48), - -39600 => RubyCoreSupport.rational_new!(-11,24), - -37800 => RubyCoreSupport.rational_new!(-7,16), - -36000 => RubyCoreSupport.rational_new!(-5,12), - -34200 => RubyCoreSupport.rational_new!(-19,48), - -32400 => RubyCoreSupport.rational_new!(-3,8), - -30600 => RubyCoreSupport.rational_new!(-17,48), - -28800 => RubyCoreSupport.rational_new!(-1,3), - -27000 => RubyCoreSupport.rational_new!(-5,16), - -25200 => RubyCoreSupport.rational_new!(-7,24), - -23400 => RubyCoreSupport.rational_new!(-13,48), - -21600 => RubyCoreSupport.rational_new!(-1,4), - -19800 => RubyCoreSupport.rational_new!(-11,48), - -18000 => RubyCoreSupport.rational_new!(-5,24), - -16200 => RubyCoreSupport.rational_new!(-3,16), - -14400 => RubyCoreSupport.rational_new!(-1,6), - -12600 => RubyCoreSupport.rational_new!(-7,48), - -10800 => RubyCoreSupport.rational_new!(-1,8), - -9000 => RubyCoreSupport.rational_new!(-5,48), - -7200 => RubyCoreSupport.rational_new!(-1,12), - -5400 => RubyCoreSupport.rational_new!(-1,16), - -3600 => RubyCoreSupport.rational_new!(-1,24), - -1800 => RubyCoreSupport.rational_new!(-1,48), - 0 => RubyCoreSupport.rational_new!(0,1), - 1800 => RubyCoreSupport.rational_new!(1,48), - 3600 => RubyCoreSupport.rational_new!(1,24), - 5400 => RubyCoreSupport.rational_new!(1,16), - 7200 => RubyCoreSupport.rational_new!(1,12), - 9000 => RubyCoreSupport.rational_new!(5,48), - 10800 => RubyCoreSupport.rational_new!(1,8), - 12600 => RubyCoreSupport.rational_new!(7,48), - 14400 => RubyCoreSupport.rational_new!(1,6), - 16200 => RubyCoreSupport.rational_new!(3,16), - 18000 => RubyCoreSupport.rational_new!(5,24), - 19800 => RubyCoreSupport.rational_new!(11,48), - 21600 => RubyCoreSupport.rational_new!(1,4), - 23400 => RubyCoreSupport.rational_new!(13,48), - 25200 => RubyCoreSupport.rational_new!(7,24), - 27000 => RubyCoreSupport.rational_new!(5,16), - 28800 => RubyCoreSupport.rational_new!(1,3), - 30600 => RubyCoreSupport.rational_new!(17,48), - 32400 => RubyCoreSupport.rational_new!(3,8), - 34200 => RubyCoreSupport.rational_new!(19,48), - 36000 => RubyCoreSupport.rational_new!(5,12), - 37800 => RubyCoreSupport.rational_new!(7,16), - 39600 => RubyCoreSupport.rational_new!(11,24), - 41400 => RubyCoreSupport.rational_new!(23,48), - 43200 => RubyCoreSupport.rational_new!(1,2), - 45000 => RubyCoreSupport.rational_new!(25,48), - 46800 => RubyCoreSupport.rational_new!(13,24), - 48600 => RubyCoreSupport.rational_new!(9,16), - 50400 => RubyCoreSupport.rational_new!(7,12)} - - # Returns a Rational expressing the fraction of a day that offset in - # seconds represents (i.e. equivalent to Rational(offset, 86400)). - def rational_for_offset(offset) - @@rational_cache[offset] || Rational(offset, 86400) - end - module_function :rational_for_offset - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb deleted file mode 100644 index b65eeaaae7..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb +++ /dev/null @@ -1,56 +0,0 @@ -#-- -# Copyright (c) 2008 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'date' -require 'rational' - -module TZInfo - - # Methods to support different versions of Ruby. - module RubyCoreSupport #:nodoc: - - # Use Rational.new! for performance reasons in Ruby 1.8. - # This has been removed from 1.9, but Rational performs better. - if Rational.respond_to? :new! - def self.rational_new!(numerator, denominator = 1) - Rational.new!(numerator, denominator) - end - else - def self.rational_new!(numerator, denominator = 1) - Rational(numerator, denominator) - end - end - - # Ruby 1.8.6 introduced new! and deprecated new0. - # Ruby 1.9.0 removed new0. - # We still need to support new0 for older versions of Ruby. - if DateTime.respond_to? :new! - def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) - DateTime.new!(ajd, of, sg) - end - else - def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) - DateTime.new0(ajd, of, sg) - end - end - end -end \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb deleted file mode 100644 index 264517f3ee..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb +++ /dev/null @@ -1,292 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'date' -require 'time' -require 'tzinfo/offset_rationals' - -module TZInfo - # Used by TZInfo internally to represent either a Time, DateTime or integer - # timestamp (seconds since 1970-01-01 00:00:00). - class TimeOrDateTime #:nodoc: - include Comparable - - # Constructs a new TimeOrDateTime. timeOrDateTime can be a Time, DateTime - # or an integer. If using a Time or DateTime, any time zone information is - # ignored. - def initialize(timeOrDateTime) - @time = nil - @datetime = nil - @timestamp = nil - - if timeOrDateTime.is_a?(Time) - @time = timeOrDateTime - @time = Time.utc(@time.year, @time.mon, @time.mday, @time.hour, @time.min, @time.sec) unless @time.zone == 'UTC' - @orig = @time - elsif timeOrDateTime.is_a?(DateTime) - @datetime = timeOrDateTime - @datetime = @datetime.new_offset(0) unless @datetime.offset == 0 - @orig = @datetime - else - @timestamp = timeOrDateTime.to_i - @orig = @timestamp - end - end - - # Returns the time as a Time. - def to_time - unless @time - if @timestamp - @time = Time.at(@timestamp).utc - else - @time = Time.utc(year, mon, mday, hour, min, sec) - end - end - - @time - end - - # Returns the time as a DateTime. - def to_datetime - unless @datetime - @datetime = DateTime.new(year, mon, mday, hour, min, sec) - end - - @datetime - end - - # Returns the time as an integer timestamp. - def to_i - unless @timestamp - @timestamp = to_time.to_i - end - - @timestamp - end - - # Returns the time as the original time passed to new. - def to_orig - @orig - end - - # Returns a string representation of the TimeOrDateTime. - def to_s - if @orig.is_a?(Time) - "Time: #{@orig.to_s}" - elsif @orig.is_a?(DateTime) - "DateTime: #{@orig.to_s}" - else - "Timestamp: #{@orig.to_s}" - end - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{@orig.inspect}>" - end - - # Returns the year. - def year - if @time - @time.year - elsif @datetime - @datetime.year - else - to_time.year - end - end - - # Returns the month of the year (1..12). - def mon - if @time - @time.mon - elsif @datetime - @datetime.mon - else - to_time.mon - end - end - alias :month :mon - - # Returns the day of the month (1..n). - def mday - if @time - @time.mday - elsif @datetime - @datetime.mday - else - to_time.mday - end - end - alias :day :mday - - # Returns the hour of the day (0..23). - def hour - if @time - @time.hour - elsif @datetime - @datetime.hour - else - to_time.hour - end - end - - # Returns the minute of the hour (0..59). - def min - if @time - @time.min - elsif @datetime - @datetime.min - else - to_time.min - end - end - - # Returns the second of the minute (0..60). (60 for a leap second). - def sec - if @time - @time.sec - elsif @datetime - @datetime.sec - else - to_time.sec - end - end - - # Compares this TimeOrDateTime with another Time, DateTime, integer - # timestamp or TimeOrDateTime. Returns -1, 0 or +1 depending whether the - # receiver is less than, equal to, or greater than timeOrDateTime. - # - # Milliseconds and smaller units are ignored in the comparison. - def <=>(timeOrDateTime) - if timeOrDateTime.is_a?(TimeOrDateTime) - orig = timeOrDateTime.to_orig - - if @orig.is_a?(DateTime) || orig.is_a?(DateTime) - # If either is a DateTime, assume it is there for a reason - # (i.e. for range). - to_datetime <=> timeOrDateTime.to_datetime - elsif orig.is_a?(Time) - to_time <=> timeOrDateTime.to_time - else - to_i <=> timeOrDateTime.to_i - end - elsif @orig.is_a?(DateTime) || timeOrDateTime.is_a?(DateTime) - # If either is a DateTime, assume it is there for a reason - # (i.e. for range). - to_datetime <=> TimeOrDateTime.wrap(timeOrDateTime).to_datetime - elsif timeOrDateTime.is_a?(Time) - to_time <=> timeOrDateTime - else - to_i <=> timeOrDateTime.to_i - end - end - - # Adds a number of seconds to the TimeOrDateTime. Returns a new - # TimeOrDateTime, preserving what the original constructed type was. - # If the original type is a Time and the resulting calculation goes out of - # range for Times, then an exception will be raised by the Time class. - def +(seconds) - if seconds == 0 - self - else - if @orig.is_a?(DateTime) - TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) - else - # + defined for Time and integer timestamps - TimeOrDateTime.new(@orig + seconds) - end - end - end - - # Subtracts a number of seconds from the TimeOrDateTime. Returns a new - # TimeOrDateTime, preserving what the original constructed type was. - # If the original type is a Time and the resulting calculation goes out of - # range for Times, then an exception will be raised by the Time class. - def -(seconds) - self + (-seconds) - end - - # Similar to the + operator, but for cases where adding would cause a - # timestamp or time to go out of the allowed range, converts to a DateTime - # based TimeOrDateTime. - def add_with_convert(seconds) - if seconds == 0 - self - else - if @orig.is_a?(DateTime) - TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) - else - # A Time or timestamp. - result = to_i + seconds - - if result < 0 || result > 2147483647 - result = TimeOrDateTime.new(to_datetime + OffsetRationals.rational_for_offset(seconds)) - else - result = TimeOrDateTime.new(@orig + seconds) - end - end - end - end - - # Returns true if todt represents the same time and was originally - # constructed with the same type (DateTime, Time or timestamp) as this - # TimeOrDateTime. - def eql?(todt) - todt.respond_to?(:to_orig) && to_orig.eql?(todt.to_orig) - end - - # Returns a hash of this TimeOrDateTime. - def hash - @orig.hash - end - - # If no block is given, returns a TimeOrDateTime wrapping the given - # timeOrDateTime. If a block is specified, a TimeOrDateTime is constructed - # and passed to the block. The result of the block must be a TimeOrDateTime. - # to_orig will be called on the result and the result of to_orig will be - # returned. - # - # timeOrDateTime can be a Time, DateTime, integer timestamp or TimeOrDateTime. - # If a TimeOrDateTime is passed in, no new TimeOrDateTime will be constructed, - # the passed in value will be used. - def self.wrap(timeOrDateTime) - t = timeOrDateTime.is_a?(TimeOrDateTime) ? timeOrDateTime : TimeOrDateTime.new(timeOrDateTime) - - if block_given? - t = yield t - - if timeOrDateTime.is_a?(TimeOrDateTime) - t - elsif timeOrDateTime.is_a?(Time) - t.to_time - elsif timeOrDateTime.is_a?(DateTime) - t.to_datetime - else - t.to_i - end - else - t - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb deleted file mode 100644 index ef4ecd8ae1..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb +++ /dev/null @@ -1,508 +0,0 @@ -#-- -# Copyright (c) 2005-2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'date' -# require 'tzinfo/country' -require 'tzinfo/time_or_datetime' -require 'tzinfo/timezone_period' - -module TZInfo - # Indicate a specified time in a local timezone has more than one - # possible time in UTC. This happens when switching from daylight savings time - # to normal time where the clocks are rolled back. Thrown by period_for_local - # and local_to_utc when using an ambiguous time and not specifying any - # means to resolve the ambiguity. - class AmbiguousTime < StandardError - end - - # Thrown to indicate that no TimezonePeriod matching a given time could be found. - class PeriodNotFound < StandardError - end - - # Thrown by Timezone#get if the identifier given is not valid. - class InvalidTimezoneIdentifier < StandardError - end - - # Thrown if an attempt is made to use a timezone created with Timezone.new(nil). - class UnknownTimezone < StandardError - end - - # Timezone is the base class of all timezones. It provides a factory method - # get to access timezones by identifier. Once a specific Timezone has been - # retrieved, DateTimes, Times and timestamps can be converted between the UTC - # and the local time for the zone. For example: - # - # tz = TZInfo::Timezone.get('America/New_York') - # puts tz.utc_to_local(DateTime.new(2005,8,29,15,35,0)).to_s - # puts tz.local_to_utc(Time.utc(2005,8,29,11,35,0)).to_s - # puts tz.utc_to_local(1125315300).to_s - # - # Each time conversion method returns an object of the same type it was - # passed. - # - # The timezone information all comes from the tz database - # (see http://www.twinsun.com/tz/tz-link.htm) - class Timezone - include Comparable - - # Cache of loaded zones by identifier to avoid using require if a zone - # has already been loaded. - @@loaded_zones = {} - - # Whether the timezones index has been loaded yet. - @@index_loaded = false - - # Returns a timezone by its identifier (e.g. "Europe/London", - # "America/Chicago" or "UTC"). - # - # Raises InvalidTimezoneIdentifier if the timezone couldn't be found. - def self.get(identifier) - instance = @@loaded_zones[identifier] - unless instance - raise InvalidTimezoneIdentifier, 'Invalid identifier' if identifier !~ /^[A-z0-9\+\-_]+(\/[A-z0-9\+\-_]+)*$/ - identifier = identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__') - begin - # Use a temporary variable to avoid an rdoc warning - file = "tzinfo/definitions/#{identifier}".untaint - require file - - m = Definitions - identifier.split(/\//).each {|part| - m = m.const_get(part) - } - - info = m.get - - # Could make Timezone subclasses register an interest in an info - # type. Since there are currently only two however, there isn't - # much point. - if info.kind_of?(DataTimezoneInfo) - instance = DataTimezone.new(info) - elsif info.kind_of?(LinkedTimezoneInfo) - instance = LinkedTimezone.new(info) - else - raise InvalidTimezoneIdentifier, "No handler for info type #{info.class}" - end - - @@loaded_zones[instance.identifier] = instance - rescue LoadError, NameError => e - raise InvalidTimezoneIdentifier, e.message - end - end - - instance - end - - # Returns a proxy for the Timezone with the given identifier. The proxy - # will cause the real timezone to be loaded when an attempt is made to - # find a period or convert a time. get_proxy will not validate the - # identifier. If an invalid identifier is specified, no exception will be - # raised until the proxy is used. - def self.get_proxy(identifier) - TimezoneProxy.new(identifier) - end - - # If identifier is nil calls super(), otherwise calls get. An identfier - # should always be passed in when called externally. - def self.new(identifier = nil) - if identifier - get(identifier) - else - super() - end - end - - # Returns an array containing all the available Timezones. - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all - get_proxies(all_identifiers) - end - - # Returns an array containing the identifiers of all the available - # Timezones. - def self.all_identifiers - load_index - Indexes::Timezones.timezones - end - - # Returns an array containing all the available Timezones that are based - # on data (are not links to other Timezones). - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all_data_zones - get_proxies(all_data_zone_identifiers) - end - - # Returns an array containing the identifiers of all the available - # Timezones that are based on data (are not links to other Timezones).. - def self.all_data_zone_identifiers - load_index - Indexes::Timezones.data_timezones - end - - # Returns an array containing all the available Timezones that are links - # to other Timezones. - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all_linked_zones - get_proxies(all_linked_zone_identifiers) - end - - # Returns an array containing the identifiers of all the available - # Timezones that are links to other Timezones. - def self.all_linked_zone_identifiers - load_index - Indexes::Timezones.linked_timezones - end - - # Returns all the Timezones defined for all Countries. This is not the - # complete set of Timezones as some are not country specific (e.g. - # 'Etc/GMT'). - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all_country_zones - Country.all_codes.inject([]) {|zones,country| - zones += Country.get(country).zones - } - end - - # Returns all the zone identifiers defined for all Countries. This is not the - # complete set of zone identifiers as some are not country specific (e.g. - # 'Etc/GMT'). You can obtain a Timezone instance for a given identifier - # with the get method. - def self.all_country_zone_identifiers - Country.all_codes.inject([]) {|zones,country| - zones += Country.get(country).zone_identifiers - } - end - - # Returns all US Timezone instances. A shortcut for - # TZInfo::Country.get('US').zones. - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.us_zones - Country.get('US').zones - end - - # Returns all US zone identifiers. A shortcut for - # TZInfo::Country.get('US').zone_identifiers. - def self.us_zone_identifiers - Country.get('US').zone_identifiers - end - - # The identifier of the timezone, e.g. "Europe/Paris". - def identifier - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' - end - - # An alias for identifier. - def name - # Don't use alias, as identifier gets overridden. - identifier - end - - # Returns a friendlier version of the identifier. - def to_s - friendly_identifier - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{identifier}>" - end - - # Returns a friendlier version of the identifier. Set skip_first_part to - # omit the first part of the identifier (typically a region name) where - # there is more than one part. - # - # For example: - # - # Timezone.get('Europe/Paris').friendly_identifier(false) #=> "Europe - Paris" - # Timezone.get('Europe/Paris').friendly_identifier(true) #=> "Paris" - # Timezone.get('America/Indiana/Knox').friendly_identifier(false) #=> "America - Knox, Indiana" - # Timezone.get('America/Indiana/Knox').friendly_identifier(true) #=> "Knox, Indiana" - def friendly_identifier(skip_first_part = false) - parts = identifier.split('/') - if parts.empty? - # shouldn't happen - identifier - elsif parts.length == 1 - parts[0] - else - if skip_first_part - result = '' - else - result = parts[0] + ' - ' - end - - parts[1, parts.length - 1].reverse_each {|part| - part.gsub!(/_/, ' ') - - if part.index(/[a-z]/) - # Missing a space if a lower case followed by an upper case and the - # name isn't McXxxx. - part.gsub!(/([^M][a-z])([A-Z])/, '\1 \2') - part.gsub!(/([M][a-bd-z])([A-Z])/, '\1 \2') - - # Missing an apostrophe if two consecutive upper case characters. - part.gsub!(/([A-Z])([A-Z])/, '\1\'\2') - end - - result << part - result << ', ' - } - - result.slice!(result.length - 2, 2) - result - end - end - - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - def period_for_utc(utc) - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how ambiguities should be resolved. - # Returns an empty array if no periods are found for the given time. - def periods_for_local(local) - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' - end - - # Returns the TimezonePeriod for the given local time. local can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in local is ignored (it is treated as a time in the current - # timezone). - # - # Warning: There are local times that have no equivalent UTC times (e.g. - # in the transition from standard time to daylight savings time). There are - # also local times that have more than one UTC equivalent (e.g. in the - # transition from daylight savings time to standard time). - # - # In the first case (no equivalent UTC time), a PeriodNotFound exception - # will be raised. - # - # In the second case (more than one equivalent UTC time), an AmbiguousTime - # exception will be raised unless the optional dst parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the dst parameter can be used to select whether the - # daylight savings time or local time is used. For example, - # - # Timezone.get('America/New_York').period_for_local(DateTime.new(2004,10,31,1,30,0)) - # - # would raise an AmbiguousTime exception. - # - # Specifying dst=true would the daylight savings period from April to - # October 2004. Specifying dst=false would return the standard period - # from October 2004 to April 2005. - # - # If the dst parameter does not resolve the ambiguity, and a block is - # specified, it is called. The block must take a single parameter - an - # array of the periods that need to be resolved. The block can select and - # return a single period or return nil or an empty array - # to cause an AmbiguousTime exception to be raised. - def period_for_local(local, dst = nil) - results = periods_for_local(local) - - if results.empty? - raise PeriodNotFound - elsif results.size < 2 - results.first - else - # ambiguous result try to resolve - - if !dst.nil? - matches = results.find_all {|period| period.dst? == dst} - results = matches if !matches.empty? - end - - if results.size < 2 - results.first - else - # still ambiguous, try the block - - if block_given? - results = yield results - end - - if results.is_a?(TimezonePeriod) - results - elsif results && results.size == 1 - results.first - else - raise AmbiguousTime, "#{local} is an ambiguous local time." - end - end - end - end - - # Converts a time in UTC to the local timezone. utc can either be - # a DateTime, Time or timestamp (Time.to_i). The returned time has the same - # type as utc. Any timezone information in utc is ignored (it is treated as - # a UTC time). - def utc_to_local(utc) - TimeOrDateTime.wrap(utc) {|wrapped| - period_for_utc(wrapped).to_local(wrapped) - } - end - - # Converts a time in the local timezone to UTC. local can either be - # a DateTime, Time or timestamp (Time.to_i). The returned time has the same - # type as local. Any timezone information in local is ignored (it is treated - # as a local time). - # - # Warning: There are local times that have no equivalent UTC times (e.g. - # in the transition from standard time to daylight savings time). There are - # also local times that have more than one UTC equivalent (e.g. in the - # transition from daylight savings time to standard time). - # - # In the first case (no equivalent UTC time), a PeriodNotFound exception - # will be raised. - # - # In the second case (more than one equivalent UTC time), an AmbiguousTime - # exception will be raised unless the optional dst parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the dst parameter can be used to select whether the - # daylight savings time or local time is used. For example, - # - # Timezone.get('America/New_York').local_to_utc(DateTime.new(2004,10,31,1,30,0)) - # - # would raise an AmbiguousTime exception. - # - # Specifying dst=true would return 2004-10-31 5:30:00. Specifying dst=false - # would return 2004-10-31 6:30:00. - # - # If the dst parameter does not resolve the ambiguity, and a block is - # specified, it is called. The block must take a single parameter - an - # array of the periods that need to be resolved. The block can return a - # single period to use to convert the time or return nil or an empty array - # to cause an AmbiguousTime exception to be raised. - def local_to_utc(local, dst = nil) - TimeOrDateTime.wrap(local) {|wrapped| - if block_given? - period = period_for_local(wrapped, dst) {|periods| yield periods } - else - period = period_for_local(wrapped, dst) - end - - period.to_utc(wrapped) - } - end - - # Returns the current time in the timezone as a Time. - def now - utc_to_local(Time.now.utc) - end - - # Returns the TimezonePeriod for the current time. - def current_period - period_for_utc(Time.now.utc) - end - - # Returns the current Time and TimezonePeriod as an array. The first element - # is the time, the second element is the period. - def current_period_and_time - utc = Time.now.utc - period = period_for_utc(utc) - [period.to_local(utc), period] - end - - alias :current_time_and_period :current_period_and_time - - # Converts a time in UTC to local time and returns it as a string - # according to the given format. The formatting is identical to - # Time.strftime and DateTime.strftime, except %Z is replaced with the - # timezone abbreviation for the specified time (for example, EST or EDT). - def strftime(format, utc = Time.now.utc) - period = period_for_utc(utc) - local = period.to_local(utc) - local = Time.at(local).utc unless local.kind_of?(Time) || local.kind_of?(DateTime) - abbreviation = period.abbreviation.to_s.gsub(/%/, '%%') - - format = format.gsub(/(.?)%Z/) do - if $1 == '%' - # return %%Z so the real strftime treats it as a literal %Z too - '%%Z' - else - "#$1#{abbreviation}" - end - end - - local.strftime(format) - end - - # Compares two Timezones based on their identifier. Returns -1 if tz is less - # than self, 0 if tz is equal to self and +1 if tz is greater than self. - def <=>(tz) - identifier <=> tz.identifier - end - - # Returns true if and only if the identifier of tz is equal to the - # identifier of this Timezone. - def eql?(tz) - self == tz - end - - # Returns a hash of this Timezone. - def hash - identifier.hash - end - - # Dumps this Timezone for marshalling. - def _dump(limit) - identifier - end - - # Loads a marshalled Timezone. - def self._load(data) - Timezone.get(data) - end - - private - # Loads in the index of timezones if it hasn't already been loaded. - def self.load_index - unless @@index_loaded - require 'tzinfo/indexes/timezones' - @@index_loaded = true - end - end - - # Returns an array of proxies corresponding to the given array of - # identifiers. - def self.get_proxies(identifiers) - identifiers.collect {|identifier| get_proxy(identifier)} - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb deleted file mode 100644 index 39ca8bfa53..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb +++ /dev/null @@ -1,56 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/data_timezone_info' -require 'tzinfo/linked_timezone_info' - -module TZInfo - - # TimezoneDefinition is included into Timezone definition modules. - # TimezoneDefinition provides the methods for defining timezones. - module TimezoneDefinition #:nodoc: - # Add class methods to the includee. - def self.append_features(base) - super - base.extend(ClassMethods) - end - - # Class methods for inclusion. - module ClassMethods #:nodoc: - # Returns and yields a DataTimezoneInfo object to define a timezone. - def timezone(identifier) - yield @timezone = DataTimezoneInfo.new(identifier) - end - - # Defines a linked timezone. - def linked_timezone(identifier, link_to_identifier) - @timezone = LinkedTimezoneInfo.new(identifier, link_to_identifier) - end - - # Returns the last TimezoneInfo to be defined with timezone or - # linked_timezone. - def get - @timezone - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb deleted file mode 100644 index 68e38c35fb..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb +++ /dev/null @@ -1,40 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -module TZInfo - # Represents a timezone defined in a data module. - class TimezoneInfo #:nodoc: - - # The timezone identifier. - attr_reader :identifier - - # Constructs a new TimezoneInfo with an identifier. - def initialize(identifier) - @identifier = identifier - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@identifier>" - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb deleted file mode 100644 index 6a0bbca46f..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb +++ /dev/null @@ -1,94 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -module TZInfo - # Represents an offset defined in a Timezone data file. - class TimezoneOffsetInfo #:nodoc: - # The base offset of the timezone from UTC in seconds. - attr_reader :utc_offset - - # The offset from standard time for the zone in seconds (i.e. non-zero if - # daylight savings is being observed). - attr_reader :std_offset - - # The total offset of this observance from UTC in seconds - # (utc_offset + std_offset). - attr_reader :utc_total_offset - - # The abbreviation that identifies this observance, e.g. "GMT" - # (Greenwich Mean Time) or "BST" (British Summer Time) for "Europe/London". The returned identifier is a - # symbol. - attr_reader :abbreviation - - # Constructs a new TimezoneOffsetInfo. utc_offset and std_offset are - # specified in seconds. - def initialize(utc_offset, std_offset, abbreviation) - @utc_offset = utc_offset - @std_offset = std_offset - @abbreviation = abbreviation - - @utc_total_offset = @utc_offset + @std_offset - end - - # True if std_offset is non-zero. - def dst? - @std_offset != 0 - end - - # Converts a UTC DateTime to local time based on the offset of this period. - def to_local(utc) - TimeOrDateTime.wrap(utc) {|wrapped| - wrapped + @utc_total_offset - } - end - - # Converts a local DateTime to UTC based on the offset of this period. - def to_utc(local) - TimeOrDateTime.wrap(local) {|wrapped| - wrapped - @utc_total_offset - } - end - - # Returns true if and only if toi has the same utc_offset, std_offset - # and abbreviation as this TimezoneOffsetInfo. - def ==(toi) - toi.respond_to?(:utc_offset) && toi.respond_to?(:std_offset) && toi.respond_to?(:abbreviation) && - utc_offset == toi.utc_offset && std_offset == toi.std_offset && abbreviation == toi.abbreviation - end - - # Returns true if and only if toi has the same utc_offset, std_offset - # and abbreviation as this TimezoneOffsetInfo. - def eql?(toi) - self == toi - end - - # Returns a hash of this TimezoneOffsetInfo. - def hash - utc_offset.hash ^ std_offset.hash ^ abbreviation.hash - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@utc_offset,#@std_offset,#@abbreviation>" - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb deleted file mode 100644 index 00888fcfdc..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb +++ /dev/null @@ -1,198 +0,0 @@ -#-- -# Copyright (c) 2005-2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/offset_rationals' -require 'tzinfo/time_or_datetime' - -module TZInfo - # A period of time in a timezone where the same offset from UTC applies. - # - # All the methods that take times accept instances of Time, DateTime or - # integer timestamps. - class TimezonePeriod - # The TimezoneTransitionInfo that defines the start of this TimezonePeriod - # (may be nil if unbounded). - attr_reader :start_transition - - # The TimezoneTransitionInfo that defines the end of this TimezonePeriod - # (may be nil if unbounded). - attr_reader :end_transition - - # The TimezoneOffsetInfo for this period. - attr_reader :offset - - # Initializes a new TimezonePeriod. - def initialize(start_transition, end_transition, offset = nil) - @start_transition = start_transition - @end_transition = end_transition - - if offset - raise ArgumentError, 'Offset specified with transitions' if @start_transition || @end_transition - @offset = offset - else - if @start_transition - @offset = @start_transition.offset - elsif @end_transition - @offset = @end_transition.previous_offset - else - raise ArgumentError, 'No offset specified and no transitions to determine it from' - end - end - - @utc_total_offset_rational = nil - end - - # Base offset of the timezone from UTC (seconds). - def utc_offset - @offset.utc_offset - end - - # Offset from the local time where daylight savings is in effect (seconds). - # E.g.: utc_offset could be -5 hours. Normally, std_offset would be 0. - # During daylight savings, std_offset would typically become +1 hours. - def std_offset - @offset.std_offset - end - - # The identifier of this period, e.g. "GMT" (Greenwich Mean Time) or "BST" - # (British Summer Time) for "Europe/London". The returned identifier is a - # symbol. - def abbreviation - @offset.abbreviation - end - alias :zone_identifier :abbreviation - - # Total offset from UTC (seconds). Equal to utc_offset + std_offset. - def utc_total_offset - @offset.utc_total_offset - end - - # Total offset from UTC (days). Result is a Rational. - def utc_total_offset_rational - unless @utc_total_offset_rational - @utc_total_offset_rational = OffsetRationals.rational_for_offset(utc_total_offset) - end - @utc_total_offset_rational - end - - # The start time of the period in UTC as a DateTime. May be nil if unbounded. - def utc_start - @start_transition ? @start_transition.at.to_datetime : nil - end - - # The end time of the period in UTC as a DateTime. May be nil if unbounded. - def utc_end - @end_transition ? @end_transition.at.to_datetime : nil - end - - # The start time of the period in local time as a DateTime. May be nil if - # unbounded. - def local_start - @start_transition ? @start_transition.local_start.to_datetime : nil - end - - # The end time of the period in local time as a DateTime. May be nil if - # unbounded. - def local_end - @end_transition ? @end_transition.local_end.to_datetime : nil - end - - # true if daylight savings is in effect for this period; otherwise false. - def dst? - @offset.dst? - end - - # true if this period is valid for the given UTC DateTime; otherwise false. - def valid_for_utc?(utc) - utc_after_start?(utc) && utc_before_end?(utc) - end - - # true if the given UTC DateTime is after the start of the period - # (inclusive); otherwise false. - def utc_after_start?(utc) - !@start_transition || @start_transition.at <= utc - end - - # true if the given UTC DateTime is before the end of the period - # (exclusive); otherwise false. - def utc_before_end?(utc) - !@end_transition || @end_transition.at > utc - end - - # true if this period is valid for the given local DateTime; otherwise false. - def valid_for_local?(local) - local_after_start?(local) && local_before_end?(local) - end - - # true if the given local DateTime is after the start of the period - # (inclusive); otherwise false. - def local_after_start?(local) - !@start_transition || @start_transition.local_start <= local - end - - # true if the given local DateTime is before the end of the period - # (exclusive); otherwise false. - def local_before_end?(local) - !@end_transition || @end_transition.local_end > local - end - - # Converts a UTC DateTime to local time based on the offset of this period. - def to_local(utc) - @offset.to_local(utc) - end - - # Converts a local DateTime to UTC based on the offset of this period. - def to_utc(local) - @offset.to_utc(local) - end - - # Returns true if this TimezonePeriod is equal to p. This compares the - # start_transition, end_transition and offset using ==. - def ==(p) - p.respond_to?(:start_transition) && p.respond_to?(:end_transition) && - p.respond_to?(:offset) && start_transition == p.start_transition && - end_transition == p.end_transition && offset == p.offset - end - - # Returns true if this TimezonePeriods is equal to p. This compares the - # start_transition, end_transition and offset using eql? - def eql?(p) - p.respond_to?(:start_transition) && p.respond_to?(:end_transition) && - p.respond_to?(:offset) && start_transition.eql?(p.start_transition) && - end_transition.eql?(p.end_transition) && offset.eql?(p.offset) - end - - # Returns a hash of this TimezonePeriod. - def hash - result = @start_transition.hash ^ @end_transition.hash - result ^= @offset.hash unless @start_transition || @end_transition - result - end - - # Returns internal object state as a programmer-readable string. - def inspect - result = "#<#{self.class}: #{@start_transition.inspect},#{@end_transition.inspect}" - result << ",#{@offset.inspect}>" unless @start_transition || @end_transition - result + '>' - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb deleted file mode 100644 index 6b0669cc4a..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb +++ /dev/null @@ -1,129 +0,0 @@ -#-- -# Copyright (c) 2006 Philip Ross -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'date' -require 'tzinfo/time_or_datetime' - -module TZInfo - # Represents an offset defined in a Timezone data file. - class TimezoneTransitionInfo #:nodoc: - # The offset this transition changes to (a TimezoneOffsetInfo instance). - attr_reader :offset - - # The offset this transition changes from (a TimezoneOffsetInfo instance). - attr_reader :previous_offset - - # The numerator of the DateTime if the transition time is defined as a - # DateTime, otherwise the transition time as a timestamp. - attr_reader :numerator_or_time - protected :numerator_or_time - - # Either the denominotor of the DateTime if the transition time is defined - # as a DateTime, otherwise nil. - attr_reader :denominator - protected :denominator - - # Creates a new TimezoneTransitionInfo with the given offset, - # previous_offset (both TimezoneOffsetInfo instances) and UTC time. - # if denominator is nil, numerator_or_time is treated as a number of - # seconds since the epoch. If denominator is specified numerator_or_time - # and denominator are used to create a DateTime as follows: - # - # DateTime.new!(Rational.send(:new!, numerator_or_time, denominator), 0, Date::ITALY) - # - # For performance reasons, the numerator and denominator must be specified - # in their lowest form. - def initialize(offset, previous_offset, numerator_or_time, denominator = nil) - @offset = offset - @previous_offset = previous_offset - @numerator_or_time = numerator_or_time - @denominator = denominator - - @at = nil - @local_end = nil - @local_start = nil - end - - # A TimeOrDateTime instance representing the UTC time when this transition - # occurs. - def at - unless @at - unless @denominator - @at = TimeOrDateTime.new(@numerator_or_time) - else - r = RubyCoreSupport.rational_new!(@numerator_or_time, @denominator) - dt = RubyCoreSupport.datetime_new!(r, 0, Date::ITALY) - @at = TimeOrDateTime.new(dt) - end - end - - @at - end - - # A TimeOrDateTime instance representing the local time when this transition - # causes the previous observance to end (calculated from at using - # previous_offset). - def local_end - @local_end = at.add_with_convert(@previous_offset.utc_total_offset) unless @local_end - @local_end - end - - # A TimeOrDateTime instance representing the local time when this transition - # causes the next observance to start (calculated from at using offset). - def local_start - @local_start = at.add_with_convert(@offset.utc_total_offset) unless @local_start - @local_start - end - - # Returns true if this TimezoneTransitionInfo is equal to the given - # TimezoneTransitionInfo. Two TimezoneTransitionInfo instances are - # considered to be equal by == if offset, previous_offset and at are all - # equal. - def ==(tti) - tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && tti.respond_to?(:at) && - offset == tti.offset && previous_offset == tti.previous_offset && at == tti.at - end - - # Returns true if this TimezoneTransitionInfo is equal to the given - # TimezoneTransitionInfo. Two TimezoneTransitionInfo instances are - # considered to be equal by eql? if offset, previous_offset, - # numerator_or_time and denominator are all equal. This is stronger than ==, - # which just requires the at times to be equal regardless of how they were - # originally specified. - def eql?(tti) - tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && - tti.respond_to?(:numerator_or_time) && tti.respond_to?(:denominator) && - offset == tti.offset && previous_offset == tti.previous_offset && - numerator_or_time == tti.numerator_or_time && denominator == tti.denominator - end - - # Returns a hash of this TimezoneTransitionInfo instance. - def hash - @offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{at.inspect},#{@offset.inspect}>" - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb new file mode 100644 index 0000000000..c8bdbeec5d --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb @@ -0,0 +1,33 @@ +#-- +# Copyright (c) 2005-2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +# Add the directory containing this file to the start of the load path if it +# isn't there already. +$:.unshift(File.dirname(__FILE__)) unless + $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) + +require 'tzinfo/timezone' +# require 'tzinfo/country' +# require 'tzinfo/tzdataparser' +# require 'tzinfo/timezone_proxy' +require 'tzinfo/data_timezone' +require 'tzinfo/linked_timezone' \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb new file mode 100644 index 0000000000..5eccbdf0db --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb @@ -0,0 +1,47 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/info_timezone' + +module TZInfo + + # A Timezone based on a DataTimezoneInfo. + class DataTimezone < InfoTimezone #:nodoc: + + # Returns the TimezonePeriod for the given UTC time. utc can either be + # a DateTime, Time or integer timestamp (Time.to_i). Any timezone + # information in utc is ignored (it is treated as a UTC time). + # + # If no TimezonePeriod could be found, PeriodNotFound is raised. + def period_for_utc(utc) + info.period_for_utc(utc) + end + + # Returns the set of TimezonePeriod instances that are valid for the given + # local time as an array. If you just want a single period, use + # period_for_local instead and specify how abiguities should be resolved. + # Raises PeriodNotFound if no periods are found for the given time. + def periods_for_local(local) + info.periods_for_local(local) + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb new file mode 100644 index 0000000000..a45d94554b --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb @@ -0,0 +1,228 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/time_or_datetime' +require 'tzinfo/timezone_info' +require 'tzinfo/timezone_offset_info' +require 'tzinfo/timezone_period' +require 'tzinfo/timezone_transition_info' + +module TZInfo + # Thrown if no offsets have been defined when calling period_for_utc or + # periods_for_local. Indicates an error in the timezone data. + class NoOffsetsDefined < StandardError + end + + # Represents a (non-linked) timezone defined in a data module. + class DataTimezoneInfo < TimezoneInfo #:nodoc: + + # Constructs a new TimezoneInfo with its identifier. + def initialize(identifier) + super(identifier) + @offsets = {} + @transitions = [] + @previous_offset = nil + @transitions_index = nil + end + + # Defines a offset. The id uniquely identifies this offset within the + # timezone. utc_offset and std_offset define the offset in seconds of + # standard time from UTC and daylight savings from standard time + # respectively. abbreviation describes the timezone offset (e.g. GMT, BST, + # EST or EDT). + # + # The first offset to be defined is treated as the offset that applies + # until the first transition. This will usually be in Local Mean Time (LMT). + # + # ArgumentError will be raised if the id is already defined. + def offset(id, utc_offset, std_offset, abbreviation) + raise ArgumentError, 'Offset already defined' if @offsets.has_key?(id) + + offset = TimezoneOffsetInfo.new(utc_offset, std_offset, abbreviation) + @offsets[id] = offset + @previous_offset = offset unless @previous_offset + end + + # Defines a transition. Transitions must be defined in chronological order. + # ArgumentError will be raised if a transition is added out of order. + # offset_id refers to an id defined with offset. ArgumentError will be + # raised if the offset_id cannot be found. numerator_or_time and + # denomiator specify the time the transition occurs as. See + # TimezoneTransitionInfo for more detail about specifying times. + def transition(year, month, offset_id, numerator_or_time, denominator = nil) + offset = @offsets[offset_id] + raise ArgumentError, 'Offset not found' unless offset + + if @transitions_index + if year < @last_year || (year == @last_year && month < @last_month) + raise ArgumentError, 'Transitions must be increasing date order' + end + + # Record the position of the first transition with this index. + index = transition_index(year, month) + @transitions_index[index] ||= @transitions.length + + # Fill in any gaps + (index - 1).downto(0) do |i| + break if @transitions_index[i] + @transitions_index[i] = @transitions.length + end + else + @transitions_index = [@transitions.length] + @start_year = year + @start_month = month + end + + @transitions << TimezoneTransitionInfo.new(offset, @previous_offset, + numerator_or_time, denominator) + @last_year = year + @last_month = month + @previous_offset = offset + end + + # Returns the TimezonePeriod for the given UTC time. + # Raises NoOffsetsDefined if no offsets have been defined. + def period_for_utc(utc) + unless @transitions.empty? + utc = TimeOrDateTime.wrap(utc) + index = transition_index(utc.year, utc.mon) + + start_transition = nil + start = transition_before_end(index) + if start + start.downto(0) do |i| + if @transitions[i].at <= utc + start_transition = @transitions[i] + break + end + end + end + + end_transition = nil + start = transition_after_start(index) + if start + start.upto(@transitions.length - 1) do |i| + if @transitions[i].at > utc + end_transition = @transitions[i] + break + end + end + end + + if start_transition || end_transition + TimezonePeriod.new(start_transition, end_transition) + else + # Won't happen since there are transitions. Must always find one + # transition that is either >= or < the specified time. + raise 'No transitions found in search' + end + else + raise NoOffsetsDefined, 'No offsets have been defined' unless @previous_offset + TimezonePeriod.new(nil, nil, @previous_offset) + end + end + + # Returns the set of TimezonePeriods for the given local time as an array. + # Results returned are ordered by increasing UTC start date. + # Returns an empty array if no periods are found for the given time. + # Raises NoOffsetsDefined if no offsets have been defined. + def periods_for_local(local) + unless @transitions.empty? + local = TimeOrDateTime.wrap(local) + index = transition_index(local.year, local.mon) + + result = [] + + start_index = transition_after_start(index - 1) + if start_index && @transitions[start_index].local_end > local + if start_index > 0 + if @transitions[start_index - 1].local_start <= local + result << TimezonePeriod.new(@transitions[start_index - 1], @transitions[start_index]) + end + else + result << TimezonePeriod.new(nil, @transitions[start_index]) + end + end + + end_index = transition_before_end(index + 1) + + if end_index + start_index = end_index unless start_index + + start_index.upto(transition_before_end(index + 1)) do |i| + if @transitions[i].local_start <= local + if i + 1 < @transitions.length + if @transitions[i + 1].local_end > local + result << TimezonePeriod.new(@transitions[i], @transitions[i + 1]) + end + else + result << TimezonePeriod.new(@transitions[i], nil) + end + end + end + end + + result + else + raise NoOffsetsDefined, 'No offsets have been defined' unless @previous_offset + [TimezonePeriod.new(nil, nil, @previous_offset)] + end + end + + private + # Returns the index into the @transitions_index array for a given year + # and month. + def transition_index(year, month) + index = (year - @start_year) * 2 + index += 1 if month > 6 + index -= 1 if @start_month > 6 + index + end + + # Returns the index into @transitions of the first transition that occurs + # on or after the start of the given index into @transitions_index. + # Returns nil if there are no such transitions. + def transition_after_start(index) + if index >= @transitions_index.length + nil + else + index = 0 if index < 0 + @transitions_index[index] + end + end + + # Returns the index into @transitions of the first transition that occurs + # before the end of the given index into @transitions_index. + # Returns nil if there are no such transitions. + def transition_before_end(index) + index = index + 1 + + if index <= 0 + nil + elsif index >= @transitions_index.length + @transitions.length - 1 + else + @transitions_index[index] - 1 + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb new file mode 100644 index 0000000000..8c5f25577f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb @@ -0,0 +1,55 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Algiers + include TimezoneDefinition + + timezone 'Africa/Algiers' do |tz| + tz.offset :o0, 732, 0, :LMT + tz.offset :o1, 561, 0, :PMT + tz.offset :o2, 0, 0, :WET + tz.offset :o3, 0, 3600, :WEST + tz.offset :o4, 3600, 0, :CET + tz.offset :o5, 3600, 3600, :CEST + + tz.transition 1891, 3, :o1, 2170625843, 900 + tz.transition 1911, 3, :o2, 69670267013, 28800 + tz.transition 1916, 6, :o3, 58104707, 24 + tz.transition 1916, 10, :o2, 58107323, 24 + tz.transition 1917, 3, :o3, 58111499, 24 + tz.transition 1917, 10, :o2, 58116227, 24 + tz.transition 1918, 3, :o3, 58119899, 24 + tz.transition 1918, 10, :o2, 58124963, 24 + tz.transition 1919, 3, :o3, 58128467, 24 + tz.transition 1919, 10, :o2, 58133699, 24 + tz.transition 1920, 2, :o3, 58136867, 24 + tz.transition 1920, 10, :o2, 58142915, 24 + tz.transition 1921, 3, :o3, 58146323, 24 + tz.transition 1921, 6, :o2, 58148699, 24 + tz.transition 1939, 9, :o3, 58308443, 24 + tz.transition 1939, 11, :o2, 4859173, 2 + tz.transition 1940, 2, :o4, 29156215, 12 + tz.transition 1944, 4, :o5, 58348405, 24 + tz.transition 1944, 10, :o4, 4862743, 2 + tz.transition 1945, 4, :o5, 58357141, 24 + tz.transition 1945, 9, :o4, 58361147, 24 + tz.transition 1946, 10, :o2, 58370411, 24 + tz.transition 1956, 1, :o4, 4871003, 2 + tz.transition 1963, 4, :o2, 58515203, 24 + tz.transition 1971, 4, :o3, 41468400 + tz.transition 1971, 9, :o2, 54774000 + tz.transition 1977, 5, :o3, 231724800 + tz.transition 1977, 10, :o4, 246236400 + tz.transition 1978, 3, :o5, 259545600 + tz.transition 1978, 9, :o4, 275274000 + tz.transition 1979, 10, :o2, 309740400 + tz.transition 1980, 4, :o3, 325468800 + tz.transition 1980, 10, :o2, 341802000 + tz.transition 1981, 5, :o4, 357523200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb new file mode 100644 index 0000000000..b7ed8e8244 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb @@ -0,0 +1,219 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Cairo + include TimezoneDefinition + + timezone 'Africa/Cairo' do |tz| + tz.offset :o0, 7500, 0, :LMT + tz.offset :o1, 7200, 0, :EET + tz.offset :o2, 7200, 3600, :EEST + + tz.transition 1900, 9, :o1, 695604503, 288 + tz.transition 1940, 7, :o2, 29157905, 12 + tz.transition 1940, 9, :o1, 19439227, 8 + tz.transition 1941, 4, :o2, 29161193, 12 + tz.transition 1941, 9, :o1, 19442027, 8 + tz.transition 1942, 3, :o2, 29165405, 12 + tz.transition 1942, 10, :o1, 19445275, 8 + tz.transition 1943, 3, :o2, 29169785, 12 + tz.transition 1943, 10, :o1, 19448235, 8 + tz.transition 1944, 3, :o2, 29174177, 12 + tz.transition 1944, 10, :o1, 19451163, 8 + tz.transition 1945, 4, :o2, 29178737, 12 + tz.transition 1945, 10, :o1, 19454083, 8 + tz.transition 1957, 5, :o2, 29231621, 12 + tz.transition 1957, 9, :o1, 19488899, 8 + tz.transition 1958, 4, :o2, 29235893, 12 + tz.transition 1958, 9, :o1, 19491819, 8 + tz.transition 1959, 4, :o2, 58480547, 24 + tz.transition 1959, 9, :o1, 4873683, 2 + tz.transition 1960, 4, :o2, 58489331, 24 + tz.transition 1960, 9, :o1, 4874415, 2 + tz.transition 1961, 4, :o2, 58498091, 24 + tz.transition 1961, 9, :o1, 4875145, 2 + tz.transition 1962, 4, :o2, 58506851, 24 + tz.transition 1962, 9, :o1, 4875875, 2 + tz.transition 1963, 4, :o2, 58515611, 24 + tz.transition 1963, 9, :o1, 4876605, 2 + tz.transition 1964, 4, :o2, 58524395, 24 + tz.transition 1964, 9, :o1, 4877337, 2 + tz.transition 1965, 4, :o2, 58533155, 24 + tz.transition 1965, 9, :o1, 4878067, 2 + tz.transition 1966, 4, :o2, 58541915, 24 + tz.transition 1966, 10, :o1, 4878799, 2 + tz.transition 1967, 4, :o2, 58550675, 24 + tz.transition 1967, 10, :o1, 4879529, 2 + tz.transition 1968, 4, :o2, 58559459, 24 + tz.transition 1968, 10, :o1, 4880261, 2 + tz.transition 1969, 4, :o2, 58568219, 24 + tz.transition 1969, 10, :o1, 4880991, 2 + tz.transition 1970, 4, :o2, 10364400 + tz.transition 1970, 10, :o1, 23587200 + tz.transition 1971, 4, :o2, 41900400 + tz.transition 1971, 10, :o1, 55123200 + tz.transition 1972, 4, :o2, 73522800 + tz.transition 1972, 10, :o1, 86745600 + tz.transition 1973, 4, :o2, 105058800 + tz.transition 1973, 10, :o1, 118281600 + tz.transition 1974, 4, :o2, 136594800 + tz.transition 1974, 10, :o1, 149817600 + tz.transition 1975, 4, :o2, 168130800 + tz.transition 1975, 10, :o1, 181353600 + tz.transition 1976, 4, :o2, 199753200 + tz.transition 1976, 10, :o1, 212976000 + tz.transition 1977, 4, :o2, 231289200 + tz.transition 1977, 10, :o1, 244512000 + tz.transition 1978, 4, :o2, 262825200 + tz.transition 1978, 10, :o1, 276048000 + tz.transition 1979, 4, :o2, 294361200 + tz.transition 1979, 10, :o1, 307584000 + tz.transition 1980, 4, :o2, 325983600 + tz.transition 1980, 10, :o1, 339206400 + tz.transition 1981, 4, :o2, 357519600 + tz.transition 1981, 10, :o1, 370742400 + tz.transition 1982, 7, :o2, 396399600 + tz.transition 1982, 10, :o1, 402278400 + tz.transition 1983, 7, :o2, 426812400 + tz.transition 1983, 10, :o1, 433814400 + tz.transition 1984, 4, :o2, 452214000 + tz.transition 1984, 10, :o1, 465436800 + tz.transition 1985, 4, :o2, 483750000 + tz.transition 1985, 10, :o1, 496972800 + tz.transition 1986, 4, :o2, 515286000 + tz.transition 1986, 10, :o1, 528508800 + tz.transition 1987, 4, :o2, 546822000 + tz.transition 1987, 10, :o1, 560044800 + tz.transition 1988, 4, :o2, 578444400 + tz.transition 1988, 10, :o1, 591667200 + tz.transition 1989, 5, :o2, 610412400 + tz.transition 1989, 10, :o1, 623203200 + tz.transition 1990, 4, :o2, 641516400 + tz.transition 1990, 10, :o1, 654739200 + tz.transition 1991, 4, :o2, 673052400 + tz.transition 1991, 10, :o1, 686275200 + tz.transition 1992, 4, :o2, 704674800 + tz.transition 1992, 10, :o1, 717897600 + tz.transition 1993, 4, :o2, 736210800 + tz.transition 1993, 10, :o1, 749433600 + tz.transition 1994, 4, :o2, 767746800 + tz.transition 1994, 10, :o1, 780969600 + tz.transition 1995, 4, :o2, 799020000 + tz.transition 1995, 9, :o1, 812322000 + tz.transition 1996, 4, :o2, 830469600 + tz.transition 1996, 9, :o1, 843771600 + tz.transition 1997, 4, :o2, 861919200 + tz.transition 1997, 9, :o1, 875221200 + tz.transition 1998, 4, :o2, 893368800 + tz.transition 1998, 9, :o1, 906670800 + tz.transition 1999, 4, :o2, 925423200 + tz.transition 1999, 9, :o1, 938725200 + tz.transition 2000, 4, :o2, 956872800 + tz.transition 2000, 9, :o1, 970174800 + tz.transition 2001, 4, :o2, 988322400 + tz.transition 2001, 9, :o1, 1001624400 + tz.transition 2002, 4, :o2, 1019772000 + tz.transition 2002, 9, :o1, 1033074000 + tz.transition 2003, 4, :o2, 1051221600 + tz.transition 2003, 9, :o1, 1064523600 + tz.transition 2004, 4, :o2, 1083276000 + tz.transition 2004, 9, :o1, 1096578000 + tz.transition 2005, 4, :o2, 1114725600 + tz.transition 2005, 9, :o1, 1128027600 + tz.transition 2006, 4, :o2, 1146175200 + tz.transition 2006, 9, :o1, 1158872400 + tz.transition 2007, 4, :o2, 1177624800 + tz.transition 2007, 9, :o1, 1189112400 + tz.transition 2008, 4, :o2, 1209074400 + tz.transition 2008, 8, :o1, 1219957200 + tz.transition 2009, 4, :o2, 1240524000 + tz.transition 2009, 8, :o1, 1250802000 + tz.transition 2010, 4, :o2, 1272578400 + tz.transition 2010, 9, :o1, 1285880400 + tz.transition 2011, 4, :o2, 1304028000 + tz.transition 2011, 9, :o1, 1317330000 + tz.transition 2012, 4, :o2, 1335477600 + tz.transition 2012, 9, :o1, 1348779600 + tz.transition 2013, 4, :o2, 1366927200 + tz.transition 2013, 9, :o1, 1380229200 + tz.transition 2014, 4, :o2, 1398376800 + tz.transition 2014, 9, :o1, 1411678800 + tz.transition 2015, 4, :o2, 1429826400 + tz.transition 2015, 9, :o1, 1443128400 + tz.transition 2016, 4, :o2, 1461880800 + tz.transition 2016, 9, :o1, 1475182800 + tz.transition 2017, 4, :o2, 1493330400 + tz.transition 2017, 9, :o1, 1506632400 + tz.transition 2018, 4, :o2, 1524780000 + tz.transition 2018, 9, :o1, 1538082000 + tz.transition 2019, 4, :o2, 1556229600 + tz.transition 2019, 9, :o1, 1569531600 + tz.transition 2020, 4, :o2, 1587679200 + tz.transition 2020, 9, :o1, 1600981200 + tz.transition 2021, 4, :o2, 1619733600 + tz.transition 2021, 9, :o1, 1633035600 + tz.transition 2022, 4, :o2, 1651183200 + tz.transition 2022, 9, :o1, 1664485200 + tz.transition 2023, 4, :o2, 1682632800 + tz.transition 2023, 9, :o1, 1695934800 + tz.transition 2024, 4, :o2, 1714082400 + tz.transition 2024, 9, :o1, 1727384400 + tz.transition 2025, 4, :o2, 1745532000 + tz.transition 2025, 9, :o1, 1758834000 + tz.transition 2026, 4, :o2, 1776981600 + tz.transition 2026, 9, :o1, 1790283600 + tz.transition 2027, 4, :o2, 1809036000 + tz.transition 2027, 9, :o1, 1822338000 + tz.transition 2028, 4, :o2, 1840485600 + tz.transition 2028, 9, :o1, 1853787600 + tz.transition 2029, 4, :o2, 1871935200 + tz.transition 2029, 9, :o1, 1885237200 + tz.transition 2030, 4, :o2, 1903384800 + tz.transition 2030, 9, :o1, 1916686800 + tz.transition 2031, 4, :o2, 1934834400 + tz.transition 2031, 9, :o1, 1948136400 + tz.transition 2032, 4, :o2, 1966888800 + tz.transition 2032, 9, :o1, 1980190800 + tz.transition 2033, 4, :o2, 1998338400 + tz.transition 2033, 9, :o1, 2011640400 + tz.transition 2034, 4, :o2, 2029788000 + tz.transition 2034, 9, :o1, 2043090000 + tz.transition 2035, 4, :o2, 2061237600 + tz.transition 2035, 9, :o1, 2074539600 + tz.transition 2036, 4, :o2, 2092687200 + tz.transition 2036, 9, :o1, 2105989200 + tz.transition 2037, 4, :o2, 2124136800 + tz.transition 2037, 9, :o1, 2137438800 + tz.transition 2038, 4, :o2, 29586521, 12 + tz.transition 2038, 9, :o1, 19725579, 8 + tz.transition 2039, 4, :o2, 29590889, 12 + tz.transition 2039, 9, :o1, 19728491, 8 + tz.transition 2040, 4, :o2, 29595257, 12 + tz.transition 2040, 9, :o1, 19731403, 8 + tz.transition 2041, 4, :o2, 29599625, 12 + tz.transition 2041, 9, :o1, 19734315, 8 + tz.transition 2042, 4, :o2, 29603993, 12 + tz.transition 2042, 9, :o1, 19737227, 8 + tz.transition 2043, 4, :o2, 29608361, 12 + tz.transition 2043, 9, :o1, 19740139, 8 + tz.transition 2044, 4, :o2, 29612813, 12 + tz.transition 2044, 9, :o1, 19743107, 8 + tz.transition 2045, 4, :o2, 29617181, 12 + tz.transition 2045, 9, :o1, 19746019, 8 + tz.transition 2046, 4, :o2, 29621549, 12 + tz.transition 2046, 9, :o1, 19748931, 8 + tz.transition 2047, 4, :o2, 29625917, 12 + tz.transition 2047, 9, :o1, 19751843, 8 + tz.transition 2048, 4, :o2, 29630285, 12 + tz.transition 2048, 9, :o1, 19754755, 8 + tz.transition 2049, 4, :o2, 29634737, 12 + tz.transition 2049, 9, :o1, 19757723, 8 + tz.transition 2050, 4, :o2, 29639105, 12 + tz.transition 2050, 9, :o1, 19760635, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb new file mode 100644 index 0000000000..18d73c93a0 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb @@ -0,0 +1,42 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Casablanca + include TimezoneDefinition + + timezone 'Africa/Casablanca' do |tz| + tz.offset :o0, -1820, 0, :LMT + tz.offset :o1, 0, 0, :WET + tz.offset :o2, 0, 3600, :WEST + tz.offset :o3, 3600, 0, :CET + + tz.transition 1913, 10, :o1, 10454687371, 4320 + tz.transition 1939, 9, :o2, 4859037, 2 + tz.transition 1939, 11, :o1, 58310075, 24 + tz.transition 1940, 2, :o2, 4859369, 2 + tz.transition 1945, 11, :o1, 58362659, 24 + tz.transition 1950, 6, :o2, 4866887, 2 + tz.transition 1950, 10, :o1, 58406003, 24 + tz.transition 1967, 6, :o2, 2439645, 1 + tz.transition 1967, 9, :o1, 58554347, 24 + tz.transition 1974, 6, :o2, 141264000 + tz.transition 1974, 8, :o1, 147222000 + tz.transition 1976, 5, :o2, 199756800 + tz.transition 1976, 7, :o1, 207702000 + tz.transition 1977, 5, :o2, 231292800 + tz.transition 1977, 9, :o1, 244249200 + tz.transition 1978, 6, :o2, 265507200 + tz.transition 1978, 8, :o1, 271033200 + tz.transition 1984, 3, :o3, 448243200 + tz.transition 1985, 12, :o1, 504918000 + tz.transition 2008, 6, :o2, 1212278400 + tz.transition 2008, 8, :o1, 1220223600 + tz.transition 2009, 6, :o2, 1243814400 + tz.transition 2009, 8, :o1, 1250809200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb new file mode 100644 index 0000000000..070c95ae0f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb @@ -0,0 +1,18 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Harare + include TimezoneDefinition + + timezone 'Africa/Harare' do |tz| + tz.offset :o0, 7452, 0, :LMT + tz.offset :o1, 7200, 0, :CAT + + tz.transition 1903, 2, :o1, 1932939531, 800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb new file mode 100644 index 0000000000..f0af0d8e33 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb @@ -0,0 +1,25 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Johannesburg + include TimezoneDefinition + + timezone 'Africa/Johannesburg' do |tz| + tz.offset :o0, 6720, 0, :LMT + tz.offset :o1, 5400, 0, :SAST + tz.offset :o2, 7200, 0, :SAST + tz.offset :o3, 7200, 3600, :SAST + + tz.transition 1892, 2, :o1, 108546139, 45 + tz.transition 1903, 2, :o2, 38658791, 16 + tz.transition 1942, 9, :o3, 4861245, 2 + tz.transition 1943, 3, :o2, 58339307, 24 + tz.transition 1943, 9, :o3, 4861973, 2 + tz.transition 1944, 3, :o2, 58348043, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb new file mode 100644 index 0000000000..40e711fa44 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb @@ -0,0 +1,22 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Monrovia + include TimezoneDefinition + + timezone 'Africa/Monrovia' do |tz| + tz.offset :o0, -2588, 0, :LMT + tz.offset :o1, -2588, 0, :MMT + tz.offset :o2, -2670, 0, :LRT + tz.offset :o3, 0, 0, :GMT + + tz.transition 1882, 1, :o1, 52022445047, 21600 + tz.transition 1919, 3, :o2, 52315600247, 21600 + tz.transition 1972, 5, :o3, 73529070 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb new file mode 100644 index 0000000000..7b0a2f43be --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb @@ -0,0 +1,23 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Africa + module Nairobi + include TimezoneDefinition + + timezone 'Africa/Nairobi' do |tz| + tz.offset :o0, 8836, 0, :LMT + tz.offset :o1, 10800, 0, :EAT + tz.offset :o2, 9000, 0, :BEAT + tz.offset :o3, 9885, 0, :BEAUT + + tz.transition 1928, 6, :o1, 52389253391, 21600 + tz.transition 1929, 12, :o2, 19407819, 8 + tz.transition 1939, 12, :o3, 116622211, 48 + tz.transition 1959, 12, :o1, 14036742061, 5760 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb new file mode 100644 index 0000000000..307f9546de --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb @@ -0,0 +1,84 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Argentina + module Buenos_Aires + include TimezoneDefinition + + timezone 'America/Argentina/Buenos_Aires' do |tz| + tz.offset :o0, -14028, 0, :LMT + tz.offset :o1, -15408, 0, :CMT + tz.offset :o2, -14400, 0, :ART + tz.offset :o3, -14400, 3600, :ARST + tz.offset :o4, -10800, 0, :ART + tz.offset :o5, -10800, 3600, :ARST + + tz.transition 1894, 10, :o1, 17374555169, 7200 + tz.transition 1920, 5, :o2, 1453467407, 600 + tz.transition 1930, 12, :o3, 7278935, 3 + tz.transition 1931, 4, :o2, 19411461, 8 + tz.transition 1931, 10, :o3, 7279889, 3 + tz.transition 1932, 3, :o2, 19414141, 8 + tz.transition 1932, 11, :o3, 7281038, 3 + tz.transition 1933, 3, :o2, 19417061, 8 + tz.transition 1933, 11, :o3, 7282133, 3 + tz.transition 1934, 3, :o2, 19419981, 8 + tz.transition 1934, 11, :o3, 7283228, 3 + tz.transition 1935, 3, :o2, 19422901, 8 + tz.transition 1935, 11, :o3, 7284323, 3 + tz.transition 1936, 3, :o2, 19425829, 8 + tz.transition 1936, 11, :o3, 7285421, 3 + tz.transition 1937, 3, :o2, 19428749, 8 + tz.transition 1937, 11, :o3, 7286516, 3 + tz.transition 1938, 3, :o2, 19431669, 8 + tz.transition 1938, 11, :o3, 7287611, 3 + tz.transition 1939, 3, :o2, 19434589, 8 + tz.transition 1939, 11, :o3, 7288706, 3 + tz.transition 1940, 3, :o2, 19437517, 8 + tz.transition 1940, 7, :o3, 7289435, 3 + tz.transition 1941, 6, :o2, 19441285, 8 + tz.transition 1941, 10, :o3, 7290848, 3 + tz.transition 1943, 8, :o2, 19447501, 8 + tz.transition 1943, 10, :o3, 7293038, 3 + tz.transition 1946, 3, :o2, 19455045, 8 + tz.transition 1946, 10, :o3, 7296284, 3 + tz.transition 1963, 10, :o2, 19506429, 8 + tz.transition 1963, 12, :o3, 7315136, 3 + tz.transition 1964, 3, :o2, 19507645, 8 + tz.transition 1964, 10, :o3, 7316051, 3 + tz.transition 1965, 3, :o2, 19510565, 8 + tz.transition 1965, 10, :o3, 7317146, 3 + tz.transition 1966, 3, :o2, 19513485, 8 + tz.transition 1966, 10, :o3, 7318241, 3 + tz.transition 1967, 4, :o2, 19516661, 8 + tz.transition 1967, 10, :o3, 7319294, 3 + tz.transition 1968, 4, :o2, 19519629, 8 + tz.transition 1968, 10, :o3, 7320407, 3 + tz.transition 1969, 4, :o2, 19522541, 8 + tz.transition 1969, 10, :o4, 7321499, 3 + tz.transition 1974, 1, :o5, 128142000 + tz.transition 1974, 5, :o4, 136605600 + tz.transition 1988, 12, :o5, 596948400 + tz.transition 1989, 3, :o4, 605066400 + tz.transition 1989, 10, :o5, 624423600 + tz.transition 1990, 3, :o4, 636516000 + tz.transition 1990, 10, :o5, 656478000 + tz.transition 1991, 3, :o4, 667965600 + tz.transition 1991, 10, :o5, 687927600 + tz.transition 1992, 3, :o4, 699415200 + tz.transition 1992, 10, :o5, 719377200 + tz.transition 1993, 3, :o4, 731469600 + tz.transition 1999, 10, :o3, 938919600 + tz.transition 2000, 3, :o4, 952052400 + tz.transition 2007, 12, :o5, 1198983600 + tz.transition 2008, 3, :o4, 1205632800 + tz.transition 2008, 10, :o5, 1224385200 + tz.transition 2009, 3, :o4, 1237082400 + end + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb new file mode 100644 index 0000000000..ba8be4705f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb @@ -0,0 +1,86 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Argentina + module San_Juan + include TimezoneDefinition + + timezone 'America/Argentina/San_Juan' do |tz| + tz.offset :o0, -16444, 0, :LMT + tz.offset :o1, -15408, 0, :CMT + tz.offset :o2, -14400, 0, :ART + tz.offset :o3, -14400, 3600, :ARST + tz.offset :o4, -10800, 0, :ART + tz.offset :o5, -10800, 3600, :ARST + tz.offset :o6, -14400, 0, :WART + + tz.transition 1894, 10, :o1, 52123666111, 21600 + tz.transition 1920, 5, :o2, 1453467407, 600 + tz.transition 1930, 12, :o3, 7278935, 3 + tz.transition 1931, 4, :o2, 19411461, 8 + tz.transition 1931, 10, :o3, 7279889, 3 + tz.transition 1932, 3, :o2, 19414141, 8 + tz.transition 1932, 11, :o3, 7281038, 3 + tz.transition 1933, 3, :o2, 19417061, 8 + tz.transition 1933, 11, :o3, 7282133, 3 + tz.transition 1934, 3, :o2, 19419981, 8 + tz.transition 1934, 11, :o3, 7283228, 3 + tz.transition 1935, 3, :o2, 19422901, 8 + tz.transition 1935, 11, :o3, 7284323, 3 + tz.transition 1936, 3, :o2, 19425829, 8 + tz.transition 1936, 11, :o3, 7285421, 3 + tz.transition 1937, 3, :o2, 19428749, 8 + tz.transition 1937, 11, :o3, 7286516, 3 + tz.transition 1938, 3, :o2, 19431669, 8 + tz.transition 1938, 11, :o3, 7287611, 3 + tz.transition 1939, 3, :o2, 19434589, 8 + tz.transition 1939, 11, :o3, 7288706, 3 + tz.transition 1940, 3, :o2, 19437517, 8 + tz.transition 1940, 7, :o3, 7289435, 3 + tz.transition 1941, 6, :o2, 19441285, 8 + tz.transition 1941, 10, :o3, 7290848, 3 + tz.transition 1943, 8, :o2, 19447501, 8 + tz.transition 1943, 10, :o3, 7293038, 3 + tz.transition 1946, 3, :o2, 19455045, 8 + tz.transition 1946, 10, :o3, 7296284, 3 + tz.transition 1963, 10, :o2, 19506429, 8 + tz.transition 1963, 12, :o3, 7315136, 3 + tz.transition 1964, 3, :o2, 19507645, 8 + tz.transition 1964, 10, :o3, 7316051, 3 + tz.transition 1965, 3, :o2, 19510565, 8 + tz.transition 1965, 10, :o3, 7317146, 3 + tz.transition 1966, 3, :o2, 19513485, 8 + tz.transition 1966, 10, :o3, 7318241, 3 + tz.transition 1967, 4, :o2, 19516661, 8 + tz.transition 1967, 10, :o3, 7319294, 3 + tz.transition 1968, 4, :o2, 19519629, 8 + tz.transition 1968, 10, :o3, 7320407, 3 + tz.transition 1969, 4, :o2, 19522541, 8 + tz.transition 1969, 10, :o4, 7321499, 3 + tz.transition 1974, 1, :o5, 128142000 + tz.transition 1974, 5, :o4, 136605600 + tz.transition 1988, 12, :o5, 596948400 + tz.transition 1989, 3, :o4, 605066400 + tz.transition 1989, 10, :o5, 624423600 + tz.transition 1990, 3, :o4, 636516000 + tz.transition 1990, 10, :o5, 656478000 + tz.transition 1991, 3, :o6, 667792800 + tz.transition 1991, 5, :o4, 673588800 + tz.transition 1991, 10, :o5, 687927600 + tz.transition 1992, 3, :o4, 699415200 + tz.transition 1992, 10, :o5, 719377200 + tz.transition 1993, 3, :o4, 731469600 + tz.transition 1999, 10, :o3, 938919600 + tz.transition 2000, 3, :o4, 952052400 + tz.transition 2004, 5, :o6, 1085972400 + tz.transition 2004, 7, :o4, 1090728000 + tz.transition 2007, 12, :o5, 1198983600 + tz.transition 2008, 3, :o4, 1205632800 + end + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb new file mode 100644 index 0000000000..ef96435c6a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb @@ -0,0 +1,23 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Bogota + include TimezoneDefinition + + timezone 'America/Bogota' do |tz| + tz.offset :o0, -17780, 0, :LMT + tz.offset :o1, -17780, 0, :BMT + tz.offset :o2, -18000, 0, :COT + tz.offset :o3, -18000, 3600, :COST + + tz.transition 1884, 3, :o1, 10407954409, 4320 + tz.transition 1914, 11, :o2, 10456385929, 4320 + tz.transition 1992, 5, :o3, 704869200 + tz.transition 1993, 4, :o2, 733896000 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb new file mode 100644 index 0000000000..27392a540a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb @@ -0,0 +1,23 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Caracas + include TimezoneDefinition + + timezone 'America/Caracas' do |tz| + tz.offset :o0, -16064, 0, :LMT + tz.offset :o1, -16060, 0, :CMT + tz.offset :o2, -16200, 0, :VET + tz.offset :o3, -14400, 0, :VET + + tz.transition 1890, 1, :o1, 1627673863, 675 + tz.transition 1912, 2, :o2, 10452001043, 4320 + tz.transition 1965, 1, :o3, 39020187, 16 + tz.transition 2007, 12, :o2, 1197183600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb new file mode 100644 index 0000000000..0996857cf0 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb @@ -0,0 +1,283 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Chicago + include TimezoneDefinition + + timezone 'America/Chicago' do |tz| + tz.offset :o0, -21036, 0, :LMT + tz.offset :o1, -21600, 0, :CST + tz.offset :o2, -21600, 3600, :CDT + tz.offset :o3, -18000, 0, :EST + tz.offset :o4, -21600, 3600, :CWT + tz.offset :o5, -21600, 3600, :CPT + + tz.transition 1883, 11, :o1, 9636533, 4 + tz.transition 1918, 3, :o2, 14530103, 6 + tz.transition 1918, 10, :o1, 58125451, 24 + tz.transition 1919, 3, :o2, 14532287, 6 + tz.transition 1919, 10, :o1, 58134187, 24 + tz.transition 1920, 6, :o2, 14534933, 6 + tz.transition 1920, 10, :o1, 58143091, 24 + tz.transition 1921, 3, :o2, 14536655, 6 + tz.transition 1921, 10, :o1, 58151827, 24 + tz.transition 1922, 4, :o2, 14539049, 6 + tz.transition 1922, 9, :o1, 58159723, 24 + tz.transition 1923, 4, :o2, 14541233, 6 + tz.transition 1923, 9, :o1, 58168627, 24 + tz.transition 1924, 4, :o2, 14543417, 6 + tz.transition 1924, 9, :o1, 58177363, 24 + tz.transition 1925, 4, :o2, 14545601, 6 + tz.transition 1925, 9, :o1, 58186099, 24 + tz.transition 1926, 4, :o2, 14547785, 6 + tz.transition 1926, 9, :o1, 58194835, 24 + tz.transition 1927, 4, :o2, 14549969, 6 + tz.transition 1927, 9, :o1, 58203571, 24 + tz.transition 1928, 4, :o2, 14552195, 6 + tz.transition 1928, 9, :o1, 58212475, 24 + tz.transition 1929, 4, :o2, 14554379, 6 + tz.transition 1929, 9, :o1, 58221211, 24 + tz.transition 1930, 4, :o2, 14556563, 6 + tz.transition 1930, 9, :o1, 58229947, 24 + tz.transition 1931, 4, :o2, 14558747, 6 + tz.transition 1931, 9, :o1, 58238683, 24 + tz.transition 1932, 4, :o2, 14560931, 6 + tz.transition 1932, 9, :o1, 58247419, 24 + tz.transition 1933, 4, :o2, 14563157, 6 + tz.transition 1933, 9, :o1, 58256155, 24 + tz.transition 1934, 4, :o2, 14565341, 6 + tz.transition 1934, 9, :o1, 58265059, 24 + tz.transition 1935, 4, :o2, 14567525, 6 + tz.transition 1935, 9, :o1, 58273795, 24 + tz.transition 1936, 3, :o3, 14569373, 6 + tz.transition 1936, 11, :o1, 58283707, 24 + tz.transition 1937, 4, :o2, 14571893, 6 + tz.transition 1937, 9, :o1, 58291267, 24 + tz.transition 1938, 4, :o2, 14574077, 6 + tz.transition 1938, 9, :o1, 58300003, 24 + tz.transition 1939, 4, :o2, 14576303, 6 + tz.transition 1939, 9, :o1, 58308739, 24 + tz.transition 1940, 4, :o2, 14578487, 6 + tz.transition 1940, 9, :o1, 58317643, 24 + tz.transition 1941, 4, :o2, 14580671, 6 + tz.transition 1941, 9, :o1, 58326379, 24 + tz.transition 1942, 2, :o4, 14582399, 6 + tz.transition 1945, 8, :o5, 58360379, 24 + tz.transition 1945, 9, :o1, 58361491, 24 + tz.transition 1946, 4, :o2, 14591633, 6 + tz.transition 1946, 9, :o1, 58370227, 24 + tz.transition 1947, 4, :o2, 14593817, 6 + tz.transition 1947, 9, :o1, 58378963, 24 + tz.transition 1948, 4, :o2, 14596001, 6 + tz.transition 1948, 9, :o1, 58387699, 24 + tz.transition 1949, 4, :o2, 14598185, 6 + tz.transition 1949, 9, :o1, 58396435, 24 + tz.transition 1950, 4, :o2, 14600411, 6 + tz.transition 1950, 9, :o1, 58405171, 24 + tz.transition 1951, 4, :o2, 14602595, 6 + tz.transition 1951, 9, :o1, 58414075, 24 + tz.transition 1952, 4, :o2, 14604779, 6 + tz.transition 1952, 9, :o1, 58422811, 24 + tz.transition 1953, 4, :o2, 14606963, 6 + tz.transition 1953, 9, :o1, 58431547, 24 + tz.transition 1954, 4, :o2, 14609147, 6 + tz.transition 1954, 9, :o1, 58440283, 24 + tz.transition 1955, 4, :o2, 14611331, 6 + tz.transition 1955, 10, :o1, 58449859, 24 + tz.transition 1956, 4, :o2, 14613557, 6 + tz.transition 1956, 10, :o1, 58458595, 24 + tz.transition 1957, 4, :o2, 14615741, 6 + tz.transition 1957, 10, :o1, 58467331, 24 + tz.transition 1958, 4, :o2, 14617925, 6 + tz.transition 1958, 10, :o1, 58476067, 24 + tz.transition 1959, 4, :o2, 14620109, 6 + tz.transition 1959, 10, :o1, 58484803, 24 + tz.transition 1960, 4, :o2, 14622293, 6 + tz.transition 1960, 10, :o1, 58493707, 24 + tz.transition 1961, 4, :o2, 14624519, 6 + tz.transition 1961, 10, :o1, 58502443, 24 + tz.transition 1962, 4, :o2, 14626703, 6 + tz.transition 1962, 10, :o1, 58511179, 24 + tz.transition 1963, 4, :o2, 14628887, 6 + tz.transition 1963, 10, :o1, 58519915, 24 + tz.transition 1964, 4, :o2, 14631071, 6 + tz.transition 1964, 10, :o1, 58528651, 24 + tz.transition 1965, 4, :o2, 14633255, 6 + tz.transition 1965, 10, :o1, 58537555, 24 + tz.transition 1966, 4, :o2, 14635439, 6 + tz.transition 1966, 10, :o1, 58546291, 24 + tz.transition 1967, 4, :o2, 14637665, 6 + tz.transition 1967, 10, :o1, 58555027, 24 + tz.transition 1968, 4, :o2, 14639849, 6 + tz.transition 1968, 10, :o1, 58563763, 24 + tz.transition 1969, 4, :o2, 14642033, 6 + tz.transition 1969, 10, :o1, 58572499, 24 + tz.transition 1970, 4, :o2, 9964800 + tz.transition 1970, 10, :o1, 25686000 + tz.transition 1971, 4, :o2, 41414400 + tz.transition 1971, 10, :o1, 57740400 + tz.transition 1972, 4, :o2, 73468800 + tz.transition 1972, 10, :o1, 89190000 + tz.transition 1973, 4, :o2, 104918400 + tz.transition 1973, 10, :o1, 120639600 + tz.transition 1974, 1, :o2, 126691200 + tz.transition 1974, 10, :o1, 152089200 + tz.transition 1975, 2, :o2, 162374400 + tz.transition 1975, 10, :o1, 183538800 + tz.transition 1976, 4, :o2, 199267200 + tz.transition 1976, 10, :o1, 215593200 + tz.transition 1977, 4, :o2, 230716800 + tz.transition 1977, 10, :o1, 247042800 + tz.transition 1978, 4, :o2, 262771200 + tz.transition 1978, 10, :o1, 278492400 + tz.transition 1979, 4, :o2, 294220800 + tz.transition 1979, 10, :o1, 309942000 + tz.transition 1980, 4, :o2, 325670400 + tz.transition 1980, 10, :o1, 341391600 + tz.transition 1981, 4, :o2, 357120000 + tz.transition 1981, 10, :o1, 372841200 + tz.transition 1982, 4, :o2, 388569600 + tz.transition 1982, 10, :o1, 404895600 + tz.transition 1983, 4, :o2, 420019200 + tz.transition 1983, 10, :o1, 436345200 + tz.transition 1984, 4, :o2, 452073600 + tz.transition 1984, 10, :o1, 467794800 + tz.transition 1985, 4, :o2, 483523200 + tz.transition 1985, 10, :o1, 499244400 + tz.transition 1986, 4, :o2, 514972800 + tz.transition 1986, 10, :o1, 530694000 + tz.transition 1987, 4, :o2, 544608000 + tz.transition 1987, 10, :o1, 562143600 + tz.transition 1988, 4, :o2, 576057600 + tz.transition 1988, 10, :o1, 594198000 + tz.transition 1989, 4, :o2, 607507200 + tz.transition 1989, 10, :o1, 625647600 + tz.transition 1990, 4, :o2, 638956800 + tz.transition 1990, 10, :o1, 657097200 + tz.transition 1991, 4, :o2, 671011200 + tz.transition 1991, 10, :o1, 688546800 + tz.transition 1992, 4, :o2, 702460800 + tz.transition 1992, 10, :o1, 719996400 + tz.transition 1993, 4, :o2, 733910400 + tz.transition 1993, 10, :o1, 752050800 + tz.transition 1994, 4, :o2, 765360000 + tz.transition 1994, 10, :o1, 783500400 + tz.transition 1995, 4, :o2, 796809600 + tz.transition 1995, 10, :o1, 814950000 + tz.transition 1996, 4, :o2, 828864000 + tz.transition 1996, 10, :o1, 846399600 + tz.transition 1997, 4, :o2, 860313600 + tz.transition 1997, 10, :o1, 877849200 + tz.transition 1998, 4, :o2, 891763200 + tz.transition 1998, 10, :o1, 909298800 + tz.transition 1999, 4, :o2, 923212800 + tz.transition 1999, 10, :o1, 941353200 + tz.transition 2000, 4, :o2, 954662400 + tz.transition 2000, 10, :o1, 972802800 + tz.transition 2001, 4, :o2, 986112000 + tz.transition 2001, 10, :o1, 1004252400 + tz.transition 2002, 4, :o2, 1018166400 + tz.transition 2002, 10, :o1, 1035702000 + tz.transition 2003, 4, :o2, 1049616000 + tz.transition 2003, 10, :o1, 1067151600 + tz.transition 2004, 4, :o2, 1081065600 + tz.transition 2004, 10, :o1, 1099206000 + tz.transition 2005, 4, :o2, 1112515200 + tz.transition 2005, 10, :o1, 1130655600 + tz.transition 2006, 4, :o2, 1143964800 + tz.transition 2006, 10, :o1, 1162105200 + tz.transition 2007, 3, :o2, 1173600000 + tz.transition 2007, 11, :o1, 1194159600 + tz.transition 2008, 3, :o2, 1205049600 + tz.transition 2008, 11, :o1, 1225609200 + tz.transition 2009, 3, :o2, 1236499200 + tz.transition 2009, 11, :o1, 1257058800 + tz.transition 2010, 3, :o2, 1268553600 + tz.transition 2010, 11, :o1, 1289113200 + tz.transition 2011, 3, :o2, 1300003200 + tz.transition 2011, 11, :o1, 1320562800 + tz.transition 2012, 3, :o2, 1331452800 + tz.transition 2012, 11, :o1, 1352012400 + tz.transition 2013, 3, :o2, 1362902400 + tz.transition 2013, 11, :o1, 1383462000 + tz.transition 2014, 3, :o2, 1394352000 + tz.transition 2014, 11, :o1, 1414911600 + tz.transition 2015, 3, :o2, 1425801600 + tz.transition 2015, 11, :o1, 1446361200 + tz.transition 2016, 3, :o2, 1457856000 + tz.transition 2016, 11, :o1, 1478415600 + tz.transition 2017, 3, :o2, 1489305600 + tz.transition 2017, 11, :o1, 1509865200 + tz.transition 2018, 3, :o2, 1520755200 + tz.transition 2018, 11, :o1, 1541314800 + tz.transition 2019, 3, :o2, 1552204800 + tz.transition 2019, 11, :o1, 1572764400 + tz.transition 2020, 3, :o2, 1583654400 + tz.transition 2020, 11, :o1, 1604214000 + tz.transition 2021, 3, :o2, 1615708800 + tz.transition 2021, 11, :o1, 1636268400 + tz.transition 2022, 3, :o2, 1647158400 + tz.transition 2022, 11, :o1, 1667718000 + tz.transition 2023, 3, :o2, 1678608000 + tz.transition 2023, 11, :o1, 1699167600 + tz.transition 2024, 3, :o2, 1710057600 + tz.transition 2024, 11, :o1, 1730617200 + tz.transition 2025, 3, :o2, 1741507200 + tz.transition 2025, 11, :o1, 1762066800 + tz.transition 2026, 3, :o2, 1772956800 + tz.transition 2026, 11, :o1, 1793516400 + tz.transition 2027, 3, :o2, 1805011200 + tz.transition 2027, 11, :o1, 1825570800 + tz.transition 2028, 3, :o2, 1836460800 + tz.transition 2028, 11, :o1, 1857020400 + tz.transition 2029, 3, :o2, 1867910400 + tz.transition 2029, 11, :o1, 1888470000 + tz.transition 2030, 3, :o2, 1899360000 + tz.transition 2030, 11, :o1, 1919919600 + tz.transition 2031, 3, :o2, 1930809600 + tz.transition 2031, 11, :o1, 1951369200 + tz.transition 2032, 3, :o2, 1962864000 + tz.transition 2032, 11, :o1, 1983423600 + tz.transition 2033, 3, :o2, 1994313600 + tz.transition 2033, 11, :o1, 2014873200 + tz.transition 2034, 3, :o2, 2025763200 + tz.transition 2034, 11, :o1, 2046322800 + tz.transition 2035, 3, :o2, 2057212800 + tz.transition 2035, 11, :o1, 2077772400 + tz.transition 2036, 3, :o2, 2088662400 + tz.transition 2036, 11, :o1, 2109222000 + tz.transition 2037, 3, :o2, 2120112000 + tz.transition 2037, 11, :o1, 2140671600 + tz.transition 2038, 3, :o2, 14792981, 6 + tz.transition 2038, 11, :o1, 59177635, 24 + tz.transition 2039, 3, :o2, 14795165, 6 + tz.transition 2039, 11, :o1, 59186371, 24 + tz.transition 2040, 3, :o2, 14797349, 6 + tz.transition 2040, 11, :o1, 59195107, 24 + tz.transition 2041, 3, :o2, 14799533, 6 + tz.transition 2041, 11, :o1, 59203843, 24 + tz.transition 2042, 3, :o2, 14801717, 6 + tz.transition 2042, 11, :o1, 59212579, 24 + tz.transition 2043, 3, :o2, 14803901, 6 + tz.transition 2043, 11, :o1, 59221315, 24 + tz.transition 2044, 3, :o2, 14806127, 6 + tz.transition 2044, 11, :o1, 59230219, 24 + tz.transition 2045, 3, :o2, 14808311, 6 + tz.transition 2045, 11, :o1, 59238955, 24 + tz.transition 2046, 3, :o2, 14810495, 6 + tz.transition 2046, 11, :o1, 59247691, 24 + tz.transition 2047, 3, :o2, 14812679, 6 + tz.transition 2047, 11, :o1, 59256427, 24 + tz.transition 2048, 3, :o2, 14814863, 6 + tz.transition 2048, 11, :o1, 59265163, 24 + tz.transition 2049, 3, :o2, 14817089, 6 + tz.transition 2049, 11, :o1, 59274067, 24 + tz.transition 2050, 3, :o2, 14819273, 6 + tz.transition 2050, 11, :o1, 59282803, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb new file mode 100644 index 0000000000..1710b57c79 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb @@ -0,0 +1,136 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Chihuahua + include TimezoneDefinition + + timezone 'America/Chihuahua' do |tz| + tz.offset :o0, -25460, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -21600, 0, :CST + tz.offset :o3, -21600, 3600, :CDT + tz.offset :o4, -25200, 3600, :MDT + + tz.transition 1922, 1, :o1, 58153339, 24 + tz.transition 1927, 6, :o2, 9700171, 4 + tz.transition 1930, 11, :o1, 9705183, 4 + tz.transition 1931, 5, :o2, 9705855, 4 + tz.transition 1931, 10, :o1, 9706463, 4 + tz.transition 1932, 4, :o2, 58243171, 24 + tz.transition 1996, 4, :o3, 828864000 + tz.transition 1996, 10, :o2, 846399600 + tz.transition 1997, 4, :o3, 860313600 + tz.transition 1997, 10, :o2, 877849200 + tz.transition 1998, 4, :o4, 891766800 + tz.transition 1998, 10, :o1, 909302400 + tz.transition 1999, 4, :o4, 923216400 + tz.transition 1999, 10, :o1, 941356800 + tz.transition 2000, 4, :o4, 954666000 + tz.transition 2000, 10, :o1, 972806400 + tz.transition 2001, 5, :o4, 989139600 + tz.transition 2001, 9, :o1, 1001836800 + tz.transition 2002, 4, :o4, 1018170000 + tz.transition 2002, 10, :o1, 1035705600 + tz.transition 2003, 4, :o4, 1049619600 + tz.transition 2003, 10, :o1, 1067155200 + tz.transition 2004, 4, :o4, 1081069200 + tz.transition 2004, 10, :o1, 1099209600 + tz.transition 2005, 4, :o4, 1112518800 + tz.transition 2005, 10, :o1, 1130659200 + tz.transition 2006, 4, :o4, 1143968400 + tz.transition 2006, 10, :o1, 1162108800 + tz.transition 2007, 4, :o4, 1175418000 + tz.transition 2007, 10, :o1, 1193558400 + tz.transition 2008, 4, :o4, 1207472400 + tz.transition 2008, 10, :o1, 1225008000 + tz.transition 2009, 4, :o4, 1238922000 + tz.transition 2009, 10, :o1, 1256457600 + tz.transition 2010, 4, :o4, 1270371600 + tz.transition 2010, 10, :o1, 1288512000 + tz.transition 2011, 4, :o4, 1301821200 + tz.transition 2011, 10, :o1, 1319961600 + tz.transition 2012, 4, :o4, 1333270800 + tz.transition 2012, 10, :o1, 1351411200 + tz.transition 2013, 4, :o4, 1365325200 + tz.transition 2013, 10, :o1, 1382860800 + tz.transition 2014, 4, :o4, 1396774800 + tz.transition 2014, 10, :o1, 1414310400 + tz.transition 2015, 4, :o4, 1428224400 + tz.transition 2015, 10, :o1, 1445760000 + tz.transition 2016, 4, :o4, 1459674000 + tz.transition 2016, 10, :o1, 1477814400 + tz.transition 2017, 4, :o4, 1491123600 + tz.transition 2017, 10, :o1, 1509264000 + tz.transition 2018, 4, :o4, 1522573200 + tz.transition 2018, 10, :o1, 1540713600 + tz.transition 2019, 4, :o4, 1554627600 + tz.transition 2019, 10, :o1, 1572163200 + tz.transition 2020, 4, :o4, 1586077200 + tz.transition 2020, 10, :o1, 1603612800 + tz.transition 2021, 4, :o4, 1617526800 + tz.transition 2021, 10, :o1, 1635667200 + tz.transition 2022, 4, :o4, 1648976400 + tz.transition 2022, 10, :o1, 1667116800 + tz.transition 2023, 4, :o4, 1680426000 + tz.transition 2023, 10, :o1, 1698566400 + tz.transition 2024, 4, :o4, 1712480400 + tz.transition 2024, 10, :o1, 1730016000 + tz.transition 2025, 4, :o4, 1743930000 + tz.transition 2025, 10, :o1, 1761465600 + tz.transition 2026, 4, :o4, 1775379600 + tz.transition 2026, 10, :o1, 1792915200 + tz.transition 2027, 4, :o4, 1806829200 + tz.transition 2027, 10, :o1, 1824969600 + tz.transition 2028, 4, :o4, 1838278800 + tz.transition 2028, 10, :o1, 1856419200 + tz.transition 2029, 4, :o4, 1869728400 + tz.transition 2029, 10, :o1, 1887868800 + tz.transition 2030, 4, :o4, 1901782800 + tz.transition 2030, 10, :o1, 1919318400 + tz.transition 2031, 4, :o4, 1933232400 + tz.transition 2031, 10, :o1, 1950768000 + tz.transition 2032, 4, :o4, 1964682000 + tz.transition 2032, 10, :o1, 1982822400 + tz.transition 2033, 4, :o4, 1996131600 + tz.transition 2033, 10, :o1, 2014272000 + tz.transition 2034, 4, :o4, 2027581200 + tz.transition 2034, 10, :o1, 2045721600 + tz.transition 2035, 4, :o4, 2059030800 + tz.transition 2035, 10, :o1, 2077171200 + tz.transition 2036, 4, :o4, 2091085200 + tz.transition 2036, 10, :o1, 2108620800 + tz.transition 2037, 4, :o4, 2122534800 + tz.transition 2037, 10, :o1, 2140070400 + tz.transition 2038, 4, :o4, 19724143, 8 + tz.transition 2038, 10, :o1, 14794367, 6 + tz.transition 2039, 4, :o4, 19727055, 8 + tz.transition 2039, 10, :o1, 14796551, 6 + tz.transition 2040, 4, :o4, 19729967, 8 + tz.transition 2040, 10, :o1, 14798735, 6 + tz.transition 2041, 4, :o4, 19732935, 8 + tz.transition 2041, 10, :o1, 14800919, 6 + tz.transition 2042, 4, :o4, 19735847, 8 + tz.transition 2042, 10, :o1, 14803103, 6 + tz.transition 2043, 4, :o4, 19738759, 8 + tz.transition 2043, 10, :o1, 14805287, 6 + tz.transition 2044, 4, :o4, 19741671, 8 + tz.transition 2044, 10, :o1, 14807513, 6 + tz.transition 2045, 4, :o4, 19744583, 8 + tz.transition 2045, 10, :o1, 14809697, 6 + tz.transition 2046, 4, :o4, 19747495, 8 + tz.transition 2046, 10, :o1, 14811881, 6 + tz.transition 2047, 4, :o4, 19750463, 8 + tz.transition 2047, 10, :o1, 14814065, 6 + tz.transition 2048, 4, :o4, 19753375, 8 + tz.transition 2048, 10, :o1, 14816249, 6 + tz.transition 2049, 4, :o4, 19756287, 8 + tz.transition 2049, 10, :o1, 14818475, 6 + tz.transition 2050, 4, :o4, 19759199, 8 + tz.transition 2050, 10, :o1, 14820659, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb new file mode 100644 index 0000000000..1c1efb5ff3 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb @@ -0,0 +1,204 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Denver + include TimezoneDefinition + + timezone 'America/Denver' do |tz| + tz.offset :o0, -25196, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -25200, 3600, :MDT + tz.offset :o3, -25200, 3600, :MWT + tz.offset :o4, -25200, 3600, :MPT + + tz.transition 1883, 11, :o1, 57819199, 24 + tz.transition 1918, 3, :o2, 19373471, 8 + tz.transition 1918, 10, :o1, 14531363, 6 + tz.transition 1919, 3, :o2, 19376383, 8 + tz.transition 1919, 10, :o1, 14533547, 6 + tz.transition 1920, 3, :o2, 19379295, 8 + tz.transition 1920, 10, :o1, 14535773, 6 + tz.transition 1921, 3, :o2, 19382207, 8 + tz.transition 1921, 5, :o1, 14536991, 6 + tz.transition 1942, 2, :o3, 19443199, 8 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 14590373, 6 + tz.transition 1965, 4, :o2, 19511007, 8 + tz.transition 1965, 10, :o1, 14634389, 6 + tz.transition 1966, 4, :o2, 19513919, 8 + tz.transition 1966, 10, :o1, 14636573, 6 + tz.transition 1967, 4, :o2, 19516887, 8 + tz.transition 1967, 10, :o1, 14638757, 6 + tz.transition 1968, 4, :o2, 19519799, 8 + tz.transition 1968, 10, :o1, 14640941, 6 + tz.transition 1969, 4, :o2, 19522711, 8 + tz.transition 1969, 10, :o1, 14643125, 6 + tz.transition 1970, 4, :o2, 9968400 + tz.transition 1970, 10, :o1, 25689600 + tz.transition 1971, 4, :o2, 41418000 + tz.transition 1971, 10, :o1, 57744000 + tz.transition 1972, 4, :o2, 73472400 + tz.transition 1972, 10, :o1, 89193600 + tz.transition 1973, 4, :o2, 104922000 + tz.transition 1973, 10, :o1, 120643200 + tz.transition 1974, 1, :o2, 126694800 + tz.transition 1974, 10, :o1, 152092800 + tz.transition 1975, 2, :o2, 162378000 + tz.transition 1975, 10, :o1, 183542400 + tz.transition 1976, 4, :o2, 199270800 + tz.transition 1976, 10, :o1, 215596800 + tz.transition 1977, 4, :o2, 230720400 + tz.transition 1977, 10, :o1, 247046400 + tz.transition 1978, 4, :o2, 262774800 + tz.transition 1978, 10, :o1, 278496000 + tz.transition 1979, 4, :o2, 294224400 + tz.transition 1979, 10, :o1, 309945600 + tz.transition 1980, 4, :o2, 325674000 + tz.transition 1980, 10, :o1, 341395200 + tz.transition 1981, 4, :o2, 357123600 + tz.transition 1981, 10, :o1, 372844800 + tz.transition 1982, 4, :o2, 388573200 + tz.transition 1982, 10, :o1, 404899200 + tz.transition 1983, 4, :o2, 420022800 + tz.transition 1983, 10, :o1, 436348800 + tz.transition 1984, 4, :o2, 452077200 + tz.transition 1984, 10, :o1, 467798400 + tz.transition 1985, 4, :o2, 483526800 + tz.transition 1985, 10, :o1, 499248000 + tz.transition 1986, 4, :o2, 514976400 + tz.transition 1986, 10, :o1, 530697600 + tz.transition 1987, 4, :o2, 544611600 + tz.transition 1987, 10, :o1, 562147200 + tz.transition 1988, 4, :o2, 576061200 + tz.transition 1988, 10, :o1, 594201600 + tz.transition 1989, 4, :o2, 607510800 + tz.transition 1989, 10, :o1, 625651200 + tz.transition 1990, 4, :o2, 638960400 + tz.transition 1990, 10, :o1, 657100800 + tz.transition 1991, 4, :o2, 671014800 + tz.transition 1991, 10, :o1, 688550400 + tz.transition 1992, 4, :o2, 702464400 + tz.transition 1992, 10, :o1, 720000000 + tz.transition 1993, 4, :o2, 733914000 + tz.transition 1993, 10, :o1, 752054400 + tz.transition 1994, 4, :o2, 765363600 + tz.transition 1994, 10, :o1, 783504000 + tz.transition 1995, 4, :o2, 796813200 + tz.transition 1995, 10, :o1, 814953600 + tz.transition 1996, 4, :o2, 828867600 + tz.transition 1996, 10, :o1, 846403200 + tz.transition 1997, 4, :o2, 860317200 + tz.transition 1997, 10, :o1, 877852800 + tz.transition 1998, 4, :o2, 891766800 + tz.transition 1998, 10, :o1, 909302400 + tz.transition 1999, 4, :o2, 923216400 + tz.transition 1999, 10, :o1, 941356800 + tz.transition 2000, 4, :o2, 954666000 + tz.transition 2000, 10, :o1, 972806400 + tz.transition 2001, 4, :o2, 986115600 + tz.transition 2001, 10, :o1, 1004256000 + tz.transition 2002, 4, :o2, 1018170000 + tz.transition 2002, 10, :o1, 1035705600 + tz.transition 2003, 4, :o2, 1049619600 + tz.transition 2003, 10, :o1, 1067155200 + tz.transition 2004, 4, :o2, 1081069200 + tz.transition 2004, 10, :o1, 1099209600 + tz.transition 2005, 4, :o2, 1112518800 + tz.transition 2005, 10, :o1, 1130659200 + tz.transition 2006, 4, :o2, 1143968400 + tz.transition 2006, 10, :o1, 1162108800 + tz.transition 2007, 3, :o2, 1173603600 + tz.transition 2007, 11, :o1, 1194163200 + tz.transition 2008, 3, :o2, 1205053200 + tz.transition 2008, 11, :o1, 1225612800 + tz.transition 2009, 3, :o2, 1236502800 + tz.transition 2009, 11, :o1, 1257062400 + tz.transition 2010, 3, :o2, 1268557200 + tz.transition 2010, 11, :o1, 1289116800 + tz.transition 2011, 3, :o2, 1300006800 + tz.transition 2011, 11, :o1, 1320566400 + tz.transition 2012, 3, :o2, 1331456400 + tz.transition 2012, 11, :o1, 1352016000 + tz.transition 2013, 3, :o2, 1362906000 + tz.transition 2013, 11, :o1, 1383465600 + tz.transition 2014, 3, :o2, 1394355600 + tz.transition 2014, 11, :o1, 1414915200 + tz.transition 2015, 3, :o2, 1425805200 + tz.transition 2015, 11, :o1, 1446364800 + tz.transition 2016, 3, :o2, 1457859600 + tz.transition 2016, 11, :o1, 1478419200 + tz.transition 2017, 3, :o2, 1489309200 + tz.transition 2017, 11, :o1, 1509868800 + tz.transition 2018, 3, :o2, 1520758800 + tz.transition 2018, 11, :o1, 1541318400 + tz.transition 2019, 3, :o2, 1552208400 + tz.transition 2019, 11, :o1, 1572768000 + tz.transition 2020, 3, :o2, 1583658000 + tz.transition 2020, 11, :o1, 1604217600 + tz.transition 2021, 3, :o2, 1615712400 + tz.transition 2021, 11, :o1, 1636272000 + tz.transition 2022, 3, :o2, 1647162000 + tz.transition 2022, 11, :o1, 1667721600 + tz.transition 2023, 3, :o2, 1678611600 + tz.transition 2023, 11, :o1, 1699171200 + tz.transition 2024, 3, :o2, 1710061200 + tz.transition 2024, 11, :o1, 1730620800 + tz.transition 2025, 3, :o2, 1741510800 + tz.transition 2025, 11, :o1, 1762070400 + tz.transition 2026, 3, :o2, 1772960400 + tz.transition 2026, 11, :o1, 1793520000 + tz.transition 2027, 3, :o2, 1805014800 + tz.transition 2027, 11, :o1, 1825574400 + tz.transition 2028, 3, :o2, 1836464400 + tz.transition 2028, 11, :o1, 1857024000 + tz.transition 2029, 3, :o2, 1867914000 + tz.transition 2029, 11, :o1, 1888473600 + tz.transition 2030, 3, :o2, 1899363600 + tz.transition 2030, 11, :o1, 1919923200 + tz.transition 2031, 3, :o2, 1930813200 + tz.transition 2031, 11, :o1, 1951372800 + tz.transition 2032, 3, :o2, 1962867600 + tz.transition 2032, 11, :o1, 1983427200 + tz.transition 2033, 3, :o2, 1994317200 + tz.transition 2033, 11, :o1, 2014876800 + tz.transition 2034, 3, :o2, 2025766800 + tz.transition 2034, 11, :o1, 2046326400 + tz.transition 2035, 3, :o2, 2057216400 + tz.transition 2035, 11, :o1, 2077776000 + tz.transition 2036, 3, :o2, 2088666000 + tz.transition 2036, 11, :o1, 2109225600 + tz.transition 2037, 3, :o2, 2120115600 + tz.transition 2037, 11, :o1, 2140675200 + tz.transition 2038, 3, :o2, 19723975, 8 + tz.transition 2038, 11, :o1, 14794409, 6 + tz.transition 2039, 3, :o2, 19726887, 8 + tz.transition 2039, 11, :o1, 14796593, 6 + tz.transition 2040, 3, :o2, 19729799, 8 + tz.transition 2040, 11, :o1, 14798777, 6 + tz.transition 2041, 3, :o2, 19732711, 8 + tz.transition 2041, 11, :o1, 14800961, 6 + tz.transition 2042, 3, :o2, 19735623, 8 + tz.transition 2042, 11, :o1, 14803145, 6 + tz.transition 2043, 3, :o2, 19738535, 8 + tz.transition 2043, 11, :o1, 14805329, 6 + tz.transition 2044, 3, :o2, 19741503, 8 + tz.transition 2044, 11, :o1, 14807555, 6 + tz.transition 2045, 3, :o2, 19744415, 8 + tz.transition 2045, 11, :o1, 14809739, 6 + tz.transition 2046, 3, :o2, 19747327, 8 + tz.transition 2046, 11, :o1, 14811923, 6 + tz.transition 2047, 3, :o2, 19750239, 8 + tz.transition 2047, 11, :o1, 14814107, 6 + tz.transition 2048, 3, :o2, 19753151, 8 + tz.transition 2048, 11, :o1, 14816291, 6 + tz.transition 2049, 3, :o2, 19756119, 8 + tz.transition 2049, 11, :o1, 14818517, 6 + tz.transition 2050, 3, :o2, 19759031, 8 + tz.transition 2050, 11, :o1, 14820701, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb new file mode 100644 index 0000000000..1e05518b0d --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb @@ -0,0 +1,161 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Godthab + include TimezoneDefinition + + timezone 'America/Godthab' do |tz| + tz.offset :o0, -12416, 0, :LMT + tz.offset :o1, -10800, 0, :WGT + tz.offset :o2, -10800, 3600, :WGST + + tz.transition 1916, 7, :o1, 3268448069, 1350 + tz.transition 1980, 4, :o2, 323845200 + tz.transition 1980, 9, :o1, 338950800 + tz.transition 1981, 3, :o2, 354675600 + tz.transition 1981, 9, :o1, 370400400 + tz.transition 1982, 3, :o2, 386125200 + tz.transition 1982, 9, :o1, 401850000 + tz.transition 1983, 3, :o2, 417574800 + tz.transition 1983, 9, :o1, 433299600 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 9, :o1, 465354000 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 9, :o1, 496803600 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 9, :o1, 528253200 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 9, :o1, 559702800 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 9, :o1, 591152400 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 9, :o1, 622602000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 9, :o1, 654656400 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 9, :o1, 686106000 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 9, :o1, 717555600 + tz.transition 1993, 3, :o2, 733280400 + tz.transition 1993, 9, :o1, 749005200 + tz.transition 1994, 3, :o2, 764730000 + tz.transition 1994, 9, :o1, 780454800 + tz.transition 1995, 3, :o2, 796179600 + tz.transition 1995, 9, :o1, 811904400 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb new file mode 100644 index 0000000000..a2bf73401c --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb @@ -0,0 +1,27 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Guatemala + include TimezoneDefinition + + timezone 'America/Guatemala' do |tz| + tz.offset :o0, -21724, 0, :LMT + tz.offset :o1, -21600, 0, :CST + tz.offset :o2, -21600, 3600, :CDT + + tz.transition 1918, 10, :o1, 52312429831, 21600 + tz.transition 1973, 11, :o2, 123055200 + tz.transition 1974, 2, :o1, 130914000 + tz.transition 1983, 5, :o2, 422344800 + tz.transition 1983, 9, :o1, 433054800 + tz.transition 1991, 3, :o2, 669708000 + tz.transition 1991, 9, :o1, 684219600 + tz.transition 2006, 4, :o2, 1146376800 + tz.transition 2006, 10, :o1, 1159678800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb new file mode 100644 index 0000000000..d25ae775b3 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb @@ -0,0 +1,274 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Halifax + include TimezoneDefinition + + timezone 'America/Halifax' do |tz| + tz.offset :o0, -15264, 0, :LMT + tz.offset :o1, -14400, 0, :AST + tz.offset :o2, -14400, 3600, :ADT + tz.offset :o3, -14400, 3600, :AWT + tz.offset :o4, -14400, 3600, :APT + + tz.transition 1902, 6, :o1, 724774703, 300 + tz.transition 1916, 4, :o2, 7262864, 3 + tz.transition 1916, 10, :o1, 19369101, 8 + tz.transition 1918, 4, :o2, 9686791, 4 + tz.transition 1918, 10, :o1, 58125545, 24 + tz.transition 1920, 5, :o2, 7267361, 3 + tz.transition 1920, 8, :o1, 19380525, 8 + tz.transition 1921, 5, :o2, 7268447, 3 + tz.transition 1921, 9, :o1, 19383501, 8 + tz.transition 1922, 4, :o2, 7269524, 3 + tz.transition 1922, 9, :o1, 19386421, 8 + tz.transition 1923, 5, :o2, 7270637, 3 + tz.transition 1923, 9, :o1, 19389333, 8 + tz.transition 1924, 5, :o2, 7271729, 3 + tz.transition 1924, 9, :o1, 19392349, 8 + tz.transition 1925, 5, :o2, 7272821, 3 + tz.transition 1925, 9, :o1, 19395373, 8 + tz.transition 1926, 5, :o2, 7273955, 3 + tz.transition 1926, 9, :o1, 19398173, 8 + tz.transition 1927, 5, :o2, 7275005, 3 + tz.transition 1927, 9, :o1, 19401197, 8 + tz.transition 1928, 5, :o2, 7276139, 3 + tz.transition 1928, 9, :o1, 19403989, 8 + tz.transition 1929, 5, :o2, 7277231, 3 + tz.transition 1929, 9, :o1, 19406861, 8 + tz.transition 1930, 5, :o2, 7278323, 3 + tz.transition 1930, 9, :o1, 19409877, 8 + tz.transition 1931, 5, :o2, 7279415, 3 + tz.transition 1931, 9, :o1, 19412901, 8 + tz.transition 1932, 5, :o2, 7280486, 3 + tz.transition 1932, 9, :o1, 19415813, 8 + tz.transition 1933, 4, :o2, 7281578, 3 + tz.transition 1933, 10, :o1, 19418781, 8 + tz.transition 1934, 5, :o2, 7282733, 3 + tz.transition 1934, 9, :o1, 19421573, 8 + tz.transition 1935, 6, :o2, 7283867, 3 + tz.transition 1935, 9, :o1, 19424605, 8 + tz.transition 1936, 6, :o2, 7284962, 3 + tz.transition 1936, 9, :o1, 19427405, 8 + tz.transition 1937, 5, :o2, 7285967, 3 + tz.transition 1937, 9, :o1, 19430429, 8 + tz.transition 1938, 5, :o2, 7287059, 3 + tz.transition 1938, 9, :o1, 19433341, 8 + tz.transition 1939, 5, :o2, 7288235, 3 + tz.transition 1939, 9, :o1, 19436253, 8 + tz.transition 1940, 5, :o2, 7289264, 3 + tz.transition 1940, 9, :o1, 19439221, 8 + tz.transition 1941, 5, :o2, 7290356, 3 + tz.transition 1941, 9, :o1, 19442133, 8 + tz.transition 1942, 2, :o3, 9721599, 4 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 58361489, 24 + tz.transition 1946, 4, :o2, 9727755, 4 + tz.transition 1946, 9, :o1, 58370225, 24 + tz.transition 1947, 4, :o2, 9729211, 4 + tz.transition 1947, 9, :o1, 58378961, 24 + tz.transition 1948, 4, :o2, 9730667, 4 + tz.transition 1948, 9, :o1, 58387697, 24 + tz.transition 1949, 4, :o2, 9732123, 4 + tz.transition 1949, 9, :o1, 58396433, 24 + tz.transition 1951, 4, :o2, 9735063, 4 + tz.transition 1951, 9, :o1, 58414073, 24 + tz.transition 1952, 4, :o2, 9736519, 4 + tz.transition 1952, 9, :o1, 58422809, 24 + tz.transition 1953, 4, :o2, 9737975, 4 + tz.transition 1953, 9, :o1, 58431545, 24 + tz.transition 1954, 4, :o2, 9739431, 4 + tz.transition 1954, 9, :o1, 58440281, 24 + tz.transition 1956, 4, :o2, 9742371, 4 + tz.transition 1956, 9, :o1, 58457921, 24 + tz.transition 1957, 4, :o2, 9743827, 4 + tz.transition 1957, 9, :o1, 58466657, 24 + tz.transition 1958, 4, :o2, 9745283, 4 + tz.transition 1958, 9, :o1, 58475393, 24 + tz.transition 1959, 4, :o2, 9746739, 4 + tz.transition 1959, 9, :o1, 58484129, 24 + tz.transition 1962, 4, :o2, 9751135, 4 + tz.transition 1962, 10, :o1, 58511177, 24 + tz.transition 1963, 4, :o2, 9752591, 4 + tz.transition 1963, 10, :o1, 58519913, 24 + tz.transition 1964, 4, :o2, 9754047, 4 + tz.transition 1964, 10, :o1, 58528649, 24 + tz.transition 1965, 4, :o2, 9755503, 4 + tz.transition 1965, 10, :o1, 58537553, 24 + tz.transition 1966, 4, :o2, 9756959, 4 + tz.transition 1966, 10, :o1, 58546289, 24 + tz.transition 1967, 4, :o2, 9758443, 4 + tz.transition 1967, 10, :o1, 58555025, 24 + tz.transition 1968, 4, :o2, 9759899, 4 + tz.transition 1968, 10, :o1, 58563761, 24 + tz.transition 1969, 4, :o2, 9761355, 4 + tz.transition 1969, 10, :o1, 58572497, 24 + tz.transition 1970, 4, :o2, 9957600 + tz.transition 1970, 10, :o1, 25678800 + tz.transition 1971, 4, :o2, 41407200 + tz.transition 1971, 10, :o1, 57733200 + tz.transition 1972, 4, :o2, 73461600 + tz.transition 1972, 10, :o1, 89182800 + tz.transition 1973, 4, :o2, 104911200 + tz.transition 1973, 10, :o1, 120632400 + tz.transition 1974, 4, :o2, 136360800 + tz.transition 1974, 10, :o1, 152082000 + tz.transition 1975, 4, :o2, 167810400 + tz.transition 1975, 10, :o1, 183531600 + tz.transition 1976, 4, :o2, 199260000 + tz.transition 1976, 10, :o1, 215586000 + tz.transition 1977, 4, :o2, 230709600 + tz.transition 1977, 10, :o1, 247035600 + tz.transition 1978, 4, :o2, 262764000 + tz.transition 1978, 10, :o1, 278485200 + tz.transition 1979, 4, :o2, 294213600 + tz.transition 1979, 10, :o1, 309934800 + tz.transition 1980, 4, :o2, 325663200 + tz.transition 1980, 10, :o1, 341384400 + tz.transition 1981, 4, :o2, 357112800 + tz.transition 1981, 10, :o1, 372834000 + tz.transition 1982, 4, :o2, 388562400 + tz.transition 1982, 10, :o1, 404888400 + tz.transition 1983, 4, :o2, 420012000 + tz.transition 1983, 10, :o1, 436338000 + tz.transition 1984, 4, :o2, 452066400 + tz.transition 1984, 10, :o1, 467787600 + tz.transition 1985, 4, :o2, 483516000 + tz.transition 1985, 10, :o1, 499237200 + tz.transition 1986, 4, :o2, 514965600 + tz.transition 1986, 10, :o1, 530686800 + tz.transition 1987, 4, :o2, 544600800 + tz.transition 1987, 10, :o1, 562136400 + tz.transition 1988, 4, :o2, 576050400 + tz.transition 1988, 10, :o1, 594190800 + tz.transition 1989, 4, :o2, 607500000 + tz.transition 1989, 10, :o1, 625640400 + tz.transition 1990, 4, :o2, 638949600 + tz.transition 1990, 10, :o1, 657090000 + tz.transition 1991, 4, :o2, 671004000 + tz.transition 1991, 10, :o1, 688539600 + tz.transition 1992, 4, :o2, 702453600 + tz.transition 1992, 10, :o1, 719989200 + tz.transition 1993, 4, :o2, 733903200 + tz.transition 1993, 10, :o1, 752043600 + tz.transition 1994, 4, :o2, 765352800 + tz.transition 1994, 10, :o1, 783493200 + tz.transition 1995, 4, :o2, 796802400 + tz.transition 1995, 10, :o1, 814942800 + tz.transition 1996, 4, :o2, 828856800 + tz.transition 1996, 10, :o1, 846392400 + tz.transition 1997, 4, :o2, 860306400 + tz.transition 1997, 10, :o1, 877842000 + tz.transition 1998, 4, :o2, 891756000 + tz.transition 1998, 10, :o1, 909291600 + tz.transition 1999, 4, :o2, 923205600 + tz.transition 1999, 10, :o1, 941346000 + tz.transition 2000, 4, :o2, 954655200 + tz.transition 2000, 10, :o1, 972795600 + tz.transition 2001, 4, :o2, 986104800 + tz.transition 2001, 10, :o1, 1004245200 + tz.transition 2002, 4, :o2, 1018159200 + tz.transition 2002, 10, :o1, 1035694800 + tz.transition 2003, 4, :o2, 1049608800 + tz.transition 2003, 10, :o1, 1067144400 + tz.transition 2004, 4, :o2, 1081058400 + tz.transition 2004, 10, :o1, 1099198800 + tz.transition 2005, 4, :o2, 1112508000 + tz.transition 2005, 10, :o1, 1130648400 + tz.transition 2006, 4, :o2, 1143957600 + tz.transition 2006, 10, :o1, 1162098000 + tz.transition 2007, 3, :o2, 1173592800 + tz.transition 2007, 11, :o1, 1194152400 + tz.transition 2008, 3, :o2, 1205042400 + tz.transition 2008, 11, :o1, 1225602000 + tz.transition 2009, 3, :o2, 1236492000 + tz.transition 2009, 11, :o1, 1257051600 + tz.transition 2010, 3, :o2, 1268546400 + tz.transition 2010, 11, :o1, 1289106000 + tz.transition 2011, 3, :o2, 1299996000 + tz.transition 2011, 11, :o1, 1320555600 + tz.transition 2012, 3, :o2, 1331445600 + tz.transition 2012, 11, :o1, 1352005200 + tz.transition 2013, 3, :o2, 1362895200 + tz.transition 2013, 11, :o1, 1383454800 + tz.transition 2014, 3, :o2, 1394344800 + tz.transition 2014, 11, :o1, 1414904400 + tz.transition 2015, 3, :o2, 1425794400 + tz.transition 2015, 11, :o1, 1446354000 + tz.transition 2016, 3, :o2, 1457848800 + tz.transition 2016, 11, :o1, 1478408400 + tz.transition 2017, 3, :o2, 1489298400 + tz.transition 2017, 11, :o1, 1509858000 + tz.transition 2018, 3, :o2, 1520748000 + tz.transition 2018, 11, :o1, 1541307600 + tz.transition 2019, 3, :o2, 1552197600 + tz.transition 2019, 11, :o1, 1572757200 + tz.transition 2020, 3, :o2, 1583647200 + tz.transition 2020, 11, :o1, 1604206800 + tz.transition 2021, 3, :o2, 1615701600 + tz.transition 2021, 11, :o1, 1636261200 + tz.transition 2022, 3, :o2, 1647151200 + tz.transition 2022, 11, :o1, 1667710800 + tz.transition 2023, 3, :o2, 1678600800 + tz.transition 2023, 11, :o1, 1699160400 + tz.transition 2024, 3, :o2, 1710050400 + tz.transition 2024, 11, :o1, 1730610000 + tz.transition 2025, 3, :o2, 1741500000 + tz.transition 2025, 11, :o1, 1762059600 + tz.transition 2026, 3, :o2, 1772949600 + tz.transition 2026, 11, :o1, 1793509200 + tz.transition 2027, 3, :o2, 1805004000 + tz.transition 2027, 11, :o1, 1825563600 + tz.transition 2028, 3, :o2, 1836453600 + tz.transition 2028, 11, :o1, 1857013200 + tz.transition 2029, 3, :o2, 1867903200 + tz.transition 2029, 11, :o1, 1888462800 + tz.transition 2030, 3, :o2, 1899352800 + tz.transition 2030, 11, :o1, 1919912400 + tz.transition 2031, 3, :o2, 1930802400 + tz.transition 2031, 11, :o1, 1951362000 + tz.transition 2032, 3, :o2, 1962856800 + tz.transition 2032, 11, :o1, 1983416400 + tz.transition 2033, 3, :o2, 1994306400 + tz.transition 2033, 11, :o1, 2014866000 + tz.transition 2034, 3, :o2, 2025756000 + tz.transition 2034, 11, :o1, 2046315600 + tz.transition 2035, 3, :o2, 2057205600 + tz.transition 2035, 11, :o1, 2077765200 + tz.transition 2036, 3, :o2, 2088655200 + tz.transition 2036, 11, :o1, 2109214800 + tz.transition 2037, 3, :o2, 2120104800 + tz.transition 2037, 11, :o1, 2140664400 + tz.transition 2038, 3, :o2, 9861987, 4 + tz.transition 2038, 11, :o1, 59177633, 24 + tz.transition 2039, 3, :o2, 9863443, 4 + tz.transition 2039, 11, :o1, 59186369, 24 + tz.transition 2040, 3, :o2, 9864899, 4 + tz.transition 2040, 11, :o1, 59195105, 24 + tz.transition 2041, 3, :o2, 9866355, 4 + tz.transition 2041, 11, :o1, 59203841, 24 + tz.transition 2042, 3, :o2, 9867811, 4 + tz.transition 2042, 11, :o1, 59212577, 24 + tz.transition 2043, 3, :o2, 9869267, 4 + tz.transition 2043, 11, :o1, 59221313, 24 + tz.transition 2044, 3, :o2, 9870751, 4 + tz.transition 2044, 11, :o1, 59230217, 24 + tz.transition 2045, 3, :o2, 9872207, 4 + tz.transition 2045, 11, :o1, 59238953, 24 + tz.transition 2046, 3, :o2, 9873663, 4 + tz.transition 2046, 11, :o1, 59247689, 24 + tz.transition 2047, 3, :o2, 9875119, 4 + tz.transition 2047, 11, :o1, 59256425, 24 + tz.transition 2048, 3, :o2, 9876575, 4 + tz.transition 2048, 11, :o1, 59265161, 24 + tz.transition 2049, 3, :o2, 9878059, 4 + tz.transition 2049, 11, :o1, 59274065, 24 + tz.transition 2050, 3, :o2, 9879515, 4 + tz.transition 2050, 11, :o1, 59282801, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb new file mode 100644 index 0000000000..f1430f6c24 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb @@ -0,0 +1,149 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Indiana + module Indianapolis + include TimezoneDefinition + + timezone 'America/Indiana/Indianapolis' do |tz| + tz.offset :o0, -20678, 0, :LMT + tz.offset :o1, -21600, 0, :CST + tz.offset :o2, -21600, 3600, :CDT + tz.offset :o3, -21600, 3600, :CWT + tz.offset :o4, -21600, 3600, :CPT + tz.offset :o5, -18000, 0, :EST + tz.offset :o6, -18000, 3600, :EDT + + tz.transition 1883, 11, :o1, 9636533, 4 + tz.transition 1918, 3, :o2, 14530103, 6 + tz.transition 1918, 10, :o1, 58125451, 24 + tz.transition 1919, 3, :o2, 14532287, 6 + tz.transition 1919, 10, :o1, 58134187, 24 + tz.transition 1941, 6, :o2, 14581007, 6 + tz.transition 1941, 9, :o1, 58326379, 24 + tz.transition 1942, 2, :o3, 14582399, 6 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 58361491, 24 + tz.transition 1946, 4, :o2, 14591633, 6 + tz.transition 1946, 9, :o1, 58370227, 24 + tz.transition 1947, 4, :o2, 14593817, 6 + tz.transition 1947, 9, :o1, 58378963, 24 + tz.transition 1948, 4, :o2, 14596001, 6 + tz.transition 1948, 9, :o1, 58387699, 24 + tz.transition 1949, 4, :o2, 14598185, 6 + tz.transition 1949, 9, :o1, 58396435, 24 + tz.transition 1950, 4, :o2, 14600411, 6 + tz.transition 1950, 9, :o1, 58405171, 24 + tz.transition 1951, 4, :o2, 14602595, 6 + tz.transition 1951, 9, :o1, 58414075, 24 + tz.transition 1952, 4, :o2, 14604779, 6 + tz.transition 1952, 9, :o1, 58422811, 24 + tz.transition 1953, 4, :o2, 14606963, 6 + tz.transition 1953, 9, :o1, 58431547, 24 + tz.transition 1954, 4, :o2, 14609147, 6 + tz.transition 1954, 9, :o1, 58440283, 24 + tz.transition 1955, 4, :o5, 14611331, 6 + tz.transition 1957, 9, :o1, 58466659, 24 + tz.transition 1958, 4, :o5, 14617925, 6 + tz.transition 1969, 4, :o6, 58568131, 24 + tz.transition 1969, 10, :o5, 9762083, 4 + tz.transition 1970, 4, :o6, 9961200 + tz.transition 1970, 10, :o5, 25682400 + tz.transition 2006, 4, :o6, 1143961200 + tz.transition 2006, 10, :o5, 1162101600 + tz.transition 2007, 3, :o6, 1173596400 + tz.transition 2007, 11, :o5, 1194156000 + tz.transition 2008, 3, :o6, 1205046000 + tz.transition 2008, 11, :o5, 1225605600 + tz.transition 2009, 3, :o6, 1236495600 + tz.transition 2009, 11, :o5, 1257055200 + tz.transition 2010, 3, :o6, 1268550000 + tz.transition 2010, 11, :o5, 1289109600 + tz.transition 2011, 3, :o6, 1299999600 + tz.transition 2011, 11, :o5, 1320559200 + tz.transition 2012, 3, :o6, 1331449200 + tz.transition 2012, 11, :o5, 1352008800 + tz.transition 2013, 3, :o6, 1362898800 + tz.transition 2013, 11, :o5, 1383458400 + tz.transition 2014, 3, :o6, 1394348400 + tz.transition 2014, 11, :o5, 1414908000 + tz.transition 2015, 3, :o6, 1425798000 + tz.transition 2015, 11, :o5, 1446357600 + tz.transition 2016, 3, :o6, 1457852400 + tz.transition 2016, 11, :o5, 1478412000 + tz.transition 2017, 3, :o6, 1489302000 + tz.transition 2017, 11, :o5, 1509861600 + tz.transition 2018, 3, :o6, 1520751600 + tz.transition 2018, 11, :o5, 1541311200 + tz.transition 2019, 3, :o6, 1552201200 + tz.transition 2019, 11, :o5, 1572760800 + tz.transition 2020, 3, :o6, 1583650800 + tz.transition 2020, 11, :o5, 1604210400 + tz.transition 2021, 3, :o6, 1615705200 + tz.transition 2021, 11, :o5, 1636264800 + tz.transition 2022, 3, :o6, 1647154800 + tz.transition 2022, 11, :o5, 1667714400 + tz.transition 2023, 3, :o6, 1678604400 + tz.transition 2023, 11, :o5, 1699164000 + tz.transition 2024, 3, :o6, 1710054000 + tz.transition 2024, 11, :o5, 1730613600 + tz.transition 2025, 3, :o6, 1741503600 + tz.transition 2025, 11, :o5, 1762063200 + tz.transition 2026, 3, :o6, 1772953200 + tz.transition 2026, 11, :o5, 1793512800 + tz.transition 2027, 3, :o6, 1805007600 + tz.transition 2027, 11, :o5, 1825567200 + tz.transition 2028, 3, :o6, 1836457200 + tz.transition 2028, 11, :o5, 1857016800 + tz.transition 2029, 3, :o6, 1867906800 + tz.transition 2029, 11, :o5, 1888466400 + tz.transition 2030, 3, :o6, 1899356400 + tz.transition 2030, 11, :o5, 1919916000 + tz.transition 2031, 3, :o6, 1930806000 + tz.transition 2031, 11, :o5, 1951365600 + tz.transition 2032, 3, :o6, 1962860400 + tz.transition 2032, 11, :o5, 1983420000 + tz.transition 2033, 3, :o6, 1994310000 + tz.transition 2033, 11, :o5, 2014869600 + tz.transition 2034, 3, :o6, 2025759600 + tz.transition 2034, 11, :o5, 2046319200 + tz.transition 2035, 3, :o6, 2057209200 + tz.transition 2035, 11, :o5, 2077768800 + tz.transition 2036, 3, :o6, 2088658800 + tz.transition 2036, 11, :o5, 2109218400 + tz.transition 2037, 3, :o6, 2120108400 + tz.transition 2037, 11, :o5, 2140668000 + tz.transition 2038, 3, :o6, 59171923, 24 + tz.transition 2038, 11, :o5, 9862939, 4 + tz.transition 2039, 3, :o6, 59180659, 24 + tz.transition 2039, 11, :o5, 9864395, 4 + tz.transition 2040, 3, :o6, 59189395, 24 + tz.transition 2040, 11, :o5, 9865851, 4 + tz.transition 2041, 3, :o6, 59198131, 24 + tz.transition 2041, 11, :o5, 9867307, 4 + tz.transition 2042, 3, :o6, 59206867, 24 + tz.transition 2042, 11, :o5, 9868763, 4 + tz.transition 2043, 3, :o6, 59215603, 24 + tz.transition 2043, 11, :o5, 9870219, 4 + tz.transition 2044, 3, :o6, 59224507, 24 + tz.transition 2044, 11, :o5, 9871703, 4 + tz.transition 2045, 3, :o6, 59233243, 24 + tz.transition 2045, 11, :o5, 9873159, 4 + tz.transition 2046, 3, :o6, 59241979, 24 + tz.transition 2046, 11, :o5, 9874615, 4 + tz.transition 2047, 3, :o6, 59250715, 24 + tz.transition 2047, 11, :o5, 9876071, 4 + tz.transition 2048, 3, :o6, 59259451, 24 + tz.transition 2048, 11, :o5, 9877527, 4 + tz.transition 2049, 3, :o6, 59268355, 24 + tz.transition 2049, 11, :o5, 9879011, 4 + tz.transition 2050, 3, :o6, 59277091, 24 + tz.transition 2050, 11, :o5, 9880467, 4 + end + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb new file mode 100644 index 0000000000..f646f3f54a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb @@ -0,0 +1,194 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Juneau + include TimezoneDefinition + + timezone 'America/Juneau' do |tz| + tz.offset :o0, 54139, 0, :LMT + tz.offset :o1, -32261, 0, :LMT + tz.offset :o2, -28800, 0, :PST + tz.offset :o3, -28800, 3600, :PWT + tz.offset :o4, -28800, 3600, :PPT + tz.offset :o5, -28800, 3600, :PDT + tz.offset :o6, -32400, 0, :YST + tz.offset :o7, -32400, 0, :AKST + tz.offset :o8, -32400, 3600, :AKDT + + tz.transition 1867, 10, :o1, 207641393861, 86400 + tz.transition 1900, 8, :o2, 208677805061, 86400 + tz.transition 1942, 2, :o3, 29164799, 12 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o2, 19453831, 8 + tz.transition 1969, 4, :o5, 29284067, 12 + tz.transition 1969, 10, :o2, 19524167, 8 + tz.transition 1970, 4, :o5, 9972000 + tz.transition 1970, 10, :o2, 25693200 + tz.transition 1971, 4, :o5, 41421600 + tz.transition 1971, 10, :o2, 57747600 + tz.transition 1972, 4, :o5, 73476000 + tz.transition 1972, 10, :o2, 89197200 + tz.transition 1973, 4, :o5, 104925600 + tz.transition 1973, 10, :o2, 120646800 + tz.transition 1974, 1, :o5, 126698400 + tz.transition 1974, 10, :o2, 152096400 + tz.transition 1975, 2, :o5, 162381600 + tz.transition 1975, 10, :o2, 183546000 + tz.transition 1976, 4, :o5, 199274400 + tz.transition 1976, 10, :o2, 215600400 + tz.transition 1977, 4, :o5, 230724000 + tz.transition 1977, 10, :o2, 247050000 + tz.transition 1978, 4, :o5, 262778400 + tz.transition 1978, 10, :o2, 278499600 + tz.transition 1979, 4, :o5, 294228000 + tz.transition 1979, 10, :o2, 309949200 + tz.transition 1980, 4, :o5, 325677600 + tz.transition 1980, 10, :o2, 341398800 + tz.transition 1981, 4, :o5, 357127200 + tz.transition 1981, 10, :o2, 372848400 + tz.transition 1982, 4, :o5, 388576800 + tz.transition 1982, 10, :o2, 404902800 + tz.transition 1983, 4, :o5, 420026400 + tz.transition 1983, 10, :o6, 436352400 + tz.transition 1983, 11, :o7, 439030800 + tz.transition 1984, 4, :o8, 452084400 + tz.transition 1984, 10, :o7, 467805600 + tz.transition 1985, 4, :o8, 483534000 + tz.transition 1985, 10, :o7, 499255200 + tz.transition 1986, 4, :o8, 514983600 + tz.transition 1986, 10, :o7, 530704800 + tz.transition 1987, 4, :o8, 544618800 + tz.transition 1987, 10, :o7, 562154400 + tz.transition 1988, 4, :o8, 576068400 + tz.transition 1988, 10, :o7, 594208800 + tz.transition 1989, 4, :o8, 607518000 + tz.transition 1989, 10, :o7, 625658400 + tz.transition 1990, 4, :o8, 638967600 + tz.transition 1990, 10, :o7, 657108000 + tz.transition 1991, 4, :o8, 671022000 + tz.transition 1991, 10, :o7, 688557600 + tz.transition 1992, 4, :o8, 702471600 + tz.transition 1992, 10, :o7, 720007200 + tz.transition 1993, 4, :o8, 733921200 + tz.transition 1993, 10, :o7, 752061600 + tz.transition 1994, 4, :o8, 765370800 + tz.transition 1994, 10, :o7, 783511200 + tz.transition 1995, 4, :o8, 796820400 + tz.transition 1995, 10, :o7, 814960800 + tz.transition 1996, 4, :o8, 828874800 + tz.transition 1996, 10, :o7, 846410400 + tz.transition 1997, 4, :o8, 860324400 + tz.transition 1997, 10, :o7, 877860000 + tz.transition 1998, 4, :o8, 891774000 + tz.transition 1998, 10, :o7, 909309600 + tz.transition 1999, 4, :o8, 923223600 + tz.transition 1999, 10, :o7, 941364000 + tz.transition 2000, 4, :o8, 954673200 + tz.transition 2000, 10, :o7, 972813600 + tz.transition 2001, 4, :o8, 986122800 + tz.transition 2001, 10, :o7, 1004263200 + tz.transition 2002, 4, :o8, 1018177200 + tz.transition 2002, 10, :o7, 1035712800 + tz.transition 2003, 4, :o8, 1049626800 + tz.transition 2003, 10, :o7, 1067162400 + tz.transition 2004, 4, :o8, 1081076400 + tz.transition 2004, 10, :o7, 1099216800 + tz.transition 2005, 4, :o8, 1112526000 + tz.transition 2005, 10, :o7, 1130666400 + tz.transition 2006, 4, :o8, 1143975600 + tz.transition 2006, 10, :o7, 1162116000 + tz.transition 2007, 3, :o8, 1173610800 + tz.transition 2007, 11, :o7, 1194170400 + tz.transition 2008, 3, :o8, 1205060400 + tz.transition 2008, 11, :o7, 1225620000 + tz.transition 2009, 3, :o8, 1236510000 + tz.transition 2009, 11, :o7, 1257069600 + tz.transition 2010, 3, :o8, 1268564400 + tz.transition 2010, 11, :o7, 1289124000 + tz.transition 2011, 3, :o8, 1300014000 + tz.transition 2011, 11, :o7, 1320573600 + tz.transition 2012, 3, :o8, 1331463600 + tz.transition 2012, 11, :o7, 1352023200 + tz.transition 2013, 3, :o8, 1362913200 + tz.transition 2013, 11, :o7, 1383472800 + tz.transition 2014, 3, :o8, 1394362800 + tz.transition 2014, 11, :o7, 1414922400 + tz.transition 2015, 3, :o8, 1425812400 + tz.transition 2015, 11, :o7, 1446372000 + tz.transition 2016, 3, :o8, 1457866800 + tz.transition 2016, 11, :o7, 1478426400 + tz.transition 2017, 3, :o8, 1489316400 + tz.transition 2017, 11, :o7, 1509876000 + tz.transition 2018, 3, :o8, 1520766000 + tz.transition 2018, 11, :o7, 1541325600 + tz.transition 2019, 3, :o8, 1552215600 + tz.transition 2019, 11, :o7, 1572775200 + tz.transition 2020, 3, :o8, 1583665200 + tz.transition 2020, 11, :o7, 1604224800 + tz.transition 2021, 3, :o8, 1615719600 + tz.transition 2021, 11, :o7, 1636279200 + tz.transition 2022, 3, :o8, 1647169200 + tz.transition 2022, 11, :o7, 1667728800 + tz.transition 2023, 3, :o8, 1678618800 + tz.transition 2023, 11, :o7, 1699178400 + tz.transition 2024, 3, :o8, 1710068400 + tz.transition 2024, 11, :o7, 1730628000 + tz.transition 2025, 3, :o8, 1741518000 + tz.transition 2025, 11, :o7, 1762077600 + tz.transition 2026, 3, :o8, 1772967600 + tz.transition 2026, 11, :o7, 1793527200 + tz.transition 2027, 3, :o8, 1805022000 + tz.transition 2027, 11, :o7, 1825581600 + tz.transition 2028, 3, :o8, 1836471600 + tz.transition 2028, 11, :o7, 1857031200 + tz.transition 2029, 3, :o8, 1867921200 + tz.transition 2029, 11, :o7, 1888480800 + tz.transition 2030, 3, :o8, 1899370800 + tz.transition 2030, 11, :o7, 1919930400 + tz.transition 2031, 3, :o8, 1930820400 + tz.transition 2031, 11, :o7, 1951380000 + tz.transition 2032, 3, :o8, 1962874800 + tz.transition 2032, 11, :o7, 1983434400 + tz.transition 2033, 3, :o8, 1994324400 + tz.transition 2033, 11, :o7, 2014884000 + tz.transition 2034, 3, :o8, 2025774000 + tz.transition 2034, 11, :o7, 2046333600 + tz.transition 2035, 3, :o8, 2057223600 + tz.transition 2035, 11, :o7, 2077783200 + tz.transition 2036, 3, :o8, 2088673200 + tz.transition 2036, 11, :o7, 2109232800 + tz.transition 2037, 3, :o8, 2120122800 + tz.transition 2037, 11, :o7, 2140682400 + tz.transition 2038, 3, :o8, 59171927, 24 + tz.transition 2038, 11, :o7, 29588819, 12 + tz.transition 2039, 3, :o8, 59180663, 24 + tz.transition 2039, 11, :o7, 29593187, 12 + tz.transition 2040, 3, :o8, 59189399, 24 + tz.transition 2040, 11, :o7, 29597555, 12 + tz.transition 2041, 3, :o8, 59198135, 24 + tz.transition 2041, 11, :o7, 29601923, 12 + tz.transition 2042, 3, :o8, 59206871, 24 + tz.transition 2042, 11, :o7, 29606291, 12 + tz.transition 2043, 3, :o8, 59215607, 24 + tz.transition 2043, 11, :o7, 29610659, 12 + tz.transition 2044, 3, :o8, 59224511, 24 + tz.transition 2044, 11, :o7, 29615111, 12 + tz.transition 2045, 3, :o8, 59233247, 24 + tz.transition 2045, 11, :o7, 29619479, 12 + tz.transition 2046, 3, :o8, 59241983, 24 + tz.transition 2046, 11, :o7, 29623847, 12 + tz.transition 2047, 3, :o8, 59250719, 24 + tz.transition 2047, 11, :o7, 29628215, 12 + tz.transition 2048, 3, :o8, 59259455, 24 + tz.transition 2048, 11, :o7, 29632583, 12 + tz.transition 2049, 3, :o8, 59268359, 24 + tz.transition 2049, 11, :o7, 29637035, 12 + tz.transition 2050, 3, :o8, 59277095, 24 + tz.transition 2050, 11, :o7, 29641403, 12 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb new file mode 100644 index 0000000000..45c907899f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb @@ -0,0 +1,22 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module La_Paz + include TimezoneDefinition + + timezone 'America/La_Paz' do |tz| + tz.offset :o0, -16356, 0, :LMT + tz.offset :o1, -16356, 0, :CMT + tz.offset :o2, -16356, 3600, :BOST + tz.offset :o3, -14400, 0, :BOT + + tz.transition 1890, 1, :o1, 17361854563, 7200 + tz.transition 1931, 10, :o2, 17471733763, 7200 + tz.transition 1932, 3, :o3, 17472871063, 7200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb new file mode 100644 index 0000000000..af68ac29f7 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb @@ -0,0 +1,35 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Lima + include TimezoneDefinition + + timezone 'America/Lima' do |tz| + tz.offset :o0, -18492, 0, :LMT + tz.offset :o1, -18516, 0, :LMT + tz.offset :o2, -18000, 0, :PET + tz.offset :o3, -18000, 3600, :PEST + + tz.transition 1890, 1, :o1, 17361854741, 7200 + tz.transition 1908, 7, :o2, 17410685143, 7200 + tz.transition 1938, 1, :o3, 58293593, 24 + tz.transition 1938, 4, :o2, 7286969, 3 + tz.transition 1938, 9, :o3, 58300001, 24 + tz.transition 1939, 3, :o2, 7288046, 3 + tz.transition 1939, 9, :o3, 58308737, 24 + tz.transition 1940, 3, :o2, 7289138, 3 + tz.transition 1986, 1, :o3, 504939600 + tz.transition 1986, 4, :o2, 512712000 + tz.transition 1987, 1, :o3, 536475600 + tz.transition 1987, 4, :o2, 544248000 + tz.transition 1990, 1, :o3, 631170000 + tz.transition 1990, 4, :o2, 638942400 + tz.transition 1994, 1, :o3, 757400400 + tz.transition 1994, 4, :o2, 765172800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb new file mode 100644 index 0000000000..16007fd675 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb @@ -0,0 +1,232 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Los_Angeles + include TimezoneDefinition + + timezone 'America/Los_Angeles' do |tz| + tz.offset :o0, -28378, 0, :LMT + tz.offset :o1, -28800, 0, :PST + tz.offset :o2, -28800, 3600, :PDT + tz.offset :o3, -28800, 3600, :PWT + tz.offset :o4, -28800, 3600, :PPT + + tz.transition 1883, 11, :o1, 7227400, 3 + tz.transition 1918, 3, :o2, 29060207, 12 + tz.transition 1918, 10, :o1, 19375151, 8 + tz.transition 1919, 3, :o2, 29064575, 12 + tz.transition 1919, 10, :o1, 19378063, 8 + tz.transition 1942, 2, :o3, 29164799, 12 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 19453831, 8 + tz.transition 1948, 3, :o2, 29191499, 12 + tz.transition 1949, 1, :o1, 19463343, 8 + tz.transition 1950, 4, :o2, 29200823, 12 + tz.transition 1950, 9, :o1, 19468391, 8 + tz.transition 1951, 4, :o2, 29205191, 12 + tz.transition 1951, 9, :o1, 19471359, 8 + tz.transition 1952, 4, :o2, 29209559, 12 + tz.transition 1952, 9, :o1, 19474271, 8 + tz.transition 1953, 4, :o2, 29213927, 12 + tz.transition 1953, 9, :o1, 19477183, 8 + tz.transition 1954, 4, :o2, 29218295, 12 + tz.transition 1954, 9, :o1, 19480095, 8 + tz.transition 1955, 4, :o2, 29222663, 12 + tz.transition 1955, 9, :o1, 19483007, 8 + tz.transition 1956, 4, :o2, 29227115, 12 + tz.transition 1956, 9, :o1, 19485975, 8 + tz.transition 1957, 4, :o2, 29231483, 12 + tz.transition 1957, 9, :o1, 19488887, 8 + tz.transition 1958, 4, :o2, 29235851, 12 + tz.transition 1958, 9, :o1, 19491799, 8 + tz.transition 1959, 4, :o2, 29240219, 12 + tz.transition 1959, 9, :o1, 19494711, 8 + tz.transition 1960, 4, :o2, 29244587, 12 + tz.transition 1960, 9, :o1, 19497623, 8 + tz.transition 1961, 4, :o2, 29249039, 12 + tz.transition 1961, 9, :o1, 19500535, 8 + tz.transition 1962, 4, :o2, 29253407, 12 + tz.transition 1962, 10, :o1, 19503727, 8 + tz.transition 1963, 4, :o2, 29257775, 12 + tz.transition 1963, 10, :o1, 19506639, 8 + tz.transition 1964, 4, :o2, 29262143, 12 + tz.transition 1964, 10, :o1, 19509551, 8 + tz.transition 1965, 4, :o2, 29266511, 12 + tz.transition 1965, 10, :o1, 19512519, 8 + tz.transition 1966, 4, :o2, 29270879, 12 + tz.transition 1966, 10, :o1, 19515431, 8 + tz.transition 1967, 4, :o2, 29275331, 12 + tz.transition 1967, 10, :o1, 19518343, 8 + tz.transition 1968, 4, :o2, 29279699, 12 + tz.transition 1968, 10, :o1, 19521255, 8 + tz.transition 1969, 4, :o2, 29284067, 12 + tz.transition 1969, 10, :o1, 19524167, 8 + tz.transition 1970, 4, :o2, 9972000 + tz.transition 1970, 10, :o1, 25693200 + tz.transition 1971, 4, :o2, 41421600 + tz.transition 1971, 10, :o1, 57747600 + tz.transition 1972, 4, :o2, 73476000 + tz.transition 1972, 10, :o1, 89197200 + tz.transition 1973, 4, :o2, 104925600 + tz.transition 1973, 10, :o1, 120646800 + tz.transition 1974, 1, :o2, 126698400 + tz.transition 1974, 10, :o1, 152096400 + tz.transition 1975, 2, :o2, 162381600 + tz.transition 1975, 10, :o1, 183546000 + tz.transition 1976, 4, :o2, 199274400 + tz.transition 1976, 10, :o1, 215600400 + tz.transition 1977, 4, :o2, 230724000 + tz.transition 1977, 10, :o1, 247050000 + tz.transition 1978, 4, :o2, 262778400 + tz.transition 1978, 10, :o1, 278499600 + tz.transition 1979, 4, :o2, 294228000 + tz.transition 1979, 10, :o1, 309949200 + tz.transition 1980, 4, :o2, 325677600 + tz.transition 1980, 10, :o1, 341398800 + tz.transition 1981, 4, :o2, 357127200 + tz.transition 1981, 10, :o1, 372848400 + tz.transition 1982, 4, :o2, 388576800 + tz.transition 1982, 10, :o1, 404902800 + tz.transition 1983, 4, :o2, 420026400 + tz.transition 1983, 10, :o1, 436352400 + tz.transition 1984, 4, :o2, 452080800 + tz.transition 1984, 10, :o1, 467802000 + tz.transition 1985, 4, :o2, 483530400 + tz.transition 1985, 10, :o1, 499251600 + tz.transition 1986, 4, :o2, 514980000 + tz.transition 1986, 10, :o1, 530701200 + tz.transition 1987, 4, :o2, 544615200 + tz.transition 1987, 10, :o1, 562150800 + tz.transition 1988, 4, :o2, 576064800 + tz.transition 1988, 10, :o1, 594205200 + tz.transition 1989, 4, :o2, 607514400 + tz.transition 1989, 10, :o1, 625654800 + tz.transition 1990, 4, :o2, 638964000 + tz.transition 1990, 10, :o1, 657104400 + tz.transition 1991, 4, :o2, 671018400 + tz.transition 1991, 10, :o1, 688554000 + tz.transition 1992, 4, :o2, 702468000 + tz.transition 1992, 10, :o1, 720003600 + tz.transition 1993, 4, :o2, 733917600 + tz.transition 1993, 10, :o1, 752058000 + tz.transition 1994, 4, :o2, 765367200 + tz.transition 1994, 10, :o1, 783507600 + tz.transition 1995, 4, :o2, 796816800 + tz.transition 1995, 10, :o1, 814957200 + tz.transition 1996, 4, :o2, 828871200 + tz.transition 1996, 10, :o1, 846406800 + tz.transition 1997, 4, :o2, 860320800 + tz.transition 1997, 10, :o1, 877856400 + tz.transition 1998, 4, :o2, 891770400 + tz.transition 1998, 10, :o1, 909306000 + tz.transition 1999, 4, :o2, 923220000 + tz.transition 1999, 10, :o1, 941360400 + tz.transition 2000, 4, :o2, 954669600 + tz.transition 2000, 10, :o1, 972810000 + tz.transition 2001, 4, :o2, 986119200 + tz.transition 2001, 10, :o1, 1004259600 + tz.transition 2002, 4, :o2, 1018173600 + tz.transition 2002, 10, :o1, 1035709200 + tz.transition 2003, 4, :o2, 1049623200 + tz.transition 2003, 10, :o1, 1067158800 + tz.transition 2004, 4, :o2, 1081072800 + tz.transition 2004, 10, :o1, 1099213200 + tz.transition 2005, 4, :o2, 1112522400 + tz.transition 2005, 10, :o1, 1130662800 + tz.transition 2006, 4, :o2, 1143972000 + tz.transition 2006, 10, :o1, 1162112400 + tz.transition 2007, 3, :o2, 1173607200 + tz.transition 2007, 11, :o1, 1194166800 + tz.transition 2008, 3, :o2, 1205056800 + tz.transition 2008, 11, :o1, 1225616400 + tz.transition 2009, 3, :o2, 1236506400 + tz.transition 2009, 11, :o1, 1257066000 + tz.transition 2010, 3, :o2, 1268560800 + tz.transition 2010, 11, :o1, 1289120400 + tz.transition 2011, 3, :o2, 1300010400 + tz.transition 2011, 11, :o1, 1320570000 + tz.transition 2012, 3, :o2, 1331460000 + tz.transition 2012, 11, :o1, 1352019600 + tz.transition 2013, 3, :o2, 1362909600 + tz.transition 2013, 11, :o1, 1383469200 + tz.transition 2014, 3, :o2, 1394359200 + tz.transition 2014, 11, :o1, 1414918800 + tz.transition 2015, 3, :o2, 1425808800 + tz.transition 2015, 11, :o1, 1446368400 + tz.transition 2016, 3, :o2, 1457863200 + tz.transition 2016, 11, :o1, 1478422800 + tz.transition 2017, 3, :o2, 1489312800 + tz.transition 2017, 11, :o1, 1509872400 + tz.transition 2018, 3, :o2, 1520762400 + tz.transition 2018, 11, :o1, 1541322000 + tz.transition 2019, 3, :o2, 1552212000 + tz.transition 2019, 11, :o1, 1572771600 + tz.transition 2020, 3, :o2, 1583661600 + tz.transition 2020, 11, :o1, 1604221200 + tz.transition 2021, 3, :o2, 1615716000 + tz.transition 2021, 11, :o1, 1636275600 + tz.transition 2022, 3, :o2, 1647165600 + tz.transition 2022, 11, :o1, 1667725200 + tz.transition 2023, 3, :o2, 1678615200 + tz.transition 2023, 11, :o1, 1699174800 + tz.transition 2024, 3, :o2, 1710064800 + tz.transition 2024, 11, :o1, 1730624400 + tz.transition 2025, 3, :o2, 1741514400 + tz.transition 2025, 11, :o1, 1762074000 + tz.transition 2026, 3, :o2, 1772964000 + tz.transition 2026, 11, :o1, 1793523600 + tz.transition 2027, 3, :o2, 1805018400 + tz.transition 2027, 11, :o1, 1825578000 + tz.transition 2028, 3, :o2, 1836468000 + tz.transition 2028, 11, :o1, 1857027600 + tz.transition 2029, 3, :o2, 1867917600 + tz.transition 2029, 11, :o1, 1888477200 + tz.transition 2030, 3, :o2, 1899367200 + tz.transition 2030, 11, :o1, 1919926800 + tz.transition 2031, 3, :o2, 1930816800 + tz.transition 2031, 11, :o1, 1951376400 + tz.transition 2032, 3, :o2, 1962871200 + tz.transition 2032, 11, :o1, 1983430800 + tz.transition 2033, 3, :o2, 1994320800 + tz.transition 2033, 11, :o1, 2014880400 + tz.transition 2034, 3, :o2, 2025770400 + tz.transition 2034, 11, :o1, 2046330000 + tz.transition 2035, 3, :o2, 2057220000 + tz.transition 2035, 11, :o1, 2077779600 + tz.transition 2036, 3, :o2, 2088669600 + tz.transition 2036, 11, :o1, 2109229200 + tz.transition 2037, 3, :o2, 2120119200 + tz.transition 2037, 11, :o1, 2140678800 + tz.transition 2038, 3, :o2, 29585963, 12 + tz.transition 2038, 11, :o1, 19725879, 8 + tz.transition 2039, 3, :o2, 29590331, 12 + tz.transition 2039, 11, :o1, 19728791, 8 + tz.transition 2040, 3, :o2, 29594699, 12 + tz.transition 2040, 11, :o1, 19731703, 8 + tz.transition 2041, 3, :o2, 29599067, 12 + tz.transition 2041, 11, :o1, 19734615, 8 + tz.transition 2042, 3, :o2, 29603435, 12 + tz.transition 2042, 11, :o1, 19737527, 8 + tz.transition 2043, 3, :o2, 29607803, 12 + tz.transition 2043, 11, :o1, 19740439, 8 + tz.transition 2044, 3, :o2, 29612255, 12 + tz.transition 2044, 11, :o1, 19743407, 8 + tz.transition 2045, 3, :o2, 29616623, 12 + tz.transition 2045, 11, :o1, 19746319, 8 + tz.transition 2046, 3, :o2, 29620991, 12 + tz.transition 2046, 11, :o1, 19749231, 8 + tz.transition 2047, 3, :o2, 29625359, 12 + tz.transition 2047, 11, :o1, 19752143, 8 + tz.transition 2048, 3, :o2, 29629727, 12 + tz.transition 2048, 11, :o1, 19755055, 8 + tz.transition 2049, 3, :o2, 29634179, 12 + tz.transition 2049, 11, :o1, 19758023, 8 + tz.transition 2050, 3, :o2, 29638547, 12 + tz.transition 2050, 11, :o1, 19760935, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb new file mode 100644 index 0000000000..ba9e6efcf1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb @@ -0,0 +1,139 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Mazatlan + include TimezoneDefinition + + timezone 'America/Mazatlan' do |tz| + tz.offset :o0, -25540, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -21600, 0, :CST + tz.offset :o3, -28800, 0, :PST + tz.offset :o4, -25200, 3600, :MDT + + tz.transition 1922, 1, :o1, 58153339, 24 + tz.transition 1927, 6, :o2, 9700171, 4 + tz.transition 1930, 11, :o1, 9705183, 4 + tz.transition 1931, 5, :o2, 9705855, 4 + tz.transition 1931, 10, :o1, 9706463, 4 + tz.transition 1932, 4, :o2, 58243171, 24 + tz.transition 1942, 4, :o1, 9721895, 4 + tz.transition 1949, 1, :o3, 58390339, 24 + tz.transition 1970, 1, :o1, 28800 + tz.transition 1996, 4, :o4, 828867600 + tz.transition 1996, 10, :o1, 846403200 + tz.transition 1997, 4, :o4, 860317200 + tz.transition 1997, 10, :o1, 877852800 + tz.transition 1998, 4, :o4, 891766800 + tz.transition 1998, 10, :o1, 909302400 + tz.transition 1999, 4, :o4, 923216400 + tz.transition 1999, 10, :o1, 941356800 + tz.transition 2000, 4, :o4, 954666000 + tz.transition 2000, 10, :o1, 972806400 + tz.transition 2001, 5, :o4, 989139600 + tz.transition 2001, 9, :o1, 1001836800 + tz.transition 2002, 4, :o4, 1018170000 + tz.transition 2002, 10, :o1, 1035705600 + tz.transition 2003, 4, :o4, 1049619600 + tz.transition 2003, 10, :o1, 1067155200 + tz.transition 2004, 4, :o4, 1081069200 + tz.transition 2004, 10, :o1, 1099209600 + tz.transition 2005, 4, :o4, 1112518800 + tz.transition 2005, 10, :o1, 1130659200 + tz.transition 2006, 4, :o4, 1143968400 + tz.transition 2006, 10, :o1, 1162108800 + tz.transition 2007, 4, :o4, 1175418000 + tz.transition 2007, 10, :o1, 1193558400 + tz.transition 2008, 4, :o4, 1207472400 + tz.transition 2008, 10, :o1, 1225008000 + tz.transition 2009, 4, :o4, 1238922000 + tz.transition 2009, 10, :o1, 1256457600 + tz.transition 2010, 4, :o4, 1270371600 + tz.transition 2010, 10, :o1, 1288512000 + tz.transition 2011, 4, :o4, 1301821200 + tz.transition 2011, 10, :o1, 1319961600 + tz.transition 2012, 4, :o4, 1333270800 + tz.transition 2012, 10, :o1, 1351411200 + tz.transition 2013, 4, :o4, 1365325200 + tz.transition 2013, 10, :o1, 1382860800 + tz.transition 2014, 4, :o4, 1396774800 + tz.transition 2014, 10, :o1, 1414310400 + tz.transition 2015, 4, :o4, 1428224400 + tz.transition 2015, 10, :o1, 1445760000 + tz.transition 2016, 4, :o4, 1459674000 + tz.transition 2016, 10, :o1, 1477814400 + tz.transition 2017, 4, :o4, 1491123600 + tz.transition 2017, 10, :o1, 1509264000 + tz.transition 2018, 4, :o4, 1522573200 + tz.transition 2018, 10, :o1, 1540713600 + tz.transition 2019, 4, :o4, 1554627600 + tz.transition 2019, 10, :o1, 1572163200 + tz.transition 2020, 4, :o4, 1586077200 + tz.transition 2020, 10, :o1, 1603612800 + tz.transition 2021, 4, :o4, 1617526800 + tz.transition 2021, 10, :o1, 1635667200 + tz.transition 2022, 4, :o4, 1648976400 + tz.transition 2022, 10, :o1, 1667116800 + tz.transition 2023, 4, :o4, 1680426000 + tz.transition 2023, 10, :o1, 1698566400 + tz.transition 2024, 4, :o4, 1712480400 + tz.transition 2024, 10, :o1, 1730016000 + tz.transition 2025, 4, :o4, 1743930000 + tz.transition 2025, 10, :o1, 1761465600 + tz.transition 2026, 4, :o4, 1775379600 + tz.transition 2026, 10, :o1, 1792915200 + tz.transition 2027, 4, :o4, 1806829200 + tz.transition 2027, 10, :o1, 1824969600 + tz.transition 2028, 4, :o4, 1838278800 + tz.transition 2028, 10, :o1, 1856419200 + tz.transition 2029, 4, :o4, 1869728400 + tz.transition 2029, 10, :o1, 1887868800 + tz.transition 2030, 4, :o4, 1901782800 + tz.transition 2030, 10, :o1, 1919318400 + tz.transition 2031, 4, :o4, 1933232400 + tz.transition 2031, 10, :o1, 1950768000 + tz.transition 2032, 4, :o4, 1964682000 + tz.transition 2032, 10, :o1, 1982822400 + tz.transition 2033, 4, :o4, 1996131600 + tz.transition 2033, 10, :o1, 2014272000 + tz.transition 2034, 4, :o4, 2027581200 + tz.transition 2034, 10, :o1, 2045721600 + tz.transition 2035, 4, :o4, 2059030800 + tz.transition 2035, 10, :o1, 2077171200 + tz.transition 2036, 4, :o4, 2091085200 + tz.transition 2036, 10, :o1, 2108620800 + tz.transition 2037, 4, :o4, 2122534800 + tz.transition 2037, 10, :o1, 2140070400 + tz.transition 2038, 4, :o4, 19724143, 8 + tz.transition 2038, 10, :o1, 14794367, 6 + tz.transition 2039, 4, :o4, 19727055, 8 + tz.transition 2039, 10, :o1, 14796551, 6 + tz.transition 2040, 4, :o4, 19729967, 8 + tz.transition 2040, 10, :o1, 14798735, 6 + tz.transition 2041, 4, :o4, 19732935, 8 + tz.transition 2041, 10, :o1, 14800919, 6 + tz.transition 2042, 4, :o4, 19735847, 8 + tz.transition 2042, 10, :o1, 14803103, 6 + tz.transition 2043, 4, :o4, 19738759, 8 + tz.transition 2043, 10, :o1, 14805287, 6 + tz.transition 2044, 4, :o4, 19741671, 8 + tz.transition 2044, 10, :o1, 14807513, 6 + tz.transition 2045, 4, :o4, 19744583, 8 + tz.transition 2045, 10, :o1, 14809697, 6 + tz.transition 2046, 4, :o4, 19747495, 8 + tz.transition 2046, 10, :o1, 14811881, 6 + tz.transition 2047, 4, :o4, 19750463, 8 + tz.transition 2047, 10, :o1, 14814065, 6 + tz.transition 2048, 4, :o4, 19753375, 8 + tz.transition 2048, 10, :o1, 14816249, 6 + tz.transition 2049, 4, :o4, 19756287, 8 + tz.transition 2049, 10, :o1, 14818475, 6 + tz.transition 2050, 4, :o4, 19759199, 8 + tz.transition 2050, 10, :o1, 14820659, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb new file mode 100644 index 0000000000..2347fce647 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb @@ -0,0 +1,144 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Mexico_City + include TimezoneDefinition + + timezone 'America/Mexico_City' do |tz| + tz.offset :o0, -23796, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -21600, 0, :CST + tz.offset :o3, -21600, 3600, :CDT + tz.offset :o4, -21600, 3600, :CWT + + tz.transition 1922, 1, :o1, 58153339, 24 + tz.transition 1927, 6, :o2, 9700171, 4 + tz.transition 1930, 11, :o1, 9705183, 4 + tz.transition 1931, 5, :o2, 9705855, 4 + tz.transition 1931, 10, :o1, 9706463, 4 + tz.transition 1932, 4, :o2, 58243171, 24 + tz.transition 1939, 2, :o3, 9717199, 4 + tz.transition 1939, 6, :o2, 58306553, 24 + tz.transition 1940, 12, :o3, 9719891, 4 + tz.transition 1941, 4, :o2, 58322057, 24 + tz.transition 1943, 12, :o4, 9724299, 4 + tz.transition 1944, 5, :o2, 58349081, 24 + tz.transition 1950, 2, :o3, 9733299, 4 + tz.transition 1950, 7, :o2, 58403825, 24 + tz.transition 1996, 4, :o3, 828864000 + tz.transition 1996, 10, :o2, 846399600 + tz.transition 1997, 4, :o3, 860313600 + tz.transition 1997, 10, :o2, 877849200 + tz.transition 1998, 4, :o3, 891763200 + tz.transition 1998, 10, :o2, 909298800 + tz.transition 1999, 4, :o3, 923212800 + tz.transition 1999, 10, :o2, 941353200 + tz.transition 2000, 4, :o3, 954662400 + tz.transition 2000, 10, :o2, 972802800 + tz.transition 2001, 5, :o3, 989136000 + tz.transition 2001, 9, :o2, 1001833200 + tz.transition 2002, 4, :o3, 1018166400 + tz.transition 2002, 10, :o2, 1035702000 + tz.transition 2003, 4, :o3, 1049616000 + tz.transition 2003, 10, :o2, 1067151600 + tz.transition 2004, 4, :o3, 1081065600 + tz.transition 2004, 10, :o2, 1099206000 + tz.transition 2005, 4, :o3, 1112515200 + tz.transition 2005, 10, :o2, 1130655600 + tz.transition 2006, 4, :o3, 1143964800 + tz.transition 2006, 10, :o2, 1162105200 + tz.transition 2007, 4, :o3, 1175414400 + tz.transition 2007, 10, :o2, 1193554800 + tz.transition 2008, 4, :o3, 1207468800 + tz.transition 2008, 10, :o2, 1225004400 + tz.transition 2009, 4, :o3, 1238918400 + tz.transition 2009, 10, :o2, 1256454000 + tz.transition 2010, 4, :o3, 1270368000 + tz.transition 2010, 10, :o2, 1288508400 + tz.transition 2011, 4, :o3, 1301817600 + tz.transition 2011, 10, :o2, 1319958000 + tz.transition 2012, 4, :o3, 1333267200 + tz.transition 2012, 10, :o2, 1351407600 + tz.transition 2013, 4, :o3, 1365321600 + tz.transition 2013, 10, :o2, 1382857200 + tz.transition 2014, 4, :o3, 1396771200 + tz.transition 2014, 10, :o2, 1414306800 + tz.transition 2015, 4, :o3, 1428220800 + tz.transition 2015, 10, :o2, 1445756400 + tz.transition 2016, 4, :o3, 1459670400 + tz.transition 2016, 10, :o2, 1477810800 + tz.transition 2017, 4, :o3, 1491120000 + tz.transition 2017, 10, :o2, 1509260400 + tz.transition 2018, 4, :o3, 1522569600 + tz.transition 2018, 10, :o2, 1540710000 + tz.transition 2019, 4, :o3, 1554624000 + tz.transition 2019, 10, :o2, 1572159600 + tz.transition 2020, 4, :o3, 1586073600 + tz.transition 2020, 10, :o2, 1603609200 + tz.transition 2021, 4, :o3, 1617523200 + tz.transition 2021, 10, :o2, 1635663600 + tz.transition 2022, 4, :o3, 1648972800 + tz.transition 2022, 10, :o2, 1667113200 + tz.transition 2023, 4, :o3, 1680422400 + tz.transition 2023, 10, :o2, 1698562800 + tz.transition 2024, 4, :o3, 1712476800 + tz.transition 2024, 10, :o2, 1730012400 + tz.transition 2025, 4, :o3, 1743926400 + tz.transition 2025, 10, :o2, 1761462000 + tz.transition 2026, 4, :o3, 1775376000 + tz.transition 2026, 10, :o2, 1792911600 + tz.transition 2027, 4, :o3, 1806825600 + tz.transition 2027, 10, :o2, 1824966000 + tz.transition 2028, 4, :o3, 1838275200 + tz.transition 2028, 10, :o2, 1856415600 + tz.transition 2029, 4, :o3, 1869724800 + tz.transition 2029, 10, :o2, 1887865200 + tz.transition 2030, 4, :o3, 1901779200 + tz.transition 2030, 10, :o2, 1919314800 + tz.transition 2031, 4, :o3, 1933228800 + tz.transition 2031, 10, :o2, 1950764400 + tz.transition 2032, 4, :o3, 1964678400 + tz.transition 2032, 10, :o2, 1982818800 + tz.transition 2033, 4, :o3, 1996128000 + tz.transition 2033, 10, :o2, 2014268400 + tz.transition 2034, 4, :o3, 2027577600 + tz.transition 2034, 10, :o2, 2045718000 + tz.transition 2035, 4, :o3, 2059027200 + tz.transition 2035, 10, :o2, 2077167600 + tz.transition 2036, 4, :o3, 2091081600 + tz.transition 2036, 10, :o2, 2108617200 + tz.transition 2037, 4, :o3, 2122531200 + tz.transition 2037, 10, :o2, 2140066800 + tz.transition 2038, 4, :o3, 14793107, 6 + tz.transition 2038, 10, :o2, 59177467, 24 + tz.transition 2039, 4, :o3, 14795291, 6 + tz.transition 2039, 10, :o2, 59186203, 24 + tz.transition 2040, 4, :o3, 14797475, 6 + tz.transition 2040, 10, :o2, 59194939, 24 + tz.transition 2041, 4, :o3, 14799701, 6 + tz.transition 2041, 10, :o2, 59203675, 24 + tz.transition 2042, 4, :o3, 14801885, 6 + tz.transition 2042, 10, :o2, 59212411, 24 + tz.transition 2043, 4, :o3, 14804069, 6 + tz.transition 2043, 10, :o2, 59221147, 24 + tz.transition 2044, 4, :o3, 14806253, 6 + tz.transition 2044, 10, :o2, 59230051, 24 + tz.transition 2045, 4, :o3, 14808437, 6 + tz.transition 2045, 10, :o2, 59238787, 24 + tz.transition 2046, 4, :o3, 14810621, 6 + tz.transition 2046, 10, :o2, 59247523, 24 + tz.transition 2047, 4, :o3, 14812847, 6 + tz.transition 2047, 10, :o2, 59256259, 24 + tz.transition 2048, 4, :o3, 14815031, 6 + tz.transition 2048, 10, :o2, 59264995, 24 + tz.transition 2049, 4, :o3, 14817215, 6 + tz.transition 2049, 10, :o2, 59273899, 24 + tz.transition 2050, 4, :o3, 14819399, 6 + tz.transition 2050, 10, :o2, 59282635, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb new file mode 100644 index 0000000000..5816a9eab1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb @@ -0,0 +1,131 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Monterrey + include TimezoneDefinition + + timezone 'America/Monterrey' do |tz| + tz.offset :o0, -24076, 0, :LMT + tz.offset :o1, -21600, 0, :CST + tz.offset :o2, -21600, 3600, :CDT + + tz.transition 1922, 1, :o1, 9692223, 4 + tz.transition 1988, 4, :o2, 576057600 + tz.transition 1988, 10, :o1, 594198000 + tz.transition 1996, 4, :o2, 828864000 + tz.transition 1996, 10, :o1, 846399600 + tz.transition 1997, 4, :o2, 860313600 + tz.transition 1997, 10, :o1, 877849200 + tz.transition 1998, 4, :o2, 891763200 + tz.transition 1998, 10, :o1, 909298800 + tz.transition 1999, 4, :o2, 923212800 + tz.transition 1999, 10, :o1, 941353200 + tz.transition 2000, 4, :o2, 954662400 + tz.transition 2000, 10, :o1, 972802800 + tz.transition 2001, 5, :o2, 989136000 + tz.transition 2001, 9, :o1, 1001833200 + tz.transition 2002, 4, :o2, 1018166400 + tz.transition 2002, 10, :o1, 1035702000 + tz.transition 2003, 4, :o2, 1049616000 + tz.transition 2003, 10, :o1, 1067151600 + tz.transition 2004, 4, :o2, 1081065600 + tz.transition 2004, 10, :o1, 1099206000 + tz.transition 2005, 4, :o2, 1112515200 + tz.transition 2005, 10, :o1, 1130655600 + tz.transition 2006, 4, :o2, 1143964800 + tz.transition 2006, 10, :o1, 1162105200 + tz.transition 2007, 4, :o2, 1175414400 + tz.transition 2007, 10, :o1, 1193554800 + tz.transition 2008, 4, :o2, 1207468800 + tz.transition 2008, 10, :o1, 1225004400 + tz.transition 2009, 4, :o2, 1238918400 + tz.transition 2009, 10, :o1, 1256454000 + tz.transition 2010, 4, :o2, 1270368000 + tz.transition 2010, 10, :o1, 1288508400 + tz.transition 2011, 4, :o2, 1301817600 + tz.transition 2011, 10, :o1, 1319958000 + tz.transition 2012, 4, :o2, 1333267200 + tz.transition 2012, 10, :o1, 1351407600 + tz.transition 2013, 4, :o2, 1365321600 + tz.transition 2013, 10, :o1, 1382857200 + tz.transition 2014, 4, :o2, 1396771200 + tz.transition 2014, 10, :o1, 1414306800 + tz.transition 2015, 4, :o2, 1428220800 + tz.transition 2015, 10, :o1, 1445756400 + tz.transition 2016, 4, :o2, 1459670400 + tz.transition 2016, 10, :o1, 1477810800 + tz.transition 2017, 4, :o2, 1491120000 + tz.transition 2017, 10, :o1, 1509260400 + tz.transition 2018, 4, :o2, 1522569600 + tz.transition 2018, 10, :o1, 1540710000 + tz.transition 2019, 4, :o2, 1554624000 + tz.transition 2019, 10, :o1, 1572159600 + tz.transition 2020, 4, :o2, 1586073600 + tz.transition 2020, 10, :o1, 1603609200 + tz.transition 2021, 4, :o2, 1617523200 + tz.transition 2021, 10, :o1, 1635663600 + tz.transition 2022, 4, :o2, 1648972800 + tz.transition 2022, 10, :o1, 1667113200 + tz.transition 2023, 4, :o2, 1680422400 + tz.transition 2023, 10, :o1, 1698562800 + tz.transition 2024, 4, :o2, 1712476800 + tz.transition 2024, 10, :o1, 1730012400 + tz.transition 2025, 4, :o2, 1743926400 + tz.transition 2025, 10, :o1, 1761462000 + tz.transition 2026, 4, :o2, 1775376000 + tz.transition 2026, 10, :o1, 1792911600 + tz.transition 2027, 4, :o2, 1806825600 + tz.transition 2027, 10, :o1, 1824966000 + tz.transition 2028, 4, :o2, 1838275200 + tz.transition 2028, 10, :o1, 1856415600 + tz.transition 2029, 4, :o2, 1869724800 + tz.transition 2029, 10, :o1, 1887865200 + tz.transition 2030, 4, :o2, 1901779200 + tz.transition 2030, 10, :o1, 1919314800 + tz.transition 2031, 4, :o2, 1933228800 + tz.transition 2031, 10, :o1, 1950764400 + tz.transition 2032, 4, :o2, 1964678400 + tz.transition 2032, 10, :o1, 1982818800 + tz.transition 2033, 4, :o2, 1996128000 + tz.transition 2033, 10, :o1, 2014268400 + tz.transition 2034, 4, :o2, 2027577600 + tz.transition 2034, 10, :o1, 2045718000 + tz.transition 2035, 4, :o2, 2059027200 + tz.transition 2035, 10, :o1, 2077167600 + tz.transition 2036, 4, :o2, 2091081600 + tz.transition 2036, 10, :o1, 2108617200 + tz.transition 2037, 4, :o2, 2122531200 + tz.transition 2037, 10, :o1, 2140066800 + tz.transition 2038, 4, :o2, 14793107, 6 + tz.transition 2038, 10, :o1, 59177467, 24 + tz.transition 2039, 4, :o2, 14795291, 6 + tz.transition 2039, 10, :o1, 59186203, 24 + tz.transition 2040, 4, :o2, 14797475, 6 + tz.transition 2040, 10, :o1, 59194939, 24 + tz.transition 2041, 4, :o2, 14799701, 6 + tz.transition 2041, 10, :o1, 59203675, 24 + tz.transition 2042, 4, :o2, 14801885, 6 + tz.transition 2042, 10, :o1, 59212411, 24 + tz.transition 2043, 4, :o2, 14804069, 6 + tz.transition 2043, 10, :o1, 59221147, 24 + tz.transition 2044, 4, :o2, 14806253, 6 + tz.transition 2044, 10, :o1, 59230051, 24 + tz.transition 2045, 4, :o2, 14808437, 6 + tz.transition 2045, 10, :o1, 59238787, 24 + tz.transition 2046, 4, :o2, 14810621, 6 + tz.transition 2046, 10, :o1, 59247523, 24 + tz.transition 2047, 4, :o2, 14812847, 6 + tz.transition 2047, 10, :o1, 59256259, 24 + tz.transition 2048, 4, :o2, 14815031, 6 + tz.transition 2048, 10, :o1, 59264995, 24 + tz.transition 2049, 4, :o2, 14817215, 6 + tz.transition 2049, 10, :o1, 59273899, 24 + tz.transition 2050, 4, :o2, 14819399, 6 + tz.transition 2050, 10, :o1, 59282635, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb new file mode 100644 index 0000000000..7d802bd2de --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb @@ -0,0 +1,282 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module New_York + include TimezoneDefinition + + timezone 'America/New_York' do |tz| + tz.offset :o0, -17762, 0, :LMT + tz.offset :o1, -18000, 0, :EST + tz.offset :o2, -18000, 3600, :EDT + tz.offset :o3, -18000, 3600, :EWT + tz.offset :o4, -18000, 3600, :EPT + + tz.transition 1883, 11, :o1, 57819197, 24 + tz.transition 1918, 3, :o2, 58120411, 24 + tz.transition 1918, 10, :o1, 9687575, 4 + tz.transition 1919, 3, :o2, 58129147, 24 + tz.transition 1919, 10, :o1, 9689031, 4 + tz.transition 1920, 3, :o2, 58137883, 24 + tz.transition 1920, 10, :o1, 9690515, 4 + tz.transition 1921, 4, :o2, 58147291, 24 + tz.transition 1921, 9, :o1, 9691831, 4 + tz.transition 1922, 4, :o2, 58156195, 24 + tz.transition 1922, 9, :o1, 9693287, 4 + tz.transition 1923, 4, :o2, 58164931, 24 + tz.transition 1923, 9, :o1, 9694771, 4 + tz.transition 1924, 4, :o2, 58173667, 24 + tz.transition 1924, 9, :o1, 9696227, 4 + tz.transition 1925, 4, :o2, 58182403, 24 + tz.transition 1925, 9, :o1, 9697683, 4 + tz.transition 1926, 4, :o2, 58191139, 24 + tz.transition 1926, 9, :o1, 9699139, 4 + tz.transition 1927, 4, :o2, 58199875, 24 + tz.transition 1927, 9, :o1, 9700595, 4 + tz.transition 1928, 4, :o2, 58208779, 24 + tz.transition 1928, 9, :o1, 9702079, 4 + tz.transition 1929, 4, :o2, 58217515, 24 + tz.transition 1929, 9, :o1, 9703535, 4 + tz.transition 1930, 4, :o2, 58226251, 24 + tz.transition 1930, 9, :o1, 9704991, 4 + tz.transition 1931, 4, :o2, 58234987, 24 + tz.transition 1931, 9, :o1, 9706447, 4 + tz.transition 1932, 4, :o2, 58243723, 24 + tz.transition 1932, 9, :o1, 9707903, 4 + tz.transition 1933, 4, :o2, 58252627, 24 + tz.transition 1933, 9, :o1, 9709359, 4 + tz.transition 1934, 4, :o2, 58261363, 24 + tz.transition 1934, 9, :o1, 9710843, 4 + tz.transition 1935, 4, :o2, 58270099, 24 + tz.transition 1935, 9, :o1, 9712299, 4 + tz.transition 1936, 4, :o2, 58278835, 24 + tz.transition 1936, 9, :o1, 9713755, 4 + tz.transition 1937, 4, :o2, 58287571, 24 + tz.transition 1937, 9, :o1, 9715211, 4 + tz.transition 1938, 4, :o2, 58296307, 24 + tz.transition 1938, 9, :o1, 9716667, 4 + tz.transition 1939, 4, :o2, 58305211, 24 + tz.transition 1939, 9, :o1, 9718123, 4 + tz.transition 1940, 4, :o2, 58313947, 24 + tz.transition 1940, 9, :o1, 9719607, 4 + tz.transition 1941, 4, :o2, 58322683, 24 + tz.transition 1941, 9, :o1, 9721063, 4 + tz.transition 1942, 2, :o3, 58329595, 24 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 9726915, 4 + tz.transition 1946, 4, :o2, 58366531, 24 + tz.transition 1946, 9, :o1, 9728371, 4 + tz.transition 1947, 4, :o2, 58375267, 24 + tz.transition 1947, 9, :o1, 9729827, 4 + tz.transition 1948, 4, :o2, 58384003, 24 + tz.transition 1948, 9, :o1, 9731283, 4 + tz.transition 1949, 4, :o2, 58392739, 24 + tz.transition 1949, 9, :o1, 9732739, 4 + tz.transition 1950, 4, :o2, 58401643, 24 + tz.transition 1950, 9, :o1, 9734195, 4 + tz.transition 1951, 4, :o2, 58410379, 24 + tz.transition 1951, 9, :o1, 9735679, 4 + tz.transition 1952, 4, :o2, 58419115, 24 + tz.transition 1952, 9, :o1, 9737135, 4 + tz.transition 1953, 4, :o2, 58427851, 24 + tz.transition 1953, 9, :o1, 9738591, 4 + tz.transition 1954, 4, :o2, 58436587, 24 + tz.transition 1954, 9, :o1, 9740047, 4 + tz.transition 1955, 4, :o2, 58445323, 24 + tz.transition 1955, 10, :o1, 9741643, 4 + tz.transition 1956, 4, :o2, 58454227, 24 + tz.transition 1956, 10, :o1, 9743099, 4 + tz.transition 1957, 4, :o2, 58462963, 24 + tz.transition 1957, 10, :o1, 9744555, 4 + tz.transition 1958, 4, :o2, 58471699, 24 + tz.transition 1958, 10, :o1, 9746011, 4 + tz.transition 1959, 4, :o2, 58480435, 24 + tz.transition 1959, 10, :o1, 9747467, 4 + tz.transition 1960, 4, :o2, 58489171, 24 + tz.transition 1960, 10, :o1, 9748951, 4 + tz.transition 1961, 4, :o2, 58498075, 24 + tz.transition 1961, 10, :o1, 9750407, 4 + tz.transition 1962, 4, :o2, 58506811, 24 + tz.transition 1962, 10, :o1, 9751863, 4 + tz.transition 1963, 4, :o2, 58515547, 24 + tz.transition 1963, 10, :o1, 9753319, 4 + tz.transition 1964, 4, :o2, 58524283, 24 + tz.transition 1964, 10, :o1, 9754775, 4 + tz.transition 1965, 4, :o2, 58533019, 24 + tz.transition 1965, 10, :o1, 9756259, 4 + tz.transition 1966, 4, :o2, 58541755, 24 + tz.transition 1966, 10, :o1, 9757715, 4 + tz.transition 1967, 4, :o2, 58550659, 24 + tz.transition 1967, 10, :o1, 9759171, 4 + tz.transition 1968, 4, :o2, 58559395, 24 + tz.transition 1968, 10, :o1, 9760627, 4 + tz.transition 1969, 4, :o2, 58568131, 24 + tz.transition 1969, 10, :o1, 9762083, 4 + tz.transition 1970, 4, :o2, 9961200 + tz.transition 1970, 10, :o1, 25682400 + tz.transition 1971, 4, :o2, 41410800 + tz.transition 1971, 10, :o1, 57736800 + tz.transition 1972, 4, :o2, 73465200 + tz.transition 1972, 10, :o1, 89186400 + tz.transition 1973, 4, :o2, 104914800 + tz.transition 1973, 10, :o1, 120636000 + tz.transition 1974, 1, :o2, 126687600 + tz.transition 1974, 10, :o1, 152085600 + tz.transition 1975, 2, :o2, 162370800 + tz.transition 1975, 10, :o1, 183535200 + tz.transition 1976, 4, :o2, 199263600 + tz.transition 1976, 10, :o1, 215589600 + tz.transition 1977, 4, :o2, 230713200 + tz.transition 1977, 10, :o1, 247039200 + tz.transition 1978, 4, :o2, 262767600 + tz.transition 1978, 10, :o1, 278488800 + tz.transition 1979, 4, :o2, 294217200 + tz.transition 1979, 10, :o1, 309938400 + tz.transition 1980, 4, :o2, 325666800 + tz.transition 1980, 10, :o1, 341388000 + tz.transition 1981, 4, :o2, 357116400 + tz.transition 1981, 10, :o1, 372837600 + tz.transition 1982, 4, :o2, 388566000 + tz.transition 1982, 10, :o1, 404892000 + tz.transition 1983, 4, :o2, 420015600 + tz.transition 1983, 10, :o1, 436341600 + tz.transition 1984, 4, :o2, 452070000 + tz.transition 1984, 10, :o1, 467791200 + tz.transition 1985, 4, :o2, 483519600 + tz.transition 1985, 10, :o1, 499240800 + tz.transition 1986, 4, :o2, 514969200 + tz.transition 1986, 10, :o1, 530690400 + tz.transition 1987, 4, :o2, 544604400 + tz.transition 1987, 10, :o1, 562140000 + tz.transition 1988, 4, :o2, 576054000 + tz.transition 1988, 10, :o1, 594194400 + tz.transition 1989, 4, :o2, 607503600 + tz.transition 1989, 10, :o1, 625644000 + tz.transition 1990, 4, :o2, 638953200 + tz.transition 1990, 10, :o1, 657093600 + tz.transition 1991, 4, :o2, 671007600 + tz.transition 1991, 10, :o1, 688543200 + tz.transition 1992, 4, :o2, 702457200 + tz.transition 1992, 10, :o1, 719992800 + tz.transition 1993, 4, :o2, 733906800 + tz.transition 1993, 10, :o1, 752047200 + tz.transition 1994, 4, :o2, 765356400 + tz.transition 1994, 10, :o1, 783496800 + tz.transition 1995, 4, :o2, 796806000 + tz.transition 1995, 10, :o1, 814946400 + tz.transition 1996, 4, :o2, 828860400 + tz.transition 1996, 10, :o1, 846396000 + tz.transition 1997, 4, :o2, 860310000 + tz.transition 1997, 10, :o1, 877845600 + tz.transition 1998, 4, :o2, 891759600 + tz.transition 1998, 10, :o1, 909295200 + tz.transition 1999, 4, :o2, 923209200 + tz.transition 1999, 10, :o1, 941349600 + tz.transition 2000, 4, :o2, 954658800 + tz.transition 2000, 10, :o1, 972799200 + tz.transition 2001, 4, :o2, 986108400 + tz.transition 2001, 10, :o1, 1004248800 + tz.transition 2002, 4, :o2, 1018162800 + tz.transition 2002, 10, :o1, 1035698400 + tz.transition 2003, 4, :o2, 1049612400 + tz.transition 2003, 10, :o1, 1067148000 + tz.transition 2004, 4, :o2, 1081062000 + tz.transition 2004, 10, :o1, 1099202400 + tz.transition 2005, 4, :o2, 1112511600 + tz.transition 2005, 10, :o1, 1130652000 + tz.transition 2006, 4, :o2, 1143961200 + tz.transition 2006, 10, :o1, 1162101600 + tz.transition 2007, 3, :o2, 1173596400 + tz.transition 2007, 11, :o1, 1194156000 + tz.transition 2008, 3, :o2, 1205046000 + tz.transition 2008, 11, :o1, 1225605600 + tz.transition 2009, 3, :o2, 1236495600 + tz.transition 2009, 11, :o1, 1257055200 + tz.transition 2010, 3, :o2, 1268550000 + tz.transition 2010, 11, :o1, 1289109600 + tz.transition 2011, 3, :o2, 1299999600 + tz.transition 2011, 11, :o1, 1320559200 + tz.transition 2012, 3, :o2, 1331449200 + tz.transition 2012, 11, :o1, 1352008800 + tz.transition 2013, 3, :o2, 1362898800 + tz.transition 2013, 11, :o1, 1383458400 + tz.transition 2014, 3, :o2, 1394348400 + tz.transition 2014, 11, :o1, 1414908000 + tz.transition 2015, 3, :o2, 1425798000 + tz.transition 2015, 11, :o1, 1446357600 + tz.transition 2016, 3, :o2, 1457852400 + tz.transition 2016, 11, :o1, 1478412000 + tz.transition 2017, 3, :o2, 1489302000 + tz.transition 2017, 11, :o1, 1509861600 + tz.transition 2018, 3, :o2, 1520751600 + tz.transition 2018, 11, :o1, 1541311200 + tz.transition 2019, 3, :o2, 1552201200 + tz.transition 2019, 11, :o1, 1572760800 + tz.transition 2020, 3, :o2, 1583650800 + tz.transition 2020, 11, :o1, 1604210400 + tz.transition 2021, 3, :o2, 1615705200 + tz.transition 2021, 11, :o1, 1636264800 + tz.transition 2022, 3, :o2, 1647154800 + tz.transition 2022, 11, :o1, 1667714400 + tz.transition 2023, 3, :o2, 1678604400 + tz.transition 2023, 11, :o1, 1699164000 + tz.transition 2024, 3, :o2, 1710054000 + tz.transition 2024, 11, :o1, 1730613600 + tz.transition 2025, 3, :o2, 1741503600 + tz.transition 2025, 11, :o1, 1762063200 + tz.transition 2026, 3, :o2, 1772953200 + tz.transition 2026, 11, :o1, 1793512800 + tz.transition 2027, 3, :o2, 1805007600 + tz.transition 2027, 11, :o1, 1825567200 + tz.transition 2028, 3, :o2, 1836457200 + tz.transition 2028, 11, :o1, 1857016800 + tz.transition 2029, 3, :o2, 1867906800 + tz.transition 2029, 11, :o1, 1888466400 + tz.transition 2030, 3, :o2, 1899356400 + tz.transition 2030, 11, :o1, 1919916000 + tz.transition 2031, 3, :o2, 1930806000 + tz.transition 2031, 11, :o1, 1951365600 + tz.transition 2032, 3, :o2, 1962860400 + tz.transition 2032, 11, :o1, 1983420000 + tz.transition 2033, 3, :o2, 1994310000 + tz.transition 2033, 11, :o1, 2014869600 + tz.transition 2034, 3, :o2, 2025759600 + tz.transition 2034, 11, :o1, 2046319200 + tz.transition 2035, 3, :o2, 2057209200 + tz.transition 2035, 11, :o1, 2077768800 + tz.transition 2036, 3, :o2, 2088658800 + tz.transition 2036, 11, :o1, 2109218400 + tz.transition 2037, 3, :o2, 2120108400 + tz.transition 2037, 11, :o1, 2140668000 + tz.transition 2038, 3, :o2, 59171923, 24 + tz.transition 2038, 11, :o1, 9862939, 4 + tz.transition 2039, 3, :o2, 59180659, 24 + tz.transition 2039, 11, :o1, 9864395, 4 + tz.transition 2040, 3, :o2, 59189395, 24 + tz.transition 2040, 11, :o1, 9865851, 4 + tz.transition 2041, 3, :o2, 59198131, 24 + tz.transition 2041, 11, :o1, 9867307, 4 + tz.transition 2042, 3, :o2, 59206867, 24 + tz.transition 2042, 11, :o1, 9868763, 4 + tz.transition 2043, 3, :o2, 59215603, 24 + tz.transition 2043, 11, :o1, 9870219, 4 + tz.transition 2044, 3, :o2, 59224507, 24 + tz.transition 2044, 11, :o1, 9871703, 4 + tz.transition 2045, 3, :o2, 59233243, 24 + tz.transition 2045, 11, :o1, 9873159, 4 + tz.transition 2046, 3, :o2, 59241979, 24 + tz.transition 2046, 11, :o1, 9874615, 4 + tz.transition 2047, 3, :o2, 59250715, 24 + tz.transition 2047, 11, :o1, 9876071, 4 + tz.transition 2048, 3, :o2, 59259451, 24 + tz.transition 2048, 11, :o1, 9877527, 4 + tz.transition 2049, 3, :o2, 59268355, 24 + tz.transition 2049, 11, :o1, 9879011, 4 + tz.transition 2050, 3, :o2, 59277091, 24 + tz.transition 2050, 11, :o1, 9880467, 4 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb new file mode 100644 index 0000000000..b514e0c0f9 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb @@ -0,0 +1,30 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Phoenix + include TimezoneDefinition + + timezone 'America/Phoenix' do |tz| + tz.offset :o0, -26898, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -25200, 3600, :MDT + tz.offset :o3, -25200, 3600, :MWT + + tz.transition 1883, 11, :o1, 57819199, 24 + tz.transition 1918, 3, :o2, 19373471, 8 + tz.transition 1918, 10, :o1, 14531363, 6 + tz.transition 1919, 3, :o2, 19376383, 8 + tz.transition 1919, 10, :o1, 14533547, 6 + tz.transition 1942, 2, :o3, 19443199, 8 + tz.transition 1944, 1, :o1, 3500770681, 1440 + tz.transition 1944, 4, :o3, 3500901781, 1440 + tz.transition 1944, 10, :o1, 3501165241, 1440 + tz.transition 1967, 4, :o2, 19516887, 8 + tz.transition 1967, 10, :o1, 14638757, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb new file mode 100644 index 0000000000..ebdb68814a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb @@ -0,0 +1,74 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Regina + include TimezoneDefinition + + timezone 'America/Regina' do |tz| + tz.offset :o0, -25116, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -25200, 3600, :MDT + tz.offset :o3, -25200, 3600, :MWT + tz.offset :o4, -25200, 3600, :MPT + tz.offset :o5, -21600, 0, :CST + + tz.transition 1905, 9, :o1, 17403046493, 7200 + tz.transition 1918, 4, :o2, 19373583, 8 + tz.transition 1918, 10, :o1, 14531387, 6 + tz.transition 1930, 5, :o2, 58226419, 24 + tz.transition 1930, 10, :o1, 9705019, 4 + tz.transition 1931, 5, :o2, 58235155, 24 + tz.transition 1931, 10, :o1, 9706475, 4 + tz.transition 1932, 5, :o2, 58243891, 24 + tz.transition 1932, 10, :o1, 9707931, 4 + tz.transition 1933, 5, :o2, 58252795, 24 + tz.transition 1933, 10, :o1, 9709387, 4 + tz.transition 1934, 5, :o2, 58261531, 24 + tz.transition 1934, 10, :o1, 9710871, 4 + tz.transition 1937, 4, :o2, 58287235, 24 + tz.transition 1937, 10, :o1, 9715267, 4 + tz.transition 1938, 4, :o2, 58295971, 24 + tz.transition 1938, 10, :o1, 9716695, 4 + tz.transition 1939, 4, :o2, 58304707, 24 + tz.transition 1939, 10, :o1, 9718179, 4 + tz.transition 1940, 4, :o2, 58313611, 24 + tz.transition 1940, 10, :o1, 9719663, 4 + tz.transition 1941, 4, :o2, 58322347, 24 + tz.transition 1941, 10, :o1, 9721119, 4 + tz.transition 1942, 2, :o3, 19443199, 8 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 14590373, 6 + tz.transition 1946, 4, :o2, 19455399, 8 + tz.transition 1946, 10, :o1, 14592641, 6 + tz.transition 1947, 4, :o2, 19458423, 8 + tz.transition 1947, 9, :o1, 14594741, 6 + tz.transition 1948, 4, :o2, 19461335, 8 + tz.transition 1948, 9, :o1, 14596925, 6 + tz.transition 1949, 4, :o2, 19464247, 8 + tz.transition 1949, 9, :o1, 14599109, 6 + tz.transition 1950, 4, :o2, 19467215, 8 + tz.transition 1950, 9, :o1, 14601293, 6 + tz.transition 1951, 4, :o2, 19470127, 8 + tz.transition 1951, 9, :o1, 14603519, 6 + tz.transition 1952, 4, :o2, 19473039, 8 + tz.transition 1952, 9, :o1, 14605703, 6 + tz.transition 1953, 4, :o2, 19475951, 8 + tz.transition 1953, 9, :o1, 14607887, 6 + tz.transition 1954, 4, :o2, 19478863, 8 + tz.transition 1954, 9, :o1, 14610071, 6 + tz.transition 1955, 4, :o2, 19481775, 8 + tz.transition 1955, 9, :o1, 14612255, 6 + tz.transition 1956, 4, :o2, 19484743, 8 + tz.transition 1956, 9, :o1, 14614481, 6 + tz.transition 1957, 4, :o2, 19487655, 8 + tz.transition 1957, 9, :o1, 14616665, 6 + tz.transition 1959, 4, :o2, 19493479, 8 + tz.transition 1959, 10, :o1, 14621201, 6 + tz.transition 1960, 4, :o5, 19496391, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb new file mode 100644 index 0000000000..0287c9ebc4 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb @@ -0,0 +1,205 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Santiago + include TimezoneDefinition + + timezone 'America/Santiago' do |tz| + tz.offset :o0, -16966, 0, :LMT + tz.offset :o1, -16966, 0, :SMT + tz.offset :o2, -18000, 0, :CLT + tz.offset :o3, -14400, 0, :CLT + tz.offset :o4, -18000, 3600, :CLST + tz.offset :o5, -14400, 3600, :CLST + + tz.transition 1890, 1, :o1, 104171127683, 43200 + tz.transition 1910, 1, :o2, 104486660483, 43200 + tz.transition 1916, 7, :o1, 58105097, 24 + tz.transition 1918, 9, :o3, 104623388483, 43200 + tz.transition 1919, 7, :o1, 7266422, 3 + tz.transition 1927, 9, :o4, 104765386883, 43200 + tz.transition 1928, 4, :o2, 7276013, 3 + tz.transition 1928, 9, :o4, 58211777, 24 + tz.transition 1929, 4, :o2, 7277108, 3 + tz.transition 1929, 9, :o4, 58220537, 24 + tz.transition 1930, 4, :o2, 7278203, 3 + tz.transition 1930, 9, :o4, 58229297, 24 + tz.transition 1931, 4, :o2, 7279298, 3 + tz.transition 1931, 9, :o4, 58238057, 24 + tz.transition 1932, 4, :o2, 7280396, 3 + tz.transition 1932, 9, :o4, 58246841, 24 + tz.transition 1942, 6, :o2, 7291535, 3 + tz.transition 1942, 8, :o4, 58333745, 24 + tz.transition 1946, 9, :o2, 19456517, 8 + tz.transition 1947, 5, :o3, 58375865, 24 + tz.transition 1968, 11, :o5, 7320491, 3 + tz.transition 1969, 3, :o3, 19522485, 8 + tz.transition 1969, 11, :o5, 7321646, 3 + tz.transition 1970, 3, :o3, 7527600 + tz.transition 1970, 10, :o5, 24465600 + tz.transition 1971, 3, :o3, 37767600 + tz.transition 1971, 10, :o5, 55915200 + tz.transition 1972, 3, :o3, 69217200 + tz.transition 1972, 10, :o5, 87969600 + tz.transition 1973, 3, :o3, 100666800 + tz.transition 1973, 9, :o5, 118209600 + tz.transition 1974, 3, :o3, 132116400 + tz.transition 1974, 10, :o5, 150868800 + tz.transition 1975, 3, :o3, 163566000 + tz.transition 1975, 10, :o5, 182318400 + tz.transition 1976, 3, :o3, 195620400 + tz.transition 1976, 10, :o5, 213768000 + tz.transition 1977, 3, :o3, 227070000 + tz.transition 1977, 10, :o5, 245217600 + tz.transition 1978, 3, :o3, 258519600 + tz.transition 1978, 10, :o5, 277272000 + tz.transition 1979, 3, :o3, 289969200 + tz.transition 1979, 10, :o5, 308721600 + tz.transition 1980, 3, :o3, 321418800 + tz.transition 1980, 10, :o5, 340171200 + tz.transition 1981, 3, :o3, 353473200 + tz.transition 1981, 10, :o5, 371620800 + tz.transition 1982, 3, :o3, 384922800 + tz.transition 1982, 10, :o5, 403070400 + tz.transition 1983, 3, :o3, 416372400 + tz.transition 1983, 10, :o5, 434520000 + tz.transition 1984, 3, :o3, 447822000 + tz.transition 1984, 10, :o5, 466574400 + tz.transition 1985, 3, :o3, 479271600 + tz.transition 1985, 10, :o5, 498024000 + tz.transition 1986, 3, :o3, 510721200 + tz.transition 1986, 10, :o5, 529473600 + tz.transition 1987, 4, :o3, 545194800 + tz.transition 1987, 10, :o5, 560923200 + tz.transition 1988, 3, :o3, 574225200 + tz.transition 1988, 10, :o5, 591768000 + tz.transition 1989, 3, :o3, 605674800 + tz.transition 1989, 10, :o5, 624427200 + tz.transition 1990, 3, :o3, 637729200 + tz.transition 1990, 9, :o5, 653457600 + tz.transition 1991, 3, :o3, 668574000 + tz.transition 1991, 10, :o5, 687326400 + tz.transition 1992, 3, :o3, 700628400 + tz.transition 1992, 10, :o5, 718776000 + tz.transition 1993, 3, :o3, 732078000 + tz.transition 1993, 10, :o5, 750225600 + tz.transition 1994, 3, :o3, 763527600 + tz.transition 1994, 10, :o5, 781675200 + tz.transition 1995, 3, :o3, 794977200 + tz.transition 1995, 10, :o5, 813729600 + tz.transition 1996, 3, :o3, 826426800 + tz.transition 1996, 10, :o5, 845179200 + tz.transition 1997, 3, :o3, 859690800 + tz.transition 1997, 10, :o5, 876628800 + tz.transition 1998, 3, :o3, 889930800 + tz.transition 1998, 9, :o5, 906868800 + tz.transition 1999, 4, :o3, 923194800 + tz.transition 1999, 10, :o5, 939528000 + tz.transition 2000, 3, :o3, 952830000 + tz.transition 2000, 10, :o5, 971582400 + tz.transition 2001, 3, :o3, 984279600 + tz.transition 2001, 10, :o5, 1003032000 + tz.transition 2002, 3, :o3, 1015729200 + tz.transition 2002, 10, :o5, 1034481600 + tz.transition 2003, 3, :o3, 1047178800 + tz.transition 2003, 10, :o5, 1065931200 + tz.transition 2004, 3, :o3, 1079233200 + tz.transition 2004, 10, :o5, 1097380800 + tz.transition 2005, 3, :o3, 1110682800 + tz.transition 2005, 10, :o5, 1128830400 + tz.transition 2006, 3, :o3, 1142132400 + tz.transition 2006, 10, :o5, 1160884800 + tz.transition 2007, 3, :o3, 1173582000 + tz.transition 2007, 10, :o5, 1192334400 + tz.transition 2008, 3, :o3, 1206846000 + tz.transition 2008, 10, :o5, 1223784000 + tz.transition 2009, 3, :o3, 1237086000 + tz.transition 2009, 10, :o5, 1255233600 + tz.transition 2010, 3, :o3, 1268535600 + tz.transition 2010, 10, :o5, 1286683200 + tz.transition 2011, 3, :o3, 1299985200 + tz.transition 2011, 10, :o5, 1318132800 + tz.transition 2012, 3, :o3, 1331434800 + tz.transition 2012, 10, :o5, 1350187200 + tz.transition 2013, 3, :o3, 1362884400 + tz.transition 2013, 10, :o5, 1381636800 + tz.transition 2014, 3, :o3, 1394334000 + tz.transition 2014, 10, :o5, 1413086400 + tz.transition 2015, 3, :o3, 1426388400 + tz.transition 2015, 10, :o5, 1444536000 + tz.transition 2016, 3, :o3, 1457838000 + tz.transition 2016, 10, :o5, 1475985600 + tz.transition 2017, 3, :o3, 1489287600 + tz.transition 2017, 10, :o5, 1508040000 + tz.transition 2018, 3, :o3, 1520737200 + tz.transition 2018, 10, :o5, 1539489600 + tz.transition 2019, 3, :o3, 1552186800 + tz.transition 2019, 10, :o5, 1570939200 + tz.transition 2020, 3, :o3, 1584241200 + tz.transition 2020, 10, :o5, 1602388800 + tz.transition 2021, 3, :o3, 1615690800 + tz.transition 2021, 10, :o5, 1633838400 + tz.transition 2022, 3, :o3, 1647140400 + tz.transition 2022, 10, :o5, 1665288000 + tz.transition 2023, 3, :o3, 1678590000 + tz.transition 2023, 10, :o5, 1697342400 + tz.transition 2024, 3, :o3, 1710039600 + tz.transition 2024, 10, :o5, 1728792000 + tz.transition 2025, 3, :o3, 1741489200 + tz.transition 2025, 10, :o5, 1760241600 + tz.transition 2026, 3, :o3, 1773543600 + tz.transition 2026, 10, :o5, 1791691200 + tz.transition 2027, 3, :o3, 1804993200 + tz.transition 2027, 10, :o5, 1823140800 + tz.transition 2028, 3, :o3, 1836442800 + tz.transition 2028, 10, :o5, 1855195200 + tz.transition 2029, 3, :o3, 1867892400 + tz.transition 2029, 10, :o5, 1886644800 + tz.transition 2030, 3, :o3, 1899342000 + tz.transition 2030, 10, :o5, 1918094400 + tz.transition 2031, 3, :o3, 1930791600 + tz.transition 2031, 10, :o5, 1949544000 + tz.transition 2032, 3, :o3, 1962846000 + tz.transition 2032, 10, :o5, 1980993600 + tz.transition 2033, 3, :o3, 1994295600 + tz.transition 2033, 10, :o5, 2012443200 + tz.transition 2034, 3, :o3, 2025745200 + tz.transition 2034, 10, :o5, 2044497600 + tz.transition 2035, 3, :o3, 2057194800 + tz.transition 2035, 10, :o5, 2075947200 + tz.transition 2036, 3, :o3, 2088644400 + tz.transition 2036, 10, :o5, 2107396800 + tz.transition 2037, 3, :o3, 2120698800 + tz.transition 2037, 10, :o5, 2138846400 + tz.transition 2038, 3, :o3, 19723973, 8 + tz.transition 2038, 10, :o5, 7397120, 3 + tz.transition 2039, 3, :o3, 19726885, 8 + tz.transition 2039, 10, :o5, 7398212, 3 + tz.transition 2040, 3, :o3, 19729797, 8 + tz.transition 2040, 10, :o5, 7399325, 3 + tz.transition 2041, 3, :o3, 19732709, 8 + tz.transition 2041, 10, :o5, 7400417, 3 + tz.transition 2042, 3, :o3, 19735621, 8 + tz.transition 2042, 10, :o5, 7401509, 3 + tz.transition 2043, 3, :o3, 19738589, 8 + tz.transition 2043, 10, :o5, 7402601, 3 + tz.transition 2044, 3, :o3, 19741501, 8 + tz.transition 2044, 10, :o5, 7403693, 3 + tz.transition 2045, 3, :o3, 19744413, 8 + tz.transition 2045, 10, :o5, 7404806, 3 + tz.transition 2046, 3, :o3, 19747325, 8 + tz.transition 2046, 10, :o5, 7405898, 3 + tz.transition 2047, 3, :o3, 19750237, 8 + tz.transition 2047, 10, :o5, 7406990, 3 + tz.transition 2048, 3, :o3, 19753205, 8 + tz.transition 2048, 10, :o5, 7408082, 3 + tz.transition 2049, 3, :o3, 19756117, 8 + tz.transition 2049, 10, :o5, 7409174, 3 + tz.transition 2050, 3, :o3, 19759029, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb new file mode 100644 index 0000000000..0524f81c04 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb @@ -0,0 +1,171 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Sao_Paulo + include TimezoneDefinition + + timezone 'America/Sao_Paulo' do |tz| + tz.offset :o0, -11188, 0, :LMT + tz.offset :o1, -10800, 0, :BRT + tz.offset :o2, -10800, 3600, :BRST + + tz.transition 1914, 1, :o1, 52274886397, 21600 + tz.transition 1931, 10, :o2, 29119417, 12 + tz.transition 1932, 4, :o1, 29121583, 12 + tz.transition 1932, 10, :o2, 19415869, 8 + tz.transition 1933, 4, :o1, 29125963, 12 + tz.transition 1949, 12, :o2, 19466013, 8 + tz.transition 1950, 4, :o1, 19467101, 8 + tz.transition 1950, 12, :o2, 19468933, 8 + tz.transition 1951, 4, :o1, 29204851, 12 + tz.transition 1951, 12, :o2, 19471853, 8 + tz.transition 1952, 4, :o1, 29209243, 12 + tz.transition 1952, 12, :o2, 19474781, 8 + tz.transition 1953, 3, :o1, 29213251, 12 + tz.transition 1963, 10, :o2, 19506605, 8 + tz.transition 1964, 3, :o1, 29261467, 12 + tz.transition 1965, 1, :o2, 19510333, 8 + tz.transition 1965, 3, :o1, 29266207, 12 + tz.transition 1965, 12, :o2, 19512765, 8 + tz.transition 1966, 3, :o1, 29270227, 12 + tz.transition 1966, 11, :o2, 19515445, 8 + tz.transition 1967, 3, :o1, 29274607, 12 + tz.transition 1967, 11, :o2, 19518365, 8 + tz.transition 1968, 3, :o1, 29278999, 12 + tz.transition 1985, 11, :o2, 499748400 + tz.transition 1986, 3, :o1, 511236000 + tz.transition 1986, 10, :o2, 530593200 + tz.transition 1987, 2, :o1, 540266400 + tz.transition 1987, 10, :o2, 562129200 + tz.transition 1988, 2, :o1, 571197600 + tz.transition 1988, 10, :o2, 592974000 + tz.transition 1989, 1, :o1, 602042400 + tz.transition 1989, 10, :o2, 624423600 + tz.transition 1990, 2, :o1, 634701600 + tz.transition 1990, 10, :o2, 656478000 + tz.transition 1991, 2, :o1, 666756000 + tz.transition 1991, 10, :o2, 687927600 + tz.transition 1992, 2, :o1, 697600800 + tz.transition 1992, 10, :o2, 719982000 + tz.transition 1993, 1, :o1, 728445600 + tz.transition 1993, 10, :o2, 750826800 + tz.transition 1994, 2, :o1, 761709600 + tz.transition 1994, 10, :o2, 782276400 + tz.transition 1995, 2, :o1, 793159200 + tz.transition 1995, 10, :o2, 813726000 + tz.transition 1996, 2, :o1, 824004000 + tz.transition 1996, 10, :o2, 844570800 + tz.transition 1997, 2, :o1, 856058400 + tz.transition 1997, 10, :o2, 876106800 + tz.transition 1998, 3, :o1, 888717600 + tz.transition 1998, 10, :o2, 908074800 + tz.transition 1999, 2, :o1, 919562400 + tz.transition 1999, 10, :o2, 938919600 + tz.transition 2000, 2, :o1, 951616800 + tz.transition 2000, 10, :o2, 970974000 + tz.transition 2001, 2, :o1, 982461600 + tz.transition 2001, 10, :o2, 1003028400 + tz.transition 2002, 2, :o1, 1013911200 + tz.transition 2002, 11, :o2, 1036292400 + tz.transition 2003, 2, :o1, 1045360800 + tz.transition 2003, 10, :o2, 1066532400 + tz.transition 2004, 2, :o1, 1076810400 + tz.transition 2004, 11, :o2, 1099364400 + tz.transition 2005, 2, :o1, 1108864800 + tz.transition 2005, 10, :o2, 1129431600 + tz.transition 2006, 2, :o1, 1140314400 + tz.transition 2006, 11, :o2, 1162695600 + tz.transition 2007, 2, :o1, 1172368800 + tz.transition 2007, 10, :o2, 1192330800 + tz.transition 2008, 2, :o1, 1203213600 + tz.transition 2008, 10, :o2, 1224385200 + tz.transition 2009, 2, :o1, 1234663200 + tz.transition 2009, 10, :o2, 1255834800 + tz.transition 2010, 2, :o1, 1266717600 + tz.transition 2010, 10, :o2, 1287284400 + tz.transition 2011, 2, :o1, 1298167200 + tz.transition 2011, 10, :o2, 1318734000 + tz.transition 2012, 2, :o1, 1330221600 + tz.transition 2012, 10, :o2, 1350788400 + tz.transition 2013, 2, :o1, 1361066400 + tz.transition 2013, 10, :o2, 1382238000 + tz.transition 2014, 2, :o1, 1392516000 + tz.transition 2014, 10, :o2, 1413687600 + tz.transition 2015, 2, :o1, 1424570400 + tz.transition 2015, 10, :o2, 1445137200 + tz.transition 2016, 2, :o1, 1456020000 + tz.transition 2016, 10, :o2, 1476586800 + tz.transition 2017, 2, :o1, 1487469600 + tz.transition 2017, 10, :o2, 1508036400 + tz.transition 2018, 2, :o1, 1518919200 + tz.transition 2018, 10, :o2, 1540090800 + tz.transition 2019, 2, :o1, 1550368800 + tz.transition 2019, 10, :o2, 1571540400 + tz.transition 2020, 2, :o1, 1581818400 + tz.transition 2020, 10, :o2, 1602990000 + tz.transition 2021, 2, :o1, 1613872800 + tz.transition 2021, 10, :o2, 1634439600 + tz.transition 2022, 2, :o1, 1645322400 + tz.transition 2022, 10, :o2, 1665889200 + tz.transition 2023, 2, :o1, 1677376800 + tz.transition 2023, 10, :o2, 1697338800 + tz.transition 2024, 2, :o1, 1708221600 + tz.transition 2024, 10, :o2, 1729393200 + tz.transition 2025, 2, :o1, 1739671200 + tz.transition 2025, 10, :o2, 1760842800 + tz.transition 2026, 2, :o1, 1771725600 + tz.transition 2026, 10, :o2, 1792292400 + tz.transition 2027, 2, :o1, 1803175200 + tz.transition 2027, 10, :o2, 1823742000 + tz.transition 2028, 2, :o1, 1834624800 + tz.transition 2028, 10, :o2, 1855191600 + tz.transition 2029, 2, :o1, 1866074400 + tz.transition 2029, 10, :o2, 1887246000 + tz.transition 2030, 2, :o1, 1897524000 + tz.transition 2030, 10, :o2, 1918695600 + tz.transition 2031, 2, :o1, 1928973600 + tz.transition 2031, 10, :o2, 1950145200 + tz.transition 2032, 2, :o1, 1960423200 + tz.transition 2032, 10, :o2, 1981594800 + tz.transition 2033, 2, :o1, 1992477600 + tz.transition 2033, 10, :o2, 2013044400 + tz.transition 2034, 2, :o1, 2024532000 + tz.transition 2034, 10, :o2, 2044494000 + tz.transition 2035, 2, :o1, 2055376800 + tz.transition 2035, 10, :o2, 2076548400 + tz.transition 2036, 2, :o1, 2086826400 + tz.transition 2036, 10, :o2, 2107998000 + tz.transition 2037, 2, :o1, 2118880800 + tz.transition 2037, 10, :o2, 2139447600 + tz.transition 2038, 2, :o1, 29585707, 12 + tz.transition 2038, 10, :o2, 19725709, 8 + tz.transition 2039, 2, :o1, 29590075, 12 + tz.transition 2039, 10, :o2, 19728621, 8 + tz.transition 2040, 2, :o1, 29594443, 12 + tz.transition 2040, 10, :o2, 19731589, 8 + tz.transition 2041, 2, :o1, 29598811, 12 + tz.transition 2041, 10, :o2, 19734501, 8 + tz.transition 2042, 2, :o1, 29603179, 12 + tz.transition 2042, 10, :o2, 19737413, 8 + tz.transition 2043, 2, :o1, 29607547, 12 + tz.transition 2043, 10, :o2, 19740325, 8 + tz.transition 2044, 2, :o1, 29611999, 12 + tz.transition 2044, 10, :o2, 19743237, 8 + tz.transition 2045, 2, :o1, 29616367, 12 + tz.transition 2045, 10, :o2, 19746149, 8 + tz.transition 2046, 2, :o1, 29620735, 12 + tz.transition 2046, 10, :o2, 19749117, 8 + tz.transition 2047, 2, :o1, 29625103, 12 + tz.transition 2047, 10, :o2, 19752029, 8 + tz.transition 2048, 2, :o1, 29629471, 12 + tz.transition 2048, 10, :o2, 19754941, 8 + tz.transition 2049, 2, :o1, 29633923, 12 + tz.transition 2049, 10, :o2, 19757853, 8 + tz.transition 2050, 2, :o1, 29638291, 12 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb new file mode 100644 index 0000000000..e4a3599d35 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb @@ -0,0 +1,288 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module St_Johns + include TimezoneDefinition + + timezone 'America/St_Johns' do |tz| + tz.offset :o0, -12652, 0, :LMT + tz.offset :o1, -12652, 0, :NST + tz.offset :o2, -12652, 3600, :NDT + tz.offset :o3, -12600, 0, :NST + tz.offset :o4, -12600, 3600, :NDT + tz.offset :o5, -12600, 3600, :NWT + tz.offset :o6, -12600, 3600, :NPT + tz.offset :o7, -12600, 7200, :NDDT + + tz.transition 1884, 1, :o1, 52038215563, 21600 + tz.transition 1917, 4, :o2, 52300657363, 21600 + tz.transition 1917, 9, :o1, 52304155663, 21600 + tz.transition 1918, 4, :o2, 52308670963, 21600 + tz.transition 1918, 10, :o1, 52312990063, 21600 + tz.transition 1919, 5, :o2, 52317027463, 21600 + tz.transition 1919, 8, :o1, 52319164963, 21600 + tz.transition 1920, 5, :o2, 52324868263, 21600 + tz.transition 1920, 11, :o1, 52328798563, 21600 + tz.transition 1921, 5, :o2, 52332730663, 21600 + tz.transition 1921, 10, :o1, 52336660963, 21600 + tz.transition 1922, 5, :o2, 52340744263, 21600 + tz.transition 1922, 10, :o1, 52344523363, 21600 + tz.transition 1923, 5, :o2, 52348606663, 21600 + tz.transition 1923, 10, :o1, 52352385763, 21600 + tz.transition 1924, 5, :o2, 52356469063, 21600 + tz.transition 1924, 10, :o1, 52360248163, 21600 + tz.transition 1925, 5, :o2, 52364331463, 21600 + tz.transition 1925, 10, :o1, 52368110563, 21600 + tz.transition 1926, 5, :o2, 52372193863, 21600 + tz.transition 1926, 11, :o1, 52376124163, 21600 + tz.transition 1927, 5, :o2, 52380056263, 21600 + tz.transition 1927, 10, :o1, 52383986563, 21600 + tz.transition 1928, 5, :o2, 52388069863, 21600 + tz.transition 1928, 10, :o1, 52391848963, 21600 + tz.transition 1929, 5, :o2, 52395932263, 21600 + tz.transition 1929, 10, :o1, 52399711363, 21600 + tz.transition 1930, 5, :o2, 52403794663, 21600 + tz.transition 1930, 10, :o1, 52407573763, 21600 + tz.transition 1931, 5, :o2, 52411657063, 21600 + tz.transition 1931, 10, :o1, 52415436163, 21600 + tz.transition 1932, 5, :o2, 52419519463, 21600 + tz.transition 1932, 10, :o1, 52423449763, 21600 + tz.transition 1933, 5, :o2, 52427533063, 21600 + tz.transition 1933, 10, :o1, 52431312163, 21600 + tz.transition 1934, 5, :o2, 52435395463, 21600 + tz.transition 1934, 10, :o1, 52439174563, 21600 + tz.transition 1935, 3, :o3, 52442459563, 21600 + tz.transition 1935, 5, :o4, 116540573, 48 + tz.transition 1935, 10, :o3, 38849657, 16 + tz.transition 1936, 5, :o4, 116558383, 48 + tz.transition 1936, 10, :o3, 116565437, 48 + tz.transition 1937, 5, :o4, 116575855, 48 + tz.transition 1937, 10, :o3, 116582909, 48 + tz.transition 1938, 5, :o4, 116593327, 48 + tz.transition 1938, 10, :o3, 116600381, 48 + tz.transition 1939, 5, :o4, 116611135, 48 + tz.transition 1939, 10, :o3, 116617853, 48 + tz.transition 1940, 5, :o4, 116628607, 48 + tz.transition 1940, 10, :o3, 116635661, 48 + tz.transition 1941, 5, :o4, 116646079, 48 + tz.transition 1941, 10, :o3, 116653133, 48 + tz.transition 1942, 5, :o5, 116663551, 48 + tz.transition 1945, 8, :o6, 58360379, 24 + tz.transition 1945, 9, :o3, 38907659, 16 + tz.transition 1946, 5, :o4, 116733731, 48 + tz.transition 1946, 10, :o3, 38913595, 16 + tz.transition 1947, 5, :o4, 116751203, 48 + tz.transition 1947, 10, :o3, 38919419, 16 + tz.transition 1948, 5, :o4, 116768675, 48 + tz.transition 1948, 10, :o3, 38925243, 16 + tz.transition 1949, 5, :o4, 116786147, 48 + tz.transition 1949, 10, :o3, 38931067, 16 + tz.transition 1950, 5, :o4, 116803955, 48 + tz.transition 1950, 10, :o3, 38937003, 16 + tz.transition 1951, 4, :o4, 116820755, 48 + tz.transition 1951, 9, :o3, 38942715, 16 + tz.transition 1952, 4, :o4, 116838227, 48 + tz.transition 1952, 9, :o3, 38948539, 16 + tz.transition 1953, 4, :o4, 116855699, 48 + tz.transition 1953, 9, :o3, 38954363, 16 + tz.transition 1954, 4, :o4, 116873171, 48 + tz.transition 1954, 9, :o3, 38960187, 16 + tz.transition 1955, 4, :o4, 116890643, 48 + tz.transition 1955, 9, :o3, 38966011, 16 + tz.transition 1956, 4, :o4, 116908451, 48 + tz.transition 1956, 9, :o3, 38971947, 16 + tz.transition 1957, 4, :o4, 116925923, 48 + tz.transition 1957, 9, :o3, 38977771, 16 + tz.transition 1958, 4, :o4, 116943395, 48 + tz.transition 1958, 9, :o3, 38983595, 16 + tz.transition 1959, 4, :o4, 116960867, 48 + tz.transition 1959, 9, :o3, 38989419, 16 + tz.transition 1960, 4, :o4, 116978339, 48 + tz.transition 1960, 10, :o3, 38995803, 16 + tz.transition 1961, 4, :o4, 116996147, 48 + tz.transition 1961, 10, :o3, 39001627, 16 + tz.transition 1962, 4, :o4, 117013619, 48 + tz.transition 1962, 10, :o3, 39007451, 16 + tz.transition 1963, 4, :o4, 117031091, 48 + tz.transition 1963, 10, :o3, 39013275, 16 + tz.transition 1964, 4, :o4, 117048563, 48 + tz.transition 1964, 10, :o3, 39019099, 16 + tz.transition 1965, 4, :o4, 117066035, 48 + tz.transition 1965, 10, :o3, 39025035, 16 + tz.transition 1966, 4, :o4, 117083507, 48 + tz.transition 1966, 10, :o3, 39030859, 16 + tz.transition 1967, 4, :o4, 117101315, 48 + tz.transition 1967, 10, :o3, 39036683, 16 + tz.transition 1968, 4, :o4, 117118787, 48 + tz.transition 1968, 10, :o3, 39042507, 16 + tz.transition 1969, 4, :o4, 117136259, 48 + tz.transition 1969, 10, :o3, 39048331, 16 + tz.transition 1970, 4, :o4, 9955800 + tz.transition 1970, 10, :o3, 25677000 + tz.transition 1971, 4, :o4, 41405400 + tz.transition 1971, 10, :o3, 57731400 + tz.transition 1972, 4, :o4, 73459800 + tz.transition 1972, 10, :o3, 89181000 + tz.transition 1973, 4, :o4, 104909400 + tz.transition 1973, 10, :o3, 120630600 + tz.transition 1974, 4, :o4, 136359000 + tz.transition 1974, 10, :o3, 152080200 + tz.transition 1975, 4, :o4, 167808600 + tz.transition 1975, 10, :o3, 183529800 + tz.transition 1976, 4, :o4, 199258200 + tz.transition 1976, 10, :o3, 215584200 + tz.transition 1977, 4, :o4, 230707800 + tz.transition 1977, 10, :o3, 247033800 + tz.transition 1978, 4, :o4, 262762200 + tz.transition 1978, 10, :o3, 278483400 + tz.transition 1979, 4, :o4, 294211800 + tz.transition 1979, 10, :o3, 309933000 + tz.transition 1980, 4, :o4, 325661400 + tz.transition 1980, 10, :o3, 341382600 + tz.transition 1981, 4, :o4, 357111000 + tz.transition 1981, 10, :o3, 372832200 + tz.transition 1982, 4, :o4, 388560600 + tz.transition 1982, 10, :o3, 404886600 + tz.transition 1983, 4, :o4, 420010200 + tz.transition 1983, 10, :o3, 436336200 + tz.transition 1984, 4, :o4, 452064600 + tz.transition 1984, 10, :o3, 467785800 + tz.transition 1985, 4, :o4, 483514200 + tz.transition 1985, 10, :o3, 499235400 + tz.transition 1986, 4, :o4, 514963800 + tz.transition 1986, 10, :o3, 530685000 + tz.transition 1987, 4, :o4, 544591860 + tz.transition 1987, 10, :o3, 562127460 + tz.transition 1988, 4, :o7, 576041460 + tz.transition 1988, 10, :o3, 594178260 + tz.transition 1989, 4, :o4, 607491060 + tz.transition 1989, 10, :o3, 625631460 + tz.transition 1990, 4, :o4, 638940660 + tz.transition 1990, 10, :o3, 657081060 + tz.transition 1991, 4, :o4, 670995060 + tz.transition 1991, 10, :o3, 688530660 + tz.transition 1992, 4, :o4, 702444660 + tz.transition 1992, 10, :o3, 719980260 + tz.transition 1993, 4, :o4, 733894260 + tz.transition 1993, 10, :o3, 752034660 + tz.transition 1994, 4, :o4, 765343860 + tz.transition 1994, 10, :o3, 783484260 + tz.transition 1995, 4, :o4, 796793460 + tz.transition 1995, 10, :o3, 814933860 + tz.transition 1996, 4, :o4, 828847860 + tz.transition 1996, 10, :o3, 846383460 + tz.transition 1997, 4, :o4, 860297460 + tz.transition 1997, 10, :o3, 877833060 + tz.transition 1998, 4, :o4, 891747060 + tz.transition 1998, 10, :o3, 909282660 + tz.transition 1999, 4, :o4, 923196660 + tz.transition 1999, 10, :o3, 941337060 + tz.transition 2000, 4, :o4, 954646260 + tz.transition 2000, 10, :o3, 972786660 + tz.transition 2001, 4, :o4, 986095860 + tz.transition 2001, 10, :o3, 1004236260 + tz.transition 2002, 4, :o4, 1018150260 + tz.transition 2002, 10, :o3, 1035685860 + tz.transition 2003, 4, :o4, 1049599860 + tz.transition 2003, 10, :o3, 1067135460 + tz.transition 2004, 4, :o4, 1081049460 + tz.transition 2004, 10, :o3, 1099189860 + tz.transition 2005, 4, :o4, 1112499060 + tz.transition 2005, 10, :o3, 1130639460 + tz.transition 2006, 4, :o4, 1143948660 + tz.transition 2006, 10, :o3, 1162089060 + tz.transition 2007, 3, :o4, 1173583860 + tz.transition 2007, 11, :o3, 1194143460 + tz.transition 2008, 3, :o4, 1205033460 + tz.transition 2008, 11, :o3, 1225593060 + tz.transition 2009, 3, :o4, 1236483060 + tz.transition 2009, 11, :o3, 1257042660 + tz.transition 2010, 3, :o4, 1268537460 + tz.transition 2010, 11, :o3, 1289097060 + tz.transition 2011, 3, :o4, 1299987060 + tz.transition 2011, 11, :o3, 1320546660 + tz.transition 2012, 3, :o4, 1331436660 + tz.transition 2012, 11, :o3, 1351996260 + tz.transition 2013, 3, :o4, 1362886260 + tz.transition 2013, 11, :o3, 1383445860 + tz.transition 2014, 3, :o4, 1394335860 + tz.transition 2014, 11, :o3, 1414895460 + tz.transition 2015, 3, :o4, 1425785460 + tz.transition 2015, 11, :o3, 1446345060 + tz.transition 2016, 3, :o4, 1457839860 + tz.transition 2016, 11, :o3, 1478399460 + tz.transition 2017, 3, :o4, 1489289460 + tz.transition 2017, 11, :o3, 1509849060 + tz.transition 2018, 3, :o4, 1520739060 + tz.transition 2018, 11, :o3, 1541298660 + tz.transition 2019, 3, :o4, 1552188660 + tz.transition 2019, 11, :o3, 1572748260 + tz.transition 2020, 3, :o4, 1583638260 + tz.transition 2020, 11, :o3, 1604197860 + tz.transition 2021, 3, :o4, 1615692660 + tz.transition 2021, 11, :o3, 1636252260 + tz.transition 2022, 3, :o4, 1647142260 + tz.transition 2022, 11, :o3, 1667701860 + tz.transition 2023, 3, :o4, 1678591860 + tz.transition 2023, 11, :o3, 1699151460 + tz.transition 2024, 3, :o4, 1710041460 + tz.transition 2024, 11, :o3, 1730601060 + tz.transition 2025, 3, :o4, 1741491060 + tz.transition 2025, 11, :o3, 1762050660 + tz.transition 2026, 3, :o4, 1772940660 + tz.transition 2026, 11, :o3, 1793500260 + tz.transition 2027, 3, :o4, 1804995060 + tz.transition 2027, 11, :o3, 1825554660 + tz.transition 2028, 3, :o4, 1836444660 + tz.transition 2028, 11, :o3, 1857004260 + tz.transition 2029, 3, :o4, 1867894260 + tz.transition 2029, 11, :o3, 1888453860 + tz.transition 2030, 3, :o4, 1899343860 + tz.transition 2030, 11, :o3, 1919903460 + tz.transition 2031, 3, :o4, 1930793460 + tz.transition 2031, 11, :o3, 1951353060 + tz.transition 2032, 3, :o4, 1962847860 + tz.transition 2032, 11, :o3, 1983407460 + tz.transition 2033, 3, :o4, 1994297460 + tz.transition 2033, 11, :o3, 2014857060 + tz.transition 2034, 3, :o4, 2025747060 + tz.transition 2034, 11, :o3, 2046306660 + tz.transition 2035, 3, :o4, 2057196660 + tz.transition 2035, 11, :o3, 2077756260 + tz.transition 2036, 3, :o4, 2088646260 + tz.transition 2036, 11, :o3, 2109205860 + tz.transition 2037, 3, :o4, 2120095860 + tz.transition 2037, 11, :o3, 2140655460 + tz.transition 2038, 3, :o4, 3550315171, 1440 + tz.transition 2038, 11, :o3, 3550657831, 1440 + tz.transition 2039, 3, :o4, 3550839331, 1440 + tz.transition 2039, 11, :o3, 3551181991, 1440 + tz.transition 2040, 3, :o4, 3551363491, 1440 + tz.transition 2040, 11, :o3, 3551706151, 1440 + tz.transition 2041, 3, :o4, 3551887651, 1440 + tz.transition 2041, 11, :o3, 3552230311, 1440 + tz.transition 2042, 3, :o4, 3552411811, 1440 + tz.transition 2042, 11, :o3, 3552754471, 1440 + tz.transition 2043, 3, :o4, 3552935971, 1440 + tz.transition 2043, 11, :o3, 3553278631, 1440 + tz.transition 2044, 3, :o4, 3553470211, 1440 + tz.transition 2044, 11, :o3, 3553812871, 1440 + tz.transition 2045, 3, :o4, 3553994371, 1440 + tz.transition 2045, 11, :o3, 3554337031, 1440 + tz.transition 2046, 3, :o4, 3554518531, 1440 + tz.transition 2046, 11, :o3, 3554861191, 1440 + tz.transition 2047, 3, :o4, 3555042691, 1440 + tz.transition 2047, 11, :o3, 3555385351, 1440 + tz.transition 2048, 3, :o4, 3555566851, 1440 + tz.transition 2048, 11, :o3, 3555909511, 1440 + tz.transition 2049, 3, :o4, 3556101091, 1440 + tz.transition 2049, 11, :o3, 3556443751, 1440 + tz.transition 2050, 3, :o4, 3556625251, 1440 + tz.transition 2050, 11, :o3, 3556967911, 1440 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb new file mode 100644 index 0000000000..423059da46 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb @@ -0,0 +1,196 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Tijuana + include TimezoneDefinition + + timezone 'America/Tijuana' do |tz| + tz.offset :o0, -28084, 0, :LMT + tz.offset :o1, -25200, 0, :MST + tz.offset :o2, -28800, 0, :PST + tz.offset :o3, -28800, 3600, :PDT + tz.offset :o4, -28800, 3600, :PWT + tz.offset :o5, -28800, 3600, :PPT + + tz.transition 1922, 1, :o1, 14538335, 6 + tz.transition 1924, 1, :o2, 58170859, 24 + tz.transition 1927, 6, :o1, 58201027, 24 + tz.transition 1930, 11, :o2, 58231099, 24 + tz.transition 1931, 4, :o3, 14558597, 6 + tz.transition 1931, 9, :o2, 58238755, 24 + tz.transition 1942, 4, :o4, 14582843, 6 + tz.transition 1945, 8, :o5, 58360379, 24 + tz.transition 1945, 11, :o2, 58362523, 24 + tz.transition 1948, 4, :o3, 14595881, 6 + tz.transition 1949, 1, :o2, 58390339, 24 + tz.transition 1954, 4, :o3, 29218295, 12 + tz.transition 1954, 9, :o2, 19480095, 8 + tz.transition 1955, 4, :o3, 29222663, 12 + tz.transition 1955, 9, :o2, 19483007, 8 + tz.transition 1956, 4, :o3, 29227115, 12 + tz.transition 1956, 9, :o2, 19485975, 8 + tz.transition 1957, 4, :o3, 29231483, 12 + tz.transition 1957, 9, :o2, 19488887, 8 + tz.transition 1958, 4, :o3, 29235851, 12 + tz.transition 1958, 9, :o2, 19491799, 8 + tz.transition 1959, 4, :o3, 29240219, 12 + tz.transition 1959, 9, :o2, 19494711, 8 + tz.transition 1960, 4, :o3, 29244587, 12 + tz.transition 1960, 9, :o2, 19497623, 8 + tz.transition 1976, 4, :o3, 199274400 + tz.transition 1976, 10, :o2, 215600400 + tz.transition 1977, 4, :o3, 230724000 + tz.transition 1977, 10, :o2, 247050000 + tz.transition 1978, 4, :o3, 262778400 + tz.transition 1978, 10, :o2, 278499600 + tz.transition 1979, 4, :o3, 294228000 + tz.transition 1979, 10, :o2, 309949200 + tz.transition 1980, 4, :o3, 325677600 + tz.transition 1980, 10, :o2, 341398800 + tz.transition 1981, 4, :o3, 357127200 + tz.transition 1981, 10, :o2, 372848400 + tz.transition 1982, 4, :o3, 388576800 + tz.transition 1982, 10, :o2, 404902800 + tz.transition 1983, 4, :o3, 420026400 + tz.transition 1983, 10, :o2, 436352400 + tz.transition 1984, 4, :o3, 452080800 + tz.transition 1984, 10, :o2, 467802000 + tz.transition 1985, 4, :o3, 483530400 + tz.transition 1985, 10, :o2, 499251600 + tz.transition 1986, 4, :o3, 514980000 + tz.transition 1986, 10, :o2, 530701200 + tz.transition 1987, 4, :o3, 544615200 + tz.transition 1987, 10, :o2, 562150800 + tz.transition 1988, 4, :o3, 576064800 + tz.transition 1988, 10, :o2, 594205200 + tz.transition 1989, 4, :o3, 607514400 + tz.transition 1989, 10, :o2, 625654800 + tz.transition 1990, 4, :o3, 638964000 + tz.transition 1990, 10, :o2, 657104400 + tz.transition 1991, 4, :o3, 671018400 + tz.transition 1991, 10, :o2, 688554000 + tz.transition 1992, 4, :o3, 702468000 + tz.transition 1992, 10, :o2, 720003600 + tz.transition 1993, 4, :o3, 733917600 + tz.transition 1993, 10, :o2, 752058000 + tz.transition 1994, 4, :o3, 765367200 + tz.transition 1994, 10, :o2, 783507600 + tz.transition 1995, 4, :o3, 796816800 + tz.transition 1995, 10, :o2, 814957200 + tz.transition 1996, 4, :o3, 828871200 + tz.transition 1996, 10, :o2, 846406800 + tz.transition 1997, 4, :o3, 860320800 + tz.transition 1997, 10, :o2, 877856400 + tz.transition 1998, 4, :o3, 891770400 + tz.transition 1998, 10, :o2, 909306000 + tz.transition 1999, 4, :o3, 923220000 + tz.transition 1999, 10, :o2, 941360400 + tz.transition 2000, 4, :o3, 954669600 + tz.transition 2000, 10, :o2, 972810000 + tz.transition 2001, 4, :o3, 986119200 + tz.transition 2001, 10, :o2, 1004259600 + tz.transition 2002, 4, :o3, 1018173600 + tz.transition 2002, 10, :o2, 1035709200 + tz.transition 2003, 4, :o3, 1049623200 + tz.transition 2003, 10, :o2, 1067158800 + tz.transition 2004, 4, :o3, 1081072800 + tz.transition 2004, 10, :o2, 1099213200 + tz.transition 2005, 4, :o3, 1112522400 + tz.transition 2005, 10, :o2, 1130662800 + tz.transition 2006, 4, :o3, 1143972000 + tz.transition 2006, 10, :o2, 1162112400 + tz.transition 2007, 4, :o3, 1175421600 + tz.transition 2007, 10, :o2, 1193562000 + tz.transition 2008, 4, :o3, 1207476000 + tz.transition 2008, 10, :o2, 1225011600 + tz.transition 2009, 4, :o3, 1238925600 + tz.transition 2009, 10, :o2, 1256461200 + tz.transition 2010, 4, :o3, 1270375200 + tz.transition 2010, 10, :o2, 1288515600 + tz.transition 2011, 4, :o3, 1301824800 + tz.transition 2011, 10, :o2, 1319965200 + tz.transition 2012, 4, :o3, 1333274400 + tz.transition 2012, 10, :o2, 1351414800 + tz.transition 2013, 4, :o3, 1365328800 + tz.transition 2013, 10, :o2, 1382864400 + tz.transition 2014, 4, :o3, 1396778400 + tz.transition 2014, 10, :o2, 1414314000 + tz.transition 2015, 4, :o3, 1428228000 + tz.transition 2015, 10, :o2, 1445763600 + tz.transition 2016, 4, :o3, 1459677600 + tz.transition 2016, 10, :o2, 1477818000 + tz.transition 2017, 4, :o3, 1491127200 + tz.transition 2017, 10, :o2, 1509267600 + tz.transition 2018, 4, :o3, 1522576800 + tz.transition 2018, 10, :o2, 1540717200 + tz.transition 2019, 4, :o3, 1554631200 + tz.transition 2019, 10, :o2, 1572166800 + tz.transition 2020, 4, :o3, 1586080800 + tz.transition 2020, 10, :o2, 1603616400 + tz.transition 2021, 4, :o3, 1617530400 + tz.transition 2021, 10, :o2, 1635670800 + tz.transition 2022, 4, :o3, 1648980000 + tz.transition 2022, 10, :o2, 1667120400 + tz.transition 2023, 4, :o3, 1680429600 + tz.transition 2023, 10, :o2, 1698570000 + tz.transition 2024, 4, :o3, 1712484000 + tz.transition 2024, 10, :o2, 1730019600 + tz.transition 2025, 4, :o3, 1743933600 + tz.transition 2025, 10, :o2, 1761469200 + tz.transition 2026, 4, :o3, 1775383200 + tz.transition 2026, 10, :o2, 1792918800 + tz.transition 2027, 4, :o3, 1806832800 + tz.transition 2027, 10, :o2, 1824973200 + tz.transition 2028, 4, :o3, 1838282400 + tz.transition 2028, 10, :o2, 1856422800 + tz.transition 2029, 4, :o3, 1869732000 + tz.transition 2029, 10, :o2, 1887872400 + tz.transition 2030, 4, :o3, 1901786400 + tz.transition 2030, 10, :o2, 1919322000 + tz.transition 2031, 4, :o3, 1933236000 + tz.transition 2031, 10, :o2, 1950771600 + tz.transition 2032, 4, :o3, 1964685600 + tz.transition 2032, 10, :o2, 1982826000 + tz.transition 2033, 4, :o3, 1996135200 + tz.transition 2033, 10, :o2, 2014275600 + tz.transition 2034, 4, :o3, 2027584800 + tz.transition 2034, 10, :o2, 2045725200 + tz.transition 2035, 4, :o3, 2059034400 + tz.transition 2035, 10, :o2, 2077174800 + tz.transition 2036, 4, :o3, 2091088800 + tz.transition 2036, 10, :o2, 2108624400 + tz.transition 2037, 4, :o3, 2122538400 + tz.transition 2037, 10, :o2, 2140074000 + tz.transition 2038, 4, :o3, 29586215, 12 + tz.transition 2038, 10, :o2, 19725823, 8 + tz.transition 2039, 4, :o3, 29590583, 12 + tz.transition 2039, 10, :o2, 19728735, 8 + tz.transition 2040, 4, :o3, 29594951, 12 + tz.transition 2040, 10, :o2, 19731647, 8 + tz.transition 2041, 4, :o3, 29599403, 12 + tz.transition 2041, 10, :o2, 19734559, 8 + tz.transition 2042, 4, :o3, 29603771, 12 + tz.transition 2042, 10, :o2, 19737471, 8 + tz.transition 2043, 4, :o3, 29608139, 12 + tz.transition 2043, 10, :o2, 19740383, 8 + tz.transition 2044, 4, :o3, 29612507, 12 + tz.transition 2044, 10, :o2, 19743351, 8 + tz.transition 2045, 4, :o3, 29616875, 12 + tz.transition 2045, 10, :o2, 19746263, 8 + tz.transition 2046, 4, :o3, 29621243, 12 + tz.transition 2046, 10, :o2, 19749175, 8 + tz.transition 2047, 4, :o3, 29625695, 12 + tz.transition 2047, 10, :o2, 19752087, 8 + tz.transition 2048, 4, :o3, 29630063, 12 + tz.transition 2048, 10, :o2, 19754999, 8 + tz.transition 2049, 4, :o3, 29634431, 12 + tz.transition 2049, 10, :o2, 19757967, 8 + tz.transition 2050, 4, :o3, 29638799, 12 + tz.transition 2050, 10, :o2, 19760879, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb new file mode 100644 index 0000000000..9ee18970f1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb @@ -0,0 +1,67 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Almaty + include TimezoneDefinition + + timezone 'Asia/Almaty' do |tz| + tz.offset :o0, 18468, 0, :LMT + tz.offset :o1, 18000, 0, :ALMT + tz.offset :o2, 21600, 0, :ALMT + tz.offset :o3, 21600, 3600, :ALMST + + tz.transition 1924, 5, :o1, 1939125829, 800 + tz.transition 1930, 6, :o2, 58227559, 24 + tz.transition 1981, 3, :o3, 354909600 + tz.transition 1981, 9, :o2, 370717200 + tz.transition 1982, 3, :o3, 386445600 + tz.transition 1982, 9, :o2, 402253200 + tz.transition 1983, 3, :o3, 417981600 + tz.transition 1983, 9, :o2, 433789200 + tz.transition 1984, 3, :o3, 449604000 + tz.transition 1984, 9, :o2, 465336000 + tz.transition 1985, 3, :o3, 481060800 + tz.transition 1985, 9, :o2, 496785600 + tz.transition 1986, 3, :o3, 512510400 + tz.transition 1986, 9, :o2, 528235200 + tz.transition 1987, 3, :o3, 543960000 + tz.transition 1987, 9, :o2, 559684800 + tz.transition 1988, 3, :o3, 575409600 + tz.transition 1988, 9, :o2, 591134400 + tz.transition 1989, 3, :o3, 606859200 + tz.transition 1989, 9, :o2, 622584000 + tz.transition 1990, 3, :o3, 638308800 + tz.transition 1990, 9, :o2, 654638400 + tz.transition 1992, 3, :o3, 701802000 + tz.transition 1992, 9, :o2, 717523200 + tz.transition 1993, 3, :o3, 733262400 + tz.transition 1993, 9, :o2, 748987200 + tz.transition 1994, 3, :o3, 764712000 + tz.transition 1994, 9, :o2, 780436800 + tz.transition 1995, 3, :o3, 796161600 + tz.transition 1995, 9, :o2, 811886400 + tz.transition 1996, 3, :o3, 828216000 + tz.transition 1996, 10, :o2, 846360000 + tz.transition 1997, 3, :o3, 859665600 + tz.transition 1997, 10, :o2, 877809600 + tz.transition 1998, 3, :o3, 891115200 + tz.transition 1998, 10, :o2, 909259200 + tz.transition 1999, 3, :o3, 922564800 + tz.transition 1999, 10, :o2, 941313600 + tz.transition 2000, 3, :o3, 954014400 + tz.transition 2000, 10, :o2, 972763200 + tz.transition 2001, 3, :o3, 985464000 + tz.transition 2001, 10, :o2, 1004212800 + tz.transition 2002, 3, :o3, 1017518400 + tz.transition 2002, 10, :o2, 1035662400 + tz.transition 2003, 3, :o3, 1048968000 + tz.transition 2003, 10, :o2, 1067112000 + tz.transition 2004, 3, :o3, 1080417600 + tz.transition 2004, 10, :o2, 1099166400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb new file mode 100644 index 0000000000..774dca1587 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb @@ -0,0 +1,73 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Baghdad + include TimezoneDefinition + + timezone 'Asia/Baghdad' do |tz| + tz.offset :o0, 10660, 0, :LMT + tz.offset :o1, 10656, 0, :BMT + tz.offset :o2, 10800, 0, :AST + tz.offset :o3, 10800, 3600, :ADT + + tz.transition 1889, 12, :o1, 10417111387, 4320 + tz.transition 1917, 12, :o2, 726478313, 300 + tz.transition 1982, 4, :o3, 389048400 + tz.transition 1982, 9, :o2, 402264000 + tz.transition 1983, 3, :o3, 417906000 + tz.transition 1983, 9, :o2, 433800000 + tz.transition 1984, 3, :o3, 449614800 + tz.transition 1984, 9, :o2, 465422400 + tz.transition 1985, 3, :o3, 481150800 + tz.transition 1985, 9, :o2, 496792800 + tz.transition 1986, 3, :o3, 512517600 + tz.transition 1986, 9, :o2, 528242400 + tz.transition 1987, 3, :o3, 543967200 + tz.transition 1987, 9, :o2, 559692000 + tz.transition 1988, 3, :o3, 575416800 + tz.transition 1988, 9, :o2, 591141600 + tz.transition 1989, 3, :o3, 606866400 + tz.transition 1989, 9, :o2, 622591200 + tz.transition 1990, 3, :o3, 638316000 + tz.transition 1990, 9, :o2, 654645600 + tz.transition 1991, 4, :o3, 670464000 + tz.transition 1991, 10, :o2, 686275200 + tz.transition 1992, 4, :o3, 702086400 + tz.transition 1992, 10, :o2, 717897600 + tz.transition 1993, 4, :o3, 733622400 + tz.transition 1993, 10, :o2, 749433600 + tz.transition 1994, 4, :o3, 765158400 + tz.transition 1994, 10, :o2, 780969600 + tz.transition 1995, 4, :o3, 796694400 + tz.transition 1995, 10, :o2, 812505600 + tz.transition 1996, 4, :o3, 828316800 + tz.transition 1996, 10, :o2, 844128000 + tz.transition 1997, 4, :o3, 859852800 + tz.transition 1997, 10, :o2, 875664000 + tz.transition 1998, 4, :o3, 891388800 + tz.transition 1998, 10, :o2, 907200000 + tz.transition 1999, 4, :o3, 922924800 + tz.transition 1999, 10, :o2, 938736000 + tz.transition 2000, 4, :o3, 954547200 + tz.transition 2000, 10, :o2, 970358400 + tz.transition 2001, 4, :o3, 986083200 + tz.transition 2001, 10, :o2, 1001894400 + tz.transition 2002, 4, :o3, 1017619200 + tz.transition 2002, 10, :o2, 1033430400 + tz.transition 2003, 4, :o3, 1049155200 + tz.transition 2003, 10, :o2, 1064966400 + tz.transition 2004, 4, :o3, 1080777600 + tz.transition 2004, 10, :o2, 1096588800 + tz.transition 2005, 4, :o3, 1112313600 + tz.transition 2005, 10, :o2, 1128124800 + tz.transition 2006, 4, :o3, 1143849600 + tz.transition 2006, 10, :o2, 1159660800 + tz.transition 2007, 4, :o3, 1175385600 + tz.transition 2007, 10, :o2, 1191196800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb new file mode 100644 index 0000000000..e86340ebfa --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb @@ -0,0 +1,161 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Baku + include TimezoneDefinition + + timezone 'Asia/Baku' do |tz| + tz.offset :o0, 11964, 0, :LMT + tz.offset :o1, 10800, 0, :BAKT + tz.offset :o2, 14400, 0, :BAKT + tz.offset :o3, 14400, 3600, :BAKST + tz.offset :o4, 10800, 3600, :BAKST + tz.offset :o5, 10800, 3600, :AZST + tz.offset :o6, 10800, 0, :AZT + tz.offset :o7, 14400, 0, :AZT + tz.offset :o8, 14400, 3600, :AZST + + tz.transition 1924, 5, :o1, 17452133003, 7200 + tz.transition 1957, 2, :o2, 19487187, 8 + tz.transition 1981, 3, :o3, 354916800 + tz.transition 1981, 9, :o2, 370724400 + tz.transition 1982, 3, :o3, 386452800 + tz.transition 1982, 9, :o2, 402260400 + tz.transition 1983, 3, :o3, 417988800 + tz.transition 1983, 9, :o2, 433796400 + tz.transition 1984, 3, :o3, 449611200 + tz.transition 1984, 9, :o2, 465343200 + tz.transition 1985, 3, :o3, 481068000 + tz.transition 1985, 9, :o2, 496792800 + tz.transition 1986, 3, :o3, 512517600 + tz.transition 1986, 9, :o2, 528242400 + tz.transition 1987, 3, :o3, 543967200 + tz.transition 1987, 9, :o2, 559692000 + tz.transition 1988, 3, :o3, 575416800 + tz.transition 1988, 9, :o2, 591141600 + tz.transition 1989, 3, :o3, 606866400 + tz.transition 1989, 9, :o2, 622591200 + tz.transition 1990, 3, :o3, 638316000 + tz.transition 1990, 9, :o2, 654645600 + tz.transition 1991, 3, :o4, 670370400 + tz.transition 1991, 8, :o5, 683496000 + tz.transition 1991, 9, :o6, 686098800 + tz.transition 1992, 3, :o5, 701812800 + tz.transition 1992, 9, :o7, 717534000 + tz.transition 1996, 3, :o8, 828234000 + tz.transition 1996, 10, :o7, 846378000 + tz.transition 1997, 3, :o8, 859680000 + tz.transition 1997, 10, :o7, 877824000 + tz.transition 1998, 3, :o8, 891129600 + tz.transition 1998, 10, :o7, 909273600 + tz.transition 1999, 3, :o8, 922579200 + tz.transition 1999, 10, :o7, 941328000 + tz.transition 2000, 3, :o8, 954028800 + tz.transition 2000, 10, :o7, 972777600 + tz.transition 2001, 3, :o8, 985478400 + tz.transition 2001, 10, :o7, 1004227200 + tz.transition 2002, 3, :o8, 1017532800 + tz.transition 2002, 10, :o7, 1035676800 + tz.transition 2003, 3, :o8, 1048982400 + tz.transition 2003, 10, :o7, 1067126400 + tz.transition 2004, 3, :o8, 1080432000 + tz.transition 2004, 10, :o7, 1099180800 + tz.transition 2005, 3, :o8, 1111881600 + tz.transition 2005, 10, :o7, 1130630400 + tz.transition 2006, 3, :o8, 1143331200 + tz.transition 2006, 10, :o7, 1162080000 + tz.transition 2007, 3, :o8, 1174780800 + tz.transition 2007, 10, :o7, 1193529600 + tz.transition 2008, 3, :o8, 1206835200 + tz.transition 2008, 10, :o7, 1224979200 + tz.transition 2009, 3, :o8, 1238284800 + tz.transition 2009, 10, :o7, 1256428800 + tz.transition 2010, 3, :o8, 1269734400 + tz.transition 2010, 10, :o7, 1288483200 + tz.transition 2011, 3, :o8, 1301184000 + tz.transition 2011, 10, :o7, 1319932800 + tz.transition 2012, 3, :o8, 1332633600 + tz.transition 2012, 10, :o7, 1351382400 + tz.transition 2013, 3, :o8, 1364688000 + tz.transition 2013, 10, :o7, 1382832000 + tz.transition 2014, 3, :o8, 1396137600 + tz.transition 2014, 10, :o7, 1414281600 + tz.transition 2015, 3, :o8, 1427587200 + tz.transition 2015, 10, :o7, 1445731200 + tz.transition 2016, 3, :o8, 1459036800 + tz.transition 2016, 10, :o7, 1477785600 + tz.transition 2017, 3, :o8, 1490486400 + tz.transition 2017, 10, :o7, 1509235200 + tz.transition 2018, 3, :o8, 1521936000 + tz.transition 2018, 10, :o7, 1540684800 + tz.transition 2019, 3, :o8, 1553990400 + tz.transition 2019, 10, :o7, 1572134400 + tz.transition 2020, 3, :o8, 1585440000 + tz.transition 2020, 10, :o7, 1603584000 + tz.transition 2021, 3, :o8, 1616889600 + tz.transition 2021, 10, :o7, 1635638400 + tz.transition 2022, 3, :o8, 1648339200 + tz.transition 2022, 10, :o7, 1667088000 + tz.transition 2023, 3, :o8, 1679788800 + tz.transition 2023, 10, :o7, 1698537600 + tz.transition 2024, 3, :o8, 1711843200 + tz.transition 2024, 10, :o7, 1729987200 + tz.transition 2025, 3, :o8, 1743292800 + tz.transition 2025, 10, :o7, 1761436800 + tz.transition 2026, 3, :o8, 1774742400 + tz.transition 2026, 10, :o7, 1792886400 + tz.transition 2027, 3, :o8, 1806192000 + tz.transition 2027, 10, :o7, 1824940800 + tz.transition 2028, 3, :o8, 1837641600 + tz.transition 2028, 10, :o7, 1856390400 + tz.transition 2029, 3, :o8, 1869091200 + tz.transition 2029, 10, :o7, 1887840000 + tz.transition 2030, 3, :o8, 1901145600 + tz.transition 2030, 10, :o7, 1919289600 + tz.transition 2031, 3, :o8, 1932595200 + tz.transition 2031, 10, :o7, 1950739200 + tz.transition 2032, 3, :o8, 1964044800 + tz.transition 2032, 10, :o7, 1982793600 + tz.transition 2033, 3, :o8, 1995494400 + tz.transition 2033, 10, :o7, 2014243200 + tz.transition 2034, 3, :o8, 2026944000 + tz.transition 2034, 10, :o7, 2045692800 + tz.transition 2035, 3, :o8, 2058393600 + tz.transition 2035, 10, :o7, 2077142400 + tz.transition 2036, 3, :o8, 2090448000 + tz.transition 2036, 10, :o7, 2108592000 + tz.transition 2037, 3, :o8, 2121897600 + tz.transition 2037, 10, :o7, 2140041600 + tz.transition 2038, 3, :o8, 4931021, 2 + tz.transition 2038, 10, :o7, 4931455, 2 + tz.transition 2039, 3, :o8, 4931749, 2 + tz.transition 2039, 10, :o7, 4932183, 2 + tz.transition 2040, 3, :o8, 4932477, 2 + tz.transition 2040, 10, :o7, 4932911, 2 + tz.transition 2041, 3, :o8, 4933219, 2 + tz.transition 2041, 10, :o7, 4933639, 2 + tz.transition 2042, 3, :o8, 4933947, 2 + tz.transition 2042, 10, :o7, 4934367, 2 + tz.transition 2043, 3, :o8, 4934675, 2 + tz.transition 2043, 10, :o7, 4935095, 2 + tz.transition 2044, 3, :o8, 4935403, 2 + tz.transition 2044, 10, :o7, 4935837, 2 + tz.transition 2045, 3, :o8, 4936131, 2 + tz.transition 2045, 10, :o7, 4936565, 2 + tz.transition 2046, 3, :o8, 4936859, 2 + tz.transition 2046, 10, :o7, 4937293, 2 + tz.transition 2047, 3, :o8, 4937601, 2 + tz.transition 2047, 10, :o7, 4938021, 2 + tz.transition 2048, 3, :o8, 4938329, 2 + tz.transition 2048, 10, :o7, 4938749, 2 + tz.transition 2049, 3, :o8, 4939057, 2 + tz.transition 2049, 10, :o7, 4939491, 2 + tz.transition 2050, 3, :o8, 4939785, 2 + tz.transition 2050, 10, :o7, 4940219, 2 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb new file mode 100644 index 0000000000..139194e5e5 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb @@ -0,0 +1,20 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Bangkok + include TimezoneDefinition + + timezone 'Asia/Bangkok' do |tz| + tz.offset :o0, 24124, 0, :LMT + tz.offset :o1, 24124, 0, :BMT + tz.offset :o2, 25200, 0, :ICT + + tz.transition 1879, 12, :o1, 52006648769, 21600 + tz.transition 1920, 3, :o2, 52324168769, 21600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb new file mode 100644 index 0000000000..8c94b4ba86 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb @@ -0,0 +1,33 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Chongqing + include TimezoneDefinition + + timezone 'Asia/Chongqing' do |tz| + tz.offset :o0, 25580, 0, :LMT + tz.offset :o1, 25200, 0, :LONT + tz.offset :o2, 28800, 0, :CST + tz.offset :o3, 28800, 3600, :CDT + + tz.transition 1927, 12, :o1, 10477063601, 4320 + tz.transition 1980, 4, :o2, 325962000 + tz.transition 1986, 5, :o3, 515520000 + tz.transition 1986, 9, :o2, 527007600 + tz.transition 1987, 4, :o3, 545155200 + tz.transition 1987, 9, :o2, 558457200 + tz.transition 1988, 4, :o3, 576604800 + tz.transition 1988, 9, :o2, 589906800 + tz.transition 1989, 4, :o3, 608659200 + tz.transition 1989, 9, :o2, 621961200 + tz.transition 1990, 4, :o3, 640108800 + tz.transition 1990, 9, :o2, 653410800 + tz.transition 1991, 4, :o3, 671558400 + tz.transition 1991, 9, :o2, 684860400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb new file mode 100644 index 0000000000..f6531fa819 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb @@ -0,0 +1,30 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Colombo + include TimezoneDefinition + + timezone 'Asia/Colombo' do |tz| + tz.offset :o0, 19164, 0, :LMT + tz.offset :o1, 19172, 0, :MMT + tz.offset :o2, 19800, 0, :IST + tz.offset :o3, 19800, 1800, :IHST + tz.offset :o4, 19800, 3600, :IST + tz.offset :o5, 23400, 0, :LKT + tz.offset :o6, 21600, 0, :LKT + + tz.transition 1879, 12, :o1, 17335550003, 7200 + tz.transition 1905, 12, :o2, 52211763607, 21600 + tz.transition 1942, 1, :o3, 116657485, 48 + tz.transition 1942, 8, :o4, 9722413, 4 + tz.transition 1945, 10, :o2, 38907909, 16 + tz.transition 1996, 5, :o5, 832962600 + tz.transition 1996, 10, :o6, 846266400 + tz.transition 2006, 4, :o2, 1145039400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb new file mode 100644 index 0000000000..46dce9a0d0 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb @@ -0,0 +1,29 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Dhaka + include TimezoneDefinition + + timezone 'Asia/Dhaka' do |tz| + tz.offset :o0, 21700, 0, :LMT + tz.offset :o1, 21200, 0, :HMT + tz.offset :o2, 23400, 0, :BURT + tz.offset :o3, 19800, 0, :IST + tz.offset :o4, 21600, 0, :DACT + tz.offset :o5, 21600, 0, :BDT + tz.offset :o6, 21600, 3600, :BDST + + tz.transition 1889, 12, :o1, 2083422167, 864 + tz.transition 1941, 9, :o2, 524937943, 216 + tz.transition 1942, 5, :o3, 116663723, 48 + tz.transition 1942, 8, :o2, 116668957, 48 + tz.transition 1951, 9, :o4, 116828123, 48 + tz.transition 1971, 3, :o5, 38772000 + tz.transition 2009, 6, :o6, 1245430800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb new file mode 100644 index 0000000000..f1edd75ac8 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb @@ -0,0 +1,87 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Hong_Kong + include TimezoneDefinition + + timezone 'Asia/Hong_Kong' do |tz| + tz.offset :o0, 27396, 0, :LMT + tz.offset :o1, 28800, 0, :HKT + tz.offset :o2, 28800, 3600, :HKST + + tz.transition 1904, 10, :o1, 5800279639, 2400 + tz.transition 1946, 4, :o2, 38910885, 16 + tz.transition 1946, 11, :o1, 116743453, 48 + tz.transition 1947, 4, :o2, 38916613, 16 + tz.transition 1947, 12, :o1, 116762365, 48 + tz.transition 1948, 5, :o2, 38922773, 16 + tz.transition 1948, 10, :o1, 116777053, 48 + tz.transition 1949, 4, :o2, 38928149, 16 + tz.transition 1949, 10, :o1, 116794525, 48 + tz.transition 1950, 4, :o2, 38933973, 16 + tz.transition 1950, 10, :o1, 116811997, 48 + tz.transition 1951, 3, :o2, 38939797, 16 + tz.transition 1951, 10, :o1, 116829469, 48 + tz.transition 1952, 4, :o2, 38945733, 16 + tz.transition 1952, 10, :o1, 116846941, 48 + tz.transition 1953, 4, :o2, 38951557, 16 + tz.transition 1953, 10, :o1, 116864749, 48 + tz.transition 1954, 3, :o2, 38957157, 16 + tz.transition 1954, 10, :o1, 116882221, 48 + tz.transition 1955, 3, :o2, 38962981, 16 + tz.transition 1955, 11, :o1, 116900029, 48 + tz.transition 1956, 3, :o2, 38968805, 16 + tz.transition 1956, 11, :o1, 116917501, 48 + tz.transition 1957, 3, :o2, 38974741, 16 + tz.transition 1957, 11, :o1, 116934973, 48 + tz.transition 1958, 3, :o2, 38980565, 16 + tz.transition 1958, 11, :o1, 116952445, 48 + tz.transition 1959, 3, :o2, 38986389, 16 + tz.transition 1959, 10, :o1, 116969917, 48 + tz.transition 1960, 3, :o2, 38992213, 16 + tz.transition 1960, 11, :o1, 116987725, 48 + tz.transition 1961, 3, :o2, 38998037, 16 + tz.transition 1961, 11, :o1, 117005197, 48 + tz.transition 1962, 3, :o2, 39003861, 16 + tz.transition 1962, 11, :o1, 117022669, 48 + tz.transition 1963, 3, :o2, 39009797, 16 + tz.transition 1963, 11, :o1, 117040141, 48 + tz.transition 1964, 3, :o2, 39015621, 16 + tz.transition 1964, 10, :o1, 117057613, 48 + tz.transition 1965, 4, :o2, 39021893, 16 + tz.transition 1965, 10, :o1, 117074413, 48 + tz.transition 1966, 4, :o2, 39027717, 16 + tz.transition 1966, 10, :o1, 117091885, 48 + tz.transition 1967, 4, :o2, 39033541, 16 + tz.transition 1967, 10, :o1, 117109693, 48 + tz.transition 1968, 4, :o2, 39039477, 16 + tz.transition 1968, 10, :o1, 117127165, 48 + tz.transition 1969, 4, :o2, 39045301, 16 + tz.transition 1969, 10, :o1, 117144637, 48 + tz.transition 1970, 4, :o2, 9315000 + tz.transition 1970, 10, :o1, 25036200 + tz.transition 1971, 4, :o2, 40764600 + tz.transition 1971, 10, :o1, 56485800 + tz.transition 1972, 4, :o2, 72214200 + tz.transition 1972, 10, :o1, 88540200 + tz.transition 1973, 4, :o2, 104268600 + tz.transition 1973, 10, :o1, 119989800 + tz.transition 1974, 4, :o2, 135718200 + tz.transition 1974, 10, :o1, 151439400 + tz.transition 1975, 4, :o2, 167167800 + tz.transition 1975, 10, :o1, 182889000 + tz.transition 1976, 4, :o2, 198617400 + tz.transition 1976, 10, :o1, 214338600 + tz.transition 1977, 4, :o2, 230067000 + tz.transition 1977, 10, :o1, 245788200 + tz.transition 1979, 5, :o2, 295385400 + tz.transition 1979, 10, :o1, 309292200 + tz.transition 1980, 5, :o2, 326835000 + tz.transition 1980, 10, :o1, 340741800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb new file mode 100644 index 0000000000..2d47d9580b --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb @@ -0,0 +1,165 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Irkutsk + include TimezoneDefinition + + timezone 'Asia/Irkutsk' do |tz| + tz.offset :o0, 25040, 0, :LMT + tz.offset :o1, 25040, 0, :IMT + tz.offset :o2, 25200, 0, :IRKT + tz.offset :o3, 28800, 0, :IRKT + tz.offset :o4, 28800, 3600, :IRKST + tz.offset :o5, 25200, 3600, :IRKST + + tz.transition 1879, 12, :o1, 2600332427, 1080 + tz.transition 1920, 1, :o2, 2616136067, 1080 + tz.transition 1930, 6, :o3, 58227557, 24 + tz.transition 1981, 3, :o4, 354902400 + tz.transition 1981, 9, :o3, 370710000 + tz.transition 1982, 3, :o4, 386438400 + tz.transition 1982, 9, :o3, 402246000 + tz.transition 1983, 3, :o4, 417974400 + tz.transition 1983, 9, :o3, 433782000 + tz.transition 1984, 3, :o4, 449596800 + tz.transition 1984, 9, :o3, 465328800 + tz.transition 1985, 3, :o4, 481053600 + tz.transition 1985, 9, :o3, 496778400 + tz.transition 1986, 3, :o4, 512503200 + tz.transition 1986, 9, :o3, 528228000 + tz.transition 1987, 3, :o4, 543952800 + tz.transition 1987, 9, :o3, 559677600 + tz.transition 1988, 3, :o4, 575402400 + tz.transition 1988, 9, :o3, 591127200 + tz.transition 1989, 3, :o4, 606852000 + tz.transition 1989, 9, :o3, 622576800 + tz.transition 1990, 3, :o4, 638301600 + tz.transition 1990, 9, :o3, 654631200 + tz.transition 1991, 3, :o5, 670356000 + tz.transition 1991, 9, :o2, 686084400 + tz.transition 1992, 1, :o3, 695761200 + tz.transition 1992, 3, :o4, 701794800 + tz.transition 1992, 9, :o3, 717516000 + tz.transition 1993, 3, :o4, 733255200 + tz.transition 1993, 9, :o3, 748980000 + tz.transition 1994, 3, :o4, 764704800 + tz.transition 1994, 9, :o3, 780429600 + tz.transition 1995, 3, :o4, 796154400 + tz.transition 1995, 9, :o3, 811879200 + tz.transition 1996, 3, :o4, 828208800 + tz.transition 1996, 10, :o3, 846352800 + tz.transition 1997, 3, :o4, 859658400 + tz.transition 1997, 10, :o3, 877802400 + tz.transition 1998, 3, :o4, 891108000 + tz.transition 1998, 10, :o3, 909252000 + tz.transition 1999, 3, :o4, 922557600 + tz.transition 1999, 10, :o3, 941306400 + tz.transition 2000, 3, :o4, 954007200 + tz.transition 2000, 10, :o3, 972756000 + tz.transition 2001, 3, :o4, 985456800 + tz.transition 2001, 10, :o3, 1004205600 + tz.transition 2002, 3, :o4, 1017511200 + tz.transition 2002, 10, :o3, 1035655200 + tz.transition 2003, 3, :o4, 1048960800 + tz.transition 2003, 10, :o3, 1067104800 + tz.transition 2004, 3, :o4, 1080410400 + tz.transition 2004, 10, :o3, 1099159200 + tz.transition 2005, 3, :o4, 1111860000 + tz.transition 2005, 10, :o3, 1130608800 + tz.transition 2006, 3, :o4, 1143309600 + tz.transition 2006, 10, :o3, 1162058400 + tz.transition 2007, 3, :o4, 1174759200 + tz.transition 2007, 10, :o3, 1193508000 + tz.transition 2008, 3, :o4, 1206813600 + tz.transition 2008, 10, :o3, 1224957600 + tz.transition 2009, 3, :o4, 1238263200 + tz.transition 2009, 10, :o3, 1256407200 + tz.transition 2010, 3, :o4, 1269712800 + tz.transition 2010, 10, :o3, 1288461600 + tz.transition 2011, 3, :o4, 1301162400 + tz.transition 2011, 10, :o3, 1319911200 + tz.transition 2012, 3, :o4, 1332612000 + tz.transition 2012, 10, :o3, 1351360800 + tz.transition 2013, 3, :o4, 1364666400 + tz.transition 2013, 10, :o3, 1382810400 + tz.transition 2014, 3, :o4, 1396116000 + tz.transition 2014, 10, :o3, 1414260000 + tz.transition 2015, 3, :o4, 1427565600 + tz.transition 2015, 10, :o3, 1445709600 + tz.transition 2016, 3, :o4, 1459015200 + tz.transition 2016, 10, :o3, 1477764000 + tz.transition 2017, 3, :o4, 1490464800 + tz.transition 2017, 10, :o3, 1509213600 + tz.transition 2018, 3, :o4, 1521914400 + tz.transition 2018, 10, :o3, 1540663200 + tz.transition 2019, 3, :o4, 1553968800 + tz.transition 2019, 10, :o3, 1572112800 + tz.transition 2020, 3, :o4, 1585418400 + tz.transition 2020, 10, :o3, 1603562400 + tz.transition 2021, 3, :o4, 1616868000 + tz.transition 2021, 10, :o3, 1635616800 + tz.transition 2022, 3, :o4, 1648317600 + tz.transition 2022, 10, :o3, 1667066400 + tz.transition 2023, 3, :o4, 1679767200 + tz.transition 2023, 10, :o3, 1698516000 + tz.transition 2024, 3, :o4, 1711821600 + tz.transition 2024, 10, :o3, 1729965600 + tz.transition 2025, 3, :o4, 1743271200 + tz.transition 2025, 10, :o3, 1761415200 + tz.transition 2026, 3, :o4, 1774720800 + tz.transition 2026, 10, :o3, 1792864800 + tz.transition 2027, 3, :o4, 1806170400 + tz.transition 2027, 10, :o3, 1824919200 + tz.transition 2028, 3, :o4, 1837620000 + tz.transition 2028, 10, :o3, 1856368800 + tz.transition 2029, 3, :o4, 1869069600 + tz.transition 2029, 10, :o3, 1887818400 + tz.transition 2030, 3, :o4, 1901124000 + tz.transition 2030, 10, :o3, 1919268000 + tz.transition 2031, 3, :o4, 1932573600 + tz.transition 2031, 10, :o3, 1950717600 + tz.transition 2032, 3, :o4, 1964023200 + tz.transition 2032, 10, :o3, 1982772000 + tz.transition 2033, 3, :o4, 1995472800 + tz.transition 2033, 10, :o3, 2014221600 + tz.transition 2034, 3, :o4, 2026922400 + tz.transition 2034, 10, :o3, 2045671200 + tz.transition 2035, 3, :o4, 2058372000 + tz.transition 2035, 10, :o3, 2077120800 + tz.transition 2036, 3, :o4, 2090426400 + tz.transition 2036, 10, :o3, 2108570400 + tz.transition 2037, 3, :o4, 2121876000 + tz.transition 2037, 10, :o3, 2140020000 + tz.transition 2038, 3, :o4, 9862041, 4 + tz.transition 2038, 10, :o3, 9862909, 4 + tz.transition 2039, 3, :o4, 9863497, 4 + tz.transition 2039, 10, :o3, 9864365, 4 + tz.transition 2040, 3, :o4, 9864953, 4 + tz.transition 2040, 10, :o3, 9865821, 4 + tz.transition 2041, 3, :o4, 9866437, 4 + tz.transition 2041, 10, :o3, 9867277, 4 + tz.transition 2042, 3, :o4, 9867893, 4 + tz.transition 2042, 10, :o3, 9868733, 4 + tz.transition 2043, 3, :o4, 9869349, 4 + tz.transition 2043, 10, :o3, 9870189, 4 + tz.transition 2044, 3, :o4, 9870805, 4 + tz.transition 2044, 10, :o3, 9871673, 4 + tz.transition 2045, 3, :o4, 9872261, 4 + tz.transition 2045, 10, :o3, 9873129, 4 + tz.transition 2046, 3, :o4, 9873717, 4 + tz.transition 2046, 10, :o3, 9874585, 4 + tz.transition 2047, 3, :o4, 9875201, 4 + tz.transition 2047, 10, :o3, 9876041, 4 + tz.transition 2048, 3, :o4, 9876657, 4 + tz.transition 2048, 10, :o3, 9877497, 4 + tz.transition 2049, 3, :o4, 9878113, 4 + tz.transition 2049, 10, :o3, 9878981, 4 + tz.transition 2050, 3, :o4, 9879569, 4 + tz.transition 2050, 10, :o3, 9880437, 4 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb new file mode 100644 index 0000000000..cc58fa173b --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb @@ -0,0 +1,30 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Jakarta + include TimezoneDefinition + + timezone 'Asia/Jakarta' do |tz| + tz.offset :o0, 25632, 0, :LMT + tz.offset :o1, 25632, 0, :JMT + tz.offset :o2, 26400, 0, :JAVT + tz.offset :o3, 27000, 0, :WIT + tz.offset :o4, 32400, 0, :JST + tz.offset :o5, 28800, 0, :WIT + tz.offset :o6, 25200, 0, :WIT + + tz.transition 1867, 8, :o1, 720956461, 300 + tz.transition 1923, 12, :o2, 87256267, 36 + tz.transition 1932, 10, :o3, 87372439, 36 + tz.transition 1942, 3, :o4, 38887059, 16 + tz.transition 1945, 9, :o3, 19453769, 8 + tz.transition 1948, 4, :o5, 38922755, 16 + tz.transition 1950, 4, :o3, 14600413, 6 + tz.transition 1963, 12, :o6, 39014323, 16 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb new file mode 100644 index 0000000000..9b737b899e --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Jerusalem + include TimezoneDefinition + + timezone 'Asia/Jerusalem' do |tz| + tz.offset :o0, 8456, 0, :LMT + tz.offset :o1, 8440, 0, :JMT + tz.offset :o2, 7200, 0, :IST + tz.offset :o3, 7200, 3600, :IDT + tz.offset :o4, 7200, 7200, :IDDT + + tz.transition 1879, 12, :o1, 26003326343, 10800 + tz.transition 1917, 12, :o2, 5230643909, 2160 + tz.transition 1940, 5, :o3, 29157377, 12 + tz.transition 1942, 10, :o2, 19445315, 8 + tz.transition 1943, 4, :o3, 4861631, 2 + tz.transition 1943, 10, :o2, 19448235, 8 + tz.transition 1944, 3, :o3, 29174177, 12 + tz.transition 1944, 10, :o2, 19451163, 8 + tz.transition 1945, 4, :o3, 29178737, 12 + tz.transition 1945, 10, :o2, 58362251, 24 + tz.transition 1946, 4, :o3, 4863853, 2 + tz.transition 1946, 10, :o2, 19457003, 8 + tz.transition 1948, 5, :o4, 29192333, 12 + tz.transition 1948, 8, :o3, 7298386, 3 + tz.transition 1948, 10, :o2, 58388555, 24 + tz.transition 1949, 4, :o3, 29196449, 12 + tz.transition 1949, 10, :o2, 58397315, 24 + tz.transition 1950, 4, :o3, 29200649, 12 + tz.transition 1950, 9, :o2, 4867079, 2 + tz.transition 1951, 3, :o3, 29204849, 12 + tz.transition 1951, 11, :o2, 4867923, 2 + tz.transition 1952, 4, :o3, 4868245, 2 + tz.transition 1952, 10, :o2, 4868609, 2 + tz.transition 1953, 4, :o3, 4868959, 2 + tz.transition 1953, 9, :o2, 4869267, 2 + tz.transition 1954, 6, :o3, 29218877, 12 + tz.transition 1954, 9, :o2, 19479979, 8 + tz.transition 1955, 6, :o3, 4870539, 2 + tz.transition 1955, 9, :o2, 19482891, 8 + tz.transition 1956, 6, :o3, 29227529, 12 + tz.transition 1956, 9, :o2, 4871493, 2 + tz.transition 1957, 4, :o3, 4871915, 2 + tz.transition 1957, 9, :o2, 19488827, 8 + tz.transition 1974, 7, :o3, 142380000 + tz.transition 1974, 10, :o2, 150843600 + tz.transition 1975, 4, :o3, 167176800 + tz.transition 1975, 8, :o2, 178664400 + tz.transition 1985, 4, :o3, 482277600 + tz.transition 1985, 9, :o2, 495579600 + tz.transition 1986, 5, :o3, 516751200 + tz.transition 1986, 9, :o2, 526424400 + tz.transition 1987, 4, :o3, 545436000 + tz.transition 1987, 9, :o2, 558478800 + tz.transition 1988, 4, :o3, 576540000 + tz.transition 1988, 9, :o2, 589237200 + tz.transition 1989, 4, :o3, 609890400 + tz.transition 1989, 9, :o2, 620773200 + tz.transition 1990, 3, :o3, 638316000 + tz.transition 1990, 8, :o2, 651618000 + tz.transition 1991, 3, :o3, 669765600 + tz.transition 1991, 8, :o2, 683672400 + tz.transition 1992, 3, :o3, 701820000 + tz.transition 1992, 9, :o2, 715726800 + tz.transition 1993, 4, :o3, 733701600 + tz.transition 1993, 9, :o2, 747176400 + tz.transition 1994, 3, :o3, 765151200 + tz.transition 1994, 8, :o2, 778021200 + tz.transition 1995, 3, :o3, 796600800 + tz.transition 1995, 9, :o2, 810075600 + tz.transition 1996, 3, :o3, 826840800 + tz.transition 1996, 9, :o2, 842821200 + tz.transition 1997, 3, :o3, 858895200 + tz.transition 1997, 9, :o2, 874184400 + tz.transition 1998, 3, :o3, 890344800 + tz.transition 1998, 9, :o2, 905029200 + tz.transition 1999, 4, :o3, 923011200 + tz.transition 1999, 9, :o2, 936313200 + tz.transition 2000, 4, :o3, 955670400 + tz.transition 2000, 10, :o2, 970783200 + tz.transition 2001, 4, :o3, 986770800 + tz.transition 2001, 9, :o2, 1001282400 + tz.transition 2002, 3, :o3, 1017356400 + tz.transition 2002, 10, :o2, 1033941600 + tz.transition 2003, 3, :o3, 1048806000 + tz.transition 2003, 10, :o2, 1065132000 + tz.transition 2004, 4, :o3, 1081292400 + tz.transition 2004, 9, :o2, 1095804000 + tz.transition 2005, 4, :o3, 1112313600 + tz.transition 2005, 10, :o2, 1128812400 + tz.transition 2006, 3, :o3, 1143763200 + tz.transition 2006, 9, :o2, 1159657200 + tz.transition 2007, 3, :o3, 1175212800 + tz.transition 2007, 9, :o2, 1189897200 + tz.transition 2008, 3, :o3, 1206662400 + tz.transition 2008, 10, :o2, 1223161200 + tz.transition 2009, 3, :o3, 1238112000 + tz.transition 2009, 9, :o2, 1254006000 + tz.transition 2010, 3, :o3, 1269561600 + tz.transition 2010, 9, :o2, 1284246000 + tz.transition 2011, 4, :o3, 1301616000 + tz.transition 2011, 10, :o2, 1317510000 + tz.transition 2012, 3, :o3, 1333065600 + tz.transition 2012, 9, :o2, 1348354800 + tz.transition 2013, 3, :o3, 1364515200 + tz.transition 2013, 9, :o2, 1378594800 + tz.transition 2014, 3, :o3, 1395964800 + tz.transition 2014, 9, :o2, 1411858800 + tz.transition 2015, 3, :o3, 1427414400 + tz.transition 2015, 9, :o2, 1442703600 + tz.transition 2016, 4, :o3, 1459468800 + tz.transition 2016, 10, :o2, 1475967600 + tz.transition 2017, 3, :o3, 1490918400 + tz.transition 2017, 9, :o2, 1506207600 + tz.transition 2018, 3, :o3, 1522368000 + tz.transition 2018, 9, :o2, 1537052400 + tz.transition 2019, 3, :o3, 1553817600 + tz.transition 2019, 10, :o2, 1570316400 + tz.transition 2020, 3, :o3, 1585267200 + tz.transition 2020, 9, :o2, 1601161200 + tz.transition 2021, 3, :o3, 1616716800 + tz.transition 2021, 9, :o2, 1631401200 + tz.transition 2022, 4, :o3, 1648771200 + tz.transition 2022, 10, :o2, 1664665200 + tz.transition 2023, 3, :o3, 1680220800 + tz.transition 2023, 9, :o2, 1695510000 + tz.transition 2024, 3, :o3, 1711670400 + tz.transition 2024, 10, :o2, 1728169200 + tz.transition 2025, 3, :o3, 1743120000 + tz.transition 2025, 9, :o2, 1759014000 + tz.transition 2026, 3, :o3, 1774569600 + tz.transition 2026, 9, :o2, 1789858800 + tz.transition 2027, 3, :o3, 1806019200 + tz.transition 2027, 10, :o2, 1823122800 + tz.transition 2028, 3, :o3, 1838073600 + tz.transition 2028, 9, :o2, 1853362800 + tz.transition 2029, 3, :o3, 1869523200 + tz.transition 2029, 9, :o2, 1884207600 + tz.transition 2030, 3, :o3, 1900972800 + tz.transition 2030, 10, :o2, 1917471600 + tz.transition 2031, 3, :o3, 1932422400 + tz.transition 2031, 9, :o2, 1947711600 + tz.transition 2032, 3, :o3, 1963872000 + tz.transition 2032, 9, :o2, 1978556400 + tz.transition 2033, 4, :o3, 1995926400 + tz.transition 2033, 10, :o2, 2011820400 + tz.transition 2034, 3, :o3, 2027376000 + tz.transition 2034, 9, :o2, 2042060400 + tz.transition 2035, 3, :o3, 2058825600 + tz.transition 2035, 10, :o2, 2075324400 + tz.transition 2036, 3, :o3, 2090275200 + tz.transition 2036, 9, :o2, 2106169200 + tz.transition 2037, 3, :o3, 2121724800 + tz.transition 2037, 9, :o2, 2136409200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb new file mode 100644 index 0000000000..669c09790a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb @@ -0,0 +1,20 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Kabul + include TimezoneDefinition + + timezone 'Asia/Kabul' do |tz| + tz.offset :o0, 16608, 0, :LMT + tz.offset :o1, 14400, 0, :AFT + tz.offset :o2, 16200, 0, :AFT + + tz.transition 1889, 12, :o1, 2170231477, 900 + tz.transition 1944, 12, :o2, 7294369, 3 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb new file mode 100644 index 0000000000..2f1690b3a9 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Kamchatka + include TimezoneDefinition + + timezone 'Asia/Kamchatka' do |tz| + tz.offset :o0, 38076, 0, :LMT + tz.offset :o1, 39600, 0, :PETT + tz.offset :o2, 43200, 0, :PETT + tz.offset :o3, 43200, 3600, :PETST + tz.offset :o4, 39600, 3600, :PETST + + tz.transition 1922, 11, :o1, 17448250027, 7200 + tz.transition 1930, 6, :o2, 58227553, 24 + tz.transition 1981, 3, :o3, 354888000 + tz.transition 1981, 9, :o2, 370695600 + tz.transition 1982, 3, :o3, 386424000 + tz.transition 1982, 9, :o2, 402231600 + tz.transition 1983, 3, :o3, 417960000 + tz.transition 1983, 9, :o2, 433767600 + tz.transition 1984, 3, :o3, 449582400 + tz.transition 1984, 9, :o2, 465314400 + tz.transition 1985, 3, :o3, 481039200 + tz.transition 1985, 9, :o2, 496764000 + tz.transition 1986, 3, :o3, 512488800 + tz.transition 1986, 9, :o2, 528213600 + tz.transition 1987, 3, :o3, 543938400 + tz.transition 1987, 9, :o2, 559663200 + tz.transition 1988, 3, :o3, 575388000 + tz.transition 1988, 9, :o2, 591112800 + tz.transition 1989, 3, :o3, 606837600 + tz.transition 1989, 9, :o2, 622562400 + tz.transition 1990, 3, :o3, 638287200 + tz.transition 1990, 9, :o2, 654616800 + tz.transition 1991, 3, :o4, 670341600 + tz.transition 1991, 9, :o1, 686070000 + tz.transition 1992, 1, :o2, 695746800 + tz.transition 1992, 3, :o3, 701780400 + tz.transition 1992, 9, :o2, 717501600 + tz.transition 1993, 3, :o3, 733240800 + tz.transition 1993, 9, :o2, 748965600 + tz.transition 1994, 3, :o3, 764690400 + tz.transition 1994, 9, :o2, 780415200 + tz.transition 1995, 3, :o3, 796140000 + tz.transition 1995, 9, :o2, 811864800 + tz.transition 1996, 3, :o3, 828194400 + tz.transition 1996, 10, :o2, 846338400 + tz.transition 1997, 3, :o3, 859644000 + tz.transition 1997, 10, :o2, 877788000 + tz.transition 1998, 3, :o3, 891093600 + tz.transition 1998, 10, :o2, 909237600 + tz.transition 1999, 3, :o3, 922543200 + tz.transition 1999, 10, :o2, 941292000 + tz.transition 2000, 3, :o3, 953992800 + tz.transition 2000, 10, :o2, 972741600 + tz.transition 2001, 3, :o3, 985442400 + tz.transition 2001, 10, :o2, 1004191200 + tz.transition 2002, 3, :o3, 1017496800 + tz.transition 2002, 10, :o2, 1035640800 + tz.transition 2003, 3, :o3, 1048946400 + tz.transition 2003, 10, :o2, 1067090400 + tz.transition 2004, 3, :o3, 1080396000 + tz.transition 2004, 10, :o2, 1099144800 + tz.transition 2005, 3, :o3, 1111845600 + tz.transition 2005, 10, :o2, 1130594400 + tz.transition 2006, 3, :o3, 1143295200 + tz.transition 2006, 10, :o2, 1162044000 + tz.transition 2007, 3, :o3, 1174744800 + tz.transition 2007, 10, :o2, 1193493600 + tz.transition 2008, 3, :o3, 1206799200 + tz.transition 2008, 10, :o2, 1224943200 + tz.transition 2009, 3, :o3, 1238248800 + tz.transition 2009, 10, :o2, 1256392800 + tz.transition 2010, 3, :o3, 1269698400 + tz.transition 2010, 10, :o2, 1288447200 + tz.transition 2011, 3, :o3, 1301148000 + tz.transition 2011, 10, :o2, 1319896800 + tz.transition 2012, 3, :o3, 1332597600 + tz.transition 2012, 10, :o2, 1351346400 + tz.transition 2013, 3, :o3, 1364652000 + tz.transition 2013, 10, :o2, 1382796000 + tz.transition 2014, 3, :o3, 1396101600 + tz.transition 2014, 10, :o2, 1414245600 + tz.transition 2015, 3, :o3, 1427551200 + tz.transition 2015, 10, :o2, 1445695200 + tz.transition 2016, 3, :o3, 1459000800 + tz.transition 2016, 10, :o2, 1477749600 + tz.transition 2017, 3, :o3, 1490450400 + tz.transition 2017, 10, :o2, 1509199200 + tz.transition 2018, 3, :o3, 1521900000 + tz.transition 2018, 10, :o2, 1540648800 + tz.transition 2019, 3, :o3, 1553954400 + tz.transition 2019, 10, :o2, 1572098400 + tz.transition 2020, 3, :o3, 1585404000 + tz.transition 2020, 10, :o2, 1603548000 + tz.transition 2021, 3, :o3, 1616853600 + tz.transition 2021, 10, :o2, 1635602400 + tz.transition 2022, 3, :o3, 1648303200 + tz.transition 2022, 10, :o2, 1667052000 + tz.transition 2023, 3, :o3, 1679752800 + tz.transition 2023, 10, :o2, 1698501600 + tz.transition 2024, 3, :o3, 1711807200 + tz.transition 2024, 10, :o2, 1729951200 + tz.transition 2025, 3, :o3, 1743256800 + tz.transition 2025, 10, :o2, 1761400800 + tz.transition 2026, 3, :o3, 1774706400 + tz.transition 2026, 10, :o2, 1792850400 + tz.transition 2027, 3, :o3, 1806156000 + tz.transition 2027, 10, :o2, 1824904800 + tz.transition 2028, 3, :o3, 1837605600 + tz.transition 2028, 10, :o2, 1856354400 + tz.transition 2029, 3, :o3, 1869055200 + tz.transition 2029, 10, :o2, 1887804000 + tz.transition 2030, 3, :o3, 1901109600 + tz.transition 2030, 10, :o2, 1919253600 + tz.transition 2031, 3, :o3, 1932559200 + tz.transition 2031, 10, :o2, 1950703200 + tz.transition 2032, 3, :o3, 1964008800 + tz.transition 2032, 10, :o2, 1982757600 + tz.transition 2033, 3, :o3, 1995458400 + tz.transition 2033, 10, :o2, 2014207200 + tz.transition 2034, 3, :o3, 2026908000 + tz.transition 2034, 10, :o2, 2045656800 + tz.transition 2035, 3, :o3, 2058357600 + tz.transition 2035, 10, :o2, 2077106400 + tz.transition 2036, 3, :o3, 2090412000 + tz.transition 2036, 10, :o2, 2108556000 + tz.transition 2037, 3, :o3, 2121861600 + tz.transition 2037, 10, :o2, 2140005600 + tz.transition 2038, 3, :o3, 29586121, 12 + tz.transition 2038, 10, :o2, 29588725, 12 + tz.transition 2039, 3, :o3, 29590489, 12 + tz.transition 2039, 10, :o2, 29593093, 12 + tz.transition 2040, 3, :o3, 29594857, 12 + tz.transition 2040, 10, :o2, 29597461, 12 + tz.transition 2041, 3, :o3, 29599309, 12 + tz.transition 2041, 10, :o2, 29601829, 12 + tz.transition 2042, 3, :o3, 29603677, 12 + tz.transition 2042, 10, :o2, 29606197, 12 + tz.transition 2043, 3, :o3, 29608045, 12 + tz.transition 2043, 10, :o2, 29610565, 12 + tz.transition 2044, 3, :o3, 29612413, 12 + tz.transition 2044, 10, :o2, 29615017, 12 + tz.transition 2045, 3, :o3, 29616781, 12 + tz.transition 2045, 10, :o2, 29619385, 12 + tz.transition 2046, 3, :o3, 29621149, 12 + tz.transition 2046, 10, :o2, 29623753, 12 + tz.transition 2047, 3, :o3, 29625601, 12 + tz.transition 2047, 10, :o2, 29628121, 12 + tz.transition 2048, 3, :o3, 29629969, 12 + tz.transition 2048, 10, :o2, 29632489, 12 + tz.transition 2049, 3, :o3, 29634337, 12 + tz.transition 2049, 10, :o2, 29636941, 12 + tz.transition 2050, 3, :o3, 29638705, 12 + tz.transition 2050, 10, :o2, 29641309, 12 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb new file mode 100644 index 0000000000..dfe02c5cf6 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb @@ -0,0 +1,114 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Karachi + include TimezoneDefinition + + timezone 'Asia/Karachi' do |tz| + tz.offset :o0, 16092, 0, :LMT + tz.offset :o1, 19800, 0, :IST + tz.offset :o2, 19800, 3600, :IST + tz.offset :o3, 18000, 0, :KART + tz.offset :o4, 18000, 0, :PKT + tz.offset :o5, 18000, 3600, :PKST + + tz.transition 1906, 12, :o1, 1934061051, 800 + tz.transition 1942, 8, :o2, 116668957, 48 + tz.transition 1945, 10, :o1, 116723675, 48 + tz.transition 1951, 9, :o3, 116828125, 48 + tz.transition 1971, 3, :o4, 38775600 + tz.transition 2002, 4, :o5, 1018119660 + tz.transition 2002, 10, :o4, 1033840860 + tz.transition 2008, 5, :o5, 1212260400 + tz.transition 2008, 10, :o4, 1225476000 + tz.transition 2009, 4, :o5, 1239735600 + tz.transition 2009, 10, :o4, 1257012000 + tz.transition 2010, 4, :o5, 1271271600 + tz.transition 2010, 10, :o4, 1288548000 + tz.transition 2011, 4, :o5, 1302807600 + tz.transition 2011, 10, :o4, 1320084000 + tz.transition 2012, 4, :o5, 1334430000 + tz.transition 2012, 10, :o4, 1351706400 + tz.transition 2013, 4, :o5, 1365966000 + tz.transition 2013, 10, :o4, 1383242400 + tz.transition 2014, 4, :o5, 1397502000 + tz.transition 2014, 10, :o4, 1414778400 + tz.transition 2015, 4, :o5, 1429038000 + tz.transition 2015, 10, :o4, 1446314400 + tz.transition 2016, 4, :o5, 1460660400 + tz.transition 2016, 10, :o4, 1477936800 + tz.transition 2017, 4, :o5, 1492196400 + tz.transition 2017, 10, :o4, 1509472800 + tz.transition 2018, 4, :o5, 1523732400 + tz.transition 2018, 10, :o4, 1541008800 + tz.transition 2019, 4, :o5, 1555268400 + tz.transition 2019, 10, :o4, 1572544800 + tz.transition 2020, 4, :o5, 1586890800 + tz.transition 2020, 10, :o4, 1604167200 + tz.transition 2021, 4, :o5, 1618426800 + tz.transition 2021, 10, :o4, 1635703200 + tz.transition 2022, 4, :o5, 1649962800 + tz.transition 2022, 10, :o4, 1667239200 + tz.transition 2023, 4, :o5, 1681498800 + tz.transition 2023, 10, :o4, 1698775200 + tz.transition 2024, 4, :o5, 1713121200 + tz.transition 2024, 10, :o4, 1730397600 + tz.transition 2025, 4, :o5, 1744657200 + tz.transition 2025, 10, :o4, 1761933600 + tz.transition 2026, 4, :o5, 1776193200 + tz.transition 2026, 10, :o4, 1793469600 + tz.transition 2027, 4, :o5, 1807729200 + tz.transition 2027, 10, :o4, 1825005600 + tz.transition 2028, 4, :o5, 1839351600 + tz.transition 2028, 10, :o4, 1856628000 + tz.transition 2029, 4, :o5, 1870887600 + tz.transition 2029, 10, :o4, 1888164000 + tz.transition 2030, 4, :o5, 1902423600 + tz.transition 2030, 10, :o4, 1919700000 + tz.transition 2031, 4, :o5, 1933959600 + tz.transition 2031, 10, :o4, 1951236000 + tz.transition 2032, 4, :o5, 1965582000 + tz.transition 2032, 10, :o4, 1982858400 + tz.transition 2033, 4, :o5, 1997118000 + tz.transition 2033, 10, :o4, 2014394400 + tz.transition 2034, 4, :o5, 2028654000 + tz.transition 2034, 10, :o4, 2045930400 + tz.transition 2035, 4, :o5, 2060190000 + tz.transition 2035, 10, :o4, 2077466400 + tz.transition 2036, 4, :o5, 2091812400 + tz.transition 2036, 10, :o4, 2109088800 + tz.transition 2037, 4, :o5, 2123348400 + tz.transition 2037, 10, :o4, 2140624800 + tz.transition 2038, 4, :o5, 59172679, 24 + tz.transition 2038, 10, :o4, 9862913, 4 + tz.transition 2039, 4, :o5, 59181439, 24 + tz.transition 2039, 10, :o4, 9864373, 4 + tz.transition 2040, 4, :o5, 59190223, 24 + tz.transition 2040, 10, :o4, 9865837, 4 + tz.transition 2041, 4, :o5, 59198983, 24 + tz.transition 2041, 10, :o4, 9867297, 4 + tz.transition 2042, 4, :o5, 59207743, 24 + tz.transition 2042, 10, :o4, 9868757, 4 + tz.transition 2043, 4, :o5, 59216503, 24 + tz.transition 2043, 10, :o4, 9870217, 4 + tz.transition 2044, 4, :o5, 59225287, 24 + tz.transition 2044, 10, :o4, 9871681, 4 + tz.transition 2045, 4, :o5, 59234047, 24 + tz.transition 2045, 10, :o4, 9873141, 4 + tz.transition 2046, 4, :o5, 59242807, 24 + tz.transition 2046, 10, :o4, 9874601, 4 + tz.transition 2047, 4, :o5, 59251567, 24 + tz.transition 2047, 10, :o4, 9876061, 4 + tz.transition 2048, 4, :o5, 59260351, 24 + tz.transition 2048, 10, :o4, 9877525, 4 + tz.transition 2049, 4, :o5, 59269111, 24 + tz.transition 2049, 10, :o4, 9878985, 4 + tz.transition 2050, 4, :o5, 59277871, 24 + tz.transition 2050, 10, :o4, 9880445, 4 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb new file mode 100644 index 0000000000..37b241612e --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb @@ -0,0 +1,20 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Kathmandu + include TimezoneDefinition + + timezone 'Asia/Kathmandu' do |tz| + tz.offset :o0, 20476, 0, :LMT + tz.offset :o1, 19800, 0, :IST + tz.offset :o2, 20700, 0, :NPT + + tz.transition 1919, 12, :o1, 52322204081, 21600 + tz.transition 1985, 12, :o2, 504901800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb new file mode 100644 index 0000000000..1b6ffbd59d --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb @@ -0,0 +1,25 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Kolkata + include TimezoneDefinition + + timezone 'Asia/Kolkata' do |tz| + tz.offset :o0, 21208, 0, :LMT + tz.offset :o1, 21200, 0, :HMT + tz.offset :o2, 23400, 0, :BURT + tz.offset :o3, 19800, 0, :IST + tz.offset :o4, 19800, 3600, :IST + + tz.transition 1879, 12, :o1, 26003324749, 10800 + tz.transition 1941, 9, :o2, 524937943, 216 + tz.transition 1942, 5, :o3, 116663723, 48 + tz.transition 1942, 8, :o4, 116668957, 48 + tz.transition 1945, 10, :o3, 116723675, 48 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb new file mode 100644 index 0000000000..d6c503c155 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Krasnoyarsk + include TimezoneDefinition + + timezone 'Asia/Krasnoyarsk' do |tz| + tz.offset :o0, 22280, 0, :LMT + tz.offset :o1, 21600, 0, :KRAT + tz.offset :o2, 25200, 0, :KRAT + tz.offset :o3, 25200, 3600, :KRAST + tz.offset :o4, 21600, 3600, :KRAST + + tz.transition 1920, 1, :o1, 5232231163, 2160 + tz.transition 1930, 6, :o2, 9704593, 4 + tz.transition 1981, 3, :o3, 354906000 + tz.transition 1981, 9, :o2, 370713600 + tz.transition 1982, 3, :o3, 386442000 + tz.transition 1982, 9, :o2, 402249600 + tz.transition 1983, 3, :o3, 417978000 + tz.transition 1983, 9, :o2, 433785600 + tz.transition 1984, 3, :o3, 449600400 + tz.transition 1984, 9, :o2, 465332400 + tz.transition 1985, 3, :o3, 481057200 + tz.transition 1985, 9, :o2, 496782000 + tz.transition 1986, 3, :o3, 512506800 + tz.transition 1986, 9, :o2, 528231600 + tz.transition 1987, 3, :o3, 543956400 + tz.transition 1987, 9, :o2, 559681200 + tz.transition 1988, 3, :o3, 575406000 + tz.transition 1988, 9, :o2, 591130800 + tz.transition 1989, 3, :o3, 606855600 + tz.transition 1989, 9, :o2, 622580400 + tz.transition 1990, 3, :o3, 638305200 + tz.transition 1990, 9, :o2, 654634800 + tz.transition 1991, 3, :o4, 670359600 + tz.transition 1991, 9, :o1, 686088000 + tz.transition 1992, 1, :o2, 695764800 + tz.transition 1992, 3, :o3, 701798400 + tz.transition 1992, 9, :o2, 717519600 + tz.transition 1993, 3, :o3, 733258800 + tz.transition 1993, 9, :o2, 748983600 + tz.transition 1994, 3, :o3, 764708400 + tz.transition 1994, 9, :o2, 780433200 + tz.transition 1995, 3, :o3, 796158000 + tz.transition 1995, 9, :o2, 811882800 + tz.transition 1996, 3, :o3, 828212400 + tz.transition 1996, 10, :o2, 846356400 + tz.transition 1997, 3, :o3, 859662000 + tz.transition 1997, 10, :o2, 877806000 + tz.transition 1998, 3, :o3, 891111600 + tz.transition 1998, 10, :o2, 909255600 + tz.transition 1999, 3, :o3, 922561200 + tz.transition 1999, 10, :o2, 941310000 + tz.transition 2000, 3, :o3, 954010800 + tz.transition 2000, 10, :o2, 972759600 + tz.transition 2001, 3, :o3, 985460400 + tz.transition 2001, 10, :o2, 1004209200 + tz.transition 2002, 3, :o3, 1017514800 + tz.transition 2002, 10, :o2, 1035658800 + tz.transition 2003, 3, :o3, 1048964400 + tz.transition 2003, 10, :o2, 1067108400 + tz.transition 2004, 3, :o3, 1080414000 + tz.transition 2004, 10, :o2, 1099162800 + tz.transition 2005, 3, :o3, 1111863600 + tz.transition 2005, 10, :o2, 1130612400 + tz.transition 2006, 3, :o3, 1143313200 + tz.transition 2006, 10, :o2, 1162062000 + tz.transition 2007, 3, :o3, 1174762800 + tz.transition 2007, 10, :o2, 1193511600 + tz.transition 2008, 3, :o3, 1206817200 + tz.transition 2008, 10, :o2, 1224961200 + tz.transition 2009, 3, :o3, 1238266800 + tz.transition 2009, 10, :o2, 1256410800 + tz.transition 2010, 3, :o3, 1269716400 + tz.transition 2010, 10, :o2, 1288465200 + tz.transition 2011, 3, :o3, 1301166000 + tz.transition 2011, 10, :o2, 1319914800 + tz.transition 2012, 3, :o3, 1332615600 + tz.transition 2012, 10, :o2, 1351364400 + tz.transition 2013, 3, :o3, 1364670000 + tz.transition 2013, 10, :o2, 1382814000 + tz.transition 2014, 3, :o3, 1396119600 + tz.transition 2014, 10, :o2, 1414263600 + tz.transition 2015, 3, :o3, 1427569200 + tz.transition 2015, 10, :o2, 1445713200 + tz.transition 2016, 3, :o3, 1459018800 + tz.transition 2016, 10, :o2, 1477767600 + tz.transition 2017, 3, :o3, 1490468400 + tz.transition 2017, 10, :o2, 1509217200 + tz.transition 2018, 3, :o3, 1521918000 + tz.transition 2018, 10, :o2, 1540666800 + tz.transition 2019, 3, :o3, 1553972400 + tz.transition 2019, 10, :o2, 1572116400 + tz.transition 2020, 3, :o3, 1585422000 + tz.transition 2020, 10, :o2, 1603566000 + tz.transition 2021, 3, :o3, 1616871600 + tz.transition 2021, 10, :o2, 1635620400 + tz.transition 2022, 3, :o3, 1648321200 + tz.transition 2022, 10, :o2, 1667070000 + tz.transition 2023, 3, :o3, 1679770800 + tz.transition 2023, 10, :o2, 1698519600 + tz.transition 2024, 3, :o3, 1711825200 + tz.transition 2024, 10, :o2, 1729969200 + tz.transition 2025, 3, :o3, 1743274800 + tz.transition 2025, 10, :o2, 1761418800 + tz.transition 2026, 3, :o3, 1774724400 + tz.transition 2026, 10, :o2, 1792868400 + tz.transition 2027, 3, :o3, 1806174000 + tz.transition 2027, 10, :o2, 1824922800 + tz.transition 2028, 3, :o3, 1837623600 + tz.transition 2028, 10, :o2, 1856372400 + tz.transition 2029, 3, :o3, 1869073200 + tz.transition 2029, 10, :o2, 1887822000 + tz.transition 2030, 3, :o3, 1901127600 + tz.transition 2030, 10, :o2, 1919271600 + tz.transition 2031, 3, :o3, 1932577200 + tz.transition 2031, 10, :o2, 1950721200 + tz.transition 2032, 3, :o3, 1964026800 + tz.transition 2032, 10, :o2, 1982775600 + tz.transition 2033, 3, :o3, 1995476400 + tz.transition 2033, 10, :o2, 2014225200 + tz.transition 2034, 3, :o3, 2026926000 + tz.transition 2034, 10, :o2, 2045674800 + tz.transition 2035, 3, :o3, 2058375600 + tz.transition 2035, 10, :o2, 2077124400 + tz.transition 2036, 3, :o3, 2090430000 + tz.transition 2036, 10, :o2, 2108574000 + tz.transition 2037, 3, :o3, 2121879600 + tz.transition 2037, 10, :o2, 2140023600 + tz.transition 2038, 3, :o3, 59172247, 24 + tz.transition 2038, 10, :o2, 59177455, 24 + tz.transition 2039, 3, :o3, 59180983, 24 + tz.transition 2039, 10, :o2, 59186191, 24 + tz.transition 2040, 3, :o3, 59189719, 24 + tz.transition 2040, 10, :o2, 59194927, 24 + tz.transition 2041, 3, :o3, 59198623, 24 + tz.transition 2041, 10, :o2, 59203663, 24 + tz.transition 2042, 3, :o3, 59207359, 24 + tz.transition 2042, 10, :o2, 59212399, 24 + tz.transition 2043, 3, :o3, 59216095, 24 + tz.transition 2043, 10, :o2, 59221135, 24 + tz.transition 2044, 3, :o3, 59224831, 24 + tz.transition 2044, 10, :o2, 59230039, 24 + tz.transition 2045, 3, :o3, 59233567, 24 + tz.transition 2045, 10, :o2, 59238775, 24 + tz.transition 2046, 3, :o3, 59242303, 24 + tz.transition 2046, 10, :o2, 59247511, 24 + tz.transition 2047, 3, :o3, 59251207, 24 + tz.transition 2047, 10, :o2, 59256247, 24 + tz.transition 2048, 3, :o3, 59259943, 24 + tz.transition 2048, 10, :o2, 59264983, 24 + tz.transition 2049, 3, :o3, 59268679, 24 + tz.transition 2049, 10, :o2, 59273887, 24 + tz.transition 2050, 3, :o3, 59277415, 24 + tz.transition 2050, 10, :o2, 59282623, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb new file mode 100644 index 0000000000..77a0c206fa --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb @@ -0,0 +1,31 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Kuala_Lumpur + include TimezoneDefinition + + timezone 'Asia/Kuala_Lumpur' do |tz| + tz.offset :o0, 24406, 0, :LMT + tz.offset :o1, 24925, 0, :SMT + tz.offset :o2, 25200, 0, :MALT + tz.offset :o3, 25200, 1200, :MALST + tz.offset :o4, 26400, 0, :MALT + tz.offset :o5, 27000, 0, :MALT + tz.offset :o6, 32400, 0, :JST + tz.offset :o7, 28800, 0, :MYT + + tz.transition 1900, 12, :o1, 104344641397, 43200 + tz.transition 1905, 5, :o2, 8353142363, 3456 + tz.transition 1932, 12, :o3, 58249757, 24 + tz.transition 1935, 12, :o4, 87414055, 36 + tz.transition 1941, 8, :o5, 87488575, 36 + tz.transition 1942, 2, :o6, 38886499, 16 + tz.transition 1945, 9, :o5, 19453681, 8 + tz.transition 1981, 12, :o7, 378664200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb new file mode 100644 index 0000000000..5bd5283197 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb @@ -0,0 +1,18 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Kuwait + include TimezoneDefinition + + timezone 'Asia/Kuwait' do |tz| + tz.offset :o0, 11516, 0, :LMT + tz.offset :o1, 10800, 0, :AST + + tz.transition 1949, 12, :o1, 52558899121, 21600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb new file mode 100644 index 0000000000..302093693e --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Magadan + include TimezoneDefinition + + timezone 'Asia/Magadan' do |tz| + tz.offset :o0, 36192, 0, :LMT + tz.offset :o1, 36000, 0, :MAGT + tz.offset :o2, 39600, 0, :MAGT + tz.offset :o3, 39600, 3600, :MAGST + tz.offset :o4, 36000, 3600, :MAGST + + tz.transition 1924, 5, :o1, 2181516373, 900 + tz.transition 1930, 6, :o2, 29113777, 12 + tz.transition 1981, 3, :o3, 354891600 + tz.transition 1981, 9, :o2, 370699200 + tz.transition 1982, 3, :o3, 386427600 + tz.transition 1982, 9, :o2, 402235200 + tz.transition 1983, 3, :o3, 417963600 + tz.transition 1983, 9, :o2, 433771200 + tz.transition 1984, 3, :o3, 449586000 + tz.transition 1984, 9, :o2, 465318000 + tz.transition 1985, 3, :o3, 481042800 + tz.transition 1985, 9, :o2, 496767600 + tz.transition 1986, 3, :o3, 512492400 + tz.transition 1986, 9, :o2, 528217200 + tz.transition 1987, 3, :o3, 543942000 + tz.transition 1987, 9, :o2, 559666800 + tz.transition 1988, 3, :o3, 575391600 + tz.transition 1988, 9, :o2, 591116400 + tz.transition 1989, 3, :o3, 606841200 + tz.transition 1989, 9, :o2, 622566000 + tz.transition 1990, 3, :o3, 638290800 + tz.transition 1990, 9, :o2, 654620400 + tz.transition 1991, 3, :o4, 670345200 + tz.transition 1991, 9, :o1, 686073600 + tz.transition 1992, 1, :o2, 695750400 + tz.transition 1992, 3, :o3, 701784000 + tz.transition 1992, 9, :o2, 717505200 + tz.transition 1993, 3, :o3, 733244400 + tz.transition 1993, 9, :o2, 748969200 + tz.transition 1994, 3, :o3, 764694000 + tz.transition 1994, 9, :o2, 780418800 + tz.transition 1995, 3, :o3, 796143600 + tz.transition 1995, 9, :o2, 811868400 + tz.transition 1996, 3, :o3, 828198000 + tz.transition 1996, 10, :o2, 846342000 + tz.transition 1997, 3, :o3, 859647600 + tz.transition 1997, 10, :o2, 877791600 + tz.transition 1998, 3, :o3, 891097200 + tz.transition 1998, 10, :o2, 909241200 + tz.transition 1999, 3, :o3, 922546800 + tz.transition 1999, 10, :o2, 941295600 + tz.transition 2000, 3, :o3, 953996400 + tz.transition 2000, 10, :o2, 972745200 + tz.transition 2001, 3, :o3, 985446000 + tz.transition 2001, 10, :o2, 1004194800 + tz.transition 2002, 3, :o3, 1017500400 + tz.transition 2002, 10, :o2, 1035644400 + tz.transition 2003, 3, :o3, 1048950000 + tz.transition 2003, 10, :o2, 1067094000 + tz.transition 2004, 3, :o3, 1080399600 + tz.transition 2004, 10, :o2, 1099148400 + tz.transition 2005, 3, :o3, 1111849200 + tz.transition 2005, 10, :o2, 1130598000 + tz.transition 2006, 3, :o3, 1143298800 + tz.transition 2006, 10, :o2, 1162047600 + tz.transition 2007, 3, :o3, 1174748400 + tz.transition 2007, 10, :o2, 1193497200 + tz.transition 2008, 3, :o3, 1206802800 + tz.transition 2008, 10, :o2, 1224946800 + tz.transition 2009, 3, :o3, 1238252400 + tz.transition 2009, 10, :o2, 1256396400 + tz.transition 2010, 3, :o3, 1269702000 + tz.transition 2010, 10, :o2, 1288450800 + tz.transition 2011, 3, :o3, 1301151600 + tz.transition 2011, 10, :o2, 1319900400 + tz.transition 2012, 3, :o3, 1332601200 + tz.transition 2012, 10, :o2, 1351350000 + tz.transition 2013, 3, :o3, 1364655600 + tz.transition 2013, 10, :o2, 1382799600 + tz.transition 2014, 3, :o3, 1396105200 + tz.transition 2014, 10, :o2, 1414249200 + tz.transition 2015, 3, :o3, 1427554800 + tz.transition 2015, 10, :o2, 1445698800 + tz.transition 2016, 3, :o3, 1459004400 + tz.transition 2016, 10, :o2, 1477753200 + tz.transition 2017, 3, :o3, 1490454000 + tz.transition 2017, 10, :o2, 1509202800 + tz.transition 2018, 3, :o3, 1521903600 + tz.transition 2018, 10, :o2, 1540652400 + tz.transition 2019, 3, :o3, 1553958000 + tz.transition 2019, 10, :o2, 1572102000 + tz.transition 2020, 3, :o3, 1585407600 + tz.transition 2020, 10, :o2, 1603551600 + tz.transition 2021, 3, :o3, 1616857200 + tz.transition 2021, 10, :o2, 1635606000 + tz.transition 2022, 3, :o3, 1648306800 + tz.transition 2022, 10, :o2, 1667055600 + tz.transition 2023, 3, :o3, 1679756400 + tz.transition 2023, 10, :o2, 1698505200 + tz.transition 2024, 3, :o3, 1711810800 + tz.transition 2024, 10, :o2, 1729954800 + tz.transition 2025, 3, :o3, 1743260400 + tz.transition 2025, 10, :o2, 1761404400 + tz.transition 2026, 3, :o3, 1774710000 + tz.transition 2026, 10, :o2, 1792854000 + tz.transition 2027, 3, :o3, 1806159600 + tz.transition 2027, 10, :o2, 1824908400 + tz.transition 2028, 3, :o3, 1837609200 + tz.transition 2028, 10, :o2, 1856358000 + tz.transition 2029, 3, :o3, 1869058800 + tz.transition 2029, 10, :o2, 1887807600 + tz.transition 2030, 3, :o3, 1901113200 + tz.transition 2030, 10, :o2, 1919257200 + tz.transition 2031, 3, :o3, 1932562800 + tz.transition 2031, 10, :o2, 1950706800 + tz.transition 2032, 3, :o3, 1964012400 + tz.transition 2032, 10, :o2, 1982761200 + tz.transition 2033, 3, :o3, 1995462000 + tz.transition 2033, 10, :o2, 2014210800 + tz.transition 2034, 3, :o3, 2026911600 + tz.transition 2034, 10, :o2, 2045660400 + tz.transition 2035, 3, :o3, 2058361200 + tz.transition 2035, 10, :o2, 2077110000 + tz.transition 2036, 3, :o3, 2090415600 + tz.transition 2036, 10, :o2, 2108559600 + tz.transition 2037, 3, :o3, 2121865200 + tz.transition 2037, 10, :o2, 2140009200 + tz.transition 2038, 3, :o3, 19724081, 8 + tz.transition 2038, 10, :o2, 19725817, 8 + tz.transition 2039, 3, :o3, 19726993, 8 + tz.transition 2039, 10, :o2, 19728729, 8 + tz.transition 2040, 3, :o3, 19729905, 8 + tz.transition 2040, 10, :o2, 19731641, 8 + tz.transition 2041, 3, :o3, 19732873, 8 + tz.transition 2041, 10, :o2, 19734553, 8 + tz.transition 2042, 3, :o3, 19735785, 8 + tz.transition 2042, 10, :o2, 19737465, 8 + tz.transition 2043, 3, :o3, 19738697, 8 + tz.transition 2043, 10, :o2, 19740377, 8 + tz.transition 2044, 3, :o3, 19741609, 8 + tz.transition 2044, 10, :o2, 19743345, 8 + tz.transition 2045, 3, :o3, 19744521, 8 + tz.transition 2045, 10, :o2, 19746257, 8 + tz.transition 2046, 3, :o3, 19747433, 8 + tz.transition 2046, 10, :o2, 19749169, 8 + tz.transition 2047, 3, :o3, 19750401, 8 + tz.transition 2047, 10, :o2, 19752081, 8 + tz.transition 2048, 3, :o3, 19753313, 8 + tz.transition 2048, 10, :o2, 19754993, 8 + tz.transition 2049, 3, :o3, 19756225, 8 + tz.transition 2049, 10, :o2, 19757961, 8 + tz.transition 2050, 3, :o3, 19759137, 8 + tz.transition 2050, 10, :o2, 19760873, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb new file mode 100644 index 0000000000..604f651dfa --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb @@ -0,0 +1,18 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Muscat + include TimezoneDefinition + + timezone 'Asia/Muscat' do |tz| + tz.offset :o0, 14060, 0, :LMT + tz.offset :o1, 14400, 0, :GST + + tz.transition 1919, 12, :o1, 10464441137, 4320 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb new file mode 100644 index 0000000000..a4e7796e75 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb @@ -0,0 +1,164 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Novosibirsk + include TimezoneDefinition + + timezone 'Asia/Novosibirsk' do |tz| + tz.offset :o0, 19900, 0, :LMT + tz.offset :o1, 21600, 0, :NOVT + tz.offset :o2, 25200, 0, :NOVT + tz.offset :o3, 25200, 3600, :NOVST + tz.offset :o4, 21600, 3600, :NOVST + + tz.transition 1919, 12, :o1, 2092872833, 864 + tz.transition 1930, 6, :o2, 9704593, 4 + tz.transition 1981, 3, :o3, 354906000 + tz.transition 1981, 9, :o2, 370713600 + tz.transition 1982, 3, :o3, 386442000 + tz.transition 1982, 9, :o2, 402249600 + tz.transition 1983, 3, :o3, 417978000 + tz.transition 1983, 9, :o2, 433785600 + tz.transition 1984, 3, :o3, 449600400 + tz.transition 1984, 9, :o2, 465332400 + tz.transition 1985, 3, :o3, 481057200 + tz.transition 1985, 9, :o2, 496782000 + tz.transition 1986, 3, :o3, 512506800 + tz.transition 1986, 9, :o2, 528231600 + tz.transition 1987, 3, :o3, 543956400 + tz.transition 1987, 9, :o2, 559681200 + tz.transition 1988, 3, :o3, 575406000 + tz.transition 1988, 9, :o2, 591130800 + tz.transition 1989, 3, :o3, 606855600 + tz.transition 1989, 9, :o2, 622580400 + tz.transition 1990, 3, :o3, 638305200 + tz.transition 1990, 9, :o2, 654634800 + tz.transition 1991, 3, :o4, 670359600 + tz.transition 1991, 9, :o1, 686088000 + tz.transition 1992, 1, :o2, 695764800 + tz.transition 1992, 3, :o3, 701798400 + tz.transition 1992, 9, :o2, 717519600 + tz.transition 1993, 3, :o3, 733258800 + tz.transition 1993, 5, :o4, 738086400 + tz.transition 1993, 9, :o1, 748987200 + tz.transition 1994, 3, :o4, 764712000 + tz.transition 1994, 9, :o1, 780436800 + tz.transition 1995, 3, :o4, 796161600 + tz.transition 1995, 9, :o1, 811886400 + tz.transition 1996, 3, :o4, 828216000 + tz.transition 1996, 10, :o1, 846360000 + tz.transition 1997, 3, :o4, 859665600 + tz.transition 1997, 10, :o1, 877809600 + tz.transition 1998, 3, :o4, 891115200 + tz.transition 1998, 10, :o1, 909259200 + tz.transition 1999, 3, :o4, 922564800 + tz.transition 1999, 10, :o1, 941313600 + tz.transition 2000, 3, :o4, 954014400 + tz.transition 2000, 10, :o1, 972763200 + tz.transition 2001, 3, :o4, 985464000 + tz.transition 2001, 10, :o1, 1004212800 + tz.transition 2002, 3, :o4, 1017518400 + tz.transition 2002, 10, :o1, 1035662400 + tz.transition 2003, 3, :o4, 1048968000 + tz.transition 2003, 10, :o1, 1067112000 + tz.transition 2004, 3, :o4, 1080417600 + tz.transition 2004, 10, :o1, 1099166400 + tz.transition 2005, 3, :o4, 1111867200 + tz.transition 2005, 10, :o1, 1130616000 + tz.transition 2006, 3, :o4, 1143316800 + tz.transition 2006, 10, :o1, 1162065600 + tz.transition 2007, 3, :o4, 1174766400 + tz.transition 2007, 10, :o1, 1193515200 + tz.transition 2008, 3, :o4, 1206820800 + tz.transition 2008, 10, :o1, 1224964800 + tz.transition 2009, 3, :o4, 1238270400 + tz.transition 2009, 10, :o1, 1256414400 + tz.transition 2010, 3, :o4, 1269720000 + tz.transition 2010, 10, :o1, 1288468800 + tz.transition 2011, 3, :o4, 1301169600 + tz.transition 2011, 10, :o1, 1319918400 + tz.transition 2012, 3, :o4, 1332619200 + tz.transition 2012, 10, :o1, 1351368000 + tz.transition 2013, 3, :o4, 1364673600 + tz.transition 2013, 10, :o1, 1382817600 + tz.transition 2014, 3, :o4, 1396123200 + tz.transition 2014, 10, :o1, 1414267200 + tz.transition 2015, 3, :o4, 1427572800 + tz.transition 2015, 10, :o1, 1445716800 + tz.transition 2016, 3, :o4, 1459022400 + tz.transition 2016, 10, :o1, 1477771200 + tz.transition 2017, 3, :o4, 1490472000 + tz.transition 2017, 10, :o1, 1509220800 + tz.transition 2018, 3, :o4, 1521921600 + tz.transition 2018, 10, :o1, 1540670400 + tz.transition 2019, 3, :o4, 1553976000 + tz.transition 2019, 10, :o1, 1572120000 + tz.transition 2020, 3, :o4, 1585425600 + tz.transition 2020, 10, :o1, 1603569600 + tz.transition 2021, 3, :o4, 1616875200 + tz.transition 2021, 10, :o1, 1635624000 + tz.transition 2022, 3, :o4, 1648324800 + tz.transition 2022, 10, :o1, 1667073600 + tz.transition 2023, 3, :o4, 1679774400 + tz.transition 2023, 10, :o1, 1698523200 + tz.transition 2024, 3, :o4, 1711828800 + tz.transition 2024, 10, :o1, 1729972800 + tz.transition 2025, 3, :o4, 1743278400 + tz.transition 2025, 10, :o1, 1761422400 + tz.transition 2026, 3, :o4, 1774728000 + tz.transition 2026, 10, :o1, 1792872000 + tz.transition 2027, 3, :o4, 1806177600 + tz.transition 2027, 10, :o1, 1824926400 + tz.transition 2028, 3, :o4, 1837627200 + tz.transition 2028, 10, :o1, 1856376000 + tz.transition 2029, 3, :o4, 1869076800 + tz.transition 2029, 10, :o1, 1887825600 + tz.transition 2030, 3, :o4, 1901131200 + tz.transition 2030, 10, :o1, 1919275200 + tz.transition 2031, 3, :o4, 1932580800 + tz.transition 2031, 10, :o1, 1950724800 + tz.transition 2032, 3, :o4, 1964030400 + tz.transition 2032, 10, :o1, 1982779200 + tz.transition 2033, 3, :o4, 1995480000 + tz.transition 2033, 10, :o1, 2014228800 + tz.transition 2034, 3, :o4, 2026929600 + tz.transition 2034, 10, :o1, 2045678400 + tz.transition 2035, 3, :o4, 2058379200 + tz.transition 2035, 10, :o1, 2077128000 + tz.transition 2036, 3, :o4, 2090433600 + tz.transition 2036, 10, :o1, 2108577600 + tz.transition 2037, 3, :o4, 2121883200 + tz.transition 2037, 10, :o1, 2140027200 + tz.transition 2038, 3, :o4, 7396531, 3 + tz.transition 2038, 10, :o1, 7397182, 3 + tz.transition 2039, 3, :o4, 7397623, 3 + tz.transition 2039, 10, :o1, 7398274, 3 + tz.transition 2040, 3, :o4, 7398715, 3 + tz.transition 2040, 10, :o1, 7399366, 3 + tz.transition 2041, 3, :o4, 7399828, 3 + tz.transition 2041, 10, :o1, 7400458, 3 + tz.transition 2042, 3, :o4, 7400920, 3 + tz.transition 2042, 10, :o1, 7401550, 3 + tz.transition 2043, 3, :o4, 7402012, 3 + tz.transition 2043, 10, :o1, 7402642, 3 + tz.transition 2044, 3, :o4, 7403104, 3 + tz.transition 2044, 10, :o1, 7403755, 3 + tz.transition 2045, 3, :o4, 7404196, 3 + tz.transition 2045, 10, :o1, 7404847, 3 + tz.transition 2046, 3, :o4, 7405288, 3 + tz.transition 2046, 10, :o1, 7405939, 3 + tz.transition 2047, 3, :o4, 7406401, 3 + tz.transition 2047, 10, :o1, 7407031, 3 + tz.transition 2048, 3, :o4, 7407493, 3 + tz.transition 2048, 10, :o1, 7408123, 3 + tz.transition 2049, 3, :o4, 7408585, 3 + tz.transition 2049, 10, :o1, 7409236, 3 + tz.transition 2050, 3, :o4, 7409677, 3 + tz.transition 2050, 10, :o1, 7410328, 3 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb new file mode 100644 index 0000000000..759b82d77a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb @@ -0,0 +1,24 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Rangoon + include TimezoneDefinition + + timezone 'Asia/Rangoon' do |tz| + tz.offset :o0, 23080, 0, :LMT + tz.offset :o1, 23076, 0, :RMT + tz.offset :o2, 23400, 0, :BURT + tz.offset :o3, 32400, 0, :JST + tz.offset :o4, 23400, 0, :MMT + + tz.transition 1879, 12, :o1, 5200664903, 2160 + tz.transition 1919, 12, :o2, 5813578159, 2400 + tz.transition 1942, 4, :o3, 116663051, 48 + tz.transition 1945, 5, :o4, 19452625, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb new file mode 100644 index 0000000000..7add410620 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb @@ -0,0 +1,18 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Riyadh + include TimezoneDefinition + + timezone 'Asia/Riyadh' do |tz| + tz.offset :o0, 11212, 0, :LMT + tz.offset :o1, 10800, 0, :AST + + tz.transition 1949, 12, :o1, 52558899197, 21600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb new file mode 100644 index 0000000000..795d2a75df --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb @@ -0,0 +1,34 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Seoul + include TimezoneDefinition + + timezone 'Asia/Seoul' do |tz| + tz.offset :o0, 30472, 0, :LMT + tz.offset :o1, 30600, 0, :KST + tz.offset :o2, 32400, 0, :KST + tz.offset :o3, 28800, 0, :KST + tz.offset :o4, 28800, 3600, :KDT + tz.offset :o5, 32400, 3600, :KDT + + tz.transition 1889, 12, :o1, 26042775991, 10800 + tz.transition 1904, 11, :o2, 116007127, 48 + tz.transition 1927, 12, :o1, 19401969, 8 + tz.transition 1931, 12, :o2, 116481943, 48 + tz.transition 1954, 3, :o3, 19478577, 8 + tz.transition 1960, 5, :o4, 14622415, 6 + tz.transition 1960, 9, :o3, 19497521, 8 + tz.transition 1961, 8, :o1, 14625127, 6 + tz.transition 1968, 9, :o2, 117126247, 48 + tz.transition 1987, 5, :o5, 547570800 + tz.transition 1987, 10, :o2, 560872800 + tz.transition 1988, 5, :o5, 579020400 + tz.transition 1988, 10, :o2, 592322400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb new file mode 100644 index 0000000000..34b13d59ae --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb @@ -0,0 +1,35 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Shanghai + include TimezoneDefinition + + timezone 'Asia/Shanghai' do |tz| + tz.offset :o0, 29152, 0, :LMT + tz.offset :o1, 28800, 0, :CST + tz.offset :o2, 28800, 3600, :CDT + + tz.transition 1927, 12, :o1, 6548164639, 2700 + tz.transition 1940, 6, :o2, 14578699, 6 + tz.transition 1940, 9, :o1, 19439225, 8 + tz.transition 1941, 3, :o2, 14580415, 6 + tz.transition 1941, 9, :o1, 19442145, 8 + tz.transition 1986, 5, :o2, 515520000 + tz.transition 1986, 9, :o1, 527007600 + tz.transition 1987, 4, :o2, 545155200 + tz.transition 1987, 9, :o1, 558457200 + tz.transition 1988, 4, :o2, 576604800 + tz.transition 1988, 9, :o1, 589906800 + tz.transition 1989, 4, :o2, 608659200 + tz.transition 1989, 9, :o1, 621961200 + tz.transition 1990, 4, :o2, 640108800 + tz.transition 1990, 9, :o1, 653410800 + tz.transition 1991, 4, :o2, 671558400 + tz.transition 1991, 9, :o1, 684860400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb new file mode 100644 index 0000000000..b323a78f74 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb @@ -0,0 +1,33 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Singapore + include TimezoneDefinition + + timezone 'Asia/Singapore' do |tz| + tz.offset :o0, 24925, 0, :LMT + tz.offset :o1, 24925, 0, :SMT + tz.offset :o2, 25200, 0, :MALT + tz.offset :o3, 25200, 1200, :MALST + tz.offset :o4, 26400, 0, :MALT + tz.offset :o5, 27000, 0, :MALT + tz.offset :o6, 32400, 0, :JST + tz.offset :o7, 27000, 0, :SGT + tz.offset :o8, 28800, 0, :SGT + + tz.transition 1900, 12, :o1, 8347571291, 3456 + tz.transition 1905, 5, :o2, 8353142363, 3456 + tz.transition 1932, 12, :o3, 58249757, 24 + tz.transition 1935, 12, :o4, 87414055, 36 + tz.transition 1941, 8, :o5, 87488575, 36 + tz.transition 1942, 2, :o6, 38886499, 16 + tz.transition 1945, 9, :o5, 19453681, 8 + tz.transition 1965, 8, :o7, 39023699, 16 + tz.transition 1981, 12, :o8, 378664200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb new file mode 100644 index 0000000000..3ba12108fb --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb @@ -0,0 +1,59 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Taipei + include TimezoneDefinition + + timezone 'Asia/Taipei' do |tz| + tz.offset :o0, 29160, 0, :LMT + tz.offset :o1, 28800, 0, :CST + tz.offset :o2, 28800, 3600, :CDT + + tz.transition 1895, 12, :o1, 193084733, 80 + tz.transition 1945, 4, :o2, 14589457, 6 + tz.transition 1945, 9, :o1, 19453833, 8 + tz.transition 1946, 4, :o2, 14591647, 6 + tz.transition 1946, 9, :o1, 19456753, 8 + tz.transition 1947, 4, :o2, 14593837, 6 + tz.transition 1947, 9, :o1, 19459673, 8 + tz.transition 1948, 4, :o2, 14596033, 6 + tz.transition 1948, 9, :o1, 19462601, 8 + tz.transition 1949, 4, :o2, 14598223, 6 + tz.transition 1949, 9, :o1, 19465521, 8 + tz.transition 1950, 4, :o2, 14600413, 6 + tz.transition 1950, 9, :o1, 19468441, 8 + tz.transition 1951, 4, :o2, 14602603, 6 + tz.transition 1951, 9, :o1, 19471361, 8 + tz.transition 1952, 2, :o2, 14604433, 6 + tz.transition 1952, 10, :o1, 19474537, 8 + tz.transition 1953, 3, :o2, 14606809, 6 + tz.transition 1953, 10, :o1, 19477457, 8 + tz.transition 1954, 3, :o2, 14608999, 6 + tz.transition 1954, 10, :o1, 19480377, 8 + tz.transition 1955, 3, :o2, 14611189, 6 + tz.transition 1955, 9, :o1, 19483049, 8 + tz.transition 1956, 3, :o2, 14613385, 6 + tz.transition 1956, 9, :o1, 19485977, 8 + tz.transition 1957, 3, :o2, 14615575, 6 + tz.transition 1957, 9, :o1, 19488897, 8 + tz.transition 1958, 3, :o2, 14617765, 6 + tz.transition 1958, 9, :o1, 19491817, 8 + tz.transition 1959, 3, :o2, 14619955, 6 + tz.transition 1959, 9, :o1, 19494737, 8 + tz.transition 1960, 5, :o2, 14622517, 6 + tz.transition 1960, 9, :o1, 19497665, 8 + tz.transition 1961, 5, :o2, 14624707, 6 + tz.transition 1961, 9, :o1, 19500585, 8 + tz.transition 1974, 3, :o2, 133977600 + tz.transition 1974, 9, :o1, 149785200 + tz.transition 1975, 3, :o2, 165513600 + tz.transition 1975, 9, :o1, 181321200 + tz.transition 1980, 6, :o2, 331142400 + tz.transition 1980, 9, :o1, 339087600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb new file mode 100644 index 0000000000..c205c7934d --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb @@ -0,0 +1,47 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Tashkent + include TimezoneDefinition + + timezone 'Asia/Tashkent' do |tz| + tz.offset :o0, 16632, 0, :LMT + tz.offset :o1, 18000, 0, :TAST + tz.offset :o2, 21600, 0, :TAST + tz.offset :o3, 21600, 3600, :TASST + tz.offset :o4, 18000, 3600, :TASST + tz.offset :o5, 18000, 3600, :UZST + tz.offset :o6, 18000, 0, :UZT + + tz.transition 1924, 5, :o1, 969562923, 400 + tz.transition 1930, 6, :o2, 58227559, 24 + tz.transition 1981, 3, :o3, 354909600 + tz.transition 1981, 9, :o2, 370717200 + tz.transition 1982, 3, :o3, 386445600 + tz.transition 1982, 9, :o2, 402253200 + tz.transition 1983, 3, :o3, 417981600 + tz.transition 1983, 9, :o2, 433789200 + tz.transition 1984, 3, :o3, 449604000 + tz.transition 1984, 9, :o2, 465336000 + tz.transition 1985, 3, :o3, 481060800 + tz.transition 1985, 9, :o2, 496785600 + tz.transition 1986, 3, :o3, 512510400 + tz.transition 1986, 9, :o2, 528235200 + tz.transition 1987, 3, :o3, 543960000 + tz.transition 1987, 9, :o2, 559684800 + tz.transition 1988, 3, :o3, 575409600 + tz.transition 1988, 9, :o2, 591134400 + tz.transition 1989, 3, :o3, 606859200 + tz.transition 1989, 9, :o2, 622584000 + tz.transition 1990, 3, :o3, 638308800 + tz.transition 1990, 9, :o2, 654638400 + tz.transition 1991, 3, :o4, 670363200 + tz.transition 1991, 8, :o5, 683661600 + tz.transition 1991, 9, :o6, 686091600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb new file mode 100644 index 0000000000..15792a5651 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb @@ -0,0 +1,78 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Tbilisi + include TimezoneDefinition + + timezone 'Asia/Tbilisi' do |tz| + tz.offset :o0, 10756, 0, :LMT + tz.offset :o1, 10756, 0, :TBMT + tz.offset :o2, 10800, 0, :TBIT + tz.offset :o3, 14400, 0, :TBIT + tz.offset :o4, 14400, 3600, :TBIST + tz.offset :o5, 10800, 3600, :TBIST + tz.offset :o6, 10800, 3600, :GEST + tz.offset :o7, 10800, 0, :GET + tz.offset :o8, 14400, 0, :GET + tz.offset :o9, 14400, 3600, :GEST + + tz.transition 1879, 12, :o1, 52006652111, 21600 + tz.transition 1924, 5, :o2, 52356399311, 21600 + tz.transition 1957, 2, :o3, 19487187, 8 + tz.transition 1981, 3, :o4, 354916800 + tz.transition 1981, 9, :o3, 370724400 + tz.transition 1982, 3, :o4, 386452800 + tz.transition 1982, 9, :o3, 402260400 + tz.transition 1983, 3, :o4, 417988800 + tz.transition 1983, 9, :o3, 433796400 + tz.transition 1984, 3, :o4, 449611200 + tz.transition 1984, 9, :o3, 465343200 + tz.transition 1985, 3, :o4, 481068000 + tz.transition 1985, 9, :o3, 496792800 + tz.transition 1986, 3, :o4, 512517600 + tz.transition 1986, 9, :o3, 528242400 + tz.transition 1987, 3, :o4, 543967200 + tz.transition 1987, 9, :o3, 559692000 + tz.transition 1988, 3, :o4, 575416800 + tz.transition 1988, 9, :o3, 591141600 + tz.transition 1989, 3, :o4, 606866400 + tz.transition 1989, 9, :o3, 622591200 + tz.transition 1990, 3, :o4, 638316000 + tz.transition 1990, 9, :o3, 654645600 + tz.transition 1991, 3, :o5, 670370400 + tz.transition 1991, 4, :o6, 671140800 + tz.transition 1991, 9, :o7, 686098800 + tz.transition 1992, 3, :o6, 701816400 + tz.transition 1992, 9, :o7, 717537600 + tz.transition 1993, 3, :o6, 733266000 + tz.transition 1993, 9, :o7, 748987200 + tz.transition 1994, 3, :o6, 764715600 + tz.transition 1994, 9, :o8, 780436800 + tz.transition 1995, 3, :o9, 796161600 + tz.transition 1995, 9, :o8, 811882800 + tz.transition 1996, 3, :o9, 828216000 + tz.transition 1997, 3, :o9, 859662000 + tz.transition 1997, 10, :o8, 877806000 + tz.transition 1998, 3, :o9, 891115200 + tz.transition 1998, 10, :o8, 909255600 + tz.transition 1999, 3, :o9, 922564800 + tz.transition 1999, 10, :o8, 941310000 + tz.transition 2000, 3, :o9, 954014400 + tz.transition 2000, 10, :o8, 972759600 + tz.transition 2001, 3, :o9, 985464000 + tz.transition 2001, 10, :o8, 1004209200 + tz.transition 2002, 3, :o9, 1017518400 + tz.transition 2002, 10, :o8, 1035658800 + tz.transition 2003, 3, :o9, 1048968000 + tz.transition 2003, 10, :o8, 1067108400 + tz.transition 2004, 3, :o9, 1080417600 + tz.transition 2004, 6, :o6, 1088276400 + tz.transition 2004, 10, :o7, 1099177200 + tz.transition 2005, 3, :o8, 1111878000 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb new file mode 100644 index 0000000000..d8df964a46 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb @@ -0,0 +1,121 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Tehran + include TimezoneDefinition + + timezone 'Asia/Tehran' do |tz| + tz.offset :o0, 12344, 0, :LMT + tz.offset :o1, 12344, 0, :TMT + tz.offset :o2, 12600, 0, :IRST + tz.offset :o3, 14400, 0, :IRST + tz.offset :o4, 14400, 3600, :IRDT + tz.offset :o5, 12600, 3600, :IRDT + + tz.transition 1915, 12, :o1, 26145324257, 10800 + tz.transition 1945, 12, :o2, 26263670657, 10800 + tz.transition 1977, 10, :o3, 247177800 + tz.transition 1978, 3, :o4, 259272000 + tz.transition 1978, 10, :o3, 277758000 + tz.transition 1978, 12, :o2, 283982400 + tz.transition 1979, 3, :o5, 290809800 + tz.transition 1979, 9, :o2, 306531000 + tz.transition 1980, 3, :o5, 322432200 + tz.transition 1980, 9, :o2, 338499000 + tz.transition 1991, 5, :o5, 673216200 + tz.transition 1991, 9, :o2, 685481400 + tz.transition 1992, 3, :o5, 701209800 + tz.transition 1992, 9, :o2, 717103800 + tz.transition 1993, 3, :o5, 732745800 + tz.transition 1993, 9, :o2, 748639800 + tz.transition 1994, 3, :o5, 764281800 + tz.transition 1994, 9, :o2, 780175800 + tz.transition 1995, 3, :o5, 795817800 + tz.transition 1995, 9, :o2, 811711800 + tz.transition 1996, 3, :o5, 827353800 + tz.transition 1996, 9, :o2, 843247800 + tz.transition 1997, 3, :o5, 858976200 + tz.transition 1997, 9, :o2, 874870200 + tz.transition 1998, 3, :o5, 890512200 + tz.transition 1998, 9, :o2, 906406200 + tz.transition 1999, 3, :o5, 922048200 + tz.transition 1999, 9, :o2, 937942200 + tz.transition 2000, 3, :o5, 953584200 + tz.transition 2000, 9, :o2, 969478200 + tz.transition 2001, 3, :o5, 985206600 + tz.transition 2001, 9, :o2, 1001100600 + tz.transition 2002, 3, :o5, 1016742600 + tz.transition 2002, 9, :o2, 1032636600 + tz.transition 2003, 3, :o5, 1048278600 + tz.transition 2003, 9, :o2, 1064172600 + tz.transition 2004, 3, :o5, 1079814600 + tz.transition 2004, 9, :o2, 1095708600 + tz.transition 2005, 3, :o5, 1111437000 + tz.transition 2005, 9, :o2, 1127331000 + tz.transition 2008, 3, :o5, 1206045000 + tz.transition 2008, 9, :o2, 1221939000 + tz.transition 2009, 3, :o5, 1237667400 + tz.transition 2009, 9, :o2, 1253561400 + tz.transition 2010, 3, :o5, 1269203400 + tz.transition 2010, 9, :o2, 1285097400 + tz.transition 2011, 3, :o5, 1300739400 + tz.transition 2011, 9, :o2, 1316633400 + tz.transition 2012, 3, :o5, 1332275400 + tz.transition 2012, 9, :o2, 1348169400 + tz.transition 2013, 3, :o5, 1363897800 + tz.transition 2013, 9, :o2, 1379791800 + tz.transition 2014, 3, :o5, 1395433800 + tz.transition 2014, 9, :o2, 1411327800 + tz.transition 2015, 3, :o5, 1426969800 + tz.transition 2015, 9, :o2, 1442863800 + tz.transition 2016, 3, :o5, 1458505800 + tz.transition 2016, 9, :o2, 1474399800 + tz.transition 2017, 3, :o5, 1490128200 + tz.transition 2017, 9, :o2, 1506022200 + tz.transition 2018, 3, :o5, 1521664200 + tz.transition 2018, 9, :o2, 1537558200 + tz.transition 2019, 3, :o5, 1553200200 + tz.transition 2019, 9, :o2, 1569094200 + tz.transition 2020, 3, :o5, 1584736200 + tz.transition 2020, 9, :o2, 1600630200 + tz.transition 2021, 3, :o5, 1616358600 + tz.transition 2021, 9, :o2, 1632252600 + tz.transition 2022, 3, :o5, 1647894600 + tz.transition 2022, 9, :o2, 1663788600 + tz.transition 2023, 3, :o5, 1679430600 + tz.transition 2023, 9, :o2, 1695324600 + tz.transition 2024, 3, :o5, 1710966600 + tz.transition 2024, 9, :o2, 1726860600 + tz.transition 2025, 3, :o5, 1742589000 + tz.transition 2025, 9, :o2, 1758483000 + tz.transition 2026, 3, :o5, 1774125000 + tz.transition 2026, 9, :o2, 1790019000 + tz.transition 2027, 3, :o5, 1805661000 + tz.transition 2027, 9, :o2, 1821555000 + tz.transition 2028, 3, :o5, 1837197000 + tz.transition 2028, 9, :o2, 1853091000 + tz.transition 2029, 3, :o5, 1868733000 + tz.transition 2029, 9, :o2, 1884627000 + tz.transition 2030, 3, :o5, 1900355400 + tz.transition 2030, 9, :o2, 1916249400 + tz.transition 2031, 3, :o5, 1931891400 + tz.transition 2031, 9, :o2, 1947785400 + tz.transition 2032, 3, :o5, 1963427400 + tz.transition 2032, 9, :o2, 1979321400 + tz.transition 2033, 3, :o5, 1994963400 + tz.transition 2033, 9, :o2, 2010857400 + tz.transition 2034, 3, :o5, 2026585800 + tz.transition 2034, 9, :o2, 2042479800 + tz.transition 2035, 3, :o5, 2058121800 + tz.transition 2035, 9, :o2, 2074015800 + tz.transition 2036, 3, :o5, 2089657800 + tz.transition 2036, 9, :o2, 2105551800 + tz.transition 2037, 3, :o5, 2121193800 + tz.transition 2037, 9, :o2, 2137087800 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb new file mode 100644 index 0000000000..51c9e16421 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb @@ -0,0 +1,30 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Tokyo + include TimezoneDefinition + + timezone 'Asia/Tokyo' do |tz| + tz.offset :o0, 33539, 0, :LMT + tz.offset :o1, 32400, 0, :JST + tz.offset :o2, 32400, 0, :CJT + tz.offset :o3, 32400, 3600, :JDT + + tz.transition 1887, 12, :o1, 19285097, 8 + tz.transition 1895, 12, :o2, 19308473, 8 + tz.transition 1937, 12, :o1, 19431193, 8 + tz.transition 1948, 5, :o3, 58384157, 24 + tz.transition 1948, 9, :o1, 14596831, 6 + tz.transition 1949, 4, :o3, 58392221, 24 + tz.transition 1949, 9, :o1, 14599015, 6 + tz.transition 1950, 5, :o3, 58401797, 24 + tz.transition 1950, 9, :o1, 14601199, 6 + tz.transition 1951, 5, :o3, 58410533, 24 + tz.transition 1951, 9, :o1, 14603383, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb new file mode 100644 index 0000000000..2854f5c5fd --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb @@ -0,0 +1,65 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Ulaanbaatar + include TimezoneDefinition + + timezone 'Asia/Ulaanbaatar' do |tz| + tz.offset :o0, 25652, 0, :LMT + tz.offset :o1, 25200, 0, :ULAT + tz.offset :o2, 28800, 0, :ULAT + tz.offset :o3, 28800, 3600, :ULAST + + tz.transition 1905, 7, :o1, 52208457187, 21600 + tz.transition 1977, 12, :o2, 252435600 + tz.transition 1983, 3, :o3, 417974400 + tz.transition 1983, 9, :o2, 433782000 + tz.transition 1984, 3, :o3, 449596800 + tz.transition 1984, 9, :o2, 465318000 + tz.transition 1985, 3, :o3, 481046400 + tz.transition 1985, 9, :o2, 496767600 + tz.transition 1986, 3, :o3, 512496000 + tz.transition 1986, 9, :o2, 528217200 + tz.transition 1987, 3, :o3, 543945600 + tz.transition 1987, 9, :o2, 559666800 + tz.transition 1988, 3, :o3, 575395200 + tz.transition 1988, 9, :o2, 591116400 + tz.transition 1989, 3, :o3, 606844800 + tz.transition 1989, 9, :o2, 622566000 + tz.transition 1990, 3, :o3, 638294400 + tz.transition 1990, 9, :o2, 654620400 + tz.transition 1991, 3, :o3, 670348800 + tz.transition 1991, 9, :o2, 686070000 + tz.transition 1992, 3, :o3, 701798400 + tz.transition 1992, 9, :o2, 717519600 + tz.transition 1993, 3, :o3, 733248000 + tz.transition 1993, 9, :o2, 748969200 + tz.transition 1994, 3, :o3, 764697600 + tz.transition 1994, 9, :o2, 780418800 + tz.transition 1995, 3, :o3, 796147200 + tz.transition 1995, 9, :o2, 811868400 + tz.transition 1996, 3, :o3, 828201600 + tz.transition 1996, 9, :o2, 843922800 + tz.transition 1997, 3, :o3, 859651200 + tz.transition 1997, 9, :o2, 875372400 + tz.transition 1998, 3, :o3, 891100800 + tz.transition 1998, 9, :o2, 906822000 + tz.transition 2001, 4, :o3, 988394400 + tz.transition 2001, 9, :o2, 1001696400 + tz.transition 2002, 3, :o3, 1017424800 + tz.transition 2002, 9, :o2, 1033146000 + tz.transition 2003, 3, :o3, 1048874400 + tz.transition 2003, 9, :o2, 1064595600 + tz.transition 2004, 3, :o3, 1080324000 + tz.transition 2004, 9, :o2, 1096045200 + tz.transition 2005, 3, :o3, 1111773600 + tz.transition 2005, 9, :o2, 1127494800 + tz.transition 2006, 3, :o3, 1143223200 + tz.transition 2006, 9, :o2, 1159549200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb new file mode 100644 index 0000000000..d793ff1341 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb @@ -0,0 +1,33 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Urumqi + include TimezoneDefinition + + timezone 'Asia/Urumqi' do |tz| + tz.offset :o0, 21020, 0, :LMT + tz.offset :o1, 21600, 0, :URUT + tz.offset :o2, 28800, 0, :CST + tz.offset :o3, 28800, 3600, :CDT + + tz.transition 1927, 12, :o1, 10477063829, 4320 + tz.transition 1980, 4, :o2, 325965600 + tz.transition 1986, 5, :o3, 515520000 + tz.transition 1986, 9, :o2, 527007600 + tz.transition 1987, 4, :o3, 545155200 + tz.transition 1987, 9, :o2, 558457200 + tz.transition 1988, 4, :o3, 576604800 + tz.transition 1988, 9, :o2, 589906800 + tz.transition 1989, 4, :o3, 608659200 + tz.transition 1989, 9, :o2, 621961200 + tz.transition 1990, 4, :o3, 640108800 + tz.transition 1990, 9, :o2, 653410800 + tz.transition 1991, 4, :o3, 671558400 + tz.transition 1991, 9, :o2, 684860400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb new file mode 100644 index 0000000000..bd9e3d60ec --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb @@ -0,0 +1,164 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Vladivostok + include TimezoneDefinition + + timezone 'Asia/Vladivostok' do |tz| + tz.offset :o0, 31664, 0, :LMT + tz.offset :o1, 32400, 0, :VLAT + tz.offset :o2, 36000, 0, :VLAT + tz.offset :o3, 36000, 3600, :VLAST + tz.offset :o4, 32400, 3600, :VLASST + tz.offset :o5, 32400, 0, :VLAST + + tz.transition 1922, 11, :o1, 13086214921, 5400 + tz.transition 1930, 6, :o2, 19409185, 8 + tz.transition 1981, 3, :o3, 354895200 + tz.transition 1981, 9, :o2, 370702800 + tz.transition 1982, 3, :o3, 386431200 + tz.transition 1982, 9, :o2, 402238800 + tz.transition 1983, 3, :o3, 417967200 + tz.transition 1983, 9, :o2, 433774800 + tz.transition 1984, 3, :o3, 449589600 + tz.transition 1984, 9, :o2, 465321600 + tz.transition 1985, 3, :o3, 481046400 + tz.transition 1985, 9, :o2, 496771200 + tz.transition 1986, 3, :o3, 512496000 + tz.transition 1986, 9, :o2, 528220800 + tz.transition 1987, 3, :o3, 543945600 + tz.transition 1987, 9, :o2, 559670400 + tz.transition 1988, 3, :o3, 575395200 + tz.transition 1988, 9, :o2, 591120000 + tz.transition 1989, 3, :o3, 606844800 + tz.transition 1989, 9, :o2, 622569600 + tz.transition 1990, 3, :o3, 638294400 + tz.transition 1990, 9, :o2, 654624000 + tz.transition 1991, 3, :o4, 670348800 + tz.transition 1991, 9, :o5, 686077200 + tz.transition 1992, 1, :o2, 695754000 + tz.transition 1992, 3, :o3, 701787600 + tz.transition 1992, 9, :o2, 717508800 + tz.transition 1993, 3, :o3, 733248000 + tz.transition 1993, 9, :o2, 748972800 + tz.transition 1994, 3, :o3, 764697600 + tz.transition 1994, 9, :o2, 780422400 + tz.transition 1995, 3, :o3, 796147200 + tz.transition 1995, 9, :o2, 811872000 + tz.transition 1996, 3, :o3, 828201600 + tz.transition 1996, 10, :o2, 846345600 + tz.transition 1997, 3, :o3, 859651200 + tz.transition 1997, 10, :o2, 877795200 + tz.transition 1998, 3, :o3, 891100800 + tz.transition 1998, 10, :o2, 909244800 + tz.transition 1999, 3, :o3, 922550400 + tz.transition 1999, 10, :o2, 941299200 + tz.transition 2000, 3, :o3, 954000000 + tz.transition 2000, 10, :o2, 972748800 + tz.transition 2001, 3, :o3, 985449600 + tz.transition 2001, 10, :o2, 1004198400 + tz.transition 2002, 3, :o3, 1017504000 + tz.transition 2002, 10, :o2, 1035648000 + tz.transition 2003, 3, :o3, 1048953600 + tz.transition 2003, 10, :o2, 1067097600 + tz.transition 2004, 3, :o3, 1080403200 + tz.transition 2004, 10, :o2, 1099152000 + tz.transition 2005, 3, :o3, 1111852800 + tz.transition 2005, 10, :o2, 1130601600 + tz.transition 2006, 3, :o3, 1143302400 + tz.transition 2006, 10, :o2, 1162051200 + tz.transition 2007, 3, :o3, 1174752000 + tz.transition 2007, 10, :o2, 1193500800 + tz.transition 2008, 3, :o3, 1206806400 + tz.transition 2008, 10, :o2, 1224950400 + tz.transition 2009, 3, :o3, 1238256000 + tz.transition 2009, 10, :o2, 1256400000 + tz.transition 2010, 3, :o3, 1269705600 + tz.transition 2010, 10, :o2, 1288454400 + tz.transition 2011, 3, :o3, 1301155200 + tz.transition 2011, 10, :o2, 1319904000 + tz.transition 2012, 3, :o3, 1332604800 + tz.transition 2012, 10, :o2, 1351353600 + tz.transition 2013, 3, :o3, 1364659200 + tz.transition 2013, 10, :o2, 1382803200 + tz.transition 2014, 3, :o3, 1396108800 + tz.transition 2014, 10, :o2, 1414252800 + tz.transition 2015, 3, :o3, 1427558400 + tz.transition 2015, 10, :o2, 1445702400 + tz.transition 2016, 3, :o3, 1459008000 + tz.transition 2016, 10, :o2, 1477756800 + tz.transition 2017, 3, :o3, 1490457600 + tz.transition 2017, 10, :o2, 1509206400 + tz.transition 2018, 3, :o3, 1521907200 + tz.transition 2018, 10, :o2, 1540656000 + tz.transition 2019, 3, :o3, 1553961600 + tz.transition 2019, 10, :o2, 1572105600 + tz.transition 2020, 3, :o3, 1585411200 + tz.transition 2020, 10, :o2, 1603555200 + tz.transition 2021, 3, :o3, 1616860800 + tz.transition 2021, 10, :o2, 1635609600 + tz.transition 2022, 3, :o3, 1648310400 + tz.transition 2022, 10, :o2, 1667059200 + tz.transition 2023, 3, :o3, 1679760000 + tz.transition 2023, 10, :o2, 1698508800 + tz.transition 2024, 3, :o3, 1711814400 + tz.transition 2024, 10, :o2, 1729958400 + tz.transition 2025, 3, :o3, 1743264000 + tz.transition 2025, 10, :o2, 1761408000 + tz.transition 2026, 3, :o3, 1774713600 + tz.transition 2026, 10, :o2, 1792857600 + tz.transition 2027, 3, :o3, 1806163200 + tz.transition 2027, 10, :o2, 1824912000 + tz.transition 2028, 3, :o3, 1837612800 + tz.transition 2028, 10, :o2, 1856361600 + tz.transition 2029, 3, :o3, 1869062400 + tz.transition 2029, 10, :o2, 1887811200 + tz.transition 2030, 3, :o3, 1901116800 + tz.transition 2030, 10, :o2, 1919260800 + tz.transition 2031, 3, :o3, 1932566400 + tz.transition 2031, 10, :o2, 1950710400 + tz.transition 2032, 3, :o3, 1964016000 + tz.transition 2032, 10, :o2, 1982764800 + tz.transition 2033, 3, :o3, 1995465600 + tz.transition 2033, 10, :o2, 2014214400 + tz.transition 2034, 3, :o3, 2026915200 + tz.transition 2034, 10, :o2, 2045664000 + tz.transition 2035, 3, :o3, 2058364800 + tz.transition 2035, 10, :o2, 2077113600 + tz.transition 2036, 3, :o3, 2090419200 + tz.transition 2036, 10, :o2, 2108563200 + tz.transition 2037, 3, :o3, 2121868800 + tz.transition 2037, 10, :o2, 2140012800 + tz.transition 2038, 3, :o3, 14793061, 6 + tz.transition 2038, 10, :o2, 14794363, 6 + tz.transition 2039, 3, :o3, 14795245, 6 + tz.transition 2039, 10, :o2, 14796547, 6 + tz.transition 2040, 3, :o3, 14797429, 6 + tz.transition 2040, 10, :o2, 14798731, 6 + tz.transition 2041, 3, :o3, 14799655, 6 + tz.transition 2041, 10, :o2, 14800915, 6 + tz.transition 2042, 3, :o3, 14801839, 6 + tz.transition 2042, 10, :o2, 14803099, 6 + tz.transition 2043, 3, :o3, 14804023, 6 + tz.transition 2043, 10, :o2, 14805283, 6 + tz.transition 2044, 3, :o3, 14806207, 6 + tz.transition 2044, 10, :o2, 14807509, 6 + tz.transition 2045, 3, :o3, 14808391, 6 + tz.transition 2045, 10, :o2, 14809693, 6 + tz.transition 2046, 3, :o3, 14810575, 6 + tz.transition 2046, 10, :o2, 14811877, 6 + tz.transition 2047, 3, :o3, 14812801, 6 + tz.transition 2047, 10, :o2, 14814061, 6 + tz.transition 2048, 3, :o3, 14814985, 6 + tz.transition 2048, 10, :o2, 14816245, 6 + tz.transition 2049, 3, :o3, 14817169, 6 + tz.transition 2049, 10, :o2, 14818471, 6 + tz.transition 2050, 3, :o3, 14819353, 6 + tz.transition 2050, 10, :o2, 14820655, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb new file mode 100644 index 0000000000..56435a788f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Yakutsk + include TimezoneDefinition + + timezone 'Asia/Yakutsk' do |tz| + tz.offset :o0, 31120, 0, :LMT + tz.offset :o1, 28800, 0, :YAKT + tz.offset :o2, 32400, 0, :YAKT + tz.offset :o3, 32400, 3600, :YAKST + tz.offset :o4, 28800, 3600, :YAKST + + tz.transition 1919, 12, :o1, 2616091711, 1080 + tz.transition 1930, 6, :o2, 14556889, 6 + tz.transition 1981, 3, :o3, 354898800 + tz.transition 1981, 9, :o2, 370706400 + tz.transition 1982, 3, :o3, 386434800 + tz.transition 1982, 9, :o2, 402242400 + tz.transition 1983, 3, :o3, 417970800 + tz.transition 1983, 9, :o2, 433778400 + tz.transition 1984, 3, :o3, 449593200 + tz.transition 1984, 9, :o2, 465325200 + tz.transition 1985, 3, :o3, 481050000 + tz.transition 1985, 9, :o2, 496774800 + tz.transition 1986, 3, :o3, 512499600 + tz.transition 1986, 9, :o2, 528224400 + tz.transition 1987, 3, :o3, 543949200 + tz.transition 1987, 9, :o2, 559674000 + tz.transition 1988, 3, :o3, 575398800 + tz.transition 1988, 9, :o2, 591123600 + tz.transition 1989, 3, :o3, 606848400 + tz.transition 1989, 9, :o2, 622573200 + tz.transition 1990, 3, :o3, 638298000 + tz.transition 1990, 9, :o2, 654627600 + tz.transition 1991, 3, :o4, 670352400 + tz.transition 1991, 9, :o1, 686080800 + tz.transition 1992, 1, :o2, 695757600 + tz.transition 1992, 3, :o3, 701791200 + tz.transition 1992, 9, :o2, 717512400 + tz.transition 1993, 3, :o3, 733251600 + tz.transition 1993, 9, :o2, 748976400 + tz.transition 1994, 3, :o3, 764701200 + tz.transition 1994, 9, :o2, 780426000 + tz.transition 1995, 3, :o3, 796150800 + tz.transition 1995, 9, :o2, 811875600 + tz.transition 1996, 3, :o3, 828205200 + tz.transition 1996, 10, :o2, 846349200 + tz.transition 1997, 3, :o3, 859654800 + tz.transition 1997, 10, :o2, 877798800 + tz.transition 1998, 3, :o3, 891104400 + tz.transition 1998, 10, :o2, 909248400 + tz.transition 1999, 3, :o3, 922554000 + tz.transition 1999, 10, :o2, 941302800 + tz.transition 2000, 3, :o3, 954003600 + tz.transition 2000, 10, :o2, 972752400 + tz.transition 2001, 3, :o3, 985453200 + tz.transition 2001, 10, :o2, 1004202000 + tz.transition 2002, 3, :o3, 1017507600 + tz.transition 2002, 10, :o2, 1035651600 + tz.transition 2003, 3, :o3, 1048957200 + tz.transition 2003, 10, :o2, 1067101200 + tz.transition 2004, 3, :o3, 1080406800 + tz.transition 2004, 10, :o2, 1099155600 + tz.transition 2005, 3, :o3, 1111856400 + tz.transition 2005, 10, :o2, 1130605200 + tz.transition 2006, 3, :o3, 1143306000 + tz.transition 2006, 10, :o2, 1162054800 + tz.transition 2007, 3, :o3, 1174755600 + tz.transition 2007, 10, :o2, 1193504400 + tz.transition 2008, 3, :o3, 1206810000 + tz.transition 2008, 10, :o2, 1224954000 + tz.transition 2009, 3, :o3, 1238259600 + tz.transition 2009, 10, :o2, 1256403600 + tz.transition 2010, 3, :o3, 1269709200 + tz.transition 2010, 10, :o2, 1288458000 + tz.transition 2011, 3, :o3, 1301158800 + tz.transition 2011, 10, :o2, 1319907600 + tz.transition 2012, 3, :o3, 1332608400 + tz.transition 2012, 10, :o2, 1351357200 + tz.transition 2013, 3, :o3, 1364662800 + tz.transition 2013, 10, :o2, 1382806800 + tz.transition 2014, 3, :o3, 1396112400 + tz.transition 2014, 10, :o2, 1414256400 + tz.transition 2015, 3, :o3, 1427562000 + tz.transition 2015, 10, :o2, 1445706000 + tz.transition 2016, 3, :o3, 1459011600 + tz.transition 2016, 10, :o2, 1477760400 + tz.transition 2017, 3, :o3, 1490461200 + tz.transition 2017, 10, :o2, 1509210000 + tz.transition 2018, 3, :o3, 1521910800 + tz.transition 2018, 10, :o2, 1540659600 + tz.transition 2019, 3, :o3, 1553965200 + tz.transition 2019, 10, :o2, 1572109200 + tz.transition 2020, 3, :o3, 1585414800 + tz.transition 2020, 10, :o2, 1603558800 + tz.transition 2021, 3, :o3, 1616864400 + tz.transition 2021, 10, :o2, 1635613200 + tz.transition 2022, 3, :o3, 1648314000 + tz.transition 2022, 10, :o2, 1667062800 + tz.transition 2023, 3, :o3, 1679763600 + tz.transition 2023, 10, :o2, 1698512400 + tz.transition 2024, 3, :o3, 1711818000 + tz.transition 2024, 10, :o2, 1729962000 + tz.transition 2025, 3, :o3, 1743267600 + tz.transition 2025, 10, :o2, 1761411600 + tz.transition 2026, 3, :o3, 1774717200 + tz.transition 2026, 10, :o2, 1792861200 + tz.transition 2027, 3, :o3, 1806166800 + tz.transition 2027, 10, :o2, 1824915600 + tz.transition 2028, 3, :o3, 1837616400 + tz.transition 2028, 10, :o2, 1856365200 + tz.transition 2029, 3, :o3, 1869066000 + tz.transition 2029, 10, :o2, 1887814800 + tz.transition 2030, 3, :o3, 1901120400 + tz.transition 2030, 10, :o2, 1919264400 + tz.transition 2031, 3, :o3, 1932570000 + tz.transition 2031, 10, :o2, 1950714000 + tz.transition 2032, 3, :o3, 1964019600 + tz.transition 2032, 10, :o2, 1982768400 + tz.transition 2033, 3, :o3, 1995469200 + tz.transition 2033, 10, :o2, 2014218000 + tz.transition 2034, 3, :o3, 2026918800 + tz.transition 2034, 10, :o2, 2045667600 + tz.transition 2035, 3, :o3, 2058368400 + tz.transition 2035, 10, :o2, 2077117200 + tz.transition 2036, 3, :o3, 2090422800 + tz.transition 2036, 10, :o2, 2108566800 + tz.transition 2037, 3, :o3, 2121872400 + tz.transition 2037, 10, :o2, 2140016400 + tz.transition 2038, 3, :o3, 59172245, 24 + tz.transition 2038, 10, :o2, 59177453, 24 + tz.transition 2039, 3, :o3, 59180981, 24 + tz.transition 2039, 10, :o2, 59186189, 24 + tz.transition 2040, 3, :o3, 59189717, 24 + tz.transition 2040, 10, :o2, 59194925, 24 + tz.transition 2041, 3, :o3, 59198621, 24 + tz.transition 2041, 10, :o2, 59203661, 24 + tz.transition 2042, 3, :o3, 59207357, 24 + tz.transition 2042, 10, :o2, 59212397, 24 + tz.transition 2043, 3, :o3, 59216093, 24 + tz.transition 2043, 10, :o2, 59221133, 24 + tz.transition 2044, 3, :o3, 59224829, 24 + tz.transition 2044, 10, :o2, 59230037, 24 + tz.transition 2045, 3, :o3, 59233565, 24 + tz.transition 2045, 10, :o2, 59238773, 24 + tz.transition 2046, 3, :o3, 59242301, 24 + tz.transition 2046, 10, :o2, 59247509, 24 + tz.transition 2047, 3, :o3, 59251205, 24 + tz.transition 2047, 10, :o2, 59256245, 24 + tz.transition 2048, 3, :o3, 59259941, 24 + tz.transition 2048, 10, :o2, 59264981, 24 + tz.transition 2049, 3, :o3, 59268677, 24 + tz.transition 2049, 10, :o2, 59273885, 24 + tz.transition 2050, 3, :o3, 59277413, 24 + tz.transition 2050, 10, :o2, 59282621, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb new file mode 100644 index 0000000000..8ef8df4a41 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb @@ -0,0 +1,165 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Yekaterinburg + include TimezoneDefinition + + timezone 'Asia/Yekaterinburg' do |tz| + tz.offset :o0, 14544, 0, :LMT + tz.offset :o1, 14400, 0, :SVET + tz.offset :o2, 18000, 0, :SVET + tz.offset :o3, 18000, 3600, :SVEST + tz.offset :o4, 14400, 3600, :SVEST + tz.offset :o5, 18000, 0, :YEKT + tz.offset :o6, 18000, 3600, :YEKST + + tz.transition 1919, 7, :o1, 1453292699, 600 + tz.transition 1930, 6, :o2, 7278445, 3 + tz.transition 1981, 3, :o3, 354913200 + tz.transition 1981, 9, :o2, 370720800 + tz.transition 1982, 3, :o3, 386449200 + tz.transition 1982, 9, :o2, 402256800 + tz.transition 1983, 3, :o3, 417985200 + tz.transition 1983, 9, :o2, 433792800 + tz.transition 1984, 3, :o3, 449607600 + tz.transition 1984, 9, :o2, 465339600 + tz.transition 1985, 3, :o3, 481064400 + tz.transition 1985, 9, :o2, 496789200 + tz.transition 1986, 3, :o3, 512514000 + tz.transition 1986, 9, :o2, 528238800 + tz.transition 1987, 3, :o3, 543963600 + tz.transition 1987, 9, :o2, 559688400 + tz.transition 1988, 3, :o3, 575413200 + tz.transition 1988, 9, :o2, 591138000 + tz.transition 1989, 3, :o3, 606862800 + tz.transition 1989, 9, :o2, 622587600 + tz.transition 1990, 3, :o3, 638312400 + tz.transition 1990, 9, :o2, 654642000 + tz.transition 1991, 3, :o4, 670366800 + tz.transition 1991, 9, :o1, 686095200 + tz.transition 1992, 1, :o5, 695772000 + tz.transition 1992, 3, :o6, 701805600 + tz.transition 1992, 9, :o5, 717526800 + tz.transition 1993, 3, :o6, 733266000 + tz.transition 1993, 9, :o5, 748990800 + tz.transition 1994, 3, :o6, 764715600 + tz.transition 1994, 9, :o5, 780440400 + tz.transition 1995, 3, :o6, 796165200 + tz.transition 1995, 9, :o5, 811890000 + tz.transition 1996, 3, :o6, 828219600 + tz.transition 1996, 10, :o5, 846363600 + tz.transition 1997, 3, :o6, 859669200 + tz.transition 1997, 10, :o5, 877813200 + tz.transition 1998, 3, :o6, 891118800 + tz.transition 1998, 10, :o5, 909262800 + tz.transition 1999, 3, :o6, 922568400 + tz.transition 1999, 10, :o5, 941317200 + tz.transition 2000, 3, :o6, 954018000 + tz.transition 2000, 10, :o5, 972766800 + tz.transition 2001, 3, :o6, 985467600 + tz.transition 2001, 10, :o5, 1004216400 + tz.transition 2002, 3, :o6, 1017522000 + tz.transition 2002, 10, :o5, 1035666000 + tz.transition 2003, 3, :o6, 1048971600 + tz.transition 2003, 10, :o5, 1067115600 + tz.transition 2004, 3, :o6, 1080421200 + tz.transition 2004, 10, :o5, 1099170000 + tz.transition 2005, 3, :o6, 1111870800 + tz.transition 2005, 10, :o5, 1130619600 + tz.transition 2006, 3, :o6, 1143320400 + tz.transition 2006, 10, :o5, 1162069200 + tz.transition 2007, 3, :o6, 1174770000 + tz.transition 2007, 10, :o5, 1193518800 + tz.transition 2008, 3, :o6, 1206824400 + tz.transition 2008, 10, :o5, 1224968400 + tz.transition 2009, 3, :o6, 1238274000 + tz.transition 2009, 10, :o5, 1256418000 + tz.transition 2010, 3, :o6, 1269723600 + tz.transition 2010, 10, :o5, 1288472400 + tz.transition 2011, 3, :o6, 1301173200 + tz.transition 2011, 10, :o5, 1319922000 + tz.transition 2012, 3, :o6, 1332622800 + tz.transition 2012, 10, :o5, 1351371600 + tz.transition 2013, 3, :o6, 1364677200 + tz.transition 2013, 10, :o5, 1382821200 + tz.transition 2014, 3, :o6, 1396126800 + tz.transition 2014, 10, :o5, 1414270800 + tz.transition 2015, 3, :o6, 1427576400 + tz.transition 2015, 10, :o5, 1445720400 + tz.transition 2016, 3, :o6, 1459026000 + tz.transition 2016, 10, :o5, 1477774800 + tz.transition 2017, 3, :o6, 1490475600 + tz.transition 2017, 10, :o5, 1509224400 + tz.transition 2018, 3, :o6, 1521925200 + tz.transition 2018, 10, :o5, 1540674000 + tz.transition 2019, 3, :o6, 1553979600 + tz.transition 2019, 10, :o5, 1572123600 + tz.transition 2020, 3, :o6, 1585429200 + tz.transition 2020, 10, :o5, 1603573200 + tz.transition 2021, 3, :o6, 1616878800 + tz.transition 2021, 10, :o5, 1635627600 + tz.transition 2022, 3, :o6, 1648328400 + tz.transition 2022, 10, :o5, 1667077200 + tz.transition 2023, 3, :o6, 1679778000 + tz.transition 2023, 10, :o5, 1698526800 + tz.transition 2024, 3, :o6, 1711832400 + tz.transition 2024, 10, :o5, 1729976400 + tz.transition 2025, 3, :o6, 1743282000 + tz.transition 2025, 10, :o5, 1761426000 + tz.transition 2026, 3, :o6, 1774731600 + tz.transition 2026, 10, :o5, 1792875600 + tz.transition 2027, 3, :o6, 1806181200 + tz.transition 2027, 10, :o5, 1824930000 + tz.transition 2028, 3, :o6, 1837630800 + tz.transition 2028, 10, :o5, 1856379600 + tz.transition 2029, 3, :o6, 1869080400 + tz.transition 2029, 10, :o5, 1887829200 + tz.transition 2030, 3, :o6, 1901134800 + tz.transition 2030, 10, :o5, 1919278800 + tz.transition 2031, 3, :o6, 1932584400 + tz.transition 2031, 10, :o5, 1950728400 + tz.transition 2032, 3, :o6, 1964034000 + tz.transition 2032, 10, :o5, 1982782800 + tz.transition 2033, 3, :o6, 1995483600 + tz.transition 2033, 10, :o5, 2014232400 + tz.transition 2034, 3, :o6, 2026933200 + tz.transition 2034, 10, :o5, 2045682000 + tz.transition 2035, 3, :o6, 2058382800 + tz.transition 2035, 10, :o5, 2077131600 + tz.transition 2036, 3, :o6, 2090437200 + tz.transition 2036, 10, :o5, 2108581200 + tz.transition 2037, 3, :o6, 2121886800 + tz.transition 2037, 10, :o5, 2140030800 + tz.transition 2038, 3, :o6, 19724083, 8 + tz.transition 2038, 10, :o5, 19725819, 8 + tz.transition 2039, 3, :o6, 19726995, 8 + tz.transition 2039, 10, :o5, 19728731, 8 + tz.transition 2040, 3, :o6, 19729907, 8 + tz.transition 2040, 10, :o5, 19731643, 8 + tz.transition 2041, 3, :o6, 19732875, 8 + tz.transition 2041, 10, :o5, 19734555, 8 + tz.transition 2042, 3, :o6, 19735787, 8 + tz.transition 2042, 10, :o5, 19737467, 8 + tz.transition 2043, 3, :o6, 19738699, 8 + tz.transition 2043, 10, :o5, 19740379, 8 + tz.transition 2044, 3, :o6, 19741611, 8 + tz.transition 2044, 10, :o5, 19743347, 8 + tz.transition 2045, 3, :o6, 19744523, 8 + tz.transition 2045, 10, :o5, 19746259, 8 + tz.transition 2046, 3, :o6, 19747435, 8 + tz.transition 2046, 10, :o5, 19749171, 8 + tz.transition 2047, 3, :o6, 19750403, 8 + tz.transition 2047, 10, :o5, 19752083, 8 + tz.transition 2048, 3, :o6, 19753315, 8 + tz.transition 2048, 10, :o5, 19754995, 8 + tz.transition 2049, 3, :o6, 19756227, 8 + tz.transition 2049, 10, :o5, 19757963, 8 + tz.transition 2050, 3, :o6, 19759139, 8 + tz.transition 2050, 10, :o5, 19760875, 8 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb new file mode 100644 index 0000000000..e7f160861f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb @@ -0,0 +1,165 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Asia + module Yerevan + include TimezoneDefinition + + timezone 'Asia/Yerevan' do |tz| + tz.offset :o0, 10680, 0, :LMT + tz.offset :o1, 10800, 0, :YERT + tz.offset :o2, 14400, 0, :YERT + tz.offset :o3, 14400, 3600, :YERST + tz.offset :o4, 10800, 3600, :YERST + tz.offset :o5, 10800, 3600, :AMST + tz.offset :o6, 10800, 0, :AMT + tz.offset :o7, 14400, 0, :AMT + tz.offset :o8, 14400, 3600, :AMST + + tz.transition 1924, 5, :o1, 1745213311, 720 + tz.transition 1957, 2, :o2, 19487187, 8 + tz.transition 1981, 3, :o3, 354916800 + tz.transition 1981, 9, :o2, 370724400 + tz.transition 1982, 3, :o3, 386452800 + tz.transition 1982, 9, :o2, 402260400 + tz.transition 1983, 3, :o3, 417988800 + tz.transition 1983, 9, :o2, 433796400 + tz.transition 1984, 3, :o3, 449611200 + tz.transition 1984, 9, :o2, 465343200 + tz.transition 1985, 3, :o3, 481068000 + tz.transition 1985, 9, :o2, 496792800 + tz.transition 1986, 3, :o3, 512517600 + tz.transition 1986, 9, :o2, 528242400 + tz.transition 1987, 3, :o3, 543967200 + tz.transition 1987, 9, :o2, 559692000 + tz.transition 1988, 3, :o3, 575416800 + tz.transition 1988, 9, :o2, 591141600 + tz.transition 1989, 3, :o3, 606866400 + tz.transition 1989, 9, :o2, 622591200 + tz.transition 1990, 3, :o3, 638316000 + tz.transition 1990, 9, :o2, 654645600 + tz.transition 1991, 3, :o4, 670370400 + tz.transition 1991, 9, :o5, 685569600 + tz.transition 1991, 9, :o6, 686098800 + tz.transition 1992, 3, :o5, 701812800 + tz.transition 1992, 9, :o6, 717534000 + tz.transition 1993, 3, :o5, 733273200 + tz.transition 1993, 9, :o6, 748998000 + tz.transition 1994, 3, :o5, 764722800 + tz.transition 1994, 9, :o6, 780447600 + tz.transition 1995, 3, :o5, 796172400 + tz.transition 1995, 9, :o7, 811897200 + tz.transition 1997, 3, :o8, 859672800 + tz.transition 1997, 10, :o7, 877816800 + tz.transition 1998, 3, :o8, 891122400 + tz.transition 1998, 10, :o7, 909266400 + tz.transition 1999, 3, :o8, 922572000 + tz.transition 1999, 10, :o7, 941320800 + tz.transition 2000, 3, :o8, 954021600 + tz.transition 2000, 10, :o7, 972770400 + tz.transition 2001, 3, :o8, 985471200 + tz.transition 2001, 10, :o7, 1004220000 + tz.transition 2002, 3, :o8, 1017525600 + tz.transition 2002, 10, :o7, 1035669600 + tz.transition 2003, 3, :o8, 1048975200 + tz.transition 2003, 10, :o7, 1067119200 + tz.transition 2004, 3, :o8, 1080424800 + tz.transition 2004, 10, :o7, 1099173600 + tz.transition 2005, 3, :o8, 1111874400 + tz.transition 2005, 10, :o7, 1130623200 + tz.transition 2006, 3, :o8, 1143324000 + tz.transition 2006, 10, :o7, 1162072800 + tz.transition 2007, 3, :o8, 1174773600 + tz.transition 2007, 10, :o7, 1193522400 + tz.transition 2008, 3, :o8, 1206828000 + tz.transition 2008, 10, :o7, 1224972000 + tz.transition 2009, 3, :o8, 1238277600 + tz.transition 2009, 10, :o7, 1256421600 + tz.transition 2010, 3, :o8, 1269727200 + tz.transition 2010, 10, :o7, 1288476000 + tz.transition 2011, 3, :o8, 1301176800 + tz.transition 2011, 10, :o7, 1319925600 + tz.transition 2012, 3, :o8, 1332626400 + tz.transition 2012, 10, :o7, 1351375200 + tz.transition 2013, 3, :o8, 1364680800 + tz.transition 2013, 10, :o7, 1382824800 + tz.transition 2014, 3, :o8, 1396130400 + tz.transition 2014, 10, :o7, 1414274400 + tz.transition 2015, 3, :o8, 1427580000 + tz.transition 2015, 10, :o7, 1445724000 + tz.transition 2016, 3, :o8, 1459029600 + tz.transition 2016, 10, :o7, 1477778400 + tz.transition 2017, 3, :o8, 1490479200 + tz.transition 2017, 10, :o7, 1509228000 + tz.transition 2018, 3, :o8, 1521928800 + tz.transition 2018, 10, :o7, 1540677600 + tz.transition 2019, 3, :o8, 1553983200 + tz.transition 2019, 10, :o7, 1572127200 + tz.transition 2020, 3, :o8, 1585432800 + tz.transition 2020, 10, :o7, 1603576800 + tz.transition 2021, 3, :o8, 1616882400 + tz.transition 2021, 10, :o7, 1635631200 + tz.transition 2022, 3, :o8, 1648332000 + tz.transition 2022, 10, :o7, 1667080800 + tz.transition 2023, 3, :o8, 1679781600 + tz.transition 2023, 10, :o7, 1698530400 + tz.transition 2024, 3, :o8, 1711836000 + tz.transition 2024, 10, :o7, 1729980000 + tz.transition 2025, 3, :o8, 1743285600 + tz.transition 2025, 10, :o7, 1761429600 + tz.transition 2026, 3, :o8, 1774735200 + tz.transition 2026, 10, :o7, 1792879200 + tz.transition 2027, 3, :o8, 1806184800 + tz.transition 2027, 10, :o7, 1824933600 + tz.transition 2028, 3, :o8, 1837634400 + tz.transition 2028, 10, :o7, 1856383200 + tz.transition 2029, 3, :o8, 1869084000 + tz.transition 2029, 10, :o7, 1887832800 + tz.transition 2030, 3, :o8, 1901138400 + tz.transition 2030, 10, :o7, 1919282400 + tz.transition 2031, 3, :o8, 1932588000 + tz.transition 2031, 10, :o7, 1950732000 + tz.transition 2032, 3, :o8, 1964037600 + tz.transition 2032, 10, :o7, 1982786400 + tz.transition 2033, 3, :o8, 1995487200 + tz.transition 2033, 10, :o7, 2014236000 + tz.transition 2034, 3, :o8, 2026936800 + tz.transition 2034, 10, :o7, 2045685600 + tz.transition 2035, 3, :o8, 2058386400 + tz.transition 2035, 10, :o7, 2077135200 + tz.transition 2036, 3, :o8, 2090440800 + tz.transition 2036, 10, :o7, 2108584800 + tz.transition 2037, 3, :o8, 2121890400 + tz.transition 2037, 10, :o7, 2140034400 + tz.transition 2038, 3, :o8, 29586125, 12 + tz.transition 2038, 10, :o7, 29588729, 12 + tz.transition 2039, 3, :o8, 29590493, 12 + tz.transition 2039, 10, :o7, 29593097, 12 + tz.transition 2040, 3, :o8, 29594861, 12 + tz.transition 2040, 10, :o7, 29597465, 12 + tz.transition 2041, 3, :o8, 29599313, 12 + tz.transition 2041, 10, :o7, 29601833, 12 + tz.transition 2042, 3, :o8, 29603681, 12 + tz.transition 2042, 10, :o7, 29606201, 12 + tz.transition 2043, 3, :o8, 29608049, 12 + tz.transition 2043, 10, :o7, 29610569, 12 + tz.transition 2044, 3, :o8, 29612417, 12 + tz.transition 2044, 10, :o7, 29615021, 12 + tz.transition 2045, 3, :o8, 29616785, 12 + tz.transition 2045, 10, :o7, 29619389, 12 + tz.transition 2046, 3, :o8, 29621153, 12 + tz.transition 2046, 10, :o7, 29623757, 12 + tz.transition 2047, 3, :o8, 29625605, 12 + tz.transition 2047, 10, :o7, 29628125, 12 + tz.transition 2048, 3, :o8, 29629973, 12 + tz.transition 2048, 10, :o7, 29632493, 12 + tz.transition 2049, 3, :o8, 29634341, 12 + tz.transition 2049, 10, :o7, 29636945, 12 + tz.transition 2050, 3, :o8, 29638709, 12 + tz.transition 2050, 10, :o7, 29641313, 12 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb new file mode 100644 index 0000000000..1bd16a75ac --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb @@ -0,0 +1,270 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Atlantic + module Azores + include TimezoneDefinition + + timezone 'Atlantic/Azores' do |tz| + tz.offset :o0, -6160, 0, :LMT + tz.offset :o1, -6872, 0, :HMT + tz.offset :o2, -7200, 0, :AZOT + tz.offset :o3, -7200, 3600, :AZOST + tz.offset :o4, -7200, 7200, :AZOMT + tz.offset :o5, -3600, 0, :AZOT + tz.offset :o6, -3600, 3600, :AZOST + tz.offset :o7, 0, 0, :WET + + tz.transition 1884, 1, :o1, 2601910697, 1080 + tz.transition 1911, 5, :o2, 26127150259, 10800 + tz.transition 1916, 6, :o3, 58104781, 24 + tz.transition 1916, 11, :o2, 29054023, 12 + tz.transition 1917, 3, :o3, 58110925, 24 + tz.transition 1917, 10, :o2, 58116397, 24 + tz.transition 1918, 3, :o3, 58119709, 24 + tz.transition 1918, 10, :o2, 58125157, 24 + tz.transition 1919, 3, :o3, 58128445, 24 + tz.transition 1919, 10, :o2, 58133917, 24 + tz.transition 1920, 3, :o3, 58137229, 24 + tz.transition 1920, 10, :o2, 58142701, 24 + tz.transition 1921, 3, :o3, 58145989, 24 + tz.transition 1921, 10, :o2, 58151461, 24 + tz.transition 1924, 4, :o3, 58173421, 24 + tz.transition 1924, 10, :o2, 58177765, 24 + tz.transition 1926, 4, :o3, 58190965, 24 + tz.transition 1926, 10, :o2, 58194997, 24 + tz.transition 1927, 4, :o3, 58199533, 24 + tz.transition 1927, 10, :o2, 58203733, 24 + tz.transition 1928, 4, :o3, 58208437, 24 + tz.transition 1928, 10, :o2, 58212637, 24 + tz.transition 1929, 4, :o3, 58217341, 24 + tz.transition 1929, 10, :o2, 58221373, 24 + tz.transition 1931, 4, :o3, 58234813, 24 + tz.transition 1931, 10, :o2, 58238845, 24 + tz.transition 1932, 4, :o3, 58243213, 24 + tz.transition 1932, 10, :o2, 58247581, 24 + tz.transition 1934, 4, :o3, 58260853, 24 + tz.transition 1934, 10, :o2, 58265221, 24 + tz.transition 1935, 3, :o3, 58269421, 24 + tz.transition 1935, 10, :o2, 58273957, 24 + tz.transition 1936, 4, :o3, 58278661, 24 + tz.transition 1936, 10, :o2, 58282693, 24 + tz.transition 1937, 4, :o3, 58287061, 24 + tz.transition 1937, 10, :o2, 58291429, 24 + tz.transition 1938, 3, :o3, 58295629, 24 + tz.transition 1938, 10, :o2, 58300165, 24 + tz.transition 1939, 4, :o3, 58304869, 24 + tz.transition 1939, 11, :o2, 58310077, 24 + tz.transition 1940, 2, :o3, 58312429, 24 + tz.transition 1940, 10, :o2, 58317805, 24 + tz.transition 1941, 4, :o3, 58322173, 24 + tz.transition 1941, 10, :o2, 58326565, 24 + tz.transition 1942, 3, :o3, 58330405, 24 + tz.transition 1942, 4, :o4, 4860951, 2 + tz.transition 1942, 8, :o3, 4861175, 2 + tz.transition 1942, 10, :o2, 58335781, 24 + tz.transition 1943, 3, :o3, 58339141, 24 + tz.transition 1943, 4, :o4, 4861665, 2 + tz.transition 1943, 8, :o3, 4861931, 2 + tz.transition 1943, 10, :o2, 58344685, 24 + tz.transition 1944, 3, :o3, 58347877, 24 + tz.transition 1944, 4, :o4, 4862407, 2 + tz.transition 1944, 8, :o3, 4862659, 2 + tz.transition 1944, 10, :o2, 58353421, 24 + tz.transition 1945, 3, :o3, 58356613, 24 + tz.transition 1945, 4, :o4, 4863135, 2 + tz.transition 1945, 8, :o3, 4863387, 2 + tz.transition 1945, 10, :o2, 58362157, 24 + tz.transition 1946, 4, :o3, 58366021, 24 + tz.transition 1946, 10, :o2, 58370389, 24 + tz.transition 1947, 4, :o3, 7296845, 3 + tz.transition 1947, 10, :o2, 7297391, 3 + tz.transition 1948, 4, :o3, 7297937, 3 + tz.transition 1948, 10, :o2, 7298483, 3 + tz.transition 1949, 4, :o3, 7299029, 3 + tz.transition 1949, 10, :o2, 7299575, 3 + tz.transition 1951, 4, :o3, 7301213, 3 + tz.transition 1951, 10, :o2, 7301780, 3 + tz.transition 1952, 4, :o3, 7302326, 3 + tz.transition 1952, 10, :o2, 7302872, 3 + tz.transition 1953, 4, :o3, 7303418, 3 + tz.transition 1953, 10, :o2, 7303964, 3 + tz.transition 1954, 4, :o3, 7304510, 3 + tz.transition 1954, 10, :o2, 7305056, 3 + tz.transition 1955, 4, :o3, 7305602, 3 + tz.transition 1955, 10, :o2, 7306148, 3 + tz.transition 1956, 4, :o3, 7306694, 3 + tz.transition 1956, 10, :o2, 7307261, 3 + tz.transition 1957, 4, :o3, 7307807, 3 + tz.transition 1957, 10, :o2, 7308353, 3 + tz.transition 1958, 4, :o3, 7308899, 3 + tz.transition 1958, 10, :o2, 7309445, 3 + tz.transition 1959, 4, :o3, 7309991, 3 + tz.transition 1959, 10, :o2, 7310537, 3 + tz.transition 1960, 4, :o3, 7311083, 3 + tz.transition 1960, 10, :o2, 7311629, 3 + tz.transition 1961, 4, :o3, 7312175, 3 + tz.transition 1961, 10, :o2, 7312721, 3 + tz.transition 1962, 4, :o3, 7313267, 3 + tz.transition 1962, 10, :o2, 7313834, 3 + tz.transition 1963, 4, :o3, 7314380, 3 + tz.transition 1963, 10, :o2, 7314926, 3 + tz.transition 1964, 4, :o3, 7315472, 3 + tz.transition 1964, 10, :o2, 7316018, 3 + tz.transition 1965, 4, :o3, 7316564, 3 + tz.transition 1965, 10, :o2, 7317110, 3 + tz.transition 1966, 4, :o5, 7317656, 3 + tz.transition 1977, 3, :o6, 228272400 + tz.transition 1977, 9, :o5, 243997200 + tz.transition 1978, 4, :o6, 260326800 + tz.transition 1978, 10, :o5, 276051600 + tz.transition 1979, 4, :o6, 291776400 + tz.transition 1979, 9, :o5, 307504800 + tz.transition 1980, 3, :o6, 323226000 + tz.transition 1980, 9, :o5, 338954400 + tz.transition 1981, 3, :o6, 354679200 + tz.transition 1981, 9, :o5, 370404000 + tz.transition 1982, 3, :o6, 386128800 + tz.transition 1982, 9, :o5, 401853600 + tz.transition 1983, 3, :o6, 417582000 + tz.transition 1983, 9, :o5, 433303200 + tz.transition 1984, 3, :o6, 449028000 + tz.transition 1984, 9, :o5, 465357600 + tz.transition 1985, 3, :o6, 481082400 + tz.transition 1985, 9, :o5, 496807200 + tz.transition 1986, 3, :o6, 512532000 + tz.transition 1986, 9, :o5, 528256800 + tz.transition 1987, 3, :o6, 543981600 + tz.transition 1987, 9, :o5, 559706400 + tz.transition 1988, 3, :o6, 575431200 + tz.transition 1988, 9, :o5, 591156000 + tz.transition 1989, 3, :o6, 606880800 + tz.transition 1989, 9, :o5, 622605600 + tz.transition 1990, 3, :o6, 638330400 + tz.transition 1990, 9, :o5, 654660000 + tz.transition 1991, 3, :o6, 670384800 + tz.transition 1991, 9, :o5, 686109600 + tz.transition 1992, 3, :o6, 701834400 + tz.transition 1992, 9, :o7, 717559200 + tz.transition 1993, 3, :o6, 733280400 + tz.transition 1993, 9, :o5, 749005200 + tz.transition 1994, 3, :o6, 764730000 + tz.transition 1994, 9, :o5, 780454800 + tz.transition 1995, 3, :o6, 796179600 + tz.transition 1995, 9, :o5, 811904400 + tz.transition 1996, 3, :o6, 828234000 + tz.transition 1996, 10, :o5, 846378000 + tz.transition 1997, 3, :o6, 859683600 + tz.transition 1997, 10, :o5, 877827600 + tz.transition 1998, 3, :o6, 891133200 + tz.transition 1998, 10, :o5, 909277200 + tz.transition 1999, 3, :o6, 922582800 + tz.transition 1999, 10, :o5, 941331600 + tz.transition 2000, 3, :o6, 954032400 + tz.transition 2000, 10, :o5, 972781200 + tz.transition 2001, 3, :o6, 985482000 + tz.transition 2001, 10, :o5, 1004230800 + tz.transition 2002, 3, :o6, 1017536400 + tz.transition 2002, 10, :o5, 1035680400 + tz.transition 2003, 3, :o6, 1048986000 + tz.transition 2003, 10, :o5, 1067130000 + tz.transition 2004, 3, :o6, 1080435600 + tz.transition 2004, 10, :o5, 1099184400 + tz.transition 2005, 3, :o6, 1111885200 + tz.transition 2005, 10, :o5, 1130634000 + tz.transition 2006, 3, :o6, 1143334800 + tz.transition 2006, 10, :o5, 1162083600 + tz.transition 2007, 3, :o6, 1174784400 + tz.transition 2007, 10, :o5, 1193533200 + tz.transition 2008, 3, :o6, 1206838800 + tz.transition 2008, 10, :o5, 1224982800 + tz.transition 2009, 3, :o6, 1238288400 + tz.transition 2009, 10, :o5, 1256432400 + tz.transition 2010, 3, :o6, 1269738000 + tz.transition 2010, 10, :o5, 1288486800 + tz.transition 2011, 3, :o6, 1301187600 + tz.transition 2011, 10, :o5, 1319936400 + tz.transition 2012, 3, :o6, 1332637200 + tz.transition 2012, 10, :o5, 1351386000 + tz.transition 2013, 3, :o6, 1364691600 + tz.transition 2013, 10, :o5, 1382835600 + tz.transition 2014, 3, :o6, 1396141200 + tz.transition 2014, 10, :o5, 1414285200 + tz.transition 2015, 3, :o6, 1427590800 + tz.transition 2015, 10, :o5, 1445734800 + tz.transition 2016, 3, :o6, 1459040400 + tz.transition 2016, 10, :o5, 1477789200 + tz.transition 2017, 3, :o6, 1490490000 + tz.transition 2017, 10, :o5, 1509238800 + tz.transition 2018, 3, :o6, 1521939600 + tz.transition 2018, 10, :o5, 1540688400 + tz.transition 2019, 3, :o6, 1553994000 + tz.transition 2019, 10, :o5, 1572138000 + tz.transition 2020, 3, :o6, 1585443600 + tz.transition 2020, 10, :o5, 1603587600 + tz.transition 2021, 3, :o6, 1616893200 + tz.transition 2021, 10, :o5, 1635642000 + tz.transition 2022, 3, :o6, 1648342800 + tz.transition 2022, 10, :o5, 1667091600 + tz.transition 2023, 3, :o6, 1679792400 + tz.transition 2023, 10, :o5, 1698541200 + tz.transition 2024, 3, :o6, 1711846800 + tz.transition 2024, 10, :o5, 1729990800 + tz.transition 2025, 3, :o6, 1743296400 + tz.transition 2025, 10, :o5, 1761440400 + tz.transition 2026, 3, :o6, 1774746000 + tz.transition 2026, 10, :o5, 1792890000 + tz.transition 2027, 3, :o6, 1806195600 + tz.transition 2027, 10, :o5, 1824944400 + tz.transition 2028, 3, :o6, 1837645200 + tz.transition 2028, 10, :o5, 1856394000 + tz.transition 2029, 3, :o6, 1869094800 + tz.transition 2029, 10, :o5, 1887843600 + tz.transition 2030, 3, :o6, 1901149200 + tz.transition 2030, 10, :o5, 1919293200 + tz.transition 2031, 3, :o6, 1932598800 + tz.transition 2031, 10, :o5, 1950742800 + tz.transition 2032, 3, :o6, 1964048400 + tz.transition 2032, 10, :o5, 1982797200 + tz.transition 2033, 3, :o6, 1995498000 + tz.transition 2033, 10, :o5, 2014246800 + tz.transition 2034, 3, :o6, 2026947600 + tz.transition 2034, 10, :o5, 2045696400 + tz.transition 2035, 3, :o6, 2058397200 + tz.transition 2035, 10, :o5, 2077146000 + tz.transition 2036, 3, :o6, 2090451600 + tz.transition 2036, 10, :o5, 2108595600 + tz.transition 2037, 3, :o6, 2121901200 + tz.transition 2037, 10, :o5, 2140045200 + tz.transition 2038, 3, :o6, 59172253, 24 + tz.transition 2038, 10, :o5, 59177461, 24 + tz.transition 2039, 3, :o6, 59180989, 24 + tz.transition 2039, 10, :o5, 59186197, 24 + tz.transition 2040, 3, :o6, 59189725, 24 + tz.transition 2040, 10, :o5, 59194933, 24 + tz.transition 2041, 3, :o6, 59198629, 24 + tz.transition 2041, 10, :o5, 59203669, 24 + tz.transition 2042, 3, :o6, 59207365, 24 + tz.transition 2042, 10, :o5, 59212405, 24 + tz.transition 2043, 3, :o6, 59216101, 24 + tz.transition 2043, 10, :o5, 59221141, 24 + tz.transition 2044, 3, :o6, 59224837, 24 + tz.transition 2044, 10, :o5, 59230045, 24 + tz.transition 2045, 3, :o6, 59233573, 24 + tz.transition 2045, 10, :o5, 59238781, 24 + tz.transition 2046, 3, :o6, 59242309, 24 + tz.transition 2046, 10, :o5, 59247517, 24 + tz.transition 2047, 3, :o6, 59251213, 24 + tz.transition 2047, 10, :o5, 59256253, 24 + tz.transition 2048, 3, :o6, 59259949, 24 + tz.transition 2048, 10, :o5, 59264989, 24 + tz.transition 2049, 3, :o6, 59268685, 24 + tz.transition 2049, 10, :o5, 59273893, 24 + tz.transition 2050, 3, :o6, 59277421, 24 + tz.transition 2050, 10, :o5, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb new file mode 100644 index 0000000000..61c8c15043 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb @@ -0,0 +1,23 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Atlantic + module Cape_Verde + include TimezoneDefinition + + timezone 'Atlantic/Cape_Verde' do |tz| + tz.offset :o0, -5644, 0, :LMT + tz.offset :o1, -7200, 0, :CVT + tz.offset :o2, -7200, 3600, :CVST + tz.offset :o3, -3600, 0, :CVT + + tz.transition 1907, 1, :o1, 52219653811, 21600 + tz.transition 1942, 9, :o2, 29167243, 12 + tz.transition 1945, 10, :o1, 58361845, 24 + tz.transition 1975, 11, :o3, 186120000 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb new file mode 100644 index 0000000000..6a4cbafb9f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb @@ -0,0 +1,18 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Atlantic + module South_Georgia + include TimezoneDefinition + + timezone 'Atlantic/South_Georgia' do |tz| + tz.offset :o0, -8768, 0, :LMT + tz.offset :o1, -7200, 0, :GST + + tz.transition 1890, 1, :o1, 1627673806, 675 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb new file mode 100644 index 0000000000..c5d561cc1e --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb @@ -0,0 +1,187 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Adelaide + include TimezoneDefinition + + timezone 'Australia/Adelaide' do |tz| + tz.offset :o0, 33260, 0, :LMT + tz.offset :o1, 32400, 0, :CST + tz.offset :o2, 34200, 0, :CST + tz.offset :o3, 34200, 3600, :CST + + tz.transition 1895, 1, :o1, 10425132497, 4320 + tz.transition 1899, 4, :o2, 19318201, 8 + tz.transition 1916, 12, :o3, 3486569911, 1440 + tz.transition 1917, 3, :o2, 116222983, 48 + tz.transition 1941, 12, :o3, 38885763, 16 + tz.transition 1942, 3, :o2, 116661463, 48 + tz.transition 1942, 9, :o3, 38890067, 16 + tz.transition 1943, 3, :o2, 116678935, 48 + tz.transition 1943, 10, :o3, 38896003, 16 + tz.transition 1944, 3, :o2, 116696407, 48 + tz.transition 1971, 10, :o3, 57688200 + tz.transition 1972, 2, :o2, 67969800 + tz.transition 1972, 10, :o3, 89137800 + tz.transition 1973, 3, :o2, 100024200 + tz.transition 1973, 10, :o3, 120587400 + tz.transition 1974, 3, :o2, 131473800 + tz.transition 1974, 10, :o3, 152037000 + tz.transition 1975, 3, :o2, 162923400 + tz.transition 1975, 10, :o3, 183486600 + tz.transition 1976, 3, :o2, 194977800 + tz.transition 1976, 10, :o3, 215541000 + tz.transition 1977, 3, :o2, 226427400 + tz.transition 1977, 10, :o3, 246990600 + tz.transition 1978, 3, :o2, 257877000 + tz.transition 1978, 10, :o3, 278440200 + tz.transition 1979, 3, :o2, 289326600 + tz.transition 1979, 10, :o3, 309889800 + tz.transition 1980, 3, :o2, 320776200 + tz.transition 1980, 10, :o3, 341339400 + tz.transition 1981, 2, :o2, 352225800 + tz.transition 1981, 10, :o3, 372789000 + tz.transition 1982, 3, :o2, 384280200 + tz.transition 1982, 10, :o3, 404843400 + tz.transition 1983, 3, :o2, 415729800 + tz.transition 1983, 10, :o3, 436293000 + tz.transition 1984, 3, :o2, 447179400 + tz.transition 1984, 10, :o3, 467742600 + tz.transition 1985, 3, :o2, 478629000 + tz.transition 1985, 10, :o3, 499192200 + tz.transition 1986, 3, :o2, 511288200 + tz.transition 1986, 10, :o3, 530037000 + tz.transition 1987, 3, :o2, 542737800 + tz.transition 1987, 10, :o3, 562091400 + tz.transition 1988, 3, :o2, 574792200 + tz.transition 1988, 10, :o3, 594145800 + tz.transition 1989, 3, :o2, 606241800 + tz.transition 1989, 10, :o3, 625595400 + tz.transition 1990, 3, :o2, 637691400 + tz.transition 1990, 10, :o3, 657045000 + tz.transition 1991, 3, :o2, 667931400 + tz.transition 1991, 10, :o3, 688494600 + tz.transition 1992, 3, :o2, 701195400 + tz.transition 1992, 10, :o3, 719944200 + tz.transition 1993, 3, :o2, 731435400 + tz.transition 1993, 10, :o3, 751998600 + tz.transition 1994, 3, :o2, 764094600 + tz.transition 1994, 10, :o3, 783448200 + tz.transition 1995, 3, :o2, 796149000 + tz.transition 1995, 10, :o3, 814897800 + tz.transition 1996, 3, :o2, 828203400 + tz.transition 1996, 10, :o3, 846347400 + tz.transition 1997, 3, :o2, 859653000 + tz.transition 1997, 10, :o3, 877797000 + tz.transition 1998, 3, :o2, 891102600 + tz.transition 1998, 10, :o3, 909246600 + tz.transition 1999, 3, :o2, 922552200 + tz.transition 1999, 10, :o3, 941301000 + tz.transition 2000, 3, :o2, 954001800 + tz.transition 2000, 10, :o3, 972750600 + tz.transition 2001, 3, :o2, 985451400 + tz.transition 2001, 10, :o3, 1004200200 + tz.transition 2002, 3, :o2, 1017505800 + tz.transition 2002, 10, :o3, 1035649800 + tz.transition 2003, 3, :o2, 1048955400 + tz.transition 2003, 10, :o3, 1067099400 + tz.transition 2004, 3, :o2, 1080405000 + tz.transition 2004, 10, :o3, 1099153800 + tz.transition 2005, 3, :o2, 1111854600 + tz.transition 2005, 10, :o3, 1130603400 + tz.transition 2006, 4, :o2, 1143909000 + tz.transition 2006, 10, :o3, 1162053000 + tz.transition 2007, 3, :o2, 1174753800 + tz.transition 2007, 10, :o3, 1193502600 + tz.transition 2008, 4, :o2, 1207413000 + tz.transition 2008, 10, :o3, 1223137800 + tz.transition 2009, 4, :o2, 1238862600 + tz.transition 2009, 10, :o3, 1254587400 + tz.transition 2010, 4, :o2, 1270312200 + tz.transition 2010, 10, :o3, 1286037000 + tz.transition 2011, 4, :o2, 1301761800 + tz.transition 2011, 10, :o3, 1317486600 + tz.transition 2012, 3, :o2, 1333211400 + tz.transition 2012, 10, :o3, 1349541000 + tz.transition 2013, 4, :o2, 1365265800 + tz.transition 2013, 10, :o3, 1380990600 + tz.transition 2014, 4, :o2, 1396715400 + tz.transition 2014, 10, :o3, 1412440200 + tz.transition 2015, 4, :o2, 1428165000 + tz.transition 2015, 10, :o3, 1443889800 + tz.transition 2016, 4, :o2, 1459614600 + tz.transition 2016, 10, :o3, 1475339400 + tz.transition 2017, 4, :o2, 1491064200 + tz.transition 2017, 9, :o3, 1506789000 + tz.transition 2018, 3, :o2, 1522513800 + tz.transition 2018, 10, :o3, 1538843400 + tz.transition 2019, 4, :o2, 1554568200 + tz.transition 2019, 10, :o3, 1570293000 + tz.transition 2020, 4, :o2, 1586017800 + tz.transition 2020, 10, :o3, 1601742600 + tz.transition 2021, 4, :o2, 1617467400 + tz.transition 2021, 10, :o3, 1633192200 + tz.transition 2022, 4, :o2, 1648917000 + tz.transition 2022, 10, :o3, 1664641800 + tz.transition 2023, 4, :o2, 1680366600 + tz.transition 2023, 9, :o3, 1696091400 + tz.transition 2024, 4, :o2, 1712421000 + tz.transition 2024, 10, :o3, 1728145800 + tz.transition 2025, 4, :o2, 1743870600 + tz.transition 2025, 10, :o3, 1759595400 + tz.transition 2026, 4, :o2, 1775320200 + tz.transition 2026, 10, :o3, 1791045000 + tz.transition 2027, 4, :o2, 1806769800 + tz.transition 2027, 10, :o3, 1822494600 + tz.transition 2028, 4, :o2, 1838219400 + tz.transition 2028, 9, :o3, 1853944200 + tz.transition 2029, 3, :o2, 1869669000 + tz.transition 2029, 10, :o3, 1885998600 + tz.transition 2030, 4, :o2, 1901723400 + tz.transition 2030, 10, :o3, 1917448200 + tz.transition 2031, 4, :o2, 1933173000 + tz.transition 2031, 10, :o3, 1948897800 + tz.transition 2032, 4, :o2, 1964622600 + tz.transition 2032, 10, :o3, 1980347400 + tz.transition 2033, 4, :o2, 1996072200 + tz.transition 2033, 10, :o3, 2011797000 + tz.transition 2034, 4, :o2, 2027521800 + tz.transition 2034, 9, :o3, 2043246600 + tz.transition 2035, 3, :o2, 2058971400 + tz.transition 2035, 10, :o3, 2075301000 + tz.transition 2036, 4, :o2, 2091025800 + tz.transition 2036, 10, :o3, 2106750600 + tz.transition 2037, 4, :o2, 2122475400 + tz.transition 2037, 10, :o3, 2138200200 + tz.transition 2038, 4, :o2, 39448275, 16 + tz.transition 2038, 10, :o3, 39451187, 16 + tz.transition 2039, 4, :o2, 39454099, 16 + tz.transition 2039, 10, :o3, 39457011, 16 + tz.transition 2040, 3, :o2, 39459923, 16 + tz.transition 2040, 10, :o3, 39462947, 16 + tz.transition 2041, 4, :o2, 39465859, 16 + tz.transition 2041, 10, :o3, 39468771, 16 + tz.transition 2042, 4, :o2, 39471683, 16 + tz.transition 2042, 10, :o3, 39474595, 16 + tz.transition 2043, 4, :o2, 39477507, 16 + tz.transition 2043, 10, :o3, 39480419, 16 + tz.transition 2044, 4, :o2, 39483331, 16 + tz.transition 2044, 10, :o3, 39486243, 16 + tz.transition 2045, 4, :o2, 39489155, 16 + tz.transition 2045, 9, :o3, 39492067, 16 + tz.transition 2046, 3, :o2, 39494979, 16 + tz.transition 2046, 10, :o3, 39498003, 16 + tz.transition 2047, 4, :o2, 39500915, 16 + tz.transition 2047, 10, :o3, 39503827, 16 + tz.transition 2048, 4, :o2, 39506739, 16 + tz.transition 2048, 10, :o3, 39509651, 16 + tz.transition 2049, 4, :o2, 39512563, 16 + tz.transition 2049, 10, :o3, 39515475, 16 + tz.transition 2050, 4, :o2, 39518387, 16 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb new file mode 100644 index 0000000000..dd85ddae94 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb @@ -0,0 +1,35 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Brisbane + include TimezoneDefinition + + timezone 'Australia/Brisbane' do |tz| + tz.offset :o0, 36728, 0, :LMT + tz.offset :o1, 36000, 0, :EST + tz.offset :o2, 36000, 3600, :EST + + tz.transition 1894, 12, :o1, 26062496009, 10800 + tz.transition 1916, 12, :o2, 3486569881, 1440 + tz.transition 1917, 3, :o1, 19370497, 8 + tz.transition 1941, 12, :o2, 14582161, 6 + tz.transition 1942, 3, :o1, 19443577, 8 + tz.transition 1942, 9, :o2, 14583775, 6 + tz.transition 1943, 3, :o1, 19446489, 8 + tz.transition 1943, 10, :o2, 14586001, 6 + tz.transition 1944, 3, :o1, 19449401, 8 + tz.transition 1971, 10, :o2, 57686400 + tz.transition 1972, 2, :o1, 67968000 + tz.transition 1989, 10, :o2, 625593600 + tz.transition 1990, 3, :o1, 636480000 + tz.transition 1990, 10, :o2, 657043200 + tz.transition 1991, 3, :o1, 667929600 + tz.transition 1991, 10, :o2, 688492800 + tz.transition 1992, 2, :o1, 699379200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb new file mode 100644 index 0000000000..17de88124d --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb @@ -0,0 +1,29 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Darwin + include TimezoneDefinition + + timezone 'Australia/Darwin' do |tz| + tz.offset :o0, 31400, 0, :LMT + tz.offset :o1, 32400, 0, :CST + tz.offset :o2, 34200, 0, :CST + tz.offset :o3, 34200, 3600, :CST + + tz.transition 1895, 1, :o1, 1042513259, 432 + tz.transition 1899, 4, :o2, 19318201, 8 + tz.transition 1916, 12, :o3, 3486569911, 1440 + tz.transition 1917, 3, :o2, 116222983, 48 + tz.transition 1941, 12, :o3, 38885763, 16 + tz.transition 1942, 3, :o2, 116661463, 48 + tz.transition 1942, 9, :o3, 38890067, 16 + tz.transition 1943, 3, :o2, 116678935, 48 + tz.transition 1943, 10, :o3, 38896003, 16 + tz.transition 1944, 3, :o2, 116696407, 48 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb new file mode 100644 index 0000000000..11384b9840 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb @@ -0,0 +1,193 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Hobart + include TimezoneDefinition + + timezone 'Australia/Hobart' do |tz| + tz.offset :o0, 35356, 0, :LMT + tz.offset :o1, 36000, 0, :EST + tz.offset :o2, 36000, 3600, :EST + + tz.transition 1895, 8, :o1, 52130241161, 21600 + tz.transition 1916, 9, :o2, 14526823, 6 + tz.transition 1917, 3, :o1, 19370497, 8 + tz.transition 1941, 12, :o2, 14582161, 6 + tz.transition 1942, 3, :o1, 19443577, 8 + tz.transition 1942, 9, :o2, 14583775, 6 + tz.transition 1943, 3, :o1, 19446489, 8 + tz.transition 1943, 10, :o2, 14586001, 6 + tz.transition 1944, 3, :o1, 19449401, 8 + tz.transition 1967, 9, :o2, 14638585, 6 + tz.transition 1968, 3, :o1, 14639677, 6 + tz.transition 1968, 10, :o2, 14640937, 6 + tz.transition 1969, 3, :o1, 14641735, 6 + tz.transition 1969, 10, :o2, 14643121, 6 + tz.transition 1970, 3, :o1, 5673600 + tz.transition 1970, 10, :o2, 25632000 + tz.transition 1971, 3, :o1, 37728000 + tz.transition 1971, 10, :o2, 57686400 + tz.transition 1972, 2, :o1, 67968000 + tz.transition 1972, 10, :o2, 89136000 + tz.transition 1973, 3, :o1, 100022400 + tz.transition 1973, 10, :o2, 120585600 + tz.transition 1974, 3, :o1, 131472000 + tz.transition 1974, 10, :o2, 152035200 + tz.transition 1975, 3, :o1, 162921600 + tz.transition 1975, 10, :o2, 183484800 + tz.transition 1976, 3, :o1, 194976000 + tz.transition 1976, 10, :o2, 215539200 + tz.transition 1977, 3, :o1, 226425600 + tz.transition 1977, 10, :o2, 246988800 + tz.transition 1978, 3, :o1, 257875200 + tz.transition 1978, 10, :o2, 278438400 + tz.transition 1979, 3, :o1, 289324800 + tz.transition 1979, 10, :o2, 309888000 + tz.transition 1980, 3, :o1, 320774400 + tz.transition 1980, 10, :o2, 341337600 + tz.transition 1981, 2, :o1, 352224000 + tz.transition 1981, 10, :o2, 372787200 + tz.transition 1982, 3, :o1, 386092800 + tz.transition 1982, 10, :o2, 404841600 + tz.transition 1983, 3, :o1, 417542400 + tz.transition 1983, 10, :o2, 436291200 + tz.transition 1984, 3, :o1, 447177600 + tz.transition 1984, 10, :o2, 467740800 + tz.transition 1985, 3, :o1, 478627200 + tz.transition 1985, 10, :o2, 499190400 + tz.transition 1986, 3, :o1, 510076800 + tz.transition 1986, 10, :o2, 530035200 + tz.transition 1987, 3, :o1, 542736000 + tz.transition 1987, 10, :o2, 562089600 + tz.transition 1988, 3, :o1, 574790400 + tz.transition 1988, 10, :o2, 594144000 + tz.transition 1989, 3, :o1, 606240000 + tz.transition 1989, 10, :o2, 625593600 + tz.transition 1990, 3, :o1, 637689600 + tz.transition 1990, 10, :o2, 657043200 + tz.transition 1991, 3, :o1, 670348800 + tz.transition 1991, 10, :o2, 686678400 + tz.transition 1992, 3, :o1, 701798400 + tz.transition 1992, 10, :o2, 718128000 + tz.transition 1993, 3, :o1, 733248000 + tz.transition 1993, 10, :o2, 749577600 + tz.transition 1994, 3, :o1, 764697600 + tz.transition 1994, 10, :o2, 781027200 + tz.transition 1995, 3, :o1, 796147200 + tz.transition 1995, 9, :o2, 812476800 + tz.transition 1996, 3, :o1, 828201600 + tz.transition 1996, 10, :o2, 844531200 + tz.transition 1997, 3, :o1, 859651200 + tz.transition 1997, 10, :o2, 875980800 + tz.transition 1998, 3, :o1, 891100800 + tz.transition 1998, 10, :o2, 907430400 + tz.transition 1999, 3, :o1, 922550400 + tz.transition 1999, 10, :o2, 938880000 + tz.transition 2000, 3, :o1, 954000000 + tz.transition 2000, 8, :o2, 967305600 + tz.transition 2001, 3, :o1, 985449600 + tz.transition 2001, 10, :o2, 1002384000 + tz.transition 2002, 3, :o1, 1017504000 + tz.transition 2002, 10, :o2, 1033833600 + tz.transition 2003, 3, :o1, 1048953600 + tz.transition 2003, 10, :o2, 1065283200 + tz.transition 2004, 3, :o1, 1080403200 + tz.transition 2004, 10, :o2, 1096732800 + tz.transition 2005, 3, :o1, 1111852800 + tz.transition 2005, 10, :o2, 1128182400 + tz.transition 2006, 4, :o1, 1143907200 + tz.transition 2006, 9, :o2, 1159632000 + tz.transition 2007, 3, :o1, 1174752000 + tz.transition 2007, 10, :o2, 1191686400 + tz.transition 2008, 4, :o1, 1207411200 + tz.transition 2008, 10, :o2, 1223136000 + tz.transition 2009, 4, :o1, 1238860800 + tz.transition 2009, 10, :o2, 1254585600 + tz.transition 2010, 4, :o1, 1270310400 + tz.transition 2010, 10, :o2, 1286035200 + tz.transition 2011, 4, :o1, 1301760000 + tz.transition 2011, 10, :o2, 1317484800 + tz.transition 2012, 3, :o1, 1333209600 + tz.transition 2012, 10, :o2, 1349539200 + tz.transition 2013, 4, :o1, 1365264000 + tz.transition 2013, 10, :o2, 1380988800 + tz.transition 2014, 4, :o1, 1396713600 + tz.transition 2014, 10, :o2, 1412438400 + tz.transition 2015, 4, :o1, 1428163200 + tz.transition 2015, 10, :o2, 1443888000 + tz.transition 2016, 4, :o1, 1459612800 + tz.transition 2016, 10, :o2, 1475337600 + tz.transition 2017, 4, :o1, 1491062400 + tz.transition 2017, 9, :o2, 1506787200 + tz.transition 2018, 3, :o1, 1522512000 + tz.transition 2018, 10, :o2, 1538841600 + tz.transition 2019, 4, :o1, 1554566400 + tz.transition 2019, 10, :o2, 1570291200 + tz.transition 2020, 4, :o1, 1586016000 + tz.transition 2020, 10, :o2, 1601740800 + tz.transition 2021, 4, :o1, 1617465600 + tz.transition 2021, 10, :o2, 1633190400 + tz.transition 2022, 4, :o1, 1648915200 + tz.transition 2022, 10, :o2, 1664640000 + tz.transition 2023, 4, :o1, 1680364800 + tz.transition 2023, 9, :o2, 1696089600 + tz.transition 2024, 4, :o1, 1712419200 + tz.transition 2024, 10, :o2, 1728144000 + tz.transition 2025, 4, :o1, 1743868800 + tz.transition 2025, 10, :o2, 1759593600 + tz.transition 2026, 4, :o1, 1775318400 + tz.transition 2026, 10, :o2, 1791043200 + tz.transition 2027, 4, :o1, 1806768000 + tz.transition 2027, 10, :o2, 1822492800 + tz.transition 2028, 4, :o1, 1838217600 + tz.transition 2028, 9, :o2, 1853942400 + tz.transition 2029, 3, :o1, 1869667200 + tz.transition 2029, 10, :o2, 1885996800 + tz.transition 2030, 4, :o1, 1901721600 + tz.transition 2030, 10, :o2, 1917446400 + tz.transition 2031, 4, :o1, 1933171200 + tz.transition 2031, 10, :o2, 1948896000 + tz.transition 2032, 4, :o1, 1964620800 + tz.transition 2032, 10, :o2, 1980345600 + tz.transition 2033, 4, :o1, 1996070400 + tz.transition 2033, 10, :o2, 2011795200 + tz.transition 2034, 4, :o1, 2027520000 + tz.transition 2034, 9, :o2, 2043244800 + tz.transition 2035, 3, :o1, 2058969600 + tz.transition 2035, 10, :o2, 2075299200 + tz.transition 2036, 4, :o1, 2091024000 + tz.transition 2036, 10, :o2, 2106748800 + tz.transition 2037, 4, :o1, 2122473600 + tz.transition 2037, 10, :o2, 2138198400 + tz.transition 2038, 4, :o1, 14793103, 6 + tz.transition 2038, 10, :o2, 14794195, 6 + tz.transition 2039, 4, :o1, 14795287, 6 + tz.transition 2039, 10, :o2, 14796379, 6 + tz.transition 2040, 3, :o1, 14797471, 6 + tz.transition 2040, 10, :o2, 14798605, 6 + tz.transition 2041, 4, :o1, 14799697, 6 + tz.transition 2041, 10, :o2, 14800789, 6 + tz.transition 2042, 4, :o1, 14801881, 6 + tz.transition 2042, 10, :o2, 14802973, 6 + tz.transition 2043, 4, :o1, 14804065, 6 + tz.transition 2043, 10, :o2, 14805157, 6 + tz.transition 2044, 4, :o1, 14806249, 6 + tz.transition 2044, 10, :o2, 14807341, 6 + tz.transition 2045, 4, :o1, 14808433, 6 + tz.transition 2045, 9, :o2, 14809525, 6 + tz.transition 2046, 3, :o1, 14810617, 6 + tz.transition 2046, 10, :o2, 14811751, 6 + tz.transition 2047, 4, :o1, 14812843, 6 + tz.transition 2047, 10, :o2, 14813935, 6 + tz.transition 2048, 4, :o1, 14815027, 6 + tz.transition 2048, 10, :o2, 14816119, 6 + tz.transition 2049, 4, :o1, 14817211, 6 + tz.transition 2049, 10, :o2, 14818303, 6 + tz.transition 2050, 4, :o1, 14819395, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb new file mode 100644 index 0000000000..c1304488ea --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb @@ -0,0 +1,185 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Melbourne + include TimezoneDefinition + + timezone 'Australia/Melbourne' do |tz| + tz.offset :o0, 34792, 0, :LMT + tz.offset :o1, 36000, 0, :EST + tz.offset :o2, 36000, 3600, :EST + + tz.transition 1895, 1, :o1, 26062831051, 10800 + tz.transition 1916, 12, :o2, 3486569881, 1440 + tz.transition 1917, 3, :o1, 19370497, 8 + tz.transition 1941, 12, :o2, 14582161, 6 + tz.transition 1942, 3, :o1, 19443577, 8 + tz.transition 1942, 9, :o2, 14583775, 6 + tz.transition 1943, 3, :o1, 19446489, 8 + tz.transition 1943, 10, :o2, 14586001, 6 + tz.transition 1944, 3, :o1, 19449401, 8 + tz.transition 1971, 10, :o2, 57686400 + tz.transition 1972, 2, :o1, 67968000 + tz.transition 1972, 10, :o2, 89136000 + tz.transition 1973, 3, :o1, 100022400 + tz.transition 1973, 10, :o2, 120585600 + tz.transition 1974, 3, :o1, 131472000 + tz.transition 1974, 10, :o2, 152035200 + tz.transition 1975, 3, :o1, 162921600 + tz.transition 1975, 10, :o2, 183484800 + tz.transition 1976, 3, :o1, 194976000 + tz.transition 1976, 10, :o2, 215539200 + tz.transition 1977, 3, :o1, 226425600 + tz.transition 1977, 10, :o2, 246988800 + tz.transition 1978, 3, :o1, 257875200 + tz.transition 1978, 10, :o2, 278438400 + tz.transition 1979, 3, :o1, 289324800 + tz.transition 1979, 10, :o2, 309888000 + tz.transition 1980, 3, :o1, 320774400 + tz.transition 1980, 10, :o2, 341337600 + tz.transition 1981, 2, :o1, 352224000 + tz.transition 1981, 10, :o2, 372787200 + tz.transition 1982, 3, :o1, 384278400 + tz.transition 1982, 10, :o2, 404841600 + tz.transition 1983, 3, :o1, 415728000 + tz.transition 1983, 10, :o2, 436291200 + tz.transition 1984, 3, :o1, 447177600 + tz.transition 1984, 10, :o2, 467740800 + tz.transition 1985, 3, :o1, 478627200 + tz.transition 1985, 10, :o2, 499190400 + tz.transition 1986, 3, :o1, 511286400 + tz.transition 1986, 10, :o2, 530035200 + tz.transition 1987, 3, :o1, 542736000 + tz.transition 1987, 10, :o2, 561484800 + tz.transition 1988, 3, :o1, 574790400 + tz.transition 1988, 10, :o2, 594144000 + tz.transition 1989, 3, :o1, 606240000 + tz.transition 1989, 10, :o2, 625593600 + tz.transition 1990, 3, :o1, 637689600 + tz.transition 1990, 10, :o2, 657043200 + tz.transition 1991, 3, :o1, 667929600 + tz.transition 1991, 10, :o2, 688492800 + tz.transition 1992, 2, :o1, 699379200 + tz.transition 1992, 10, :o2, 719942400 + tz.transition 1993, 3, :o1, 731433600 + tz.transition 1993, 10, :o2, 751996800 + tz.transition 1994, 3, :o1, 762883200 + tz.transition 1994, 10, :o2, 783446400 + tz.transition 1995, 3, :o1, 796147200 + tz.transition 1995, 10, :o2, 814896000 + tz.transition 1996, 3, :o1, 828201600 + tz.transition 1996, 10, :o2, 846345600 + tz.transition 1997, 3, :o1, 859651200 + tz.transition 1997, 10, :o2, 877795200 + tz.transition 1998, 3, :o1, 891100800 + tz.transition 1998, 10, :o2, 909244800 + tz.transition 1999, 3, :o1, 922550400 + tz.transition 1999, 10, :o2, 941299200 + tz.transition 2000, 3, :o1, 954000000 + tz.transition 2000, 8, :o2, 967305600 + tz.transition 2001, 3, :o1, 985449600 + tz.transition 2001, 10, :o2, 1004198400 + tz.transition 2002, 3, :o1, 1017504000 + tz.transition 2002, 10, :o2, 1035648000 + tz.transition 2003, 3, :o1, 1048953600 + tz.transition 2003, 10, :o2, 1067097600 + tz.transition 2004, 3, :o1, 1080403200 + tz.transition 2004, 10, :o2, 1099152000 + tz.transition 2005, 3, :o1, 1111852800 + tz.transition 2005, 10, :o2, 1130601600 + tz.transition 2006, 4, :o1, 1143907200 + tz.transition 2006, 10, :o2, 1162051200 + tz.transition 2007, 3, :o1, 1174752000 + tz.transition 2007, 10, :o2, 1193500800 + tz.transition 2008, 4, :o1, 1207411200 + tz.transition 2008, 10, :o2, 1223136000 + tz.transition 2009, 4, :o1, 1238860800 + tz.transition 2009, 10, :o2, 1254585600 + tz.transition 2010, 4, :o1, 1270310400 + tz.transition 2010, 10, :o2, 1286035200 + tz.transition 2011, 4, :o1, 1301760000 + tz.transition 2011, 10, :o2, 1317484800 + tz.transition 2012, 3, :o1, 1333209600 + tz.transition 2012, 10, :o2, 1349539200 + tz.transition 2013, 4, :o1, 1365264000 + tz.transition 2013, 10, :o2, 1380988800 + tz.transition 2014, 4, :o1, 1396713600 + tz.transition 2014, 10, :o2, 1412438400 + tz.transition 2015, 4, :o1, 1428163200 + tz.transition 2015, 10, :o2, 1443888000 + tz.transition 2016, 4, :o1, 1459612800 + tz.transition 2016, 10, :o2, 1475337600 + tz.transition 2017, 4, :o1, 1491062400 + tz.transition 2017, 9, :o2, 1506787200 + tz.transition 2018, 3, :o1, 1522512000 + tz.transition 2018, 10, :o2, 1538841600 + tz.transition 2019, 4, :o1, 1554566400 + tz.transition 2019, 10, :o2, 1570291200 + tz.transition 2020, 4, :o1, 1586016000 + tz.transition 2020, 10, :o2, 1601740800 + tz.transition 2021, 4, :o1, 1617465600 + tz.transition 2021, 10, :o2, 1633190400 + tz.transition 2022, 4, :o1, 1648915200 + tz.transition 2022, 10, :o2, 1664640000 + tz.transition 2023, 4, :o1, 1680364800 + tz.transition 2023, 9, :o2, 1696089600 + tz.transition 2024, 4, :o1, 1712419200 + tz.transition 2024, 10, :o2, 1728144000 + tz.transition 2025, 4, :o1, 1743868800 + tz.transition 2025, 10, :o2, 1759593600 + tz.transition 2026, 4, :o1, 1775318400 + tz.transition 2026, 10, :o2, 1791043200 + tz.transition 2027, 4, :o1, 1806768000 + tz.transition 2027, 10, :o2, 1822492800 + tz.transition 2028, 4, :o1, 1838217600 + tz.transition 2028, 9, :o2, 1853942400 + tz.transition 2029, 3, :o1, 1869667200 + tz.transition 2029, 10, :o2, 1885996800 + tz.transition 2030, 4, :o1, 1901721600 + tz.transition 2030, 10, :o2, 1917446400 + tz.transition 2031, 4, :o1, 1933171200 + tz.transition 2031, 10, :o2, 1948896000 + tz.transition 2032, 4, :o1, 1964620800 + tz.transition 2032, 10, :o2, 1980345600 + tz.transition 2033, 4, :o1, 1996070400 + tz.transition 2033, 10, :o2, 2011795200 + tz.transition 2034, 4, :o1, 2027520000 + tz.transition 2034, 9, :o2, 2043244800 + tz.transition 2035, 3, :o1, 2058969600 + tz.transition 2035, 10, :o2, 2075299200 + tz.transition 2036, 4, :o1, 2091024000 + tz.transition 2036, 10, :o2, 2106748800 + tz.transition 2037, 4, :o1, 2122473600 + tz.transition 2037, 10, :o2, 2138198400 + tz.transition 2038, 4, :o1, 14793103, 6 + tz.transition 2038, 10, :o2, 14794195, 6 + tz.transition 2039, 4, :o1, 14795287, 6 + tz.transition 2039, 10, :o2, 14796379, 6 + tz.transition 2040, 3, :o1, 14797471, 6 + tz.transition 2040, 10, :o2, 14798605, 6 + tz.transition 2041, 4, :o1, 14799697, 6 + tz.transition 2041, 10, :o2, 14800789, 6 + tz.transition 2042, 4, :o1, 14801881, 6 + tz.transition 2042, 10, :o2, 14802973, 6 + tz.transition 2043, 4, :o1, 14804065, 6 + tz.transition 2043, 10, :o2, 14805157, 6 + tz.transition 2044, 4, :o1, 14806249, 6 + tz.transition 2044, 10, :o2, 14807341, 6 + tz.transition 2045, 4, :o1, 14808433, 6 + tz.transition 2045, 9, :o2, 14809525, 6 + tz.transition 2046, 3, :o1, 14810617, 6 + tz.transition 2046, 10, :o2, 14811751, 6 + tz.transition 2047, 4, :o1, 14812843, 6 + tz.transition 2047, 10, :o2, 14813935, 6 + tz.transition 2048, 4, :o1, 14815027, 6 + tz.transition 2048, 10, :o2, 14816119, 6 + tz.transition 2049, 4, :o1, 14817211, 6 + tz.transition 2049, 10, :o2, 14818303, 6 + tz.transition 2050, 4, :o1, 14819395, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb new file mode 100644 index 0000000000..d9e66f14a8 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb @@ -0,0 +1,37 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Perth + include TimezoneDefinition + + timezone 'Australia/Perth' do |tz| + tz.offset :o0, 27804, 0, :LMT + tz.offset :o1, 28800, 0, :WST + tz.offset :o2, 28800, 3600, :WST + + tz.transition 1895, 11, :o1, 17377402883, 7200 + tz.transition 1916, 12, :o2, 3486570001, 1440 + tz.transition 1917, 3, :o1, 58111493, 24 + tz.transition 1941, 12, :o2, 9721441, 4 + tz.transition 1942, 3, :o1, 58330733, 24 + tz.transition 1942, 9, :o2, 9722517, 4 + tz.transition 1943, 3, :o1, 58339469, 24 + tz.transition 1974, 10, :o2, 152042400 + tz.transition 1975, 3, :o1, 162928800 + tz.transition 1983, 10, :o2, 436298400 + tz.transition 1984, 3, :o1, 447184800 + tz.transition 1991, 11, :o2, 690314400 + tz.transition 1992, 2, :o1, 699386400 + tz.transition 2006, 12, :o2, 1165082400 + tz.transition 2007, 3, :o1, 1174759200 + tz.transition 2007, 10, :o2, 1193508000 + tz.transition 2008, 3, :o1, 1206813600 + tz.transition 2008, 10, :o2, 1224957600 + tz.transition 2009, 3, :o1, 1238263200 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb new file mode 100644 index 0000000000..9062bd7c3c --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb @@ -0,0 +1,185 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Australia + module Sydney + include TimezoneDefinition + + timezone 'Australia/Sydney' do |tz| + tz.offset :o0, 36292, 0, :LMT + tz.offset :o1, 36000, 0, :EST + tz.offset :o2, 36000, 3600, :EST + + tz.transition 1895, 1, :o1, 52125661727, 21600 + tz.transition 1916, 12, :o2, 3486569881, 1440 + tz.transition 1917, 3, :o1, 19370497, 8 + tz.transition 1941, 12, :o2, 14582161, 6 + tz.transition 1942, 3, :o1, 19443577, 8 + tz.transition 1942, 9, :o2, 14583775, 6 + tz.transition 1943, 3, :o1, 19446489, 8 + tz.transition 1943, 10, :o2, 14586001, 6 + tz.transition 1944, 3, :o1, 19449401, 8 + tz.transition 1971, 10, :o2, 57686400 + tz.transition 1972, 2, :o1, 67968000 + tz.transition 1972, 10, :o2, 89136000 + tz.transition 1973, 3, :o1, 100022400 + tz.transition 1973, 10, :o2, 120585600 + tz.transition 1974, 3, :o1, 131472000 + tz.transition 1974, 10, :o2, 152035200 + tz.transition 1975, 3, :o1, 162921600 + tz.transition 1975, 10, :o2, 183484800 + tz.transition 1976, 3, :o1, 194976000 + tz.transition 1976, 10, :o2, 215539200 + tz.transition 1977, 3, :o1, 226425600 + tz.transition 1977, 10, :o2, 246988800 + tz.transition 1978, 3, :o1, 257875200 + tz.transition 1978, 10, :o2, 278438400 + tz.transition 1979, 3, :o1, 289324800 + tz.transition 1979, 10, :o2, 309888000 + tz.transition 1980, 3, :o1, 320774400 + tz.transition 1980, 10, :o2, 341337600 + tz.transition 1981, 2, :o1, 352224000 + tz.transition 1981, 10, :o2, 372787200 + tz.transition 1982, 4, :o1, 386697600 + tz.transition 1982, 10, :o2, 404841600 + tz.transition 1983, 3, :o1, 415728000 + tz.transition 1983, 10, :o2, 436291200 + tz.transition 1984, 3, :o1, 447177600 + tz.transition 1984, 10, :o2, 467740800 + tz.transition 1985, 3, :o1, 478627200 + tz.transition 1985, 10, :o2, 499190400 + tz.transition 1986, 3, :o1, 511286400 + tz.transition 1986, 10, :o2, 530035200 + tz.transition 1987, 3, :o1, 542736000 + tz.transition 1987, 10, :o2, 562089600 + tz.transition 1988, 3, :o1, 574790400 + tz.transition 1988, 10, :o2, 594144000 + tz.transition 1989, 3, :o1, 606240000 + tz.transition 1989, 10, :o2, 625593600 + tz.transition 1990, 3, :o1, 636480000 + tz.transition 1990, 10, :o2, 657043200 + tz.transition 1991, 3, :o1, 667929600 + tz.transition 1991, 10, :o2, 688492800 + tz.transition 1992, 2, :o1, 699379200 + tz.transition 1992, 10, :o2, 719942400 + tz.transition 1993, 3, :o1, 731433600 + tz.transition 1993, 10, :o2, 751996800 + tz.transition 1994, 3, :o1, 762883200 + tz.transition 1994, 10, :o2, 783446400 + tz.transition 1995, 3, :o1, 794332800 + tz.transition 1995, 10, :o2, 814896000 + tz.transition 1996, 3, :o1, 828201600 + tz.transition 1996, 10, :o2, 846345600 + tz.transition 1997, 3, :o1, 859651200 + tz.transition 1997, 10, :o2, 877795200 + tz.transition 1998, 3, :o1, 891100800 + tz.transition 1998, 10, :o2, 909244800 + tz.transition 1999, 3, :o1, 922550400 + tz.transition 1999, 10, :o2, 941299200 + tz.transition 2000, 3, :o1, 954000000 + tz.transition 2000, 8, :o2, 967305600 + tz.transition 2001, 3, :o1, 985449600 + tz.transition 2001, 10, :o2, 1004198400 + tz.transition 2002, 3, :o1, 1017504000 + tz.transition 2002, 10, :o2, 1035648000 + tz.transition 2003, 3, :o1, 1048953600 + tz.transition 2003, 10, :o2, 1067097600 + tz.transition 2004, 3, :o1, 1080403200 + tz.transition 2004, 10, :o2, 1099152000 + tz.transition 2005, 3, :o1, 1111852800 + tz.transition 2005, 10, :o2, 1130601600 + tz.transition 2006, 4, :o1, 1143907200 + tz.transition 2006, 10, :o2, 1162051200 + tz.transition 2007, 3, :o1, 1174752000 + tz.transition 2007, 10, :o2, 1193500800 + tz.transition 2008, 4, :o1, 1207411200 + tz.transition 2008, 10, :o2, 1223136000 + tz.transition 2009, 4, :o1, 1238860800 + tz.transition 2009, 10, :o2, 1254585600 + tz.transition 2010, 4, :o1, 1270310400 + tz.transition 2010, 10, :o2, 1286035200 + tz.transition 2011, 4, :o1, 1301760000 + tz.transition 2011, 10, :o2, 1317484800 + tz.transition 2012, 3, :o1, 1333209600 + tz.transition 2012, 10, :o2, 1349539200 + tz.transition 2013, 4, :o1, 1365264000 + tz.transition 2013, 10, :o2, 1380988800 + tz.transition 2014, 4, :o1, 1396713600 + tz.transition 2014, 10, :o2, 1412438400 + tz.transition 2015, 4, :o1, 1428163200 + tz.transition 2015, 10, :o2, 1443888000 + tz.transition 2016, 4, :o1, 1459612800 + tz.transition 2016, 10, :o2, 1475337600 + tz.transition 2017, 4, :o1, 1491062400 + tz.transition 2017, 9, :o2, 1506787200 + tz.transition 2018, 3, :o1, 1522512000 + tz.transition 2018, 10, :o2, 1538841600 + tz.transition 2019, 4, :o1, 1554566400 + tz.transition 2019, 10, :o2, 1570291200 + tz.transition 2020, 4, :o1, 1586016000 + tz.transition 2020, 10, :o2, 1601740800 + tz.transition 2021, 4, :o1, 1617465600 + tz.transition 2021, 10, :o2, 1633190400 + tz.transition 2022, 4, :o1, 1648915200 + tz.transition 2022, 10, :o2, 1664640000 + tz.transition 2023, 4, :o1, 1680364800 + tz.transition 2023, 9, :o2, 1696089600 + tz.transition 2024, 4, :o1, 1712419200 + tz.transition 2024, 10, :o2, 1728144000 + tz.transition 2025, 4, :o1, 1743868800 + tz.transition 2025, 10, :o2, 1759593600 + tz.transition 2026, 4, :o1, 1775318400 + tz.transition 2026, 10, :o2, 1791043200 + tz.transition 2027, 4, :o1, 1806768000 + tz.transition 2027, 10, :o2, 1822492800 + tz.transition 2028, 4, :o1, 1838217600 + tz.transition 2028, 9, :o2, 1853942400 + tz.transition 2029, 3, :o1, 1869667200 + tz.transition 2029, 10, :o2, 1885996800 + tz.transition 2030, 4, :o1, 1901721600 + tz.transition 2030, 10, :o2, 1917446400 + tz.transition 2031, 4, :o1, 1933171200 + tz.transition 2031, 10, :o2, 1948896000 + tz.transition 2032, 4, :o1, 1964620800 + tz.transition 2032, 10, :o2, 1980345600 + tz.transition 2033, 4, :o1, 1996070400 + tz.transition 2033, 10, :o2, 2011795200 + tz.transition 2034, 4, :o1, 2027520000 + tz.transition 2034, 9, :o2, 2043244800 + tz.transition 2035, 3, :o1, 2058969600 + tz.transition 2035, 10, :o2, 2075299200 + tz.transition 2036, 4, :o1, 2091024000 + tz.transition 2036, 10, :o2, 2106748800 + tz.transition 2037, 4, :o1, 2122473600 + tz.transition 2037, 10, :o2, 2138198400 + tz.transition 2038, 4, :o1, 14793103, 6 + tz.transition 2038, 10, :o2, 14794195, 6 + tz.transition 2039, 4, :o1, 14795287, 6 + tz.transition 2039, 10, :o2, 14796379, 6 + tz.transition 2040, 3, :o1, 14797471, 6 + tz.transition 2040, 10, :o2, 14798605, 6 + tz.transition 2041, 4, :o1, 14799697, 6 + tz.transition 2041, 10, :o2, 14800789, 6 + tz.transition 2042, 4, :o1, 14801881, 6 + tz.transition 2042, 10, :o2, 14802973, 6 + tz.transition 2043, 4, :o1, 14804065, 6 + tz.transition 2043, 10, :o2, 14805157, 6 + tz.transition 2044, 4, :o1, 14806249, 6 + tz.transition 2044, 10, :o2, 14807341, 6 + tz.transition 2045, 4, :o1, 14808433, 6 + tz.transition 2045, 9, :o2, 14809525, 6 + tz.transition 2046, 3, :o1, 14810617, 6 + tz.transition 2046, 10, :o2, 14811751, 6 + tz.transition 2047, 4, :o1, 14812843, 6 + tz.transition 2047, 10, :o2, 14813935, 6 + tz.transition 2048, 4, :o1, 14815027, 6 + tz.transition 2048, 10, :o2, 14816119, 6 + tz.transition 2049, 4, :o1, 14817211, 6 + tz.transition 2049, 10, :o2, 14818303, 6 + tz.transition 2050, 4, :o1, 14819395, 6 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb new file mode 100644 index 0000000000..28b2c6a04c --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb @@ -0,0 +1,16 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Etc + module UTC + include TimezoneDefinition + + timezone 'Etc/UTC' do |tz| + tz.offset :o0, 0, 0, :UTC + + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb new file mode 100644 index 0000000000..2d0c95c4bc --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb @@ -0,0 +1,228 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Amsterdam + include TimezoneDefinition + + timezone 'Europe/Amsterdam' do |tz| + tz.offset :o0, 1172, 0, :LMT + tz.offset :o1, 1172, 0, :AMT + tz.offset :o2, 1172, 3600, :NST + tz.offset :o3, 1200, 3600, :NEST + tz.offset :o4, 1200, 0, :NET + tz.offset :o5, 3600, 3600, :CEST + tz.offset :o6, 3600, 0, :CET + + tz.transition 1834, 12, :o1, 51651636907, 21600 + tz.transition 1916, 4, :o2, 52293264907, 21600 + tz.transition 1916, 9, :o1, 52296568807, 21600 + tz.transition 1917, 4, :o2, 52300826707, 21600 + tz.transition 1917, 9, :o1, 52304153107, 21600 + tz.transition 1918, 4, :o2, 52308386707, 21600 + tz.transition 1918, 9, :o1, 52312317907, 21600 + tz.transition 1919, 4, :o2, 52316400307, 21600 + tz.transition 1919, 9, :o1, 52320180307, 21600 + tz.transition 1920, 4, :o2, 52324262707, 21600 + tz.transition 1920, 9, :o1, 52328042707, 21600 + tz.transition 1921, 4, :o2, 52332125107, 21600 + tz.transition 1921, 9, :o1, 52335905107, 21600 + tz.transition 1922, 3, :o2, 52339814707, 21600 + tz.transition 1922, 10, :o1, 52344048307, 21600 + tz.transition 1923, 6, :o2, 52349145907, 21600 + tz.transition 1923, 10, :o1, 52351910707, 21600 + tz.transition 1924, 3, :o2, 52355690707, 21600 + tz.transition 1924, 10, :o1, 52359773107, 21600 + tz.transition 1925, 6, :o2, 52365021907, 21600 + tz.transition 1925, 10, :o1, 52367635507, 21600 + tz.transition 1926, 5, :o2, 52372452307, 21600 + tz.transition 1926, 10, :o1, 52375497907, 21600 + tz.transition 1927, 5, :o2, 52380336307, 21600 + tz.transition 1927, 10, :o1, 52383360307, 21600 + tz.transition 1928, 5, :o2, 52388241907, 21600 + tz.transition 1928, 10, :o1, 52391373907, 21600 + tz.transition 1929, 5, :o2, 52396125907, 21600 + tz.transition 1929, 10, :o1, 52399236307, 21600 + tz.transition 1930, 5, :o2, 52404009907, 21600 + tz.transition 1930, 10, :o1, 52407098707, 21600 + tz.transition 1931, 5, :o2, 52411893907, 21600 + tz.transition 1931, 10, :o1, 52414961107, 21600 + tz.transition 1932, 5, :o2, 52419950707, 21600 + tz.transition 1932, 10, :o1, 52422823507, 21600 + tz.transition 1933, 5, :o2, 52427683507, 21600 + tz.transition 1933, 10, :o1, 52430837107, 21600 + tz.transition 1934, 5, :o2, 52435567507, 21600 + tz.transition 1934, 10, :o1, 52438699507, 21600 + tz.transition 1935, 5, :o2, 52443451507, 21600 + tz.transition 1935, 10, :o1, 52446561907, 21600 + tz.transition 1936, 5, :o2, 52451357107, 21600 + tz.transition 1936, 10, :o1, 52454424307, 21600 + tz.transition 1937, 5, :o2, 52459392307, 21600 + tz.transition 1937, 6, :o3, 52460253607, 21600 + tz.transition 1937, 10, :o4, 174874289, 72 + tz.transition 1938, 5, :o3, 174890417, 72 + tz.transition 1938, 10, :o4, 174900497, 72 + tz.transition 1939, 5, :o3, 174916697, 72 + tz.transition 1939, 10, :o4, 174927209, 72 + tz.transition 1940, 5, :o5, 174943115, 72 + tz.transition 1942, 11, :o6, 58335973, 24 + tz.transition 1943, 3, :o5, 58339501, 24 + tz.transition 1943, 10, :o6, 58344037, 24 + tz.transition 1944, 4, :o5, 58348405, 24 + tz.transition 1944, 10, :o6, 58352773, 24 + tz.transition 1945, 4, :o5, 58357141, 24 + tz.transition 1945, 9, :o6, 58361149, 24 + tz.transition 1977, 4, :o5, 228877200 + tz.transition 1977, 9, :o6, 243997200 + tz.transition 1978, 4, :o5, 260326800 + tz.transition 1978, 10, :o6, 276051600 + tz.transition 1979, 4, :o5, 291776400 + tz.transition 1979, 9, :o6, 307501200 + tz.transition 1980, 4, :o5, 323830800 + tz.transition 1980, 9, :o6, 338950800 + tz.transition 1981, 3, :o5, 354675600 + tz.transition 1981, 9, :o6, 370400400 + tz.transition 1982, 3, :o5, 386125200 + tz.transition 1982, 9, :o6, 401850000 + tz.transition 1983, 3, :o5, 417574800 + tz.transition 1983, 9, :o6, 433299600 + tz.transition 1984, 3, :o5, 449024400 + tz.transition 1984, 9, :o6, 465354000 + tz.transition 1985, 3, :o5, 481078800 + tz.transition 1985, 9, :o6, 496803600 + tz.transition 1986, 3, :o5, 512528400 + tz.transition 1986, 9, :o6, 528253200 + tz.transition 1987, 3, :o5, 543978000 + tz.transition 1987, 9, :o6, 559702800 + tz.transition 1988, 3, :o5, 575427600 + tz.transition 1988, 9, :o6, 591152400 + tz.transition 1989, 3, :o5, 606877200 + tz.transition 1989, 9, :o6, 622602000 + tz.transition 1990, 3, :o5, 638326800 + tz.transition 1990, 9, :o6, 654656400 + tz.transition 1991, 3, :o5, 670381200 + tz.transition 1991, 9, :o6, 686106000 + tz.transition 1992, 3, :o5, 701830800 + tz.transition 1992, 9, :o6, 717555600 + tz.transition 1993, 3, :o5, 733280400 + tz.transition 1993, 9, :o6, 749005200 + tz.transition 1994, 3, :o5, 764730000 + tz.transition 1994, 9, :o6, 780454800 + tz.transition 1995, 3, :o5, 796179600 + tz.transition 1995, 9, :o6, 811904400 + tz.transition 1996, 3, :o5, 828234000 + tz.transition 1996, 10, :o6, 846378000 + tz.transition 1997, 3, :o5, 859683600 + tz.transition 1997, 10, :o6, 877827600 + tz.transition 1998, 3, :o5, 891133200 + tz.transition 1998, 10, :o6, 909277200 + tz.transition 1999, 3, :o5, 922582800 + tz.transition 1999, 10, :o6, 941331600 + tz.transition 2000, 3, :o5, 954032400 + tz.transition 2000, 10, :o6, 972781200 + tz.transition 2001, 3, :o5, 985482000 + tz.transition 2001, 10, :o6, 1004230800 + tz.transition 2002, 3, :o5, 1017536400 + tz.transition 2002, 10, :o6, 1035680400 + tz.transition 2003, 3, :o5, 1048986000 + tz.transition 2003, 10, :o6, 1067130000 + tz.transition 2004, 3, :o5, 1080435600 + tz.transition 2004, 10, :o6, 1099184400 + tz.transition 2005, 3, :o5, 1111885200 + tz.transition 2005, 10, :o6, 1130634000 + tz.transition 2006, 3, :o5, 1143334800 + tz.transition 2006, 10, :o6, 1162083600 + tz.transition 2007, 3, :o5, 1174784400 + tz.transition 2007, 10, :o6, 1193533200 + tz.transition 2008, 3, :o5, 1206838800 + tz.transition 2008, 10, :o6, 1224982800 + tz.transition 2009, 3, :o5, 1238288400 + tz.transition 2009, 10, :o6, 1256432400 + tz.transition 2010, 3, :o5, 1269738000 + tz.transition 2010, 10, :o6, 1288486800 + tz.transition 2011, 3, :o5, 1301187600 + tz.transition 2011, 10, :o6, 1319936400 + tz.transition 2012, 3, :o5, 1332637200 + tz.transition 2012, 10, :o6, 1351386000 + tz.transition 2013, 3, :o5, 1364691600 + tz.transition 2013, 10, :o6, 1382835600 + tz.transition 2014, 3, :o5, 1396141200 + tz.transition 2014, 10, :o6, 1414285200 + tz.transition 2015, 3, :o5, 1427590800 + tz.transition 2015, 10, :o6, 1445734800 + tz.transition 2016, 3, :o5, 1459040400 + tz.transition 2016, 10, :o6, 1477789200 + tz.transition 2017, 3, :o5, 1490490000 + tz.transition 2017, 10, :o6, 1509238800 + tz.transition 2018, 3, :o5, 1521939600 + tz.transition 2018, 10, :o6, 1540688400 + tz.transition 2019, 3, :o5, 1553994000 + tz.transition 2019, 10, :o6, 1572138000 + tz.transition 2020, 3, :o5, 1585443600 + tz.transition 2020, 10, :o6, 1603587600 + tz.transition 2021, 3, :o5, 1616893200 + tz.transition 2021, 10, :o6, 1635642000 + tz.transition 2022, 3, :o5, 1648342800 + tz.transition 2022, 10, :o6, 1667091600 + tz.transition 2023, 3, :o5, 1679792400 + tz.transition 2023, 10, :o6, 1698541200 + tz.transition 2024, 3, :o5, 1711846800 + tz.transition 2024, 10, :o6, 1729990800 + tz.transition 2025, 3, :o5, 1743296400 + tz.transition 2025, 10, :o6, 1761440400 + tz.transition 2026, 3, :o5, 1774746000 + tz.transition 2026, 10, :o6, 1792890000 + tz.transition 2027, 3, :o5, 1806195600 + tz.transition 2027, 10, :o6, 1824944400 + tz.transition 2028, 3, :o5, 1837645200 + tz.transition 2028, 10, :o6, 1856394000 + tz.transition 2029, 3, :o5, 1869094800 + tz.transition 2029, 10, :o6, 1887843600 + tz.transition 2030, 3, :o5, 1901149200 + tz.transition 2030, 10, :o6, 1919293200 + tz.transition 2031, 3, :o5, 1932598800 + tz.transition 2031, 10, :o6, 1950742800 + tz.transition 2032, 3, :o5, 1964048400 + tz.transition 2032, 10, :o6, 1982797200 + tz.transition 2033, 3, :o5, 1995498000 + tz.transition 2033, 10, :o6, 2014246800 + tz.transition 2034, 3, :o5, 2026947600 + tz.transition 2034, 10, :o6, 2045696400 + tz.transition 2035, 3, :o5, 2058397200 + tz.transition 2035, 10, :o6, 2077146000 + tz.transition 2036, 3, :o5, 2090451600 + tz.transition 2036, 10, :o6, 2108595600 + tz.transition 2037, 3, :o5, 2121901200 + tz.transition 2037, 10, :o6, 2140045200 + tz.transition 2038, 3, :o5, 59172253, 24 + tz.transition 2038, 10, :o6, 59177461, 24 + tz.transition 2039, 3, :o5, 59180989, 24 + tz.transition 2039, 10, :o6, 59186197, 24 + tz.transition 2040, 3, :o5, 59189725, 24 + tz.transition 2040, 10, :o6, 59194933, 24 + tz.transition 2041, 3, :o5, 59198629, 24 + tz.transition 2041, 10, :o6, 59203669, 24 + tz.transition 2042, 3, :o5, 59207365, 24 + tz.transition 2042, 10, :o6, 59212405, 24 + tz.transition 2043, 3, :o5, 59216101, 24 + tz.transition 2043, 10, :o6, 59221141, 24 + tz.transition 2044, 3, :o5, 59224837, 24 + tz.transition 2044, 10, :o6, 59230045, 24 + tz.transition 2045, 3, :o5, 59233573, 24 + tz.transition 2045, 10, :o6, 59238781, 24 + tz.transition 2046, 3, :o5, 59242309, 24 + tz.transition 2046, 10, :o6, 59247517, 24 + tz.transition 2047, 3, :o5, 59251213, 24 + tz.transition 2047, 10, :o6, 59256253, 24 + tz.transition 2048, 3, :o5, 59259949, 24 + tz.transition 2048, 10, :o6, 59264989, 24 + tz.transition 2049, 3, :o5, 59268685, 24 + tz.transition 2049, 10, :o6, 59273893, 24 + tz.transition 2050, 3, :o5, 59277421, 24 + tz.transition 2050, 10, :o6, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb new file mode 100644 index 0000000000..4e21e535ca --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb @@ -0,0 +1,185 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Athens + include TimezoneDefinition + + timezone 'Europe/Athens' do |tz| + tz.offset :o0, 5692, 0, :LMT + tz.offset :o1, 5692, 0, :AMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 7200, 3600, :EEST + tz.offset :o4, 3600, 3600, :CEST + tz.offset :o5, 3600, 0, :CET + + tz.transition 1895, 9, :o1, 52130529377, 21600 + tz.transition 1916, 7, :o2, 3268447787, 1350 + tz.transition 1932, 7, :o3, 29122745, 12 + tz.transition 1932, 8, :o2, 19415611, 8 + tz.transition 1941, 4, :o3, 29161097, 12 + tz.transition 1941, 4, :o4, 19440915, 8 + tz.transition 1942, 11, :o5, 58335973, 24 + tz.transition 1943, 3, :o4, 58339523, 24 + tz.transition 1943, 10, :o5, 29172017, 12 + tz.transition 1944, 4, :o2, 58348427, 24 + tz.transition 1952, 6, :o3, 29210333, 12 + tz.transition 1952, 11, :o2, 19474547, 8 + tz.transition 1975, 4, :o3, 166485600 + tz.transition 1975, 11, :o2, 186184800 + tz.transition 1976, 4, :o3, 198028800 + tz.transition 1976, 10, :o2, 213753600 + tz.transition 1977, 4, :o3, 228873600 + tz.transition 1977, 9, :o2, 244080000 + tz.transition 1978, 4, :o3, 260323200 + tz.transition 1978, 9, :o2, 275446800 + tz.transition 1979, 4, :o3, 291798000 + tz.transition 1979, 9, :o2, 307407600 + tz.transition 1980, 3, :o3, 323388000 + tz.transition 1980, 9, :o2, 338936400 + tz.transition 1981, 3, :o3, 354675600 + tz.transition 1981, 9, :o2, 370400400 + tz.transition 1982, 3, :o3, 386125200 + tz.transition 1982, 9, :o2, 401850000 + tz.transition 1983, 3, :o3, 417574800 + tz.transition 1983, 9, :o2, 433299600 + tz.transition 1984, 3, :o3, 449024400 + tz.transition 1984, 9, :o2, 465354000 + tz.transition 1985, 3, :o3, 481078800 + tz.transition 1985, 9, :o2, 496803600 + tz.transition 1986, 3, :o3, 512528400 + tz.transition 1986, 9, :o2, 528253200 + tz.transition 1987, 3, :o3, 543978000 + tz.transition 1987, 9, :o2, 559702800 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb new file mode 100644 index 0000000000..4dbd893d75 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Belgrade + include TimezoneDefinition + + timezone 'Europe/Belgrade' do |tz| + tz.offset :o0, 4920, 0, :LMT + tz.offset :o1, 3600, 0, :CET + tz.offset :o2, 3600, 3600, :CEST + + tz.transition 1883, 12, :o1, 1734607039, 720 + tz.transition 1941, 4, :o2, 29161241, 12 + tz.transition 1942, 11, :o1, 58335973, 24 + tz.transition 1943, 3, :o2, 58339501, 24 + tz.transition 1943, 10, :o1, 58344037, 24 + tz.transition 1944, 4, :o2, 58348405, 24 + tz.transition 1944, 10, :o1, 58352773, 24 + tz.transition 1945, 5, :o2, 58358005, 24 + tz.transition 1945, 9, :o1, 58361149, 24 + tz.transition 1983, 3, :o2, 417574800 + tz.transition 1983, 9, :o1, 433299600 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 9, :o1, 465354000 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 9, :o1, 496803600 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 9, :o1, 528253200 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 9, :o1, 559702800 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 9, :o1, 591152400 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 9, :o1, 622602000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 9, :o1, 654656400 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 9, :o1, 686106000 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 9, :o1, 717555600 + tz.transition 1993, 3, :o2, 733280400 + tz.transition 1993, 9, :o1, 749005200 + tz.transition 1994, 3, :o2, 764730000 + tz.transition 1994, 9, :o1, 780454800 + tz.transition 1995, 3, :o2, 796179600 + tz.transition 1995, 9, :o1, 811904400 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb new file mode 100644 index 0000000000..721054236c --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb @@ -0,0 +1,188 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Berlin + include TimezoneDefinition + + timezone 'Europe/Berlin' do |tz| + tz.offset :o0, 3208, 0, :LMT + tz.offset :o1, 3600, 0, :CET + tz.offset :o2, 3600, 3600, :CEST + tz.offset :o3, 3600, 7200, :CEMT + + tz.transition 1893, 3, :o1, 26055588199, 10800 + tz.transition 1916, 4, :o2, 29051813, 12 + tz.transition 1916, 9, :o1, 58107299, 24 + tz.transition 1917, 4, :o2, 58112029, 24 + tz.transition 1917, 9, :o1, 58115725, 24 + tz.transition 1918, 4, :o2, 58120765, 24 + tz.transition 1918, 9, :o1, 58124461, 24 + tz.transition 1940, 4, :o2, 58313293, 24 + tz.transition 1942, 11, :o1, 58335973, 24 + tz.transition 1943, 3, :o2, 58339501, 24 + tz.transition 1943, 10, :o1, 58344037, 24 + tz.transition 1944, 4, :o2, 58348405, 24 + tz.transition 1944, 10, :o1, 58352773, 24 + tz.transition 1945, 4, :o2, 58357141, 24 + tz.transition 1945, 5, :o3, 4863199, 2 + tz.transition 1945, 9, :o2, 4863445, 2 + tz.transition 1945, 11, :o1, 58362661, 24 + tz.transition 1946, 4, :o2, 58366189, 24 + tz.transition 1946, 10, :o1, 58370413, 24 + tz.transition 1947, 4, :o2, 29187379, 12 + tz.transition 1947, 5, :o3, 58375597, 24 + tz.transition 1947, 6, :o2, 4864731, 2 + tz.transition 1947, 10, :o1, 58379125, 24 + tz.transition 1948, 4, :o2, 58383829, 24 + tz.transition 1948, 10, :o1, 58387861, 24 + tz.transition 1949, 4, :o2, 58392397, 24 + tz.transition 1949, 10, :o1, 58396597, 24 + tz.transition 1980, 4, :o2, 323830800 + tz.transition 1980, 9, :o1, 338950800 + tz.transition 1981, 3, :o2, 354675600 + tz.transition 1981, 9, :o1, 370400400 + tz.transition 1982, 3, :o2, 386125200 + tz.transition 1982, 9, :o1, 401850000 + tz.transition 1983, 3, :o2, 417574800 + tz.transition 1983, 9, :o1, 433299600 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 9, :o1, 465354000 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 9, :o1, 496803600 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 9, :o1, 528253200 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 9, :o1, 559702800 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 9, :o1, 591152400 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 9, :o1, 622602000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 9, :o1, 654656400 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 9, :o1, 686106000 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 9, :o1, 717555600 + tz.transition 1993, 3, :o2, 733280400 + tz.transition 1993, 9, :o1, 749005200 + tz.transition 1994, 3, :o2, 764730000 + tz.transition 1994, 9, :o1, 780454800 + tz.transition 1995, 3, :o2, 796179600 + tz.transition 1995, 9, :o1, 811904400 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb new file mode 100644 index 0000000000..7a731a0b6a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb @@ -0,0 +1,13 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Bratislava + include TimezoneDefinition + + linked_timezone 'Europe/Bratislava', 'Europe/Prague' + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb new file mode 100644 index 0000000000..6b0a242944 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb @@ -0,0 +1,232 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Brussels + include TimezoneDefinition + + timezone 'Europe/Brussels' do |tz| + tz.offset :o0, 1050, 0, :LMT + tz.offset :o1, 1050, 0, :BMT + tz.offset :o2, 0, 0, :WET + tz.offset :o3, 3600, 0, :CET + tz.offset :o4, 3600, 3600, :CEST + tz.offset :o5, 0, 3600, :WEST + + tz.transition 1879, 12, :o1, 1386844121, 576 + tz.transition 1892, 5, :o2, 1389438713, 576 + tz.transition 1914, 11, :o3, 4840889, 2 + tz.transition 1916, 4, :o4, 58103627, 24 + tz.transition 1916, 9, :o3, 58107299, 24 + tz.transition 1917, 4, :o4, 58112029, 24 + tz.transition 1917, 9, :o3, 58115725, 24 + tz.transition 1918, 4, :o4, 58120765, 24 + tz.transition 1918, 9, :o3, 58124461, 24 + tz.transition 1918, 11, :o2, 58125815, 24 + tz.transition 1919, 3, :o5, 58128467, 24 + tz.transition 1919, 10, :o2, 58133675, 24 + tz.transition 1920, 2, :o5, 58136867, 24 + tz.transition 1920, 10, :o2, 58142915, 24 + tz.transition 1921, 3, :o5, 58146323, 24 + tz.transition 1921, 10, :o2, 58151723, 24 + tz.transition 1922, 3, :o5, 58155347, 24 + tz.transition 1922, 10, :o2, 58160051, 24 + tz.transition 1923, 4, :o5, 58164755, 24 + tz.transition 1923, 10, :o2, 58168787, 24 + tz.transition 1924, 3, :o5, 58172987, 24 + tz.transition 1924, 10, :o2, 58177523, 24 + tz.transition 1925, 4, :o5, 58181891, 24 + tz.transition 1925, 10, :o2, 58186259, 24 + tz.transition 1926, 4, :o5, 58190963, 24 + tz.transition 1926, 10, :o2, 58194995, 24 + tz.transition 1927, 4, :o5, 58199531, 24 + tz.transition 1927, 10, :o2, 58203731, 24 + tz.transition 1928, 4, :o5, 58208435, 24 + tz.transition 1928, 10, :o2, 29106319, 12 + tz.transition 1929, 4, :o5, 29108671, 12 + tz.transition 1929, 10, :o2, 29110687, 12 + tz.transition 1930, 4, :o5, 29112955, 12 + tz.transition 1930, 10, :o2, 29115055, 12 + tz.transition 1931, 4, :o5, 29117407, 12 + tz.transition 1931, 10, :o2, 29119423, 12 + tz.transition 1932, 4, :o5, 29121607, 12 + tz.transition 1932, 10, :o2, 29123791, 12 + tz.transition 1933, 3, :o5, 29125891, 12 + tz.transition 1933, 10, :o2, 29128243, 12 + tz.transition 1934, 4, :o5, 29130427, 12 + tz.transition 1934, 10, :o2, 29132611, 12 + tz.transition 1935, 3, :o5, 29134711, 12 + tz.transition 1935, 10, :o2, 29136979, 12 + tz.transition 1936, 4, :o5, 29139331, 12 + tz.transition 1936, 10, :o2, 29141347, 12 + tz.transition 1937, 4, :o5, 29143531, 12 + tz.transition 1937, 10, :o2, 29145715, 12 + tz.transition 1938, 3, :o5, 29147815, 12 + tz.transition 1938, 10, :o2, 29150083, 12 + tz.transition 1939, 4, :o5, 29152435, 12 + tz.transition 1939, 11, :o2, 29155039, 12 + tz.transition 1940, 2, :o5, 29156215, 12 + tz.transition 1940, 5, :o4, 29157235, 12 + tz.transition 1942, 11, :o3, 58335973, 24 + tz.transition 1943, 3, :o4, 58339501, 24 + tz.transition 1943, 10, :o3, 58344037, 24 + tz.transition 1944, 4, :o4, 58348405, 24 + tz.transition 1944, 9, :o3, 58352413, 24 + tz.transition 1945, 4, :o4, 58357141, 24 + tz.transition 1945, 9, :o3, 58361149, 24 + tz.transition 1946, 5, :o4, 58367029, 24 + tz.transition 1946, 10, :o3, 58370413, 24 + tz.transition 1977, 4, :o4, 228877200 + tz.transition 1977, 9, :o3, 243997200 + tz.transition 1978, 4, :o4, 260326800 + tz.transition 1978, 10, :o3, 276051600 + tz.transition 1979, 4, :o4, 291776400 + tz.transition 1979, 9, :o3, 307501200 + tz.transition 1980, 4, :o4, 323830800 + tz.transition 1980, 9, :o3, 338950800 + tz.transition 1981, 3, :o4, 354675600 + tz.transition 1981, 9, :o3, 370400400 + tz.transition 1982, 3, :o4, 386125200 + tz.transition 1982, 9, :o3, 401850000 + tz.transition 1983, 3, :o4, 417574800 + tz.transition 1983, 9, :o3, 433299600 + tz.transition 1984, 3, :o4, 449024400 + tz.transition 1984, 9, :o3, 465354000 + tz.transition 1985, 3, :o4, 481078800 + tz.transition 1985, 9, :o3, 496803600 + tz.transition 1986, 3, :o4, 512528400 + tz.transition 1986, 9, :o3, 528253200 + tz.transition 1987, 3, :o4, 543978000 + tz.transition 1987, 9, :o3, 559702800 + tz.transition 1988, 3, :o4, 575427600 + tz.transition 1988, 9, :o3, 591152400 + tz.transition 1989, 3, :o4, 606877200 + tz.transition 1989, 9, :o3, 622602000 + tz.transition 1990, 3, :o4, 638326800 + tz.transition 1990, 9, :o3, 654656400 + tz.transition 1991, 3, :o4, 670381200 + tz.transition 1991, 9, :o3, 686106000 + tz.transition 1992, 3, :o4, 701830800 + tz.transition 1992, 9, :o3, 717555600 + tz.transition 1993, 3, :o4, 733280400 + tz.transition 1993, 9, :o3, 749005200 + tz.transition 1994, 3, :o4, 764730000 + tz.transition 1994, 9, :o3, 780454800 + tz.transition 1995, 3, :o4, 796179600 + tz.transition 1995, 9, :o3, 811904400 + tz.transition 1996, 3, :o4, 828234000 + tz.transition 1996, 10, :o3, 846378000 + tz.transition 1997, 3, :o4, 859683600 + tz.transition 1997, 10, :o3, 877827600 + tz.transition 1998, 3, :o4, 891133200 + tz.transition 1998, 10, :o3, 909277200 + tz.transition 1999, 3, :o4, 922582800 + tz.transition 1999, 10, :o3, 941331600 + tz.transition 2000, 3, :o4, 954032400 + tz.transition 2000, 10, :o3, 972781200 + tz.transition 2001, 3, :o4, 985482000 + tz.transition 2001, 10, :o3, 1004230800 + tz.transition 2002, 3, :o4, 1017536400 + tz.transition 2002, 10, :o3, 1035680400 + tz.transition 2003, 3, :o4, 1048986000 + tz.transition 2003, 10, :o3, 1067130000 + tz.transition 2004, 3, :o4, 1080435600 + tz.transition 2004, 10, :o3, 1099184400 + tz.transition 2005, 3, :o4, 1111885200 + tz.transition 2005, 10, :o3, 1130634000 + tz.transition 2006, 3, :o4, 1143334800 + tz.transition 2006, 10, :o3, 1162083600 + tz.transition 2007, 3, :o4, 1174784400 + tz.transition 2007, 10, :o3, 1193533200 + tz.transition 2008, 3, :o4, 1206838800 + tz.transition 2008, 10, :o3, 1224982800 + tz.transition 2009, 3, :o4, 1238288400 + tz.transition 2009, 10, :o3, 1256432400 + tz.transition 2010, 3, :o4, 1269738000 + tz.transition 2010, 10, :o3, 1288486800 + tz.transition 2011, 3, :o4, 1301187600 + tz.transition 2011, 10, :o3, 1319936400 + tz.transition 2012, 3, :o4, 1332637200 + tz.transition 2012, 10, :o3, 1351386000 + tz.transition 2013, 3, :o4, 1364691600 + tz.transition 2013, 10, :o3, 1382835600 + tz.transition 2014, 3, :o4, 1396141200 + tz.transition 2014, 10, :o3, 1414285200 + tz.transition 2015, 3, :o4, 1427590800 + tz.transition 2015, 10, :o3, 1445734800 + tz.transition 2016, 3, :o4, 1459040400 + tz.transition 2016, 10, :o3, 1477789200 + tz.transition 2017, 3, :o4, 1490490000 + tz.transition 2017, 10, :o3, 1509238800 + tz.transition 2018, 3, :o4, 1521939600 + tz.transition 2018, 10, :o3, 1540688400 + tz.transition 2019, 3, :o4, 1553994000 + tz.transition 2019, 10, :o3, 1572138000 + tz.transition 2020, 3, :o4, 1585443600 + tz.transition 2020, 10, :o3, 1603587600 + tz.transition 2021, 3, :o4, 1616893200 + tz.transition 2021, 10, :o3, 1635642000 + tz.transition 2022, 3, :o4, 1648342800 + tz.transition 2022, 10, :o3, 1667091600 + tz.transition 2023, 3, :o4, 1679792400 + tz.transition 2023, 10, :o3, 1698541200 + tz.transition 2024, 3, :o4, 1711846800 + tz.transition 2024, 10, :o3, 1729990800 + tz.transition 2025, 3, :o4, 1743296400 + tz.transition 2025, 10, :o3, 1761440400 + tz.transition 2026, 3, :o4, 1774746000 + tz.transition 2026, 10, :o3, 1792890000 + tz.transition 2027, 3, :o4, 1806195600 + tz.transition 2027, 10, :o3, 1824944400 + tz.transition 2028, 3, :o4, 1837645200 + tz.transition 2028, 10, :o3, 1856394000 + tz.transition 2029, 3, :o4, 1869094800 + tz.transition 2029, 10, :o3, 1887843600 + tz.transition 2030, 3, :o4, 1901149200 + tz.transition 2030, 10, :o3, 1919293200 + tz.transition 2031, 3, :o4, 1932598800 + tz.transition 2031, 10, :o3, 1950742800 + tz.transition 2032, 3, :o4, 1964048400 + tz.transition 2032, 10, :o3, 1982797200 + tz.transition 2033, 3, :o4, 1995498000 + tz.transition 2033, 10, :o3, 2014246800 + tz.transition 2034, 3, :o4, 2026947600 + tz.transition 2034, 10, :o3, 2045696400 + tz.transition 2035, 3, :o4, 2058397200 + tz.transition 2035, 10, :o3, 2077146000 + tz.transition 2036, 3, :o4, 2090451600 + tz.transition 2036, 10, :o3, 2108595600 + tz.transition 2037, 3, :o4, 2121901200 + tz.transition 2037, 10, :o3, 2140045200 + tz.transition 2038, 3, :o4, 59172253, 24 + tz.transition 2038, 10, :o3, 59177461, 24 + tz.transition 2039, 3, :o4, 59180989, 24 + tz.transition 2039, 10, :o3, 59186197, 24 + tz.transition 2040, 3, :o4, 59189725, 24 + tz.transition 2040, 10, :o3, 59194933, 24 + tz.transition 2041, 3, :o4, 59198629, 24 + tz.transition 2041, 10, :o3, 59203669, 24 + tz.transition 2042, 3, :o4, 59207365, 24 + tz.transition 2042, 10, :o3, 59212405, 24 + tz.transition 2043, 3, :o4, 59216101, 24 + tz.transition 2043, 10, :o3, 59221141, 24 + tz.transition 2044, 3, :o4, 59224837, 24 + tz.transition 2044, 10, :o3, 59230045, 24 + tz.transition 2045, 3, :o4, 59233573, 24 + tz.transition 2045, 10, :o3, 59238781, 24 + tz.transition 2046, 3, :o4, 59242309, 24 + tz.transition 2046, 10, :o3, 59247517, 24 + tz.transition 2047, 3, :o4, 59251213, 24 + tz.transition 2047, 10, :o3, 59256253, 24 + tz.transition 2048, 3, :o4, 59259949, 24 + tz.transition 2048, 10, :o3, 59264989, 24 + tz.transition 2049, 3, :o4, 59268685, 24 + tz.transition 2049, 10, :o3, 59273893, 24 + tz.transition 2050, 3, :o4, 59277421, 24 + tz.transition 2050, 10, :o3, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb new file mode 100644 index 0000000000..521c3c932e --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb @@ -0,0 +1,181 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Bucharest + include TimezoneDefinition + + timezone 'Europe/Bucharest' do |tz| + tz.offset :o0, 6264, 0, :LMT + tz.offset :o1, 6264, 0, :BMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 7200, 3600, :EEST + + tz.transition 1891, 9, :o1, 964802571, 400 + tz.transition 1931, 7, :o2, 970618571, 400 + tz.transition 1932, 5, :o3, 29122181, 12 + tz.transition 1932, 10, :o2, 29123789, 12 + tz.transition 1933, 4, :o3, 29125973, 12 + tz.transition 1933, 9, :o2, 29128157, 12 + tz.transition 1934, 4, :o3, 29130425, 12 + tz.transition 1934, 10, :o2, 29132609, 12 + tz.transition 1935, 4, :o3, 29134793, 12 + tz.transition 1935, 10, :o2, 29136977, 12 + tz.transition 1936, 4, :o3, 29139161, 12 + tz.transition 1936, 10, :o2, 29141345, 12 + tz.transition 1937, 4, :o3, 29143529, 12 + tz.transition 1937, 10, :o2, 29145713, 12 + tz.transition 1938, 4, :o3, 29147897, 12 + tz.transition 1938, 10, :o2, 29150081, 12 + tz.transition 1939, 4, :o3, 29152265, 12 + tz.transition 1939, 9, :o2, 29154449, 12 + tz.transition 1979, 5, :o3, 296604000 + tz.transition 1979, 9, :o2, 307486800 + tz.transition 1980, 4, :o3, 323816400 + tz.transition 1980, 9, :o2, 338940000 + tz.transition 1981, 3, :o3, 354672000 + tz.transition 1981, 9, :o2, 370396800 + tz.transition 1982, 3, :o3, 386121600 + tz.transition 1982, 9, :o2, 401846400 + tz.transition 1983, 3, :o3, 417571200 + tz.transition 1983, 9, :o2, 433296000 + tz.transition 1984, 3, :o3, 449020800 + tz.transition 1984, 9, :o2, 465350400 + tz.transition 1985, 3, :o3, 481075200 + tz.transition 1985, 9, :o2, 496800000 + tz.transition 1986, 3, :o3, 512524800 + tz.transition 1986, 9, :o2, 528249600 + tz.transition 1987, 3, :o3, 543974400 + tz.transition 1987, 9, :o2, 559699200 + tz.transition 1988, 3, :o3, 575424000 + tz.transition 1988, 9, :o2, 591148800 + tz.transition 1989, 3, :o3, 606873600 + tz.transition 1989, 9, :o2, 622598400 + tz.transition 1990, 3, :o3, 638323200 + tz.transition 1990, 9, :o2, 654652800 + tz.transition 1991, 3, :o3, 670370400 + tz.transition 1991, 9, :o2, 686095200 + tz.transition 1992, 3, :o3, 701820000 + tz.transition 1992, 9, :o2, 717544800 + tz.transition 1993, 3, :o3, 733269600 + tz.transition 1993, 9, :o2, 748994400 + tz.transition 1994, 3, :o3, 764719200 + tz.transition 1994, 9, :o2, 780440400 + tz.transition 1995, 3, :o3, 796168800 + tz.transition 1995, 9, :o2, 811890000 + tz.transition 1996, 3, :o3, 828223200 + tz.transition 1996, 10, :o2, 846363600 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb new file mode 100644 index 0000000000..1f3a9738b7 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb @@ -0,0 +1,197 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Budapest + include TimezoneDefinition + + timezone 'Europe/Budapest' do |tz| + tz.offset :o0, 4580, 0, :LMT + tz.offset :o1, 3600, 0, :CET + tz.offset :o2, 3600, 3600, :CEST + + tz.transition 1890, 9, :o1, 10418291051, 4320 + tz.transition 1916, 4, :o2, 29051813, 12 + tz.transition 1916, 9, :o1, 58107299, 24 + tz.transition 1917, 4, :o2, 58112029, 24 + tz.transition 1917, 9, :o1, 58115725, 24 + tz.transition 1918, 4, :o2, 29060215, 12 + tz.transition 1918, 9, :o1, 58124773, 24 + tz.transition 1919, 4, :o2, 29064763, 12 + tz.transition 1919, 9, :o1, 58133197, 24 + tz.transition 1920, 4, :o2, 29069035, 12 + tz.transition 1920, 9, :o1, 58142341, 24 + tz.transition 1941, 4, :o2, 58322173, 24 + tz.transition 1942, 11, :o1, 58335973, 24 + tz.transition 1943, 3, :o2, 58339501, 24 + tz.transition 1943, 10, :o1, 58344037, 24 + tz.transition 1944, 4, :o2, 58348405, 24 + tz.transition 1944, 10, :o1, 58352773, 24 + tz.transition 1945, 5, :o2, 29178929, 12 + tz.transition 1945, 11, :o1, 29181149, 12 + tz.transition 1946, 3, :o2, 58365853, 24 + tz.transition 1946, 10, :o1, 58370389, 24 + tz.transition 1947, 4, :o2, 58374757, 24 + tz.transition 1947, 10, :o1, 58379125, 24 + tz.transition 1948, 4, :o2, 58383493, 24 + tz.transition 1948, 10, :o1, 58387861, 24 + tz.transition 1949, 4, :o2, 58392397, 24 + tz.transition 1949, 10, :o1, 58396597, 24 + tz.transition 1950, 4, :o2, 58401325, 24 + tz.transition 1950, 10, :o1, 58405861, 24 + tz.transition 1954, 5, :o2, 58437251, 24 + tz.transition 1954, 10, :o1, 29220221, 12 + tz.transition 1955, 5, :o2, 58446011, 24 + tz.transition 1955, 10, :o1, 29224601, 12 + tz.transition 1956, 6, :o2, 58455059, 24 + tz.transition 1956, 9, :o1, 29228957, 12 + tz.transition 1957, 6, :o2, 4871983, 2 + tz.transition 1957, 9, :o1, 58466653, 24 + tz.transition 1980, 4, :o2, 323827200 + tz.transition 1980, 9, :o1, 338950800 + tz.transition 1981, 3, :o2, 354675600 + tz.transition 1981, 9, :o1, 370400400 + tz.transition 1982, 3, :o2, 386125200 + tz.transition 1982, 9, :o1, 401850000 + tz.transition 1983, 3, :o2, 417574800 + tz.transition 1983, 9, :o1, 433299600 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 9, :o1, 465354000 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 9, :o1, 496803600 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 9, :o1, 528253200 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 9, :o1, 559702800 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 9, :o1, 591152400 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 9, :o1, 622602000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 9, :o1, 654656400 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 9, :o1, 686106000 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 9, :o1, 717555600 + tz.transition 1993, 3, :o2, 733280400 + tz.transition 1993, 9, :o1, 749005200 + tz.transition 1994, 3, :o2, 764730000 + tz.transition 1994, 9, :o1, 780454800 + tz.transition 1995, 3, :o2, 796179600 + tz.transition 1995, 9, :o1, 811904400 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb new file mode 100644 index 0000000000..47cbaf14a7 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb @@ -0,0 +1,179 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Copenhagen + include TimezoneDefinition + + timezone 'Europe/Copenhagen' do |tz| + tz.offset :o0, 3020, 0, :LMT + tz.offset :o1, 3020, 0, :CMT + tz.offset :o2, 3600, 0, :CET + tz.offset :o3, 3600, 3600, :CEST + + tz.transition 1889, 12, :o1, 10417111769, 4320 + tz.transition 1893, 12, :o2, 10423423289, 4320 + tz.transition 1916, 5, :o3, 29051981, 12 + tz.transition 1916, 9, :o2, 19369099, 8 + tz.transition 1940, 5, :o3, 58314347, 24 + tz.transition 1942, 11, :o2, 58335973, 24 + tz.transition 1943, 3, :o3, 58339501, 24 + tz.transition 1943, 10, :o2, 58344037, 24 + tz.transition 1944, 4, :o3, 58348405, 24 + tz.transition 1944, 10, :o2, 58352773, 24 + tz.transition 1945, 4, :o3, 58357141, 24 + tz.transition 1945, 8, :o2, 58360381, 24 + tz.transition 1946, 5, :o3, 58366597, 24 + tz.transition 1946, 9, :o2, 58369549, 24 + tz.transition 1947, 5, :o3, 58375429, 24 + tz.transition 1947, 8, :o2, 58377781, 24 + tz.transition 1948, 5, :o3, 58384333, 24 + tz.transition 1948, 8, :o2, 58386517, 24 + tz.transition 1980, 4, :o3, 323830800 + tz.transition 1980, 9, :o2, 338950800 + tz.transition 1981, 3, :o3, 354675600 + tz.transition 1981, 9, :o2, 370400400 + tz.transition 1982, 3, :o3, 386125200 + tz.transition 1982, 9, :o2, 401850000 + tz.transition 1983, 3, :o3, 417574800 + tz.transition 1983, 9, :o2, 433299600 + tz.transition 1984, 3, :o3, 449024400 + tz.transition 1984, 9, :o2, 465354000 + tz.transition 1985, 3, :o3, 481078800 + tz.transition 1985, 9, :o2, 496803600 + tz.transition 1986, 3, :o3, 512528400 + tz.transition 1986, 9, :o2, 528253200 + tz.transition 1987, 3, :o3, 543978000 + tz.transition 1987, 9, :o2, 559702800 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb new file mode 100644 index 0000000000..0560bb5436 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb @@ -0,0 +1,276 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Dublin + include TimezoneDefinition + + timezone 'Europe/Dublin' do |tz| + tz.offset :o0, -1500, 0, :LMT + tz.offset :o1, -1521, 0, :DMT + tz.offset :o2, -1521, 3600, :IST + tz.offset :o3, 0, 0, :GMT + tz.offset :o4, 0, 3600, :BST + tz.offset :o5, 0, 3600, :IST + tz.offset :o6, 3600, 0, :IST + + tz.transition 1880, 8, :o1, 693483701, 288 + tz.transition 1916, 5, :o2, 7747214723, 3200 + tz.transition 1916, 10, :o3, 7747640323, 3200 + tz.transition 1917, 4, :o4, 29055919, 12 + tz.transition 1917, 9, :o3, 29057863, 12 + tz.transition 1918, 3, :o4, 29060119, 12 + tz.transition 1918, 9, :o3, 29062399, 12 + tz.transition 1919, 3, :o4, 29064571, 12 + tz.transition 1919, 9, :o3, 29066767, 12 + tz.transition 1920, 3, :o4, 29068939, 12 + tz.transition 1920, 10, :o3, 29071471, 12 + tz.transition 1921, 4, :o4, 29073391, 12 + tz.transition 1921, 10, :o3, 29075587, 12 + tz.transition 1922, 3, :o5, 29077675, 12 + tz.transition 1922, 10, :o3, 29080027, 12 + tz.transition 1923, 4, :o5, 29082379, 12 + tz.transition 1923, 9, :o3, 29084143, 12 + tz.transition 1924, 4, :o5, 29086663, 12 + tz.transition 1924, 9, :o3, 29088595, 12 + tz.transition 1925, 4, :o5, 29091115, 12 + tz.transition 1925, 10, :o3, 29093131, 12 + tz.transition 1926, 4, :o5, 29095483, 12 + tz.transition 1926, 10, :o3, 29097499, 12 + tz.transition 1927, 4, :o5, 29099767, 12 + tz.transition 1927, 10, :o3, 29101867, 12 + tz.transition 1928, 4, :o5, 29104303, 12 + tz.transition 1928, 10, :o3, 29106319, 12 + tz.transition 1929, 4, :o5, 29108671, 12 + tz.transition 1929, 10, :o3, 29110687, 12 + tz.transition 1930, 4, :o5, 29112955, 12 + tz.transition 1930, 10, :o3, 29115055, 12 + tz.transition 1931, 4, :o5, 29117407, 12 + tz.transition 1931, 10, :o3, 29119423, 12 + tz.transition 1932, 4, :o5, 29121775, 12 + tz.transition 1932, 10, :o3, 29123791, 12 + tz.transition 1933, 4, :o5, 29126059, 12 + tz.transition 1933, 10, :o3, 29128243, 12 + tz.transition 1934, 4, :o5, 29130595, 12 + tz.transition 1934, 10, :o3, 29132611, 12 + tz.transition 1935, 4, :o5, 29134879, 12 + tz.transition 1935, 10, :o3, 29136979, 12 + tz.transition 1936, 4, :o5, 29139331, 12 + tz.transition 1936, 10, :o3, 29141347, 12 + tz.transition 1937, 4, :o5, 29143699, 12 + tz.transition 1937, 10, :o3, 29145715, 12 + tz.transition 1938, 4, :o5, 29147983, 12 + tz.transition 1938, 10, :o3, 29150083, 12 + tz.transition 1939, 4, :o5, 29152435, 12 + tz.transition 1939, 11, :o3, 29155039, 12 + tz.transition 1940, 2, :o5, 29156215, 12 + tz.transition 1946, 10, :o3, 58370389, 24 + tz.transition 1947, 3, :o5, 29187127, 12 + tz.transition 1947, 11, :o3, 58379797, 24 + tz.transition 1948, 4, :o5, 29191915, 12 + tz.transition 1948, 10, :o3, 29194267, 12 + tz.transition 1949, 4, :o5, 29196115, 12 + tz.transition 1949, 10, :o3, 29198635, 12 + tz.transition 1950, 4, :o5, 29200651, 12 + tz.transition 1950, 10, :o3, 29202919, 12 + tz.transition 1951, 4, :o5, 29205019, 12 + tz.transition 1951, 10, :o3, 29207287, 12 + tz.transition 1952, 4, :o5, 29209471, 12 + tz.transition 1952, 10, :o3, 29211739, 12 + tz.transition 1953, 4, :o5, 29213839, 12 + tz.transition 1953, 10, :o3, 29215855, 12 + tz.transition 1954, 4, :o5, 29218123, 12 + tz.transition 1954, 10, :o3, 29220223, 12 + tz.transition 1955, 4, :o5, 29222575, 12 + tz.transition 1955, 10, :o3, 29224591, 12 + tz.transition 1956, 4, :o5, 29227027, 12 + tz.transition 1956, 10, :o3, 29229043, 12 + tz.transition 1957, 4, :o5, 29231311, 12 + tz.transition 1957, 10, :o3, 29233411, 12 + tz.transition 1958, 4, :o5, 29235763, 12 + tz.transition 1958, 10, :o3, 29237779, 12 + tz.transition 1959, 4, :o5, 29240131, 12 + tz.transition 1959, 10, :o3, 29242147, 12 + tz.transition 1960, 4, :o5, 29244415, 12 + tz.transition 1960, 10, :o3, 29246515, 12 + tz.transition 1961, 3, :o5, 29248615, 12 + tz.transition 1961, 10, :o3, 29251219, 12 + tz.transition 1962, 3, :o5, 29252983, 12 + tz.transition 1962, 10, :o3, 29255587, 12 + tz.transition 1963, 3, :o5, 29257435, 12 + tz.transition 1963, 10, :o3, 29259955, 12 + tz.transition 1964, 3, :o5, 29261719, 12 + tz.transition 1964, 10, :o3, 29264323, 12 + tz.transition 1965, 3, :o5, 29266087, 12 + tz.transition 1965, 10, :o3, 29268691, 12 + tz.transition 1966, 3, :o5, 29270455, 12 + tz.transition 1966, 10, :o3, 29273059, 12 + tz.transition 1967, 3, :o5, 29274823, 12 + tz.transition 1967, 10, :o3, 29277511, 12 + tz.transition 1968, 2, :o5, 29278855, 12 + tz.transition 1968, 10, :o6, 58563755, 24 + tz.transition 1971, 10, :o3, 57722400 + tz.transition 1972, 3, :o5, 69818400 + tz.transition 1972, 10, :o3, 89172000 + tz.transition 1973, 3, :o5, 101268000 + tz.transition 1973, 10, :o3, 120621600 + tz.transition 1974, 3, :o5, 132717600 + tz.transition 1974, 10, :o3, 152071200 + tz.transition 1975, 3, :o5, 164167200 + tz.transition 1975, 10, :o3, 183520800 + tz.transition 1976, 3, :o5, 196221600 + tz.transition 1976, 10, :o3, 214970400 + tz.transition 1977, 3, :o5, 227671200 + tz.transition 1977, 10, :o3, 246420000 + tz.transition 1978, 3, :o5, 259120800 + tz.transition 1978, 10, :o3, 278474400 + tz.transition 1979, 3, :o5, 290570400 + tz.transition 1979, 10, :o3, 309924000 + tz.transition 1980, 3, :o5, 322020000 + tz.transition 1980, 10, :o3, 341373600 + tz.transition 1981, 3, :o5, 354675600 + tz.transition 1981, 10, :o3, 372819600 + tz.transition 1982, 3, :o5, 386125200 + tz.transition 1982, 10, :o3, 404269200 + tz.transition 1983, 3, :o5, 417574800 + tz.transition 1983, 10, :o3, 435718800 + tz.transition 1984, 3, :o5, 449024400 + tz.transition 1984, 10, :o3, 467773200 + tz.transition 1985, 3, :o5, 481078800 + tz.transition 1985, 10, :o3, 499222800 + tz.transition 1986, 3, :o5, 512528400 + tz.transition 1986, 10, :o3, 530672400 + tz.transition 1987, 3, :o5, 543978000 + tz.transition 1987, 10, :o3, 562122000 + tz.transition 1988, 3, :o5, 575427600 + tz.transition 1988, 10, :o3, 593571600 + tz.transition 1989, 3, :o5, 606877200 + tz.transition 1989, 10, :o3, 625626000 + tz.transition 1990, 3, :o5, 638326800 + tz.transition 1990, 10, :o3, 657075600 + tz.transition 1991, 3, :o5, 670381200 + tz.transition 1991, 10, :o3, 688525200 + tz.transition 1992, 3, :o5, 701830800 + tz.transition 1992, 10, :o3, 719974800 + tz.transition 1993, 3, :o5, 733280400 + tz.transition 1993, 10, :o3, 751424400 + tz.transition 1994, 3, :o5, 764730000 + tz.transition 1994, 10, :o3, 782874000 + tz.transition 1995, 3, :o5, 796179600 + tz.transition 1995, 10, :o3, 814323600 + tz.transition 1996, 3, :o5, 828234000 + tz.transition 1996, 10, :o3, 846378000 + tz.transition 1997, 3, :o5, 859683600 + tz.transition 1997, 10, :o3, 877827600 + tz.transition 1998, 3, :o5, 891133200 + tz.transition 1998, 10, :o3, 909277200 + tz.transition 1999, 3, :o5, 922582800 + tz.transition 1999, 10, :o3, 941331600 + tz.transition 2000, 3, :o5, 954032400 + tz.transition 2000, 10, :o3, 972781200 + tz.transition 2001, 3, :o5, 985482000 + tz.transition 2001, 10, :o3, 1004230800 + tz.transition 2002, 3, :o5, 1017536400 + tz.transition 2002, 10, :o3, 1035680400 + tz.transition 2003, 3, :o5, 1048986000 + tz.transition 2003, 10, :o3, 1067130000 + tz.transition 2004, 3, :o5, 1080435600 + tz.transition 2004, 10, :o3, 1099184400 + tz.transition 2005, 3, :o5, 1111885200 + tz.transition 2005, 10, :o3, 1130634000 + tz.transition 2006, 3, :o5, 1143334800 + tz.transition 2006, 10, :o3, 1162083600 + tz.transition 2007, 3, :o5, 1174784400 + tz.transition 2007, 10, :o3, 1193533200 + tz.transition 2008, 3, :o5, 1206838800 + tz.transition 2008, 10, :o3, 1224982800 + tz.transition 2009, 3, :o5, 1238288400 + tz.transition 2009, 10, :o3, 1256432400 + tz.transition 2010, 3, :o5, 1269738000 + tz.transition 2010, 10, :o3, 1288486800 + tz.transition 2011, 3, :o5, 1301187600 + tz.transition 2011, 10, :o3, 1319936400 + tz.transition 2012, 3, :o5, 1332637200 + tz.transition 2012, 10, :o3, 1351386000 + tz.transition 2013, 3, :o5, 1364691600 + tz.transition 2013, 10, :o3, 1382835600 + tz.transition 2014, 3, :o5, 1396141200 + tz.transition 2014, 10, :o3, 1414285200 + tz.transition 2015, 3, :o5, 1427590800 + tz.transition 2015, 10, :o3, 1445734800 + tz.transition 2016, 3, :o5, 1459040400 + tz.transition 2016, 10, :o3, 1477789200 + tz.transition 2017, 3, :o5, 1490490000 + tz.transition 2017, 10, :o3, 1509238800 + tz.transition 2018, 3, :o5, 1521939600 + tz.transition 2018, 10, :o3, 1540688400 + tz.transition 2019, 3, :o5, 1553994000 + tz.transition 2019, 10, :o3, 1572138000 + tz.transition 2020, 3, :o5, 1585443600 + tz.transition 2020, 10, :o3, 1603587600 + tz.transition 2021, 3, :o5, 1616893200 + tz.transition 2021, 10, :o3, 1635642000 + tz.transition 2022, 3, :o5, 1648342800 + tz.transition 2022, 10, :o3, 1667091600 + tz.transition 2023, 3, :o5, 1679792400 + tz.transition 2023, 10, :o3, 1698541200 + tz.transition 2024, 3, :o5, 1711846800 + tz.transition 2024, 10, :o3, 1729990800 + tz.transition 2025, 3, :o5, 1743296400 + tz.transition 2025, 10, :o3, 1761440400 + tz.transition 2026, 3, :o5, 1774746000 + tz.transition 2026, 10, :o3, 1792890000 + tz.transition 2027, 3, :o5, 1806195600 + tz.transition 2027, 10, :o3, 1824944400 + tz.transition 2028, 3, :o5, 1837645200 + tz.transition 2028, 10, :o3, 1856394000 + tz.transition 2029, 3, :o5, 1869094800 + tz.transition 2029, 10, :o3, 1887843600 + tz.transition 2030, 3, :o5, 1901149200 + tz.transition 2030, 10, :o3, 1919293200 + tz.transition 2031, 3, :o5, 1932598800 + tz.transition 2031, 10, :o3, 1950742800 + tz.transition 2032, 3, :o5, 1964048400 + tz.transition 2032, 10, :o3, 1982797200 + tz.transition 2033, 3, :o5, 1995498000 + tz.transition 2033, 10, :o3, 2014246800 + tz.transition 2034, 3, :o5, 2026947600 + tz.transition 2034, 10, :o3, 2045696400 + tz.transition 2035, 3, :o5, 2058397200 + tz.transition 2035, 10, :o3, 2077146000 + tz.transition 2036, 3, :o5, 2090451600 + tz.transition 2036, 10, :o3, 2108595600 + tz.transition 2037, 3, :o5, 2121901200 + tz.transition 2037, 10, :o3, 2140045200 + tz.transition 2038, 3, :o5, 59172253, 24 + tz.transition 2038, 10, :o3, 59177461, 24 + tz.transition 2039, 3, :o5, 59180989, 24 + tz.transition 2039, 10, :o3, 59186197, 24 + tz.transition 2040, 3, :o5, 59189725, 24 + tz.transition 2040, 10, :o3, 59194933, 24 + tz.transition 2041, 3, :o5, 59198629, 24 + tz.transition 2041, 10, :o3, 59203669, 24 + tz.transition 2042, 3, :o5, 59207365, 24 + tz.transition 2042, 10, :o3, 59212405, 24 + tz.transition 2043, 3, :o5, 59216101, 24 + tz.transition 2043, 10, :o3, 59221141, 24 + tz.transition 2044, 3, :o5, 59224837, 24 + tz.transition 2044, 10, :o3, 59230045, 24 + tz.transition 2045, 3, :o5, 59233573, 24 + tz.transition 2045, 10, :o3, 59238781, 24 + tz.transition 2046, 3, :o5, 59242309, 24 + tz.transition 2046, 10, :o3, 59247517, 24 + tz.transition 2047, 3, :o5, 59251213, 24 + tz.transition 2047, 10, :o3, 59256253, 24 + tz.transition 2048, 3, :o5, 59259949, 24 + tz.transition 2048, 10, :o3, 59264989, 24 + tz.transition 2049, 3, :o5, 59268685, 24 + tz.transition 2049, 10, :o3, 59273893, 24 + tz.transition 2050, 3, :o5, 59277421, 24 + tz.transition 2050, 10, :o3, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb new file mode 100644 index 0000000000..13a806bcc7 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb @@ -0,0 +1,163 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Helsinki + include TimezoneDefinition + + timezone 'Europe/Helsinki' do |tz| + tz.offset :o0, 5992, 0, :LMT + tz.offset :o1, 5992, 0, :HMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 7200, 3600, :EEST + + tz.transition 1878, 5, :o1, 25997062651, 10800 + tz.transition 1921, 4, :o2, 26166352651, 10800 + tz.transition 1942, 4, :o3, 29165429, 12 + tz.transition 1942, 10, :o2, 19445083, 8 + tz.transition 1981, 3, :o3, 354675600 + tz.transition 1981, 9, :o2, 370400400 + tz.transition 1982, 3, :o3, 386125200 + tz.transition 1982, 9, :o2, 401850000 + tz.transition 1983, 3, :o3, 417574800 + tz.transition 1983, 9, :o2, 433299600 + tz.transition 1984, 3, :o3, 449024400 + tz.transition 1984, 9, :o2, 465354000 + tz.transition 1985, 3, :o3, 481078800 + tz.transition 1985, 9, :o2, 496803600 + tz.transition 1986, 3, :o3, 512528400 + tz.transition 1986, 9, :o2, 528253200 + tz.transition 1987, 3, :o3, 543978000 + tz.transition 1987, 9, :o2, 559702800 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb new file mode 100644 index 0000000000..8306c47536 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb @@ -0,0 +1,218 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Istanbul + include TimezoneDefinition + + timezone 'Europe/Istanbul' do |tz| + tz.offset :o0, 6952, 0, :LMT + tz.offset :o1, 7016, 0, :IMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 7200, 3600, :EEST + tz.offset :o4, 10800, 3600, :TRST + tz.offset :o5, 10800, 0, :TRT + + tz.transition 1879, 12, :o1, 26003326531, 10800 + tz.transition 1910, 9, :o2, 26124610523, 10800 + tz.transition 1916, 4, :o3, 29051813, 12 + tz.transition 1916, 9, :o2, 19369099, 8 + tz.transition 1920, 3, :o3, 29068937, 12 + tz.transition 1920, 10, :o2, 19380979, 8 + tz.transition 1921, 4, :o3, 29073389, 12 + tz.transition 1921, 10, :o2, 19383723, 8 + tz.transition 1922, 3, :o3, 29077673, 12 + tz.transition 1922, 10, :o2, 19386683, 8 + tz.transition 1924, 5, :o3, 29087021, 12 + tz.transition 1924, 9, :o2, 19392475, 8 + tz.transition 1925, 4, :o3, 29091257, 12 + tz.transition 1925, 9, :o2, 19395395, 8 + tz.transition 1940, 6, :o3, 29157725, 12 + tz.transition 1940, 10, :o2, 19439259, 8 + tz.transition 1940, 11, :o3, 29159573, 12 + tz.transition 1941, 9, :o2, 19442067, 8 + tz.transition 1942, 3, :o3, 29165405, 12 + tz.transition 1942, 10, :o2, 19445315, 8 + tz.transition 1945, 4, :o3, 29178569, 12 + tz.transition 1945, 10, :o2, 19453891, 8 + tz.transition 1946, 5, :o3, 29183669, 12 + tz.transition 1946, 9, :o2, 19456755, 8 + tz.transition 1947, 4, :o3, 29187545, 12 + tz.transition 1947, 10, :o2, 19459707, 8 + tz.transition 1948, 4, :o3, 29191913, 12 + tz.transition 1948, 10, :o2, 19462619, 8 + tz.transition 1949, 4, :o3, 29196197, 12 + tz.transition 1949, 10, :o2, 19465531, 8 + tz.transition 1950, 4, :o3, 29200685, 12 + tz.transition 1950, 10, :o2, 19468499, 8 + tz.transition 1951, 4, :o3, 29205101, 12 + tz.transition 1951, 10, :o2, 19471419, 8 + tz.transition 1962, 7, :o3, 29254325, 12 + tz.transition 1962, 10, :o2, 19503563, 8 + tz.transition 1964, 5, :o3, 29262365, 12 + tz.transition 1964, 9, :o2, 19509355, 8 + tz.transition 1970, 5, :o3, 10533600 + tz.transition 1970, 10, :o2, 23835600 + tz.transition 1971, 5, :o3, 41983200 + tz.transition 1971, 10, :o2, 55285200 + tz.transition 1972, 5, :o3, 74037600 + tz.transition 1972, 10, :o2, 87339600 + tz.transition 1973, 6, :o3, 107910000 + tz.transition 1973, 11, :o2, 121219200 + tz.transition 1974, 3, :o3, 133920000 + tz.transition 1974, 11, :o2, 152676000 + tz.transition 1975, 3, :o3, 165362400 + tz.transition 1975, 10, :o2, 183502800 + tz.transition 1976, 5, :o3, 202428000 + tz.transition 1976, 10, :o2, 215557200 + tz.transition 1977, 4, :o3, 228866400 + tz.transition 1977, 10, :o2, 245797200 + tz.transition 1978, 4, :o3, 260316000 + tz.transition 1978, 10, :o4, 277246800 + tz.transition 1979, 10, :o5, 308779200 + tz.transition 1980, 4, :o4, 323827200 + tz.transition 1980, 10, :o5, 340228800 + tz.transition 1981, 3, :o4, 354672000 + tz.transition 1981, 10, :o5, 371678400 + tz.transition 1982, 3, :o4, 386121600 + tz.transition 1982, 10, :o5, 403128000 + tz.transition 1983, 7, :o4, 428446800 + tz.transition 1983, 10, :o5, 433886400 + tz.transition 1985, 4, :o3, 482792400 + tz.transition 1985, 9, :o2, 496702800 + tz.transition 1986, 3, :o3, 512524800 + tz.transition 1986, 9, :o2, 528249600 + tz.transition 1987, 3, :o3, 543974400 + tz.transition 1987, 9, :o2, 559699200 + tz.transition 1988, 3, :o3, 575424000 + tz.transition 1988, 9, :o2, 591148800 + tz.transition 1989, 3, :o3, 606873600 + tz.transition 1989, 9, :o2, 622598400 + tz.transition 1990, 3, :o3, 638323200 + tz.transition 1990, 9, :o2, 654652800 + tz.transition 1991, 3, :o3, 670374000 + tz.transition 1991, 9, :o2, 686098800 + tz.transition 1992, 3, :o3, 701823600 + tz.transition 1992, 9, :o2, 717548400 + tz.transition 1993, 3, :o3, 733273200 + tz.transition 1993, 9, :o2, 748998000 + tz.transition 1994, 3, :o3, 764722800 + tz.transition 1994, 9, :o2, 780447600 + tz.transition 1995, 3, :o3, 796172400 + tz.transition 1995, 9, :o2, 811897200 + tz.transition 1996, 3, :o3, 828226800 + tz.transition 1996, 10, :o2, 846370800 + tz.transition 1997, 3, :o3, 859676400 + tz.transition 1997, 10, :o2, 877820400 + tz.transition 1998, 3, :o3, 891126000 + tz.transition 1998, 10, :o2, 909270000 + tz.transition 1999, 3, :o3, 922575600 + tz.transition 1999, 10, :o2, 941324400 + tz.transition 2000, 3, :o3, 954025200 + tz.transition 2000, 10, :o2, 972774000 + tz.transition 2001, 3, :o3, 985474800 + tz.transition 2001, 10, :o2, 1004223600 + tz.transition 2002, 3, :o3, 1017529200 + tz.transition 2002, 10, :o2, 1035673200 + tz.transition 2003, 3, :o3, 1048978800 + tz.transition 2003, 10, :o2, 1067122800 + tz.transition 2004, 3, :o3, 1080428400 + tz.transition 2004, 10, :o2, 1099177200 + tz.transition 2005, 3, :o3, 1111878000 + tz.transition 2005, 10, :o2, 1130626800 + tz.transition 2006, 3, :o3, 1143327600 + tz.transition 2006, 10, :o2, 1162076400 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb new file mode 100644 index 0000000000..513d3308be --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb @@ -0,0 +1,168 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Kiev + include TimezoneDefinition + + timezone 'Europe/Kiev' do |tz| + tz.offset :o0, 7324, 0, :LMT + tz.offset :o1, 7324, 0, :KMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 10800, 0, :MSK + tz.offset :o4, 3600, 3600, :CEST + tz.offset :o5, 3600, 0, :CET + tz.offset :o6, 10800, 3600, :MSD + tz.offset :o7, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 52006652969, 21600 + tz.transition 1924, 5, :o2, 52356400169, 21600 + tz.transition 1930, 6, :o3, 29113781, 12 + tz.transition 1941, 9, :o4, 19442059, 8 + tz.transition 1942, 11, :o5, 58335973, 24 + tz.transition 1943, 3, :o4, 58339501, 24 + tz.transition 1943, 10, :o5, 58344037, 24 + tz.transition 1943, 11, :o3, 58344827, 24 + tz.transition 1981, 3, :o6, 354920400 + tz.transition 1981, 9, :o3, 370728000 + tz.transition 1982, 3, :o6, 386456400 + tz.transition 1982, 9, :o3, 402264000 + tz.transition 1983, 3, :o6, 417992400 + tz.transition 1983, 9, :o3, 433800000 + tz.transition 1984, 3, :o6, 449614800 + tz.transition 1984, 9, :o3, 465346800 + tz.transition 1985, 3, :o6, 481071600 + tz.transition 1985, 9, :o3, 496796400 + tz.transition 1986, 3, :o6, 512521200 + tz.transition 1986, 9, :o3, 528246000 + tz.transition 1987, 3, :o6, 543970800 + tz.transition 1987, 9, :o3, 559695600 + tz.transition 1988, 3, :o6, 575420400 + tz.transition 1988, 9, :o3, 591145200 + tz.transition 1989, 3, :o6, 606870000 + tz.transition 1989, 9, :o3, 622594800 + tz.transition 1990, 6, :o2, 646786800 + tz.transition 1992, 3, :o7, 701820000 + tz.transition 1992, 9, :o2, 717541200 + tz.transition 1993, 3, :o7, 733269600 + tz.transition 1993, 9, :o2, 748990800 + tz.transition 1994, 3, :o7, 764719200 + tz.transition 1994, 9, :o2, 780440400 + tz.transition 1995, 3, :o7, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o7, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o7, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o7, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o7, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o7, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o7, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o7, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o7, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o7, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o7, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o7, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o7, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o7, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o7, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o7, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o7, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o7, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o7, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o7, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o7, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o7, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o7, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o7, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o7, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o7, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o7, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o7, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o7, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o7, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o7, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o7, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o7, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o7, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o7, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o7, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o7, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o7, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o7, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o7, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o7, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o7, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o7, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o7, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o7, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o7, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o7, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o7, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o7, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o7, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o7, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o7, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o7, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o7, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o7, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o7, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb new file mode 100644 index 0000000000..1c6d2a3d30 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb @@ -0,0 +1,268 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Lisbon + include TimezoneDefinition + + timezone 'Europe/Lisbon' do |tz| + tz.offset :o0, -2192, 0, :LMT + tz.offset :o1, 0, 0, :WET + tz.offset :o2, 0, 3600, :WEST + tz.offset :o3, 0, 7200, :WEMT + tz.offset :o4, 3600, 0, :CET + tz.offset :o5, 3600, 3600, :CEST + + tz.transition 1912, 1, :o1, 13064773637, 5400 + tz.transition 1916, 6, :o2, 58104779, 24 + tz.transition 1916, 11, :o1, 4842337, 2 + tz.transition 1917, 2, :o2, 58110923, 24 + tz.transition 1917, 10, :o1, 58116395, 24 + tz.transition 1918, 3, :o2, 58119707, 24 + tz.transition 1918, 10, :o1, 58125155, 24 + tz.transition 1919, 2, :o2, 58128443, 24 + tz.transition 1919, 10, :o1, 58133915, 24 + tz.transition 1920, 2, :o2, 58137227, 24 + tz.transition 1920, 10, :o1, 58142699, 24 + tz.transition 1921, 2, :o2, 58145987, 24 + tz.transition 1921, 10, :o1, 58151459, 24 + tz.transition 1924, 4, :o2, 58173419, 24 + tz.transition 1924, 10, :o1, 58177763, 24 + tz.transition 1926, 4, :o2, 58190963, 24 + tz.transition 1926, 10, :o1, 58194995, 24 + tz.transition 1927, 4, :o2, 58199531, 24 + tz.transition 1927, 10, :o1, 58203731, 24 + tz.transition 1928, 4, :o2, 58208435, 24 + tz.transition 1928, 10, :o1, 58212635, 24 + tz.transition 1929, 4, :o2, 58217339, 24 + tz.transition 1929, 10, :o1, 58221371, 24 + tz.transition 1931, 4, :o2, 58234811, 24 + tz.transition 1931, 10, :o1, 58238843, 24 + tz.transition 1932, 4, :o2, 58243211, 24 + tz.transition 1932, 10, :o1, 58247579, 24 + tz.transition 1934, 4, :o2, 58260851, 24 + tz.transition 1934, 10, :o1, 58265219, 24 + tz.transition 1935, 3, :o2, 58269419, 24 + tz.transition 1935, 10, :o1, 58273955, 24 + tz.transition 1936, 4, :o2, 58278659, 24 + tz.transition 1936, 10, :o1, 58282691, 24 + tz.transition 1937, 4, :o2, 58287059, 24 + tz.transition 1937, 10, :o1, 58291427, 24 + tz.transition 1938, 3, :o2, 58295627, 24 + tz.transition 1938, 10, :o1, 58300163, 24 + tz.transition 1939, 4, :o2, 58304867, 24 + tz.transition 1939, 11, :o1, 58310075, 24 + tz.transition 1940, 2, :o2, 58312427, 24 + tz.transition 1940, 10, :o1, 58317803, 24 + tz.transition 1941, 4, :o2, 58322171, 24 + tz.transition 1941, 10, :o1, 58326563, 24 + tz.transition 1942, 3, :o2, 58330403, 24 + tz.transition 1942, 4, :o3, 29165705, 12 + tz.transition 1942, 8, :o2, 29167049, 12 + tz.transition 1942, 10, :o1, 58335779, 24 + tz.transition 1943, 3, :o2, 58339139, 24 + tz.transition 1943, 4, :o3, 29169989, 12 + tz.transition 1943, 8, :o2, 29171585, 12 + tz.transition 1943, 10, :o1, 58344683, 24 + tz.transition 1944, 3, :o2, 58347875, 24 + tz.transition 1944, 4, :o3, 29174441, 12 + tz.transition 1944, 8, :o2, 29175953, 12 + tz.transition 1944, 10, :o1, 58353419, 24 + tz.transition 1945, 3, :o2, 58356611, 24 + tz.transition 1945, 4, :o3, 29178809, 12 + tz.transition 1945, 8, :o2, 29180321, 12 + tz.transition 1945, 10, :o1, 58362155, 24 + tz.transition 1946, 4, :o2, 58366019, 24 + tz.transition 1946, 10, :o1, 58370387, 24 + tz.transition 1947, 4, :o2, 29187379, 12 + tz.transition 1947, 10, :o1, 29189563, 12 + tz.transition 1948, 4, :o2, 29191747, 12 + tz.transition 1948, 10, :o1, 29193931, 12 + tz.transition 1949, 4, :o2, 29196115, 12 + tz.transition 1949, 10, :o1, 29198299, 12 + tz.transition 1951, 4, :o2, 29204851, 12 + tz.transition 1951, 10, :o1, 29207119, 12 + tz.transition 1952, 4, :o2, 29209303, 12 + tz.transition 1952, 10, :o1, 29211487, 12 + tz.transition 1953, 4, :o2, 29213671, 12 + tz.transition 1953, 10, :o1, 29215855, 12 + tz.transition 1954, 4, :o2, 29218039, 12 + tz.transition 1954, 10, :o1, 29220223, 12 + tz.transition 1955, 4, :o2, 29222407, 12 + tz.transition 1955, 10, :o1, 29224591, 12 + tz.transition 1956, 4, :o2, 29226775, 12 + tz.transition 1956, 10, :o1, 29229043, 12 + tz.transition 1957, 4, :o2, 29231227, 12 + tz.transition 1957, 10, :o1, 29233411, 12 + tz.transition 1958, 4, :o2, 29235595, 12 + tz.transition 1958, 10, :o1, 29237779, 12 + tz.transition 1959, 4, :o2, 29239963, 12 + tz.transition 1959, 10, :o1, 29242147, 12 + tz.transition 1960, 4, :o2, 29244331, 12 + tz.transition 1960, 10, :o1, 29246515, 12 + tz.transition 1961, 4, :o2, 29248699, 12 + tz.transition 1961, 10, :o1, 29250883, 12 + tz.transition 1962, 4, :o2, 29253067, 12 + tz.transition 1962, 10, :o1, 29255335, 12 + tz.transition 1963, 4, :o2, 29257519, 12 + tz.transition 1963, 10, :o1, 29259703, 12 + tz.transition 1964, 4, :o2, 29261887, 12 + tz.transition 1964, 10, :o1, 29264071, 12 + tz.transition 1965, 4, :o2, 29266255, 12 + tz.transition 1965, 10, :o1, 29268439, 12 + tz.transition 1966, 4, :o4, 29270623, 12 + tz.transition 1976, 9, :o1, 212544000 + tz.transition 1977, 3, :o2, 228268800 + tz.transition 1977, 9, :o1, 243993600 + tz.transition 1978, 4, :o2, 260323200 + tz.transition 1978, 10, :o1, 276048000 + tz.transition 1979, 4, :o2, 291772800 + tz.transition 1979, 9, :o1, 307501200 + tz.transition 1980, 3, :o2, 323222400 + tz.transition 1980, 9, :o1, 338950800 + tz.transition 1981, 3, :o2, 354675600 + tz.transition 1981, 9, :o1, 370400400 + tz.transition 1982, 3, :o2, 386125200 + tz.transition 1982, 9, :o1, 401850000 + tz.transition 1983, 3, :o2, 417578400 + tz.transition 1983, 9, :o1, 433299600 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 9, :o1, 465354000 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 9, :o1, 496803600 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 9, :o1, 528253200 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 9, :o1, 559702800 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 9, :o1, 591152400 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 9, :o1, 622602000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 9, :o1, 654656400 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 9, :o1, 686106000 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 9, :o4, 717555600 + tz.transition 1993, 3, :o5, 733280400 + tz.transition 1993, 9, :o4, 749005200 + tz.transition 1994, 3, :o5, 764730000 + tz.transition 1994, 9, :o4, 780454800 + tz.transition 1995, 3, :o5, 796179600 + tz.transition 1995, 9, :o4, 811904400 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb new file mode 100644 index 0000000000..a9828e6ef8 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb @@ -0,0 +1,13 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Ljubljana + include TimezoneDefinition + + linked_timezone 'Europe/Ljubljana', 'Europe/Belgrade' + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb new file mode 100644 index 0000000000..64ce41e900 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb @@ -0,0 +1,288 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module London + include TimezoneDefinition + + timezone 'Europe/London' do |tz| + tz.offset :o0, -75, 0, :LMT + tz.offset :o1, 0, 0, :GMT + tz.offset :o2, 0, 3600, :BST + tz.offset :o3, 0, 7200, :BDST + tz.offset :o4, 3600, 0, :BST + + tz.transition 1847, 12, :o1, 2760187969, 1152 + tz.transition 1916, 5, :o2, 29052055, 12 + tz.transition 1916, 10, :o1, 29053651, 12 + tz.transition 1917, 4, :o2, 29055919, 12 + tz.transition 1917, 9, :o1, 29057863, 12 + tz.transition 1918, 3, :o2, 29060119, 12 + tz.transition 1918, 9, :o1, 29062399, 12 + tz.transition 1919, 3, :o2, 29064571, 12 + tz.transition 1919, 9, :o1, 29066767, 12 + tz.transition 1920, 3, :o2, 29068939, 12 + tz.transition 1920, 10, :o1, 29071471, 12 + tz.transition 1921, 4, :o2, 29073391, 12 + tz.transition 1921, 10, :o1, 29075587, 12 + tz.transition 1922, 3, :o2, 29077675, 12 + tz.transition 1922, 10, :o1, 29080027, 12 + tz.transition 1923, 4, :o2, 29082379, 12 + tz.transition 1923, 9, :o1, 29084143, 12 + tz.transition 1924, 4, :o2, 29086663, 12 + tz.transition 1924, 9, :o1, 29088595, 12 + tz.transition 1925, 4, :o2, 29091115, 12 + tz.transition 1925, 10, :o1, 29093131, 12 + tz.transition 1926, 4, :o2, 29095483, 12 + tz.transition 1926, 10, :o1, 29097499, 12 + tz.transition 1927, 4, :o2, 29099767, 12 + tz.transition 1927, 10, :o1, 29101867, 12 + tz.transition 1928, 4, :o2, 29104303, 12 + tz.transition 1928, 10, :o1, 29106319, 12 + tz.transition 1929, 4, :o2, 29108671, 12 + tz.transition 1929, 10, :o1, 29110687, 12 + tz.transition 1930, 4, :o2, 29112955, 12 + tz.transition 1930, 10, :o1, 29115055, 12 + tz.transition 1931, 4, :o2, 29117407, 12 + tz.transition 1931, 10, :o1, 29119423, 12 + tz.transition 1932, 4, :o2, 29121775, 12 + tz.transition 1932, 10, :o1, 29123791, 12 + tz.transition 1933, 4, :o2, 29126059, 12 + tz.transition 1933, 10, :o1, 29128243, 12 + tz.transition 1934, 4, :o2, 29130595, 12 + tz.transition 1934, 10, :o1, 29132611, 12 + tz.transition 1935, 4, :o2, 29134879, 12 + tz.transition 1935, 10, :o1, 29136979, 12 + tz.transition 1936, 4, :o2, 29139331, 12 + tz.transition 1936, 10, :o1, 29141347, 12 + tz.transition 1937, 4, :o2, 29143699, 12 + tz.transition 1937, 10, :o1, 29145715, 12 + tz.transition 1938, 4, :o2, 29147983, 12 + tz.transition 1938, 10, :o1, 29150083, 12 + tz.transition 1939, 4, :o2, 29152435, 12 + tz.transition 1939, 11, :o1, 29155039, 12 + tz.transition 1940, 2, :o2, 29156215, 12 + tz.transition 1941, 5, :o3, 58322845, 24 + tz.transition 1941, 8, :o2, 58325197, 24 + tz.transition 1942, 4, :o3, 58330909, 24 + tz.transition 1942, 8, :o2, 58333933, 24 + tz.transition 1943, 4, :o3, 58339645, 24 + tz.transition 1943, 8, :o2, 58342837, 24 + tz.transition 1944, 4, :o3, 58348381, 24 + tz.transition 1944, 9, :o2, 58352413, 24 + tz.transition 1945, 4, :o3, 58357141, 24 + tz.transition 1945, 7, :o2, 58359637, 24 + tz.transition 1945, 10, :o1, 29180827, 12 + tz.transition 1946, 4, :o2, 29183095, 12 + tz.transition 1946, 10, :o1, 29185195, 12 + tz.transition 1947, 3, :o2, 29187127, 12 + tz.transition 1947, 4, :o3, 58374925, 24 + tz.transition 1947, 8, :o2, 58377781, 24 + tz.transition 1947, 11, :o1, 29189899, 12 + tz.transition 1948, 3, :o2, 29191495, 12 + tz.transition 1948, 10, :o1, 29194267, 12 + tz.transition 1949, 4, :o2, 29196115, 12 + tz.transition 1949, 10, :o1, 29198635, 12 + tz.transition 1950, 4, :o2, 29200651, 12 + tz.transition 1950, 10, :o1, 29202919, 12 + tz.transition 1951, 4, :o2, 29205019, 12 + tz.transition 1951, 10, :o1, 29207287, 12 + tz.transition 1952, 4, :o2, 29209471, 12 + tz.transition 1952, 10, :o1, 29211739, 12 + tz.transition 1953, 4, :o2, 29213839, 12 + tz.transition 1953, 10, :o1, 29215855, 12 + tz.transition 1954, 4, :o2, 29218123, 12 + tz.transition 1954, 10, :o1, 29220223, 12 + tz.transition 1955, 4, :o2, 29222575, 12 + tz.transition 1955, 10, :o1, 29224591, 12 + tz.transition 1956, 4, :o2, 29227027, 12 + tz.transition 1956, 10, :o1, 29229043, 12 + tz.transition 1957, 4, :o2, 29231311, 12 + tz.transition 1957, 10, :o1, 29233411, 12 + tz.transition 1958, 4, :o2, 29235763, 12 + tz.transition 1958, 10, :o1, 29237779, 12 + tz.transition 1959, 4, :o2, 29240131, 12 + tz.transition 1959, 10, :o1, 29242147, 12 + tz.transition 1960, 4, :o2, 29244415, 12 + tz.transition 1960, 10, :o1, 29246515, 12 + tz.transition 1961, 3, :o2, 29248615, 12 + tz.transition 1961, 10, :o1, 29251219, 12 + tz.transition 1962, 3, :o2, 29252983, 12 + tz.transition 1962, 10, :o1, 29255587, 12 + tz.transition 1963, 3, :o2, 29257435, 12 + tz.transition 1963, 10, :o1, 29259955, 12 + tz.transition 1964, 3, :o2, 29261719, 12 + tz.transition 1964, 10, :o1, 29264323, 12 + tz.transition 1965, 3, :o2, 29266087, 12 + tz.transition 1965, 10, :o1, 29268691, 12 + tz.transition 1966, 3, :o2, 29270455, 12 + tz.transition 1966, 10, :o1, 29273059, 12 + tz.transition 1967, 3, :o2, 29274823, 12 + tz.transition 1967, 10, :o1, 29277511, 12 + tz.transition 1968, 2, :o2, 29278855, 12 + tz.transition 1968, 10, :o4, 58563755, 24 + tz.transition 1971, 10, :o1, 57722400 + tz.transition 1972, 3, :o2, 69818400 + tz.transition 1972, 10, :o1, 89172000 + tz.transition 1973, 3, :o2, 101268000 + tz.transition 1973, 10, :o1, 120621600 + tz.transition 1974, 3, :o2, 132717600 + tz.transition 1974, 10, :o1, 152071200 + tz.transition 1975, 3, :o2, 164167200 + tz.transition 1975, 10, :o1, 183520800 + tz.transition 1976, 3, :o2, 196221600 + tz.transition 1976, 10, :o1, 214970400 + tz.transition 1977, 3, :o2, 227671200 + tz.transition 1977, 10, :o1, 246420000 + tz.transition 1978, 3, :o2, 259120800 + tz.transition 1978, 10, :o1, 278474400 + tz.transition 1979, 3, :o2, 290570400 + tz.transition 1979, 10, :o1, 309924000 + tz.transition 1980, 3, :o2, 322020000 + tz.transition 1980, 10, :o1, 341373600 + tz.transition 1981, 3, :o2, 354675600 + tz.transition 1981, 10, :o1, 372819600 + tz.transition 1982, 3, :o2, 386125200 + tz.transition 1982, 10, :o1, 404269200 + tz.transition 1983, 3, :o2, 417574800 + tz.transition 1983, 10, :o1, 435718800 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 10, :o1, 467773200 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 10, :o1, 499222800 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 10, :o1, 530672400 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 10, :o1, 562122000 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 10, :o1, 593571600 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 10, :o1, 625626000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 10, :o1, 657075600 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 10, :o1, 688525200 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 10, :o1, 719974800 + tz.transition 1993, 3, :o2, 733280400 + tz.transition 1993, 10, :o1, 751424400 + tz.transition 1994, 3, :o2, 764730000 + tz.transition 1994, 10, :o1, 782874000 + tz.transition 1995, 3, :o2, 796179600 + tz.transition 1995, 10, :o1, 814323600 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb new file mode 100644 index 0000000000..1fb568239a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb @@ -0,0 +1,211 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Madrid + include TimezoneDefinition + + timezone 'Europe/Madrid' do |tz| + tz.offset :o0, -884, 0, :LMT + tz.offset :o1, 0, 0, :WET + tz.offset :o2, 0, 3600, :WEST + tz.offset :o3, 0, 7200, :WEMT + tz.offset :o4, 3600, 0, :CET + tz.offset :o5, 3600, 3600, :CEST + + tz.transition 1901, 1, :o1, 52172327021, 21600 + tz.transition 1917, 5, :o2, 58112507, 24 + tz.transition 1917, 10, :o1, 58116203, 24 + tz.transition 1918, 4, :o2, 58120787, 24 + tz.transition 1918, 10, :o1, 58124963, 24 + tz.transition 1919, 4, :o2, 58129307, 24 + tz.transition 1919, 10, :o1, 58133723, 24 + tz.transition 1924, 4, :o2, 58173419, 24 + tz.transition 1924, 10, :o1, 58177523, 24 + tz.transition 1926, 4, :o2, 58190963, 24 + tz.transition 1926, 10, :o1, 58194995, 24 + tz.transition 1927, 4, :o2, 58199531, 24 + tz.transition 1927, 10, :o1, 58203731, 24 + tz.transition 1928, 4, :o2, 58208435, 24 + tz.transition 1928, 10, :o1, 58212635, 24 + tz.transition 1929, 4, :o2, 58217339, 24 + tz.transition 1929, 10, :o1, 58221371, 24 + tz.transition 1937, 5, :o2, 58288235, 24 + tz.transition 1937, 10, :o1, 58291427, 24 + tz.transition 1938, 3, :o2, 58295531, 24 + tz.transition 1938, 10, :o1, 58300163, 24 + tz.transition 1939, 4, :o2, 58304867, 24 + tz.transition 1939, 10, :o1, 58309067, 24 + tz.transition 1940, 3, :o2, 58312931, 24 + tz.transition 1942, 5, :o3, 29165789, 12 + tz.transition 1942, 9, :o2, 29167253, 12 + tz.transition 1943, 4, :o3, 29169989, 12 + tz.transition 1943, 10, :o2, 29172017, 12 + tz.transition 1944, 4, :o3, 29174357, 12 + tz.transition 1944, 10, :o2, 29176493, 12 + tz.transition 1945, 4, :o3, 29178725, 12 + tz.transition 1945, 9, :o2, 58361483, 24 + tz.transition 1946, 4, :o3, 29183093, 12 + tz.transition 1946, 9, :o4, 29185121, 12 + tz.transition 1949, 4, :o5, 29196449, 12 + tz.transition 1949, 9, :o4, 58396547, 24 + tz.transition 1974, 4, :o5, 135122400 + tz.transition 1974, 10, :o4, 150246000 + tz.transition 1975, 4, :o5, 167176800 + tz.transition 1975, 10, :o4, 181695600 + tz.transition 1976, 3, :o5, 196812000 + tz.transition 1976, 9, :o4, 212540400 + tz.transition 1977, 4, :o5, 228866400 + tz.transition 1977, 9, :o4, 243990000 + tz.transition 1978, 4, :o5, 260402400 + tz.transition 1978, 9, :o4, 276044400 + tz.transition 1979, 4, :o5, 291776400 + tz.transition 1979, 9, :o4, 307501200 + tz.transition 1980, 4, :o5, 323830800 + tz.transition 1980, 9, :o4, 338950800 + tz.transition 1981, 3, :o5, 354675600 + tz.transition 1981, 9, :o4, 370400400 + tz.transition 1982, 3, :o5, 386125200 + tz.transition 1982, 9, :o4, 401850000 + tz.transition 1983, 3, :o5, 417574800 + tz.transition 1983, 9, :o4, 433299600 + tz.transition 1984, 3, :o5, 449024400 + tz.transition 1984, 9, :o4, 465354000 + tz.transition 1985, 3, :o5, 481078800 + tz.transition 1985, 9, :o4, 496803600 + tz.transition 1986, 3, :o5, 512528400 + tz.transition 1986, 9, :o4, 528253200 + tz.transition 1987, 3, :o5, 543978000 + tz.transition 1987, 9, :o4, 559702800 + tz.transition 1988, 3, :o5, 575427600 + tz.transition 1988, 9, :o4, 591152400 + tz.transition 1989, 3, :o5, 606877200 + tz.transition 1989, 9, :o4, 622602000 + tz.transition 1990, 3, :o5, 638326800 + tz.transition 1990, 9, :o4, 654656400 + tz.transition 1991, 3, :o5, 670381200 + tz.transition 1991, 9, :o4, 686106000 + tz.transition 1992, 3, :o5, 701830800 + tz.transition 1992, 9, :o4, 717555600 + tz.transition 1993, 3, :o5, 733280400 + tz.transition 1993, 9, :o4, 749005200 + tz.transition 1994, 3, :o5, 764730000 + tz.transition 1994, 9, :o4, 780454800 + tz.transition 1995, 3, :o5, 796179600 + tz.transition 1995, 9, :o4, 811904400 + tz.transition 1996, 3, :o5, 828234000 + tz.transition 1996, 10, :o4, 846378000 + tz.transition 1997, 3, :o5, 859683600 + tz.transition 1997, 10, :o4, 877827600 + tz.transition 1998, 3, :o5, 891133200 + tz.transition 1998, 10, :o4, 909277200 + tz.transition 1999, 3, :o5, 922582800 + tz.transition 1999, 10, :o4, 941331600 + tz.transition 2000, 3, :o5, 954032400 + tz.transition 2000, 10, :o4, 972781200 + tz.transition 2001, 3, :o5, 985482000 + tz.transition 2001, 10, :o4, 1004230800 + tz.transition 2002, 3, :o5, 1017536400 + tz.transition 2002, 10, :o4, 1035680400 + tz.transition 2003, 3, :o5, 1048986000 + tz.transition 2003, 10, :o4, 1067130000 + tz.transition 2004, 3, :o5, 1080435600 + tz.transition 2004, 10, :o4, 1099184400 + tz.transition 2005, 3, :o5, 1111885200 + tz.transition 2005, 10, :o4, 1130634000 + tz.transition 2006, 3, :o5, 1143334800 + tz.transition 2006, 10, :o4, 1162083600 + tz.transition 2007, 3, :o5, 1174784400 + tz.transition 2007, 10, :o4, 1193533200 + tz.transition 2008, 3, :o5, 1206838800 + tz.transition 2008, 10, :o4, 1224982800 + tz.transition 2009, 3, :o5, 1238288400 + tz.transition 2009, 10, :o4, 1256432400 + tz.transition 2010, 3, :o5, 1269738000 + tz.transition 2010, 10, :o4, 1288486800 + tz.transition 2011, 3, :o5, 1301187600 + tz.transition 2011, 10, :o4, 1319936400 + tz.transition 2012, 3, :o5, 1332637200 + tz.transition 2012, 10, :o4, 1351386000 + tz.transition 2013, 3, :o5, 1364691600 + tz.transition 2013, 10, :o4, 1382835600 + tz.transition 2014, 3, :o5, 1396141200 + tz.transition 2014, 10, :o4, 1414285200 + tz.transition 2015, 3, :o5, 1427590800 + tz.transition 2015, 10, :o4, 1445734800 + tz.transition 2016, 3, :o5, 1459040400 + tz.transition 2016, 10, :o4, 1477789200 + tz.transition 2017, 3, :o5, 1490490000 + tz.transition 2017, 10, :o4, 1509238800 + tz.transition 2018, 3, :o5, 1521939600 + tz.transition 2018, 10, :o4, 1540688400 + tz.transition 2019, 3, :o5, 1553994000 + tz.transition 2019, 10, :o4, 1572138000 + tz.transition 2020, 3, :o5, 1585443600 + tz.transition 2020, 10, :o4, 1603587600 + tz.transition 2021, 3, :o5, 1616893200 + tz.transition 2021, 10, :o4, 1635642000 + tz.transition 2022, 3, :o5, 1648342800 + tz.transition 2022, 10, :o4, 1667091600 + tz.transition 2023, 3, :o5, 1679792400 + tz.transition 2023, 10, :o4, 1698541200 + tz.transition 2024, 3, :o5, 1711846800 + tz.transition 2024, 10, :o4, 1729990800 + tz.transition 2025, 3, :o5, 1743296400 + tz.transition 2025, 10, :o4, 1761440400 + tz.transition 2026, 3, :o5, 1774746000 + tz.transition 2026, 10, :o4, 1792890000 + tz.transition 2027, 3, :o5, 1806195600 + tz.transition 2027, 10, :o4, 1824944400 + tz.transition 2028, 3, :o5, 1837645200 + tz.transition 2028, 10, :o4, 1856394000 + tz.transition 2029, 3, :o5, 1869094800 + tz.transition 2029, 10, :o4, 1887843600 + tz.transition 2030, 3, :o5, 1901149200 + tz.transition 2030, 10, :o4, 1919293200 + tz.transition 2031, 3, :o5, 1932598800 + tz.transition 2031, 10, :o4, 1950742800 + tz.transition 2032, 3, :o5, 1964048400 + tz.transition 2032, 10, :o4, 1982797200 + tz.transition 2033, 3, :o5, 1995498000 + tz.transition 2033, 10, :o4, 2014246800 + tz.transition 2034, 3, :o5, 2026947600 + tz.transition 2034, 10, :o4, 2045696400 + tz.transition 2035, 3, :o5, 2058397200 + tz.transition 2035, 10, :o4, 2077146000 + tz.transition 2036, 3, :o5, 2090451600 + tz.transition 2036, 10, :o4, 2108595600 + tz.transition 2037, 3, :o5, 2121901200 + tz.transition 2037, 10, :o4, 2140045200 + tz.transition 2038, 3, :o5, 59172253, 24 + tz.transition 2038, 10, :o4, 59177461, 24 + tz.transition 2039, 3, :o5, 59180989, 24 + tz.transition 2039, 10, :o4, 59186197, 24 + tz.transition 2040, 3, :o5, 59189725, 24 + tz.transition 2040, 10, :o4, 59194933, 24 + tz.transition 2041, 3, :o5, 59198629, 24 + tz.transition 2041, 10, :o4, 59203669, 24 + tz.transition 2042, 3, :o5, 59207365, 24 + tz.transition 2042, 10, :o4, 59212405, 24 + tz.transition 2043, 3, :o5, 59216101, 24 + tz.transition 2043, 10, :o4, 59221141, 24 + tz.transition 2044, 3, :o5, 59224837, 24 + tz.transition 2044, 10, :o4, 59230045, 24 + tz.transition 2045, 3, :o5, 59233573, 24 + tz.transition 2045, 10, :o4, 59238781, 24 + tz.transition 2046, 3, :o5, 59242309, 24 + tz.transition 2046, 10, :o4, 59247517, 24 + tz.transition 2047, 3, :o5, 59251213, 24 + tz.transition 2047, 10, :o4, 59256253, 24 + tz.transition 2048, 3, :o5, 59259949, 24 + tz.transition 2048, 10, :o4, 59264989, 24 + tz.transition 2049, 3, :o5, 59268685, 24 + tz.transition 2049, 10, :o4, 59273893, 24 + tz.transition 2050, 3, :o5, 59277421, 24 + tz.transition 2050, 10, :o4, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb new file mode 100644 index 0000000000..fa15816cc8 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb @@ -0,0 +1,170 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Minsk + include TimezoneDefinition + + timezone 'Europe/Minsk' do |tz| + tz.offset :o0, 6616, 0, :LMT + tz.offset :o1, 6600, 0, :MMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 10800, 0, :MSK + tz.offset :o4, 3600, 3600, :CEST + tz.offset :o5, 3600, 0, :CET + tz.offset :o6, 10800, 3600, :MSD + tz.offset :o7, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 26003326573, 10800 + tz.transition 1924, 5, :o2, 349042669, 144 + tz.transition 1930, 6, :o3, 29113781, 12 + tz.transition 1941, 6, :o4, 19441387, 8 + tz.transition 1942, 11, :o5, 58335973, 24 + tz.transition 1943, 3, :o4, 58339501, 24 + tz.transition 1943, 10, :o5, 58344037, 24 + tz.transition 1944, 4, :o4, 58348405, 24 + tz.transition 1944, 7, :o3, 29175293, 12 + tz.transition 1981, 3, :o6, 354920400 + tz.transition 1981, 9, :o3, 370728000 + tz.transition 1982, 3, :o6, 386456400 + tz.transition 1982, 9, :o3, 402264000 + tz.transition 1983, 3, :o6, 417992400 + tz.transition 1983, 9, :o3, 433800000 + tz.transition 1984, 3, :o6, 449614800 + tz.transition 1984, 9, :o3, 465346800 + tz.transition 1985, 3, :o6, 481071600 + tz.transition 1985, 9, :o3, 496796400 + tz.transition 1986, 3, :o6, 512521200 + tz.transition 1986, 9, :o3, 528246000 + tz.transition 1987, 3, :o6, 543970800 + tz.transition 1987, 9, :o3, 559695600 + tz.transition 1988, 3, :o6, 575420400 + tz.transition 1988, 9, :o3, 591145200 + tz.transition 1989, 3, :o6, 606870000 + tz.transition 1989, 9, :o3, 622594800 + tz.transition 1991, 3, :o7, 670374000 + tz.transition 1991, 9, :o2, 686102400 + tz.transition 1992, 3, :o7, 701820000 + tz.transition 1992, 9, :o2, 717544800 + tz.transition 1993, 3, :o7, 733276800 + tz.transition 1993, 9, :o2, 749001600 + tz.transition 1994, 3, :o7, 764726400 + tz.transition 1994, 9, :o2, 780451200 + tz.transition 1995, 3, :o7, 796176000 + tz.transition 1995, 9, :o2, 811900800 + tz.transition 1996, 3, :o7, 828230400 + tz.transition 1996, 10, :o2, 846374400 + tz.transition 1997, 3, :o7, 859680000 + tz.transition 1997, 10, :o2, 877824000 + tz.transition 1998, 3, :o7, 891129600 + tz.transition 1998, 10, :o2, 909273600 + tz.transition 1999, 3, :o7, 922579200 + tz.transition 1999, 10, :o2, 941328000 + tz.transition 2000, 3, :o7, 954028800 + tz.transition 2000, 10, :o2, 972777600 + tz.transition 2001, 3, :o7, 985478400 + tz.transition 2001, 10, :o2, 1004227200 + tz.transition 2002, 3, :o7, 1017532800 + tz.transition 2002, 10, :o2, 1035676800 + tz.transition 2003, 3, :o7, 1048982400 + tz.transition 2003, 10, :o2, 1067126400 + tz.transition 2004, 3, :o7, 1080432000 + tz.transition 2004, 10, :o2, 1099180800 + tz.transition 2005, 3, :o7, 1111881600 + tz.transition 2005, 10, :o2, 1130630400 + tz.transition 2006, 3, :o7, 1143331200 + tz.transition 2006, 10, :o2, 1162080000 + tz.transition 2007, 3, :o7, 1174780800 + tz.transition 2007, 10, :o2, 1193529600 + tz.transition 2008, 3, :o7, 1206835200 + tz.transition 2008, 10, :o2, 1224979200 + tz.transition 2009, 3, :o7, 1238284800 + tz.transition 2009, 10, :o2, 1256428800 + tz.transition 2010, 3, :o7, 1269734400 + tz.transition 2010, 10, :o2, 1288483200 + tz.transition 2011, 3, :o7, 1301184000 + tz.transition 2011, 10, :o2, 1319932800 + tz.transition 2012, 3, :o7, 1332633600 + tz.transition 2012, 10, :o2, 1351382400 + tz.transition 2013, 3, :o7, 1364688000 + tz.transition 2013, 10, :o2, 1382832000 + tz.transition 2014, 3, :o7, 1396137600 + tz.transition 2014, 10, :o2, 1414281600 + tz.transition 2015, 3, :o7, 1427587200 + tz.transition 2015, 10, :o2, 1445731200 + tz.transition 2016, 3, :o7, 1459036800 + tz.transition 2016, 10, :o2, 1477785600 + tz.transition 2017, 3, :o7, 1490486400 + tz.transition 2017, 10, :o2, 1509235200 + tz.transition 2018, 3, :o7, 1521936000 + tz.transition 2018, 10, :o2, 1540684800 + tz.transition 2019, 3, :o7, 1553990400 + tz.transition 2019, 10, :o2, 1572134400 + tz.transition 2020, 3, :o7, 1585440000 + tz.transition 2020, 10, :o2, 1603584000 + tz.transition 2021, 3, :o7, 1616889600 + tz.transition 2021, 10, :o2, 1635638400 + tz.transition 2022, 3, :o7, 1648339200 + tz.transition 2022, 10, :o2, 1667088000 + tz.transition 2023, 3, :o7, 1679788800 + tz.transition 2023, 10, :o2, 1698537600 + tz.transition 2024, 3, :o7, 1711843200 + tz.transition 2024, 10, :o2, 1729987200 + tz.transition 2025, 3, :o7, 1743292800 + tz.transition 2025, 10, :o2, 1761436800 + tz.transition 2026, 3, :o7, 1774742400 + tz.transition 2026, 10, :o2, 1792886400 + tz.transition 2027, 3, :o7, 1806192000 + tz.transition 2027, 10, :o2, 1824940800 + tz.transition 2028, 3, :o7, 1837641600 + tz.transition 2028, 10, :o2, 1856390400 + tz.transition 2029, 3, :o7, 1869091200 + tz.transition 2029, 10, :o2, 1887840000 + tz.transition 2030, 3, :o7, 1901145600 + tz.transition 2030, 10, :o2, 1919289600 + tz.transition 2031, 3, :o7, 1932595200 + tz.transition 2031, 10, :o2, 1950739200 + tz.transition 2032, 3, :o7, 1964044800 + tz.transition 2032, 10, :o2, 1982793600 + tz.transition 2033, 3, :o7, 1995494400 + tz.transition 2033, 10, :o2, 2014243200 + tz.transition 2034, 3, :o7, 2026944000 + tz.transition 2034, 10, :o2, 2045692800 + tz.transition 2035, 3, :o7, 2058393600 + tz.transition 2035, 10, :o2, 2077142400 + tz.transition 2036, 3, :o7, 2090448000 + tz.transition 2036, 10, :o2, 2108592000 + tz.transition 2037, 3, :o7, 2121897600 + tz.transition 2037, 10, :o2, 2140041600 + tz.transition 2038, 3, :o7, 4931021, 2 + tz.transition 2038, 10, :o2, 4931455, 2 + tz.transition 2039, 3, :o7, 4931749, 2 + tz.transition 2039, 10, :o2, 4932183, 2 + tz.transition 2040, 3, :o7, 4932477, 2 + tz.transition 2040, 10, :o2, 4932911, 2 + tz.transition 2041, 3, :o7, 4933219, 2 + tz.transition 2041, 10, :o2, 4933639, 2 + tz.transition 2042, 3, :o7, 4933947, 2 + tz.transition 2042, 10, :o2, 4934367, 2 + tz.transition 2043, 3, :o7, 4934675, 2 + tz.transition 2043, 10, :o2, 4935095, 2 + tz.transition 2044, 3, :o7, 4935403, 2 + tz.transition 2044, 10, :o2, 4935837, 2 + tz.transition 2045, 3, :o7, 4936131, 2 + tz.transition 2045, 10, :o2, 4936565, 2 + tz.transition 2046, 3, :o7, 4936859, 2 + tz.transition 2046, 10, :o2, 4937293, 2 + tz.transition 2047, 3, :o7, 4937601, 2 + tz.transition 2047, 10, :o2, 4938021, 2 + tz.transition 2048, 3, :o7, 4938329, 2 + tz.transition 2048, 10, :o2, 4938749, 2 + tz.transition 2049, 3, :o7, 4939057, 2 + tz.transition 2049, 10, :o2, 4939491, 2 + tz.transition 2050, 3, :o7, 4939785, 2 + tz.transition 2050, 10, :o2, 4940219, 2 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb new file mode 100644 index 0000000000..ef269b675b --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb @@ -0,0 +1,181 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Moscow + include TimezoneDefinition + + timezone 'Europe/Moscow' do |tz| + tz.offset :o0, 9020, 0, :LMT + tz.offset :o1, 9000, 0, :MMT + tz.offset :o2, 9048, 0, :MMT + tz.offset :o3, 9048, 3600, :MST + tz.offset :o4, 9048, 7200, :MDST + tz.offset :o5, 10800, 3600, :MSD + tz.offset :o6, 10800, 0, :MSK + tz.offset :o7, 10800, 7200, :MSD + tz.offset :o8, 7200, 0, :EET + tz.offset :o9, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 10401330509, 4320 + tz.transition 1916, 7, :o2, 116210275, 48 + tz.transition 1917, 7, :o3, 8717080873, 3600 + tz.transition 1917, 12, :o2, 8717725273, 3600 + tz.transition 1918, 5, :o4, 8718283123, 3600 + tz.transition 1918, 9, :o3, 8718668473, 3600 + tz.transition 1919, 5, :o4, 8719597123, 3600 + tz.transition 1919, 6, :o5, 8719705423, 3600 + tz.transition 1919, 8, :o6, 7266559, 3 + tz.transition 1921, 2, :o5, 7268206, 3 + tz.transition 1921, 3, :o7, 58146463, 24 + tz.transition 1921, 8, :o5, 58150399, 24 + tz.transition 1921, 9, :o6, 7268890, 3 + tz.transition 1922, 9, :o8, 19386627, 8 + tz.transition 1930, 6, :o6, 29113781, 12 + tz.transition 1981, 3, :o5, 354920400 + tz.transition 1981, 9, :o6, 370728000 + tz.transition 1982, 3, :o5, 386456400 + tz.transition 1982, 9, :o6, 402264000 + tz.transition 1983, 3, :o5, 417992400 + tz.transition 1983, 9, :o6, 433800000 + tz.transition 1984, 3, :o5, 449614800 + tz.transition 1984, 9, :o6, 465346800 + tz.transition 1985, 3, :o5, 481071600 + tz.transition 1985, 9, :o6, 496796400 + tz.transition 1986, 3, :o5, 512521200 + tz.transition 1986, 9, :o6, 528246000 + tz.transition 1987, 3, :o5, 543970800 + tz.transition 1987, 9, :o6, 559695600 + tz.transition 1988, 3, :o5, 575420400 + tz.transition 1988, 9, :o6, 591145200 + tz.transition 1989, 3, :o5, 606870000 + tz.transition 1989, 9, :o6, 622594800 + tz.transition 1990, 3, :o5, 638319600 + tz.transition 1990, 9, :o6, 654649200 + tz.transition 1991, 3, :o9, 670374000 + tz.transition 1991, 9, :o8, 686102400 + tz.transition 1992, 1, :o6, 695779200 + tz.transition 1992, 3, :o5, 701812800 + tz.transition 1992, 9, :o6, 717534000 + tz.transition 1993, 3, :o5, 733273200 + tz.transition 1993, 9, :o6, 748998000 + tz.transition 1994, 3, :o5, 764722800 + tz.transition 1994, 9, :o6, 780447600 + tz.transition 1995, 3, :o5, 796172400 + tz.transition 1995, 9, :o6, 811897200 + tz.transition 1996, 3, :o5, 828226800 + tz.transition 1996, 10, :o6, 846370800 + tz.transition 1997, 3, :o5, 859676400 + tz.transition 1997, 10, :o6, 877820400 + tz.transition 1998, 3, :o5, 891126000 + tz.transition 1998, 10, :o6, 909270000 + tz.transition 1999, 3, :o5, 922575600 + tz.transition 1999, 10, :o6, 941324400 + tz.transition 2000, 3, :o5, 954025200 + tz.transition 2000, 10, :o6, 972774000 + tz.transition 2001, 3, :o5, 985474800 + tz.transition 2001, 10, :o6, 1004223600 + tz.transition 2002, 3, :o5, 1017529200 + tz.transition 2002, 10, :o6, 1035673200 + tz.transition 2003, 3, :o5, 1048978800 + tz.transition 2003, 10, :o6, 1067122800 + tz.transition 2004, 3, :o5, 1080428400 + tz.transition 2004, 10, :o6, 1099177200 + tz.transition 2005, 3, :o5, 1111878000 + tz.transition 2005, 10, :o6, 1130626800 + tz.transition 2006, 3, :o5, 1143327600 + tz.transition 2006, 10, :o6, 1162076400 + tz.transition 2007, 3, :o5, 1174777200 + tz.transition 2007, 10, :o6, 1193526000 + tz.transition 2008, 3, :o5, 1206831600 + tz.transition 2008, 10, :o6, 1224975600 + tz.transition 2009, 3, :o5, 1238281200 + tz.transition 2009, 10, :o6, 1256425200 + tz.transition 2010, 3, :o5, 1269730800 + tz.transition 2010, 10, :o6, 1288479600 + tz.transition 2011, 3, :o5, 1301180400 + tz.transition 2011, 10, :o6, 1319929200 + tz.transition 2012, 3, :o5, 1332630000 + tz.transition 2012, 10, :o6, 1351378800 + tz.transition 2013, 3, :o5, 1364684400 + tz.transition 2013, 10, :o6, 1382828400 + tz.transition 2014, 3, :o5, 1396134000 + tz.transition 2014, 10, :o6, 1414278000 + tz.transition 2015, 3, :o5, 1427583600 + tz.transition 2015, 10, :o6, 1445727600 + tz.transition 2016, 3, :o5, 1459033200 + tz.transition 2016, 10, :o6, 1477782000 + tz.transition 2017, 3, :o5, 1490482800 + tz.transition 2017, 10, :o6, 1509231600 + tz.transition 2018, 3, :o5, 1521932400 + tz.transition 2018, 10, :o6, 1540681200 + tz.transition 2019, 3, :o5, 1553986800 + tz.transition 2019, 10, :o6, 1572130800 + tz.transition 2020, 3, :o5, 1585436400 + tz.transition 2020, 10, :o6, 1603580400 + tz.transition 2021, 3, :o5, 1616886000 + tz.transition 2021, 10, :o6, 1635634800 + tz.transition 2022, 3, :o5, 1648335600 + tz.transition 2022, 10, :o6, 1667084400 + tz.transition 2023, 3, :o5, 1679785200 + tz.transition 2023, 10, :o6, 1698534000 + tz.transition 2024, 3, :o5, 1711839600 + tz.transition 2024, 10, :o6, 1729983600 + tz.transition 2025, 3, :o5, 1743289200 + tz.transition 2025, 10, :o6, 1761433200 + tz.transition 2026, 3, :o5, 1774738800 + tz.transition 2026, 10, :o6, 1792882800 + tz.transition 2027, 3, :o5, 1806188400 + tz.transition 2027, 10, :o6, 1824937200 + tz.transition 2028, 3, :o5, 1837638000 + tz.transition 2028, 10, :o6, 1856386800 + tz.transition 2029, 3, :o5, 1869087600 + tz.transition 2029, 10, :o6, 1887836400 + tz.transition 2030, 3, :o5, 1901142000 + tz.transition 2030, 10, :o6, 1919286000 + tz.transition 2031, 3, :o5, 1932591600 + tz.transition 2031, 10, :o6, 1950735600 + tz.transition 2032, 3, :o5, 1964041200 + tz.transition 2032, 10, :o6, 1982790000 + tz.transition 2033, 3, :o5, 1995490800 + tz.transition 2033, 10, :o6, 2014239600 + tz.transition 2034, 3, :o5, 2026940400 + tz.transition 2034, 10, :o6, 2045689200 + tz.transition 2035, 3, :o5, 2058390000 + tz.transition 2035, 10, :o6, 2077138800 + tz.transition 2036, 3, :o5, 2090444400 + tz.transition 2036, 10, :o6, 2108588400 + tz.transition 2037, 3, :o5, 2121894000 + tz.transition 2037, 10, :o6, 2140038000 + tz.transition 2038, 3, :o5, 59172251, 24 + tz.transition 2038, 10, :o6, 59177459, 24 + tz.transition 2039, 3, :o5, 59180987, 24 + tz.transition 2039, 10, :o6, 59186195, 24 + tz.transition 2040, 3, :o5, 59189723, 24 + tz.transition 2040, 10, :o6, 59194931, 24 + tz.transition 2041, 3, :o5, 59198627, 24 + tz.transition 2041, 10, :o6, 59203667, 24 + tz.transition 2042, 3, :o5, 59207363, 24 + tz.transition 2042, 10, :o6, 59212403, 24 + tz.transition 2043, 3, :o5, 59216099, 24 + tz.transition 2043, 10, :o6, 59221139, 24 + tz.transition 2044, 3, :o5, 59224835, 24 + tz.transition 2044, 10, :o6, 59230043, 24 + tz.transition 2045, 3, :o5, 59233571, 24 + tz.transition 2045, 10, :o6, 59238779, 24 + tz.transition 2046, 3, :o5, 59242307, 24 + tz.transition 2046, 10, :o6, 59247515, 24 + tz.transition 2047, 3, :o5, 59251211, 24 + tz.transition 2047, 10, :o6, 59256251, 24 + tz.transition 2048, 3, :o5, 59259947, 24 + tz.transition 2048, 10, :o6, 59264987, 24 + tz.transition 2049, 3, :o5, 59268683, 24 + tz.transition 2049, 10, :o6, 59273891, 24 + tz.transition 2050, 3, :o5, 59277419, 24 + tz.transition 2050, 10, :o6, 59282627, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb new file mode 100644 index 0000000000..e3236c0ba1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb @@ -0,0 +1,232 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Paris + include TimezoneDefinition + + timezone 'Europe/Paris' do |tz| + tz.offset :o0, 561, 0, :LMT + tz.offset :o1, 561, 0, :PMT + tz.offset :o2, 0, 0, :WET + tz.offset :o3, 0, 3600, :WEST + tz.offset :o4, 3600, 3600, :CEST + tz.offset :o5, 3600, 0, :CET + tz.offset :o6, 0, 7200, :WEMT + + tz.transition 1891, 3, :o1, 69460027033, 28800 + tz.transition 1911, 3, :o2, 69670267033, 28800 + tz.transition 1916, 6, :o3, 58104707, 24 + tz.transition 1916, 10, :o2, 58107323, 24 + tz.transition 1917, 3, :o3, 58111499, 24 + tz.transition 1917, 10, :o2, 58116227, 24 + tz.transition 1918, 3, :o3, 58119899, 24 + tz.transition 1918, 10, :o2, 58124963, 24 + tz.transition 1919, 3, :o3, 58128467, 24 + tz.transition 1919, 10, :o2, 58133699, 24 + tz.transition 1920, 2, :o3, 58136867, 24 + tz.transition 1920, 10, :o2, 58142915, 24 + tz.transition 1921, 3, :o3, 58146323, 24 + tz.transition 1921, 10, :o2, 58151723, 24 + tz.transition 1922, 3, :o3, 58155347, 24 + tz.transition 1922, 10, :o2, 58160051, 24 + tz.transition 1923, 5, :o3, 58165595, 24 + tz.transition 1923, 10, :o2, 58168787, 24 + tz.transition 1924, 3, :o3, 58172987, 24 + tz.transition 1924, 10, :o2, 58177523, 24 + tz.transition 1925, 4, :o3, 58181891, 24 + tz.transition 1925, 10, :o2, 58186259, 24 + tz.transition 1926, 4, :o3, 58190963, 24 + tz.transition 1926, 10, :o2, 58194995, 24 + tz.transition 1927, 4, :o3, 58199531, 24 + tz.transition 1927, 10, :o2, 58203731, 24 + tz.transition 1928, 4, :o3, 58208435, 24 + tz.transition 1928, 10, :o2, 58212635, 24 + tz.transition 1929, 4, :o3, 58217339, 24 + tz.transition 1929, 10, :o2, 58221371, 24 + tz.transition 1930, 4, :o3, 58225907, 24 + tz.transition 1930, 10, :o2, 58230107, 24 + tz.transition 1931, 4, :o3, 58234811, 24 + tz.transition 1931, 10, :o2, 58238843, 24 + tz.transition 1932, 4, :o3, 58243211, 24 + tz.transition 1932, 10, :o2, 58247579, 24 + tz.transition 1933, 3, :o3, 58251779, 24 + tz.transition 1933, 10, :o2, 58256483, 24 + tz.transition 1934, 4, :o3, 58260851, 24 + tz.transition 1934, 10, :o2, 58265219, 24 + tz.transition 1935, 3, :o3, 58269419, 24 + tz.transition 1935, 10, :o2, 58273955, 24 + tz.transition 1936, 4, :o3, 58278659, 24 + tz.transition 1936, 10, :o2, 58282691, 24 + tz.transition 1937, 4, :o3, 58287059, 24 + tz.transition 1937, 10, :o2, 58291427, 24 + tz.transition 1938, 3, :o3, 58295627, 24 + tz.transition 1938, 10, :o2, 58300163, 24 + tz.transition 1939, 4, :o3, 58304867, 24 + tz.transition 1939, 11, :o2, 58310075, 24 + tz.transition 1940, 2, :o3, 29156215, 12 + tz.transition 1940, 6, :o4, 29157545, 12 + tz.transition 1942, 11, :o5, 58335973, 24 + tz.transition 1943, 3, :o4, 58339501, 24 + tz.transition 1943, 10, :o5, 58344037, 24 + tz.transition 1944, 4, :o4, 58348405, 24 + tz.transition 1944, 8, :o6, 29175929, 12 + tz.transition 1944, 10, :o3, 58352915, 24 + tz.transition 1945, 4, :o6, 58357141, 24 + tz.transition 1945, 9, :o5, 58361149, 24 + tz.transition 1976, 3, :o4, 196819200 + tz.transition 1976, 9, :o5, 212540400 + tz.transition 1977, 4, :o4, 228877200 + tz.transition 1977, 9, :o5, 243997200 + tz.transition 1978, 4, :o4, 260326800 + tz.transition 1978, 10, :o5, 276051600 + tz.transition 1979, 4, :o4, 291776400 + tz.transition 1979, 9, :o5, 307501200 + tz.transition 1980, 4, :o4, 323830800 + tz.transition 1980, 9, :o5, 338950800 + tz.transition 1981, 3, :o4, 354675600 + tz.transition 1981, 9, :o5, 370400400 + tz.transition 1982, 3, :o4, 386125200 + tz.transition 1982, 9, :o5, 401850000 + tz.transition 1983, 3, :o4, 417574800 + tz.transition 1983, 9, :o5, 433299600 + tz.transition 1984, 3, :o4, 449024400 + tz.transition 1984, 9, :o5, 465354000 + tz.transition 1985, 3, :o4, 481078800 + tz.transition 1985, 9, :o5, 496803600 + tz.transition 1986, 3, :o4, 512528400 + tz.transition 1986, 9, :o5, 528253200 + tz.transition 1987, 3, :o4, 543978000 + tz.transition 1987, 9, :o5, 559702800 + tz.transition 1988, 3, :o4, 575427600 + tz.transition 1988, 9, :o5, 591152400 + tz.transition 1989, 3, :o4, 606877200 + tz.transition 1989, 9, :o5, 622602000 + tz.transition 1990, 3, :o4, 638326800 + tz.transition 1990, 9, :o5, 654656400 + tz.transition 1991, 3, :o4, 670381200 + tz.transition 1991, 9, :o5, 686106000 + tz.transition 1992, 3, :o4, 701830800 + tz.transition 1992, 9, :o5, 717555600 + tz.transition 1993, 3, :o4, 733280400 + tz.transition 1993, 9, :o5, 749005200 + tz.transition 1994, 3, :o4, 764730000 + tz.transition 1994, 9, :o5, 780454800 + tz.transition 1995, 3, :o4, 796179600 + tz.transition 1995, 9, :o5, 811904400 + tz.transition 1996, 3, :o4, 828234000 + tz.transition 1996, 10, :o5, 846378000 + tz.transition 1997, 3, :o4, 859683600 + tz.transition 1997, 10, :o5, 877827600 + tz.transition 1998, 3, :o4, 891133200 + tz.transition 1998, 10, :o5, 909277200 + tz.transition 1999, 3, :o4, 922582800 + tz.transition 1999, 10, :o5, 941331600 + tz.transition 2000, 3, :o4, 954032400 + tz.transition 2000, 10, :o5, 972781200 + tz.transition 2001, 3, :o4, 985482000 + tz.transition 2001, 10, :o5, 1004230800 + tz.transition 2002, 3, :o4, 1017536400 + tz.transition 2002, 10, :o5, 1035680400 + tz.transition 2003, 3, :o4, 1048986000 + tz.transition 2003, 10, :o5, 1067130000 + tz.transition 2004, 3, :o4, 1080435600 + tz.transition 2004, 10, :o5, 1099184400 + tz.transition 2005, 3, :o4, 1111885200 + tz.transition 2005, 10, :o5, 1130634000 + tz.transition 2006, 3, :o4, 1143334800 + tz.transition 2006, 10, :o5, 1162083600 + tz.transition 2007, 3, :o4, 1174784400 + tz.transition 2007, 10, :o5, 1193533200 + tz.transition 2008, 3, :o4, 1206838800 + tz.transition 2008, 10, :o5, 1224982800 + tz.transition 2009, 3, :o4, 1238288400 + tz.transition 2009, 10, :o5, 1256432400 + tz.transition 2010, 3, :o4, 1269738000 + tz.transition 2010, 10, :o5, 1288486800 + tz.transition 2011, 3, :o4, 1301187600 + tz.transition 2011, 10, :o5, 1319936400 + tz.transition 2012, 3, :o4, 1332637200 + tz.transition 2012, 10, :o5, 1351386000 + tz.transition 2013, 3, :o4, 1364691600 + tz.transition 2013, 10, :o5, 1382835600 + tz.transition 2014, 3, :o4, 1396141200 + tz.transition 2014, 10, :o5, 1414285200 + tz.transition 2015, 3, :o4, 1427590800 + tz.transition 2015, 10, :o5, 1445734800 + tz.transition 2016, 3, :o4, 1459040400 + tz.transition 2016, 10, :o5, 1477789200 + tz.transition 2017, 3, :o4, 1490490000 + tz.transition 2017, 10, :o5, 1509238800 + tz.transition 2018, 3, :o4, 1521939600 + tz.transition 2018, 10, :o5, 1540688400 + tz.transition 2019, 3, :o4, 1553994000 + tz.transition 2019, 10, :o5, 1572138000 + tz.transition 2020, 3, :o4, 1585443600 + tz.transition 2020, 10, :o5, 1603587600 + tz.transition 2021, 3, :o4, 1616893200 + tz.transition 2021, 10, :o5, 1635642000 + tz.transition 2022, 3, :o4, 1648342800 + tz.transition 2022, 10, :o5, 1667091600 + tz.transition 2023, 3, :o4, 1679792400 + tz.transition 2023, 10, :o5, 1698541200 + tz.transition 2024, 3, :o4, 1711846800 + tz.transition 2024, 10, :o5, 1729990800 + tz.transition 2025, 3, :o4, 1743296400 + tz.transition 2025, 10, :o5, 1761440400 + tz.transition 2026, 3, :o4, 1774746000 + tz.transition 2026, 10, :o5, 1792890000 + tz.transition 2027, 3, :o4, 1806195600 + tz.transition 2027, 10, :o5, 1824944400 + tz.transition 2028, 3, :o4, 1837645200 + tz.transition 2028, 10, :o5, 1856394000 + tz.transition 2029, 3, :o4, 1869094800 + tz.transition 2029, 10, :o5, 1887843600 + tz.transition 2030, 3, :o4, 1901149200 + tz.transition 2030, 10, :o5, 1919293200 + tz.transition 2031, 3, :o4, 1932598800 + tz.transition 2031, 10, :o5, 1950742800 + tz.transition 2032, 3, :o4, 1964048400 + tz.transition 2032, 10, :o5, 1982797200 + tz.transition 2033, 3, :o4, 1995498000 + tz.transition 2033, 10, :o5, 2014246800 + tz.transition 2034, 3, :o4, 2026947600 + tz.transition 2034, 10, :o5, 2045696400 + tz.transition 2035, 3, :o4, 2058397200 + tz.transition 2035, 10, :o5, 2077146000 + tz.transition 2036, 3, :o4, 2090451600 + tz.transition 2036, 10, :o5, 2108595600 + tz.transition 2037, 3, :o4, 2121901200 + tz.transition 2037, 10, :o5, 2140045200 + tz.transition 2038, 3, :o4, 59172253, 24 + tz.transition 2038, 10, :o5, 59177461, 24 + tz.transition 2039, 3, :o4, 59180989, 24 + tz.transition 2039, 10, :o5, 59186197, 24 + tz.transition 2040, 3, :o4, 59189725, 24 + tz.transition 2040, 10, :o5, 59194933, 24 + tz.transition 2041, 3, :o4, 59198629, 24 + tz.transition 2041, 10, :o5, 59203669, 24 + tz.transition 2042, 3, :o4, 59207365, 24 + tz.transition 2042, 10, :o5, 59212405, 24 + tz.transition 2043, 3, :o4, 59216101, 24 + tz.transition 2043, 10, :o5, 59221141, 24 + tz.transition 2044, 3, :o4, 59224837, 24 + tz.transition 2044, 10, :o5, 59230045, 24 + tz.transition 2045, 3, :o4, 59233573, 24 + tz.transition 2045, 10, :o5, 59238781, 24 + tz.transition 2046, 3, :o4, 59242309, 24 + tz.transition 2046, 10, :o5, 59247517, 24 + tz.transition 2047, 3, :o4, 59251213, 24 + tz.transition 2047, 10, :o5, 59256253, 24 + tz.transition 2048, 3, :o4, 59259949, 24 + tz.transition 2048, 10, :o5, 59264989, 24 + tz.transition 2049, 3, :o4, 59268685, 24 + tz.transition 2049, 10, :o5, 59273893, 24 + tz.transition 2050, 3, :o4, 59277421, 24 + tz.transition 2050, 10, :o5, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb new file mode 100644 index 0000000000..bcabee96c1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb @@ -0,0 +1,187 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Prague + include TimezoneDefinition + + timezone 'Europe/Prague' do |tz| + tz.offset :o0, 3464, 0, :LMT + tz.offset :o1, 3464, 0, :PMT + tz.offset :o2, 3600, 0, :CET + tz.offset :o3, 3600, 3600, :CEST + + tz.transition 1849, 12, :o1, 25884991367, 10800 + tz.transition 1891, 9, :o2, 26049669767, 10800 + tz.transition 1916, 4, :o3, 29051813, 12 + tz.transition 1916, 9, :o2, 58107299, 24 + tz.transition 1917, 4, :o3, 58112029, 24 + tz.transition 1917, 9, :o2, 58115725, 24 + tz.transition 1918, 4, :o3, 58120765, 24 + tz.transition 1918, 9, :o2, 58124461, 24 + tz.transition 1940, 4, :o3, 58313293, 24 + tz.transition 1942, 11, :o2, 58335973, 24 + tz.transition 1943, 3, :o3, 58339501, 24 + tz.transition 1943, 10, :o2, 58344037, 24 + tz.transition 1944, 4, :o3, 58348405, 24 + tz.transition 1944, 9, :o2, 58352413, 24 + tz.transition 1945, 4, :o3, 58357285, 24 + tz.transition 1945, 11, :o2, 58362661, 24 + tz.transition 1946, 5, :o3, 58366717, 24 + tz.transition 1946, 10, :o2, 58370389, 24 + tz.transition 1947, 4, :o3, 58375093, 24 + tz.transition 1947, 10, :o2, 58379125, 24 + tz.transition 1948, 4, :o3, 58383829, 24 + tz.transition 1948, 10, :o2, 58387861, 24 + tz.transition 1949, 4, :o3, 58392373, 24 + tz.transition 1949, 10, :o2, 58396597, 24 + tz.transition 1979, 4, :o3, 291776400 + tz.transition 1979, 9, :o2, 307501200 + tz.transition 1980, 4, :o3, 323830800 + tz.transition 1980, 9, :o2, 338950800 + tz.transition 1981, 3, :o3, 354675600 + tz.transition 1981, 9, :o2, 370400400 + tz.transition 1982, 3, :o3, 386125200 + tz.transition 1982, 9, :o2, 401850000 + tz.transition 1983, 3, :o3, 417574800 + tz.transition 1983, 9, :o2, 433299600 + tz.transition 1984, 3, :o3, 449024400 + tz.transition 1984, 9, :o2, 465354000 + tz.transition 1985, 3, :o3, 481078800 + tz.transition 1985, 9, :o2, 496803600 + tz.transition 1986, 3, :o3, 512528400 + tz.transition 1986, 9, :o2, 528253200 + tz.transition 1987, 3, :o3, 543978000 + tz.transition 1987, 9, :o2, 559702800 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb new file mode 100644 index 0000000000..784837f758 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb @@ -0,0 +1,176 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Riga + include TimezoneDefinition + + timezone 'Europe/Riga' do |tz| + tz.offset :o0, 5784, 0, :LMT + tz.offset :o1, 5784, 0, :RMT + tz.offset :o2, 5784, 3600, :LST + tz.offset :o3, 7200, 0, :EET + tz.offset :o4, 10800, 0, :MSK + tz.offset :o5, 3600, 3600, :CEST + tz.offset :o6, 3600, 0, :CET + tz.offset :o7, 10800, 3600, :MSD + tz.offset :o8, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 8667775559, 3600 + tz.transition 1918, 4, :o2, 8718114659, 3600 + tz.transition 1918, 9, :o1, 8718669059, 3600 + tz.transition 1919, 4, :o2, 8719378259, 3600 + tz.transition 1919, 5, :o1, 8719561859, 3600 + tz.transition 1926, 5, :o3, 8728727159, 3600 + tz.transition 1940, 8, :o4, 29158157, 12 + tz.transition 1941, 6, :o5, 19441411, 8 + tz.transition 1942, 11, :o6, 58335973, 24 + tz.transition 1943, 3, :o5, 58339501, 24 + tz.transition 1943, 10, :o6, 58344037, 24 + tz.transition 1944, 4, :o5, 58348405, 24 + tz.transition 1944, 10, :o6, 58352773, 24 + tz.transition 1944, 10, :o4, 58353035, 24 + tz.transition 1981, 3, :o7, 354920400 + tz.transition 1981, 9, :o4, 370728000 + tz.transition 1982, 3, :o7, 386456400 + tz.transition 1982, 9, :o4, 402264000 + tz.transition 1983, 3, :o7, 417992400 + tz.transition 1983, 9, :o4, 433800000 + tz.transition 1984, 3, :o7, 449614800 + tz.transition 1984, 9, :o4, 465346800 + tz.transition 1985, 3, :o7, 481071600 + tz.transition 1985, 9, :o4, 496796400 + tz.transition 1986, 3, :o7, 512521200 + tz.transition 1986, 9, :o4, 528246000 + tz.transition 1987, 3, :o7, 543970800 + tz.transition 1987, 9, :o4, 559695600 + tz.transition 1988, 3, :o7, 575420400 + tz.transition 1988, 9, :o4, 591145200 + tz.transition 1989, 3, :o8, 606870000 + tz.transition 1989, 9, :o3, 622598400 + tz.transition 1990, 3, :o8, 638323200 + tz.transition 1990, 9, :o3, 654652800 + tz.transition 1991, 3, :o8, 670377600 + tz.transition 1991, 9, :o3, 686102400 + tz.transition 1992, 3, :o8, 701827200 + tz.transition 1992, 9, :o3, 717552000 + tz.transition 1993, 3, :o8, 733276800 + tz.transition 1993, 9, :o3, 749001600 + tz.transition 1994, 3, :o8, 764726400 + tz.transition 1994, 9, :o3, 780451200 + tz.transition 1995, 3, :o8, 796176000 + tz.transition 1995, 9, :o3, 811900800 + tz.transition 1996, 3, :o8, 828230400 + tz.transition 1996, 9, :o3, 843955200 + tz.transition 1997, 3, :o8, 859683600 + tz.transition 1997, 10, :o3, 877827600 + tz.transition 1998, 3, :o8, 891133200 + tz.transition 1998, 10, :o3, 909277200 + tz.transition 1999, 3, :o8, 922582800 + tz.transition 1999, 10, :o3, 941331600 + tz.transition 2001, 3, :o8, 985482000 + tz.transition 2001, 10, :o3, 1004230800 + tz.transition 2002, 3, :o8, 1017536400 + tz.transition 2002, 10, :o3, 1035680400 + tz.transition 2003, 3, :o8, 1048986000 + tz.transition 2003, 10, :o3, 1067130000 + tz.transition 2004, 3, :o8, 1080435600 + tz.transition 2004, 10, :o3, 1099184400 + tz.transition 2005, 3, :o8, 1111885200 + tz.transition 2005, 10, :o3, 1130634000 + tz.transition 2006, 3, :o8, 1143334800 + tz.transition 2006, 10, :o3, 1162083600 + tz.transition 2007, 3, :o8, 1174784400 + tz.transition 2007, 10, :o3, 1193533200 + tz.transition 2008, 3, :o8, 1206838800 + tz.transition 2008, 10, :o3, 1224982800 + tz.transition 2009, 3, :o8, 1238288400 + tz.transition 2009, 10, :o3, 1256432400 + tz.transition 2010, 3, :o8, 1269738000 + tz.transition 2010, 10, :o3, 1288486800 + tz.transition 2011, 3, :o8, 1301187600 + tz.transition 2011, 10, :o3, 1319936400 + tz.transition 2012, 3, :o8, 1332637200 + tz.transition 2012, 10, :o3, 1351386000 + tz.transition 2013, 3, :o8, 1364691600 + tz.transition 2013, 10, :o3, 1382835600 + tz.transition 2014, 3, :o8, 1396141200 + tz.transition 2014, 10, :o3, 1414285200 + tz.transition 2015, 3, :o8, 1427590800 + tz.transition 2015, 10, :o3, 1445734800 + tz.transition 2016, 3, :o8, 1459040400 + tz.transition 2016, 10, :o3, 1477789200 + tz.transition 2017, 3, :o8, 1490490000 + tz.transition 2017, 10, :o3, 1509238800 + tz.transition 2018, 3, :o8, 1521939600 + tz.transition 2018, 10, :o3, 1540688400 + tz.transition 2019, 3, :o8, 1553994000 + tz.transition 2019, 10, :o3, 1572138000 + tz.transition 2020, 3, :o8, 1585443600 + tz.transition 2020, 10, :o3, 1603587600 + tz.transition 2021, 3, :o8, 1616893200 + tz.transition 2021, 10, :o3, 1635642000 + tz.transition 2022, 3, :o8, 1648342800 + tz.transition 2022, 10, :o3, 1667091600 + tz.transition 2023, 3, :o8, 1679792400 + tz.transition 2023, 10, :o3, 1698541200 + tz.transition 2024, 3, :o8, 1711846800 + tz.transition 2024, 10, :o3, 1729990800 + tz.transition 2025, 3, :o8, 1743296400 + tz.transition 2025, 10, :o3, 1761440400 + tz.transition 2026, 3, :o8, 1774746000 + tz.transition 2026, 10, :o3, 1792890000 + tz.transition 2027, 3, :o8, 1806195600 + tz.transition 2027, 10, :o3, 1824944400 + tz.transition 2028, 3, :o8, 1837645200 + tz.transition 2028, 10, :o3, 1856394000 + tz.transition 2029, 3, :o8, 1869094800 + tz.transition 2029, 10, :o3, 1887843600 + tz.transition 2030, 3, :o8, 1901149200 + tz.transition 2030, 10, :o3, 1919293200 + tz.transition 2031, 3, :o8, 1932598800 + tz.transition 2031, 10, :o3, 1950742800 + tz.transition 2032, 3, :o8, 1964048400 + tz.transition 2032, 10, :o3, 1982797200 + tz.transition 2033, 3, :o8, 1995498000 + tz.transition 2033, 10, :o3, 2014246800 + tz.transition 2034, 3, :o8, 2026947600 + tz.transition 2034, 10, :o3, 2045696400 + tz.transition 2035, 3, :o8, 2058397200 + tz.transition 2035, 10, :o3, 2077146000 + tz.transition 2036, 3, :o8, 2090451600 + tz.transition 2036, 10, :o3, 2108595600 + tz.transition 2037, 3, :o8, 2121901200 + tz.transition 2037, 10, :o3, 2140045200 + tz.transition 2038, 3, :o8, 59172253, 24 + tz.transition 2038, 10, :o3, 59177461, 24 + tz.transition 2039, 3, :o8, 59180989, 24 + tz.transition 2039, 10, :o3, 59186197, 24 + tz.transition 2040, 3, :o8, 59189725, 24 + tz.transition 2040, 10, :o3, 59194933, 24 + tz.transition 2041, 3, :o8, 59198629, 24 + tz.transition 2041, 10, :o3, 59203669, 24 + tz.transition 2042, 3, :o8, 59207365, 24 + tz.transition 2042, 10, :o3, 59212405, 24 + tz.transition 2043, 3, :o8, 59216101, 24 + tz.transition 2043, 10, :o3, 59221141, 24 + tz.transition 2044, 3, :o8, 59224837, 24 + tz.transition 2044, 10, :o3, 59230045, 24 + tz.transition 2045, 3, :o8, 59233573, 24 + tz.transition 2045, 10, :o3, 59238781, 24 + tz.transition 2046, 3, :o8, 59242309, 24 + tz.transition 2046, 10, :o3, 59247517, 24 + tz.transition 2047, 3, :o8, 59251213, 24 + tz.transition 2047, 10, :o3, 59256253, 24 + tz.transition 2048, 3, :o8, 59259949, 24 + tz.transition 2048, 10, :o3, 59264989, 24 + tz.transition 2049, 3, :o8, 59268685, 24 + tz.transition 2049, 10, :o3, 59273893, 24 + tz.transition 2050, 3, :o8, 59277421, 24 + tz.transition 2050, 10, :o3, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb new file mode 100644 index 0000000000..aa7b43d9d2 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb @@ -0,0 +1,215 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Rome + include TimezoneDefinition + + timezone 'Europe/Rome' do |tz| + tz.offset :o0, 2996, 0, :LMT + tz.offset :o1, 2996, 0, :RMT + tz.offset :o2, 3600, 0, :CET + tz.offset :o3, 3600, 3600, :CEST + + tz.transition 1866, 9, :o1, 51901915651, 21600 + tz.transition 1893, 10, :o2, 52115798851, 21600 + tz.transition 1916, 6, :o3, 58104419, 24 + tz.transition 1916, 9, :o2, 58107299, 24 + tz.transition 1917, 3, :o3, 58111667, 24 + tz.transition 1917, 9, :o2, 58116035, 24 + tz.transition 1918, 3, :o3, 58119899, 24 + tz.transition 1918, 10, :o2, 58124939, 24 + tz.transition 1919, 3, :o3, 58128467, 24 + tz.transition 1919, 10, :o2, 58133675, 24 + tz.transition 1920, 3, :o3, 58137707, 24 + tz.transition 1920, 9, :o2, 58142075, 24 + tz.transition 1940, 6, :o3, 58315091, 24 + tz.transition 1942, 11, :o2, 58335973, 24 + tz.transition 1943, 3, :o3, 58339501, 24 + tz.transition 1943, 10, :o2, 58344037, 24 + tz.transition 1944, 4, :o3, 58348405, 24 + tz.transition 1944, 9, :o2, 58352411, 24 + tz.transition 1945, 4, :o3, 58357141, 24 + tz.transition 1945, 9, :o2, 58361123, 24 + tz.transition 1946, 3, :o3, 58365517, 24 + tz.transition 1946, 10, :o2, 58370389, 24 + tz.transition 1947, 3, :o3, 58374251, 24 + tz.transition 1947, 10, :o2, 58379123, 24 + tz.transition 1948, 2, :o3, 58382653, 24 + tz.transition 1948, 10, :o2, 58387861, 24 + tz.transition 1966, 5, :o3, 58542419, 24 + tz.transition 1966, 9, :o2, 29272721, 12 + tz.transition 1967, 5, :o3, 58551323, 24 + tz.transition 1967, 9, :o2, 29277089, 12 + tz.transition 1968, 5, :o3, 58560059, 24 + tz.transition 1968, 9, :o2, 29281457, 12 + tz.transition 1969, 5, :o3, 58568963, 24 + tz.transition 1969, 9, :o2, 29285909, 12 + tz.transition 1970, 5, :o3, 12956400 + tz.transition 1970, 9, :o2, 23234400 + tz.transition 1971, 5, :o3, 43801200 + tz.transition 1971, 9, :o2, 54687600 + tz.transition 1972, 5, :o3, 75855600 + tz.transition 1972, 9, :o2, 86738400 + tz.transition 1973, 6, :o3, 107910000 + tz.transition 1973, 9, :o2, 118188000 + tz.transition 1974, 5, :o3, 138754800 + tz.transition 1974, 9, :o2, 149637600 + tz.transition 1975, 5, :o3, 170809200 + tz.transition 1975, 9, :o2, 181090800 + tz.transition 1976, 5, :o3, 202258800 + tz.transition 1976, 9, :o2, 212540400 + tz.transition 1977, 5, :o3, 233103600 + tz.transition 1977, 9, :o2, 243990000 + tz.transition 1978, 5, :o3, 265158000 + tz.transition 1978, 9, :o2, 276044400 + tz.transition 1979, 5, :o3, 296607600 + tz.transition 1979, 9, :o2, 307494000 + tz.transition 1980, 4, :o3, 323830800 + tz.transition 1980, 9, :o2, 338950800 + tz.transition 1981, 3, :o3, 354675600 + tz.transition 1981, 9, :o2, 370400400 + tz.transition 1982, 3, :o3, 386125200 + tz.transition 1982, 9, :o2, 401850000 + tz.transition 1983, 3, :o3, 417574800 + tz.transition 1983, 9, :o2, 433299600 + tz.transition 1984, 3, :o3, 449024400 + tz.transition 1984, 9, :o2, 465354000 + tz.transition 1985, 3, :o3, 481078800 + tz.transition 1985, 9, :o2, 496803600 + tz.transition 1986, 3, :o3, 512528400 + tz.transition 1986, 9, :o2, 528253200 + tz.transition 1987, 3, :o3, 543978000 + tz.transition 1987, 9, :o2, 559702800 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb new file mode 100644 index 0000000000..068c5fe6ad --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb @@ -0,0 +1,13 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Sarajevo + include TimezoneDefinition + + linked_timezone 'Europe/Sarajevo', 'Europe/Belgrade' + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb new file mode 100644 index 0000000000..10b71f285e --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb @@ -0,0 +1,13 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Skopje + include TimezoneDefinition + + linked_timezone 'Europe/Skopje', 'Europe/Belgrade' + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb new file mode 100644 index 0000000000..38a70eceb9 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb @@ -0,0 +1,173 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Sofia + include TimezoneDefinition + + timezone 'Europe/Sofia' do |tz| + tz.offset :o0, 5596, 0, :LMT + tz.offset :o1, 7016, 0, :IMT + tz.offset :o2, 7200, 0, :EET + tz.offset :o3, 3600, 0, :CET + tz.offset :o4, 3600, 3600, :CEST + tz.offset :o5, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 52006653401, 21600 + tz.transition 1894, 11, :o2, 26062154123, 10800 + tz.transition 1942, 11, :o3, 58335973, 24 + tz.transition 1943, 3, :o4, 58339501, 24 + tz.transition 1943, 10, :o3, 58344037, 24 + tz.transition 1944, 4, :o4, 58348405, 24 + tz.transition 1944, 10, :o3, 58352773, 24 + tz.transition 1945, 4, :o2, 29178571, 12 + tz.transition 1979, 3, :o5, 291762000 + tz.transition 1979, 9, :o2, 307576800 + tz.transition 1980, 4, :o5, 323816400 + tz.transition 1980, 9, :o2, 339026400 + tz.transition 1981, 4, :o5, 355266000 + tz.transition 1981, 9, :o2, 370393200 + tz.transition 1982, 4, :o5, 386715600 + tz.transition 1982, 9, :o2, 401846400 + tz.transition 1983, 3, :o5, 417571200 + tz.transition 1983, 9, :o2, 433296000 + tz.transition 1984, 3, :o5, 449020800 + tz.transition 1984, 9, :o2, 465350400 + tz.transition 1985, 3, :o5, 481075200 + tz.transition 1985, 9, :o2, 496800000 + tz.transition 1986, 3, :o5, 512524800 + tz.transition 1986, 9, :o2, 528249600 + tz.transition 1987, 3, :o5, 543974400 + tz.transition 1987, 9, :o2, 559699200 + tz.transition 1988, 3, :o5, 575424000 + tz.transition 1988, 9, :o2, 591148800 + tz.transition 1989, 3, :o5, 606873600 + tz.transition 1989, 9, :o2, 622598400 + tz.transition 1990, 3, :o5, 638323200 + tz.transition 1990, 9, :o2, 654652800 + tz.transition 1991, 3, :o5, 670370400 + tz.transition 1991, 9, :o2, 686091600 + tz.transition 1992, 3, :o5, 701820000 + tz.transition 1992, 9, :o2, 717541200 + tz.transition 1993, 3, :o5, 733269600 + tz.transition 1993, 9, :o2, 748990800 + tz.transition 1994, 3, :o5, 764719200 + tz.transition 1994, 9, :o2, 780440400 + tz.transition 1995, 3, :o5, 796168800 + tz.transition 1995, 9, :o2, 811890000 + tz.transition 1996, 3, :o5, 828223200 + tz.transition 1996, 10, :o2, 846363600 + tz.transition 1997, 3, :o5, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o5, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o5, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o5, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o5, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o5, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o5, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o5, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o5, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o5, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o5, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o5, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o5, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o5, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o5, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o5, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o5, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o5, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o5, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o5, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o5, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o5, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o5, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o5, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o5, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o5, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o5, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o5, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o5, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o5, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o5, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o5, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o5, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o5, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o5, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o5, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o5, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o5, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o5, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o5, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o5, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o5, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o5, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o5, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o5, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o5, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o5, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o5, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o5, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o5, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o5, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o5, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o5, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o5, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb new file mode 100644 index 0000000000..43db70fa61 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb @@ -0,0 +1,165 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Stockholm + include TimezoneDefinition + + timezone 'Europe/Stockholm' do |tz| + tz.offset :o0, 4332, 0, :LMT + tz.offset :o1, 3614, 0, :SET + tz.offset :o2, 3600, 0, :CET + tz.offset :o3, 3600, 3600, :CEST + + tz.transition 1878, 12, :o1, 17332923239, 7200 + tz.transition 1899, 12, :o2, 104328883793, 43200 + tz.transition 1916, 5, :o3, 29051981, 12 + tz.transition 1916, 9, :o2, 58107299, 24 + tz.transition 1980, 4, :o3, 323830800 + tz.transition 1980, 9, :o2, 338950800 + tz.transition 1981, 3, :o3, 354675600 + tz.transition 1981, 9, :o2, 370400400 + tz.transition 1982, 3, :o3, 386125200 + tz.transition 1982, 9, :o2, 401850000 + tz.transition 1983, 3, :o3, 417574800 + tz.transition 1983, 9, :o2, 433299600 + tz.transition 1984, 3, :o3, 449024400 + tz.transition 1984, 9, :o2, 465354000 + tz.transition 1985, 3, :o3, 481078800 + tz.transition 1985, 9, :o2, 496803600 + tz.transition 1986, 3, :o3, 512528400 + tz.transition 1986, 9, :o2, 528253200 + tz.transition 1987, 3, :o3, 543978000 + tz.transition 1987, 9, :o2, 559702800 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb new file mode 100644 index 0000000000..de5a8569f3 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb @@ -0,0 +1,172 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Tallinn + include TimezoneDefinition + + timezone 'Europe/Tallinn' do |tz| + tz.offset :o0, 5940, 0, :LMT + tz.offset :o1, 5940, 0, :TMT + tz.offset :o2, 3600, 0, :CET + tz.offset :o3, 3600, 3600, :CEST + tz.offset :o4, 7200, 0, :EET + tz.offset :o5, 10800, 0, :MSK + tz.offset :o6, 10800, 3600, :MSD + tz.offset :o7, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 385234469, 160 + tz.transition 1918, 1, :o2, 387460069, 160 + tz.transition 1918, 4, :o3, 58120765, 24 + tz.transition 1918, 9, :o2, 58124461, 24 + tz.transition 1919, 6, :o1, 58131371, 24 + tz.transition 1921, 4, :o4, 387649669, 160 + tz.transition 1940, 8, :o5, 29158169, 12 + tz.transition 1941, 9, :o3, 19442019, 8 + tz.transition 1942, 11, :o2, 58335973, 24 + tz.transition 1943, 3, :o3, 58339501, 24 + tz.transition 1943, 10, :o2, 58344037, 24 + tz.transition 1944, 4, :o3, 58348405, 24 + tz.transition 1944, 9, :o5, 29176265, 12 + tz.transition 1981, 3, :o6, 354920400 + tz.transition 1981, 9, :o5, 370728000 + tz.transition 1982, 3, :o6, 386456400 + tz.transition 1982, 9, :o5, 402264000 + tz.transition 1983, 3, :o6, 417992400 + tz.transition 1983, 9, :o5, 433800000 + tz.transition 1984, 3, :o6, 449614800 + tz.transition 1984, 9, :o5, 465346800 + tz.transition 1985, 3, :o6, 481071600 + tz.transition 1985, 9, :o5, 496796400 + tz.transition 1986, 3, :o6, 512521200 + tz.transition 1986, 9, :o5, 528246000 + tz.transition 1987, 3, :o6, 543970800 + tz.transition 1987, 9, :o5, 559695600 + tz.transition 1988, 3, :o6, 575420400 + tz.transition 1988, 9, :o5, 591145200 + tz.transition 1989, 3, :o7, 606870000 + tz.transition 1989, 9, :o4, 622598400 + tz.transition 1990, 3, :o7, 638323200 + tz.transition 1990, 9, :o4, 654652800 + tz.transition 1991, 3, :o7, 670377600 + tz.transition 1991, 9, :o4, 686102400 + tz.transition 1992, 3, :o7, 701827200 + tz.transition 1992, 9, :o4, 717552000 + tz.transition 1993, 3, :o7, 733276800 + tz.transition 1993, 9, :o4, 749001600 + tz.transition 1994, 3, :o7, 764726400 + tz.transition 1994, 9, :o4, 780451200 + tz.transition 1995, 3, :o7, 796176000 + tz.transition 1995, 9, :o4, 811900800 + tz.transition 1996, 3, :o7, 828230400 + tz.transition 1996, 10, :o4, 846374400 + tz.transition 1997, 3, :o7, 859680000 + tz.transition 1997, 10, :o4, 877824000 + tz.transition 1998, 3, :o7, 891129600 + tz.transition 1998, 10, :o4, 909277200 + tz.transition 1999, 3, :o7, 922582800 + tz.transition 1999, 10, :o4, 941331600 + tz.transition 2002, 3, :o7, 1017536400 + tz.transition 2002, 10, :o4, 1035680400 + tz.transition 2003, 3, :o7, 1048986000 + tz.transition 2003, 10, :o4, 1067130000 + tz.transition 2004, 3, :o7, 1080435600 + tz.transition 2004, 10, :o4, 1099184400 + tz.transition 2005, 3, :o7, 1111885200 + tz.transition 2005, 10, :o4, 1130634000 + tz.transition 2006, 3, :o7, 1143334800 + tz.transition 2006, 10, :o4, 1162083600 + tz.transition 2007, 3, :o7, 1174784400 + tz.transition 2007, 10, :o4, 1193533200 + tz.transition 2008, 3, :o7, 1206838800 + tz.transition 2008, 10, :o4, 1224982800 + tz.transition 2009, 3, :o7, 1238288400 + tz.transition 2009, 10, :o4, 1256432400 + tz.transition 2010, 3, :o7, 1269738000 + tz.transition 2010, 10, :o4, 1288486800 + tz.transition 2011, 3, :o7, 1301187600 + tz.transition 2011, 10, :o4, 1319936400 + tz.transition 2012, 3, :o7, 1332637200 + tz.transition 2012, 10, :o4, 1351386000 + tz.transition 2013, 3, :o7, 1364691600 + tz.transition 2013, 10, :o4, 1382835600 + tz.transition 2014, 3, :o7, 1396141200 + tz.transition 2014, 10, :o4, 1414285200 + tz.transition 2015, 3, :o7, 1427590800 + tz.transition 2015, 10, :o4, 1445734800 + tz.transition 2016, 3, :o7, 1459040400 + tz.transition 2016, 10, :o4, 1477789200 + tz.transition 2017, 3, :o7, 1490490000 + tz.transition 2017, 10, :o4, 1509238800 + tz.transition 2018, 3, :o7, 1521939600 + tz.transition 2018, 10, :o4, 1540688400 + tz.transition 2019, 3, :o7, 1553994000 + tz.transition 2019, 10, :o4, 1572138000 + tz.transition 2020, 3, :o7, 1585443600 + tz.transition 2020, 10, :o4, 1603587600 + tz.transition 2021, 3, :o7, 1616893200 + tz.transition 2021, 10, :o4, 1635642000 + tz.transition 2022, 3, :o7, 1648342800 + tz.transition 2022, 10, :o4, 1667091600 + tz.transition 2023, 3, :o7, 1679792400 + tz.transition 2023, 10, :o4, 1698541200 + tz.transition 2024, 3, :o7, 1711846800 + tz.transition 2024, 10, :o4, 1729990800 + tz.transition 2025, 3, :o7, 1743296400 + tz.transition 2025, 10, :o4, 1761440400 + tz.transition 2026, 3, :o7, 1774746000 + tz.transition 2026, 10, :o4, 1792890000 + tz.transition 2027, 3, :o7, 1806195600 + tz.transition 2027, 10, :o4, 1824944400 + tz.transition 2028, 3, :o7, 1837645200 + tz.transition 2028, 10, :o4, 1856394000 + tz.transition 2029, 3, :o7, 1869094800 + tz.transition 2029, 10, :o4, 1887843600 + tz.transition 2030, 3, :o7, 1901149200 + tz.transition 2030, 10, :o4, 1919293200 + tz.transition 2031, 3, :o7, 1932598800 + tz.transition 2031, 10, :o4, 1950742800 + tz.transition 2032, 3, :o7, 1964048400 + tz.transition 2032, 10, :o4, 1982797200 + tz.transition 2033, 3, :o7, 1995498000 + tz.transition 2033, 10, :o4, 2014246800 + tz.transition 2034, 3, :o7, 2026947600 + tz.transition 2034, 10, :o4, 2045696400 + tz.transition 2035, 3, :o7, 2058397200 + tz.transition 2035, 10, :o4, 2077146000 + tz.transition 2036, 3, :o7, 2090451600 + tz.transition 2036, 10, :o4, 2108595600 + tz.transition 2037, 3, :o7, 2121901200 + tz.transition 2037, 10, :o4, 2140045200 + tz.transition 2038, 3, :o7, 59172253, 24 + tz.transition 2038, 10, :o4, 59177461, 24 + tz.transition 2039, 3, :o7, 59180989, 24 + tz.transition 2039, 10, :o4, 59186197, 24 + tz.transition 2040, 3, :o7, 59189725, 24 + tz.transition 2040, 10, :o4, 59194933, 24 + tz.transition 2041, 3, :o7, 59198629, 24 + tz.transition 2041, 10, :o4, 59203669, 24 + tz.transition 2042, 3, :o7, 59207365, 24 + tz.transition 2042, 10, :o4, 59212405, 24 + tz.transition 2043, 3, :o7, 59216101, 24 + tz.transition 2043, 10, :o4, 59221141, 24 + tz.transition 2044, 3, :o7, 59224837, 24 + tz.transition 2044, 10, :o4, 59230045, 24 + tz.transition 2045, 3, :o7, 59233573, 24 + tz.transition 2045, 10, :o4, 59238781, 24 + tz.transition 2046, 3, :o7, 59242309, 24 + tz.transition 2046, 10, :o4, 59247517, 24 + tz.transition 2047, 3, :o7, 59251213, 24 + tz.transition 2047, 10, :o4, 59256253, 24 + tz.transition 2048, 3, :o7, 59259949, 24 + tz.transition 2048, 10, :o4, 59264989, 24 + tz.transition 2049, 3, :o7, 59268685, 24 + tz.transition 2049, 10, :o4, 59273893, 24 + tz.transition 2050, 3, :o7, 59277421, 24 + tz.transition 2050, 10, :o4, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb new file mode 100644 index 0000000000..990aabab66 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb @@ -0,0 +1,183 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Vienna + include TimezoneDefinition + + timezone 'Europe/Vienna' do |tz| + tz.offset :o0, 3920, 0, :LMT + tz.offset :o1, 3600, 0, :CET + tz.offset :o2, 3600, 3600, :CEST + + tz.transition 1893, 3, :o1, 2605558811, 1080 + tz.transition 1916, 4, :o2, 29051813, 12 + tz.transition 1916, 9, :o1, 58107299, 24 + tz.transition 1917, 4, :o2, 58112029, 24 + tz.transition 1917, 9, :o1, 58115725, 24 + tz.transition 1918, 4, :o2, 58120765, 24 + tz.transition 1918, 9, :o1, 58124461, 24 + tz.transition 1920, 4, :o2, 58138069, 24 + tz.transition 1920, 9, :o1, 58141933, 24 + tz.transition 1940, 4, :o2, 58313293, 24 + tz.transition 1942, 11, :o1, 58335973, 24 + tz.transition 1943, 3, :o2, 58339501, 24 + tz.transition 1943, 10, :o1, 58344037, 24 + tz.transition 1944, 4, :o2, 58348405, 24 + tz.transition 1944, 10, :o1, 58352773, 24 + tz.transition 1945, 4, :o2, 58357141, 24 + tz.transition 1945, 4, :o1, 58357381, 24 + tz.transition 1946, 4, :o2, 58366189, 24 + tz.transition 1946, 10, :o1, 58370389, 24 + tz.transition 1947, 4, :o2, 58374757, 24 + tz.transition 1947, 10, :o1, 58379125, 24 + tz.transition 1948, 4, :o2, 58383829, 24 + tz.transition 1948, 10, :o1, 58387861, 24 + tz.transition 1980, 4, :o2, 323823600 + tz.transition 1980, 9, :o1, 338940000 + tz.transition 1981, 3, :o2, 354675600 + tz.transition 1981, 9, :o1, 370400400 + tz.transition 1982, 3, :o2, 386125200 + tz.transition 1982, 9, :o1, 401850000 + tz.transition 1983, 3, :o2, 417574800 + tz.transition 1983, 9, :o1, 433299600 + tz.transition 1984, 3, :o2, 449024400 + tz.transition 1984, 9, :o1, 465354000 + tz.transition 1985, 3, :o2, 481078800 + tz.transition 1985, 9, :o1, 496803600 + tz.transition 1986, 3, :o2, 512528400 + tz.transition 1986, 9, :o1, 528253200 + tz.transition 1987, 3, :o2, 543978000 + tz.transition 1987, 9, :o1, 559702800 + tz.transition 1988, 3, :o2, 575427600 + tz.transition 1988, 9, :o1, 591152400 + tz.transition 1989, 3, :o2, 606877200 + tz.transition 1989, 9, :o1, 622602000 + tz.transition 1990, 3, :o2, 638326800 + tz.transition 1990, 9, :o1, 654656400 + tz.transition 1991, 3, :o2, 670381200 + tz.transition 1991, 9, :o1, 686106000 + tz.transition 1992, 3, :o2, 701830800 + tz.transition 1992, 9, :o1, 717555600 + tz.transition 1993, 3, :o2, 733280400 + tz.transition 1993, 9, :o1, 749005200 + tz.transition 1994, 3, :o2, 764730000 + tz.transition 1994, 9, :o1, 780454800 + tz.transition 1995, 3, :o2, 796179600 + tz.transition 1995, 9, :o1, 811904400 + tz.transition 1996, 3, :o2, 828234000 + tz.transition 1996, 10, :o1, 846378000 + tz.transition 1997, 3, :o2, 859683600 + tz.transition 1997, 10, :o1, 877827600 + tz.transition 1998, 3, :o2, 891133200 + tz.transition 1998, 10, :o1, 909277200 + tz.transition 1999, 3, :o2, 922582800 + tz.transition 1999, 10, :o1, 941331600 + tz.transition 2000, 3, :o2, 954032400 + tz.transition 2000, 10, :o1, 972781200 + tz.transition 2001, 3, :o2, 985482000 + tz.transition 2001, 10, :o1, 1004230800 + tz.transition 2002, 3, :o2, 1017536400 + tz.transition 2002, 10, :o1, 1035680400 + tz.transition 2003, 3, :o2, 1048986000 + tz.transition 2003, 10, :o1, 1067130000 + tz.transition 2004, 3, :o2, 1080435600 + tz.transition 2004, 10, :o1, 1099184400 + tz.transition 2005, 3, :o2, 1111885200 + tz.transition 2005, 10, :o1, 1130634000 + tz.transition 2006, 3, :o2, 1143334800 + tz.transition 2006, 10, :o1, 1162083600 + tz.transition 2007, 3, :o2, 1174784400 + tz.transition 2007, 10, :o1, 1193533200 + tz.transition 2008, 3, :o2, 1206838800 + tz.transition 2008, 10, :o1, 1224982800 + tz.transition 2009, 3, :o2, 1238288400 + tz.transition 2009, 10, :o1, 1256432400 + tz.transition 2010, 3, :o2, 1269738000 + tz.transition 2010, 10, :o1, 1288486800 + tz.transition 2011, 3, :o2, 1301187600 + tz.transition 2011, 10, :o1, 1319936400 + tz.transition 2012, 3, :o2, 1332637200 + tz.transition 2012, 10, :o1, 1351386000 + tz.transition 2013, 3, :o2, 1364691600 + tz.transition 2013, 10, :o1, 1382835600 + tz.transition 2014, 3, :o2, 1396141200 + tz.transition 2014, 10, :o1, 1414285200 + tz.transition 2015, 3, :o2, 1427590800 + tz.transition 2015, 10, :o1, 1445734800 + tz.transition 2016, 3, :o2, 1459040400 + tz.transition 2016, 10, :o1, 1477789200 + tz.transition 2017, 3, :o2, 1490490000 + tz.transition 2017, 10, :o1, 1509238800 + tz.transition 2018, 3, :o2, 1521939600 + tz.transition 2018, 10, :o1, 1540688400 + tz.transition 2019, 3, :o2, 1553994000 + tz.transition 2019, 10, :o1, 1572138000 + tz.transition 2020, 3, :o2, 1585443600 + tz.transition 2020, 10, :o1, 1603587600 + tz.transition 2021, 3, :o2, 1616893200 + tz.transition 2021, 10, :o1, 1635642000 + tz.transition 2022, 3, :o2, 1648342800 + tz.transition 2022, 10, :o1, 1667091600 + tz.transition 2023, 3, :o2, 1679792400 + tz.transition 2023, 10, :o1, 1698541200 + tz.transition 2024, 3, :o2, 1711846800 + tz.transition 2024, 10, :o1, 1729990800 + tz.transition 2025, 3, :o2, 1743296400 + tz.transition 2025, 10, :o1, 1761440400 + tz.transition 2026, 3, :o2, 1774746000 + tz.transition 2026, 10, :o1, 1792890000 + tz.transition 2027, 3, :o2, 1806195600 + tz.transition 2027, 10, :o1, 1824944400 + tz.transition 2028, 3, :o2, 1837645200 + tz.transition 2028, 10, :o1, 1856394000 + tz.transition 2029, 3, :o2, 1869094800 + tz.transition 2029, 10, :o1, 1887843600 + tz.transition 2030, 3, :o2, 1901149200 + tz.transition 2030, 10, :o1, 1919293200 + tz.transition 2031, 3, :o2, 1932598800 + tz.transition 2031, 10, :o1, 1950742800 + tz.transition 2032, 3, :o2, 1964048400 + tz.transition 2032, 10, :o1, 1982797200 + tz.transition 2033, 3, :o2, 1995498000 + tz.transition 2033, 10, :o1, 2014246800 + tz.transition 2034, 3, :o2, 2026947600 + tz.transition 2034, 10, :o1, 2045696400 + tz.transition 2035, 3, :o2, 2058397200 + tz.transition 2035, 10, :o1, 2077146000 + tz.transition 2036, 3, :o2, 2090451600 + tz.transition 2036, 10, :o1, 2108595600 + tz.transition 2037, 3, :o2, 2121901200 + tz.transition 2037, 10, :o1, 2140045200 + tz.transition 2038, 3, :o2, 59172253, 24 + tz.transition 2038, 10, :o1, 59177461, 24 + tz.transition 2039, 3, :o2, 59180989, 24 + tz.transition 2039, 10, :o1, 59186197, 24 + tz.transition 2040, 3, :o2, 59189725, 24 + tz.transition 2040, 10, :o1, 59194933, 24 + tz.transition 2041, 3, :o2, 59198629, 24 + tz.transition 2041, 10, :o1, 59203669, 24 + tz.transition 2042, 3, :o2, 59207365, 24 + tz.transition 2042, 10, :o1, 59212405, 24 + tz.transition 2043, 3, :o2, 59216101, 24 + tz.transition 2043, 10, :o1, 59221141, 24 + tz.transition 2044, 3, :o2, 59224837, 24 + tz.transition 2044, 10, :o1, 59230045, 24 + tz.transition 2045, 3, :o2, 59233573, 24 + tz.transition 2045, 10, :o1, 59238781, 24 + tz.transition 2046, 3, :o2, 59242309, 24 + tz.transition 2046, 10, :o1, 59247517, 24 + tz.transition 2047, 3, :o2, 59251213, 24 + tz.transition 2047, 10, :o1, 59256253, 24 + tz.transition 2048, 3, :o2, 59259949, 24 + tz.transition 2048, 10, :o1, 59264989, 24 + tz.transition 2049, 3, :o2, 59268685, 24 + tz.transition 2049, 10, :o1, 59273893, 24 + tz.transition 2050, 3, :o2, 59277421, 24 + tz.transition 2050, 10, :o1, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb new file mode 100644 index 0000000000..d89d095a75 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb @@ -0,0 +1,170 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Vilnius + include TimezoneDefinition + + timezone 'Europe/Vilnius' do |tz| + tz.offset :o0, 6076, 0, :LMT + tz.offset :o1, 5040, 0, :WMT + tz.offset :o2, 5736, 0, :KMT + tz.offset :o3, 3600, 0, :CET + tz.offset :o4, 7200, 0, :EET + tz.offset :o5, 10800, 0, :MSK + tz.offset :o6, 3600, 3600, :CEST + tz.offset :o7, 10800, 3600, :MSD + tz.offset :o8, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 52006653281, 21600 + tz.transition 1916, 12, :o2, 290547533, 120 + tz.transition 1919, 10, :o3, 8720069161, 3600 + tz.transition 1920, 7, :o4, 58140419, 24 + tz.transition 1920, 10, :o3, 29071277, 12 + tz.transition 1940, 8, :o5, 58316267, 24 + tz.transition 1941, 6, :o6, 19441355, 8 + tz.transition 1942, 11, :o3, 58335973, 24 + tz.transition 1943, 3, :o6, 58339501, 24 + tz.transition 1943, 10, :o3, 58344037, 24 + tz.transition 1944, 4, :o6, 58348405, 24 + tz.transition 1944, 7, :o5, 29175641, 12 + tz.transition 1981, 3, :o7, 354920400 + tz.transition 1981, 9, :o5, 370728000 + tz.transition 1982, 3, :o7, 386456400 + tz.transition 1982, 9, :o5, 402264000 + tz.transition 1983, 3, :o7, 417992400 + tz.transition 1983, 9, :o5, 433800000 + tz.transition 1984, 3, :o7, 449614800 + tz.transition 1984, 9, :o5, 465346800 + tz.transition 1985, 3, :o7, 481071600 + tz.transition 1985, 9, :o5, 496796400 + tz.transition 1986, 3, :o7, 512521200 + tz.transition 1986, 9, :o5, 528246000 + tz.transition 1987, 3, :o7, 543970800 + tz.transition 1987, 9, :o5, 559695600 + tz.transition 1988, 3, :o7, 575420400 + tz.transition 1988, 9, :o5, 591145200 + tz.transition 1989, 3, :o7, 606870000 + tz.transition 1989, 9, :o5, 622594800 + tz.transition 1990, 3, :o7, 638319600 + tz.transition 1990, 9, :o5, 654649200 + tz.transition 1991, 3, :o8, 670374000 + tz.transition 1991, 9, :o4, 686102400 + tz.transition 1992, 3, :o8, 701827200 + tz.transition 1992, 9, :o4, 717552000 + tz.transition 1993, 3, :o8, 733276800 + tz.transition 1993, 9, :o4, 749001600 + tz.transition 1994, 3, :o8, 764726400 + tz.transition 1994, 9, :o4, 780451200 + tz.transition 1995, 3, :o8, 796176000 + tz.transition 1995, 9, :o4, 811900800 + tz.transition 1996, 3, :o8, 828230400 + tz.transition 1996, 10, :o4, 846374400 + tz.transition 1997, 3, :o8, 859680000 + tz.transition 1997, 10, :o4, 877824000 + tz.transition 1998, 3, :o6, 891133200 + tz.transition 1998, 10, :o3, 909277200 + tz.transition 1999, 3, :o6, 922582800 + tz.transition 1999, 10, :o4, 941331600 + tz.transition 2003, 3, :o8, 1048986000 + tz.transition 2003, 10, :o4, 1067130000 + tz.transition 2004, 3, :o8, 1080435600 + tz.transition 2004, 10, :o4, 1099184400 + tz.transition 2005, 3, :o8, 1111885200 + tz.transition 2005, 10, :o4, 1130634000 + tz.transition 2006, 3, :o8, 1143334800 + tz.transition 2006, 10, :o4, 1162083600 + tz.transition 2007, 3, :o8, 1174784400 + tz.transition 2007, 10, :o4, 1193533200 + tz.transition 2008, 3, :o8, 1206838800 + tz.transition 2008, 10, :o4, 1224982800 + tz.transition 2009, 3, :o8, 1238288400 + tz.transition 2009, 10, :o4, 1256432400 + tz.transition 2010, 3, :o8, 1269738000 + tz.transition 2010, 10, :o4, 1288486800 + tz.transition 2011, 3, :o8, 1301187600 + tz.transition 2011, 10, :o4, 1319936400 + tz.transition 2012, 3, :o8, 1332637200 + tz.transition 2012, 10, :o4, 1351386000 + tz.transition 2013, 3, :o8, 1364691600 + tz.transition 2013, 10, :o4, 1382835600 + tz.transition 2014, 3, :o8, 1396141200 + tz.transition 2014, 10, :o4, 1414285200 + tz.transition 2015, 3, :o8, 1427590800 + tz.transition 2015, 10, :o4, 1445734800 + tz.transition 2016, 3, :o8, 1459040400 + tz.transition 2016, 10, :o4, 1477789200 + tz.transition 2017, 3, :o8, 1490490000 + tz.transition 2017, 10, :o4, 1509238800 + tz.transition 2018, 3, :o8, 1521939600 + tz.transition 2018, 10, :o4, 1540688400 + tz.transition 2019, 3, :o8, 1553994000 + tz.transition 2019, 10, :o4, 1572138000 + tz.transition 2020, 3, :o8, 1585443600 + tz.transition 2020, 10, :o4, 1603587600 + tz.transition 2021, 3, :o8, 1616893200 + tz.transition 2021, 10, :o4, 1635642000 + tz.transition 2022, 3, :o8, 1648342800 + tz.transition 2022, 10, :o4, 1667091600 + tz.transition 2023, 3, :o8, 1679792400 + tz.transition 2023, 10, :o4, 1698541200 + tz.transition 2024, 3, :o8, 1711846800 + tz.transition 2024, 10, :o4, 1729990800 + tz.transition 2025, 3, :o8, 1743296400 + tz.transition 2025, 10, :o4, 1761440400 + tz.transition 2026, 3, :o8, 1774746000 + tz.transition 2026, 10, :o4, 1792890000 + tz.transition 2027, 3, :o8, 1806195600 + tz.transition 2027, 10, :o4, 1824944400 + tz.transition 2028, 3, :o8, 1837645200 + tz.transition 2028, 10, :o4, 1856394000 + tz.transition 2029, 3, :o8, 1869094800 + tz.transition 2029, 10, :o4, 1887843600 + tz.transition 2030, 3, :o8, 1901149200 + tz.transition 2030, 10, :o4, 1919293200 + tz.transition 2031, 3, :o8, 1932598800 + tz.transition 2031, 10, :o4, 1950742800 + tz.transition 2032, 3, :o8, 1964048400 + tz.transition 2032, 10, :o4, 1982797200 + tz.transition 2033, 3, :o8, 1995498000 + tz.transition 2033, 10, :o4, 2014246800 + tz.transition 2034, 3, :o8, 2026947600 + tz.transition 2034, 10, :o4, 2045696400 + tz.transition 2035, 3, :o8, 2058397200 + tz.transition 2035, 10, :o4, 2077146000 + tz.transition 2036, 3, :o8, 2090451600 + tz.transition 2036, 10, :o4, 2108595600 + tz.transition 2037, 3, :o8, 2121901200 + tz.transition 2037, 10, :o4, 2140045200 + tz.transition 2038, 3, :o8, 59172253, 24 + tz.transition 2038, 10, :o4, 59177461, 24 + tz.transition 2039, 3, :o8, 59180989, 24 + tz.transition 2039, 10, :o4, 59186197, 24 + tz.transition 2040, 3, :o8, 59189725, 24 + tz.transition 2040, 10, :o4, 59194933, 24 + tz.transition 2041, 3, :o8, 59198629, 24 + tz.transition 2041, 10, :o4, 59203669, 24 + tz.transition 2042, 3, :o8, 59207365, 24 + tz.transition 2042, 10, :o4, 59212405, 24 + tz.transition 2043, 3, :o8, 59216101, 24 + tz.transition 2043, 10, :o4, 59221141, 24 + tz.transition 2044, 3, :o8, 59224837, 24 + tz.transition 2044, 10, :o4, 59230045, 24 + tz.transition 2045, 3, :o8, 59233573, 24 + tz.transition 2045, 10, :o4, 59238781, 24 + tz.transition 2046, 3, :o8, 59242309, 24 + tz.transition 2046, 10, :o4, 59247517, 24 + tz.transition 2047, 3, :o8, 59251213, 24 + tz.transition 2047, 10, :o4, 59256253, 24 + tz.transition 2048, 3, :o8, 59259949, 24 + tz.transition 2048, 10, :o4, 59264989, 24 + tz.transition 2049, 3, :o8, 59268685, 24 + tz.transition 2049, 10, :o4, 59273893, 24 + tz.transition 2050, 3, :o8, 59277421, 24 + tz.transition 2050, 10, :o4, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb new file mode 100644 index 0000000000..7fa51c2691 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb @@ -0,0 +1,212 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Warsaw + include TimezoneDefinition + + timezone 'Europe/Warsaw' do |tz| + tz.offset :o0, 5040, 0, :LMT + tz.offset :o1, 5040, 0, :WMT + tz.offset :o2, 3600, 0, :CET + tz.offset :o3, 3600, 3600, :CEST + tz.offset :o4, 7200, 0, :EET + tz.offset :o5, 7200, 3600, :EEST + + tz.transition 1879, 12, :o1, 288925853, 120 + tz.transition 1915, 8, :o2, 290485733, 120 + tz.transition 1916, 4, :o3, 29051813, 12 + tz.transition 1916, 9, :o2, 58107299, 24 + tz.transition 1917, 4, :o3, 58112029, 24 + tz.transition 1917, 9, :o2, 58115725, 24 + tz.transition 1918, 4, :o3, 58120765, 24 + tz.transition 1918, 9, :o4, 58124461, 24 + tz.transition 1919, 4, :o5, 4844127, 2 + tz.transition 1919, 9, :o4, 4844435, 2 + tz.transition 1922, 5, :o2, 29078477, 12 + tz.transition 1940, 6, :o3, 58315285, 24 + tz.transition 1942, 11, :o2, 58335973, 24 + tz.transition 1943, 3, :o3, 58339501, 24 + tz.transition 1943, 10, :o2, 58344037, 24 + tz.transition 1944, 4, :o3, 58348405, 24 + tz.transition 1944, 10, :o2, 4862735, 2 + tz.transition 1945, 4, :o3, 58357787, 24 + tz.transition 1945, 10, :o2, 29181125, 12 + tz.transition 1946, 4, :o3, 58366187, 24 + tz.transition 1946, 10, :o2, 58370413, 24 + tz.transition 1947, 5, :o3, 58375429, 24 + tz.transition 1947, 10, :o2, 58379125, 24 + tz.transition 1948, 4, :o3, 58383829, 24 + tz.transition 1948, 10, :o2, 58387861, 24 + tz.transition 1949, 4, :o3, 58392397, 24 + tz.transition 1949, 10, :o2, 58396597, 24 + tz.transition 1957, 6, :o3, 4871983, 2 + tz.transition 1957, 9, :o2, 4872221, 2 + tz.transition 1958, 3, :o3, 4872585, 2 + tz.transition 1958, 9, :o2, 4872949, 2 + tz.transition 1959, 5, :o3, 4873439, 2 + tz.transition 1959, 10, :o2, 4873691, 2 + tz.transition 1960, 4, :o3, 4874055, 2 + tz.transition 1960, 10, :o2, 4874419, 2 + tz.transition 1961, 5, :o3, 4874895, 2 + tz.transition 1961, 10, :o2, 4875147, 2 + tz.transition 1962, 5, :o3, 4875623, 2 + tz.transition 1962, 9, :o2, 4875875, 2 + tz.transition 1963, 5, :o3, 4876351, 2 + tz.transition 1963, 9, :o2, 4876603, 2 + tz.transition 1964, 5, :o3, 4877093, 2 + tz.transition 1964, 9, :o2, 4877331, 2 + tz.transition 1977, 4, :o3, 228873600 + tz.transition 1977, 9, :o2, 243993600 + tz.transition 1978, 4, :o3, 260323200 + tz.transition 1978, 10, :o2, 276048000 + tz.transition 1979, 4, :o3, 291772800 + tz.transition 1979, 9, :o2, 307497600 + tz.transition 1980, 4, :o3, 323827200 + tz.transition 1980, 9, :o2, 338947200 + tz.transition 1981, 3, :o3, 354672000 + tz.transition 1981, 9, :o2, 370396800 + tz.transition 1982, 3, :o3, 386121600 + tz.transition 1982, 9, :o2, 401846400 + tz.transition 1983, 3, :o3, 417571200 + tz.transition 1983, 9, :o2, 433296000 + tz.transition 1984, 3, :o3, 449020800 + tz.transition 1984, 9, :o2, 465350400 + tz.transition 1985, 3, :o3, 481075200 + tz.transition 1985, 9, :o2, 496800000 + tz.transition 1986, 3, :o3, 512524800 + tz.transition 1986, 9, :o2, 528249600 + tz.transition 1987, 3, :o3, 543974400 + tz.transition 1987, 9, :o2, 559699200 + tz.transition 1988, 3, :o3, 575427600 + tz.transition 1988, 9, :o2, 591152400 + tz.transition 1989, 3, :o3, 606877200 + tz.transition 1989, 9, :o2, 622602000 + tz.transition 1990, 3, :o3, 638326800 + tz.transition 1990, 9, :o2, 654656400 + tz.transition 1991, 3, :o3, 670381200 + tz.transition 1991, 9, :o2, 686106000 + tz.transition 1992, 3, :o3, 701830800 + tz.transition 1992, 9, :o2, 717555600 + tz.transition 1993, 3, :o3, 733280400 + tz.transition 1993, 9, :o2, 749005200 + tz.transition 1994, 3, :o3, 764730000 + tz.transition 1994, 9, :o2, 780454800 + tz.transition 1995, 3, :o3, 796179600 + tz.transition 1995, 9, :o2, 811904400 + tz.transition 1996, 3, :o3, 828234000 + tz.transition 1996, 10, :o2, 846378000 + tz.transition 1997, 3, :o3, 859683600 + tz.transition 1997, 10, :o2, 877827600 + tz.transition 1998, 3, :o3, 891133200 + tz.transition 1998, 10, :o2, 909277200 + tz.transition 1999, 3, :o3, 922582800 + tz.transition 1999, 10, :o2, 941331600 + tz.transition 2000, 3, :o3, 954032400 + tz.transition 2000, 10, :o2, 972781200 + tz.transition 2001, 3, :o3, 985482000 + tz.transition 2001, 10, :o2, 1004230800 + tz.transition 2002, 3, :o3, 1017536400 + tz.transition 2002, 10, :o2, 1035680400 + tz.transition 2003, 3, :o3, 1048986000 + tz.transition 2003, 10, :o2, 1067130000 + tz.transition 2004, 3, :o3, 1080435600 + tz.transition 2004, 10, :o2, 1099184400 + tz.transition 2005, 3, :o3, 1111885200 + tz.transition 2005, 10, :o2, 1130634000 + tz.transition 2006, 3, :o3, 1143334800 + tz.transition 2006, 10, :o2, 1162083600 + tz.transition 2007, 3, :o3, 1174784400 + tz.transition 2007, 10, :o2, 1193533200 + tz.transition 2008, 3, :o3, 1206838800 + tz.transition 2008, 10, :o2, 1224982800 + tz.transition 2009, 3, :o3, 1238288400 + tz.transition 2009, 10, :o2, 1256432400 + tz.transition 2010, 3, :o3, 1269738000 + tz.transition 2010, 10, :o2, 1288486800 + tz.transition 2011, 3, :o3, 1301187600 + tz.transition 2011, 10, :o2, 1319936400 + tz.transition 2012, 3, :o3, 1332637200 + tz.transition 2012, 10, :o2, 1351386000 + tz.transition 2013, 3, :o3, 1364691600 + tz.transition 2013, 10, :o2, 1382835600 + tz.transition 2014, 3, :o3, 1396141200 + tz.transition 2014, 10, :o2, 1414285200 + tz.transition 2015, 3, :o3, 1427590800 + tz.transition 2015, 10, :o2, 1445734800 + tz.transition 2016, 3, :o3, 1459040400 + tz.transition 2016, 10, :o2, 1477789200 + tz.transition 2017, 3, :o3, 1490490000 + tz.transition 2017, 10, :o2, 1509238800 + tz.transition 2018, 3, :o3, 1521939600 + tz.transition 2018, 10, :o2, 1540688400 + tz.transition 2019, 3, :o3, 1553994000 + tz.transition 2019, 10, :o2, 1572138000 + tz.transition 2020, 3, :o3, 1585443600 + tz.transition 2020, 10, :o2, 1603587600 + tz.transition 2021, 3, :o3, 1616893200 + tz.transition 2021, 10, :o2, 1635642000 + tz.transition 2022, 3, :o3, 1648342800 + tz.transition 2022, 10, :o2, 1667091600 + tz.transition 2023, 3, :o3, 1679792400 + tz.transition 2023, 10, :o2, 1698541200 + tz.transition 2024, 3, :o3, 1711846800 + tz.transition 2024, 10, :o2, 1729990800 + tz.transition 2025, 3, :o3, 1743296400 + tz.transition 2025, 10, :o2, 1761440400 + tz.transition 2026, 3, :o3, 1774746000 + tz.transition 2026, 10, :o2, 1792890000 + tz.transition 2027, 3, :o3, 1806195600 + tz.transition 2027, 10, :o2, 1824944400 + tz.transition 2028, 3, :o3, 1837645200 + tz.transition 2028, 10, :o2, 1856394000 + tz.transition 2029, 3, :o3, 1869094800 + tz.transition 2029, 10, :o2, 1887843600 + tz.transition 2030, 3, :o3, 1901149200 + tz.transition 2030, 10, :o2, 1919293200 + tz.transition 2031, 3, :o3, 1932598800 + tz.transition 2031, 10, :o2, 1950742800 + tz.transition 2032, 3, :o3, 1964048400 + tz.transition 2032, 10, :o2, 1982797200 + tz.transition 2033, 3, :o3, 1995498000 + tz.transition 2033, 10, :o2, 2014246800 + tz.transition 2034, 3, :o3, 2026947600 + tz.transition 2034, 10, :o2, 2045696400 + tz.transition 2035, 3, :o3, 2058397200 + tz.transition 2035, 10, :o2, 2077146000 + tz.transition 2036, 3, :o3, 2090451600 + tz.transition 2036, 10, :o2, 2108595600 + tz.transition 2037, 3, :o3, 2121901200 + tz.transition 2037, 10, :o2, 2140045200 + tz.transition 2038, 3, :o3, 59172253, 24 + tz.transition 2038, 10, :o2, 59177461, 24 + tz.transition 2039, 3, :o3, 59180989, 24 + tz.transition 2039, 10, :o2, 59186197, 24 + tz.transition 2040, 3, :o3, 59189725, 24 + tz.transition 2040, 10, :o2, 59194933, 24 + tz.transition 2041, 3, :o3, 59198629, 24 + tz.transition 2041, 10, :o2, 59203669, 24 + tz.transition 2042, 3, :o3, 59207365, 24 + tz.transition 2042, 10, :o2, 59212405, 24 + tz.transition 2043, 3, :o3, 59216101, 24 + tz.transition 2043, 10, :o2, 59221141, 24 + tz.transition 2044, 3, :o3, 59224837, 24 + tz.transition 2044, 10, :o2, 59230045, 24 + tz.transition 2045, 3, :o3, 59233573, 24 + tz.transition 2045, 10, :o2, 59238781, 24 + tz.transition 2046, 3, :o3, 59242309, 24 + tz.transition 2046, 10, :o2, 59247517, 24 + tz.transition 2047, 3, :o3, 59251213, 24 + tz.transition 2047, 10, :o2, 59256253, 24 + tz.transition 2048, 3, :o3, 59259949, 24 + tz.transition 2048, 10, :o2, 59264989, 24 + tz.transition 2049, 3, :o3, 59268685, 24 + tz.transition 2049, 10, :o2, 59273893, 24 + tz.transition 2050, 3, :o3, 59277421, 24 + tz.transition 2050, 10, :o2, 59282629, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb new file mode 100644 index 0000000000..ecdd903d28 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb @@ -0,0 +1,13 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Europe + module Zagreb + include TimezoneDefinition + + linked_timezone 'Europe/Zagreb', 'Europe/Belgrade' + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb new file mode 100644 index 0000000000..a524fd6b6b --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb @@ -0,0 +1,202 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Auckland + include TimezoneDefinition + + timezone 'Pacific/Auckland' do |tz| + tz.offset :o0, 41944, 0, :LMT + tz.offset :o1, 41400, 0, :NZMT + tz.offset :o2, 41400, 3600, :NZST + tz.offset :o3, 41400, 1800, :NZST + tz.offset :o4, 43200, 0, :NZST + tz.offset :o5, 43200, 3600, :NZDT + + tz.transition 1868, 11, :o1, 25959290557, 10800 + tz.transition 1927, 11, :o2, 116409125, 48 + tz.transition 1928, 3, :o1, 38804945, 16 + tz.transition 1928, 10, :o3, 116425589, 48 + tz.transition 1929, 3, :o1, 29108245, 12 + tz.transition 1929, 10, :o3, 116443061, 48 + tz.transition 1930, 3, :o1, 29112613, 12 + tz.transition 1930, 10, :o3, 116460533, 48 + tz.transition 1931, 3, :o1, 29116981, 12 + tz.transition 1931, 10, :o3, 116478005, 48 + tz.transition 1932, 3, :o1, 29121433, 12 + tz.transition 1932, 10, :o3, 116495477, 48 + tz.transition 1933, 3, :o1, 29125801, 12 + tz.transition 1933, 10, :o3, 116512949, 48 + tz.transition 1934, 4, :o1, 29130673, 12 + tz.transition 1934, 9, :o3, 116530085, 48 + tz.transition 1935, 4, :o1, 29135041, 12 + tz.transition 1935, 9, :o3, 116547557, 48 + tz.transition 1936, 4, :o1, 29139409, 12 + tz.transition 1936, 9, :o3, 116565029, 48 + tz.transition 1937, 4, :o1, 29143777, 12 + tz.transition 1937, 9, :o3, 116582501, 48 + tz.transition 1938, 4, :o1, 29148145, 12 + tz.transition 1938, 9, :o3, 116599973, 48 + tz.transition 1939, 4, :o1, 29152597, 12 + tz.transition 1939, 9, :o3, 116617445, 48 + tz.transition 1940, 4, :o1, 29156965, 12 + tz.transition 1940, 9, :o3, 116635253, 48 + tz.transition 1945, 12, :o4, 2431821, 1 + tz.transition 1974, 11, :o5, 152632800 + tz.transition 1975, 2, :o4, 162309600 + tz.transition 1975, 10, :o5, 183477600 + tz.transition 1976, 3, :o4, 194968800 + tz.transition 1976, 10, :o5, 215532000 + tz.transition 1977, 3, :o4, 226418400 + tz.transition 1977, 10, :o5, 246981600 + tz.transition 1978, 3, :o4, 257868000 + tz.transition 1978, 10, :o5, 278431200 + tz.transition 1979, 3, :o4, 289317600 + tz.transition 1979, 10, :o5, 309880800 + tz.transition 1980, 3, :o4, 320767200 + tz.transition 1980, 10, :o5, 341330400 + tz.transition 1981, 2, :o4, 352216800 + tz.transition 1981, 10, :o5, 372780000 + tz.transition 1982, 3, :o4, 384271200 + tz.transition 1982, 10, :o5, 404834400 + tz.transition 1983, 3, :o4, 415720800 + tz.transition 1983, 10, :o5, 436284000 + tz.transition 1984, 3, :o4, 447170400 + tz.transition 1984, 10, :o5, 467733600 + tz.transition 1985, 3, :o4, 478620000 + tz.transition 1985, 10, :o5, 499183200 + tz.transition 1986, 3, :o4, 510069600 + tz.transition 1986, 10, :o5, 530632800 + tz.transition 1987, 2, :o4, 541519200 + tz.transition 1987, 10, :o5, 562082400 + tz.transition 1988, 3, :o4, 573573600 + tz.transition 1988, 10, :o5, 594136800 + tz.transition 1989, 3, :o4, 605023200 + tz.transition 1989, 10, :o5, 623772000 + tz.transition 1990, 3, :o4, 637682400 + tz.transition 1990, 10, :o5, 655221600 + tz.transition 1991, 3, :o4, 669132000 + tz.transition 1991, 10, :o5, 686671200 + tz.transition 1992, 3, :o4, 700581600 + tz.transition 1992, 10, :o5, 718120800 + tz.transition 1993, 3, :o4, 732636000 + tz.transition 1993, 10, :o5, 749570400 + tz.transition 1994, 3, :o4, 764085600 + tz.transition 1994, 10, :o5, 781020000 + tz.transition 1995, 3, :o4, 795535200 + tz.transition 1995, 9, :o5, 812469600 + tz.transition 1996, 3, :o4, 826984800 + tz.transition 1996, 10, :o5, 844524000 + tz.transition 1997, 3, :o4, 858434400 + tz.transition 1997, 10, :o5, 875973600 + tz.transition 1998, 3, :o4, 889884000 + tz.transition 1998, 10, :o5, 907423200 + tz.transition 1999, 3, :o4, 921938400 + tz.transition 1999, 10, :o5, 938872800 + tz.transition 2000, 3, :o4, 953388000 + tz.transition 2000, 9, :o5, 970322400 + tz.transition 2001, 3, :o4, 984837600 + tz.transition 2001, 10, :o5, 1002376800 + tz.transition 2002, 3, :o4, 1016287200 + tz.transition 2002, 10, :o5, 1033826400 + tz.transition 2003, 3, :o4, 1047736800 + tz.transition 2003, 10, :o5, 1065276000 + tz.transition 2004, 3, :o4, 1079791200 + tz.transition 2004, 10, :o5, 1096725600 + tz.transition 2005, 3, :o4, 1111240800 + tz.transition 2005, 10, :o5, 1128175200 + tz.transition 2006, 3, :o4, 1142690400 + tz.transition 2006, 9, :o5, 1159624800 + tz.transition 2007, 3, :o4, 1174140000 + tz.transition 2007, 9, :o5, 1191074400 + tz.transition 2008, 4, :o4, 1207404000 + tz.transition 2008, 9, :o5, 1222524000 + tz.transition 2009, 4, :o4, 1238853600 + tz.transition 2009, 9, :o5, 1253973600 + tz.transition 2010, 4, :o4, 1270303200 + tz.transition 2010, 9, :o5, 1285423200 + tz.transition 2011, 4, :o4, 1301752800 + tz.transition 2011, 9, :o5, 1316872800 + tz.transition 2012, 3, :o4, 1333202400 + tz.transition 2012, 9, :o5, 1348927200 + tz.transition 2013, 4, :o4, 1365256800 + tz.transition 2013, 9, :o5, 1380376800 + tz.transition 2014, 4, :o4, 1396706400 + tz.transition 2014, 9, :o5, 1411826400 + tz.transition 2015, 4, :o4, 1428156000 + tz.transition 2015, 9, :o5, 1443276000 + tz.transition 2016, 4, :o4, 1459605600 + tz.transition 2016, 9, :o5, 1474725600 + tz.transition 2017, 4, :o4, 1491055200 + tz.transition 2017, 9, :o5, 1506175200 + tz.transition 2018, 3, :o4, 1522504800 + tz.transition 2018, 9, :o5, 1538229600 + tz.transition 2019, 4, :o4, 1554559200 + tz.transition 2019, 9, :o5, 1569679200 + tz.transition 2020, 4, :o4, 1586008800 + tz.transition 2020, 9, :o5, 1601128800 + tz.transition 2021, 4, :o4, 1617458400 + tz.transition 2021, 9, :o5, 1632578400 + tz.transition 2022, 4, :o4, 1648908000 + tz.transition 2022, 9, :o5, 1664028000 + tz.transition 2023, 4, :o4, 1680357600 + tz.transition 2023, 9, :o5, 1695477600 + tz.transition 2024, 4, :o4, 1712412000 + tz.transition 2024, 9, :o5, 1727532000 + tz.transition 2025, 4, :o4, 1743861600 + tz.transition 2025, 9, :o5, 1758981600 + tz.transition 2026, 4, :o4, 1775311200 + tz.transition 2026, 9, :o5, 1790431200 + tz.transition 2027, 4, :o4, 1806760800 + tz.transition 2027, 9, :o5, 1821880800 + tz.transition 2028, 4, :o4, 1838210400 + tz.transition 2028, 9, :o5, 1853330400 + tz.transition 2029, 3, :o4, 1869660000 + tz.transition 2029, 9, :o5, 1885384800 + tz.transition 2030, 4, :o4, 1901714400 + tz.transition 2030, 9, :o5, 1916834400 + tz.transition 2031, 4, :o4, 1933164000 + tz.transition 2031, 9, :o5, 1948284000 + tz.transition 2032, 4, :o4, 1964613600 + tz.transition 2032, 9, :o5, 1979733600 + tz.transition 2033, 4, :o4, 1996063200 + tz.transition 2033, 9, :o5, 2011183200 + tz.transition 2034, 4, :o4, 2027512800 + tz.transition 2034, 9, :o5, 2042632800 + tz.transition 2035, 3, :o4, 2058962400 + tz.transition 2035, 9, :o5, 2074687200 + tz.transition 2036, 4, :o4, 2091016800 + tz.transition 2036, 9, :o5, 2106136800 + tz.transition 2037, 4, :o4, 2122466400 + tz.transition 2037, 9, :o5, 2137586400 + tz.transition 2038, 4, :o4, 29586205, 12 + tz.transition 2038, 9, :o5, 29588305, 12 + tz.transition 2039, 4, :o4, 29590573, 12 + tz.transition 2039, 9, :o5, 29592673, 12 + tz.transition 2040, 3, :o4, 29594941, 12 + tz.transition 2040, 9, :o5, 29597125, 12 + tz.transition 2041, 4, :o4, 29599393, 12 + tz.transition 2041, 9, :o5, 29601493, 12 + tz.transition 2042, 4, :o4, 29603761, 12 + tz.transition 2042, 9, :o5, 29605861, 12 + tz.transition 2043, 4, :o4, 29608129, 12 + tz.transition 2043, 9, :o5, 29610229, 12 + tz.transition 2044, 4, :o4, 29612497, 12 + tz.transition 2044, 9, :o5, 29614597, 12 + tz.transition 2045, 4, :o4, 29616865, 12 + tz.transition 2045, 9, :o5, 29618965, 12 + tz.transition 2046, 3, :o4, 29621233, 12 + tz.transition 2046, 9, :o5, 29623417, 12 + tz.transition 2047, 4, :o4, 29625685, 12 + tz.transition 2047, 9, :o5, 29627785, 12 + tz.transition 2048, 4, :o4, 29630053, 12 + tz.transition 2048, 9, :o5, 29632153, 12 + tz.transition 2049, 4, :o4, 29634421, 12 + tz.transition 2049, 9, :o5, 29636521, 12 + tz.transition 2050, 4, :o4, 29638789, 12 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb new file mode 100644 index 0000000000..5fe9bbd9a6 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb @@ -0,0 +1,23 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Fiji + include TimezoneDefinition + + timezone 'Pacific/Fiji' do |tz| + tz.offset :o0, 42820, 0, :LMT + tz.offset :o1, 43200, 0, :FJT + tz.offset :o2, 43200, 3600, :FJST + + tz.transition 1915, 10, :o1, 10457838739, 4320 + tz.transition 1998, 10, :o2, 909842400 + tz.transition 1999, 2, :o1, 920124000 + tz.transition 1999, 11, :o2, 941896800 + tz.transition 2000, 2, :o1, 951573600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb new file mode 100644 index 0000000000..d4c1a0a682 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb @@ -0,0 +1,22 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Guam + include TimezoneDefinition + + timezone 'Pacific/Guam' do |tz| + tz.offset :o0, -51660, 0, :LMT + tz.offset :o1, 34740, 0, :LMT + tz.offset :o2, 36000, 0, :GST + tz.offset :o3, 36000, 0, :ChST + + tz.transition 1844, 12, :o1, 1149567407, 480 + tz.transition 1900, 12, :o2, 1159384847, 480 + tz.transition 2000, 12, :o3, 977493600 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb new file mode 100644 index 0000000000..204b226537 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb @@ -0,0 +1,28 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Honolulu + include TimezoneDefinition + + timezone 'Pacific/Honolulu' do |tz| + tz.offset :o0, -37886, 0, :LMT + tz.offset :o1, -37800, 0, :HST + tz.offset :o2, -37800, 3600, :HDT + tz.offset :o3, -37800, 3600, :HWT + tz.offset :o4, -37800, 3600, :HPT + tz.offset :o5, -36000, 0, :HST + + tz.transition 1900, 1, :o1, 104328926143, 43200 + tz.transition 1933, 4, :o2, 116505265, 48 + tz.transition 1933, 5, :o1, 116506271, 48 + tz.transition 1942, 2, :o3, 116659201, 48 + tz.transition 1945, 8, :o4, 58360379, 24 + tz.transition 1945, 9, :o1, 116722991, 48 + tz.transition 1947, 6, :o5, 116752561, 48 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb new file mode 100644 index 0000000000..32adad92c1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb @@ -0,0 +1,20 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Majuro + include TimezoneDefinition + + timezone 'Pacific/Majuro' do |tz| + tz.offset :o0, 41088, 0, :LMT + tz.offset :o1, 39600, 0, :MHT + tz.offset :o2, 43200, 0, :MHT + + tz.transition 1900, 12, :o1, 1086923261, 450 + tz.transition 1969, 9, :o2, 58571881, 24 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb new file mode 100644 index 0000000000..97784fcc10 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb @@ -0,0 +1,25 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Midway + include TimezoneDefinition + + timezone 'Pacific/Midway' do |tz| + tz.offset :o0, -42568, 0, :LMT + tz.offset :o1, -39600, 0, :NST + tz.offset :o2, -39600, 3600, :NDT + tz.offset :o3, -39600, 0, :BST + tz.offset :o4, -39600, 0, :SST + + tz.transition 1901, 1, :o1, 26086168721, 10800 + tz.transition 1956, 6, :o2, 58455071, 24 + tz.transition 1956, 9, :o1, 29228627, 12 + tz.transition 1967, 4, :o3, 58549967, 24 + tz.transition 1983, 11, :o4, 439038000 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb new file mode 100644 index 0000000000..70173db8ab --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb @@ -0,0 +1,25 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Noumea + include TimezoneDefinition + + timezone 'Pacific/Noumea' do |tz| + tz.offset :o0, 39948, 0, :LMT + tz.offset :o1, 39600, 0, :NCT + tz.offset :o2, 39600, 3600, :NCST + + tz.transition 1912, 1, :o1, 17419781071, 7200 + tz.transition 1977, 12, :o2, 250002000 + tz.transition 1978, 2, :o1, 257342400 + tz.transition 1978, 12, :o2, 281451600 + tz.transition 1979, 2, :o1, 288878400 + tz.transition 1996, 11, :o2, 849366000 + tz.transition 1997, 3, :o1, 857228400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb new file mode 100644 index 0000000000..c8fcd7d527 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb @@ -0,0 +1,26 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Pago_Pago + include TimezoneDefinition + + timezone 'Pacific/Pago_Pago' do |tz| + tz.offset :o0, 45432, 0, :LMT + tz.offset :o1, -40968, 0, :LMT + tz.offset :o2, -41400, 0, :SAMT + tz.offset :o3, -39600, 0, :NST + tz.offset :o4, -39600, 0, :BST + tz.offset :o5, -39600, 0, :SST + + tz.transition 1879, 7, :o1, 2889041969, 1200 + tz.transition 1911, 1, :o2, 2902845569, 1200 + tz.transition 1950, 1, :o3, 116797583, 48 + tz.transition 1967, 4, :o4, 58549967, 24 + tz.transition 1983, 11, :o5, 439038000 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb new file mode 100644 index 0000000000..f06cf6d54f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb @@ -0,0 +1,20 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Port_Moresby + include TimezoneDefinition + + timezone 'Pacific/Port_Moresby' do |tz| + tz.offset :o0, 35320, 0, :LMT + tz.offset :o1, 35312, 0, :PMMT + tz.offset :o2, 36000, 0, :PGT + + tz.transition 1879, 12, :o1, 5200664597, 2160 + tz.transition 1894, 12, :o2, 13031248093, 5400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb new file mode 100644 index 0000000000..7578d92f38 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb @@ -0,0 +1,27 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module Pacific + module Tongatapu + include TimezoneDefinition + + timezone 'Pacific/Tongatapu' do |tz| + tz.offset :o0, 44360, 0, :LMT + tz.offset :o1, 44400, 0, :TOT + tz.offset :o2, 46800, 0, :TOT + tz.offset :o3, 46800, 3600, :TOST + + tz.transition 1900, 12, :o1, 5217231571, 2160 + tz.transition 1940, 12, :o2, 174959639, 72 + tz.transition 1999, 10, :o3, 939214800 + tz.transition 2000, 3, :o2, 953384400 + tz.transition 2000, 11, :o3, 973342800 + tz.transition 2001, 1, :o2, 980596800 + tz.transition 2001, 11, :o3, 1004792400 + tz.transition 2002, 1, :o2, 1012046400 + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb new file mode 100644 index 0000000000..001303c594 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb @@ -0,0 +1,52 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/timezone' + +module TZInfo + + # A Timezone based on a TimezoneInfo. + class InfoTimezone < Timezone #:nodoc: + + # Constructs a new InfoTimezone with a TimezoneInfo instance. + def self.new(info) + tz = super() + tz.send(:setup, info) + tz + end + + # The identifier of the timezone, e.g. "Europe/Paris". + def identifier + @info.identifier + end + + protected + # The TimezoneInfo for this Timezone. + def info + @info + end + + def setup(info) + @info = info + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb new file mode 100644 index 0000000000..f8ec4fca87 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb @@ -0,0 +1,51 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/info_timezone' + +module TZInfo + + class LinkedTimezone < InfoTimezone #:nodoc: + # Returns the TimezonePeriod for the given UTC time. utc can either be + # a DateTime, Time or integer timestamp (Time.to_i). Any timezone + # information in utc is ignored (it is treated as a UTC time). + # + # If no TimezonePeriod could be found, PeriodNotFound is raised. + def period_for_utc(utc) + @linked_timezone.period_for_utc(utc) + end + + # Returns the set of TimezonePeriod instances that are valid for the given + # local time as an array. If you just want a single period, use + # period_for_local instead and specify how abiguities should be resolved. + # Raises PeriodNotFound if no periods are found for the given time. + def periods_for_local(local) + @linked_timezone.periods_for_local(local) + end + + protected + def setup(info) + super(info) + @linked_timezone = Timezone.get(info.link_to_identifier) + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb new file mode 100644 index 0000000000..8197ff3e81 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb @@ -0,0 +1,44 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/timezone_info' + +module TZInfo + # Represents a linked timezone defined in a data module. + class LinkedTimezoneInfo < TimezoneInfo #:nodoc: + + # The zone that provides the data (that this zone is an alias for). + attr_reader :link_to_identifier + + # Constructs a new TimezoneInfo with an identifier and the identifier + # of the zone linked to. + def initialize(identifier, link_to_identifier) + super(identifier) + @link_to_identifier = link_to_identifier + end + + # Returns internal object state as a programmer-readable string. + def inspect + "#<#{self.class}: #@identifier,#@link_to_identifier>" + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb new file mode 100644 index 0000000000..b1f10b2b63 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb @@ -0,0 +1,98 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'rational' +require 'tzinfo/ruby_core_support' + +module TZInfo + + # Provides a method for getting Rationals for a timezone offset in seconds. + # Pre-reduced rationals are returned for all the half-hour intervals between + # -14 and +14 hours to avoid having to call gcd at runtime. + module OffsetRationals #:nodoc: + @@rational_cache = { + -50400 => RubyCoreSupport.rational_new!(-7,12), + -48600 => RubyCoreSupport.rational_new!(-9,16), + -46800 => RubyCoreSupport.rational_new!(-13,24), + -45000 => RubyCoreSupport.rational_new!(-25,48), + -43200 => RubyCoreSupport.rational_new!(-1,2), + -41400 => RubyCoreSupport.rational_new!(-23,48), + -39600 => RubyCoreSupport.rational_new!(-11,24), + -37800 => RubyCoreSupport.rational_new!(-7,16), + -36000 => RubyCoreSupport.rational_new!(-5,12), + -34200 => RubyCoreSupport.rational_new!(-19,48), + -32400 => RubyCoreSupport.rational_new!(-3,8), + -30600 => RubyCoreSupport.rational_new!(-17,48), + -28800 => RubyCoreSupport.rational_new!(-1,3), + -27000 => RubyCoreSupport.rational_new!(-5,16), + -25200 => RubyCoreSupport.rational_new!(-7,24), + -23400 => RubyCoreSupport.rational_new!(-13,48), + -21600 => RubyCoreSupport.rational_new!(-1,4), + -19800 => RubyCoreSupport.rational_new!(-11,48), + -18000 => RubyCoreSupport.rational_new!(-5,24), + -16200 => RubyCoreSupport.rational_new!(-3,16), + -14400 => RubyCoreSupport.rational_new!(-1,6), + -12600 => RubyCoreSupport.rational_new!(-7,48), + -10800 => RubyCoreSupport.rational_new!(-1,8), + -9000 => RubyCoreSupport.rational_new!(-5,48), + -7200 => RubyCoreSupport.rational_new!(-1,12), + -5400 => RubyCoreSupport.rational_new!(-1,16), + -3600 => RubyCoreSupport.rational_new!(-1,24), + -1800 => RubyCoreSupport.rational_new!(-1,48), + 0 => RubyCoreSupport.rational_new!(0,1), + 1800 => RubyCoreSupport.rational_new!(1,48), + 3600 => RubyCoreSupport.rational_new!(1,24), + 5400 => RubyCoreSupport.rational_new!(1,16), + 7200 => RubyCoreSupport.rational_new!(1,12), + 9000 => RubyCoreSupport.rational_new!(5,48), + 10800 => RubyCoreSupport.rational_new!(1,8), + 12600 => RubyCoreSupport.rational_new!(7,48), + 14400 => RubyCoreSupport.rational_new!(1,6), + 16200 => RubyCoreSupport.rational_new!(3,16), + 18000 => RubyCoreSupport.rational_new!(5,24), + 19800 => RubyCoreSupport.rational_new!(11,48), + 21600 => RubyCoreSupport.rational_new!(1,4), + 23400 => RubyCoreSupport.rational_new!(13,48), + 25200 => RubyCoreSupport.rational_new!(7,24), + 27000 => RubyCoreSupport.rational_new!(5,16), + 28800 => RubyCoreSupport.rational_new!(1,3), + 30600 => RubyCoreSupport.rational_new!(17,48), + 32400 => RubyCoreSupport.rational_new!(3,8), + 34200 => RubyCoreSupport.rational_new!(19,48), + 36000 => RubyCoreSupport.rational_new!(5,12), + 37800 => RubyCoreSupport.rational_new!(7,16), + 39600 => RubyCoreSupport.rational_new!(11,24), + 41400 => RubyCoreSupport.rational_new!(23,48), + 43200 => RubyCoreSupport.rational_new!(1,2), + 45000 => RubyCoreSupport.rational_new!(25,48), + 46800 => RubyCoreSupport.rational_new!(13,24), + 48600 => RubyCoreSupport.rational_new!(9,16), + 50400 => RubyCoreSupport.rational_new!(7,12)} + + # Returns a Rational expressing the fraction of a day that offset in + # seconds represents (i.e. equivalent to Rational(offset, 86400)). + def rational_for_offset(offset) + @@rational_cache[offset] || Rational(offset, 86400) + end + module_function :rational_for_offset + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb new file mode 100644 index 0000000000..9a0441206b --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb @@ -0,0 +1,56 @@ +#-- +# Copyright (c) 2008 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'date' +require 'rational' + +module TZInfo + + # Methods to support different versions of Ruby. + module RubyCoreSupport #:nodoc: + + # Use Rational.new! for performance reasons in Ruby 1.8. + # This has been removed from 1.9, but Rational performs better. + if Rational.respond_to? :new! + def self.rational_new!(numerator, denominator = 1) + Rational.new!(numerator, denominator) + end + else + def self.rational_new!(numerator, denominator = 1) + Rational(numerator, denominator) + end + end + + # Ruby 1.8.6 introduced new! and deprecated new0. + # Ruby 1.9.0 removed new0. + # We still need to support new0 for older versions of Ruby. + if DateTime.respond_to? :new! + def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) + DateTime.new!(ajd, of, sg) + end + else + def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) + DateTime.new0(ajd, of, sg) + end + end + end +end \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb new file mode 100644 index 0000000000..264517f3ee --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb @@ -0,0 +1,292 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'date' +require 'time' +require 'tzinfo/offset_rationals' + +module TZInfo + # Used by TZInfo internally to represent either a Time, DateTime or integer + # timestamp (seconds since 1970-01-01 00:00:00). + class TimeOrDateTime #:nodoc: + include Comparable + + # Constructs a new TimeOrDateTime. timeOrDateTime can be a Time, DateTime + # or an integer. If using a Time or DateTime, any time zone information is + # ignored. + def initialize(timeOrDateTime) + @time = nil + @datetime = nil + @timestamp = nil + + if timeOrDateTime.is_a?(Time) + @time = timeOrDateTime + @time = Time.utc(@time.year, @time.mon, @time.mday, @time.hour, @time.min, @time.sec) unless @time.zone == 'UTC' + @orig = @time + elsif timeOrDateTime.is_a?(DateTime) + @datetime = timeOrDateTime + @datetime = @datetime.new_offset(0) unless @datetime.offset == 0 + @orig = @datetime + else + @timestamp = timeOrDateTime.to_i + @orig = @timestamp + end + end + + # Returns the time as a Time. + def to_time + unless @time + if @timestamp + @time = Time.at(@timestamp).utc + else + @time = Time.utc(year, mon, mday, hour, min, sec) + end + end + + @time + end + + # Returns the time as a DateTime. + def to_datetime + unless @datetime + @datetime = DateTime.new(year, mon, mday, hour, min, sec) + end + + @datetime + end + + # Returns the time as an integer timestamp. + def to_i + unless @timestamp + @timestamp = to_time.to_i + end + + @timestamp + end + + # Returns the time as the original time passed to new. + def to_orig + @orig + end + + # Returns a string representation of the TimeOrDateTime. + def to_s + if @orig.is_a?(Time) + "Time: #{@orig.to_s}" + elsif @orig.is_a?(DateTime) + "DateTime: #{@orig.to_s}" + else + "Timestamp: #{@orig.to_s}" + end + end + + # Returns internal object state as a programmer-readable string. + def inspect + "#<#{self.class}: #{@orig.inspect}>" + end + + # Returns the year. + def year + if @time + @time.year + elsif @datetime + @datetime.year + else + to_time.year + end + end + + # Returns the month of the year (1..12). + def mon + if @time + @time.mon + elsif @datetime + @datetime.mon + else + to_time.mon + end + end + alias :month :mon + + # Returns the day of the month (1..n). + def mday + if @time + @time.mday + elsif @datetime + @datetime.mday + else + to_time.mday + end + end + alias :day :mday + + # Returns the hour of the day (0..23). + def hour + if @time + @time.hour + elsif @datetime + @datetime.hour + else + to_time.hour + end + end + + # Returns the minute of the hour (0..59). + def min + if @time + @time.min + elsif @datetime + @datetime.min + else + to_time.min + end + end + + # Returns the second of the minute (0..60). (60 for a leap second). + def sec + if @time + @time.sec + elsif @datetime + @datetime.sec + else + to_time.sec + end + end + + # Compares this TimeOrDateTime with another Time, DateTime, integer + # timestamp or TimeOrDateTime. Returns -1, 0 or +1 depending whether the + # receiver is less than, equal to, or greater than timeOrDateTime. + # + # Milliseconds and smaller units are ignored in the comparison. + def <=>(timeOrDateTime) + if timeOrDateTime.is_a?(TimeOrDateTime) + orig = timeOrDateTime.to_orig + + if @orig.is_a?(DateTime) || orig.is_a?(DateTime) + # If either is a DateTime, assume it is there for a reason + # (i.e. for range). + to_datetime <=> timeOrDateTime.to_datetime + elsif orig.is_a?(Time) + to_time <=> timeOrDateTime.to_time + else + to_i <=> timeOrDateTime.to_i + end + elsif @orig.is_a?(DateTime) || timeOrDateTime.is_a?(DateTime) + # If either is a DateTime, assume it is there for a reason + # (i.e. for range). + to_datetime <=> TimeOrDateTime.wrap(timeOrDateTime).to_datetime + elsif timeOrDateTime.is_a?(Time) + to_time <=> timeOrDateTime + else + to_i <=> timeOrDateTime.to_i + end + end + + # Adds a number of seconds to the TimeOrDateTime. Returns a new + # TimeOrDateTime, preserving what the original constructed type was. + # If the original type is a Time and the resulting calculation goes out of + # range for Times, then an exception will be raised by the Time class. + def +(seconds) + if seconds == 0 + self + else + if @orig.is_a?(DateTime) + TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) + else + # + defined for Time and integer timestamps + TimeOrDateTime.new(@orig + seconds) + end + end + end + + # Subtracts a number of seconds from the TimeOrDateTime. Returns a new + # TimeOrDateTime, preserving what the original constructed type was. + # If the original type is a Time and the resulting calculation goes out of + # range for Times, then an exception will be raised by the Time class. + def -(seconds) + self + (-seconds) + end + + # Similar to the + operator, but for cases where adding would cause a + # timestamp or time to go out of the allowed range, converts to a DateTime + # based TimeOrDateTime. + def add_with_convert(seconds) + if seconds == 0 + self + else + if @orig.is_a?(DateTime) + TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) + else + # A Time or timestamp. + result = to_i + seconds + + if result < 0 || result > 2147483647 + result = TimeOrDateTime.new(to_datetime + OffsetRationals.rational_for_offset(seconds)) + else + result = TimeOrDateTime.new(@orig + seconds) + end + end + end + end + + # Returns true if todt represents the same time and was originally + # constructed with the same type (DateTime, Time or timestamp) as this + # TimeOrDateTime. + def eql?(todt) + todt.respond_to?(:to_orig) && to_orig.eql?(todt.to_orig) + end + + # Returns a hash of this TimeOrDateTime. + def hash + @orig.hash + end + + # If no block is given, returns a TimeOrDateTime wrapping the given + # timeOrDateTime. If a block is specified, a TimeOrDateTime is constructed + # and passed to the block. The result of the block must be a TimeOrDateTime. + # to_orig will be called on the result and the result of to_orig will be + # returned. + # + # timeOrDateTime can be a Time, DateTime, integer timestamp or TimeOrDateTime. + # If a TimeOrDateTime is passed in, no new TimeOrDateTime will be constructed, + # the passed in value will be used. + def self.wrap(timeOrDateTime) + t = timeOrDateTime.is_a?(TimeOrDateTime) ? timeOrDateTime : TimeOrDateTime.new(timeOrDateTime) + + if block_given? + t = yield t + + if timeOrDateTime.is_a?(TimeOrDateTime) + t + elsif timeOrDateTime.is_a?(Time) + t.to_time + elsif timeOrDateTime.is_a?(DateTime) + t.to_datetime + else + t.to_i + end + else + t + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb new file mode 100644 index 0000000000..ef4ecd8ae1 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb @@ -0,0 +1,508 @@ +#-- +# Copyright (c) 2005-2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'date' +# require 'tzinfo/country' +require 'tzinfo/time_or_datetime' +require 'tzinfo/timezone_period' + +module TZInfo + # Indicate a specified time in a local timezone has more than one + # possible time in UTC. This happens when switching from daylight savings time + # to normal time where the clocks are rolled back. Thrown by period_for_local + # and local_to_utc when using an ambiguous time and not specifying any + # means to resolve the ambiguity. + class AmbiguousTime < StandardError + end + + # Thrown to indicate that no TimezonePeriod matching a given time could be found. + class PeriodNotFound < StandardError + end + + # Thrown by Timezone#get if the identifier given is not valid. + class InvalidTimezoneIdentifier < StandardError + end + + # Thrown if an attempt is made to use a timezone created with Timezone.new(nil). + class UnknownTimezone < StandardError + end + + # Timezone is the base class of all timezones. It provides a factory method + # get to access timezones by identifier. Once a specific Timezone has been + # retrieved, DateTimes, Times and timestamps can be converted between the UTC + # and the local time for the zone. For example: + # + # tz = TZInfo::Timezone.get('America/New_York') + # puts tz.utc_to_local(DateTime.new(2005,8,29,15,35,0)).to_s + # puts tz.local_to_utc(Time.utc(2005,8,29,11,35,0)).to_s + # puts tz.utc_to_local(1125315300).to_s + # + # Each time conversion method returns an object of the same type it was + # passed. + # + # The timezone information all comes from the tz database + # (see http://www.twinsun.com/tz/tz-link.htm) + class Timezone + include Comparable + + # Cache of loaded zones by identifier to avoid using require if a zone + # has already been loaded. + @@loaded_zones = {} + + # Whether the timezones index has been loaded yet. + @@index_loaded = false + + # Returns a timezone by its identifier (e.g. "Europe/London", + # "America/Chicago" or "UTC"). + # + # Raises InvalidTimezoneIdentifier if the timezone couldn't be found. + def self.get(identifier) + instance = @@loaded_zones[identifier] + unless instance + raise InvalidTimezoneIdentifier, 'Invalid identifier' if identifier !~ /^[A-z0-9\+\-_]+(\/[A-z0-9\+\-_]+)*$/ + identifier = identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__') + begin + # Use a temporary variable to avoid an rdoc warning + file = "tzinfo/definitions/#{identifier}".untaint + require file + + m = Definitions + identifier.split(/\//).each {|part| + m = m.const_get(part) + } + + info = m.get + + # Could make Timezone subclasses register an interest in an info + # type. Since there are currently only two however, there isn't + # much point. + if info.kind_of?(DataTimezoneInfo) + instance = DataTimezone.new(info) + elsif info.kind_of?(LinkedTimezoneInfo) + instance = LinkedTimezone.new(info) + else + raise InvalidTimezoneIdentifier, "No handler for info type #{info.class}" + end + + @@loaded_zones[instance.identifier] = instance + rescue LoadError, NameError => e + raise InvalidTimezoneIdentifier, e.message + end + end + + instance + end + + # Returns a proxy for the Timezone with the given identifier. The proxy + # will cause the real timezone to be loaded when an attempt is made to + # find a period or convert a time. get_proxy will not validate the + # identifier. If an invalid identifier is specified, no exception will be + # raised until the proxy is used. + def self.get_proxy(identifier) + TimezoneProxy.new(identifier) + end + + # If identifier is nil calls super(), otherwise calls get. An identfier + # should always be passed in when called externally. + def self.new(identifier = nil) + if identifier + get(identifier) + else + super() + end + end + + # Returns an array containing all the available Timezones. + # + # Returns TimezoneProxy objects to avoid the overhead of loading Timezone + # definitions until a conversion is actually required. + def self.all + get_proxies(all_identifiers) + end + + # Returns an array containing the identifiers of all the available + # Timezones. + def self.all_identifiers + load_index + Indexes::Timezones.timezones + end + + # Returns an array containing all the available Timezones that are based + # on data (are not links to other Timezones). + # + # Returns TimezoneProxy objects to avoid the overhead of loading Timezone + # definitions until a conversion is actually required. + def self.all_data_zones + get_proxies(all_data_zone_identifiers) + end + + # Returns an array containing the identifiers of all the available + # Timezones that are based on data (are not links to other Timezones).. + def self.all_data_zone_identifiers + load_index + Indexes::Timezones.data_timezones + end + + # Returns an array containing all the available Timezones that are links + # to other Timezones. + # + # Returns TimezoneProxy objects to avoid the overhead of loading Timezone + # definitions until a conversion is actually required. + def self.all_linked_zones + get_proxies(all_linked_zone_identifiers) + end + + # Returns an array containing the identifiers of all the available + # Timezones that are links to other Timezones. + def self.all_linked_zone_identifiers + load_index + Indexes::Timezones.linked_timezones + end + + # Returns all the Timezones defined for all Countries. This is not the + # complete set of Timezones as some are not country specific (e.g. + # 'Etc/GMT'). + # + # Returns TimezoneProxy objects to avoid the overhead of loading Timezone + # definitions until a conversion is actually required. + def self.all_country_zones + Country.all_codes.inject([]) {|zones,country| + zones += Country.get(country).zones + } + end + + # Returns all the zone identifiers defined for all Countries. This is not the + # complete set of zone identifiers as some are not country specific (e.g. + # 'Etc/GMT'). You can obtain a Timezone instance for a given identifier + # with the get method. + def self.all_country_zone_identifiers + Country.all_codes.inject([]) {|zones,country| + zones += Country.get(country).zone_identifiers + } + end + + # Returns all US Timezone instances. A shortcut for + # TZInfo::Country.get('US').zones. + # + # Returns TimezoneProxy objects to avoid the overhead of loading Timezone + # definitions until a conversion is actually required. + def self.us_zones + Country.get('US').zones + end + + # Returns all US zone identifiers. A shortcut for + # TZInfo::Country.get('US').zone_identifiers. + def self.us_zone_identifiers + Country.get('US').zone_identifiers + end + + # The identifier of the timezone, e.g. "Europe/Paris". + def identifier + raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + end + + # An alias for identifier. + def name + # Don't use alias, as identifier gets overridden. + identifier + end + + # Returns a friendlier version of the identifier. + def to_s + friendly_identifier + end + + # Returns internal object state as a programmer-readable string. + def inspect + "#<#{self.class}: #{identifier}>" + end + + # Returns a friendlier version of the identifier. Set skip_first_part to + # omit the first part of the identifier (typically a region name) where + # there is more than one part. + # + # For example: + # + # Timezone.get('Europe/Paris').friendly_identifier(false) #=> "Europe - Paris" + # Timezone.get('Europe/Paris').friendly_identifier(true) #=> "Paris" + # Timezone.get('America/Indiana/Knox').friendly_identifier(false) #=> "America - Knox, Indiana" + # Timezone.get('America/Indiana/Knox').friendly_identifier(true) #=> "Knox, Indiana" + def friendly_identifier(skip_first_part = false) + parts = identifier.split('/') + if parts.empty? + # shouldn't happen + identifier + elsif parts.length == 1 + parts[0] + else + if skip_first_part + result = '' + else + result = parts[0] + ' - ' + end + + parts[1, parts.length - 1].reverse_each {|part| + part.gsub!(/_/, ' ') + + if part.index(/[a-z]/) + # Missing a space if a lower case followed by an upper case and the + # name isn't McXxxx. + part.gsub!(/([^M][a-z])([A-Z])/, '\1 \2') + part.gsub!(/([M][a-bd-z])([A-Z])/, '\1 \2') + + # Missing an apostrophe if two consecutive upper case characters. + part.gsub!(/([A-Z])([A-Z])/, '\1\'\2') + end + + result << part + result << ', ' + } + + result.slice!(result.length - 2, 2) + result + end + end + + # Returns the TimezonePeriod for the given UTC time. utc can either be + # a DateTime, Time or integer timestamp (Time.to_i). Any timezone + # information in utc is ignored (it is treated as a UTC time). + def period_for_utc(utc) + raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + end + + # Returns the set of TimezonePeriod instances that are valid for the given + # local time as an array. If you just want a single period, use + # period_for_local instead and specify how ambiguities should be resolved. + # Returns an empty array if no periods are found for the given time. + def periods_for_local(local) + raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + end + + # Returns the TimezonePeriod for the given local time. local can either be + # a DateTime, Time or integer timestamp (Time.to_i). Any timezone + # information in local is ignored (it is treated as a time in the current + # timezone). + # + # Warning: There are local times that have no equivalent UTC times (e.g. + # in the transition from standard time to daylight savings time). There are + # also local times that have more than one UTC equivalent (e.g. in the + # transition from daylight savings time to standard time). + # + # In the first case (no equivalent UTC time), a PeriodNotFound exception + # will be raised. + # + # In the second case (more than one equivalent UTC time), an AmbiguousTime + # exception will be raised unless the optional dst parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the dst parameter can be used to select whether the + # daylight savings time or local time is used. For example, + # + # Timezone.get('America/New_York').period_for_local(DateTime.new(2004,10,31,1,30,0)) + # + # would raise an AmbiguousTime exception. + # + # Specifying dst=true would the daylight savings period from April to + # October 2004. Specifying dst=false would return the standard period + # from October 2004 to April 2005. + # + # If the dst parameter does not resolve the ambiguity, and a block is + # specified, it is called. The block must take a single parameter - an + # array of the periods that need to be resolved. The block can select and + # return a single period or return nil or an empty array + # to cause an AmbiguousTime exception to be raised. + def period_for_local(local, dst = nil) + results = periods_for_local(local) + + if results.empty? + raise PeriodNotFound + elsif results.size < 2 + results.first + else + # ambiguous result try to resolve + + if !dst.nil? + matches = results.find_all {|period| period.dst? == dst} + results = matches if !matches.empty? + end + + if results.size < 2 + results.first + else + # still ambiguous, try the block + + if block_given? + results = yield results + end + + if results.is_a?(TimezonePeriod) + results + elsif results && results.size == 1 + results.first + else + raise AmbiguousTime, "#{local} is an ambiguous local time." + end + end + end + end + + # Converts a time in UTC to the local timezone. utc can either be + # a DateTime, Time or timestamp (Time.to_i). The returned time has the same + # type as utc. Any timezone information in utc is ignored (it is treated as + # a UTC time). + def utc_to_local(utc) + TimeOrDateTime.wrap(utc) {|wrapped| + period_for_utc(wrapped).to_local(wrapped) + } + end + + # Converts a time in the local timezone to UTC. local can either be + # a DateTime, Time or timestamp (Time.to_i). The returned time has the same + # type as local. Any timezone information in local is ignored (it is treated + # as a local time). + # + # Warning: There are local times that have no equivalent UTC times (e.g. + # in the transition from standard time to daylight savings time). There are + # also local times that have more than one UTC equivalent (e.g. in the + # transition from daylight savings time to standard time). + # + # In the first case (no equivalent UTC time), a PeriodNotFound exception + # will be raised. + # + # In the second case (more than one equivalent UTC time), an AmbiguousTime + # exception will be raised unless the optional dst parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the dst parameter can be used to select whether the + # daylight savings time or local time is used. For example, + # + # Timezone.get('America/New_York').local_to_utc(DateTime.new(2004,10,31,1,30,0)) + # + # would raise an AmbiguousTime exception. + # + # Specifying dst=true would return 2004-10-31 5:30:00. Specifying dst=false + # would return 2004-10-31 6:30:00. + # + # If the dst parameter does not resolve the ambiguity, and a block is + # specified, it is called. The block must take a single parameter - an + # array of the periods that need to be resolved. The block can return a + # single period to use to convert the time or return nil or an empty array + # to cause an AmbiguousTime exception to be raised. + def local_to_utc(local, dst = nil) + TimeOrDateTime.wrap(local) {|wrapped| + if block_given? + period = period_for_local(wrapped, dst) {|periods| yield periods } + else + period = period_for_local(wrapped, dst) + end + + period.to_utc(wrapped) + } + end + + # Returns the current time in the timezone as a Time. + def now + utc_to_local(Time.now.utc) + end + + # Returns the TimezonePeriod for the current time. + def current_period + period_for_utc(Time.now.utc) + end + + # Returns the current Time and TimezonePeriod as an array. The first element + # is the time, the second element is the period. + def current_period_and_time + utc = Time.now.utc + period = period_for_utc(utc) + [period.to_local(utc), period] + end + + alias :current_time_and_period :current_period_and_time + + # Converts a time in UTC to local time and returns it as a string + # according to the given format. The formatting is identical to + # Time.strftime and DateTime.strftime, except %Z is replaced with the + # timezone abbreviation for the specified time (for example, EST or EDT). + def strftime(format, utc = Time.now.utc) + period = period_for_utc(utc) + local = period.to_local(utc) + local = Time.at(local).utc unless local.kind_of?(Time) || local.kind_of?(DateTime) + abbreviation = period.abbreviation.to_s.gsub(/%/, '%%') + + format = format.gsub(/(.?)%Z/) do + if $1 == '%' + # return %%Z so the real strftime treats it as a literal %Z too + '%%Z' + else + "#$1#{abbreviation}" + end + end + + local.strftime(format) + end + + # Compares two Timezones based on their identifier. Returns -1 if tz is less + # than self, 0 if tz is equal to self and +1 if tz is greater than self. + def <=>(tz) + identifier <=> tz.identifier + end + + # Returns true if and only if the identifier of tz is equal to the + # identifier of this Timezone. + def eql?(tz) + self == tz + end + + # Returns a hash of this Timezone. + def hash + identifier.hash + end + + # Dumps this Timezone for marshalling. + def _dump(limit) + identifier + end + + # Loads a marshalled Timezone. + def self._load(data) + Timezone.get(data) + end + + private + # Loads in the index of timezones if it hasn't already been loaded. + def self.load_index + unless @@index_loaded + require 'tzinfo/indexes/timezones' + @@index_loaded = true + end + end + + # Returns an array of proxies corresponding to the given array of + # identifiers. + def self.get_proxies(identifiers) + identifiers.collect {|identifier| get_proxy(identifier)} + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb new file mode 100644 index 0000000000..39ca8bfa53 --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb @@ -0,0 +1,56 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/data_timezone_info' +require 'tzinfo/linked_timezone_info' + +module TZInfo + + # TimezoneDefinition is included into Timezone definition modules. + # TimezoneDefinition provides the methods for defining timezones. + module TimezoneDefinition #:nodoc: + # Add class methods to the includee. + def self.append_features(base) + super + base.extend(ClassMethods) + end + + # Class methods for inclusion. + module ClassMethods #:nodoc: + # Returns and yields a DataTimezoneInfo object to define a timezone. + def timezone(identifier) + yield @timezone = DataTimezoneInfo.new(identifier) + end + + # Defines a linked timezone. + def linked_timezone(identifier, link_to_identifier) + @timezone = LinkedTimezoneInfo.new(identifier, link_to_identifier) + end + + # Returns the last TimezoneInfo to be defined with timezone or + # linked_timezone. + def get + @timezone + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb new file mode 100644 index 0000000000..68e38c35fb --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb @@ -0,0 +1,40 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +module TZInfo + # Represents a timezone defined in a data module. + class TimezoneInfo #:nodoc: + + # The timezone identifier. + attr_reader :identifier + + # Constructs a new TimezoneInfo with an identifier. + def initialize(identifier) + @identifier = identifier + end + + # Returns internal object state as a programmer-readable string. + def inspect + "#<#{self.class}: #@identifier>" + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb new file mode 100644 index 0000000000..6a0bbca46f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb @@ -0,0 +1,94 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +module TZInfo + # Represents an offset defined in a Timezone data file. + class TimezoneOffsetInfo #:nodoc: + # The base offset of the timezone from UTC in seconds. + attr_reader :utc_offset + + # The offset from standard time for the zone in seconds (i.e. non-zero if + # daylight savings is being observed). + attr_reader :std_offset + + # The total offset of this observance from UTC in seconds + # (utc_offset + std_offset). + attr_reader :utc_total_offset + + # The abbreviation that identifies this observance, e.g. "GMT" + # (Greenwich Mean Time) or "BST" (British Summer Time) for "Europe/London". The returned identifier is a + # symbol. + attr_reader :abbreviation + + # Constructs a new TimezoneOffsetInfo. utc_offset and std_offset are + # specified in seconds. + def initialize(utc_offset, std_offset, abbreviation) + @utc_offset = utc_offset + @std_offset = std_offset + @abbreviation = abbreviation + + @utc_total_offset = @utc_offset + @std_offset + end + + # True if std_offset is non-zero. + def dst? + @std_offset != 0 + end + + # Converts a UTC DateTime to local time based on the offset of this period. + def to_local(utc) + TimeOrDateTime.wrap(utc) {|wrapped| + wrapped + @utc_total_offset + } + end + + # Converts a local DateTime to UTC based on the offset of this period. + def to_utc(local) + TimeOrDateTime.wrap(local) {|wrapped| + wrapped - @utc_total_offset + } + end + + # Returns true if and only if toi has the same utc_offset, std_offset + # and abbreviation as this TimezoneOffsetInfo. + def ==(toi) + toi.respond_to?(:utc_offset) && toi.respond_to?(:std_offset) && toi.respond_to?(:abbreviation) && + utc_offset == toi.utc_offset && std_offset == toi.std_offset && abbreviation == toi.abbreviation + end + + # Returns true if and only if toi has the same utc_offset, std_offset + # and abbreviation as this TimezoneOffsetInfo. + def eql?(toi) + self == toi + end + + # Returns a hash of this TimezoneOffsetInfo. + def hash + utc_offset.hash ^ std_offset.hash ^ abbreviation.hash + end + + # Returns internal object state as a programmer-readable string. + def inspect + "#<#{self.class}: #@utc_offset,#@std_offset,#@abbreviation>" + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb new file mode 100644 index 0000000000..00888fcfdc --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb @@ -0,0 +1,198 @@ +#-- +# Copyright (c) 2005-2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'tzinfo/offset_rationals' +require 'tzinfo/time_or_datetime' + +module TZInfo + # A period of time in a timezone where the same offset from UTC applies. + # + # All the methods that take times accept instances of Time, DateTime or + # integer timestamps. + class TimezonePeriod + # The TimezoneTransitionInfo that defines the start of this TimezonePeriod + # (may be nil if unbounded). + attr_reader :start_transition + + # The TimezoneTransitionInfo that defines the end of this TimezonePeriod + # (may be nil if unbounded). + attr_reader :end_transition + + # The TimezoneOffsetInfo for this period. + attr_reader :offset + + # Initializes a new TimezonePeriod. + def initialize(start_transition, end_transition, offset = nil) + @start_transition = start_transition + @end_transition = end_transition + + if offset + raise ArgumentError, 'Offset specified with transitions' if @start_transition || @end_transition + @offset = offset + else + if @start_transition + @offset = @start_transition.offset + elsif @end_transition + @offset = @end_transition.previous_offset + else + raise ArgumentError, 'No offset specified and no transitions to determine it from' + end + end + + @utc_total_offset_rational = nil + end + + # Base offset of the timezone from UTC (seconds). + def utc_offset + @offset.utc_offset + end + + # Offset from the local time where daylight savings is in effect (seconds). + # E.g.: utc_offset could be -5 hours. Normally, std_offset would be 0. + # During daylight savings, std_offset would typically become +1 hours. + def std_offset + @offset.std_offset + end + + # The identifier of this period, e.g. "GMT" (Greenwich Mean Time) or "BST" + # (British Summer Time) for "Europe/London". The returned identifier is a + # symbol. + def abbreviation + @offset.abbreviation + end + alias :zone_identifier :abbreviation + + # Total offset from UTC (seconds). Equal to utc_offset + std_offset. + def utc_total_offset + @offset.utc_total_offset + end + + # Total offset from UTC (days). Result is a Rational. + def utc_total_offset_rational + unless @utc_total_offset_rational + @utc_total_offset_rational = OffsetRationals.rational_for_offset(utc_total_offset) + end + @utc_total_offset_rational + end + + # The start time of the period in UTC as a DateTime. May be nil if unbounded. + def utc_start + @start_transition ? @start_transition.at.to_datetime : nil + end + + # The end time of the period in UTC as a DateTime. May be nil if unbounded. + def utc_end + @end_transition ? @end_transition.at.to_datetime : nil + end + + # The start time of the period in local time as a DateTime. May be nil if + # unbounded. + def local_start + @start_transition ? @start_transition.local_start.to_datetime : nil + end + + # The end time of the period in local time as a DateTime. May be nil if + # unbounded. + def local_end + @end_transition ? @end_transition.local_end.to_datetime : nil + end + + # true if daylight savings is in effect for this period; otherwise false. + def dst? + @offset.dst? + end + + # true if this period is valid for the given UTC DateTime; otherwise false. + def valid_for_utc?(utc) + utc_after_start?(utc) && utc_before_end?(utc) + end + + # true if the given UTC DateTime is after the start of the period + # (inclusive); otherwise false. + def utc_after_start?(utc) + !@start_transition || @start_transition.at <= utc + end + + # true if the given UTC DateTime is before the end of the period + # (exclusive); otherwise false. + def utc_before_end?(utc) + !@end_transition || @end_transition.at > utc + end + + # true if this period is valid for the given local DateTime; otherwise false. + def valid_for_local?(local) + local_after_start?(local) && local_before_end?(local) + end + + # true if the given local DateTime is after the start of the period + # (inclusive); otherwise false. + def local_after_start?(local) + !@start_transition || @start_transition.local_start <= local + end + + # true if the given local DateTime is before the end of the period + # (exclusive); otherwise false. + def local_before_end?(local) + !@end_transition || @end_transition.local_end > local + end + + # Converts a UTC DateTime to local time based on the offset of this period. + def to_local(utc) + @offset.to_local(utc) + end + + # Converts a local DateTime to UTC based on the offset of this period. + def to_utc(local) + @offset.to_utc(local) + end + + # Returns true if this TimezonePeriod is equal to p. This compares the + # start_transition, end_transition and offset using ==. + def ==(p) + p.respond_to?(:start_transition) && p.respond_to?(:end_transition) && + p.respond_to?(:offset) && start_transition == p.start_transition && + end_transition == p.end_transition && offset == p.offset + end + + # Returns true if this TimezonePeriods is equal to p. This compares the + # start_transition, end_transition and offset using eql? + def eql?(p) + p.respond_to?(:start_transition) && p.respond_to?(:end_transition) && + p.respond_to?(:offset) && start_transition.eql?(p.start_transition) && + end_transition.eql?(p.end_transition) && offset.eql?(p.offset) + end + + # Returns a hash of this TimezonePeriod. + def hash + result = @start_transition.hash ^ @end_transition.hash + result ^= @offset.hash unless @start_transition || @end_transition + result + end + + # Returns internal object state as a programmer-readable string. + def inspect + result = "#<#{self.class}: #{@start_transition.inspect},#{@end_transition.inspect}" + result << ",#{@offset.inspect}>" unless @start_transition || @end_transition + result + '>' + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb new file mode 100644 index 0000000000..6b0669cc4a --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb @@ -0,0 +1,129 @@ +#-- +# Copyright (c) 2006 Philip Ross +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +#++ + +require 'date' +require 'tzinfo/time_or_datetime' + +module TZInfo + # Represents an offset defined in a Timezone data file. + class TimezoneTransitionInfo #:nodoc: + # The offset this transition changes to (a TimezoneOffsetInfo instance). + attr_reader :offset + + # The offset this transition changes from (a TimezoneOffsetInfo instance). + attr_reader :previous_offset + + # The numerator of the DateTime if the transition time is defined as a + # DateTime, otherwise the transition time as a timestamp. + attr_reader :numerator_or_time + protected :numerator_or_time + + # Either the denominotor of the DateTime if the transition time is defined + # as a DateTime, otherwise nil. + attr_reader :denominator + protected :denominator + + # Creates a new TimezoneTransitionInfo with the given offset, + # previous_offset (both TimezoneOffsetInfo instances) and UTC time. + # if denominator is nil, numerator_or_time is treated as a number of + # seconds since the epoch. If denominator is specified numerator_or_time + # and denominator are used to create a DateTime as follows: + # + # DateTime.new!(Rational.send(:new!, numerator_or_time, denominator), 0, Date::ITALY) + # + # For performance reasons, the numerator and denominator must be specified + # in their lowest form. + def initialize(offset, previous_offset, numerator_or_time, denominator = nil) + @offset = offset + @previous_offset = previous_offset + @numerator_or_time = numerator_or_time + @denominator = denominator + + @at = nil + @local_end = nil + @local_start = nil + end + + # A TimeOrDateTime instance representing the UTC time when this transition + # occurs. + def at + unless @at + unless @denominator + @at = TimeOrDateTime.new(@numerator_or_time) + else + r = RubyCoreSupport.rational_new!(@numerator_or_time, @denominator) + dt = RubyCoreSupport.datetime_new!(r, 0, Date::ITALY) + @at = TimeOrDateTime.new(dt) + end + end + + @at + end + + # A TimeOrDateTime instance representing the local time when this transition + # causes the previous observance to end (calculated from at using + # previous_offset). + def local_end + @local_end = at.add_with_convert(@previous_offset.utc_total_offset) unless @local_end + @local_end + end + + # A TimeOrDateTime instance representing the local time when this transition + # causes the next observance to start (calculated from at using offset). + def local_start + @local_start = at.add_with_convert(@offset.utc_total_offset) unless @local_start + @local_start + end + + # Returns true if this TimezoneTransitionInfo is equal to the given + # TimezoneTransitionInfo. Two TimezoneTransitionInfo instances are + # considered to be equal by == if offset, previous_offset and at are all + # equal. + def ==(tti) + tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && tti.respond_to?(:at) && + offset == tti.offset && previous_offset == tti.previous_offset && at == tti.at + end + + # Returns true if this TimezoneTransitionInfo is equal to the given + # TimezoneTransitionInfo. Two TimezoneTransitionInfo instances are + # considered to be equal by eql? if offset, previous_offset, + # numerator_or_time and denominator are all equal. This is stronger than ==, + # which just requires the at times to be equal regardless of how they were + # originally specified. + def eql?(tti) + tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && + tti.respond_to?(:numerator_or_time) && tti.respond_to?(:denominator) && + offset == tti.offset && previous_offset == tti.previous_offset && + numerator_or_time == tti.numerator_or_time && denominator == tti.denominator + end + + # Returns a hash of this TimezoneTransitionInfo instance. + def hash + @offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash + end + + # Returns internal object state as a programmer-readable string. + def inspect + "#<#{self.class}: #{at.inspect},#{@offset.inspect}>" + end + end +end -- cgit v1.2.3 From 9b67b7ba2f74067235c8bd8f9dc02fb6337eda52 Mon Sep 17 00:00:00 2001 From: Phil Ross Date: Thu, 1 Oct 2009 22:09:12 +0100 Subject: Edinburgh TimeZone references "Europe/London" instead of "Europe/Dublin" [#3310 state:resolved] --- activesupport/CHANGELOG | 2 ++ activesupport/lib/active_support/values/time_zone.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index fd45a248bb..4edeadf10c 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *Edge* +* Update Edinburgh TimeZone to use "Europe/London" instead of "Europe/Dublin" #3310 [Phil Ross] + * Update bundled TZInfo to v0.3.15 [Geoff Buesing] * JSON: +Object#to_json+ calls +as_json+ to coerce itself into something natively encodable like +Hash+, +Integer+, or +String+. Override +as_json+ instead of +to_json+ so you're JSON library agnostic. [Jeremy Kemper] diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 564528bfe2..53a4c7acf5 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -63,7 +63,7 @@ module ActiveSupport "Azores" => "Atlantic/Azores", "Cape Verde Is." => "Atlantic/Cape_Verde", "Dublin" => "Europe/Dublin", - "Edinburgh" => "Europe/Dublin", + "Edinburgh" => "Europe/London", "Lisbon" => "Europe/Lisbon", "London" => "Europe/London", "Casablanca" => "Africa/Casablanca", -- cgit v1.2.3 From cbcb947b00a7c6992cfe42c6b369e87b4fa4ee23 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Tue, 27 Oct 2009 21:01:31 -0700 Subject: AS::Notifications.subscribe blocks are now yielded the arguments to pass to AS::Notifications::Event.new --- actionpack/lib/action_controller/notifications.rb | 4 +++- activesupport/lib/active_support/notifications.rb | 2 +- activesupport/test/notifications_test.rb | 18 ++++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/actionpack/lib/action_controller/notifications.rb b/actionpack/lib/action_controller/notifications.rb index 4ec88193d5..1a4f29e0e2 100644 --- a/actionpack/lib/action_controller/notifications.rb +++ b/actionpack/lib/action_controller/notifications.rb @@ -1,6 +1,8 @@ require 'active_support/notifications' -ActiveSupport::Notifications.subscribe(/(read|write|cache|expire|exist)_(fragment|page)\??/) do |event| +ActiveSupport::Notifications.subscribe(/(read|write|cache|expire|exist)_(fragment|page)\??/) do |*args| + event = ActiveSupport::Notifications::Event.new(*args) + if logger = ActionController::Base.logger human_name = event.name.to_s.humanize logger.info("#{human_name} (%.1fms)" % event.duration) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 139c66b1e1..2cf91fc383 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -96,7 +96,7 @@ module ActiveSupport def subscribe @queue.subscribe(@pattern) do |*args| - yield Event.new(*args) + yield *args end end end diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 7d2bdf5ccf..b763b740af 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -52,7 +52,9 @@ class NotificationsMainTest < Test::Unit::TestCase def setup @events = [] Thread.abort_on_exception = true - ActiveSupport::Notifications.subscribe { |event| @events << event } + ActiveSupport::Notifications.subscribe do |*args| + @events << ActiveSupport::Notifications::Event.new(*args) + end end def teardown @@ -124,7 +126,11 @@ class NotificationsMainTest < Test::Unit::TestCase def test_subscriber_with_pattern @another = [] - ActiveSupport::Notifications.subscribe("cache"){ |event| @another << event } + + ActiveSupport::Notifications.subscribe("cache") do |*args| + @another << ActiveSupport::Notifications::Event.new(*args) + end + ActiveSupport::Notifications.instrument(:cache){ 1 } sleep(0.1) @@ -136,7 +142,9 @@ class NotificationsMainTest < Test::Unit::TestCase def test_subscriber_with_pattern_as_regexp @another = [] - ActiveSupport::Notifications.subscribe(/cache/){ |event| @another << event } + ActiveSupport::Notifications.subscribe(/cache/) do |*args| + @another << ActiveSupport::Notifications::Event.new(*args) + end ActiveSupport::Notifications.instrument(:something){ 0 } ActiveSupport::Notifications.instrument(:cache){ 1 } @@ -150,7 +158,9 @@ class NotificationsMainTest < Test::Unit::TestCase def test_with_several_consumers_and_several_events @another = [] - ActiveSupport::Notifications.subscribe { |event| @another << event } + ActiveSupport::Notifications.subscribe do |*args| + @another << ActiveSupport::Notifications::Event.new(*args) + end 1.upto(100) do |i| ActiveSupport::Notifications.instrument(:value){ i } -- cgit v1.2.3 From 0b2dd7afd9ee1dfe46506f9d745afb0a23e496ba Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 00:12:35 -0700 Subject: Reorganize CSRF a bit --- .../metal/request_forgery_protection.rb | 56 +++++++++------------- actionpack/lib/action_dispatch/http/request.rb | 4 ++ 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb index ad06657f86..113c20a758 100644 --- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb +++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb @@ -5,7 +5,6 @@ module ActionController #:nodoc: module RequestForgeryProtection extend ActiveSupport::Concern - # TODO : Remove the defined? check when new base is the main base include AbstractController::Helpers, Session included do @@ -21,26 +20,26 @@ module ActionController #:nodoc: helper_method :protect_against_forgery? end - # Protecting controller actions from CSRF attacks by ensuring that all forms are coming from the current web application, not a - # forged link from another site, is done by embedding a token based on a random string stored in the session (which an attacker wouldn't know) in all - # forms and Ajax requests generated by Rails and then verifying the authenticity of that token in the controller. Only - # HTML/JavaScript requests are checked, so this will not protect your XML API (presumably you'll have a different authentication - # scheme there anyway). Also, GET requests are not protected as these should be idempotent anyway. + # Protecting controller actions from CSRF attacks by ensuring that all forms are coming from the current + # web application, not a forged link from another site, is done by embedding a token based on a random + # string stored in the session (which an attacker wouldn't know) in all forms and Ajax requests generated + # by Rails and then verifying the authenticity of that token in the controller. Only HTML/JavaScript + # requests are checked, so this will not protect your XML API (presumably you'll have a different + # authentication scheme there anyway). Also, GET requests are not protected as these should be + # idempotent anyway. # # This is turned on with the protect_from_forgery method, which will check the token and raise an - # ActionController::InvalidAuthenticityToken if it doesn't match what was expected. You can customize the error message in - # production by editing public/422.html. A call to this method in ApplicationController is generated by default in post-Rails 2.0 - # applications. + # ActionController::InvalidAuthenticityToken if it doesn't match what was expected. You can customize the + # error message in production by editing public/422.html. A call to this method in ApplicationController is + # generated by default in post-Rails 2.0 applications. # - # The token parameter is named authenticity_token by default. If you are generating an HTML form manually (without the - # use of Rails' form_for, form_tag or other helpers), you have to include a hidden field named like that and - # set its value to what is returned by form_authenticity_token. Same applies to manually constructed Ajax requests. To - # make the token available through a global variable to scripts on a certain page, you could add something like this to a view: + # The token parameter is named authenticity_token by default. If you are generating an HTML form + # manually (without the use of Rails' form_for, form_tag or other helpers), you have to + # include a hidden field named like that and set its value to what is returned by + # form_authenticity_token. # - # <%= javascript_tag "window._token = '#{form_authenticity_token}'" %> - # - # Request forgery protection is disabled by default in test environment. If you are upgrading from Rails 1.x, add this to - # config/environments/test.rb: + # Request forgery protection is disabled by default in test environment. If you are upgrading from Rails + # 1.x, add this to config/environments/test.rb: # # # Disable request forgery protection in test environment # config.action_controller.allow_forgery_protection = false @@ -57,7 +56,8 @@ module ActionController #:nodoc: # * Keep your GET requests safe and idempotent. More reading material: # * http://www.xml.com/pub/a/2002/04/24/deviant.html # * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1 - # * Make sure the session cookies that Rails creates are non-persistent. Check in Firefox and look for "Expires: at end of session" + # * Make sure the session cookies that Rails creates are non-persistent. Check in Firefox and look + # for "Expires: at end of session" # module ClassMethods # Turn on request forgery protection. Bear in mind that only non-GET, HTML/JavaScript requests are checked. @@ -76,10 +76,7 @@ module ActionController #:nodoc: # * :only/:except - Passed to the before_filter call. Set which actions are verified. def protect_from_forgery(options = {}) self.request_forgery_protection_token ||= :authenticity_token - before_filter :verify_authenticity_token, :only => options.delete(:only), :except => options.delete(:except) - if options[:secret] || options[:digest] - ActiveSupport::Deprecation.warn("protect_from_forgery only takes :only and :except options now. :digest and :secret have no effect", caller) - end + before_filter :verify_authenticity_token, options end end @@ -88,31 +85,24 @@ module ActionController #:nodoc: def verify_authenticity_token verified_request? || raise(ActionController::InvalidAuthenticityToken) end - + # Returns true or false if a request is verified. Checks: # # * is the format restricted? By default, only HTML requests are checked. # * is it a GET request? Gets should be safe and idempotent # * Does the form_authenticity_token match the given token value from the params? def verified_request? - !protect_against_forgery? || - request.method == :get || - request.xhr? || - !verifiable_request_format? || + !protect_against_forgery? || request.forgery_whitelisted? || form_authenticity_token == params[request_forgery_protection_token] end - - def verifiable_request_format? - !request.content_type.nil? && request.content_type.verify_request? - end - + # Sets the token value for the current session. def form_authenticity_token session[:_csrf_token] ||= ActiveSupport::SecureRandom.base64(32) end def protect_against_forgery? - allow_forgery_protection && request_forgery_protection_token + allow_forgery_protection end end end diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 1e366520c9..bb99fac5e0 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -97,6 +97,10 @@ module ActionDispatch end end + def forgery_whitelisted? + method == :get || xhr? || !(!content_type.nil? && content_type.verify_request?) + end + def media_type content_type.to_s end -- cgit v1.2.3 From c5e73b897616049c613b0331dd53e88dbc9c1532 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 00:13:08 -0700 Subject: Reduce TextTemplate cost for simple cases --- actionpack/lib/action_dispatch/http/mime_type.rb | 1 + actionpack/lib/action_view/template/text.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index e85823d8db..c30897b32a 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -24,6 +24,7 @@ module Mime LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k.blank? } def self.[](type) + return type if type.is_a?(Type) Type.lookup_by_extension(type.to_s) end diff --git a/actionpack/lib/action_view/template/text.rb b/actionpack/lib/action_view/template/text.rb index f7d0df5ba0..fa8cfe506b 100644 --- a/actionpack/lib/action_view/template/text.rb +++ b/actionpack/lib/action_view/template/text.rb @@ -1,6 +1,8 @@ module ActionView #:nodoc: class TextTemplate < String #:nodoc: - def initialize(string, content_type = Mime[:html]) + HTML = Mime[:html] + + def initialize(string, content_type = HTML) super(string.to_s) @content_type = Mime[content_type] || content_type end -- cgit v1.2.3 From a0fc92f455e239fd667ed267b76855eaaf190d2c Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 01:43:33 -0700 Subject: This is all that's needed in 1.8.7+ --- .../lib/active_support/core_ext/array/wrap.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 9d45c2739b..63b6640843 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -1,17 +1,18 @@ class Array # Wraps the object in an Array unless it's an Array. Converts the # object to an Array using #to_ary if it implements that. - def self.wrap(object) - case object - when nil - [] - when self - object - else - if object.respond_to?(:to_ary) - object.to_ary - else + array = Array("foo\nbar") + + if array.size == 1 + def self.wrap(object) + Array(object) + end + else + def self.wrap(object) + if object.is_a?(String) [object] + else + Array(object) end end end -- cgit v1.2.3 From 654b33afc5a789aea90199bbb108093a80fe8020 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 01:43:46 -0700 Subject: New semantics eliminate the need for __send__ --- actionpack/lib/action_controller/metal/verification.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_controller/metal/verification.rb b/actionpack/lib/action_controller/metal/verification.rb index d3d78e3749..500cced539 100644 --- a/actionpack/lib/action_controller/metal/verification.rb +++ b/actionpack/lib/action_controller/metal/verification.rb @@ -79,8 +79,8 @@ module ActionController #:nodoc: # do not apply this verification to the actions specified in the associated # array (may also be a single value). def verify(options={}) - before_filter :only => options[:only], :except => options[:except] do |c| - c.__send__ :verify_action, options + before_filter :only => options[:only], :except => options[:except] do + verify_action options end end end -- cgit v1.2.3 From 03d3824d965f38d3c595330d697fb16dc9efdb9a Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 01:50:59 -0700 Subject: Make it possible to have IDs per request --- activesupport/lib/active_support/notifications.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 2cf91fc383..bf668964f5 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -45,7 +45,7 @@ module ActiveSupport mattr_accessor :queue class << self - delegate :instrument, :to => :instrumenter + delegate :instrument, :transaction_id, :generate_id, :to => :instrumenter def instrumenter Thread.current[:notifications_instrumeter] ||= Instrumenter.new(publisher) @@ -63,7 +63,18 @@ module ActiveSupport class Instrumenter def initialize(publisher) @publisher = publisher - @id = SecureRandom.hex(10) + @id = random_id + end + + def transaction + @id, old_id = random_id, @id + yield + ensure + @id = old_id + end + + def transaction_id + @id end def instrument(name, payload={}) @@ -72,6 +83,11 @@ module ActiveSupport ensure @publisher.publish(name, time, Time.now, result, @id, payload) end + + private + def random_id + SecureRandom.hex(10) + end end class Publisher -- cgit v1.2.3 From c9487ed6aff76693f33ff89e466ba944297681d3 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 01:58:33 -0700 Subject: Change Event#thread_id to #transaction_id. Defaults to one "transaction" per thread but you can explicitly declare the start of a new one. This makes it possible for each request to have it own id. --- activesupport/lib/active_support/notifications.rb | 25 +++++++++++------------ activesupport/test/notifications_test.rb | 20 ++++++++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index bf668964f5..9eae3bebe2 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -16,8 +16,8 @@ module ActiveSupport # # @events = [] # - # ActiveSupport::Notifications.subscribe do |event| - # @events << event + # ActiveSupport::Notifications.subscribe do |*args| + # @events << ActiveSupport::Notifications::Event.new(*args) # end # # ActiveSupport::Notifications.instrument(:render, :extra => :information) do @@ -25,7 +25,6 @@ module ActiveSupport # end # # event = @events.first - # event.class #=> ActiveSupport::Notifications::Event # event.name #=> :render # event.duration #=> 10 (in miliseconds) # event.result #=> "Foo" @@ -45,7 +44,7 @@ module ActiveSupport mattr_accessor :queue class << self - delegate :instrument, :transaction_id, :generate_id, :to => :instrumenter + delegate :instrument, :transaction_id, :transaction, :to => :instrumenter def instrumenter Thread.current[:notifications_instrumeter] ||= Instrumenter.new(publisher) @@ -118,15 +117,15 @@ module ActiveSupport end class Event - attr_reader :name, :time, :end, :thread_id, :result, :payload - - def initialize(name, start, ending, result, thread_id, payload) - @name = name - @payload = payload.dup - @time = start - @thread_id = thread_id - @end = ending - @result = result + attr_reader :name, :time, :end, :transaction_id, :result, :payload + + def initialize(name, start, ending, result, transaction_id, payload) + @name = name + @payload = payload.dup + @time = start + @transaction_id = transaction_id + @end = ending + @result = result end def duration diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index b763b740af..9175c8f26e 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -124,6 +124,26 @@ class NotificationsMainTest < Test::Unit::TestCase assert_equal Hash[:payload => "notifications"], @events.last.payload end + def test_subscribed_in_a_transaction + @another = [] + + ActiveSupport::Notifications.subscribe("cache") do |*args| + @another << ActiveSupport::Notifications::Event.new(*args) + end + + ActiveSupport::Notifications.instrument(:cache){ 1 } + ActiveSupport::Notifications.transaction do + ActiveSupport::Notifications.instrument(:cache){ 1 } + end + ActiveSupport::Notifications.instrument(:cache){ 1 } + + sleep 0.1 + + before, during, after = @another.map {|e| e.transaction_id } + assert_equal before, after + assert_not_equal before, during + end + def test_subscriber_with_pattern @another = [] -- cgit v1.2.3 From f51ac9e78014b6be531b4413de79fb041721df11 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 06:51:25 -0700 Subject: Array.wrap(struct) needs to return the wrapped struct --- .../lib/active_support/core_ext/array/wrap.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 63b6640843..38bb68c1ec 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -1,19 +1,14 @@ class Array # Wraps the object in an Array unless it's an Array. Converts the # object to an Array using #to_ary if it implements that. - array = Array("foo\nbar") - - if array.size == 1 - def self.wrap(object) + def self.wrap(object) + if object.nil? + [] + # to_a doesn't work correctly with Array() but to_ary always does + elsif object.respond_to?(:to_a) && !object.respond_to?(:to_ary) + [object] + else Array(object) end - else - def self.wrap(object) - if object.is_a?(String) - [object] - else - Array(object) - end - end end end -- cgit v1.2.3 From 427a7385eb9b784ad4372bf607217b0b7b2ca543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 28 Oct 2009 14:13:48 -0500 Subject: Make polymorphic_url work with symbols again and refactor it [#1384 status:resolved] Signed-off-by: Joshua Peek --- .../lib/action_controller/polymorphic_routes.rb | 41 ++++------------------ .../test/activerecord/polymorphic_routes_test.rb | 14 ++++---- 2 files changed, 13 insertions(+), 42 deletions(-) diff --git a/actionpack/lib/action_controller/polymorphic_routes.rb b/actionpack/lib/action_controller/polymorphic_routes.rb index 2adf3575a7..eaed00cfb7 100644 --- a/actionpack/lib/action_controller/polymorphic_routes.rb +++ b/actionpack/lib/action_controller/polymorphic_routes.rb @@ -80,9 +80,8 @@ module ActionController record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 end - record = extract_record(record_or_hash_or_array) - record = record.to_model if record.respond_to?(:to_model) - namespace = extract_namespace(record_or_hash_or_array) + record = extract_record(record_or_hash_or_array) + record = record.to_model if record.respond_to?(:to_model) args = case record_or_hash_or_array when Hash; [ record_or_hash_or_array ] @@ -105,8 +104,7 @@ module ActionController end args.delete_if {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} - - named_route = build_named_route_call(record_or_hash_or_array, namespace, inflection, options) + named_route = build_named_route_call(record_or_hash_or_array, inflection, options) url_options = options.except(:action, :routing_type) unless url_options.empty? @@ -138,18 +136,6 @@ module ActionController EOT end - def formatted_polymorphic_url(record_or_hash, options = {}) - ActiveSupport::Deprecation.warn("formatted_polymorphic_url has been deprecated. Please pass :format to the polymorphic_url method instead", caller) - options[:format] = record_or_hash.pop if Array === record_or_hash - polymorphic_url(record_or_hash, options) - end - - def formatted_polymorphic_path(record_or_hash, options = {}) - ActiveSupport::Deprecation.warn("formatted_polymorphic_path has been deprecated. Please pass :format to the polymorphic_path method instead", caller) - options[:format] = record_or_hash.pop if record_or_hash === Array - polymorphic_url(record_or_hash, options.merge(:routing_type => :path)) - end - private def action_prefix(options) options[:action] ? "#{options[:action]}_" : '' @@ -159,7 +145,7 @@ module ActionController options[:routing_type] || :url end - def build_named_route_call(records, namespace, inflection, options = {}) + def build_named_route_call(records, inflection, options = {}) unless records.is_a?(Array) record = extract_record(records) route = '' @@ -169,7 +155,7 @@ module ActionController if parent.is_a?(Symbol) || parent.is_a?(String) string << "#{parent}_" else - string << "#{RecordIdentifier.__send__("plural_class_name", parent)}".singularize + string << RecordIdentifier.__send__("plural_class_name", parent).singularize string << "_" end end @@ -178,12 +164,12 @@ module ActionController if record.is_a?(Symbol) || record.is_a?(String) route << "#{record}_" else - route << "#{RecordIdentifier.__send__("plural_class_name", record)}" + route << RecordIdentifier.__send__("plural_class_name", record) route = route.singularize if inflection == :singular route << "_" end - action_prefix(options) + namespace + route + routing_type(options).to_s + action_prefix(options) + route + routing_type(options).to_s end def extract_record(record_or_hash_or_array) @@ -193,18 +179,5 @@ module ActionController else record_or_hash_or_array end end - - # Remove the first symbols from the array and return the url prefix - # implied by those symbols. - def extract_namespace(record_or_hash_or_array) - return "" unless record_or_hash_or_array.is_a?(Array) - - namespace_keys = [] - while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol) - namespace_keys << record_or_hash_or_array.shift - end - - namespace_keys.map {|k| "#{k}_"}.join - end end end diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb index 37f1f6dff8..ad744421db 100644 --- a/actionpack/test/activerecord/polymorphic_routes_test.rb +++ b/actionpack/test/activerecord/polymorphic_routes_test.rb @@ -98,14 +98,6 @@ class PolymorphicRoutesTest < ActionController::TestCase end end - def test_formatted_url_helper_is_deprecated - with_test_routes do - assert_deprecated do - formatted_polymorphic_url([@project, :pdf]) - end - end - end - def test_format_option with_test_routes do @project.save @@ -251,6 +243,12 @@ class PolymorphicRoutesTest < ActionController::TestCase end end + def test_with_array_containing_symbols + with_test_routes do + assert_equal "http://example.com/series/new", polymorphic_url([:new, :series]) + end + end + def test_with_hash with_test_routes do @project.save -- cgit v1.2.3 From 8dcf91ca113579646e95b0fd7a864dfb6512a53b Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 28 Oct 2009 16:53:34 -0400 Subject: First pass at cleaning up action caching --- actionpack/lib/action_controller/caching.rb | 28 ++-- .../lib/action_controller/caching/actions.rb | 172 ++++++++++----------- actionpack/lib/action_view/render/rendering.rb | 1 - .../lib/active_support/core_ext/hash/slice.rb | 6 + 4 files changed, 102 insertions(+), 105 deletions(-) diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 38cf1da6a8..63429e1cbe 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -52,19 +52,23 @@ module ActionController #:nodoc: end end - protected - # Convenience accessor - def cache(key, options = {}, &block) - if cache_configured? - cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block) - else - yield - end - end + def caching_allowed? + request.get? && response.status == 200 + end - private - def cache_configured? - self.class.cache_configured? + protected + # Convenience accessor + def cache(key, options = {}, &block) + if cache_configured? + cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block) + else + yield end + end + + private + def cache_configured? + self.class.cache_configured? + end end end diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index cb0c3a1384..05305d9a3f 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -2,9 +2,10 @@ require 'set' module ActionController #:nodoc: module Caching - # Action caching is similar to page caching by the fact that the entire output of the response is cached, but unlike page caching, - # every request still goes through the Action Pack. The key benefit of this is that filters are run before the cache is served, which - # allows for authentication and other restrictions on whether someone is allowed to see the cache. Example: + # Action caching is similar to page caching by the fact that the entire output of the response is + # cached, but unlike page caching, every request still goes through the Action Pack. The key benefit + # of this is that filters are run before the cache is served, which allows for authentication and other + # restrictions on whether someone is allowed to see the cache. Example: # # class ListsController < ApplicationController # before_filter :authenticate, :except => :public @@ -12,44 +13,53 @@ module ActionController #:nodoc: # caches_action :index, :show, :feed # end # - # In this example, the public action doesn't require authentication, so it's possible to use the faster page caching method. But both the - # show and feed action are to be shielded behind the authenticate filter, so we need to implement those as action caches. + # In this example, the public action doesn't require authentication, so it's possible to use the faster + # page caching method. But both the show and feed action are to be shielded behind the authenticate + # filter, so we need to implement those as action caches. # - # Action caching internally uses the fragment caching and an around filter to do the job. The fragment cache is named according to both - # the current host and the path. So a page that is accessed at http://david.somewhere.com/lists/show/1 will result in a fragment named - # "david.somewhere.com/lists/show/1". This allows the cacher to differentiate between "david.somewhere.com/lists/" and - # "jamis.somewhere.com/lists/" -- which is a helpful way of assisting the subdomain-as-account-key pattern. + # Action caching internally uses the fragment caching and an around filter to do the job. The fragment + # cache is named according to both the current host and the path. So a page that is accessed at + # http://david.somewhere.com/lists/show/1 will result in a fragment named + # "david.somewhere.com/lists/show/1". This allows the cacher to differentiate between + # "david.somewhere.com/lists/" and + # "jamis.somewhere.com/lists/" -- which is a helpful way of assisting the subdomain-as-account-key + # pattern. # - # Different representations of the same resource, e.g. http://david.somewhere.com/lists and http://david.somewhere.com/lists.xml - # are treated like separate requests and so are cached separately. Keep in mind when expiring an action cache that :action => 'lists' is not the same - # as :action => 'list', :format => :xml. + # Different representations of the same resource, e.g. http://david.somewhere.com/lists and + # http://david.somewhere.com/lists.xml + # are treated like separate requests and so are cached separately. Keep in mind when expiring an + # action cache that :action => 'lists' is not the same as + # :action => 'list', :format => :xml. # - # You can set modify the default action cache path by passing a :cache_path option. This will be passed directly to ActionCachePath.path_for. This is handy - # for actions with multiple possible routes that should be cached differently. If a block is given, it is called with the current controller instance. + # You can set modify the default action cache path by passing a :cache_path option. This will be + # passed directly to ActionCachePath.path_for. This is handy for actions with multiple possible + # routes that should be cached differently. If a block is given, it is called with the current + # controller instance. # - # And you can also use :if (or :unless) to pass a Proc that specifies when the action should be cached. + # And you can also use :if (or :unless) to pass a Proc that specifies when the action should + # be cached. # # Finally, if you are using memcached, you can also pass :expires_in. # # class ListsController < ApplicationController # before_filter :authenticate, :except => :public # caches_page :public - # caches_action :index, :if => Proc.new { |c| !c.request.format.json? } # cache if is not a JSON request + # caches_action :index, :if => proc { |c| !c.request.format.json? } # cache if is not a JSON request # caches_action :show, :cache_path => { :project => 1 }, :expires_in => 1.hour - # caches_action :feed, :cache_path => Proc.new { |controller| + # caches_action :feed, :cache_path => proc { |controller| # controller.params[:user_id] ? # controller.send(:user_list_url, controller.params[:user_id], controller.params[:id]) : # controller.send(:list_url, controller.params[:id]) } # end # - # If you pass :layout => false, it will only cache your action content. It is useful when your layout has dynamic information. + # If you pass :layout => false, it will only cache your action content. It is useful when your + # layout has dynamic information. # module Actions - def self.included(base) #:nodoc: - base.extend(ClassMethods) - base.class_eval do - attr_accessor :rendered_action_cache, :action_cache_path - end + extend ActiveSupport::Concern + + included do + attr_accessor :rendered_action_cache, :action_cache_path end module ClassMethods @@ -58,22 +68,35 @@ module ActionController #:nodoc: def caches_action(*actions) return unless cache_configured? options = actions.extract_options! - filter_options = { :only => actions, :if => options.delete(:if), :unless => options.delete(:unless) } + filter_options = options.extract!(:if, :unless).merge(:only => actions) + cache_options = options.extract!(:layout, :cache_path).merge(:store_options => options) - cache_filter = ActionCacheFilter.new(:layout => options.delete(:layout), :cache_path => options.delete(:cache_path), :store_options => options) - - around_filter cache_filter, filter_options + around_filter ActionCacheFilter.new(cache_options), filter_options end end + def _render_cache_fragment(cache, extension, layout) + self.rendered_action_cache = true + response.content_type = Mime[extension].to_s if extension + options = { :text => cache } + options.merge!(:layout => true) if layout + render options + end + + def _save_fragment(name, layout, options) + return unless caching_allowed? + + content = layout ? view_context.content_for(:layout) : response_body + write_fragment(name, content, options) + end + protected def expire_action(options = {}) return unless cache_configured? - if options[:action].is_a?(Array) - options[:action].dup.each do |action| - expire_fragment(ActionCachePath.path_for(self, options.merge({ :action => action }), false)) - end + actions = options[:action] + if actions.is_a?(Array) + actions.each {|action| expire_action(options.merge(:action => action)) } else expire_fragment(ActionCachePath.path_for(self, options, false)) end @@ -81,57 +104,21 @@ module ActionController #:nodoc: class ActionCacheFilter #:nodoc: def initialize(options, &block) - @options = options + @cache_path, @store_options, @layout = + options.values_at(:cache_path, :store_options, :layout) end def filter(controller) - should_continue = before(controller) - yield if should_continue - after(controller) - end - - def before(controller) - cache_path = ActionCachePath.new(controller, path_options_for(controller, @options.slice(:cache_path))) + path_options = @cache_path.respond_to?(:call) ? @cache_path.call(controller) : @cache_path + cache_path = ActionCachePath.new(controller, path_options || {}) - if cache = controller.read_fragment(cache_path.path, @options[:store_options]) - controller.rendered_action_cache = true - set_content_type!(controller, cache_path.extension) - options = { :text => cache } - options.merge!(:layout => true) if cache_layout? - controller.__send__(:render, options) - false + if cache = controller.read_fragment(cache_path.path, @store_options) + controller._render_cache_fragment(cache, cache_path.extension, @layout == false) else - controller.action_cache_path = cache_path + yield + controller._save_fragment(cache_path.path, @layout == false, @store_options) end end - - def after(controller) - return if controller.rendered_action_cache || !caching_allowed(controller) - action_content = cache_layout? ? content_for_layout(controller) : controller.response.body - controller.write_fragment(controller.action_cache_path.path, action_content, @options[:store_options]) - end - - private - def set_content_type!(controller, extension) - controller.response.content_type = Mime::Type.lookup_by_extension(extension).to_s if extension - end - - def path_options_for(controller, options) - ((path_options = options[:cache_path]).respond_to?(:call) ? path_options.call(controller) : path_options) || {} - end - - def caching_allowed(controller) - controller.request.get? && controller.response.status.to_i == 200 - end - - def cache_layout? - @options[:layout] == false - end - - def content_for_layout(controller) - template = controller.view_context - template.layout && template.instance_variable_get('@cached_content_for_layout') - end end class ActionCachePath @@ -142,10 +129,11 @@ module ActionController #:nodoc: new(controller, options, infer_extension).path end end - - # If +infer_extension+ is true, the cache path extension is looked up from the request's path & format. - # This is desirable when reading and writing the cache, but not when expiring the cache - - # expire_action should expire the same files regardless of the request format. + + # If +infer_extension+ is true, the cache path extension is looked up from the request's + # path & format. This is desirable when reading and writing the cache, but not when + # expiring the cache - expire_action should expire the same files regardless of the + # request format. def initialize(controller, options = {}, infer_extension = true) if infer_extension extract_extension(controller.request) @@ -158,20 +146,20 @@ module ActionController #:nodoc: @path = URI.unescape(path) end - private - def normalize!(path) - path << 'index' if path[-1] == ?/ - end + private + def normalize!(path) + path << 'index' if path[-1] == ?/ + end - def add_extension!(path, extension) - path << ".#{extension}" if extension and !path.ends_with?(extension) - end - - def extract_extension(request) - # Don't want just what comes after the last '.' to accommodate multi part extensions - # such as tar.gz. - @extension = request.path[/^[^.]+\.(.+)$/, 1] || request.cache_format - end + def add_extension!(path, extension) + path << ".#{extension}" if extension and !path.ends_with?(extension) + end + + def extract_extension(request) + # Don't want just what comes after the last '.' to accommodate multi part extensions + # such as tar.gz. + @extension = request.path[/^[^.]+\.(.+)$/, 1] || request.cache_format + end end end end diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index b6f5b9b6d1..7dcd9d38d9 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -123,7 +123,6 @@ module ActionView template.render(self, locals) end - @cached_content_for_layout = content @_content_for[:layout] = content if layout diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb index 7aa394d7bf..e4a864c20f 100644 --- a/activesupport/lib/active_support/core_ext/hash/slice.rb +++ b/activesupport/lib/active_support/core_ext/hash/slice.rb @@ -29,4 +29,10 @@ class Hash replace(hash) omit end + + def extract!(*keys) + result = {} + keys.each {|key| result[key] = delete(key) } + result + end end -- cgit v1.2.3 From a288b74f1c75c6f100de7611a5093a421f1ad6d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 28 Oct 2009 18:32:53 -0200 Subject: Generators should use Rails.root instead of Dir.pwd [#3408 status:resolved] Signed-off-by: Yehuda Katz --- railties/lib/rails/generators/base.rb | 17 +++++++++++++++++ railties/test/generators/actions_test.rb | 2 +- railties/test/generators/app_generator_test.rb | 4 ++-- railties/test/generators/controller_generator_test.rb | 2 +- railties/test/generators/generator_generator_test.rb | 2 +- railties/test/generators/generators_test_helper.rb | 11 ++++++++--- railties/test/generators/helper_generator_test.rb | 2 +- .../test/generators/integration_test_generator_test.rb | 2 +- railties/test/generators/mailer_generator_test.rb | 2 +- railties/test/generators/metal_generator_test.rb | 2 +- railties/test/generators/migration_generator_test.rb | 2 +- railties/test/generators/model_generator_test.rb | 2 +- railties/test/generators/observer_generator_test.rb | 2 +- .../test/generators/performance_test_generator_test.rb | 2 +- railties/test/generators/plugin_generator_test.rb | 2 +- railties/test/generators/resource_generator_test.rb | 2 +- .../generators/scaffold_controller_generator_test.rb | 2 +- railties/test/generators/scaffold_generator_test.rb | 3 +-- .../test/generators/session_migration_generator_test.rb | 2 +- railties/test/generators/stylesheets_generator_test.rb | 2 +- 20 files changed, 44 insertions(+), 23 deletions(-) diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 7af99797ea..e6baf2fc79 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -12,6 +12,16 @@ module Rails add_runtime_options! + # Always move to rails source root. + # + def initialize(*args) #:nodoc: + if !invoked?(args) && defined?(Rails.root) && Rails.root + self.destination_root = Rails.root + FileUtils.cd(destination_root) + end + super + end + # Automatically sets the source root based on the class name. # def self.source_root @@ -247,6 +257,13 @@ module Rails end end + # Check if this generator was invoked from another one by inspecting + # parameters. + # + def invoked?(args) + args.last.is_a?(Hash) && args.last.key?(:invocations) + end + # Use Rails default banner. # def self.banner diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 199b5fa8b4..f5cb26cf52 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -182,7 +182,7 @@ class ActionsTest < GeneratorsTestCase end def generator(config={}) - @generator ||= Rails::Generators::Base.new([], {}, { :destination_root => destination_root }.merge!(config)) + @generator ||= Rails::Generators::Base.new([], {}, config) end def action(*args, &block) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 20f2a24e6d..c44d25b72c 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -126,7 +126,7 @@ class AppGeneratorTest < GeneratorsTestCase def test_template_from_dir_pwd FileUtils.cd(Rails.root) - assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"]) + assert_match /It works from file!/, run_generator(["-m", "../lib/template.rb"]) end def test_template_raises_an_error_with_invalid_path @@ -170,7 +170,7 @@ class AppGeneratorTest < GeneratorsTestCase end def generator(options={}) - @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :destination_root => destination_root) + @generator ||= Rails::Generators::AppGenerator.new([destination_root], options) end def action(*args, &block) diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 56bc688ad0..3020e928dc 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -74,7 +74,7 @@ class ControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "foo", "bar"]) - silence(:stdout) { Rails::Generators::ControllerGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::ControllerGenerator.start args } end end diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index aea3f4da51..703aa20914 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -20,7 +20,7 @@ class GeneratorGeneratorTest < GeneratorsTestCase protected def run_generator(args=["awesome"], config={}) - silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config } end end diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index ccf08c347c..829a38c103 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -1,5 +1,5 @@ # TODO: Fix this RAILS_ENV stuff -RAILS_ENV = 'test' +RAILS_ENV = 'test' unless defined?(RAILS_ENV) require 'abstract_unit' Rails.application.config.root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) @@ -11,12 +11,17 @@ require 'action_dispatch' CURRENT_PATH = File.expand_path(Dir.pwd) Rails::Generators.no_color! +module Rails + def self.root + @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'tmp')) + end +end + class GeneratorsTestCase < Test::Unit::TestCase include FileUtils def destination_root - @destination_root ||= File.expand_path(File.join(File.dirname(__FILE__), - '..', 'fixtures', 'tmp')) + Rails.root end def setup diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index f8bfc517a2..44f5a324af 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -54,7 +54,7 @@ class HelperGeneratorTest < GeneratorsTestCase protected def run_generator(args=["admin"]) - silence(:stdout) { Rails::Generators::HelperGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::HelperGenerator.start args } end end diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb index 6a504ceea2..68b55a66f9 100644 --- a/railties/test/generators/integration_test_generator_test.rb +++ b/railties/test/generators/integration_test_generator_test.rb @@ -12,7 +12,7 @@ class IntegrationTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["integration"]) - silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args } end end diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index 251474ad16..e33af25773 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -46,7 +46,7 @@ class MailerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["notifier", "foo", "bar"]) - silence(:stdout) { Rails::Generators::MailerGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::MailerGenerator.start args } end end diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index 80bf342892..4f36e0f612 100644 --- a/railties/test/generators/metal_generator_test.rb +++ b/railties/test/generators/metal_generator_test.rb @@ -17,7 +17,7 @@ class MetalGeneratorTest < GeneratorsTestCase protected def run_generator(args=["foo"]) - silence(:stdout) { Rails::Generators::MetalGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::MetalGenerator.start args } end end diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 35172a8be4..b1fdbef425 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -53,7 +53,7 @@ class MigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[@migration]) - silence(:stdout) { Rails::Generators::MigrationGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::MigrationGenerator.start args } end end diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index e073b11e1e..a0d4bed992 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -175,7 +175,7 @@ class ModelGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "name:string", "age:integer"], config={}) - silence(:stdout) { Rails::Generators::ModelGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::ModelGenerator.start args, config } end end diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index 6fed2998dd..becc217ac0 100644 --- a/railties/test/generators/observer_generator_test.rb +++ b/railties/test/generators/observer_generator_test.rb @@ -27,7 +27,7 @@ class ObserverGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"]) - silence(:stdout) { Rails::Generators::ObserverGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::ObserverGenerator.start args } end end diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index d19128f79a..00906a61e0 100644 --- a/railties/test/generators/performance_test_generator_test.rb +++ b/railties/test/generators/performance_test_generator_test.rb @@ -12,7 +12,7 @@ class PerformanceTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["performance"]) - silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args } end end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index f5b8b6ffb6..c8bfaf3d97 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -50,7 +50,7 @@ class PluginGeneratorTest < GeneratorsTestCase protected def run_generator(args=["plugin_fu"], config={}) - silence(:stdout) { Rails::Generators::PluginGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout){ Rails::Generators::PluginGenerator.start args, config } end end diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index dcae81c204..99811bc07b 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -100,7 +100,7 @@ class ResourceGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"], config={}) - silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config } end end diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 02155c295c..43647360d6 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -139,7 +139,7 @@ class ScaffoldControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["User", "name:string", "age:integer"]) - silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args } end end diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index c0652c034f..09ab58e404 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -122,8 +122,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase def run_generator(config={}) silence(:stdout) do - Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], - config.merge(:destination_root => destination_root) + Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], config end end diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 34fb996b7f..342b9a900e 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -28,7 +28,7 @@ class SessionMigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[]) - silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args } end end diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index 15263d4bb8..6a07898c51 100644 --- a/railties/test/generators/stylesheets_generator_test.rb +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -18,7 +18,7 @@ class StylesheetsGeneratorTest < GeneratorsTestCase protected def run_generator(config={}) - silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config } end end -- cgit v1.2.3 From 51c24ae3e3c1a260a304042aff5e1a7c56faabfe Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 29 Oct 2009 00:37:29 -0400 Subject: Caching refactoring --- actionpack/lib/action_controller/caching.rb | 32 +++-- .../lib/action_controller/caching/actions.rb | 135 ++++++++++----------- .../lib/action_controller/caching/sweeping.rb | 2 +- .../lib/action_controller/metal/compatibility.rb | 8 +- actionpack/lib/action_dispatch/http/request.rb | 6 +- actionpack/test/controller/caching_test.rb | 8 +- 6 files changed, 98 insertions(+), 93 deletions(-) diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 63429e1cbe..083d6328af 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -3,26 +3,30 @@ require 'uri' require 'set' module ActionController #:nodoc: - # Caching is a cheap way of speeding up slow applications by keeping the result of calculations, renderings, and database calls - # around for subsequent requests. Action Controller affords you three approaches in varying levels of granularity: Page, Action, Fragment. + # Caching is a cheap way of speeding up slow applications by keeping the result of + # calculations, renderings, and database calls around for subsequent requests. + # Action Controller affords you three approaches in varying levels of granularity: + # Page, Action, Fragment. # - # You can read more about each approach and the sweeping assistance by clicking the modules below. - # - # Note: To turn off all caching and sweeping, set Base.perform_caching = false. + # You can read more about each approach and the sweeping assistance by clicking the + # modules below. # + # Note: To turn off all caching and sweeping, set + # config.action_controller.perform_caching = false. # # == Caching stores # - # All the caching stores from ActiveSupport::Cache are available to be used as backends for Action Controller caching. This setting only - # affects action and fragment caching as page caching is always written to disk. + # All the caching stores from ActiveSupport::Cache are available to be used as backends + # for Action Controller caching. This setting only affects action and fragment caching + # as page caching is always written to disk. # # Configuration examples (MemoryStore is the default): # - # ActionController::Base.cache_store = :memory_store - # ActionController::Base.cache_store = :file_store, "/path/to/cache/directory" - # ActionController::Base.cache_store = :drb_store, "druby://localhost:9192" - # ActionController::Base.cache_store = :mem_cache_store, "localhost" - # ActionController::Base.cache_store = MyOwnStore.new("parameter") + # config.action_controller.cache_store = :memory_store + # config.action_controller.cache_store = :file_store, "/path/to/cache/directory" + # config.action_controller.cache_store = :drb_store, "druby://localhost:9192" + # config.action_controller.cache_store = :mem_cache_store, "localhost" + # config.action_controller.cache_store = MyOwnStore.new("parameter") module Caching extend ActiveSupport::Concern @@ -46,8 +50,10 @@ module ActionController #:nodoc: @@perform_caching = true cattr_accessor :perform_caching + end - def self.cache_configured? + module ClassMethods + def cache_configured? perform_caching && cache_store end end diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index 05305d9a3f..35111a4b92 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -2,10 +2,12 @@ require 'set' module ActionController #:nodoc: module Caching - # Action caching is similar to page caching by the fact that the entire output of the response is - # cached, but unlike page caching, every request still goes through the Action Pack. The key benefit - # of this is that filters are run before the cache is served, which allows for authentication and other - # restrictions on whether someone is allowed to see the cache. Example: + # Action caching is similar to page caching by the fact that the entire + # output of the response is cached, but unlike page caching, every + # request still goes through the Action Pack. The key benefit + # of this is that filters are run before the cache is served, which + # allows for authentication and other restrictions on whether someone + # is allowed to see the cache. Example: # # class ListsController < ApplicationController # before_filter :authenticate, :except => :public @@ -13,55 +15,65 @@ module ActionController #:nodoc: # caches_action :index, :show, :feed # end # - # In this example, the public action doesn't require authentication, so it's possible to use the faster - # page caching method. But both the show and feed action are to be shielded behind the authenticate + # In this example, the public action doesn't require authentication, + # so it's possible to use the faster page caching method. But both + # the show and feed action are to be shielded behind the authenticate # filter, so we need to implement those as action caches. # - # Action caching internally uses the fragment caching and an around filter to do the job. The fragment - # cache is named according to both the current host and the path. So a page that is accessed at + # Action caching internally uses the fragment caching and an around + # filter to do the job. The fragment cache is named according to both + # the current host and the path. So a page that is accessed at # http://david.somewhere.com/lists/show/1 will result in a fragment named - # "david.somewhere.com/lists/show/1". This allows the cacher to differentiate between - # "david.somewhere.com/lists/" and - # "jamis.somewhere.com/lists/" -- which is a helpful way of assisting the subdomain-as-account-key - # pattern. + # "david.somewhere.com/lists/show/1". This allows the cacher to + # differentiate between "david.somewhere.com/lists/" and + # "jamis.somewhere.com/lists/" -- which is a helpful way of assisting + # the subdomain-as-account-key pattern. # - # Different representations of the same resource, e.g. http://david.somewhere.com/lists and + # Different representations of the same resource, e.g. + # http://david.somewhere.com/lists and # http://david.somewhere.com/lists.xml - # are treated like separate requests and so are cached separately. Keep in mind when expiring an - # action cache that :action => 'lists' is not the same as + # are treated like separate requests and so are cached separately. + # Keep in mind when expiring an action cache that + # :action => 'lists' is not the same as # :action => 'list', :format => :xml. # - # You can set modify the default action cache path by passing a :cache_path option. This will be - # passed directly to ActionCachePath.path_for. This is handy for actions with multiple possible - # routes that should be cached differently. If a block is given, it is called with the current - # controller instance. + # You can set modify the default action cache path by passing a + # :cache_path option. This will be passed directly to + # ActionCachePath.path_for. This is handy for actions with multiple + # possible routes that should be cached differently. If a block is + # given, it is called with the current controller instance. # - # And you can also use :if (or :unless) to pass a Proc that specifies when the action should - # be cached. + # And you can also use :if (or :unless) to pass a Proc that + # specifies when the action should be cached. # # Finally, if you are using memcached, you can also pass :expires_in. # # class ListsController < ApplicationController # before_filter :authenticate, :except => :public # caches_page :public - # caches_action :index, :if => proc { |c| !c.request.format.json? } # cache if is not a JSON request - # caches_action :show, :cache_path => { :project => 1 }, :expires_in => 1.hour - # caches_action :feed, :cache_path => proc { |controller| - # controller.params[:user_id] ? - # controller.send(:user_list_url, controller.params[:user_id], controller.params[:id]) : - # controller.send(:list_url, controller.params[:id]) } + # caches_action :index, :if => proc do |c| + # !c.request.format.json? # cache if is not a JSON request + # end + # + # caches_action :show, :cache_path => { :project => 1 }, + # :expires_in => 1.hour + # + # caches_action :feed, :cache_path => proc do |controller| + # if controller.params[:user_id] + # controller.send(:user_list_url, + # controller.params[:user_id], controller.params[:id]) + # else + # controller.send(:list_url, controller.params[:id]) + # end + # end # end # - # If you pass :layout => false, it will only cache your action content. It is useful when your - # layout has dynamic information. + # If you pass :layout => false, it will only cache your action + # content. It is useful when your layout has dynamic information. # module Actions extend ActiveSupport::Concern - included do - attr_accessor :rendered_action_cache, :action_cache_path - end - module ClassMethods # Declares that +actions+ should be cached. # See ActionController::Caching::Actions for details. @@ -76,11 +88,7 @@ module ActionController #:nodoc: end def _render_cache_fragment(cache, extension, layout) - self.rendered_action_cache = true - response.content_type = Mime[extension].to_s if extension - options = { :text => cache } - options.merge!(:layout => true) if layout - render options + render :text => cache, :layout => layout, :content_type => Mime[extension || :html] end def _save_fragment(name, layout, options) @@ -90,17 +98,17 @@ module ActionController #:nodoc: write_fragment(name, content, options) end - protected - def expire_action(options = {}) - return unless cache_configured? + protected + def expire_action(options = {}) + return unless cache_configured? - actions = options[:action] - if actions.is_a?(Array) - actions.each {|action| expire_action(options.merge(:action => action)) } - else - expire_fragment(ActionCachePath.path_for(self, options, false)) - end + actions = options[:action] + if actions.is_a?(Array) + actions.each {|action| expire_action(options.merge(:action => action)) } + else + expire_fragment(ActionCachePath.new(self, options, false).path) end + end class ActionCacheFilter #:nodoc: def initialize(options, &block) @@ -109,7 +117,12 @@ module ActionController #:nodoc: end def filter(controller) - path_options = @cache_path.respond_to?(:call) ? @cache_path.call(controller) : @cache_path + path_options = if @cache_path.respond_to?(:call) + controller.instance_exec(controller, &@cache_path) + else + @cache_path + end + cache_path = ActionCachePath.new(controller, path_options || {}) if cache = controller.read_fragment(cache_path.path, @store_options) @@ -124,41 +137,25 @@ module ActionController #:nodoc: class ActionCachePath attr_reader :path, :extension - class << self - def path_for(controller, options, infer_extension = true) - new(controller, options, infer_extension).path - end - end - # If +infer_extension+ is true, the cache path extension is looked up from the request's # path & format. This is desirable when reading and writing the cache, but not when # expiring the cache - expire_action should expire the same files regardless of the # request format. def initialize(controller, options = {}, infer_extension = true) if infer_extension - extract_extension(controller.request) - options = options.reverse_merge(:format => @extension) if options.is_a?(Hash) + @extension = controller.params[:format] + options.reverse_merge!(:format => @extension) if options.is_a?(Hash) end - path = controller.url_for(options).split('://').last - normalize!(path) - add_extension!(path, @extension) - @path = URI.unescape(path) + path = controller.url_for(options).split(%r{://}).last + @path = normalize!(path) end private def normalize!(path) path << 'index' if path[-1] == ?/ - end - - def add_extension!(path, extension) path << ".#{extension}" if extension and !path.ends_with?(extension) - end - - def extract_extension(request) - # Don't want just what comes after the last '.' to accommodate multi part extensions - # such as tar.gz. - @extension = request.path[/^[^.]+\.(.+)$/, 1] || request.cache_format + URI.unescape(path) end end end diff --git a/actionpack/lib/action_controller/caching/sweeping.rb b/actionpack/lib/action_controller/caching/sweeping.rb index c1be264ffb..871f41bfdd 100644 --- a/actionpack/lib/action_controller/caching/sweeping.rb +++ b/actionpack/lib/action_controller/caching/sweeping.rb @@ -70,7 +70,7 @@ module ActionController #:nodoc: protected # gets the action cache path for the given options. def action_path_for(options) - ActionController::Caching::Actions::ActionCachePath.path_for(controller, options) + Actions::ActionCachePath.new(controller, options).path end # Retrieve instance variables set in the controller. diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 22f9ab219c..c251d79f4e 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -25,9 +25,11 @@ module ActionController # cattr_reader :protected_instance_variables cattr_accessor :protected_instance_variables - self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render @variables_added @request_origin @url @parent_controller - @action_name @before_filter_chain_aborted @action_cache_path @_headers @_params - @_flash @_response) + self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render + @variables_added @request_origin @url + @parent_controller @action_name + @before_filter_chain_aborted @_headers @_params + @_flash @_response) # Indicates whether or not optimise the generated named # route helper methods diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index bb99fac5e0..75be2cc260 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -98,7 +98,7 @@ module ActionDispatch end def forgery_whitelisted? - method == :get || xhr? || !(!content_type.nil? && content_type.verify_request?) + method == :get || xhr? || content_type.nil? || !content_type.verify_request? end def media_type @@ -205,10 +205,6 @@ module ActionDispatch end end - def cache_format - parameters[:format] - end - # Returns true if the request's "X-Requested-With" header contains # "XMLHttpRequest". (The Prototype Javascript library sends this header with # every Ajax request.) diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index df2dee8228..3ce90b6ccf 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -228,12 +228,16 @@ class ActionCachingMockController @mock_url_for end + def params + request.parameters + end + def request mocked_path = @mock_path Object.new.instance_eval(<<-EVAL) def path; '#{@mock_path}' end def format; 'all' end - def cache_format; nil end + def parameters; {:format => nil}; end self EVAL end @@ -466,7 +470,7 @@ class ActionCacheTest < ActionController::TestCase @mock_controller.mock_url_for = 'http://example.org/' @mock_controller.mock_path = '/' - assert_equal 'example.org/index', @path_class.path_for(@mock_controller, {}) + assert_equal 'example.org/index', @path_class.new(@mock_controller, {}).path end def test_file_extensions -- cgit v1.2.3 From 3f560386125adabe441facf2514ad53425e4af4e Mon Sep 17 00:00:00 2001 From: Tim Carey-Smith Date: Thu, 29 Oct 2009 00:00:18 -0700 Subject: Remove the random line at the beginning of every new log file --- activesupport/lib/active_support/buffered_logger.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb index dfce507b33..29c3843d16 100644 --- a/activesupport/lib/active_support/buffered_logger.rb +++ b/activesupport/lib/active_support/buffered_logger.rb @@ -53,7 +53,6 @@ module ActiveSupport FileUtils.mkdir_p(File.dirname(log)) @log = open(log, (File::WRONLY | File::APPEND | File::CREAT)) @log.sync = true - @log.write("# Logfile created on %s" % [Time.now.to_s]) end end -- cgit v1.2.3 From f4f76772fb5c25357a54baaa9cd20f7e9a1cd653 Mon Sep 17 00:00:00 2001 From: Matthew Rudy Jacobs Date: Wed, 28 Oct 2009 09:17:59 +0000 Subject: abstract all of the ActionMailer delivery methods into their own classes. thereby the following are equivalent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.delivery_method = ActionMailer::DeliveryMethod::Smtp we could equally set our own custom object as long as it provides the instance method :perform_delivery(mail) eg. class MySmsDeliveryMethod def perform_delivery(mail) Sms.send(mail['to'], mail['body']) end end MySmsMailer.delivery_method = MySmsDeliveryMethod.new Signed-off-by: José Valim --- actionmailer/Rakefile | 1 + actionmailer/lib/action_mailer.rb | 1 + actionmailer/lib/action_mailer/base.rb | 75 ++++------------------ actionmailer/lib/action_mailer/delivery_method.rb | 58 +++++++++++++++++ .../lib/action_mailer/delivery_method/file.rb | 21 ++++++ .../lib/action_mailer/delivery_method/sendmail.rb | 22 +++++++ .../lib/action_mailer/delivery_method/smtp.rb | 31 +++++++++ .../lib/action_mailer/delivery_method/test.rb | 12 ++++ actionmailer/test/delivery_method_test.rb | 36 +++++++++-- actionmailer/test/mail_service_test.rb | 2 +- actionmailer/test/test_helper_test.rb | 2 +- 11 files changed, 193 insertions(+), 68 deletions(-) create mode 100644 actionmailer/lib/action_mailer/delivery_method.rb create mode 100644 actionmailer/lib/action_mailer/delivery_method/file.rb create mode 100644 actionmailer/lib/action_mailer/delivery_method/sendmail.rb create mode 100644 actionmailer/lib/action_mailer/delivery_method/smtp.rb create mode 100644 actionmailer/lib/action_mailer/delivery_method/test.rb diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 8a863705bb..96c84b986e 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -44,6 +44,7 @@ Rake::RDocTask.new { |rdoc| rdoc.rdoc_files.include('README', 'CHANGELOG') rdoc.rdoc_files.include('lib/action_mailer.rb') rdoc.rdoc_files.include('lib/action_mailer/*.rb') + rdoc.rdoc_files.include('lib/action_mailer/delivery_method/*.rb') } spec = eval(File.read('actionmailer.gemspec')) diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index a427376579..71dc1c6eb8 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -33,6 +33,7 @@ module ActionMailer autoload :AdvAttrAccessor, 'action_mailer/adv_attr_accessor' autoload :Base, 'action_mailer/base' + autoload :DeliveryMethod, 'action_mailer/delivery_method' autoload :Helpers, 'action_mailer/helpers' autoload :Part, 'action_mailer/part' autoload :PartContainer, 'action_mailer/part_container' diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index df3bfb3620..898356075f 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,5 +1,3 @@ -require 'tmpdir' - require "active_support/core_ext/class" # Use the old layouts until actionmailer gets refactored require "action_controller/legacy/layout" @@ -232,7 +230,7 @@ module ActionMailer #:nodoc: # * raise_delivery_errors - Whether or not errors should be raised if the email fails to be delivered. # # * delivery_method - Defines a delivery method. Possible values are :smtp (default), :sendmail, :test, - # and :file. + # and :file. Or you may provide a custom delivery method object eg. MyOwnDeliveryMethodClass.new # # * perform_deliveries - Determines whether deliver_* methods are actually carried out. By default they are, # but this can be turned off to help functional testing. @@ -270,35 +268,21 @@ module ActionMailer #:nodoc: cattr_accessor :logger - @@smtp_settings = { - :address => "localhost", - :port => 25, - :domain => 'localhost.localdomain', - :user_name => nil, - :password => nil, - :authentication => nil, - :enable_starttls_auto => true, - } - cattr_accessor :smtp_settings - - @@sendmail_settings = { - :location => '/usr/sbin/sendmail', - :arguments => '-i -t' - } - cattr_accessor :sendmail_settings - - @@file_settings = { - :location => defined?(Rails) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails" - } - - cattr_accessor :file_settings + class << self + delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::File, :prefix => :file + delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::Sendmail, :prefix => :sendmail + delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::Smtp, :prefix => :smtp + + def delivery_method=(method_name) + @delivery_method = ActionMailer::DeliveryMethod.lookup_method(method_name) + end + end + self.delivery_method = :smtp + superclass_delegating_reader :delivery_method @@raise_delivery_errors = true cattr_accessor :raise_delivery_errors - superclass_delegating_accessor :delivery_method - self.delivery_method = :smtp - @@perform_deliveries = true cattr_accessor :perform_deliveries @@ -552,7 +536,7 @@ module ActionMailer #:nodoc: ActiveSupport::Notifications.instrument(:deliver_mail, :mail => @mail) do begin - __send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries + self.delivery_method.perform_delivery(mail) if perform_deliveries rescue Exception => e # Net::SMTP errors or sendmail pipe errors raise e if raise_delivery_errors end @@ -720,39 +704,6 @@ module ActionMailer #:nodoc: @mail = m end - def perform_delivery_smtp(mail) - destinations = mail.destinations - mail.ready_to_send - sender = (mail['return-path'] && mail['return-path'].spec) || mail['from'] - - smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port]) - smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto) - smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password], - smtp_settings[:authentication]) do |smtp| - smtp.sendmail(mail.encoded, sender, destinations) - end - end - - def perform_delivery_sendmail(mail) - sendmail_args = sendmail_settings[:arguments] - sendmail_args += " -f \"#{mail['return-path']}\"" if mail['return-path'] - IO.popen("#{sendmail_settings[:location]} #{sendmail_args}","w+") do |sm| - sm.print(mail.encoded.gsub(/\r/, '')) - sm.flush - end - end - - def perform_delivery_test(mail) - deliveries << mail - end - - def perform_delivery_file(mail) - FileUtils.mkdir_p file_settings[:location] - - (mail.to + mail.cc + mail.bcc).uniq.each do |to| - File.open(File.join(file_settings[:location], to), 'a') { |f| f.write(mail) } - end - end end Base.class_eval do diff --git a/actionmailer/lib/action_mailer/delivery_method.rb b/actionmailer/lib/action_mailer/delivery_method.rb new file mode 100644 index 0000000000..ffba3c418c --- /dev/null +++ b/actionmailer/lib/action_mailer/delivery_method.rb @@ -0,0 +1,58 @@ +require "active_support/core_ext/class" +module ActionMailer + module DeliveryMethod + + autoload :File, 'action_mailer/delivery_method/file' + autoload :Sendmail, 'action_mailer/delivery_method/sendmail' + autoload :Smtp, 'action_mailer/delivery_method/smtp' + autoload :Test, 'action_mailer/delivery_method/test' + + # Creates a new DeliveryMethod object according to the given options. + # + # If no arguments are passed to this method, then a new + # ActionMailer::DeliveryMethod::Stmp object will be returned. + # + # If you pass a Symbol as the first argument, then a corresponding + # delivery method class under the ActionMailer::DeliveryMethod namespace + # will be created. + # For example: + # + # ActionMailer::DeliveryMethod.lookup_method(:sendmail) + # # => returns a new ActionMailer::DeliveryMethod::Sendmail object + # + # If the first argument is not a Symbol, then it will simply be returned: + # + # ActionMailer::DeliveryMethod.lookup_method(MyOwnDeliveryMethod.new) + # # => returns MyOwnDeliveryMethod.new + def self.lookup_method(delivery_method) + case delivery_method + when Symbol + method_name = delivery_method.to_s.camelize + method_class = ActionMailer::DeliveryMethod.const_get(method_name) + method_class.new() + when nil + Smtp.new + else + delivery_method + end + end + + # An abstract delivery method class. There are multiple delivery method + # classes, documented under + # See the classes under the ActionMailer::DeliveryMethod, e.g. + # ActionMailer::DeliveryMethod::Smtp. + # Smtp is the default delivery method for production + # while Test is used in testing. + # + # each delivery method exposes just one method + # + # delivery_method = ActionMailer::DeliveryMethod::Smtp.new + # + # delivery_method.perform_delivery(mail) # send the mail via smtp + class Method + superclass_delegating_accessor :settings + self.settings = {} + end + + end +end diff --git a/actionmailer/lib/action_mailer/delivery_method/file.rb b/actionmailer/lib/action_mailer/delivery_method/file.rb new file mode 100644 index 0000000000..8807a05221 --- /dev/null +++ b/actionmailer/lib/action_mailer/delivery_method/file.rb @@ -0,0 +1,21 @@ +require 'tmpdir' +module ActionMailer + module DeliveryMethod + + # A delivery method implementation which writes all mails to a file. + class File < Method + + self.settings = { + :location => defined?(Rails) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails" + } + + def perform_delivery(mail) + FileUtils.mkdir_p settings[:location] + + (mail.to + mail.cc + mail.bcc).uniq.each do |to| + ::File.open(::File.join(settings[:location], to), 'a') { |f| f.write(mail) } + end + end + end + end +end diff --git a/actionmailer/lib/action_mailer/delivery_method/sendmail.rb b/actionmailer/lib/action_mailer/delivery_method/sendmail.rb new file mode 100644 index 0000000000..34e03b8060 --- /dev/null +++ b/actionmailer/lib/action_mailer/delivery_method/sendmail.rb @@ -0,0 +1,22 @@ +module ActionMailer + module DeliveryMethod + + # A delivery method implementation which sends via sendmail. + class Sendmail < Method + + self.settings = { + :location => '/usr/sbin/sendmail', + :arguments => '-i -t' + } + + def perform_delivery(mail) + sendmail_args = settings[:arguments] + sendmail_args += " -f \"#{mail['return-path']}\"" if mail['return-path'] + IO.popen("#{settings[:location]} #{sendmail_args}","w+") do |sm| + sm.print(mail.encoded.gsub(/\r/, '')) + sm.flush + end + end + end + end +end diff --git a/actionmailer/lib/action_mailer/delivery_method/smtp.rb b/actionmailer/lib/action_mailer/delivery_method/smtp.rb new file mode 100644 index 0000000000..e39f97330c --- /dev/null +++ b/actionmailer/lib/action_mailer/delivery_method/smtp.rb @@ -0,0 +1,31 @@ +module ActionMailer + module DeliveryMethod + + # A delivery method implementation which sends via smtp. + class Smtp < Method + + self.settings = { + :address => "localhost", + :port => 25, + :domain => 'localhost.localdomain', + :user_name => nil, + :password => nil, + :authentication => nil, + :enable_starttls_auto => true, + } + + def perform_delivery(mail) + destinations = mail.destinations + mail.ready_to_send + sender = (mail['return-path'] && mail['return-path'].spec) || mail['from'] + + smtp = Net::SMTP.new(settings[:address], settings[:port]) + smtp.enable_starttls_auto if settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto) + smtp.start(settings[:domain], settings[:user_name], settings[:password], + settings[:authentication]) do |smtp| + smtp.sendmail(mail.encoded, sender, destinations) + end + end + end + end +end diff --git a/actionmailer/lib/action_mailer/delivery_method/test.rb b/actionmailer/lib/action_mailer/delivery_method/test.rb new file mode 100644 index 0000000000..e63e0abbb8 --- /dev/null +++ b/actionmailer/lib/action_mailer/delivery_method/test.rb @@ -0,0 +1,12 @@ +module ActionMailer + module DeliveryMethod + + # A delivery method implementation designed for testing, which just appends each record to the :deliveries array + class Test < Method + + def perform_delivery(mail) + ActionMailer::Base.deliveries << mail + end + end + end +end diff --git a/actionmailer/test/delivery_method_test.rb b/actionmailer/test/delivery_method_test.rb index 1b8c3ba523..8f8c6b0275 100644 --- a/actionmailer/test/delivery_method_test.rb +++ b/actionmailer/test/delivery_method_test.rb @@ -11,6 +11,21 @@ class FileDeliveryMethodMailer < ActionMailer::Base self.delivery_method = :file end +class CustomDeliveryMethod + attr_accessor :custom_deliveries + def initialize() + @customer_deliveries = [] + end + + def self.perform_delivery(mail) + self.custom_deliveries << mail + end +end + +class CustomerDeliveryMailer < ActionMailer::Base + self.delivery_method = CustomDeliveryMethod.new +end + class ActionMailerBase_delivery_method_Test < Test::Unit::TestCase def setup set_delivery_method :smtp @@ -21,7 +36,7 @@ class ActionMailerBase_delivery_method_Test < Test::Unit::TestCase end def test_should_be_the_default_smtp - assert_equal :smtp, ActionMailer::Base.delivery_method + assert_instance_of ActionMailer::DeliveryMethod::Smtp, ActionMailer::Base.delivery_method end end @@ -35,7 +50,7 @@ class DefaultDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase end def test_should_be_the_default_smtp - assert_equal :smtp, DefaultDeliveryMethodMailer.delivery_method + assert_instance_of ActionMailer::DeliveryMethod::Smtp, DefaultDeliveryMethodMailer.delivery_method end end @@ -49,7 +64,7 @@ class NonDefaultDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase end def test_should_be_the_set_delivery_method - assert_equal :sendmail, NonDefaultDeliveryMethodMailer.delivery_method + assert_instance_of ActionMailer::DeliveryMethod::Sendmail, NonDefaultDeliveryMethodMailer.delivery_method end end @@ -63,7 +78,7 @@ class FileDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase end def test_should_be_the_set_delivery_method - assert_equal :file, FileDeliveryMethodMailer.delivery_method + assert_instance_of ActionMailer::DeliveryMethod::File, FileDeliveryMethodMailer.delivery_method end def test_should_default_location_to_the_tmpdir @@ -71,3 +86,16 @@ class FileDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase end end +class CustomDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase + def setup + set_delivery_method :smtp + end + + def teardown + restore_delivery_method + end + + def test_should_be_the_set_delivery_method + assert_instance_of CustomDeliveryMethod, CustomerDeliveryMailer.delivery_method + end +end diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 5584afa8be..802c2b37d4 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -554,7 +554,7 @@ class ActionMailerTest < Test::Unit::TestCase def test_doesnt_raise_errors_when_raise_delivery_errors_is_false ActionMailer::Base.raise_delivery_errors = false - TestMailer.any_instance.expects(:perform_delivery_test).raises(Exception) + TestMailer.delivery_method.expects(:perform_delivery).raises(Exception) assert_nothing_raised { TestMailer.deliver_signed_up(@recipient) } end diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index 65b07a71b8..a9f83f555b 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -10,7 +10,7 @@ end class TestHelperMailerTest < ActionMailer::TestCase def test_setup_sets_right_action_mailer_options - assert_equal :test, ActionMailer::Base.delivery_method + assert_instance_of ActionMailer::DeliveryMethod::Test, ActionMailer::Base.delivery_method assert ActionMailer::Base.perform_deliveries assert_equal [], ActionMailer::Base.deliveries end -- cgit v1.2.3 From a9751a7034c5a2a49fd90e9f79ad5fcae103487b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 17 Oct 2009 10:31:11 -0300 Subject: Refactor ActionMailer layout and remove legacy one. --- actionmailer/lib/action_mailer/base.rb | 42 ++-- actionmailer/lib/action_mailer/delivery_method.rb | 17 +- .../lib/action_mailer/delivery_method/file.rb | 2 +- .../lib/action_mailer/delivery_method/sendmail.rb | 2 +- .../lib/action_mailer/delivery_method/smtp.rb | 2 +- .../lib/action_mailer/delivery_method/test.rb | 2 +- actionpack/lib/abstract_controller/layouts.rb | 20 ++ actionpack/lib/action_controller/legacy/layout.rb | 256 --------------------- actionpack/lib/action_controller/metal/layouts.rb | 11 - 9 files changed, 51 insertions(+), 303 deletions(-) delete mode 100644 actionpack/lib/action_controller/legacy/layout.rb diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 898356075f..29afa2692a 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,6 +1,4 @@ -require "active_support/core_ext/class" -# Use the old layouts until actionmailer gets refactored -require "action_controller/legacy/layout" +require 'active_support/core_ext/class' module ActionMailer #:nodoc: # Action Mailer allows you to send email from your application using a mailer model and views. @@ -254,11 +252,12 @@ module ActionMailer #:nodoc: # +implicit_parts_order+. class Base include AdvAttrAccessor, PartContainer, Quoting, Utils - extend AbstractController::RenderingController + + include AbstractController::RenderingController + include AbstractController::Layouts if Object.const_defined?(:ActionController) include ActionController::UrlWriter - include ActionController::Layout end private_class_method :new #:nodoc: @@ -569,8 +568,7 @@ module ActionMailer #:nodoc: end @template = initialize_template_class(body) - layout = _pick_layout(layout, true) unless - ActionController::Base.exempt_from_layout.include?(template.handler) + layout = _layout_for_option(:default, :formats => formats) @template._render_template(template, layout, {}) ensure @current_template_content_type = nil @@ -583,25 +581,23 @@ module ActionMailer #:nodoc: end def render(opts) + file = opts[:file] opts[:locals] ||= {} - layout, file = opts.delete(:layout), opts[:file] - - begin - @template = initialize_template_class(opts.delete(:body)) - - if file - prefix = mailer_name unless file =~ /\// - template = view_paths.find(file, {:formats => formats}, prefix) - end - layout = _pick_layout(layout, - !template || ActionController::Base.exempt_from_layout.include?(template.handler)) + @template = initialize_template_class(opts.delete(:body)) - if template - @template._render_template(template, layout, opts) - elsif inline = opts[:inline] - @template._render_inline(inline, layout, opts) - end + if file + prefix = mailer_name unless file =~ /\// + template = view_paths.find(file, {:formats => formats}, prefix) + end + + layout = opts.key?(:layout) ? opts.delete(:layout) : :default + layout = _layout_for_option(layout, :formats => formats) + + if template + @template._render_template(template, layout, opts) + elsif inline = opts[:inline] + @template._render_inline(inline, layout, opts) end end diff --git a/actionmailer/lib/action_mailer/delivery_method.rb b/actionmailer/lib/action_mailer/delivery_method.rb index ffba3c418c..29a51afdc3 100644 --- a/actionmailer/lib/action_mailer/delivery_method.rb +++ b/actionmailer/lib/action_mailer/delivery_method.rb @@ -2,10 +2,10 @@ require "active_support/core_ext/class" module ActionMailer module DeliveryMethod - autoload :File, 'action_mailer/delivery_method/file' + autoload :File, 'action_mailer/delivery_method/file' autoload :Sendmail, 'action_mailer/delivery_method/sendmail' - autoload :Smtp, 'action_mailer/delivery_method/smtp' - autoload :Test, 'action_mailer/delivery_method/test' + autoload :Smtp, 'action_mailer/delivery_method/smtp' + autoload :Test, 'action_mailer/delivery_method/test' # Creates a new DeliveryMethod object according to the given options. # @@ -27,18 +27,17 @@ module ActionMailer def self.lookup_method(delivery_method) case delivery_method when Symbol - method_name = delivery_method.to_s.camelize + method_name = delivery_method.to_s.camelize method_class = ActionMailer::DeliveryMethod.const_get(method_name) - method_class.new() - when nil + method_class.new + when nil # default Smtp.new else delivery_method end end - # An abstract delivery method class. There are multiple delivery method - # classes, documented under + # An abstract delivery method class. There are multiple delivery method classes. # See the classes under the ActionMailer::DeliveryMethod, e.g. # ActionMailer::DeliveryMethod::Smtp. # Smtp is the default delivery method for production @@ -47,8 +46,8 @@ module ActionMailer # each delivery method exposes just one method # # delivery_method = ActionMailer::DeliveryMethod::Smtp.new - # # delivery_method.perform_delivery(mail) # send the mail via smtp + # class Method superclass_delegating_accessor :settings self.settings = {} diff --git a/actionmailer/lib/action_mailer/delivery_method/file.rb b/actionmailer/lib/action_mailer/delivery_method/file.rb index 8807a05221..587ae37ffa 100644 --- a/actionmailer/lib/action_mailer/delivery_method/file.rb +++ b/actionmailer/lib/action_mailer/delivery_method/file.rb @@ -1,10 +1,10 @@ require 'tmpdir' + module ActionMailer module DeliveryMethod # A delivery method implementation which writes all mails to a file. class File < Method - self.settings = { :location => defined?(Rails) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails" } diff --git a/actionmailer/lib/action_mailer/delivery_method/sendmail.rb b/actionmailer/lib/action_mailer/delivery_method/sendmail.rb index 34e03b8060..db55af79f1 100644 --- a/actionmailer/lib/action_mailer/delivery_method/sendmail.rb +++ b/actionmailer/lib/action_mailer/delivery_method/sendmail.rb @@ -3,7 +3,6 @@ module ActionMailer # A delivery method implementation which sends via sendmail. class Sendmail < Method - self.settings = { :location => '/usr/sbin/sendmail', :arguments => '-i -t' @@ -18,5 +17,6 @@ module ActionMailer end end end + end end diff --git a/actionmailer/lib/action_mailer/delivery_method/smtp.rb b/actionmailer/lib/action_mailer/delivery_method/smtp.rb index e39f97330c..86b0ae8329 100644 --- a/actionmailer/lib/action_mailer/delivery_method/smtp.rb +++ b/actionmailer/lib/action_mailer/delivery_method/smtp.rb @@ -1,6 +1,5 @@ module ActionMailer module DeliveryMethod - # A delivery method implementation which sends via smtp. class Smtp < Method @@ -27,5 +26,6 @@ module ActionMailer end end end + end end diff --git a/actionmailer/lib/action_mailer/delivery_method/test.rb b/actionmailer/lib/action_mailer/delivery_method/test.rb index e63e0abbb8..6e3239d52a 100644 --- a/actionmailer/lib/action_mailer/delivery_method/test.rb +++ b/actionmailer/lib/action_mailer/delivery_method/test.rb @@ -3,10 +3,10 @@ module ActionMailer # A delivery method implementation designed for testing, which just appends each record to the :deliveries array class Test < Method - def perform_delivery(mail) ActionMailer::Base.deliveries << mail end end + end end diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 796ef40584..4723e18a01 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -171,6 +171,26 @@ module AbstractController name && _find_layout(name, details) end + # Determine the layout for a given name and details, taking into account + # the name type. + # + # ==== Parameters + # name:: The name of the template + # details Object}>:: A list of details to restrict + # the lookup to. By default, layout lookup is limited to the + # formats specified for the current request. + def _layout_for_option(name, details) + case name + when String then _layout_for_name(name, details) + when true then _default_layout(details, true) + when :default then _default_layout(details, false) + when false, nil then nil + else + raise ArgumentError, + "String, true, or false, expected for `layout'; you passed #{name.inspect}" + end + end + # Take in the name and details and find a Template. # # ==== Parameters diff --git a/actionpack/lib/action_controller/legacy/layout.rb b/actionpack/lib/action_controller/legacy/layout.rb deleted file mode 100644 index 4e3b67de20..0000000000 --- a/actionpack/lib/action_controller/legacy/layout.rb +++ /dev/null @@ -1,256 +0,0 @@ -require 'active_support/core_ext/enumerable' -require 'active_support/core_ext/class' -require 'active_support/core_ext/class/delegating_attributes' -require 'active_support/core_ext/class/inheritable_attributes' - -module ActionController #:nodoc: - # MegasuperultraHAX - # plz refactor ActionMailer - class Base - @@exempt_from_layout = [ActionView::TemplateHandlers::RJS] - cattr_accessor :exempt_from_layout - end - - module Layout #:nodoc: - def self.included(base) - base.extend(ClassMethods) - base.class_inheritable_accessor :layout_name, :layout_conditions - end - - # Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in - # repeated setups. The inclusion pattern has pages that look like this: - # - # <%= render "shared/header" %> - # Hello World - # <%= render "shared/footer" %> - # - # This approach is a decent way of keeping common structures isolated from the changing content, but it's verbose - # and if you ever want to change the structure of these two includes, you'll have to change all the templates. - # - # With layouts, you can flip it around and have the common structure know where to insert changing content. This means - # that the header and footer are only mentioned in one place, like this: - # - # // The header part of this layout - # <%= yield %> - # // The footer part of this layout - # - # And then you have content pages that look like this: - # - # hello world - # - # At rendering time, the content page is computed and then inserted in the layout, like this: - # - # // The header part of this layout - # hello world - # // The footer part of this layout - # - # == Accessing shared variables - # - # Layouts have access to variables specified in the content pages and vice versa. This allows you to have layouts with - # references that won't materialize before rendering time: - # - #

<%= @page_title %>

- # <%= yield %> - # - # ...and content pages that fulfill these references _at_ rendering time: - # - # <% @page_title = "Welcome" %> - # Off-world colonies offers you a chance to start a new life - # - # The result after rendering is: - # - #

Welcome

- # Off-world colonies offers you a chance to start a new life - # - # == Automatic layout assignment - # - # If there is a template in app/views/layouts/ with the same name as the current controller then it will be automatically - # set as that controller's layout unless explicitly told otherwise. Say you have a WeblogController, for example. If a template named - # app/views/layouts/weblog.erb or app/views/layouts/weblog.builder exists then it will be automatically set as - # the layout for your WeblogController. You can create a layout with the name application.erb or application.builder - # and this will be set as the default controller if there is no layout with the same name as the current controller and there is - # no layout explicitly assigned with the +layout+ method. Nested controllers use the same folder structure for automatic layout. - # assignment. So an Admin::WeblogController will look for a template named app/views/layouts/admin/weblog.erb. - # Setting a layout explicitly will always override the automatic behaviour for the controller where the layout is set. - # Explicitly setting the layout in a parent class, though, will not override the child class's layout assignment if the child - # class has a layout with the same name. - # - # == Inheritance for layouts - # - # Layouts are shared downwards in the inheritance hierarchy, but not upwards. Examples: - # - # class BankController < ActionController::Base - # layout "bank_standard" - # - # class InformationController < BankController - # - # class VaultController < BankController - # layout :access_level_layout - # - # class EmployeeController < BankController - # layout nil - # - # The InformationController uses "bank_standard" inherited from the BankController, the VaultController overwrites - # and picks the layout dynamically, and the EmployeeController doesn't want to use a layout at all. - # - # == Types of layouts - # - # Layouts are basically just regular templates, but the name of this template needs not be specified statically. Sometimes - # you want to alternate layouts depending on runtime information, such as whether someone is logged in or not. This can - # be done either by specifying a method reference as a symbol or using an inline method (as a proc). - # - # The method reference is the preferred approach to variable layouts and is used like this: - # - # class WeblogController < ActionController::Base - # layout :writers_and_readers - # - # def index - # # fetching posts - # end - # - # private - # def writers_and_readers - # logged_in? ? "writer_layout" : "reader_layout" - # end - # - # Now when a new request for the index action is processed, the layout will vary depending on whether the person accessing - # is logged in or not. - # - # If you want to use an inline method, such as a proc, do something like this: - # - # class WeblogController < ActionController::Base - # layout proc{ |controller| controller.logged_in? ? "writer_layout" : "reader_layout" } - # - # Of course, the most common way of specifying a layout is still just as a plain template name: - # - # class WeblogController < ActionController::Base - # layout "weblog_standard" - # - # If no directory is specified for the template name, the template will by default be looked for in app/views/layouts/. - # Otherwise, it will be looked up relative to the template root. - # - # == Conditional layouts - # - # If you have a layout that by default is applied to all the actions of a controller, you still have the option of rendering - # a given action or set of actions without a layout, or restricting a layout to only a single action or a set of actions. The - # :only and :except options can be passed to the layout call. For example: - # - # class WeblogController < ActionController::Base - # layout "weblog_standard", :except => :rss - # - # # ... - # - # end - # - # This will assign "weblog_standard" as the WeblogController's layout except for the +rss+ action, which will not wrap a layout - # around the rendered view. - # - # Both the :only and :except condition can accept an arbitrary number of method references, so - # #:except => [ :rss, :text_only ] is valid, as is :except => :rss. - # - # == Using a different layout in the action render call - # - # If most of your actions use the same layout, it makes perfect sense to define a controller-wide layout as described above. - # Sometimes you'll have exceptions where one action wants to use a different layout than the rest of the controller. - # You can do this by passing a :layout option to the render call. For example: - # - # class WeblogController < ActionController::Base - # layout "weblog_standard" - # - # def help - # render :action => "help", :layout => "help" - # end - # end - # - # This will render the help action with the "help" layout instead of the controller-wide "weblog_standard" layout. - module ClassMethods - extend ActiveSupport::Memoizable - - # If a layout is specified, all rendered actions will have their result rendered - # when the layout yields. This layout can itself depend on instance variables assigned during action - # performance and have access to them as any normal template would. - def layout(template_name, conditions = {}, auto = false) - add_layout_conditions(conditions) - self.layout_name = template_name - end - - def memoized_default_layout(formats) #:nodoc: - self.layout_name || begin - layout = default_layout_name - layout.is_a?(String) ? find_layout(layout, formats) : layout - rescue ActionView::MissingTemplate - end - end - - def default_layout(*args) - memoized_default_layout(*args) - @_memoized_default_layout ||= {} - @_memoized_default_layout[args] ||= memoized_default_layout(*args) - end - - def memoized_find_layout(layout, formats) #:nodoc: - return layout if layout.nil? || layout.respond_to?(:render) - prefix = layout.to_s =~ /layouts\// ? nil : "layouts" - find_template(layout.to_s, {:formats => formats}, :_prefix => prefix) - end - - def find_layout(*args) - @_memoized_find_layout ||= {} - @_memoized_find_layout[args] ||= memoized_find_layout(*args) - end - - def layout_list #:nodoc: - Array(view_paths).sum([]) { |path| Dir["#{path}/layouts/**/*"] } - end - memoize :layout_list - - def default_layout_name - layout_match = name.underscore.sub(/_controller$/, '') - if layout_list.grep(%r{layouts/#{layout_match}(\.[a-z][0-9a-z]*)+$}).empty? - superclass.default_layout_name if superclass.respond_to?(:default_layout_name) - else - layout_match - end - end - memoize :default_layout_name - - private - def add_layout_conditions(conditions) - # :except => :foo == :except => [:foo] == :except => "foo" == :except => ["foo"] - conditions.each {|k, v| conditions[k] = Array(v).map {|a| a.to_s} } - write_inheritable_hash(:layout_conditions, conditions) - end - end - - def active_layout(name) - name = self.class.default_layout(formats) if name == true - - layout_name = case name - when Symbol then __send__(name) - when Proc then name.call(self) - else name - end - - self.class.find_layout(layout_name, formats) - end - - def _pick_layout(layout_name = nil, implicit = false) - return unless layout_name || implicit - layout_name = true if layout_name.nil? - active_layout(layout_name) if action_has_layout? && layout_name - end - - private - def action_has_layout? - if conditions = self.class.layout_conditions - if only = conditions[:only] - return only.include?(action_name) - elsif except = conditions[:except] - return !except.include?(action_name) - end - end - true - end - - end -end diff --git a/actionpack/lib/action_controller/metal/layouts.rb b/actionpack/lib/action_controller/metal/layouts.rb index cac529b1ae..e7859e3fec 100644 --- a/actionpack/lib/action_controller/metal/layouts.rb +++ b/actionpack/lib/action_controller/metal/layouts.rb @@ -177,16 +177,5 @@ module ActionController options[:_layout] = _layout_for_option(layout, options[:_template].details) end - def _layout_for_option(name, details) - case name - when String then _layout_for_name(name, details) - when true then _default_layout(details, true) - when :default then _default_layout(details, false) - when false, nil then nil - else - raise ArgumentError, - "String, true, or false, expected for `layout'; you passed #{name.inspect}" - end - end end end -- cgit v1.2.3 From 684c2dc20801b7fcc941ec9478d33d3bf7c74551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 18 Oct 2009 20:20:14 -0200 Subject: Remove ActionMailer helpers and rely on AbstractController one. --- actionmailer/lib/action_mailer.rb | 1 - actionmailer/lib/action_mailer/base.rb | 30 +++--- actionmailer/lib/action_mailer/helpers.rb | 114 ---------------------- actionmailer/test/mail_service_test.rb | 10 +- actionpack/lib/abstract_controller/helpers.rb | 81 ++++++++++++--- actionpack/lib/action_controller/metal/helpers.rb | 69 +------------ actionpack/lib/action_view/render/rendering.rb | 2 +- 7 files changed, 96 insertions(+), 211 deletions(-) delete mode 100644 actionmailer/lib/action_mailer/helpers.rb diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 71dc1c6eb8..8d99d36b36 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -34,7 +34,6 @@ module ActionMailer autoload :AdvAttrAccessor, 'action_mailer/adv_attr_accessor' autoload :Base, 'action_mailer/base' autoload :DeliveryMethod, 'action_mailer/delivery_method' - autoload :Helpers, 'action_mailer/helpers' autoload :Part, 'action_mailer/part' autoload :PartContainer, 'action_mailer/part_container' autoload :Quoting, 'action_mailer/quoting' diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 29afa2692a..d01120d0d8 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -256,6 +256,9 @@ module ActionMailer #:nodoc: include AbstractController::RenderingController include AbstractController::Layouts + include AbstractController::Helpers + helper MailHelper + if Object.const_defined?(:ActionController) include ActionController::UrlWriter end @@ -442,6 +445,7 @@ module ActionMailer #:nodoc: self.view_paths && self.view_paths.first end + # Should template root overwrite the whole view_paths? def template_root=(root) self.view_paths = ActionView::Base.process_view_paths(root) end @@ -470,6 +474,11 @@ module ActionMailer #:nodoc: # If an explicit, textual body has not been set, we check assumptions. unless String === @body + # TODO Hax + @body.each do |k, v| + instance_variable_set(:"@#{k}", v) + end + # First, we look to see if there are any likely templates that match, # which include the content-type in their file name (i.e., # "the_template_file.text.html.erb", etc.). Only do this if parts @@ -480,7 +489,7 @@ module ActionMailer #:nodoc: :content_type => template.mime_type ? template.mime_type.to_s : "text/plain", :disposition => "inline", :charset => charset, - :body => render_template(template, @body) + :body => render_to_string(:_template => template) ) end @@ -562,16 +571,10 @@ module ActionMailer #:nodoc: @sent_on ||= Time.now end - def render_template(template, body) - if template.respond_to?(:mime_type) - @current_template_content_type = template.mime_type && template.mime_type.to_sym.to_s - end - - @template = initialize_template_class(body) - layout = _layout_for_option(:default, :formats => formats) - @template._render_template(template, layout, {}) - ensure - @current_template_content_type = nil + def _determine_template(options) + super + layout = options.key?(:layout) ? options[:layout] : :default + options[:_layout] = _layout_for_option(layout, options[:_template].details) end def render_message(method_name, body) @@ -701,9 +704,4 @@ module ActionMailer #:nodoc: end end - - Base.class_eval do - include Helpers - helper MailHelper - end end diff --git a/actionmailer/lib/action_mailer/helpers.rb b/actionmailer/lib/action_mailer/helpers.rb deleted file mode 100644 index ecd8f0f5b6..0000000000 --- a/actionmailer/lib/action_mailer/helpers.rb +++ /dev/null @@ -1,114 +0,0 @@ -require 'active_support/dependencies' - -module ActionMailer - module Helpers #:nodoc: - def self.included(base) #:nodoc: - # Initialize the base module to aggregate its helpers. - base.class_inheritable_accessor :master_helper_module - base.master_helper_module = Module.new - - # Extend base with class methods to declare helpers. - base.extend(ClassMethods) - - base.class_eval do - # Wrap inherited to create a new master helper module for subclasses. - class << self - alias_method_chain :inherited, :helper - end - - # Wrap initialize_template_class to extend new template class - # instances with the master helper module. - alias_method_chain :initialize_template_class, :helper - end - end - - module ClassMethods - # Makes all the (instance) methods in the helper module available to templates rendered through this controller. - # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules - # available to the templates. - def add_template_helper(helper_module) #:nodoc: - master_helper_module.module_eval "include #{helper_module}" - end - - # Declare a helper: - # helper :foo - # requires 'foo_helper' and includes FooHelper in the template class. - # helper FooHelper - # includes FooHelper in the template class. - # helper { def foo() "#{bar} is the very best" end } - # evaluates the block in the template class, adding method +foo+. - # helper(:three, BlindHelper) { def mice() 'mice' end } - # does all three. - def helper(*args, &block) - args.flatten.each do |arg| - case arg - when Module - add_template_helper(arg) - when String, Symbol - file_name = arg.to_s.underscore + '_helper' - class_name = file_name.camelize - - require_dependency(file_name, "Missing helper file helpers/%s.rb") - # begin - # require_dependency(file_name) - # rescue LoadError => load_error - # requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1] - # msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}" - # raise LoadError.new(msg).copy_blame!(load_error) - # end - - add_template_helper(class_name.constantize) - else - raise ArgumentError, 'helper expects String, Symbol, or Module argument' - end - end - - # Evaluate block in template class if given. - master_helper_module.module_eval(&block) if block_given? - end - - # Declare a controller method as a helper. For example, - # helper_method :link_to - # def link_to(name, options) ... end - # makes the link_to controller method available in the view. - def helper_method(*methods) - methods.flatten.each do |method| - master_helper_module.module_eval <<-end_eval - def #{method}(*args, &block) - controller.__send__(%(#{method}), *args, &block) - end - end_eval - end - end - - # Declare a controller attribute as a helper. For example, - # helper_attr :name - # attr_accessor :name - # makes the name and name= controller methods available in the view. - # The is a convenience wrapper for helper_method. - def helper_attr(*attrs) - attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") } - end - - private - def inherited_with_helper(child) - inherited_without_helper(child) - begin - child.master_helper_module = Module.new - child.master_helper_module.__send__(:include, master_helper_module) - child.helper child.name.to_s.underscore - rescue MissingSourceFile => e - raise unless e.is_missing?("#{child.name.to_s.underscore}_helper") - end - end - end - - private - # Extend the template class instance with our controller's helper module. - def initialize_template_class_with_helper(assigns) - initialize_template_class_without_helper(assigns).tap do |template| - template.extend self.class.master_helper_module - end - end - end -end diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 802c2b37d4..680fe283bd 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -1,5 +1,6 @@ # encoding: utf-8 require 'abstract_unit' +require 'active_support/testing/pending' class FunkyPathMailer < ActionMailer::Base self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots" @@ -279,7 +280,7 @@ class TestMailer < ActionMailer::Base body :body => "foo", :bar => "baz" end - class <:: Modules to be included - # block:: Evalulate the block in the context - # of the helper module. Any methods defined in the block - # will be helpers. + # *args + # block:: A block defining helper methods + # + # ==== Examples + # When the argument is a module it will be included directly in the template class. + # helper FooHelper # => includes FooHelper + # + # When the argument is a string or symbol, the method will provide the "_helper" suffix, require the file + # and include the module in the template class. The second form illustrates how to include custom helpers + # when working with namespaced controllers, or other cases where the file containing the helper definition is not + # in one of Rails' standard load paths: + # helper :foo # => requires 'foo_helper' and includes FooHelper + # helper 'resources/foo' # => requires 'resources/foo_helper' and includes Resources::FooHelper + # + # Additionally, the +helper+ class method can receive and evaluate a block, making the methods defined available + # to the template. + # + # # One line + # helper { def hello() "Hello, world!" end } + # + # # Multi-line + # helper do + # def foo(bar) + # "#{bar} is the very best" + # end + # end + # + # Finally, all the above styles can be mixed together, and the +helper+ method can be invoked with a mix of + # +symbols+, +strings+, +modules+ and blocks. + # + # helper(:three, BlindHelper) { def mice() 'mice' end } + # def helper(*args, &block) self._helper_serial = AbstractController::Helpers.next_serial + 1 - args.flatten.each do |arg| - case arg - when Module - add_template_helper(arg) - end + _modules_for_helpers(args).each do |mod| + add_template_helper(mod) end + _helpers.module_eval(&block) if block_given? end @@ -87,6 +114,38 @@ module AbstractController def add_template_helper(mod) _helpers.module_eval { include mod } end + + # Returns a list of modules, normalized from the acceptable kinds of + # helpers with the following behavior: + # + # String or Symbol:: :FooBar or "FooBar" becomes "foo_bar_helper", + # and "foo_bar_helper.rb" is loaded using require_dependency. + # + # Module:: No further processing + # + # After loading the appropriate files, the corresponding modules + # are returned. + # + # ==== Parameters + # args:: A list of helpers + # + # ==== Returns + # Array[Module]:: A normalized list of modules for the list of + # helpers provided. + def _modules_for_helpers(args) + args.flatten.map! do |arg| + case arg + when String, Symbol + file_name = "#{arg.to_s.underscore}_helper" + require_dependency(file_name, "Missing helper file helpers/%s.rb") + file_name.camelize.constantize + when Module + arg + else + raise ArgumentError, "helper must be a String, Symbol, or Module" + end + end + end end end end diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb index 117ea3481f..b4325e24ad 100644 --- a/actionpack/lib/action_controller/metal/helpers.rb +++ b/actionpack/lib/action_controller/metal/helpers.rb @@ -1,5 +1,3 @@ -require 'active_support/dependencies' - module ActionController # The Rails framework provides a large number of helpers for working with +assets+, +dates+, +forms+, # +numbers+ and model objects, to name a few. These helpers are available to all templates @@ -64,46 +62,6 @@ module ActionController super end - # The +helper+ class method can take a series of helper module names, a block, or both. - # - # ==== Parameters - # *args - # block:: A block defining helper methods - # - # ==== Examples - # When the argument is a string or symbol, the method will provide the "_helper" suffix, require the file - # and include the module in the template class. The second form illustrates how to include custom helpers - # when working with namespaced controllers, or other cases where the file containing the helper definition is not - # in one of Rails' standard load paths: - # helper :foo # => requires 'foo_helper' and includes FooHelper - # helper 'resources/foo' # => requires 'resources/foo_helper' and includes Resources::FooHelper - # - # When the argument is a module it will be included directly in the template class. - # helper FooHelper # => includes FooHelper - # - # When the argument is the symbol :all, the controller will include all helpers beneath - # ActionController::Base.helpers_dir (defaults to app/helpers/**/*.rb under RAILS_ROOT). - # helper :all - # - # Additionally, the +helper+ class method can receive and evaluate a block, making the methods defined available - # to the template. - # # One line - # helper { def hello() "Hello, world!" end } - # # Multi-line - # helper do - # def foo(bar) - # "#{bar} is the very best" - # end - # end - # - # Finally, all the above styles can be mixed together, and the +helper+ method can be invoked with a mix of - # +symbols+, +strings+, +modules+ and blocks. - # helper(:three, BlindHelper) { def mice() 'mice' end } - # - def helper(*args, &block) - super(*_modules_for_helpers(args), &block) - end - # Declares helper accessors for controller attributes. For example, the # following adds new +name+ and name= instance methods to a # controller and makes them available to the view: @@ -123,15 +81,8 @@ module ActionController end private - # Returns a list of modules, normalized from the acceptable kinds of - # helpers with the following behavior: - # String or Symbol:: :FooBar or "FooBar" becomes "foo_bar_helper", - # and "foo_bar_helper.rb" is loaded using require_dependency. - # :all:: Loads all modules in the #helpers_dir - # Module:: No further processing - # - # After loading the appropriate files, the corresponding modules - # are returned. + # Overwrite _modules_for_helpers to accept :all as argument, which loads + # all helpers in helpers_dir. # # ==== Parameters # args:: A list of helpers @@ -140,20 +91,8 @@ module ActionController # Array[Module]:: A normalized list of modules for the list of # helpers provided. def _modules_for_helpers(args) - args.flatten.map! do |arg| - case arg - when :all - _modules_for_helpers all_application_helpers - when String, Symbol - file_name = "#{arg.to_s.underscore}_helper" - require_dependency(file_name, "Missing helper file helpers/%s.rb") - file_name.camelize.constantize - when Module - arg - else - raise ArgumentError, "helper must be a String, Symbol, or Module" - end - end + args += all_application_helpers if args.delete(:all) + super(args) end def default_helper_module! diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index 7dcd9d38d9..fc89726670 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -133,4 +133,4 @@ module ActionView content end end -end \ No newline at end of file +end -- cgit v1.2.3 From 43d5504f0a6a831474d149aa5f1ebb2545790152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 18 Oct 2009 22:52:36 -0200 Subject: Move all render and layout pieces required in ActionMailer from ActionController to AbstractController. --- actionmailer/lib/action_mailer/base.rb | 168 +++++++++------------ actionmailer/test/mail_render_test.rb | 15 +- actionpack/lib/abstract_controller/layouts.rb | 9 ++ .../abstract_controller/rendering_controller.rb | 19 +++ actionpack/lib/action_controller/metal/layouts.rb | 10 -- .../metal/rendering_controller.rb | 24 --- actionpack/test/abstract/helper_test.rb | 4 +- 7 files changed, 115 insertions(+), 134 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index d01120d0d8..3009d8cdfc 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -376,13 +376,19 @@ module ActionMailer #:nodoc: # The mail object instance referenced by this mailer. attr_reader :mail attr_reader :template_name, :default_template_name, :action_name + attr_internal :response_body def controller_path self.class.controller_path end - + def formats - @template.formats + [:"*/*"] + end + + # Refactor out all mailer_name + def _prefix + mailer_name end class << self @@ -468,67 +474,68 @@ module ActionMailer #:nodoc: # Initialize the mailer via the given +method_name+. The body will be # rendered and a new TMail::Mail object created. def create!(method_name, *parameters) #:nodoc: - ActiveSupport::Notifications.instrument(:create_mail, :name => method_name) do - initialize_defaults(method_name) - __send__(method_name, *parameters) + initialize_defaults(method_name) + __send__(method_name, *parameters) + + # Check if render was called. + @body = self.response_body if @body.is_a?(Hash) && @body.empty? - # If an explicit, textual body has not been set, we check assumptions. - unless String === @body - # TODO Hax + # If an explicit, textual body has not been set, we check assumptions. + unless String === @body + # TODO Fix me. Deprecate assigns to be given as a :body hash + if @body.is_a?(Hash) @body.each do |k, v| instance_variable_set(:"@#{k}", v) end - - # First, we look to see if there are any likely templates that match, - # which include the content-type in their file name (i.e., - # "the_template_file.text.html.erb", etc.). Only do this if parts - # have not already been specified manually. - # if @parts.empty? - template_root.find_all(@template, {}, template_path).each do |template| - @parts << Part.new( - :content_type => template.mime_type ? template.mime_type.to_s : "text/plain", - :disposition => "inline", - :charset => charset, - :body => render_to_string(:_template => template) - ) - end - - if @parts.size > 1 - @content_type = "multipart/alternative" if @content_type !~ /^multipart/ - @parts = sort_parts(@parts, @implicit_parts_order) - end - # end - - # Then, if there were such templates, we check to see if we ought to - # also render a "normal" template (without the content type). If a - # normal template exists (or if there were no implicit parts) we render - # it. - # ==== - # TODO: Revisit this - # template_exists = @parts.empty? - # template_exists ||= template_root.find("#{mailer_name}/#{@template}") - # @body = render_message(@template, @body) if template_exists - - # Finally, if there are other message parts and a textual body exists, - # we shift it onto the front of the parts and set the body to nil (so - # that create_mail doesn't try to render it in addition to the parts). - # ==== - # TODO: Revisit this - # if !@parts.empty? && String === @body - # @parts.unshift Part.new(:charset => charset, :body => @body) - # @body = nil - # end end - # If this is a multipart e-mail add the mime_version if it is not - # already set. - @mime_version ||= "1.0" if !@parts.empty? + # First, we look to see if there are any likely templates that match, + # which include the content-type in their file name (i.e., + # "the_template_file.text.html.erb", etc.). Only do this if parts + # have not already been specified manually. + # if @parts.empty? + template_root.find_all(@template, {}, template_path).each do |template| + @parts << Part.new( + :content_type => template.mime_type ? template.mime_type.to_s : "text/plain", + :disposition => "inline", + :charset => charset, + :body => render_to_body(:_template => template) + ) + end - # build the mail object itself - @mail = create_mail + if @parts.size > 1 + @content_type = "multipart/alternative" if @content_type !~ /^multipart/ + @parts = sort_parts(@parts, @implicit_parts_order) + end + # end + + # Then, if there were such templates, we check to see if we ought to + # also render a "normal" template (without the content type). If a + # normal template exists (or if there were no implicit parts) we render + # it. + # ==== + # TODO: Revisit this + # template_exists = @parts.empty? + # template_exists ||= template_root.find("#{mailer_name}/#{@template}") + # @body = render_message(@template, @body) if template_exists + + # Finally, if there are other message parts and a textual body exists, + # we shift it onto the front of the parts and set the body to nil (so + # that create_mail doesn't try to render it in addition to the parts). + # ==== + # TODO: Revisit this + # if !@parts.empty? && String === @body + # @parts.unshift Part.new(:charset => charset, :body => @body) + # @body = nil + # end end - @mail + # If this is a multipart e-mail add the mime_version if it is not + # already set. + @mime_version ||= "1.0" if !@parts.empty? + + # build the mail object itself + @mail = create_mail end # Delivers a TMail::Mail object. By default, it delivers the cached mail @@ -537,7 +544,7 @@ module ActionMailer #:nodoc: def deliver!(mail = @mail) raise "no mail object available for delivery!" unless mail - unless logger.nil? + if logger logger.info "Sent mail to #{Array(recipients).join(', ')}" logger.debug "\n#{mail.encoded}" end @@ -571,45 +578,16 @@ module ActionMailer #:nodoc: @sent_on ||= Time.now end - def _determine_template(options) - super - layout = options.key?(:layout) ? options[:layout] : :default - options[:_layout] = _layout_for_option(layout, options[:_template].details) - end - - def render_message(method_name, body) - render :file => method_name, :body => body - ensure - @current_template_content_type = nil - end - - def render(opts) - file = opts[:file] - opts[:locals] ||= {} - - @template = initialize_template_class(opts.delete(:body)) - - if file - prefix = mailer_name unless file =~ /\// - template = view_paths.find(file, {:formats => formats}, prefix) + def render(*args) + # TODO Fix me. Deprecate assigns to be given as a :body hash + options = args.last.is_a?(Hash) ? args.last : {} + if options[:body] + options.delete(:body).each do |k, v| + instance_variable_set(:"@#{k}", v) + end end - layout = opts.key?(:layout) ? opts.delete(:layout) : :default - layout = _layout_for_option(layout, :formats => formats) - - if template - @template._render_template(template, layout, opts) - elsif inline = opts[:inline] - @template._render_inline(inline, layout, opts) - end - end - - def default_template_format - if @current_template_content_type - Mime::Type.lookup(@current_template_content_type).to_sym - else - :html - end + super end def template_root @@ -624,12 +602,6 @@ module ActionMailer #:nodoc: "#{mailer_name}" end - def initialize_template_class(assigns) - template = ActionView::Base.new(self.class.view_paths, assigns, self) - template.formats = [default_template_format] - template - end - def sort_parts(parts, order = []) order = order.collect { |s| s.downcase } diff --git a/actionmailer/test/mail_render_test.rb b/actionmailer/test/mail_render_test.rb index 45811612eb..3f66fb1e43 100644 --- a/actionmailer/test/mail_render_test.rb +++ b/actionmailer/test/mail_render_test.rb @@ -12,7 +12,15 @@ class RenderMailer < ActionMailer::Base recipients recipient subject "using helpers" from "tester@example.com" - body render(:file => "signed_up", :body => { :recipient => recipient }) + body render(:file => "templates/signed_up", :body => { :recipient => recipient }) + end + + def implicit_body(recipient) + recipients recipient + subject "using helpers" + from "tester@example.com" + + render(:template => "templates/signed_up", :body => { :recipient => recipient }) end def rxml_template(recipient) @@ -69,6 +77,11 @@ class RenderHelperTest < Test::Unit::TestCase restore_delivery_method end + def test_implicit_body + mail = RenderMailer.create_implicit_body(@recipient) + assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip + end + def test_inline_template mail = RenderMailer.create_inline_template(@recipient) assert_equal "Hello, Earth", mail.body.strip diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 4723e18a01..f4f1d41360 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -157,6 +157,7 @@ module AbstractController end private + # This will be overwritten by _write_layout_method def _layout(details) end @@ -191,6 +192,14 @@ module AbstractController end end + def _determine_template(options) + super + + return if (options.key?(:text) || options.key?(:inline) || options.key?(:partial)) && !options.key?(:layout) + layout = options.key?(:layout) ? options[:layout] : :default + options[:_layout] = _layout_for_option(layout, options[:_template].details) + end + # Take in the name and details and find a Template. # # ==== Parameters diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index bbf941aa32..9fb7935ce4 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -109,6 +109,21 @@ module AbstractController # to a directory. # _partial:: Whether or not the file to look up is a partial def _determine_template(options) + if options.key?(:text) + options[:_template] = ActionView::TextTemplate.new(options[:text], formats.first) + elsif options.key?(:inline) + handler = ActionView::Template.handler_class_for_extension(options[:type] || "erb") + template = ActionView::Template.new(options[:inline], "inline #{options[:inline].inspect}", handler, {}) + options[:_template] = template + elsif options.key?(:template) + options[:_template_name] = options[:template] + elsif options.key?(:file) + options[:_template_name] = options[:file] + elsif !options.key?(:partial) + options[:_template_name] ||= options[:action] + options[:_prefix] = _prefix + end + name = (options[:_template_name] || action_name).to_s options[:_template] ||= with_template_cache(name) do @@ -124,6 +139,10 @@ module AbstractController view_paths.exists?(name, details, options[:_prefix], options[:_partial]) end + def _prefix + self.class.name.underscore + end + def with_template_cache(name) yield end diff --git a/actionpack/lib/action_controller/metal/layouts.rb b/actionpack/lib/action_controller/metal/layouts.rb index e7859e3fec..cc7088248a 100644 --- a/actionpack/lib/action_controller/metal/layouts.rb +++ b/actionpack/lib/action_controller/metal/layouts.rb @@ -167,15 +167,5 @@ module ActionController controller_path end end - - private - def _determine_template(options) - super - - return if (options.key?(:text) || options.key?(:inline) || options.key?(:partial)) && !options.key?(:layout) - layout = options.key?(:layout) ? options[:layout] : :default - options[:_layout] = _layout_for_option(layout, options[:_template].details) - end - end end diff --git a/actionpack/lib/action_controller/metal/rendering_controller.rb b/actionpack/lib/action_controller/metal/rendering_controller.rb index 4da32ca1b3..afd484b0ec 100644 --- a/actionpack/lib/action_controller/metal/rendering_controller.rb +++ b/actionpack/lib/action_controller/metal/rendering_controller.rb @@ -38,11 +38,6 @@ module ActionController def process_action(*) self.formats = request.formats.map {|x| x.to_sym} - - super - end - - def _determine_template(*) super end @@ -74,25 +69,6 @@ module ActionController self.class.template_cache[Thread.current[:format_locale_key]][name] ||= super end - def _determine_template(options) - if options.key?(:text) - options[:_template] = ActionView::TextTemplate.new(options[:text], formats.first) - elsif options.key?(:inline) - handler = ActionView::Template.handler_class_for_extension(options[:type] || "erb") - template = ActionView::Template.new(options[:inline], "inline #{options[:inline].inspect}", handler, {}) - options[:_template] = template - elsif options.key?(:template) - options[:_template_name] = options[:template] - elsif options.key?(:file) - options[:_template_name] = options[:file] - elsif !options.key?(:partial) - options[:_template_name] = (options[:action] || action_name).to_s - options[:_prefix] = _prefix - end - - super - end - def _process_options(options) status, content_type, location = options.values_at(:status, :content_type, :location) self.status = status if status diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb index 5a363c9aa5..b6952d2758 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -7,10 +7,12 @@ module AbstractController include AbstractController::RenderingController include Helpers + def _prefix() end + def render(string) super(:_template_name => string) end - + append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views")) end -- cgit v1.2.3 From 2d514e5352d17c8c3958b26397f1c808c7fa0b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 14:42:58 -0200 Subject: Move some of helper tests to AbstractController. --- actionpack/test/abstract/helper_test.rb | 65 ++++++++++++++++++++++++------- actionpack/test/controller/helper_test.rb | 34 ---------------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb index b6952d2758..6c28f01fa4 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -1,19 +1,17 @@ require 'abstract_unit' +ActionController::Base.helpers_dir = File.dirname(__FILE__) + '/../fixtures/helpers' + module AbstractController module Testing class ControllerWithHelpers < AbstractController::Base include AbstractController::RenderingController include Helpers - - def _prefix() end - def render(string) - super(:_template_name => string) + def with_module + render :inline => "Module <%= included_method %>" end - - append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views")) end module HelperyTest @@ -22,24 +20,61 @@ module AbstractController end end - class MyHelpers1 < ControllerWithHelpers + class AbstractHelpers < ControllerWithHelpers helper(HelperyTest) do def helpery_test "World" end end - - def index - render "helper_test.erb" + + helper :abc + + def with_block + render :inline => "Hello <%= helpery_test %>" + end + + def with_symbol + render :inline => "I respond to bare_a: <%= respond_to?(:bare_a) %>" + end + end + + class AbstractHelpersBlock < ControllerWithHelpers + helper do + include HelperyTest end end - + class TestHelpers < ActiveSupport::TestCase - def test_helpers - controller = MyHelpers1.new - controller.process(:index) - assert_equal "Hello World : Included", controller.response_body + + def setup + @controller = AbstractHelpers.new end + + def test_helpers_with_block + @controller.process(:with_block) + assert_equal "Hello World", @controller.response_body + end + + def test_helpers_with_module + @controller.process(:with_module) + assert_equal "Module Included", @controller.response_body + end + + def test_helpers_with_symbol + @controller.process(:with_symbol) + assert_equal "I respond to bare_a: true", @controller.response_body + end + + def test_declare_missing_helper + assert_raise(MissingSourceFile) { AbstractHelpers.helper :missing } + end + + def test_helpers_with_module_through_block + @controller = AbstractHelpersBlock.new + @controller.process(:with_module) + assert_equal "Module Included", @controller.response_body + end + end end diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 23149fee27..12539739aa 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -57,40 +57,6 @@ class HelperTest < Test::Unit::TestCase assert_equal [], missing_methods end - def test_declare_helper - require 'abc_helper' - self.test_helper = AbcHelper - assert_equal expected_helper_methods, missing_methods - assert_nothing_raised { @controller_class.helper :abc } - assert_equal [], missing_methods - end - - def test_declare_missing_helper - assert_equal expected_helper_methods, missing_methods - assert_raise(MissingSourceFile) { @controller_class.helper :missing } - end - - def test_declare_missing_file_from_helper - require 'broken_helper' - rescue LoadError => e - assert_nil(/\bbroken_helper\b/.match(e.to_s)[1]) - end - - def test_helper_block - assert_nothing_raised { - @controller_class.helper { def block_helper_method; end } - } - assert master_helper_methods.include?('block_helper_method') - end - - def test_helper_block_include - assert_equal expected_helper_methods, missing_methods - assert_nothing_raised { - @controller_class.helper { include HelperTest::TestHelper } - } - assert [], missing_methods - end - def test_helper_method assert_nothing_raised { @controller_class.helper_method :delegate_method } assert master_helper_methods.include?('delegate_method') -- cgit v1.2.3 From 0cf16ddb88b4fa28c37e576d50d835b100c3f6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 15:55:47 -0200 Subject: Improve AbstractController layouts coverage. --- .../abstract_controller/rendering_controller.rb | 9 ++-- .../metal/rendering_controller.rb | 4 ++ actionpack/lib/action_view/template/text.rb | 4 +- actionpack/test/abstract/layouts_test.rb | 53 +++++++++++++++++----- 4 files changed, 53 insertions(+), 17 deletions(-) diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index 9fb7935ce4..07deda77a2 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -8,9 +8,7 @@ module AbstractController included do attr_internal :formats - extlib_inheritable_accessor :_view_paths - self._view_paths ||= ActionView::PathSet.new end @@ -99,6 +97,7 @@ module AbstractController end private + # Take in a set of options and determine the template to render # # ==== Options @@ -110,7 +109,7 @@ module AbstractController # _partial:: Whether or not the file to look up is a partial def _determine_template(options) if options.key?(:text) - options[:_template] = ActionView::TextTemplate.new(options[:text], formats.first) + options[:_template] = ActionView::TextTemplate.new(options[:text], format_for_text) elsif options.key?(:inline) handler = ActionView::Template.handler_class_for_extension(options[:type] || "erb") template = ActionView::Template.new(options[:inline], "inline #{options[:inline].inspect}", handler, {}) @@ -147,6 +146,10 @@ module AbstractController yield end + def format_for_text + Mime[:text] + end + module ClassMethods def clear_template_caches! end diff --git a/actionpack/lib/action_controller/metal/rendering_controller.rb b/actionpack/lib/action_controller/metal/rendering_controller.rb index afd484b0ec..9e8bc82385 100644 --- a/actionpack/lib/action_controller/metal/rendering_controller.rb +++ b/actionpack/lib/action_controller/metal/rendering_controller.rb @@ -65,6 +65,10 @@ module ActionController controller_path end + def format_for_text + formats.first + end + def with_template_cache(name) self.class.template_cache[Thread.current[:format_locale_key]][name] ||= super end diff --git a/actionpack/lib/action_view/template/text.rb b/actionpack/lib/action_view/template/text.rb index fa8cfe506b..f6e011a5ab 100644 --- a/actionpack/lib/action_view/template/text.rb +++ b/actionpack/lib/action_view/template/text.rb @@ -16,11 +16,11 @@ module ActionView #:nodoc: end def inspect - 'inline template' + 'text template' end def render(*args) - self + to_s end def mime_type diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb index 453d31826e..9c29696ad5 100644 --- a/actionpack/test/abstract/layouts_test.rb +++ b/actionpack/test/abstract/layouts_test.rb @@ -17,17 +17,6 @@ module AbstractControllerTests "layouts/omg.erb" => "OMGHI2U <%= yield %>", "layouts/with_false_layout.erb" => "False Layout <%= yield %>" )] - - def self.controller_path - @controller_path ||= self.name.sub(/Controller$/, '').underscore - end - - def controller_path() self.class.controller_path end - - def render_to_body(options) - options[:_layout] = _default_layout({}) - super - end end class Blank < Base @@ -44,6 +33,22 @@ module AbstractControllerTests def index render :_template => ActionView::TextTemplate.new("Hello string!") end + + def overwrite_default + render :_template => ActionView::TextTemplate.new("Hello string!"), :layout => :default + end + + def overwrite_false + render :_template => ActionView::TextTemplate.new("Hello string!"), :layout => false + end + + def overwrite_string + render :_template => ActionView::TextTemplate.new("Hello string!"), :layout => "omg" + end + + def overwrite_skip + render :text => "Hello text!" + end end class WithStringChild < WithString @@ -153,7 +158,31 @@ module AbstractControllerTests controller.process(:index) assert_equal "With String Hello string!", controller.response_body end - + + test "when layout is overwriten by :default in render, render default layout" do + controller = WithString.new + controller.process(:overwrite_default) + assert_equal "With String Hello string!", controller.response_body + end + + test "when layout is overwriten by string in render, render new layout" do + controller = WithString.new + controller.process(:overwrite_string) + assert_equal "OMGHI2U Hello string!", controller.response_body + end + + test "when layout is overwriten by false in render, render no layout" do + controller = WithString.new + controller.process(:overwrite_false) + assert_equal "Hello string!", controller.response_body + end + + test "when text is rendered, render no layout" do + controller = WithString.new + controller.process(:overwrite_skip) + assert_equal "Hello text!", controller.response_body + end + test "when layout is specified as a string, but the layout is missing, raise an exception" do assert_raises(ActionView::MissingTemplate) { WithMissingLayout.new.process(:index) } end -- cgit v1.2.3 From 03960048616593c249745d1e321dbcc7f0483c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 17:47:10 -0200 Subject: Add some basic render_test to AbstractController. --- actionmailer/lib/action_mailer/base.rb | 5 -- actionpack/lib/abstract_controller/layouts.rb | 2 +- .../abstract_controller/rendering_controller.rb | 7 -- .../metal/rendering_controller.rb | 9 +++ actionpack/test/abstract/render_test.rb | 88 ++++++++++++++++++++++ 5 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 actionpack/test/abstract/render_test.rb diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3009d8cdfc..e3690577e1 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -386,11 +386,6 @@ module ActionMailer #:nodoc: [:"*/*"] end - # Refactor out all mailer_name - def _prefix - mailer_name - end - class << self attr_writer :mailer_name diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index f4f1d41360..8293e79b0a 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -195,7 +195,7 @@ module AbstractController def _determine_template(options) super - return if (options.key?(:text) || options.key?(:inline) || options.key?(:partial)) && !options.key?(:layout) + return unless (options.keys & [:text, :inline, :partial]).empty? || options.key?(:layout) layout = options.key?(:layout) ? options[:layout] : :default options[:_layout] = _layout_for_option(layout, options[:_template].details) end diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index 07deda77a2..0aae2b18e9 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -118,9 +118,6 @@ module AbstractController options[:_template_name] = options[:template] elsif options.key?(:file) options[:_template_name] = options[:file] - elsif !options.key?(:partial) - options[:_template_name] ||= options[:action] - options[:_prefix] = _prefix end name = (options[:_template_name] || action_name).to_s @@ -138,10 +135,6 @@ module AbstractController view_paths.exists?(name, details, options[:_prefix], options[:_partial]) end - def _prefix - self.class.name.underscore - end - def with_template_cache(name) yield end diff --git a/actionpack/lib/action_controller/metal/rendering_controller.rb b/actionpack/lib/action_controller/metal/rendering_controller.rb index 9e8bc82385..c5ade26702 100644 --- a/actionpack/lib/action_controller/metal/rendering_controller.rb +++ b/actionpack/lib/action_controller/metal/rendering_controller.rb @@ -65,6 +65,15 @@ module ActionController controller_path end + def _determine_template(options) + if (options.keys & [:partial, :file, :template, :text, :inline]).empty? + options[:_template_name] ||= options[:action] + options[:_prefix] = _prefix + end + + super + end + def format_for_text formats.first end diff --git a/actionpack/test/abstract/render_test.rb b/actionpack/test/abstract/render_test.rb new file mode 100644 index 0000000000..45a4763fe4 --- /dev/null +++ b/actionpack/test/abstract/render_test.rb @@ -0,0 +1,88 @@ +require 'abstract_unit' + +module AbstractController + module Testing + + class ControllerRenderer < AbstractController::Base + include AbstractController::RenderingController + + self.view_paths = [ActionView::FixtureResolver.new( + "default.erb" => "With Default", + "template.erb" => "With Template", + "some/file.erb" => "With File", + "template_name.erb" => "With Template Name" + )] + + def template + render :template => "template" + end + + def file + render :file => "some/file" + end + + def inline + render :inline => "With <%= :Inline %>" + end + + def text + render :text => "With Text" + end + + def default + render + end + + def template_name + render :_template_name => :template_name + end + + def object + render :_template => ActionView::TextTemplate.new("With Object") + end + end + + class TestRenderer < ActiveSupport::TestCase + + def setup + @controller = ControllerRenderer.new + end + + def test_render_template + @controller.process(:template) + assert_equal "With Template", @controller.response_body + end + + def test_render_file + @controller.process(:file) + assert_equal "With File", @controller.response_body + end + + def test_render_inline + @controller.process(:inline) + assert_equal "With Inline", @controller.response_body + end + + def test_render_text + @controller.process(:text) + assert_equal "With Text", @controller.response_body + end + + def test_render_default + @controller.process(:default) + assert_equal "With Default", @controller.response_body + end + + def test_render_template_name + @controller.process(:template_name) + assert_equal "With Template Name", @controller.response_body + end + + def test_render_object + @controller.process(:object) + assert_equal "With Object", @controller.response_body + end + + end + end +end -- cgit v1.2.3 From 418c3f801cd436f011b37fe69059073e69e05084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 21:05:55 -0200 Subject: Another refactoring on AM. body is deprecated, use render instead. --- actionmailer/lib/action_mailer.rb | 1 + actionmailer/lib/action_mailer/base.rb | 152 ++++++---------------- actionmailer/lib/action_mailer/deprecated_body.rb | 44 +++++++ actionmailer/test/mail_service_test.rb | 8 +- 4 files changed, 90 insertions(+), 115 deletions(-) create mode 100644 actionmailer/lib/action_mailer/deprecated_body.rb diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 8d99d36b36..23f04a11ba 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -32,6 +32,7 @@ module ActionMailer end autoload :AdvAttrAccessor, 'action_mailer/adv_attr_accessor' + autoload :DeprecatedBody, 'action_mailer/deprecated_body' autoload :Base, 'action_mailer/base' autoload :DeliveryMethod, 'action_mailer/delivery_method' autoload :Part, 'action_mailer/part' diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index e3690577e1..3d71ba5a14 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -263,6 +263,8 @@ module ActionMailer #:nodoc: include ActionController::UrlWriter end + include ActionMailer::DeprecatedBody + private_class_method :new #:nodoc: class_inheritable_accessor :view_paths @@ -304,16 +306,11 @@ module ActionMailer #:nodoc: cattr_accessor :default_implicit_parts_order cattr_reader :protected_instance_variables - @@protected_instance_variables = %w(@body) + @@protected_instance_variables = [] # Specify the BCC addresses for the message adv_attr_accessor :bcc - # Define the body of the message. This is either a Hash (in which case it - # specifies the variables to pass to the template when it is rendered), - # or a string, in which case it specifies the actual text of the message. - adv_attr_accessor :body - # Specify the CC addresses for the message. adv_attr_accessor :cc @@ -358,33 +355,27 @@ module ActionMailer #:nodoc: # have multiple mailer methods share the same template. adv_attr_accessor :template + # The mail and action_name instances referenced by this mailer. + attr_reader :mail, :action_name + + # Where the response body is stored. + attr_internal :response_body + # Override the mailer name, which defaults to an inflected version of the # mailer's class name. If you want to use a template in a non-standard # location, you can use this to specify that location. + attr_writer :mailer_name + def mailer_name(value = nil) if value - self.mailer_name = value + @mailer_name = value else - self.class.mailer_name + @mailer_name || self.class.mailer_name end end - def mailer_name=(value) - self.class.mailer_name = value - end - - # The mail object instance referenced by this mailer. - attr_reader :mail - attr_reader :template_name, :default_template_name, :action_name - attr_internal :response_body - - def controller_path - self.class.controller_path - end - - def formats - [:"*/*"] - end + # Alias controller_path to mailer_name so render :partial in views work. + alias :controller_path :mailer_name class << self attr_writer :mailer_name @@ -393,10 +384,6 @@ module ActionMailer #:nodoc: @mailer_name ||= name.underscore end - # for ActionView compatibility - alias_method :controller_name, :mailer_name - alias_method :controller_path, :mailer_name - def respond_to?(method_symbol, include_private = false) #:nodoc: matches_dynamic_method?(method_symbol) || super end @@ -472,58 +459,8 @@ module ActionMailer #:nodoc: initialize_defaults(method_name) __send__(method_name, *parameters) - # Check if render was called. - @body = self.response_body if @body.is_a?(Hash) && @body.empty? - - # If an explicit, textual body has not been set, we check assumptions. - unless String === @body - # TODO Fix me. Deprecate assigns to be given as a :body hash - if @body.is_a?(Hash) - @body.each do |k, v| - instance_variable_set(:"@#{k}", v) - end - end - - # First, we look to see if there are any likely templates that match, - # which include the content-type in their file name (i.e., - # "the_template_file.text.html.erb", etc.). Only do this if parts - # have not already been specified manually. - # if @parts.empty? - template_root.find_all(@template, {}, template_path).each do |template| - @parts << Part.new( - :content_type => template.mime_type ? template.mime_type.to_s : "text/plain", - :disposition => "inline", - :charset => charset, - :body => render_to_body(:_template => template) - ) - end - - if @parts.size > 1 - @content_type = "multipart/alternative" if @content_type !~ /^multipart/ - @parts = sort_parts(@parts, @implicit_parts_order) - end - # end - - # Then, if there were such templates, we check to see if we ought to - # also render a "normal" template (without the content type). If a - # normal template exists (or if there were no implicit parts) we render - # it. - # ==== - # TODO: Revisit this - # template_exists = @parts.empty? - # template_exists ||= template_root.find("#{mailer_name}/#{@template}") - # @body = render_message(@template, @body) if template_exists - - # Finally, if there are other message parts and a textual body exists, - # we shift it onto the front of the parts and set the body to nil (so - # that create_mail doesn't try to render it in addition to the parts). - # ==== - # TODO: Revisit this - # if !@parts.empty? && String === @body - # @parts.unshift Part.new(:charset => charset, :body => @body) - # @body = nil - # end - end + # Create e-mail parts + create_parts # If this is a multipart e-mail add the mime_version if it is not # already set. @@ -556,6 +493,7 @@ module ActionMailer #:nodoc: end private + # Set up the default values for the various instance variables of this # mailer. Subclasses may override this method to provide different # defaults. @@ -568,38 +506,42 @@ module ActionMailer #:nodoc: @mailer_name ||= self.class.name.underscore @parts ||= [] @headers ||= {} - @body ||= {} @mime_version = @@default_mime_version.dup if @@default_mime_version @sent_on ||= Time.now - end - def render(*args) - # TODO Fix me. Deprecate assigns to be given as a :body hash - options = args.last.is_a?(Hash) ? args.last : {} - if options[:body] - options.delete(:body).each do |k, v| - instance_variable_set(:"@#{k}", v) - end - end - - super + super # Run deprecation hooks end - def template_root - self.class.template_root - end + def create_parts + super # Run deprecation hooks - def template_root=(root) - self.class.template_root = root - end + if String === response_body + @parts.unshift Part.new( + :content_type => "text/plain", + :disposition => "inline", + :charset => charset, + :body => response_body + ) + else + self.class.template_root.find_all(@template, {}, mailer_name).each do |template| + @parts << Part.new( + :content_type => template.mime_type ? template.mime_type.to_s : "text/plain", + :disposition => "inline", + :charset => charset, + :body => render_to_body(:_template => template) + ) + end - def template_path - "#{mailer_name}" + if @parts.size > 1 + @content_type = "multipart/alternative" if @content_type !~ /^multipart/ + @parts = sort_parts(@parts, @implicit_parts_order) + end + end end def sort_parts(parts, order = []) order = order.collect { |s| s.downcase } - + parts = parts.sort do |a, b| a_ct = a.content_type.downcase b_ct = b.content_type.downcase @@ -648,14 +590,6 @@ module ActionMailer #:nodoc: m.set_content_type(real_content_type, nil, ctype_attrs) m.body = normalize_new_lines(@parts.first.body) else - if String === body - part = TMail::Mail.new - part.body = normalize_new_lines(body) - part.set_content_type(real_content_type, nil, ctype_attrs) - part.set_content_disposition "inline" - m.parts << part - end - @parts.each do |p| part = (TMail::Mail === p ? p : p.to_mail(self)) m.parts << part diff --git a/actionmailer/lib/action_mailer/deprecated_body.rb b/actionmailer/lib/action_mailer/deprecated_body.rb new file mode 100644 index 0000000000..982f098bc5 --- /dev/null +++ b/actionmailer/lib/action_mailer/deprecated_body.rb @@ -0,0 +1,44 @@ +module ActionMailer + # TODO Remove this module all together in a next release. Ensure that super + # hooks in ActionMailer::Base are removed as well. + module DeprecatedBody + def self.included(base) + base.class_eval do + # Define the body of the message. This is either a Hash (in which case it + # specifies the variables to pass to the template when it is rendered), + # or a string, in which case it specifies the actual text of the message. + adv_attr_accessor :body + end + end + + def initialize_defaults(method_name) + @body ||= {} + end + + def create_parts + if String === @body + ActiveSupport::Deprecation.warn('body is deprecated. To set the body with a text ' << + 'call render(:text => "body").', caller[7,1]) + self.response_body = @body + elsif @body.is_a?(Hash) && !@body.empty? + ActiveSupport::Deprecation.warn('body is deprecated. To set assigns simply ' << + 'use instance variables', caller[7,1]) + @body.each { |k, v| instance_variable_set(:"@#{k}", v) } + end + end + + def render(*args) + options = args.last.is_a?(Hash) ? args.last : {} + if options[:body] + ActiveSupport::Deprecation.warn(':body is deprecated. To set assigns simply ' << + 'use instance variables', caller[0,1]) + + options.delete(:body).each do |k, v| + instance_variable_set(:"@#{k}", v) + end + end + + super + end + end +end diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 680fe283bd..cda394d926 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -1,6 +1,5 @@ # encoding: utf-8 require 'abstract_unit' -require 'active_support/testing/pending' class FunkyPathMailer < ActionMailer::Base self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots" @@ -291,7 +290,6 @@ end class ActionMailerTest < Test::Unit::TestCase include ActionMailer::Quoting - include ActiveSupport::Testing::Pending def encode( text, charset="utf-8" ) quoted_printable( text, charset ) @@ -979,10 +977,8 @@ EOF end def test_body_is_stored_as_an_ivar - pending "needs attr_internal on @body" do - mail = TestMailer.create_body_ivar(@recipient) - assert_equal "body: foo\nbar: baz", mail.body - end + mail = TestMailer.create_body_ivar(@recipient) + assert_equal "body: foo\nbar: baz", mail.body end def test_starttls_is_enabled_if_supported -- cgit v1.2.3 From e9667ad1f0e74694d9df16fa2819a1679ee21e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 21:26:10 -0200 Subject: Make tests run without deprecation warning (just one left). --- actionmailer/lib/action_mailer/deprecated_body.rb | 4 +- actionmailer/test/mail_helper_test.rb | 21 ++-- actionmailer/test/mail_layout_test.rb | 8 +- actionmailer/test/mail_render_test.rb | 15 ++- actionmailer/test/mail_service_test.rb | 137 ++++++++++++---------- actionmailer/test/test_helper_test.rb | 4 +- 6 files changed, 110 insertions(+), 79 deletions(-) diff --git a/actionmailer/lib/action_mailer/deprecated_body.rb b/actionmailer/lib/action_mailer/deprecated_body.rb index 982f098bc5..50ff262432 100644 --- a/actionmailer/lib/action_mailer/deprecated_body.rb +++ b/actionmailer/lib/action_mailer/deprecated_body.rb @@ -18,11 +18,11 @@ module ActionMailer def create_parts if String === @body ActiveSupport::Deprecation.warn('body is deprecated. To set the body with a text ' << - 'call render(:text => "body").', caller[7,1]) + 'call render(:text => "body").', caller[0,10]) self.response_body = @body elsif @body.is_a?(Hash) && !@body.empty? ActiveSupport::Deprecation.warn('body is deprecated. To set assigns simply ' << - 'use instance variables', caller[7,1]) + 'use instance variables', caller[0,10]) @body.each { |k, v| instance_variable_set(:"@#{k}", v) } end end diff --git a/actionmailer/test/mail_helper_test.rb b/actionmailer/test/mail_helper_test.rb index e94aeff074..f8b002e0a7 100644 --- a/actionmailer/test/mail_helper_test.rb +++ b/actionmailer/test/mail_helper_test.rb @@ -20,28 +20,29 @@ class HelperMailer < ActionMailer::Base recipients recipient subject "using helpers" from "tester@example.com" - self.body = { :text => "emphasize me!" } + + @text = "emphasize me!" end def use_mail_helper(recipient) recipients recipient subject "using mailing helpers" from "tester@example.com" - self.body = { :text => - "But soft! What light through yonder window breaks? It is the east, " + - "and Juliet is the sun. Arise, fair sun, and kill the envious moon, " + - "which is sick and pale with grief that thou, her maid, art far more " + - "fair than she. Be not her maid, for she is envious! Her vestal " + - "livery is but sick and green, and none but fools do wear it. Cast " + - "it off!" - } + + @text = "But soft! What light through yonder window breaks? It is the east, " + + "and Juliet is the sun. Arise, fair sun, and kill the envious moon, " + + "which is sick and pale with grief that thou, her maid, art far more " + + "fair than she. Be not her maid, for she is envious! Her vestal " + + "livery is but sick and green, and none but fools do wear it. Cast " + + "it off!" end def use_helper_method(recipient) recipients recipient subject "using helpers" from "tester@example.com" - self.body = { :text => "emphasize me!" } + + @text = "emphasize me!" end private diff --git a/actionmailer/test/mail_layout_test.rb b/actionmailer/test/mail_layout_test.rb index 50901f52ec..f37c26ff69 100644 --- a/actionmailer/test/mail_layout_test.rb +++ b/actionmailer/test/mail_layout_test.rb @@ -11,14 +11,18 @@ class AutoLayoutMailer < ActionMailer::Base recipients recipient subject "You have a mail" from "tester@example.com" - body render(:inline => "Hello, <%= @world %>", :layout => 'spam', :body => { :world => "Earth" }) + + @world = "Earth" + render(:inline => "Hello, <%= @world %>", :layout => 'spam') end def nolayout(recipient) recipients recipient subject "You have a mail" from "tester@example.com" - body render(:inline => "Hello, <%= @world %>", :layout => false, :body => { :world => "Earth" }) + + @world = "Earth" + render(:inline => "Hello, <%= @world %>", :layout => false) end def multipart(recipient, type = nil) diff --git a/actionmailer/test/mail_render_test.rb b/actionmailer/test/mail_render_test.rb index 3f66fb1e43..514f7ed798 100644 --- a/actionmailer/test/mail_render_test.rb +++ b/actionmailer/test/mail_render_test.rb @@ -5,14 +5,18 @@ class RenderMailer < ActionMailer::Base recipients recipient subject "using helpers" from "tester@example.com" - body render(:inline => "Hello, <%= @world %>", :body => { :world => "Earth" }) + + @world = "Earth" + render :inline => "Hello, <%= @world %>" end def file_template(recipient) recipients recipient subject "using helpers" from "tester@example.com" - body render(:file => "templates/signed_up", :body => { :recipient => recipient }) + + @recipient = recipient + render :file => "templates/signed_up" end def implicit_body(recipient) @@ -20,7 +24,8 @@ class RenderMailer < ActionMailer::Base subject "using helpers" from "tester@example.com" - render(:template => "templates/signed_up", :body => { :recipient => recipient }) + @recipient = recipient + render :template => "templates/signed_up" end def rxml_template(recipient) @@ -39,7 +44,9 @@ class RenderMailer < ActionMailer::Base recipients recipient subject "Including another template in the one being rendered" from "tester@example.com" - body render(:inline => "Hello, <%= render \"subtemplate\" %>", :body => { :world => "Earth" }) + + @world = "Earth" + render :inline => "Hello, <%= render \"subtemplate\" %>" end def initialize_defaults(method_name) diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index cda394d926..96c00a4098 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -15,18 +15,20 @@ end class TestMailer < ActionMailer::Base def signed_up(recipient) - @recipients = recipient - @subject = "[Signed up] Welcome #{recipient}" - @from = "system@loudthinking.com" - @body["recipient"] = recipient + recipients recipient + subject "[Signed up] Welcome #{recipient}" + from "system@loudthinking.com" + + @recipient = recipient end def cancelled_account(recipient) - self.recipients = recipient - self.subject = "[Cancelled] Goodbye #{recipient}" - self.from = "system@loudthinking.com" - self.sent_on = Time.local(2004, 12, 12) - self.body = "Goodbye, Mr. #{recipient}" + recipients recipient + subject "[Cancelled] Goodbye #{recipient}" + from "system@loudthinking.com" + sent_on Time.local(2004, 12, 12) + + render :text => "Goodbye, Mr. #{recipient}" end def cc_bcc(recipient) @@ -36,7 +38,8 @@ class TestMailer < ActionMailer::Base sent_on Time.local(2004, 12, 12) cc "nobody@loudthinking.com" bcc "root@loudthinking.com" - body "Nothing to see here." + + render :text => "Nothing to see here." end def different_reply_to(recipient) @@ -45,50 +48,55 @@ class TestMailer < ActionMailer::Base from "system@loudthinking.com" sent_on Time.local(2008, 5, 23) reply_to "atraver@gmail.com" - body "Nothing to see here." + + render :text => "Nothing to see here." end def iso_charset(recipient) - @recipients = recipient - @subject = "testing isø charsets" - @from = "system@loudthinking.com" - @sent_on = Time.local 2004, 12, 12 - @cc = "nobody@loudthinking.com" - @bcc = "root@loudthinking.com" - @body = "Nothing to see here." - @charset = "iso-8859-1" + recipients recipient + subject "testing isø charsets" + from "system@loudthinking.com" + sent_on Time.local(2004, 12, 12) + cc "nobody@loudthinking.com" + bcc "root@loudthinking.com" + charset "iso-8859-1" + + render :text => "Nothing to see here." end def unencoded_subject(recipient) - @recipients = recipient - @subject = "testing unencoded subject" - @from = "system@loudthinking.com" - @sent_on = Time.local 2004, 12, 12 - @cc = "nobody@loudthinking.com" - @bcc = "root@loudthinking.com" - @body = "Nothing to see here." + recipients recipient + subject "testing unencoded subject" + from "system@loudthinking.com" + sent_on Time.local(2004, 12, 12) + cc "nobody@loudthinking.com" + bcc "root@loudthinking.com" + + render :text => "Nothing to see here." end def extended_headers(recipient) - @recipients = recipient - @subject = "testing extended headers" - @from = "Grytøyr " - @sent_on = Time.local 2004, 12, 12 - @cc = "Grytøyr " - @bcc = "Grytøyr " - @body = "Nothing to see here." - @charset = "iso-8859-1" + recipients recipient + subject "testing extended headers" + from "Grytøyr " + sent_on Time.local(2004, 12, 12) + cc "Grytøyr " + bcc "Grytøyr " + charset "iso-8859-1" + + render :text => "Nothing to see here." end def utf8_body(recipient) - @recipients = recipient - @subject = "testing utf-8 body" - @from = "Foo áëô îü " - @sent_on = Time.local 2004, 12, 12 - @cc = "Foo áëô îü " - @bcc = "Foo áëô îü " - @body = "åœö blah" - @charset = "utf-8" + recipients recipient + subject "testing utf-8 body" + from "Foo áëô îü " + sent_on Time.local(2004, 12, 12) + cc "Foo áëô îü " + bcc "Foo áëô îü " + charset "utf-8" + + render :text => "åœö blah" end def multipart_with_mime_version(recipient) @@ -128,7 +136,6 @@ class TestMailer < ActionMailer::Base subject "multipart example" from "test@example.com" sent_on Time.local(2004, 12, 12) - body "plain text default" content_type ct if ct part "text/html" do |p| @@ -138,15 +145,18 @@ class TestMailer < ActionMailer::Base attachment :content_type => "image/jpeg", :filename => "foo.jpg", :body => "123456789" + + render :text => "plain text default" end def implicitly_multipart_example(recipient, cs = nil, order = nil) - @recipients = recipient - @subject = "multipart example" - @from = "test@example.com" - @sent_on = Time.local 2004, 12, 12 - @body = { "recipient" => recipient } - @charset = cs if cs + recipients recipient + subject "multipart example" + from "test@example.com" + sent_on Time.local(2004, 12, 12) + + @charset = cs if cs + @recipient = recipient @implicit_parts_order = order if order end @@ -155,20 +165,22 @@ class TestMailer < ActionMailer::Base subject "Foo áëô îü" from "some.one@somewhere.test" template "implicitly_multipart_example" - body ({ "recipient" => "no.one@nowhere.test" }) + + @recipient = "no.one@nowhere.test" end def html_mail(recipient) recipients recipient subject "html mail" from "test@example.com" - body "Emphasize this" content_type "text/html" + + render :text => "Emphasize this" end def html_mail_with_underscores(recipient) subject "html mail with underscores" - body %{_Google} + render :text => %{_Google} end def custom_template(recipient) @@ -178,7 +190,7 @@ class TestMailer < ActionMailer::Base sent_on Time.local(2004, 12, 12) template "signed_up" - body["recipient"] = recipient + @recipient = recipient end def custom_templating_extension(recipient) @@ -187,15 +199,16 @@ class TestMailer < ActionMailer::Base from "system@loudthinking.com" sent_on Time.local(2004, 12, 12) - body["recipient"] = recipient + @recipient = recipient end def various_newlines(recipient) recipients recipient subject "various newlines" from "test@example.com" - body "line #1\nline #2\rline #3\r\nline #4\r\r" + - "line #5\n\nline#6\r\n\r\nline #7" + + render :text => "line #1\nline #2\rline #3\r\nline #4\r\r" + + "line #5\n\nline#6\r\n\r\nline #7" end def various_newlines_multipart(recipient) @@ -203,6 +216,7 @@ class TestMailer < ActionMailer::Base subject "various newlines multipart" from "test@example.com" content_type "multipart/alternative" + part :content_type => "text/plain", :body => "line #1\nline #2\rline #3\r\nline #4\r\r" part :content_type => "text/html", :body => "

line #1

\n

line #2

\r

line #3

\r\n

line #4

\r\r" end @@ -212,10 +226,12 @@ class TestMailer < ActionMailer::Base subject "nested multipart" from "test@example.com" content_type "multipart/mixed" + part :content_type => "multipart/alternative", :content_disposition => "inline", :headers => { "foo" => "bar" } do |p| p.part :content_type => "text/plain", :body => "test text\nline #2" p.part :content_type => "text/html", :body => "test HTML
\nline #2" end + attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" end @@ -224,6 +240,7 @@ class TestMailer < ActionMailer::Base subject "nested multipart with body" from "test@example.com" content_type "multipart/mixed" + part :content_type => "multipart/alternative", :content_disposition => "inline", :body => "Nothing to see here." do |p| p.part :content_type => "text/html", :body => "test HTML
" end @@ -253,7 +270,7 @@ class TestMailer < ActionMailer::Base from "One: Two " cc "Three: Four " bcc "Five: Six " - body "testing" + render :text => "testing" end def custom_content_type_attributes @@ -261,15 +278,15 @@ class TestMailer < ActionMailer::Base subject "custom content types" from "some.one@somewhere.test" content_type "text/plain; format=flowed" - body "testing" + render :text => "testing" end def return_path recipients "no.one@nowhere.test" subject "return path test" from "some.one@somewhere.test" - body "testing" headers "return-path" => "another@somewhere.test" + render :text => "testing" end def body_ivar(recipient) @@ -1024,7 +1041,7 @@ end class MethodNamingTest < Test::Unit::TestCase class TestMailer < ActionMailer::Base def send - body 'foo' + render :text => 'foo' end end diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index a9f83f555b..34c5243936 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -4,7 +4,9 @@ class TestHelperMailer < ActionMailer::Base def test recipients "test@example.com" from "tester@example.com" - body render(:inline => "Hello, <%= @world %>", :body => { :world => "Earth" }) + + @world = "Earth" + render(:inline => "Hello, <%= @world %>") end end -- cgit v1.2.3 From 81c416b72e44a75ea74ba342cd223a33f3b80caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 28 Oct 2009 09:08:55 -0200 Subject: More refactoring on ActionMailer::Base. --- actionmailer/lib/action_mailer/base.rb | 43 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3d71ba5a14..49551dca51 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -272,18 +272,6 @@ module ActionMailer #:nodoc: cattr_accessor :logger - class << self - delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::File, :prefix => :file - delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::Sendmail, :prefix => :sendmail - delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::Smtp, :prefix => :smtp - - def delivery_method=(method_name) - @delivery_method = ActionMailer::DeliveryMethod.lookup_method(method_name) - end - end - self.delivery_method = :smtp - superclass_delegating_reader :delivery_method - @@raise_delivery_errors = true cattr_accessor :raise_delivery_errors @@ -305,8 +293,8 @@ module ActionMailer #:nodoc: @@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ] cattr_accessor :default_implicit_parts_order - cattr_reader :protected_instance_variables @@protected_instance_variables = [] + cattr_reader :protected_instance_variables # Specify the BCC addresses for the message adv_attr_accessor :bcc @@ -380,10 +368,18 @@ module ActionMailer #:nodoc: class << self attr_writer :mailer_name + delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::File, :prefix => :file + delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::Sendmail, :prefix => :sendmail + delegate :settings, :settings=, :to => ActionMailer::DeliveryMethod::Smtp, :prefix => :smtp + def mailer_name @mailer_name ||= name.underscore end + def delivery_method=(method_name) + @delivery_method = ActionMailer::DeliveryMethod.lookup_method(method_name) + end + def respond_to?(method_symbol, include_private = false) #:nodoc: matches_dynamic_method?(method_symbol) || super end @@ -445,6 +441,11 @@ module ActionMailer #:nodoc: end end + # Configure delivery method. Check ActionMailer::DeliveryMethod for more + # instructions. + superclass_delegating_reader :delivery_method + self.delivery_method = :smtp + # Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer # will be initialized according to the named method. If not, the mailer will # remain uninitialized (useful when you only need to invoke the "receive" @@ -498,15 +499,17 @@ module ActionMailer #:nodoc: # mailer. Subclasses may override this method to provide different # defaults. def initialize_defaults(method_name) - @charset ||= @@default_charset.dup - @content_type ||= @@default_content_type.dup + @charset ||= @@default_charset.dup + @content_type ||= @@default_content_type.dup @implicit_parts_order ||= @@default_implicit_parts_order.dup - @template ||= method_name - @default_template_name = @action_name = @template - @mailer_name ||= self.class.name.underscore - @parts ||= [] + @mime_version ||= @@default_mime_version.dup if @@default_mime_version + + @mailer_name ||= self.class.mailer_name + @template ||= method_name + @action_name = @template + + @parts ||= [] @headers ||= {} - @mime_version = @@default_mime_version.dup if @@default_mime_version @sent_on ||= Time.now super # Run deprecation hooks -- cgit v1.2.3 From 2aafdc839600240a55cea06c960d0a2a7f63016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 28 Oct 2009 09:22:07 -0200 Subject: Use I18n on ActionMailer subjects by default. --- actionmailer/lib/action_mailer/base.rb | 10 +++++++--- actionmailer/test/mail_service_test.rb | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 49551dca51..3855ce91c8 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -463,9 +463,9 @@ module ActionMailer #:nodoc: # Create e-mail parts create_parts - # If this is a multipart e-mail add the mime_version if it is not - # already set. - @mime_version ||= "1.0" if !@parts.empty? + # Set the subject if not set yet + @subject ||= I18n.t(method_name, :scope => [:actionmailer, :subjects, mailer_name], + :default => method_name.humanize) # build the mail object itself @mail = create_mail @@ -539,6 +539,10 @@ module ActionMailer #:nodoc: @content_type = "multipart/alternative" if @content_type !~ /^multipart/ @parts = sort_parts(@parts, @implicit_parts_order) end + + # If this is a multipart e-mail add the mime_version if it is not + # already set. + @mime_version ||= "1.0" if !@parts.empty? end end diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 96c00a4098..f9365ea90c 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -296,6 +296,12 @@ class TestMailer < ActionMailer::Base body :body => "foo", :bar => "baz" end + def subject_with_i18n(recipient) + recipients recipient + from "system@loudthinking.com" + render :text => "testing" + end + class << self attr_accessor :received_body end @@ -392,6 +398,15 @@ class ActionMailerTest < Test::Unit::TestCase assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded end + def test_subject_with_i18n + assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) } + assert_equal "Subject with i18n", ActionMailer::Base.deliveries.first.subject + + I18n.backend.store_translations('en', :actionmailer => {:subjects => {:test_mailer => {:subject_with_i18n => "New Subject!"}}}) + assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) } + assert_equal "New Subject!", ActionMailer::Base.deliveries.last.subject + end + def test_custom_template expected = new_mail expected.to = @recipient -- cgit v1.2.3 From a107103e85a2cc294faedddbb44707fd2bc2e206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 28 Oct 2009 09:50:18 -0200 Subject: Allow :instance_reader to be given to superclass_delegating_accessor as well. --- .../core_ext/class/delegating_attributes.rb | 60 ++++++++++++++-------- .../core_ext/class/delegating_attributes_test.rb | 7 +++ 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb index 6c67df7f50..301c09fc73 100644 --- a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb @@ -1,39 +1,57 @@ require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/object/duplicable' +require 'active_support/core_ext/array/extract_options' class Class def superclass_delegating_reader(*names) - class_name_to_stop_searching_on = superclass.name.blank? ? "Object" : superclass.name + class_to_stop_searching_on = superclass.name.blank? ? "Object" : superclass.name + options = names.extract_options! + names.each do |name| - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def self.#{name} # def self.only_reader - if defined?(@#{name}) # if defined?(@only_reader) - @#{name} # @only_reader - elsif superclass < #{class_name_to_stop_searching_on} && # elsif superclass < Object && - superclass.respond_to?(:#{name}) # superclass.respond_to?(:only_reader) - superclass.#{name} # superclass.only_reader - end # end - end # end - def #{name} # def only_reader - self.class.#{name} # self.class.only_reader - end # end - def self.#{name}? # def self.only_reader? - !!#{name} # !!only_reader - end # end - def #{name}? # def only_reader? - !!#{name} # !!only_reader - end # end + # def self.only_reader + # if defined?(@only_reader) + # @only_reader + # elsif superclass < Object && superclass.respond_to?(:only_reader) + # superclass.only_reader + # end + # end + class_eval <<-EOS, __FILE__, __LINE__ + 1 + def self.#{name} + if defined?(@#{name}) + @#{name} + elsif superclass < #{class_to_stop_searching_on} && superclass.respond_to?(:#{name}) + superclass.#{name} + end + end EOS + + unless options[:instance_reader] == false + class_eval <<-EOS, __FILE__, __LINE__ + 1 + def #{name} # def only_reader + self.class.#{name} # self.class.only_reader + end # end + def self.#{name}? # def self.only_reader? + !!#{name} # !!only_reader + end # end + def #{name}? # def only_reader? + !!#{name} # !!only_reader + end # end + EOS + end end end def superclass_delegating_writer(*names, &block) + options = names.extract_options! + names.each do |name| - class_eval(<<-EOS, __FILE__, __LINE__ + 1) + class_eval <<-EOS, __FILE__, __LINE__ + 1 def self.#{name}=(value) # def self.property=(value) @#{name} = value # @property = value end # end EOS - self.send("#{name}=", yield) if block_given? + + self.send(:"#{name}=", yield) if block_given? end end diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb index b51d68551d..beb55ba17e 100644 --- a/activesupport/test/core_ext/class/delegating_attributes_test.rb +++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb @@ -52,6 +52,13 @@ class DelegatingAttributesTest < Test::Unit::TestCase assert !single_class.public_instance_methods.map(&:to_s).include?("both=") end + def test_simple_accessor_declaration_with_instance_reader_false + single_class.superclass_delegating_accessor :no_instance_reader, :instance_reader => false + assert single_class.respond_to?(:no_instance_reader) + assert single_class.respond_to?(:no_instance_reader=) + assert !single_class.public_instance_methods.map(&:to_s).include?("no_instance_reader") + end + def test_working_with_simple_attributes single_class.superclass_delegating_accessor :both -- cgit v1.2.3 From 976c2647240fd40a2b706ab5e41856cd47e7b212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 28 Oct 2009 10:33:05 -0200 Subject: Extracted localized_cache.rb from ActionController, added it to AbstractController and made ActionMailer use it. --- actionmailer/lib/action_mailer/base.rb | 1 + actionpack/lib/abstract_controller.rb | 1 + .../lib/abstract_controller/localized_cache.rb | 49 +++++++++++++++++++ .../metal/rendering_controller.rb | 41 ++-------------- actionpack/lib/action_view/base.rb | 4 +- actionpack/test/abstract/localized_cache_test.rb | 57 ++++++++++++++++++++++ 6 files changed, 113 insertions(+), 40 deletions(-) create mode 100644 actionpack/lib/abstract_controller/localized_cache.rb create mode 100644 actionpack/test/abstract/localized_cache_test.rb diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3855ce91c8..293af01bbf 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -254,6 +254,7 @@ module ActionMailer #:nodoc: include AdvAttrAccessor, PartContainer, Quoting, Utils include AbstractController::RenderingController + include AbstractController::LocalizedCache include AbstractController::Layouts include AbstractController::Helpers diff --git a/actionpack/lib/abstract_controller.rb b/actionpack/lib/abstract_controller.rb index 76c5845f5b..1a6c4278c9 100644 --- a/actionpack/lib/abstract_controller.rb +++ b/actionpack/lib/abstract_controller.rb @@ -6,6 +6,7 @@ module AbstractController autoload :Callbacks, "abstract_controller/callbacks" autoload :Helpers, "abstract_controller/helpers" autoload :Layouts, "abstract_controller/layouts" + autoload :LocalizedCache, "abstract_controller/localized_cache" autoload :Logger, "abstract_controller/logger" autoload :RenderingController, "abstract_controller/rendering_controller" # === Exceptions diff --git a/actionpack/lib/abstract_controller/localized_cache.rb b/actionpack/lib/abstract_controller/localized_cache.rb new file mode 100644 index 0000000000..ee7b43cb9f --- /dev/null +++ b/actionpack/lib/abstract_controller/localized_cache.rb @@ -0,0 +1,49 @@ +module AbstractController + class HashKey + @hash_keys = Hash.new {|h,k| h[k] = Hash.new {|h,k| h[k] = {} } } + + def self.get(klass, formats, locale) + @hash_keys[klass][formats][locale] ||= new(klass, formats, locale) + end + + attr_accessor :hash + def initialize(klass, formats, locale) + @formats, @locale = formats, locale + @hash = [formats, locale].hash + end + + alias_method :eql?, :equal? + + def inspect + "#" + end + end + + module LocalizedCache + extend ActiveSupport::Concern + + module ClassMethods + def clear_template_caches! + ActionView::Partials::PartialRenderer::TEMPLATES.clear + template_cache.clear + super + end + + def template_cache + @template_cache ||= Hash.new {|h,k| h[k] = {} } + end + end + + def render(options) + Thread.current[:format_locale_key] = HashKey.get(self.class, formats, I18n.locale) + super + end + + private + + def with_template_cache(name) + self.class.template_cache[Thread.current[:format_locale_key]][name] ||= super + end + + end +end diff --git a/actionpack/lib/action_controller/metal/rendering_controller.rb b/actionpack/lib/action_controller/metal/rendering_controller.rb index c5ade26702..237299cd30 100644 --- a/actionpack/lib/action_controller/metal/rendering_controller.rb +++ b/actionpack/lib/action_controller/metal/rendering_controller.rb @@ -1,39 +1,10 @@ module ActionController - class HashKey - @hash_keys = Hash.new {|h,k| h[k] = Hash.new {|h,k| h[k] = {} } } - - def self.get(klass, formats, locale) - @hash_keys[klass][formats][locale] ||= new(klass, formats, locale) - end - - attr_accessor :hash - def initialize(klass, formats, locale) - @formats, @locale = formats, locale - @hash = [formats, locale].hash - end - - alias_method :eql?, :equal? - - def inspect - "#" - end - end - module RenderingController extend ActiveSupport::Concern - include AbstractController::RenderingController - - module ClassMethods - def clear_template_caches! - ActionView::Partials::PartialRenderer::TEMPLATES.clear - template_cache.clear - super - end - - def template_cache - @template_cache ||= Hash.new {|h,k| h[k] = {} } - end + included do + include AbstractController::RenderingController + include AbstractController::LocalizedCache end def process_action(*) @@ -42,8 +13,6 @@ module ActionController end def render(options) - Thread.current[:format_locale_key] = HashKey.get(self.class, formats, I18n.locale) - super self.content_type ||= options[:_template].mime_type.to_s response_body @@ -78,10 +47,6 @@ module ActionController formats.first end - def with_template_cache(name) - self.class.template_cache[Thread.current[:format_locale_key]][name] ||= super - end - def _process_options(options) status, content_type, location = options.values_at(:status, :content_type, :location) self.status = status if status diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 84e4103280..c33695770f 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -187,11 +187,11 @@ module ActionView #:nodoc: def reset_formats(formats) @formats = formats - if defined?(ActionController) + if defined?(AbstractController::HashKey) # This is expensive, but we need to reset this when the format is updated, # which currently only happens Thread.current[:format_locale_key] = - ActionController::HashKey.get(self.class, formats, I18n.locale) + AbstractController::HashKey.get(self.class, formats, I18n.locale) end end diff --git a/actionpack/test/abstract/localized_cache_test.rb b/actionpack/test/abstract/localized_cache_test.rb new file mode 100644 index 0000000000..6f9bb693f7 --- /dev/null +++ b/actionpack/test/abstract/localized_cache_test.rb @@ -0,0 +1,57 @@ +require 'abstract_unit' + +module AbstractController + module Testing + + class CachedController < AbstractController::Base + include AbstractController::RenderingController + include AbstractController::LocalizedCache + + self.view_paths = [ActionView::FixtureResolver.new( + "default.erb" => "With Default", + "template.erb" => "With Template", + "some/file.erb" => "With File", + "template_name.erb" => "With Template Name" + )] + end + + class TestLocalizedCache < ActiveSupport::TestCase + + def setup + @controller = CachedController.new + CachedController.clear_template_caches! + end + + def test_templates_are_cached + @controller.render :template => "default.erb" + assert_equal "With Default", @controller.response_body + + cached = @controller.class.template_cache + assert_equal 1, cached.size + assert_kind_of ActionView::Template, cached.values.first["default.erb"] + end + + def test_cache_is_used + CachedController.new.render :template => "default.erb" + + @controller.expects(:find_template).never + @controller.render :template => "default.erb" + + assert_equal 1, @controller.class.template_cache.size + end + + def test_cache_changes_with_locale + CachedController.new.render :template => "default.erb" + + I18n.locale = :es + @controller.render :template => "default.erb" + + assert_equal 2, @controller.class.template_cache.size + ensure + I18n.locale = :en + end + + end + + end +end -- cgit v1.2.3 From 14370e1aab6ddfb5b86cf50bd7e5abcebae0684c Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 2 Nov 2009 17:12:01 -0800 Subject: CI breakage This reverts commit a288b74f1c75c6f100de7611a5093a421f1ad6d1. --- railties/lib/rails/generators/base.rb | 17 ----------------- railties/test/generators/actions_test.rb | 2 +- railties/test/generators/app_generator_test.rb | 4 ++-- railties/test/generators/controller_generator_test.rb | 2 +- railties/test/generators/generator_generator_test.rb | 2 +- railties/test/generators/generators_test_helper.rb | 11 +++-------- railties/test/generators/helper_generator_test.rb | 2 +- .../test/generators/integration_test_generator_test.rb | 2 +- railties/test/generators/mailer_generator_test.rb | 2 +- railties/test/generators/metal_generator_test.rb | 2 +- railties/test/generators/migration_generator_test.rb | 2 +- railties/test/generators/model_generator_test.rb | 2 +- railties/test/generators/observer_generator_test.rb | 2 +- .../test/generators/performance_test_generator_test.rb | 2 +- railties/test/generators/plugin_generator_test.rb | 2 +- railties/test/generators/resource_generator_test.rb | 2 +- .../generators/scaffold_controller_generator_test.rb | 2 +- railties/test/generators/scaffold_generator_test.rb | 3 ++- .../test/generators/session_migration_generator_test.rb | 2 +- railties/test/generators/stylesheets_generator_test.rb | 2 +- 20 files changed, 23 insertions(+), 44 deletions(-) diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index e6baf2fc79..7af99797ea 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -12,16 +12,6 @@ module Rails add_runtime_options! - # Always move to rails source root. - # - def initialize(*args) #:nodoc: - if !invoked?(args) && defined?(Rails.root) && Rails.root - self.destination_root = Rails.root - FileUtils.cd(destination_root) - end - super - end - # Automatically sets the source root based on the class name. # def self.source_root @@ -257,13 +247,6 @@ module Rails end end - # Check if this generator was invoked from another one by inspecting - # parameters. - # - def invoked?(args) - args.last.is_a?(Hash) && args.last.key?(:invocations) - end - # Use Rails default banner. # def self.banner diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index f5cb26cf52..199b5fa8b4 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -182,7 +182,7 @@ class ActionsTest < GeneratorsTestCase end def generator(config={}) - @generator ||= Rails::Generators::Base.new([], {}, config) + @generator ||= Rails::Generators::Base.new([], {}, { :destination_root => destination_root }.merge!(config)) end def action(*args, &block) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index c44d25b72c..20f2a24e6d 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -126,7 +126,7 @@ class AppGeneratorTest < GeneratorsTestCase def test_template_from_dir_pwd FileUtils.cd(Rails.root) - assert_match /It works from file!/, run_generator(["-m", "../lib/template.rb"]) + assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"]) end def test_template_raises_an_error_with_invalid_path @@ -170,7 +170,7 @@ class AppGeneratorTest < GeneratorsTestCase end def generator(options={}) - @generator ||= Rails::Generators::AppGenerator.new([destination_root], options) + @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :destination_root => destination_root) end def action(*args, &block) diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 3020e928dc..56bc688ad0 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -74,7 +74,7 @@ class ControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "foo", "bar"]) - silence(:stdout) { Rails::Generators::ControllerGenerator.start args } + silence(:stdout) { Rails::Generators::ControllerGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index 703aa20914..aea3f4da51 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -20,7 +20,7 @@ class GeneratorGeneratorTest < GeneratorsTestCase protected def run_generator(args=["awesome"], config={}) - silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config } + silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 829a38c103..ccf08c347c 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -1,5 +1,5 @@ # TODO: Fix this RAILS_ENV stuff -RAILS_ENV = 'test' unless defined?(RAILS_ENV) +RAILS_ENV = 'test' require 'abstract_unit' Rails.application.config.root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) @@ -11,17 +11,12 @@ require 'action_dispatch' CURRENT_PATH = File.expand_path(Dir.pwd) Rails::Generators.no_color! -module Rails - def self.root - @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'tmp')) - end -end - class GeneratorsTestCase < Test::Unit::TestCase include FileUtils def destination_root - Rails.root + @destination_root ||= File.expand_path(File.join(File.dirname(__FILE__), + '..', 'fixtures', 'tmp')) end def setup diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index 44f5a324af..f8bfc517a2 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -54,7 +54,7 @@ class HelperGeneratorTest < GeneratorsTestCase protected def run_generator(args=["admin"]) - silence(:stdout) { Rails::Generators::HelperGenerator.start args } + silence(:stdout) { Rails::Generators::HelperGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb index 68b55a66f9..6a504ceea2 100644 --- a/railties/test/generators/integration_test_generator_test.rb +++ b/railties/test/generators/integration_test_generator_test.rb @@ -12,7 +12,7 @@ class IntegrationTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["integration"]) - silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args } + silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index e33af25773..251474ad16 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -46,7 +46,7 @@ class MailerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["notifier", "foo", "bar"]) - silence(:stdout) { Rails::Generators::MailerGenerator.start args } + silence(:stdout) { Rails::Generators::MailerGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index 4f36e0f612..80bf342892 100644 --- a/railties/test/generators/metal_generator_test.rb +++ b/railties/test/generators/metal_generator_test.rb @@ -17,7 +17,7 @@ class MetalGeneratorTest < GeneratorsTestCase protected def run_generator(args=["foo"]) - silence(:stdout) { Rails::Generators::MetalGenerator.start args } + silence(:stdout) { Rails::Generators::MetalGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index b1fdbef425..35172a8be4 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -53,7 +53,7 @@ class MigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[@migration]) - silence(:stdout) { Rails::Generators::MigrationGenerator.start args } + silence(:stdout) { Rails::Generators::MigrationGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index a0d4bed992..e073b11e1e 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -175,7 +175,7 @@ class ModelGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "name:string", "age:integer"], config={}) - silence(:stdout) { Rails::Generators::ModelGenerator.start args, config } + silence(:stdout) { Rails::Generators::ModelGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index becc217ac0..6fed2998dd 100644 --- a/railties/test/generators/observer_generator_test.rb +++ b/railties/test/generators/observer_generator_test.rb @@ -27,7 +27,7 @@ class ObserverGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"]) - silence(:stdout) { Rails::Generators::ObserverGenerator.start args } + silence(:stdout) { Rails::Generators::ObserverGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index 00906a61e0..d19128f79a 100644 --- a/railties/test/generators/performance_test_generator_test.rb +++ b/railties/test/generators/performance_test_generator_test.rb @@ -12,7 +12,7 @@ class PerformanceTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["performance"]) - silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args } + silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index c8bfaf3d97..f5b8b6ffb6 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -50,7 +50,7 @@ class PluginGeneratorTest < GeneratorsTestCase protected def run_generator(args=["plugin_fu"], config={}) - silence(:stdout){ Rails::Generators::PluginGenerator.start args, config } + silence(:stdout) { Rails::Generators::PluginGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 99811bc07b..dcae81c204 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -100,7 +100,7 @@ class ResourceGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"], config={}) - silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config } + silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 43647360d6..02155c295c 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -139,7 +139,7 @@ class ScaffoldControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["User", "name:string", "age:integer"]) - silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args } + silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 09ab58e404..c0652c034f 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -122,7 +122,8 @@ class ScaffoldGeneratorTest < GeneratorsTestCase def run_generator(config={}) silence(:stdout) do - Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], config + Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], + config.merge(:destination_root => destination_root) end end diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 342b9a900e..34fb996b7f 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -28,7 +28,7 @@ class SessionMigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[]) - silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args } + silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index 6a07898c51..15263d4bb8 100644 --- a/railties/test/generators/stylesheets_generator_test.rb +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -18,7 +18,7 @@ class StylesheetsGeneratorTest < GeneratorsTestCase protected def run_generator(config={}) - silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config } + silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config.merge(:destination_root => destination_root) } end end -- cgit v1.2.3 From 13004c37e658dac960ba3a75cdf90206fc58118e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 1 Nov 2009 13:44:24 +0100 Subject: Give useful test:isolated failures --- activesupport/test/ts_isolated.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/test/ts_isolated.rb b/activesupport/test/ts_isolated.rb index 9378a13766..cbab61a523 100644 --- a/activesupport/test/ts_isolated.rb +++ b/activesupport/test/ts_isolated.rb @@ -8,8 +8,8 @@ class TestIsolated < Test::Unit::TestCase Dir["#{File.dirname(__FILE__)}/**/*_test.rb"].each do |file| define_method("test #{file}") do command = "#{ruby} -Ilib:test #{file}" - silence_stderr { `#{command}` } - assert_equal 0, $?.to_i, command + result = silence_stderr { `#{command}` } + assert_block("#{command}\n#{result}") { $?.to_i.zero? } end end end -- cgit v1.2.3 From 36121d29a53c71cbdf4f0280718d572f16360f8c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 1 Nov 2009 10:34:16 +0100 Subject: Ruby 1.9 doesn't recognize EM SPACE as whitespace, breaking String#strip --- activesupport/test/multibyte_chars_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 680936ded5..0d3c3c7716 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -102,7 +102,13 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase # NEWLINE, SPACE, EM SPACE @whitespace = "\n#{[32, 8195].pack('U*')}" - @whitespace.force_encoding(Encoding::UTF_8) if @whitespace.respond_to?(:force_encoding) + + # Ruby 1.9 doesn't recognize EM SPACE as whitespace! + if @whitespace.respond_to?(:force_encoding) + @whitespace.slice!(2) + @whitespace.force_encoding(Encoding::UTF_8) + end + @byte_order_mark = [65279].pack('U') end -- cgit v1.2.3 From a2de13e1e0de5bba3cbd6050fe4884595704e1e2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 1 Nov 2009 10:38:02 +0100 Subject: Ruby 1.9.2: URI.escape is obsolete --- activesupport/lib/active_support/core_ext/uri.rb | 3 ++- activesupport/test/core_ext/uri_ext_test.rb | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb index 9a1c61d99b..ca1be8b7e9 100644 --- a/activesupport/lib/active_support/core_ext/uri.rb +++ b/activesupport/lib/active_support/core_ext/uri.rb @@ -4,7 +4,8 @@ if RUBY_VERSION >= '1.9' str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese. str.force_encoding(Encoding::UTF_8) if str.respond_to?(:force_encoding) - unless str == URI.unescape(URI.escape(str)) + parser = URI::Parser.new + unless str == parser.unescape(parser.escape(str)) URI::Parser.class_eval do remove_method :unescape def unescape(str, escaped = @regexp[:ESCAPED]) diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb index 2d4f38d095..e4a242abc4 100644 --- a/activesupport/test/core_ext/uri_ext_test.rb +++ b/activesupport/test/core_ext/uri_ext_test.rb @@ -7,7 +7,11 @@ class URIExtTest < Test::Unit::TestCase str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese. str.force_encoding(Encoding::UTF_8) if str.respond_to?(:force_encoding) - assert_equal str, URI.unescape(URI.escape(str)) - assert_equal str, URI.decode(URI.escape(str)) + if URI.const_defined?(:Parser) + parser = URI::Parser.new + assert_equal str, parser.unescape(parser.escape(str)) + else + assert_equal str, URI.unescape(URI.escape(str)) + end end end -- cgit v1.2.3 From 8935854375a6c08acd617beaec30f6fd09a29ea0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 1 Nov 2009 10:49:28 +0100 Subject: Ruby 1.9.2: rational.rb is deprecated --- activesupport/lib/active_support/core_ext/date_time/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb index 41cf020f94..e93abfa4a3 100644 --- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb @@ -1,4 +1,4 @@ -require 'rational' +require 'rational' unless RUBY_VERSION >= '1.9.2' class DateTime class << self -- cgit v1.2.3 From b540eca5889d7a28fac39c9ec0df715aa89487ce Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 1 Nov 2009 11:06:47 +0100 Subject: Consolidate Object#to_param and #to_query core extensions --- actionpack/lib/action_dispatch/routing.rb | 4 +- activeresource/lib/active_resource/base.rb | 1 + activesupport/lib/active_support/cache.rb | 7 +--- .../active_support/core_ext/array/conversions.rb | 16 -------- .../lib/active_support/core_ext/boolean.rb | 1 - .../active_support/core_ext/boolean/conversions.rb | 11 ----- .../active_support/core_ext/hash/conversions.rb | 17 -------- activesupport/lib/active_support/core_ext/nil.rb | 1 - .../lib/active_support/core_ext/nil/conversions.rb | 5 --- .../active_support/core_ext/object/conversions.rb | 18 +-------- .../lib/active_support/core_ext/object/to_param.rb | 47 ++++++++++++++++++++++ .../lib/active_support/core_ext/object/to_query.rb | 27 +++++++++++++ activesupport/test/core_ext/boolean_ext_test.rb | 12 ------ activesupport/test/core_ext/hash_ext_test.rb | 41 ------------------- activesupport/test/core_ext/nil_ext_test.rb | 8 ---- .../test/core_ext/object/to_param_test.rb | 19 +++++++++ .../test/core_ext/object/to_query_test.rb | 43 ++++++++++++++++++++ activesupport/test/core_ext/object_ext_test.rb | 7 ---- 18 files changed, 141 insertions(+), 144 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/boolean.rb delete mode 100644 activesupport/lib/active_support/core_ext/boolean/conversions.rb delete mode 100644 activesupport/lib/active_support/core_ext/nil.rb delete mode 100644 activesupport/lib/active_support/core_ext/nil/conversions.rb create mode 100644 activesupport/lib/active_support/core_ext/object/to_param.rb create mode 100644 activesupport/lib/active_support/core_ext/object/to_query.rb delete mode 100644 activesupport/test/core_ext/boolean_ext_test.rb delete mode 100644 activesupport/test/core_ext/nil_ext_test.rb create mode 100644 activesupport/test/core_ext/object/to_param_test.rb create mode 100644 activesupport/test/core_ext/object/to_query_test.rb diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index b9c377db2c..68ed1e3340 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -1,6 +1,4 @@ -require 'active_support/core_ext/object/conversions' -require 'active_support/core_ext/boolean/conversions' -require 'active_support/core_ext/nil/conversions' +require 'active_support/core_ext/object/to_param' require 'active_support/core_ext/regexp' module ActionDispatch diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index ae627c365d..bd2abdd38e 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -8,6 +8,7 @@ require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/module/aliasing' require 'active_support/core_ext/object/blank' require 'active_support/core_ext/object/misc' +require 'active_support/core_ext/object/to_query' require 'set' require 'uri' diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 818983fdd6..b91ae65e9f 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -2,12 +2,7 @@ require 'benchmark' require 'active_support/core_ext/benchmark' require 'active_support/core_ext/exception' require 'active_support/core_ext/class/attribute_accessors' - -%w(hash nil string time date date_time array big_decimal range object boolean).each do |library| - require "active_support/core_ext/#{library}/conversions" -end - -# require 'active_support/core_ext' # FIXME: pulling in all to_param extensions +require 'active_support/core_ext/object/to_param' module ActiveSupport # See ActiveSupport::Cache::Store for documentation. diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index c53cf3f530..db140225e8 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -40,22 +40,6 @@ class Array end end - - # Calls to_param on all its elements and joins the result with - # slashes. This is used by url_for in Action Pack. - def to_param - collect { |e| e.to_param }.join '/' - end - - # Converts an array into a string suitable for use as a URL query string, - # using the given +key+ as the param name. - # - # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" - def to_query(key) - prefix = "#{key}[]" - collect { |value| value.to_query(prefix) }.join '&' - end - # Converts a collection of elements into a formatted string by calling # to_s on all elements and joining them: # diff --git a/activesupport/lib/active_support/core_ext/boolean.rb b/activesupport/lib/active_support/core_ext/boolean.rb deleted file mode 100644 index be834288f2..0000000000 --- a/activesupport/lib/active_support/core_ext/boolean.rb +++ /dev/null @@ -1 +0,0 @@ -require 'active_support/core_ext/boolean/conversions' \ No newline at end of file diff --git a/activesupport/lib/active_support/core_ext/boolean/conversions.rb b/activesupport/lib/active_support/core_ext/boolean/conversions.rb deleted file mode 100644 index 534ebb7118..0000000000 --- a/activesupport/lib/active_support/core_ext/boolean/conversions.rb +++ /dev/null @@ -1,11 +0,0 @@ -class TrueClass - def to_param - self - end -end - -class FalseClass - def to_param - self - end -end diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index bd9419e1a2..190173f8a0 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -1,6 +1,4 @@ require 'active_support/time' -require 'active_support/core_ext/object/conversions' -require 'active_support/core_ext/array/conversions' require 'active_support/core_ext/hash/reverse_merge' class Hash @@ -68,21 +66,6 @@ class Hash ) end - # Converts a hash into a string suitable for use as a URL query string. An optional namespace can be - # passed to enclose the param names (see example below). - # - # ==== Examples - # { :name => 'David', :nationality => 'Danish' }.to_query # => "name=David&nationality=Danish" - # - # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" - def to_query(namespace = nil) - collect do |key, value| - value.to_query(namespace ? "#{namespace}[#{key}]" : key) - end.sort * '&' - end - - alias_method :to_param, :to_query - def to_xml(options = {}) require 'builder' unless defined?(Builder) diff --git a/activesupport/lib/active_support/core_ext/nil.rb b/activesupport/lib/active_support/core_ext/nil.rb deleted file mode 100644 index e9f63c4802..0000000000 --- a/activesupport/lib/active_support/core_ext/nil.rb +++ /dev/null @@ -1 +0,0 @@ -require 'active_support/core_ext/nil/conversions' \ No newline at end of file diff --git a/activesupport/lib/active_support/core_ext/nil/conversions.rb b/activesupport/lib/active_support/core_ext/nil/conversions.rb deleted file mode 100644 index 6ceb500a2a..0000000000 --- a/activesupport/lib/active_support/core_ext/nil/conversions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class NilClass - def to_param - self - end -end diff --git a/activesupport/lib/active_support/core_ext/object/conversions.rb b/activesupport/lib/active_support/core_ext/object/conversions.rb index 638f0decc1..540f7aadb0 100644 --- a/activesupport/lib/active_support/core_ext/object/conversions.rb +++ b/activesupport/lib/active_support/core_ext/object/conversions.rb @@ -1,18 +1,4 @@ +require 'active_support/core_ext/object/to_param' +require 'active_support/core_ext/object/to_query' require 'active_support/core_ext/array/conversions' require 'active_support/core_ext/hash/conversions' - -class Object - # Alias of to_s. - def to_param - to_s - end - - # Converts an object into a string suitable for use as a URL query string, using the given key as the - # param name. - # - # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work. - def to_query(key) - require 'cgi' unless defined?(CGI) && defined?(CGI::escape) - "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}" - end -end diff --git a/activesupport/lib/active_support/core_ext/object/to_param.rb b/activesupport/lib/active_support/core_ext/object/to_param.rb new file mode 100644 index 0000000000..a5e2260791 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/object/to_param.rb @@ -0,0 +1,47 @@ +class Object + # Alias of to_s. + def to_param + to_s + end +end + +class NilClass + def to_param + self + end +end + +class TrueClass + def to_param + self + end +end + +class FalseClass + def to_param + self + end +end + +class Array + # Calls to_param on all its elements and joins the result with + # slashes. This is used by url_for in Action Pack. + def to_param + collect { |e| e.to_param }.join '/' + end +end + +class Hash + # Converts a hash into a string suitable for use as a URL query string. An optional namespace can be + # passed to enclose the param names (see example below). + # + # ==== Examples + # { :name => 'David', :nationality => 'Danish' }.to_query # => "name=David&nationality=Danish" + # + # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" + def to_param(namespace = nil) + collect do |key, value| + value.to_query(namespace ? "#{namespace}[#{key}]" : key) + end.sort * '&' + end +end diff --git a/activesupport/lib/active_support/core_ext/object/to_query.rb b/activesupport/lib/active_support/core_ext/object/to_query.rb new file mode 100644 index 0000000000..3f1540f685 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/object/to_query.rb @@ -0,0 +1,27 @@ +require 'active_support/core_ext/object/to_param' + +class Object + # Converts an object into a string suitable for use as a URL query string, using the given key as the + # param name. + # + # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work. + def to_query(key) + require 'cgi' unless defined?(CGI) && defined?(CGI::escape) + "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}" + end +end + +class Array + # Converts an array into a string suitable for use as a URL query string, + # using the given +key+ as the param name. + # + # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" + def to_query(key) + prefix = "#{key}[]" + collect { |value| value.to_query(prefix) }.join '&' + end +end + +class Hash + alias_method :to_query, :to_param +end diff --git a/activesupport/test/core_ext/boolean_ext_test.rb b/activesupport/test/core_ext/boolean_ext_test.rb deleted file mode 100644 index 9439716efb..0000000000 --- a/activesupport/test/core_ext/boolean_ext_test.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'abstract_unit' -require 'active_support/core_ext/boolean/conversions' - -class BooleanExtAccessTests < Test::Unit::TestCase - def test_to_param_on_true - assert_equal true, true.to_param - end - - def test_to_param_on_false - assert_equal false, false.to_param - end -end diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index eb4c37aaf0..4642bb1330 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -899,42 +899,6 @@ class HashToXmlTest < Test::Unit::TestCase # :builder, etc, shouldn't be added to options assert_equal({:skip_instruct => true}, options) end -end - -class QueryTest < Test::Unit::TestCase - def test_simple_conversion - assert_query_equal 'a=10', :a => 10 - end - - def test_cgi_escaping - assert_query_equal 'a%3Ab=c+d', 'a:b' => 'c d' - end - - def test_nil_parameter_value - empty = Object.new - def empty.to_param; nil end - assert_query_equal 'a=', 'a' => empty - end - - def test_nested_conversion - assert_query_equal 'person%5Blogin%5D=seckar&person%5Bname%5D=Nicholas', - :person => {:name => 'Nicholas', :login => 'seckar'} - end - - def test_multiple_nested - assert_query_equal 'account%5Bperson%5D%5Bid%5D=20&person%5Bid%5D=10', - :person => {:id => 10}, :account => {:person => {:id => 20}} - end - - def test_array_values - assert_query_equal 'person%5Bid%5D%5B%5D=10&person%5Bid%5D%5B%5D=20', - :person => {:id => [10, 20]} - end - - def test_array_values_are_not_sorted - assert_query_equal 'person%5Bid%5D%5B%5D=20&person%5Bid%5D%5B%5D=10', - :person => {:id => [20, 10]} - end def test_expansion_count_is_limited expected = { @@ -962,9 +926,4 @@ class QueryTest < Test::Unit::TestCase Hash.from_xml(attack_xml) end end - - private - def assert_query_equal(expected, actual, message = nil) - assert_equal expected.split('&'), actual.to_query.split('&') - end end diff --git a/activesupport/test/core_ext/nil_ext_test.rb b/activesupport/test/core_ext/nil_ext_test.rb deleted file mode 100644 index 1062676d65..0000000000 --- a/activesupport/test/core_ext/nil_ext_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'abstract_unit' -require 'active_support/core_ext/nil/conversions' - -class NilExtAccessTests < Test::Unit::TestCase - def test_to_param - assert_nil nil.to_param - end -end diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb new file mode 100644 index 0000000000..c3efefddb5 --- /dev/null +++ b/activesupport/test/core_ext/object/to_param_test.rb @@ -0,0 +1,19 @@ +require 'abstract_unit' +require 'active_support/core_ext/object/to_param' + +class ToParamTest < Test::Unit::TestCase + def test_object + foo = Object.new + def foo.to_s; 'foo' end + assert_equal 'foo', foo.to_param + end + + def test_nil + assert_nil nil.to_param + end + + def test_boolean + assert_equal true, true.to_param + assert_equal false, false.to_param + end +end diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb new file mode 100644 index 0000000000..0fb15be654 --- /dev/null +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -0,0 +1,43 @@ +require 'abstract_unit' +require 'active_support/core_ext/object/to_query' + +class ToQueryTest < Test::Unit::TestCase + def test_simple_conversion + assert_query_equal 'a=10', :a => 10 + end + + def test_cgi_escaping + assert_query_equal 'a%3Ab=c+d', 'a:b' => 'c d' + end + + def test_nil_parameter_value + empty = Object.new + def empty.to_param; nil end + assert_query_equal 'a=', 'a' => empty + end + + def test_nested_conversion + assert_query_equal 'person%5Blogin%5D=seckar&person%5Bname%5D=Nicholas', + :person => {:name => 'Nicholas', :login => 'seckar'} + end + + def test_multiple_nested + assert_query_equal 'account%5Bperson%5D%5Bid%5D=20&person%5Bid%5D=10', + :person => {:id => 10}, :account => {:person => {:id => 20}} + end + + def test_array_values + assert_query_equal 'person%5Bid%5D%5B%5D=10&person%5Bid%5D%5B%5D=20', + :person => {:id => [10, 20]} + end + + def test_array_values_are_not_sorted + assert_query_equal 'person%5Bid%5D%5B%5D=20&person%5Bid%5D%5B%5D=10', + :person => {:id => [20, 10]} + end + + private + def assert_query_equal(expected, actual, message = nil) + assert_equal expected.split('&'), actual.to_query.split('&') + end +end diff --git a/activesupport/test/core_ext/object_ext_test.rb b/activesupport/test/core_ext/object_ext_test.rb index 484eecaab6..04c19ed2aa 100644 --- a/activesupport/test/core_ext/object_ext_test.rb +++ b/activesupport/test/core_ext/object_ext_test.rb @@ -1,16 +1,9 @@ require 'abstract_unit' require 'active_support/core_ext/object/metaclass' -require 'active_support/core_ext/object/conversions' class ObjectExtTest < Test::Unit::TestCase def test_tap_yields_and_returns_self foo = Object.new assert_equal foo, foo.tap { |x| assert_equal foo, x; :bar } end - - def test_to_param - foo = Object.new - foo.class_eval("def to_s; 'foo'; end") - assert_equal 'foo', foo.to_param - end end -- cgit v1.2.3 From 36a9644b86c53e322a891669cbdd2cf62cd648ac Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 1 Nov 2009 13:43:53 +0100 Subject: Clarify date/time dependencies --- activesupport/lib/active_support/core_ext/date/calculations.rb | 1 + activesupport/lib/active_support/core_ext/date/conversions.rb | 1 + activesupport/lib/active_support/json/encoding.rb | 3 --- activesupport/lib/active_support/time_with_zone.rb | 1 + activesupport/test/caching_test.rb | 6 +++--- railties/lib/rails/application.rb | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index ce3bebc25a..3dd61334d0 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -1,4 +1,5 @@ require 'active_support/duration' +require 'active_support/core_ext/time/zones' class Date class << self diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb index 54facf4430..b41ad5b686 100644 --- a/activesupport/lib/active_support/core_ext/date/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date/conversions.rb @@ -1,6 +1,7 @@ require 'active_support/inflector' require 'active_support/core_ext/time/conversions' require 'active_support/core_ext/date_time/conversions' +require 'active_support/values/time_zone' class Date DATE_FORMATS = { diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index f440d6ce58..8e8f9022c1 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -6,10 +6,7 @@ require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/object/instance_variables' require 'active_support/deprecation' -require 'active_support/core_ext/date_time/conversions' -require 'active_support/core_ext/time/conversions' require 'active_support/time_with_zone' -require 'active_support/values/time_zone' # Hack to load json gem first so we can overwrite its to_json. begin diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 4907fae9d6..a64128e49e 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -1,4 +1,5 @@ require 'active_support/duration' +require 'active_support/values/time_zone' require 'active_support/core_ext/numeric/time' require 'active_support/core_ext/integer/time' require 'active_support/core_ext/time/conversions' diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 892aa97ad7..6a51ce9402 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -154,13 +154,13 @@ class FileStoreTest < ActiveSupport::TestCase File.stubs(:mtime).returns(time) @cache.write('foo', 'bar') - cache_read = lambda { @cache.read('foo', :expires_in => 1.minute) } + cache_read = lambda { @cache.read('foo', :expires_in => 60) } assert_equal 'bar', cache_read.call - Time.stubs(:now).returns(time + 30.seconds) + Time.stubs(:now).returns(time + 30) assert_equal 'bar', cache_read.call - Time.stubs(:now).returns(time + 2.minutes) + Time.stubs(:now).returns(time + 120) assert_nil cache_read.call end end diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 26a55a73e1..af73b08547 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -242,6 +242,7 @@ module Rails # If assigned value cannot be matched to a TimeZone, an exception will be raised. initializer :initialize_time_zone do if config.time_zone + require 'active_support/core_ext/time/zones' zone_default = Time.__send__(:get_zone, config.time_zone) unless zone_default -- cgit v1.2.3 From e93c2da14108c324ddf5f08f0165b342e028896f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 2 Nov 2009 17:49:37 -0800 Subject: Arel::In -> Arel::Predicates::In --- activerecord/lib/active_record/associations.rb | 2 +- .../active_record/associations/has_and_belongs_to_many_association.rb | 2 +- activerecord/lib/active_record/associations/has_many_association.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 0888c41396..03c8d4b3ed 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1724,7 +1724,7 @@ module ActiveRecord if (ids_array = select_limited_ids_array(options, join_dependency)).empty? throw :invalid_query else - Arel::In.new( + Arel::Predicates::In.new( Arel::SqlLiteral.new("#{connection.quote_table_name table_name}.#{primary_key}"), ids_array ) diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index 4672b0723e..c646fe488b 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -84,7 +84,7 @@ module ActiveRecord else relation = arel_table(@reflection.options[:join_table]) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). - and(Arel::In.new(relation[@reflection.association_foreign_key], records.map(&:id))) + and(Arel::Predicates::In.new(relation[@reflection.association_foreign_key], records.map(&:id))) ).delete end end diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 29ba84ee37..cd31b0e211 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -71,7 +71,7 @@ module ActiveRecord else relation = arel_table(@reflection.table_name) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). - and(Arel::In.new(relation[@reflection.klass.primary_key], records.map(&:id))) + and(Arel::Predicates::In.new(relation[@reflection.klass.primary_key], records.map(&:id))) ).update(relation[@reflection.primary_key_name] => nil) @owner.class.update_counters(@owner.id, cached_counter_attribute_name => -records.size) if has_cached_counter? -- cgit v1.2.3 From 23780850237876cf81038534d8f59fa307af0b31 Mon Sep 17 00:00:00 2001 From: Matias Flores Date: Sat, 26 Sep 2009 21:32:21 -0300 Subject: Fix chars.reverse for multibyte decomposed strings [#597 state:committed] Signed-off-by: Jeremy Kemper --- activesupport/lib/active_support/multibyte/chars.rb | 2 +- activesupport/test/multibyte_chars_test.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 579ccc124d..c9bcfbd313 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -321,7 +321,7 @@ module ActiveSupport #:nodoc: # Example: # 'Café'.mb_chars.reverse.to_s #=> 'éfaC' def reverse - chars(self.class.u_unpack(@wrapped_string).reverse.pack('U*')) + chars(self.class.g_unpack(@wrapped_string).reverse.flatten.pack('U*')) end # Implements Unicode-aware slice with codepoints. Slicing on one point returns the codepoints for that diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 0d3c3c7716..a1ea8c8f4c 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -384,6 +384,17 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase assert_equal 'わちにこ', @chars.reverse end + def test_reverse_should_work_with_normalized_strings + str = 'bös' + reversed_str = 'söb' + assert_equal chars(reversed_str).normalize(:kc), chars(str).normalize(:kc).reverse + assert_equal chars(reversed_str).normalize(:c), chars(str).normalize(:c).reverse + assert_equal chars(reversed_str).normalize(:d), chars(str).normalize(:d).reverse + assert_equal chars(reversed_str).normalize(:kd), chars(str).normalize(:kd).reverse + assert_equal chars(reversed_str).decompose, chars(str).decompose.reverse + assert_equal chars(reversed_str).compose, chars(str).compose.reverse + end + def test_slice_should_take_character_offsets assert_equal nil, ''.mb_chars.slice(0) assert_equal 'こ', @chars.slice(0) -- cgit v1.2.3 From d226f17507805c145cc7a1727d46714b88910094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 3 Nov 2009 00:08:33 -0200 Subject: Ensure that generators can be invoked from any directory. Signed-off-by: Engine Yard --- railties/lib/rails/generators/base.rb | 17 +++++++++++++++++ railties/test/generators/generators_test_helper.rb | 15 ++++++++++----- railties/test/generators_test.rb | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 7af99797ea..e6baf2fc79 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -12,6 +12,16 @@ module Rails add_runtime_options! + # Always move to rails source root. + # + def initialize(*args) #:nodoc: + if !invoked?(args) && defined?(Rails.root) && Rails.root + self.destination_root = Rails.root + FileUtils.cd(destination_root) + end + super + end + # Automatically sets the source root based on the class name. # def self.source_root @@ -247,6 +257,13 @@ module Rails end end + # Check if this generator was invoked from another one by inspecting + # parameters. + # + def invoked?(args) + args.last.is_a?(Hash) && args.last.key?(:invocations) + end + # Use Rails default banner. # def self.banner diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index ccf08c347c..fdf6b4041f 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -1,8 +1,14 @@ # TODO: Fix this RAILS_ENV stuff -RAILS_ENV = 'test' - +RAILS_ENV = 'test' unless defined?(RAILS_ENV) require 'abstract_unit' -Rails.application.config.root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) + +module Rails + def self.root + @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) + end +end +Rails.application.config.root = Rails.root + require 'rails/generators' require 'rubygems' require 'active_record' @@ -15,8 +21,7 @@ class GeneratorsTestCase < Test::Unit::TestCase include FileUtils def destination_root - @destination_root ||= File.expand_path(File.join(File.dirname(__FILE__), - '..', 'fixtures', 'tmp')) + File.join(Rails.root, "tmp") end def setup diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 178b5ef6de..8f1984c7d2 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -105,7 +105,7 @@ class GeneratorsTest < GeneratorsTestCase end def test_warning_is_shown_if_generator_cant_be_loaded - Rails::Generators.load_paths << File.expand_path("../fixtures/vendor/gems/gems/wrong", __FILE__) + Rails::Generators.load_paths << File.join(Rails.root, "vendor", "gems", "gems", "wrong") output = capture(:stderr){ Rails::Generators.find_by_namespace(:wrong) } assert_match /\[WARNING\] Could not load generator at/, output assert_match /Error: uninitialized constant Rails::Generator/, output -- cgit v1.2.3 From ca990b03cc24a132211d0de8fb9dc2f975d904ca Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 2 Nov 2009 20:08:32 -0800 Subject: Work around rebundling issue --- ci/ci_build.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index b2f9f59bec..a6f8871f27 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -16,13 +16,11 @@ root_dir = File.expand_path(File.dirname(__FILE__) + "/..") # A security hole, but there is nothing valuable on rails CI box anyway. build_results[:geminstaller] = system "sudo geminstaller --config=#{root_dir}/ci/geminstaller.yml --exceptions" -rm_f "#{root_dir}/vendor" -system "rm -rf #{root_dir}/*/vendor" cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" puts - build_results[:bundle] = system 'gem bundle' + build_results[:bundle] = system 'rm -rf vendor && gem bundle' end cd "#{root_dir}/activesupport" do -- cgit v1.2.3 From 8ed82dfeb964345db9d092507a24b253de1d2ced Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 2 Nov 2009 20:25:02 -0800 Subject: Force gemcutter source to ensure a consistent arel version --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index e99e7c7591..eb84edd147 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ -Gem.sources.each { |uri| source uri } +clear_sources +source 'http://gemcutter.org' gem "rails", "3.0.pre", :vendored_at => "railties" %w( @@ -15,7 +16,6 @@ gem "rack", "1.0.1" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", "~> 0.5.0" gem "erubis", "~> 2.6.0" -gem "arel", :git => "git://github.com/rails/arel.git" gem "mocha" gem "sqlite3-ruby" gem "RedCloth" -- cgit v1.2.3 From aaa5a692a3e471f7f8f50957aac1c06fd30ec166 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 3 Nov 2009 00:25:15 -0800 Subject: Use spoofed version bump to ensure git is preferred --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index eb84edd147..a60c1010d9 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,7 @@ gem "rack", "1.0.1" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", "~> 0.5.0" gem "erubis", "~> 2.6.0" +gem "arel", "0.1.3", :git => "git://github.com/rails/arel.git" gem "mocha" gem "sqlite3-ruby" gem "RedCloth" -- cgit v1.2.3 From f950d0b4af54c3d387024dce2c5e2bc56aef0fc3 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 3 Nov 2009 11:23:22 -0600 Subject: Fix simple resource named routes for new routing dsl --- actionpack/lib/action_dispatch/routing/mapper.rb | 28 +++++++++++++++++------- actionpack/test/dispatch/routing_test.rb | 25 ++++++++++++++++----- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index d6d822842b..ebfb4c9be2 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -20,15 +20,20 @@ module ActionDispatch return self end - controller(resource) do + singular = resource.to_s + plural = singular.pluralize + + controller(plural) do namespace(resource) do with_scope_level(:resource) do yield if block_given? - get "", :to => :show + get "", :to => :show, :as => "#{singular}" post "", :to => :create put "", :to => :update - delete "", :to => :destory + delete "", :to => :destroy + get "new", :to => :new, :as => "new_#{singular}" + get "edit", :to => :edit, :as => "edit_#{singular}" end end end @@ -54,22 +59,25 @@ module ActionDispatch return self end + plural = resource.to_s + singular = plural.singularize + controller(resource) do namespace(resource) do with_scope_level(:resources) do yield if block_given? member do - get "", :to => :show + get "", :to => :show, :as => "#{singular}" put "", :to => :update - delete "", :to => :destory - get "edit", :to => :edit + delete "", :to => :destroy + get "edit", :to => :edit, :as => "edit_#{singular}" end collection do - get "", :to => :index + get "", :to => :index, :as => "#{plural}" post "", :to => :create - get "new", :to => :new + get "new", :to => :new, :as => "new_#{singular}" end end end @@ -221,6 +229,10 @@ module ActionDispatch map_method(:delete, *args, &block) end + def root(options = {}) + match '/', options.merge(:as => :root) + end + def match(*args) options = args.last.is_a?(Hash) ? args.pop : {} diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 74e6c8e72d..7917c1974b 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -190,8 +190,21 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest def test_projects with_test_routes do + get '/projects' + assert_equal 'projects#index', @response.body + assert_equal '/projects', projects_path + + get '/projects/new' + assert_equal 'projects#new', @response.body + assert_equal '/projects/new', new_project_path + get '/projects/1' assert_equal 'projects#show', @response.body + assert_equal '/projects/1', project_path(:id => '1') + + get '/projects/1/edit' + assert_equal 'projects#edit', @response.body + assert_equal '/projects/1/edit', edit_project_path(:id => '1') end end @@ -231,7 +244,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal 'people#index', @response.body get '/projects/1/companies/1/avatar' - assert_equal 'avatar#show', @response.body + assert_equal 'avatars#show', @response.body end end @@ -254,7 +267,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal 'people#show', @response.body get '/projects/1/people/1/7a2dec8/avatar' - assert_equal 'avatar#show', @response.body + assert_equal 'avatars#show', @response.body put '/projects/1/people/1/accessible_projects' assert_equal 'people#accessible_projects', @response.body @@ -282,7 +295,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal 'posts#preview', @response.body get '/projects/1/posts/1/subscription' - assert_equal 'subscription#show', @response.body + assert_equal 'subscriptions#show', @response.body get '/projects/1/posts/1/comments' assert_equal 'comments#index', @response.body @@ -329,13 +342,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest def test_account_namespace with_test_routes do get '/account/subscription' - assert_equal 'subscription#show', @response.body + assert_equal 'subscriptions#show', @response.body get '/account/credit' - assert_equal 'credit#show', @response.body + assert_equal 'credits#show', @response.body get '/account/credit_card' - assert_equal 'credit_card#show', @response.body + assert_equal 'credit_cards#show', @response.body end end -- cgit v1.2.3 From e15b5eda2b4888764cd0c63a297136babac026d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 3 Nov 2009 20:50:39 -0200 Subject: Avoid duplicated names on help description and show proper error message if trying to load a Rails 2.x generator. Signed-off-by: Jeremy Kemper --- railties/lib/rails/generators.rb | 50 ++++++++++++++++------ .../lib/generators/foobar/foobar_generator.rb | 4 ++ railties/test/generators_test.rb | 11 ++++- 3 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 railties/test/fixtures/lib/generators/foobar/foobar_generator.rb diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 49f32aa0db..a6a59f039f 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -152,7 +152,18 @@ module Rails end load_paths # Cache load paths. Needed to avoid __FILE__ pointing to wrong paths. - # Receives a namespace and tries different combinations to find a generator. + # Rails finds namespaces exactly as thor, with three conveniences: + # + # 1) If your generator name ends with generator, as WebratGenerator, it sets + # its namespace to "webrat", so it can be invoked as "webrat" and not + # "webrat_generator"; + # + # 2) If your generator has a generators namespace, as Rails::Generators::WebratGenerator, + # the namespace is set to "rails:generators:webrat", but Rails allows it + # to be invoked simply as "rails:webrat". The "generators" is added + # automatically when doing the lookup; + # + # 3) Rails looks in load paths and loads the generator just before it's going to be used. # # ==== Examples # @@ -162,30 +173,29 @@ module Rails # # "rails:generators:webrat", "webrat:generators:integration", "webrat" # - # If the namespace has ":" included we consider that a absolute namespace - # was given and the lookup above does not happen. Just the name is searched. - # - # Finally, it deals with one kind of shortcut: + # On the other hand, if "rails:webrat" is given, it will search for: # - # find_by_namespace "test_unit:model" + # "rails:generators:webrat", "rails:webrat" # - # It will search for generators at: - # - # "test_unit:generators:model", "test_unit:model" + # Notice that the "generators" namespace is handled automatically by Rails, + # so you don't need to type it when you want to invoke a generator in specific. # def self.find_by_namespace(name, base=nil, context=nil) #:nodoc: - name, attempts = name.to_s, [] + name, attempts = name.to_s, [ ] case name.count(':') when 1 base, name = name.split(':') return find_by_namespace(name, base) when 0 - attempts << "#{base}:generators:#{name}" if base - attempts << "#{name}:generators:#{context}" if context + attempts += generator_names(base, name) if base + attempts += generator_names(name, context) if context end attempts << name + attempts += generator_names(name, name) unless name.include?(?:) + attempts.uniq! + unloaded = attempts - namespaces lookup(unloaded) @@ -231,7 +241,10 @@ module Rails until tail.empty? others += Dir[File.join(path, *tail)].collect do |file| - file.split('/')[-tail.size, 2].join(':').sub(/_generator\.rb$/, '') + name = file.split('/')[-tail.size, 2] + name.last.sub!(/_generator\.rb$/, '') + name.uniq! + name.join(':') end tail.shift end @@ -246,7 +259,7 @@ module Rails # Return all defined namespaces. # def self.namespaces #:nodoc: - Thor::Base.subclasses.map{ |klass| klass.namespace } + Thor::Base.subclasses.map { |klass| klass.namespace } end # Keep builtin generators in an Array[Array[group, name]]. @@ -257,6 +270,12 @@ module Rails end end + # By default, Rails strips the generator namespace to make invocations + # easier. This method generaters the both possibilities names. + def self.generator_names(first, second) + [ "#{first}:generators:#{second}", "#{first}:#{second}" ] + end + # Try callbacks for the given base. # def self.invoke_fallbacks_for(name, base) @@ -285,6 +304,9 @@ module Rails Dir[File.join(path, '**', attempts)].each do |file| begin require file + rescue NameError => e + raise unless e.message =~ /Rails::Generator/ + warn "[WARNING] Could not load generator at #{file.inspect} because it's a Rails 2.x generator, which is not supported anymore" rescue Exception => e warn "[WARNING] Could not load generator at #{file.inspect}. Error: #{e.message}" end diff --git a/railties/test/fixtures/lib/generators/foobar/foobar_generator.rb b/railties/test/fixtures/lib/generators/foobar/foobar_generator.rb new file mode 100644 index 0000000000..d1de8c56fa --- /dev/null +++ b/railties/test/fixtures/lib/generators/foobar/foobar_generator.rb @@ -0,0 +1,4 @@ +module Foobar + class FoobarGenerator < Rails::Generators::Base + end +end diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 8f1984c7d2..07f51eca01 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -45,6 +45,12 @@ class GeneratorsTest < GeneratorsTestCase assert_equal "test_unit:generators:model", klass.namespace end + def test_find_by_namespace_with_duplicated_name + klass = Rails::Generators.find_by_namespace(:foobar) + assert klass + assert_equal "foobar:foobar", klass.namespace + end + def test_find_by_namespace_add_generators_to_raw_lookups klass = Rails::Generators.find_by_namespace("test_unit:model") assert klass @@ -101,14 +107,15 @@ class GeneratorsTest < GeneratorsTestCase def test_rails_generators_with_others_information output = capture(:stdout){ Rails::Generators.help }.split("\n").last - assert_equal "Others: active_record:fixjour, fixjour, mspec, rails:javascripts.", output + assert_equal "Others: active_record:fixjour, fixjour, foobar, mspec, rails:javascripts.", output end def test_warning_is_shown_if_generator_cant_be_loaded Rails::Generators.load_paths << File.join(Rails.root, "vendor", "gems", "gems", "wrong") output = capture(:stderr){ Rails::Generators.find_by_namespace(:wrong) } + assert_match /\[WARNING\] Could not load generator at/, output - assert_match /Error: uninitialized constant Rails::Generator/, output + assert_match /Rails 2\.x generator/, output end def test_no_color_sets_proper_shell -- cgit v1.2.3 From 3fb548cac319207f369f348c5f27d165b65c2f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 3 Nov 2009 20:51:44 -0200 Subject: Ensure ActiveRecord is loaded on revoke/destroy. Signed-off-by: Jeremy Kemper --- railties/lib/rails/generators/active_record.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/railties/lib/rails/generators/active_record.rb b/railties/lib/rails/generators/active_record.rb index babad33db3..c62f75c384 100644 --- a/railties/lib/rails/generators/active_record.rb +++ b/railties/lib/rails/generators/active_record.rb @@ -1,6 +1,7 @@ require 'rails/generators/named_base' require 'rails/generators/migration' require 'rails/generators/active_model' +require 'active_record' module ActiveRecord module Generators -- cgit v1.2.3 From 3b8e29fe5697d4aec99229abcbd04141d3e53b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 3 Nov 2009 22:02:24 -0200 Subject: Remove --freeze (since Rails will come bundled in all new apps) and update gem action to change Gemfile instead of config.environment. Signed-off-by: Jeremy Kemper --- railties/lib/rails/generators/actions.rb | 60 ++++++++++++++++++---- .../rails/generators/rails/app/app_generator.rb | 7 --- .../rails/generators/rails/app/templates/Gemfile | 4 +- railties/test/generators/actions_test.rb | 47 ++++++++--------- railties/test/generators/app_generator_test.rb | 14 ----- railties/test/generators/generators_test_helper.rb | 2 +- 6 files changed, 76 insertions(+), 58 deletions(-) diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 9254f8d918..c601c6fb39 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -1,4 +1,5 @@ require 'open-uri' +require 'active_support/deprecation' module Rails module Generators @@ -45,19 +46,56 @@ module Rails # # gem "rspec", :env => :test # gem "technoweenie-restful-authentication", :lib => "restful-authentication", :source => "http://gems.github.com/" + # gem "rails", "3.0", :git => "git://github.com/rails/rails" # - def gem(name, options={}) - log :gem, name - env = options.delete(:env) + def gem(*args) + options = args.extract_options! + name, version = args - gems_code = "config.gem '#{name}'" + # Deal with deprecated options + { :env => :only, :lib => :require_as }.each do |old, new| + next unless options[old] + options[new] = options.delete(old) + ActiveSupport::Deprecation.warn "#{old.inspect} option in gem is deprecated, use #{new.inspect} instead" + end + + # Deal with deprecated source + if source = options.delete(:source) + ActiveSupport::Deprecation.warn ":source option in gem is deprecated, use add_source method instead" + add_source(source) + end + + # Set the message to be shown in logs. Uses the git repo if one is given, + # otherwise use name (version). + parts, message = [ name.inspect ], name + if version ||= options.delete(:version) + parts << version + message << " (#{version})" + end + message = options[:git] if options[:git] + + log :gemfile, message + + options.each do |option, value| + parts << ":#{option} => #{value.inspect}" + end - if options.any? - opts = options.inject([]) {|result, h| result << [":#{h[0]} => #{h[1].inspect.gsub('"',"'")}"] }.sort.join(", ") - gems_code << ", #{opts}" + in_root do + append_file "Gemfile", "gem #{parts.join(", ")}", :verbose => false end + end + + # Add the given source to Gemfile + # + # ==== Example + # + # source "http://gems.github.com/" + def add_source(source, options={}) + log :source, source - environment gems_code, :env => env + in_root do + prepend_file "Gemfile", "source #{source.inspect}", :verbose => false + end end # Adds a line inside the Initializer block for config/environment.rb. @@ -79,6 +117,7 @@ module Rails end end end + alias :application :environment # Run a command in git. # @@ -222,9 +261,8 @@ module Rails # # freeze! # - def freeze!(args = {}) - log :vendor, "rails" - in_root { run("#{extify(:rake)} rails:freeze:edge", :verbose => false) } + def freeze!(args={}) + ActiveSupport::Deprecation.warn "freeze! is deprecated since your rails app now comes bundled with Rails by default, please check your Gemfile" end # Make an entry in Rails routing file conifg/routes.rb diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 93d9ac553d..e552cc4520 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -12,9 +12,6 @@ module Rails::Generators class_option :database, :type => :string, :aliases => "-d", :default => "sqlite3", :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})" - class_option :freeze, :type => :boolean, :aliases => "-F", :default => false, - :desc => "Freeze Rails in vendor/rails from the gems" - class_option :template, :type => :string, :aliases => "-m", :desc => "Path to an application template (can be a filesystem path or URL)." @@ -155,10 +152,6 @@ module Rails::Generators raise Error, "The template [#{rails_template}] could not be loaded. Error: #{e}" end - def freeze? - freeze! if options[:freeze] - end - protected attr_accessor :rails_template diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index 3966c0f70d..a41ce2f484 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -1,9 +1,9 @@ # Gemfile is where you list all of your application's dependencies # -<%= "# " if options.freeze? %>gem "rails", "<%= Rails::VERSION::STRING %>" +gem "rails", "<%= Rails::VERSION::STRING %>" # # Bundling edge rails: -<%= "# " unless options.freeze? %>gem "rails", "<%= Rails::VERSION::STRING %>", :git => "git://github.com/rails/rails.git" +# gem "rails", "<%= Rails::VERSION::STRING %>", :git => "git://github.com/rails/rails.git" # Specify gemcutter as a gem source # source "http://gemcutter.org" diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 199b5fa8b4..7d03a37f2a 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -54,37 +54,37 @@ class ActionsTest < GeneratorsTestCase action :plugin, 'rest_auth', {} end - def test_gem_should_put_gem_dependency_in_enviroment + def test_add_source_adds_source_to_gemfile run_generator - action :gem, 'will-paginate' - assert_file 'config/application.rb', /config\.gem 'will\-paginate'/ + action :add_source, 'http://gems.github.com' + assert_file 'Gemfile', /source "http:\/\/gems\.github\.com"/ end - def test_gem_with_options_should_include_options_in_gem_dependency_in_environment + def test_gem_should_put_gem_dependency_in_gemfile run_generator - action :gem, 'mislav-will-paginate', :lib => 'will-paginate', :source => 'http://gems.github.com' - - regexp = /#{Regexp.escape("config.gem 'mislav-will-paginate', :lib => 'will-paginate', :source => 'http://gems.github.com'")}/ - assert_file 'config/application.rb', regexp + action :gem, 'will-paginate' + assert_file 'Gemfile', /gem "will\-paginate"/ end - def test_gem_with_env_string_should_put_gem_dependency_in_specified_environment + def test_gem_with_options_should_include_all_options_in_gemfile run_generator - action :gem, 'rspec', :env => 'test' - assert_file 'config/environments/test.rb', /config\.gem 'rspec'/ - end - def test_gem_with_env_array_should_put_gem_dependency_in_specified_environments - run_generator - action :gem, 'quietbacktrace', :env => %w[ development test ] - assert_file 'config/environments/development.rb', /config\.gem 'quietbacktrace'/ - assert_file 'config/environments/test.rb', /config\.gem 'quietbacktrace'/ + assert_deprecated do + action :gem, 'mislav-will-paginate', :lib => 'will-paginate', :source => 'http://gems.github.com' + end + + assert_file 'Gemfile', /gem "mislav\-will\-paginate", :require_as => "will\-paginate"/ + assert_file 'Gemfile', /source "http:\/\/gems\.github\.com"/ end - def test_gem_with_lib_option_set_to_false_should_put_gem_dependency_in_enviroment_correctly + def test_gem_with_env_should_include_all_dependencies_in_gemfile run_generator - action :gem, 'mislav-will-paginate', :lib => false - assert_file 'config/application.rb', /config\.gem 'mislav\-will\-paginate'\, :lib => false/ + + assert_deprecated do + action :gem, 'rspec', :env => %w(development test) + end + + assert_file 'Gemfile', /gem "rspec", :only => \["development", "test"\]/ end def test_environment_should_include_data_in_environment_initializer_block @@ -163,9 +163,10 @@ class ActionsTest < GeneratorsTestCase action :capify! end - def test_freeze_should_freeze_rails_edge - generator.expects(:run).once.with('rake rails:freeze:edge', :verbose => false) - action :freeze! + def test_freeze_is_deprecated + assert_deprecated do + action :freeze! + end end def test_route_should_add_data_to_the_routes_block_in_config_routes diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 20f2a24e6d..10d0bc6bc2 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -110,20 +110,6 @@ class AppGeneratorTest < GeneratorsTestCase ).each { |path| assert_file "script/#{path}", /#!\/usr\/bin\/env/ } end - def test_rails_is_frozen - generator(:freeze => true, :database => "sqlite3").expects(:run). - with("rake rails:freeze:edge", :verbose => false) - silence(:stdout){ generator.invoke } - - assert_file 'Gemfile' do |content| - flag = %(gem "rails", "#{Rails::VERSION::STRING}", :git => "git://github.com/rails/rails.git") - assert_match /^#{Regexp.escape(flag)}$/, content - - flag = %(# gem "rails", "#{Rails::VERSION::STRING}") - assert_match /^#{Regexp.escape(flag)}$/, content - end - end - def test_template_from_dir_pwd FileUtils.cd(Rails.root) assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"]) diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index fdf6b4041f..4ce48a453b 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -17,7 +17,7 @@ require 'action_dispatch' CURRENT_PATH = File.expand_path(Dir.pwd) Rails::Generators.no_color! -class GeneratorsTestCase < Test::Unit::TestCase +class GeneratorsTestCase < ActiveSupport::TestCase include FileUtils def destination_root -- cgit v1.2.3 From e5211e3bd052ebc24905c65172d449f7b3bcc73f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 3 Nov 2009 16:36:19 -0800 Subject: Improve Gemfile commentary --- railties/lib/rails/generators/rails/app/templates/Gemfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index a41ce2f484..8e851a64e7 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -1,20 +1,17 @@ -# Gemfile is where you list all of your application's dependencies -# +# Edit this Gemfile to bundle your application's dependencies. + gem "rails", "<%= Rails::VERSION::STRING %>" -# -# Bundling edge rails: -# gem "rails", "<%= Rails::VERSION::STRING %>", :git => "git://github.com/rails/rails.git" -# Specify gemcutter as a gem source -# source "http://gemcutter.org" +## Bundle edge rails: +# gem "rails", :git => "git://github.com/rails/rails.git" -# Specify gems that this application depends on and have them installed with rake gems:install +## Bundle the gems you use: # gem "bj" # gem "hpricot", "0.6" # gem "sqlite3-ruby", :require_as => "sqlite3" # gem "aws-s3", :require_as => "aws/s3" -# Specify gems that should only be required in certain environments +## Bundle gems used only in certain environments: # gem "rspec", :only => :test # only :test do # gem "webrat" -- cgit v1.2.3 From d627c932bdc5c0e2911e39cfb38952c29dab7afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 4 Nov 2009 00:14:44 -0200 Subject: Pass config.generators options along when RAILS_GENERATORS is set and show --force-plural message just once. Signed-off-by: Jeremy Kemper --- railties/lib/rails/application.rb | 3 ++- railties/lib/rails/commands/destroy.rb | 2 -- railties/lib/rails/commands/generate.rb | 2 -- railties/lib/rails/configuration.rb | 14 +++++++++----- railties/lib/rails/generators/actions.rb | 1 + railties/lib/rails/generators/named_base.rb | 5 ++++- .../rails/generators/rails/app/templates/script/destroy.tt | 3 ++- .../generators/rails/app/templates/script/generate.tt | 1 + railties/lib/rails/generators/resource_helpers.rb | 8 +++++++- railties/test/application/generators_test.rb | 6 ++++-- railties/test/generators/resource_generator_test.rb | 2 +- 11 files changed, 31 insertions(+), 16 deletions(-) diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index af73b08547..ce3ab9147c 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -416,7 +416,8 @@ module Rails # === # TODO: Does this need to be an initializer here? initializer :initialize_generators do - if defined?(Rails::Generators) + if defined?(RAILS_GENERATORS) && RAILS_GENERATORS + require 'rails/generators' Rails::Generators.no_color! unless config.generators.colorize_logging Rails::Generators.aliases.deep_merge! config.generators.aliases Rails::Generators.options.deep_merge! config.generators.options diff --git a/railties/lib/rails/commands/destroy.rb b/railties/lib/rails/commands/destroy.rb index 1270fdd033..15ff90f78a 100644 --- a/railties/lib/rails/commands/destroy.rb +++ b/railties/lib/rails/commands/destroy.rb @@ -1,5 +1,3 @@ -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators')) - if ARGV.size == 0 Rails::Generators.help exit diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index d91dcf9788..82a658e2ed 100755 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -1,5 +1,3 @@ -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators')) - if ARGV.size == 0 Rails::Generators.help exit diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 0a545f23de..2b847ba711 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -278,12 +278,16 @@ module Rails end def method_missing(method, *args) - method = method.to_s.sub(/=$/, '').to_sym - namespace = args.first.is_a?(Symbol) ? args.shift : nil - configuration = args.first.is_a?(Hash) ? args.shift : nil + method = method.to_s.sub(/=$/, '').to_sym - @options[:rails][method] = namespace if namespace - namespace ||= method + if method == :rails + namespace, configuration = :rails, args.shift + elsif args.first.is_a?(Hash) + namespace, configuration = method, args.shift + else + namespace, configuration = args.shift, args.shift + @options[:rails][method] = namespace + end if configuration aliases = configuration.delete(:aliases) diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index c601c6fb39..8677bf283b 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -289,6 +289,7 @@ module Rails if args.size == 1 say args.first.to_s else + args << (self.behavior == :invoke ? :green : :red) say_status *args end end diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 0e5976f915..1d4f52286e 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -11,7 +11,10 @@ module Rails alias :file_name :singular_name - def initialize(*args) #:nodoc: + def initialize(args, *options) #:nodoc: + # Unfreeze name in case it's given as a frozen string + args[0] = args[0].dup if args[0].is_a?(String) && args[0].frozen? + super assign_names!(self.name) parse_attributes! if respond_to?(:attributes) diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt b/railties/lib/rails/generators/rails/app/templates/script/destroy.tt index c97090cdee..62a856d338 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/destroy.tt @@ -1,3 +1,4 @@ <%= shebang %> -require File.expand_path('../../config/application', __FILE__) +RAILS_GENERATORS = true +require File.expand_path('../../config/environment', __FILE__) require 'rails/commands/destroy' diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate.tt b/railties/lib/rails/generators/rails/app/templates/script/generate.tt index 26f029c6a6..a005e77104 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/generate.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/generate.tt @@ -1,3 +1,4 @@ <%= shebang %> +RAILS_GENERATORS = true require File.expand_path('../../config/environment', __FILE__) require 'rails/commands/generate' diff --git a/railties/lib/rails/generators/resource_helpers.rb b/railties/lib/rails/generators/resource_helpers.rb index 0385581083..99954e2292 100644 --- a/railties/lib/rails/generators/resource_helpers.rb +++ b/railties/lib/rails/generators/resource_helpers.rb @@ -6,6 +6,8 @@ module Rails # ActiveModel. # module ResourceHelpers + mattr_accessor :skip_warn + def self.included(base) #:nodoc: base.send :attr_reader, :controller_name, :controller_class_name, :controller_file_name, :controller_class_path, :controller_file_path @@ -19,7 +21,11 @@ module Rails super if name == name.pluralize && !options[:force_plural] - say "Plural version of the model detected, using singularized version. Override with --force-plural." + unless ResourceHelpers.skip_warn + say "Plural version of the model detected, using singularized version. Override with --force-plural." + ResourceHelpers.skip_warn = true + end + name.replace name.singularize assign_names!(self.name) end diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 445a867c85..bfbf1ffd16 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -1,4 +1,5 @@ require "isolation/abstract_unit" +RAILS_GENERATORS = true module ApplicationTests class GeneratorsTest < Test::Unit::TestCase @@ -23,7 +24,8 @@ module ApplicationTests Rails::Initializer.run do |c| c.generators.orm = :datamapper c.generators.test_framework = :rspec - expected = { :rails => { :orm => :datamapper, :test_framework => :rspec } } + c.generators.helper = false + expected = { :rails => { :orm => :datamapper, :test_framework => :rspec, :helper => false } } assert_equal(expected, c.generators.options) end end @@ -93,4 +95,4 @@ module ApplicationTests assert Rails::Generators.options.size >= 1 end end -end \ No newline at end of file +end diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index dcae81c204..886af01b22 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -75,7 +75,7 @@ class ResourceGeneratorTest < GeneratorsTestCase end def test_plural_names_are_singularized - content = run_generator ["accounts"] + content = run_generator ["accounts".freeze] assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ assert_file "test/unit/account_test.rb", /class AccountTest/ assert_match /Plural version of the model detected, using singularized version. Override with --force-plural./, content -- cgit v1.2.3 From a3d5274e67c841a6fdc9f9acb9e1b6bbc351dd28 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 3 Nov 2009 18:58:40 -0800 Subject: Configure generator when needed rather than during initialization --- railties/lib/rails/application.rb | 12 ------------ railties/lib/rails/generators.rb | 6 ++++++ .../rails/generators/rails/app/templates/script/destroy.tt | 3 ++- .../rails/generators/rails/app/templates/script/generate.tt | 3 ++- railties/test/application/generators_test.rb | 3 ++- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index ce3ab9147c..242aea1842 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -412,18 +412,6 @@ module Rails end end - # Configure generators if they were already loaded - # === - # TODO: Does this need to be an initializer here? - initializer :initialize_generators do - if defined?(RAILS_GENERATORS) && RAILS_GENERATORS - require 'rails/generators' - Rails::Generators.no_color! unless config.generators.colorize_logging - Rails::Generators.aliases.deep_merge! config.generators.aliases - Rails::Generators.options.deep_merge! config.generators.options - end - end - # For each framework, search for instrument file with Notifications hooks. # initializer :load_notifications_hooks do diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index a6a59f039f..fa2c11795b 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -72,6 +72,12 @@ module Rails } } + def self.configure!(config = Rails.application.config.generators) #:nodoc: + no_color! unless config.colorize_logging + aliases.deep_merge! config.aliases + options.deep_merge! config.options + end + def self.aliases #:nodoc: @aliases ||= DEFAULT_ALIASES.dup end diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt b/railties/lib/rails/generators/rails/app/templates/script/destroy.tt index 62a856d338..6adc90b2c3 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/destroy.tt @@ -1,4 +1,5 @@ <%= shebang %> -RAILS_GENERATORS = true require File.expand_path('../../config/environment', __FILE__) +require 'rails/generators' +Rails::Generators.configure! require 'rails/commands/destroy' diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate.tt b/railties/lib/rails/generators/rails/app/templates/script/generate.tt index a005e77104..71d47dec92 100755 --- a/railties/lib/rails/generators/rails/app/templates/script/generate.tt +++ b/railties/lib/rails/generators/rails/app/templates/script/generate.tt @@ -1,4 +1,5 @@ <%= shebang %> -RAILS_GENERATORS = true require File.expand_path('../../config/environment', __FILE__) +require 'rails/generators' +Rails::Generators.configure! require 'rails/commands/generate' diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index bfbf1ffd16..ccbcd84176 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -1,5 +1,4 @@ require "isolation/abstract_unit" -RAILS_GENERATORS = true module ApplicationTests class GeneratorsTest < Test::Unit::TestCase @@ -47,6 +46,7 @@ module ApplicationTests end # Initialize the application Rails.initialize! + Rails::Generators.configure! assert_equal :rspec, Rails::Generators.options[:rails][:test_framework] assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework] @@ -59,6 +59,7 @@ module ApplicationTests end # Initialize the application Rails.initialize! + Rails::Generators.configure! assert_equal Thor::Base.shell, Thor::Shell::Basic end -- cgit v1.2.3 From 935bd0fef8e26f4ec65fe411a1d29942493f8d46 Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Sun, 1 Nov 2009 17:18:27 +0100 Subject: Add ActiveSupport::Multibyte::Chars#limit. The limit method limits the number of bytes in a string. Useful when the storage space of the string is limited, for instance in a database column definition. Sharpen up the implementation of translate offset. [#3192 state:committed] --- .../lib/active_support/multibyte/chars.rb | 29 ++++++----- activesupport/test/multibyte_chars_test.rb | 59 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index c9bcfbd313..51b870de8c 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -363,6 +363,16 @@ module ActiveSupport #:nodoc: slice end + # Limit the byte size of the string to a number of bytes without breaking characters. Usable + # when the storage for a string is limited for some reason. + # + # Example: + # s = 'こんにちは' + # s.mb_chars.limit(7) #=> "こに" + def limit(limit) + slice(0...translate_offset(limit)) + end + # Returns the codepoint of the first character in the string. # # Example: @@ -651,24 +661,15 @@ module ActiveSupport #:nodoc: end protected - + def translate_offset(byte_offset) #:nodoc: return nil if byte_offset.nil? return 0 if @wrapped_string == '' - chunk = @wrapped_string[0..byte_offset] begin - begin - chunk.unpack('U*').length - 1 - rescue ArgumentError => e - chunk = @wrapped_string[0..(byte_offset+=1)] - # Stop retrying at the end of the string - raise e unless byte_offset < chunk.length - # We damaged a character, retry - retry - end - # Catch the ArgumentError so we can throw our own - rescue ArgumentError - raise EncodingError, 'malformed UTF-8 character' + @wrapped_string[0...byte_offset].unpack('U*').length + rescue ArgumentError => e + byte_offset -= 1 + retry end end diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index a1ea8c8f4c..fc7b5e5081 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -169,6 +169,7 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase assert chars('').strip.kind_of?(ActiveSupport::Multibyte.proxy_class) assert chars('').reverse.kind_of?(ActiveSupport::Multibyte.proxy_class) assert chars(' ').slice(0).kind_of?(ActiveSupport::Multibyte.proxy_class) + assert chars('').limit(0).kind_of?(ActiveSupport::Multibyte.proxy_class) assert chars('').upcase.kind_of?(ActiveSupport::Multibyte.proxy_class) assert chars('').downcase.kind_of?(ActiveSupport::Multibyte.proxy_class) assert chars('').capitalize.kind_of?(ActiveSupport::Multibyte.proxy_class) @@ -196,7 +197,9 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase def test_should_return_character_offset_for_regexp_matches assert_nil(@chars =~ /wrong/u) assert_equal 0, (@chars =~ /こ/u) + assert_equal 0, (@chars =~ /こに/u) assert_equal 1, (@chars =~ /に/u) + assert_equal 2, (@chars =~ /ち/u) assert_equal 3, (@chars =~ /わ/u) end @@ -493,6 +496,44 @@ class MultibyteCharsExtrasTest < Test::Unit::TestCase end end + def test_limit_should_not_break_on_blank_strings + chars = ''.mb_chars + + assert_equal '', chars.limit(0) + assert_equal '', chars.limit(1) + end + + def test_limit_should_work_on_a_multibyte_string + chars = UNICODE_STRING.mb_chars + + assert_equal UNICODE_STRING, chars.limit(UNICODE_STRING.length) + assert_equal '', chars.limit(0) + assert_equal '', chars.limit(1) + assert_equal 'こ', chars.limit(3) + assert_equal 'こに', chars.limit(6) + assert_equal 'こに', chars.limit(8) + assert_equal 'こにち', chars.limit(9) + assert_equal 'こにちわ', chars.limit(50) + end + + def test_limit_should_work_on_an_ascii_string + ascii = ASCII_STRING.mb_chars + + assert_equal ASCII_STRING, ascii.limit(ASCII_STRING.length) + assert_equal '', ascii.limit(0) + assert_equal 'o', ascii.limit(1) + assert_equal 'oh', ascii.limit(2) + assert_equal 'ohay', ascii.limit(4) + assert_equal 'ohayo', ascii.limit(50) + end + + def test_limit_should_keep_under_the_specified_byte_limit + chars = UNICODE_STRING.mb_chars + (1..UNICODE_STRING.length).each do |limit| + assert chars.limit(limit).to_s.length <= limit + end + end + def test_composition_exclusion_is_set_up_properly # Normalization of DEVANAGARI LETTER QA breaks when composition exclusion isn't used correctly qa = [0x915, 0x93c].pack('U*') @@ -603,3 +644,21 @@ class MultibyteCharsExtrasTest < Test::Unit::TestCase end.pack('U*') end end + +class MultibyteInternalsTest < ActiveSupport::TestCase + include MultibyteTestHelpers + + test "Chars translates a character offset to a byte offset" do + chars = "Puisque c'était son erreur, il m'a aidé".mb_chars + [ + [0, 0], + [3, 3], + [12, 11], + [14, 13], + [41, 39] + ].each do |byte_offset, character_offset| + assert_equal character_offset, chars.send(:translate_offset, byte_offset), + "Expected byte offset #{byte_offset} to translate to #{character_offset}" + end + end +end \ No newline at end of file -- cgit v1.2.3 From 62a022891b5f12284205920a03a3cbbe5b8ecd27 Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Mon, 2 Nov 2009 21:06:12 +0100 Subject: Improve performance of Multibyte::Utils. Replace explicit for-loops by faster enumeration methods. [#3158 state:committed] --- activesupport/lib/active_support/multibyte/utils.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/activesupport/lib/active_support/multibyte/utils.rb b/activesupport/lib/active_support/multibyte/utils.rb index 8e47763d39..b243df46d8 100644 --- a/activesupport/lib/active_support/multibyte/utils.rb +++ b/activesupport/lib/active_support/multibyte/utils.rb @@ -26,11 +26,11 @@ module ActiveSupport #:nodoc: else def self.verify(string) if expression = valid_character - for c in string.split(//) - return false unless expression.match(c) - end + # Splits the string on character boundaries, which are determined based on $KCODE. + string.split(//).all? { |c| expression.match(c) } + else + true end - true end end @@ -49,9 +49,8 @@ module ActiveSupport #:nodoc: else def self.clean(string) if expression = valid_character - stripped = []; for c in string.split(//) - stripped << c if expression.match(c) - end; stripped.join + # Splits the string on character boundaries, which are determined based on $KCODE. + string.split(//).grep(expression).join else string end -- cgit v1.2.3 From da3a228a93e1858a46f9a0cefcb9c72285479a56 Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Mon, 2 Nov 2009 21:34:07 +0100 Subject: Make ActiveSupport::Chars#limit run on Ruby 1.9. --- .../lib/active_support/multibyte/chars.rb | 5 ++ activesupport/test/multibyte_chars_test.rb | 56 +++++++++++----------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 51b870de8c..d372b0ab1f 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -665,6 +665,11 @@ module ActiveSupport #:nodoc: def translate_offset(byte_offset) #:nodoc: return nil if byte_offset.nil? return 0 if @wrapped_string == '' + + if @wrapped_string.respond_to?(:force_encoding) + @wrapped_string = @wrapped_string.dup.force_encoding(Encoding::ASCII_8BIT) + end + begin @wrapped_string[0...byte_offset].unpack('U*').length rescue ArgumentError => e diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index fc7b5e5081..4ff74abf61 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -100,15 +100,14 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase def setup @chars = UNICODE_STRING.dup.mb_chars - # NEWLINE, SPACE, EM SPACE - @whitespace = "\n#{[32, 8195].pack('U*')}" - - # Ruby 1.9 doesn't recognize EM SPACE as whitespace! - if @whitespace.respond_to?(:force_encoding) - @whitespace.slice!(2) - @whitespace.force_encoding(Encoding::UTF_8) + if RUBY_VERSION < '1.9' + # Multibyte support all kinds of whitespace (ie. NEWLINE, SPACE, EM SPACE) + @whitespace = "\n\t#{[32, 8195].pack('U*')}" + else + # Ruby 1.9 only supports basic whitespace + @whitespace = "\n\t ".force_encoding(Encoding::UTF_8) end - + @byte_order_mark = [65279].pack('U') end @@ -497,28 +496,27 @@ class MultibyteCharsExtrasTest < Test::Unit::TestCase end def test_limit_should_not_break_on_blank_strings - chars = ''.mb_chars - - assert_equal '', chars.limit(0) - assert_equal '', chars.limit(1) + example = chars('') + assert_equal example, example.limit(0) + assert_equal example, example.limit(1) end def test_limit_should_work_on_a_multibyte_string - chars = UNICODE_STRING.mb_chars + example = chars(UNICODE_STRING) + bytesize = UNICODE_STRING.respond_to?(:bytesize) ? UNICODE_STRING.bytesize : UNICODE_STRING.size - assert_equal UNICODE_STRING, chars.limit(UNICODE_STRING.length) - assert_equal '', chars.limit(0) - assert_equal '', chars.limit(1) - assert_equal 'こ', chars.limit(3) - assert_equal 'こに', chars.limit(6) - assert_equal 'こに', chars.limit(8) - assert_equal 'こにち', chars.limit(9) - assert_equal 'こにちわ', chars.limit(50) + assert_equal UNICODE_STRING, example.limit(bytesize) + assert_equal '', example.limit(0) + assert_equal '', example.limit(1) + assert_equal 'こ', example.limit(3) + assert_equal 'こに', example.limit(6) + assert_equal 'こに', example.limit(8) + assert_equal 'こにち', example.limit(9) + assert_equal 'こにちわ', example.limit(50) end def test_limit_should_work_on_an_ascii_string - ascii = ASCII_STRING.mb_chars - + ascii = chars(ASCII_STRING) assert_equal ASCII_STRING, ascii.limit(ASCII_STRING.length) assert_equal '', ascii.limit(0) assert_equal 'o', ascii.limit(1) @@ -528,12 +526,12 @@ class MultibyteCharsExtrasTest < Test::Unit::TestCase end def test_limit_should_keep_under_the_specified_byte_limit - chars = UNICODE_STRING.mb_chars + example = chars(UNICODE_STRING) (1..UNICODE_STRING.length).each do |limit| - assert chars.limit(limit).to_s.length <= limit + assert example.limit(limit).to_s.length <= limit end end - + def test_composition_exclusion_is_set_up_properly # Normalization of DEVANAGARI LETTER QA breaks when composition exclusion isn't used correctly qa = [0x915, 0x93c].pack('U*') @@ -647,9 +645,9 @@ end class MultibyteInternalsTest < ActiveSupport::TestCase include MultibyteTestHelpers - + test "Chars translates a character offset to a byte offset" do - chars = "Puisque c'était son erreur, il m'a aidé".mb_chars + example = chars("Puisque c'était son erreur, il m'a aidé") [ [0, 0], [3, 3], @@ -657,7 +655,7 @@ class MultibyteInternalsTest < ActiveSupport::TestCase [14, 13], [41, 39] ].each do |byte_offset, character_offset| - assert_equal character_offset, chars.send(:translate_offset, byte_offset), + assert_equal character_offset, example.send(:translate_offset, byte_offset), "Expected byte offset #{byte_offset} to translate to #{character_offset}" end end -- cgit v1.2.3 From 0e64eab6a27bebdaaffa1ec10bbbd80bd8d73cb9 Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Mon, 2 Nov 2009 22:10:02 +0100 Subject: Autoload Multibyte features. --- activesupport/lib/active_support/multibyte.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/multibyte.rb b/activesupport/lib/active_support/multibyte.rb index 6f2016a409..7e6f7d754b 100644 --- a/activesupport/lib/active_support/multibyte.rb +++ b/activesupport/lib/active_support/multibyte.rb @@ -4,6 +4,12 @@ require 'active_support/core_ext/module/attribute_accessors' module ActiveSupport #:nodoc: module Multibyte + autoload :EncodingError, 'active_support/multibyte/exceptions' + autoload :Chars, 'active_support/multibyte/chars' + autoload :UnicodeDatabase, 'active_support/multibyte/unicode_database' + autoload :Codepoint, 'active_support/multibyte/unicode_database' + autoload :UCD, 'active_support/multibyte/unicode_database' + # A list of all available normalization forms. See http://www.unicode.org/reports/tr15/tr15-29.html for more # information about normalization. NORMALIZATION_FORMS = [:c, :kc, :d, :kd] @@ -53,7 +59,4 @@ module ActiveSupport #:nodoc: end end -require 'active_support/multibyte/chars' -require 'active_support/multibyte/exceptions' -require 'active_support/multibyte/unicode_database' -require 'active_support/multibyte/utils' +require 'active_support/multibyte/utils' \ No newline at end of file -- cgit v1.2.3 From d64e87edd6d6362a18837f438123f9cd56b91f43 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 11:50:41 -0800 Subject: Try to remotely troubleshoot bundler issue in CI --- ci/ci_build.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index a6f8871f27..e5c632bd01 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -6,7 +6,7 @@ include FileUtils puts "[CruiseControl] Rails build" build_results = {} -root_dir = File.expand_path(File.dirname(__FILE__) + "/..") +root_dir = File.expand_path('../..', __FILE__) # Requires gem home and path to be writeable and/or overridden to be ~/.gem, # Will enable when RubyGems supports this properly (in a coming release) @@ -20,7 +20,7 @@ cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" puts - build_results[:bundle] = system 'rm -rf vendor && gem bundle' + build_results[:bundle] = system 'rm -rf vendor && gem --debug bundle' end cd "#{root_dir}/activesupport" do -- cgit v1.2.3 From 03dc66444e7c99701c0814f20ebcea64b1cc43ae Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 11:57:21 -0800 Subject: Add bundler 0.6.0 to CI geminstaller --- ci/geminstaller.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/geminstaller.yml b/ci/geminstaller.yml index 70729ea34a..a38221884b 100644 --- a/ci/geminstaller.yml +++ b/ci/geminstaller.yml @@ -27,3 +27,5 @@ gems: version: >= 1.2.2 - name: rubygems-update version: >= 1.3.3 +- name: bundler + version: >= 0.6.0 -- cgit v1.2.3 From 726a2fc8d26da0ab95d50ee57679d73bc762ba4d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 12:44:06 -0800 Subject: Give useful test:isolated failures --- actionpack/test/ts_isolated.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/test/ts_isolated.rb b/actionpack/test/ts_isolated.rb index 21d62f6aa7..5670d93613 100644 --- a/actionpack/test/ts_isolated.rb +++ b/actionpack/test/ts_isolated.rb @@ -10,8 +10,8 @@ class TestIsolated < Test::Unit::TestCase Dir["#{File.dirname(__FILE__)}/{abstract,controller,dispatch,template}/**/*_test.rb"].each do |file| define_method("test #{file}") do command = "#{ruby} -Ilib:test #{file}" - silence_stderr { `#{command}` } - assert_equal 0, $?.to_i, command + result = silence_stderr { `#{command}` } + assert_block("#{command}\n#{result}") { $?.to_i.zero? } end end end -- cgit v1.2.3 From d2d3464fcc8c230cc206cdb4d47f24c47ae6699d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 14:49:15 -0800 Subject: Turn off --debug for gem bundle. Force gem update. --- ci/ci_build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index e5c632bd01..0ee952c00b 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -20,7 +20,7 @@ cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" puts - build_results[:bundle] = system 'rm -rf vendor && gem --debug bundle' + build_results[:bundle] = system 'rm -rf vendor && gem bundle --update' end cd "#{root_dir}/activesupport" do -- cgit v1.2.3 From 52e2bbd5c004f22b2affeec0fc03f1f9ca8c2a24 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 14:49:29 -0800 Subject: Ruby 1.9: work around constant resolution behavior change :( --- actionpack/test/abstract/helper_test.rb | 2 +- actionpack/test/dispatch/routing_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb index 6c28f01fa4..efcd68e5c8 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -40,7 +40,7 @@ module AbstractController class AbstractHelpersBlock < ControllerWithHelpers helper do - include HelperyTest + include ::AbstractController::Testing::HelperyTest end end diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 7917c1974b..ca07bc7a28 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -37,7 +37,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest get 'admin', :to => "queenbee#index" end - constraints IpRestrictor do + constraints ::TestRoutingMapper::IpRestrictor do get 'admin/accounts', :to => "queenbee#accounts" end @@ -80,7 +80,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end - match 'sprockets.js', :to => SprocketsApp + match 'sprockets.js', :to => ::TestRoutingMapper::SprocketsApp match 'people/:id/update', :to => 'people#update', :as => :update_person match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person -- cgit v1.2.3 From 0ff8f81adcf1e025a34d4a50ea1db39384a00e0b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 15:00:19 -0800 Subject: Ruby 1.9: more constant lookup badness :( --- actionpack/test/controller/integration_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index d6e2a5a974..624b14e69b 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -390,7 +390,7 @@ class IntegrationProcessTest < ActionController::IntegrationTest def with_test_route_set with_routing do |set| set.draw do |map| - match ':action', :to => IntegrationController + match ':action', :to => ::IntegrationProcessTest::IntegrationController end yield end -- cgit v1.2.3 From 425a02cecea188f502ad8f137271d1b90b9c7558 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 15:25:15 -0800 Subject: Ruby 1.9: resolve constant lookup issues --- actionpack/test/controller/helper_test.rb | 12 ++++++------ actionpack/test/controller/render_test.rb | 2 +- actionpack/test/controller/rescue_test.rb | 6 +++--- actionpack/test/controller/verification_test.rb | 2 +- actionpack/test/dispatch/request/json_params_parsing_test.rb | 2 +- .../test/dispatch/request/query_string_parsing_test.rb | 4 ++-- .../test/dispatch/request/url_encoded_params_parsing_test.rb | 2 +- actionpack/test/dispatch/request/xml_params_parsing_test.rb | 4 ++-- actionpack/test/dispatch/session/cookie_store_test.rb | 2 +- actionpack/test/dispatch/session/mem_cache_store_test.rb | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 12539739aa..b9be163904 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -3,12 +3,6 @@ require 'active_support/core_ext/kernel/reporting' ActionController::Base.helpers_dir = File.dirname(__FILE__) + '/../fixtures/helpers' -class TestController < ActionController::Base - attr_accessor :delegate_attr - def delegate_method() end - def rescue_action(e) raise end -end - module Fun class GamesController < ActionController::Base def render_hello_world @@ -38,6 +32,12 @@ module LocalAbcHelper end class HelperTest < Test::Unit::TestCase + class TestController < ActionController::Base + attr_accessor :delegate_attr + def delegate_method() end + def rescue_action(e) raise end + end + def setup # Increment symbol counter. @symbol = (@@counter ||= 'A0').succ!.dup diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index ac8dad7c42..b32325fa20 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -860,7 +860,7 @@ class RenderTest < ActionController::TestCase # :ported: def test_access_to_controller_name_in_view get :accessing_controller_name_in_template - assert_equal "test", @response.body # name is explicitly set to 'test' inside the controller. + assert_equal "test", @response.body # name is explicitly set in the controller. end # :ported: diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb index 2b1f532b8d..37367eaafc 100644 --- a/actionpack/test/controller/rescue_test.rb +++ b/actionpack/test/controller/rescue_test.rb @@ -343,9 +343,9 @@ class RescueTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - match 'foo', :to => TestController.action(:foo) - match 'invalid', :to => TestController.action(:invalid) - match 'b00m', :to => TestController.action(:b00m) + match 'foo', :to => ::RescueTest::TestController.action(:foo) + match 'invalid', :to => ::RescueTest::TestController.action(:invalid) + match 'b00m', :to => ::RescueTest::TestController.action(:b00m) end yield end diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb index 63e8cf3e61..11d0d10897 100644 --- a/actionpack/test/controller/verification_test.rb +++ b/actionpack/test/controller/verification_test.rb @@ -126,7 +126,7 @@ class VerificationTest < ActionController::TestCase with_routing do |set| set.draw do |map| match 'foo', :to => 'test#foo', :as => :foo - match 'verification_test/:action', :to => TestController + match 'verification_test/:action', :to => ::VerificationTest::TestController end get :guarded_one_for_named_route_test, :two => "not one" assert_redirected_to '/foo' diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index 3c2408de5f..d3308f73cc 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -57,7 +57,7 @@ class JsonParamsParsingTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - match ':action', :to => TestController + match ':action', :to => ::JsonParamsParsingTest::TestController end yield end diff --git a/actionpack/test/dispatch/request/query_string_parsing_test.rb b/actionpack/test/dispatch/request/query_string_parsing_test.rb index b764478d87..071d80c5b0 100644 --- a/actionpack/test/dispatch/request/query_string_parsing_test.rb +++ b/actionpack/test/dispatch/request/query_string_parsing_test.rb @@ -109,12 +109,12 @@ class QueryStringParsingTest < ActionController::IntegrationTest def assert_parses(expected, actual) with_routing do |set| set.draw do |map| - match ':action', :to => TestController + match ':action', :to => ::QueryStringParsingTest::TestController end get "/parse", actual assert_response :ok - assert_equal(expected, TestController.last_query_parameters) + assert_equal(expected, ::QueryStringParsingTest::TestController.last_query_parameters) end end end diff --git a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb index e98a49980e..69dbd7f528 100644 --- a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb @@ -130,7 +130,7 @@ class UrlEncodedParamsParsingTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - match ':action', :to => TestController + match ':action', :to => ::UrlEncodedParamsParsingTest::TestController end yield end diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb index 0dc47ed9d5..96189e4ca2 100644 --- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb @@ -84,7 +84,7 @@ class XmlParamsParsingTest < ActionController::IntegrationTest def with_test_routing with_routing do |set| set.draw do |map| - match ':action', :to => TestController + match ':action', :to => ::XmlParamsParsingTest::TestController end yield end @@ -100,4 +100,4 @@ class LegacyXmlParamsParsingTest < XmlParamsParsingTest def default_headers {'HTTP_X_POST_DATA_FORMAT' => 'xml'} end -end \ No newline at end of file +end diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index edfc303d3d..ab7b9bc31b 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -219,7 +219,7 @@ class CookieStoreTest < ActionController::IntegrationTest def with_test_route_set(options = {}) with_routing do |set| set.draw do |map| - match ':action', :to => TestController + match ':action', :to => ::CookieStoreTest::TestController end options = {:key => SessionKey, :secret => SessionSecret}.merge(options) @app = ActionDispatch::Session::CookieStore.new(set, options) diff --git a/actionpack/test/dispatch/session/mem_cache_store_test.rb b/actionpack/test/dispatch/session/mem_cache_store_test.rb index afc9d91d50..5a1dcb4dab 100644 --- a/actionpack/test/dispatch/session/mem_cache_store_test.rb +++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb @@ -112,7 +112,7 @@ class MemCacheStoreTest < ActionController::IntegrationTest def with_test_route_set with_routing do |set| set.draw do |map| - match ':action', :to => TestController + match ':action', :to => ::MemCacheStoreTest::TestController end @app = ActionDispatch::Session::MemCacheStore.new(set, :key => '_session_id') yield -- cgit v1.2.3 From dc1816da30eace9f292bfc57e21fe76a05ae8ea7 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 16:10:24 -0800 Subject: Ruby 1.9: fix number precision test --- actionpack/test/template/number_helper_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb index 85a97d570c..0a2b82bd89 100644 --- a/actionpack/test/template/number_helper_test.rb +++ b/actionpack/test/template/number_helper_test.rb @@ -88,7 +88,7 @@ class NumberHelperTest < ActionView::TestCase assert_equal("111.00", number_with_precision(111, :precision => 2)) assert_equal("111.235", number_with_precision("111.2346")) assert_equal("31.83", number_with_precision("31.825", :precision => 2)) - assert_equal("3268", number_with_precision((32.675 * 100.00), :precision => 0)) + assert_equal("3268", number_with_precision((32.6751 * 100.00), :precision => 0)) assert_equal("112", number_with_precision(111.50, :precision => 0)) assert_equal("1234567892", number_with_precision(1234567891.50, :precision => 0)) -- cgit v1.2.3 From a8ed10546d844fc15d87f5c8f168a18d0cdab5f0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Nov 2009 16:11:59 -0800 Subject: Ruby 1.9: don't assume params are US-ASCII. Hands off the encoding. --- actionpack/lib/action_dispatch/routing/route_set.rb | 7 ++++++- actionpack/test/controller/routing_test.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 93617e826d..28e5b806da 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -20,7 +20,12 @@ module ActionDispatch params = env[PARAMETERS_KEY] merge_default_action!(params) split_glob_param!(params) if @glob_param - params.each { |key, value| params[key] = URI.unescape(value) if value.is_a?(String) } + params.each do |key, value| + if value.is_a?(String) + value = value.dup.force_encoding(Encoding::BINARY) if value.respond_to?(:force_encoding) + params[key] = URI.unescape(value) + end + end if env['action_controller.recognize'] [200, {}, params] diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 308e2a85b1..bb0b9247f3 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -450,6 +450,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase assert_equal({:controller => "content", :action => 'show_page', :id => 'foo'}, rs.recognize_path("/page/foo")) token = "\321\202\320\265\320\272\321\201\321\202" # 'text' in russian + token.force_encoding(Encoding::BINARY) if token.respond_to?(:force_encoding) escaped_token = CGI::escape(token) assert_equal '/page/' + escaped_token, rs.generate(:controller => 'content', :action => 'show_page', :id => token) -- cgit v1.2.3 From 6c59e5a558922b8f4084533071c3d93e151858ac Mon Sep 17 00:00:00 2001 From: Chris Hapgood Date: Wed, 4 Nov 2009 10:13:59 -0500 Subject: Fix OrderedHash#replace Signed-off-by: Michael Koziarski --- activesupport/lib/active_support/ordered_hash.rb | 7 +++++++ activesupport/test/ordered_hash_test.rb | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 4324e40cbb..b492648610 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -120,6 +120,13 @@ module ActiveSupport dup.merge!(other_hash) end + # When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not. + def replace(other) + super + @keys = other.keys + self + end + def inspect "#" end diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index 15bd57181f..1521279437 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -191,4 +191,11 @@ class OrderedHashTest < Test::Unit::TestCase assert_equal "odd number of arguments for Hash", $!.message end end + + def test_replace_updates_keys + @other_ordered_hash = ActiveSupport::OrderedHash[:black, '000000', :white, '000000'] + original = @ordered_hash.replace(@other_ordered_hash) + assert_same original, @ordered_hash + assert_equal @other_ordered_hash.keys, @ordered_hash.keys + end end -- cgit v1.2.3 From 897164ddb70ed6f51b026e5c91f2bf3f7aa46ba6 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Mon, 2 Nov 2009 17:19:03 -0800 Subject: Conceptually unify instance & global initializers --- railties/lib/rails/application.rb | 45 ++++++++++----- railties/lib/rails/initializable.rb | 111 ++++++++++++++++-------------------- railties/lib/rails/plugin.rb | 99 ++++++++++++++++---------------- railties/test/initializable_test.rb | 72 +++++++++++++++++++---- 4 files changed, 192 insertions(+), 135 deletions(-) diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 242aea1842..b43dcb0041 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -1,6 +1,6 @@ module Rails class Application - extend Initializable + include Initializable class << self # Stub out App initialize @@ -8,6 +8,10 @@ module Rails new end + def new + @instance ||= super + end + def config @config ||= Configuration.new end @@ -27,23 +31,36 @@ module Rails config.root end - def routes - ActionController::Routing::Routes + def call(env) + new.call(env) end + end - def middleware - config.middleware - end + def initialize + run_initializers + end - def call(env) - @app ||= middleware.build(routes) - @app.call(env) - end + def config + self.class.config + end - def new - run_initializers - self - end + alias configuration config + + def plugin_loader + self.class.plugin_loader + end + + def middleware + config.middleware + end + + def routes + ActionController::Routing::Routes + end + + def call(env) + @app ||= middleware.build(routes) + @app.call(env) end initializer :initialize_rails do diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index c491d5e012..93349454dd 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -1,93 +1,82 @@ module Rails module Initializable - def self.included(klass) - klass.instance_eval do - extend Rails::Initializable - extend Rails::Initializable::ClassMethodsWhenIncluded - include Rails::Initializable::InstanceMethodsWhenIncluded - end + def self.included(base) + base.extend ClassMethods end - def self.extended(klass) - klass.extend Initializer + Initializer = Struct.new(:name, :before, :after, :global, :block) do + alias global? global end class Collection < Array - def initialize(klasses) - klasses.each do |klass| - (klass.added_initializers || []).each do |initializer| - index = if initializer.before - index_for(initializer.before) - elsif initializer.after - index_for(initializer.after) + 1 - else - length - end - - insert(index, initializer) + def initialize(initializers = []) + super() + initializers.each do |initializer| + if initializer.before + index = index_for(initializer.before) + elsif initializer.after + index = index_for(initializer.after) + 1 + else + index = length end + insert(index || -1, initializer) end end - def index_for(name) - inst = find {|i| i.name == name } - inst && index(inst) + def +(other) + Collection.new(to_a + other.to_a) end + def index_for(name) + initializer = find { |i| i.name == name } + initializer && index(initializer) + end end - attr_reader :added_initializers - - # When you include Rails::Initializable, this method will be on instances - # of the class included into. When you extend it, it will be on the - # class or module itself. - # - # The #initializers method is set up to return the right list of - # initializers for the context in question. - def run_initializers - return if @_initialized - - initializers.each {|initializer| instance_eval(&initializer.block) } - - @_initialized = true + def run_initializers(*args) + return if @ran + self.class.initializers_for(:instance).each do |initializer| + instance_exec(*args, &initializer.block) + end + @ran = true end - module Initializer - Initializer = Struct.new(:name, :before, :after, :block, :global) - - def all_initializers - klasses = ancestors.select {|klass| klass.is_a?(Initializable) }.reverse - initializers = Collection.new(klasses) + module ClassMethods + def initializers + @initializers ||= [] end - alias initializers all_initializers - - def initializer(name, options = {}, &block) - @added_initializers ||= [] - @added_initializers << - Initializer.new(name, options[:before], options[:after], block, options[:global]) + def initializers_for(scope = :global) + initializers = Collection.new + ancestors.reverse_each do |klass| + next unless klass.respond_to?(:initializers) + initializers = initializers + klass.initializers.select { |i| + (scope == :global) == !!i.global? + } + end + initializers end - end - module ClassMethodsWhenIncluded - def initializers - all_initializers.select {|i| i.global == true } + def initializer(name, opts = {}, &blk) + @initializers ||= [] + @initializers << Initializer.new(name, opts[:before], opts[:after], opts[:global], blk) end - end - - module InstanceMethodsWhenIncluded - def initializers - self.class.all_initializers.reject {|i| i.global == true } + def run_initializers(*args) + return if @ran + initializers_for(:global).each do |initializer| + instance_exec(*args, &initializer.block) + end + @ran = true end end end - extend Initializable + include Initializable # Check for valid Ruby version (1.8.2 or 1.8.4 or higher). This is done in an # external file, so we can use it from the `rails` program as well without duplication. - initializer :check_ruby_version do + initializer :check_ruby_version, :global => true do require 'rails/ruby_version_check' end @@ -97,7 +86,7 @@ module Rails # on ActionController::Base. # # For Ruby 1.9, UTF-8 is the default internal and external encoding. - initializer :initialize_encoding do + initializer :initialize_encoding, :global => true do if RUBY_VERSION < '1.9' $KCODE='u' else diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 1c0af6411a..090ec6e4cb 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -18,6 +18,7 @@ module Rails # plugin.about["url"] # => "http://interblah.net" class Plugin include Comparable + include Initializable attr_reader :directory, :name @@ -99,67 +100,69 @@ module Rails def locale_files Dir[ File.join(locale_path, '*.{rb,yml}') ] end - - private - def load_about_information - about_yml_path = File.join(@directory, "about.yml") - parsed_yml = File.exist?(about_yml_path) ? YAML.load(File.read(about_yml_path)) : {} - parsed_yml || {} - rescue Exception - {} - end + private + def load_about_information + about_yml_path = File.join(@directory, "about.yml") + parsed_yml = File.exist?(about_yml_path) ? YAML.load(File.read(about_yml_path)) : {} + parsed_yml || {} + rescue Exception + {} + end - def report_nonexistant_or_empty_plugin! - raise LoadError, "Can not find the plugin named: #{name}" - end + def report_nonexistant_or_empty_plugin! + raise LoadError, "Can not find the plugin named: #{name}" + end - - def app_paths - [ File.join(directory, 'app', 'models'), File.join(directory, 'app', 'helpers'), controller_path, metal_path ] - end - - def lib_path - File.join(directory, 'lib') - end + def app_paths + [ File.join(directory, 'app', 'models'), File.join(directory, 'app', 'helpers'), controller_path, metal_path ] + end - def classic_init_path - File.join(directory, 'init.rb') - end + def lib_path + File.join(directory, 'lib') + end - def gem_init_path - File.join(directory, 'rails', 'init.rb') - end + def classic_init_path + File.join(directory, 'init.rb') + end - def init_path - File.file?(gem_init_path) ? gem_init_path : classic_init_path - end + def gem_init_path + File.join(directory, 'rails', 'init.rb') + end + def init_path + File.file?(gem_init_path) ? gem_init_path : classic_init_path + end - def has_app_directory? - File.directory?(File.join(directory, 'app')) - end + def has_app_directory? + File.directory?(File.join(directory, 'app')) + end - def has_lib_directory? - File.directory?(lib_path) - end + def has_lib_directory? + File.directory?(lib_path) + end - def has_init_file? - File.file?(init_path) - end + def has_init_file? + File.file?(init_path) + end + def evaluate_init_rb(initializer) + if has_init_file? + require 'active_support/core_ext/kernel/reporting' + silence_warnings do + # Allow plugins to reference the current configuration object + config = initializer.configuration - def evaluate_init_rb(initializer) - if has_init_file? - require 'active_support/core_ext/kernel/reporting' - silence_warnings do - # Allow plugins to reference the current configuration object - config = initializer.configuration - - eval(IO.read(init_path), binding, init_path) - end + eval(IO.read(init_path), binding, init_path) end - end + end + end + + class Vendored < Plugin + initializer :init_rb do |application| + evaluate_init_rb(application) + end + end end # This Plugin subclass represents a Gem plugin. Although RubyGems has already diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index f7237e69cc..463fdc03c0 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -4,59 +4,59 @@ require 'rails/initializable' module InitializableTests class Foo - extend Rails::Initializable + include Rails::Initializable class << self attr_accessor :foo, :bar end - initializer :omg do + initializer :omg, :global => true do @foo ||= 0 @foo += 1 end end class Bar < Foo - initializer :bar do + initializer :bar, :global => true do @bar ||= 0 @bar += 1 end end module Word - extend Rails::Initializable + include Rails::Initializable - initializer :word do + initializer :word, :global => true do $word = "bird" end end class Parent - extend Rails::Initializable + include Rails::Initializable - initializer :one do + initializer :one, :global => true do $arr << 1 end - initializer :two do + initializer :two, :global => true do $arr << 2 end end class Child < Parent - extend Rails::Initializable + include Rails::Initializable - initializer :three, :before => :one do + initializer :three, :before => :one, :global => true do $arr << 3 end - initializer :four, :after => :one do + initializer :four, :after => :one, :global => true do $arr << 4 end end class Parent - initializer :five, :before => :one do + initializer :five, :before => :one, :global => true do $arr << 5 end end @@ -81,6 +81,38 @@ module InitializableTests end end + class WithArgs + include Rails::Initializable + + initializer :foo do |arg| + $with_arg = arg + end + end + + class OverriddenInitializer + class MoreInitializers + include Rails::Initializable + + initializer :startup, :before => :last do + $arr << 2 + end + end + + include Rails::Initializable + + initializer :first do + $arr << 1 + end + + initializer :last do + $arr << 3 + end + + def self.initializers + super + MoreInitializers.initializers + end + end + class Basic < ActiveSupport::TestCase include ActiveSupport::Testing::Isolation @@ -140,4 +172,20 @@ module InitializableTests assert_equal [3, 4], $arr end end + + class WithArgsTest < ActiveSupport::TestCase + test "running initializers with args" do + $with_arg = nil + WithArgs.new.run_initializers('foo') + assert_equal 'foo', $with_arg + end + end + + class OverriddenInitializerTest < ActiveSupport::TestCase + test "merges in the initializers from the parent in the right order" do + $arr = [] + OverriddenInitializer.new.run_initializers + assert_equal [1, 2, 3], $arr + end + end end \ No newline at end of file -- cgit v1.2.3 From 43694269934540de2a73130d7ff47bd1a25ed3e4 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 5 Nov 2009 14:45:53 -0800 Subject: Add the ability to merge initializers from various objects in order. --- railties/lib/rails/initializable.rb | 42 +++++++++++++++++++++++++++++++++---- railties/test/initializable_test.rb | 8 +++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index 93349454dd..d78eab9a75 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -4,8 +4,35 @@ module Rails base.extend ClassMethods end - Initializer = Struct.new(:name, :before, :after, :global, :block) do + class Initializer + attr_reader :name, :before, :after, :global, :block + + def initialize(name, context, options, &block) + @name, @context, @options, @block = name, context, options, block + end + + def before + @options[:before] + end + + def after + @options[:after] + end + + def global + @options[:global] + end + alias global? global + + def run(*args) + @context.instance_exec(*args, &block) + end + + def bind(context) + return self if @context + Initializer.new(@name, context, @options, &block) + end end class Collection < Array @@ -35,12 +62,19 @@ module Rails def run_initializers(*args) return if @ran - self.class.initializers_for(:instance).each do |initializer| - instance_exec(*args, &initializer.block) + initializers.each do |initializer| + initializer.run(*args) end @ran = true end + def initializers + @initializers ||= begin + initializers = self.class.initializers_for(:instance) + Collection.new(initializers.map { |i| i.bind(self) }) + end + end + module ClassMethods def initializers @initializers ||= [] @@ -59,7 +93,7 @@ module Rails def initializer(name, opts = {}, &blk) @initializers ||= [] - @initializers << Initializer.new(name, opts[:before], opts[:after], opts[:global], blk) + @initializers << Initializer.new(name, nil, opts, &blk) end def run_initializers(*args) diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index 463fdc03c0..2920883132 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -94,7 +94,11 @@ module InitializableTests include Rails::Initializable initializer :startup, :before => :last do - $arr << 2 + $arr << two + end + + def two + 2 end end @@ -109,7 +113,7 @@ module InitializableTests end def self.initializers - super + MoreInitializers.initializers + super + MoreInitializers.new.initializers end end -- cgit v1.2.3 From b0dfd1d19b83f1812317345a68c6bc1ad590be53 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 5 Nov 2009 15:37:01 -0800 Subject: Update Ruby version check to 1.8.7 --- railties/lib/rails/ruby_version_check.rb | 11 ++------- .../test/initializer/check_ruby_version_test.rb | 28 ++++++++++++++-------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/railties/lib/rails/ruby_version_check.rb b/railties/lib/rails/ruby_version_check.rb index 68d3acc876..62d7804bf3 100644 --- a/railties/lib/rails/ruby_version_check.rb +++ b/railties/lib/rails/ruby_version_check.rb @@ -1,13 +1,6 @@ -min_release = "1.8.2 (2004-12-25)" +min_release = "1.8.7" ruby_release = "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE})" -if ruby_release =~ /1\.8\.3/ - abort <<-end_message - - Rails does not work with Ruby version 1.8.3. - Please upgrade to version 1.8.4 or downgrade to 1.8.2. - - end_message -elsif ruby_release < min_release +if ruby_release < min_release abort <<-end_message Rails requires Ruby version #{min_release} or later. diff --git a/railties/test/initializer/check_ruby_version_test.rb b/railties/test/initializer/check_ruby_version_test.rb index cf956e68fb..97d884e1be 100644 --- a/railties/test/initializer/check_ruby_version_test.rb +++ b/railties/test/initializer/check_ruby_version_test.rb @@ -14,24 +14,32 @@ module InitializerTests assert_rails_does_not_boot "1.8.1" end - test "rails initializes with ruby version 1.8.2" do - assert_rails_boots "1.8.2" + test "rails does not initialize with ruby version 1.8.2" do + assert_rails_does_not_boot "1.8.2" end test "rails does not initialize with ruby version 1.8.3" do assert_rails_does_not_boot "1.8.3" end - test "rails initializes with ruby version 1.8.4" do - assert_rails_boots "1.8.4" + test "rails does not initialize with ruby version 1.8.4" do + assert_rails_does_not_boot "1.8.4" end - test "rails initializes with ruby version 1.8.5" do - assert_rails_boots "1.8.5" + test "rails does not initializes with ruby version 1.8.5" do + assert_rails_does_not_boot "1.8.5" end - test "rails initializes with ruby version 1.8.6" do - assert_rails_boots "1.8.6" + test "rails does not initialize with ruby version 1.8.6" do + assert_rails_does_not_boot "1.8.6" + end + + test "rails initializes with ruby version 1.8.7" do + assert_rails_boots "1.8.7" + end + + test "rails initializes with the current version of Ruby" do + assert_rails_boots end def set_ruby_version(version) @@ -39,8 +47,8 @@ module InitializerTests Object.const_set(:RUBY_VERSION, version.freeze) end - def assert_rails_boots(version) - set_ruby_version(version) + def assert_rails_boots(version = nil) + set_ruby_version(version) if version assert_nothing_raised "It appears that rails does not boot" do Rails::Initializer.run { |c| c.frameworks = [] } Rails.initialize! -- cgit v1.2.3 From b12f194c396b5d279986dd16a3b2caa360e64d19 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 5 Nov 2009 15:38:04 -0800 Subject: Update AC::Middleware to play better with the normal AC::Metal stack. This required stopping to use #call for non-rack-related stuff --- actionpack/lib/action_controller/metal.rb | 6 ++-- .../action_controller/metal/rack_convenience.rb | 2 +- actionpack/lib/action_controller/middleware.rb | 40 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 6f89bf5d67..60b3f9a89b 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -49,7 +49,7 @@ module ActionController # and response object available. You might wish to control the # environment and response manually for performance reasons. - attr_internal :status, :headers, :content_type, :app, :response + attr_internal :status, :headers, :content_type, :response def initialize(*) @_headers = {} @@ -69,7 +69,7 @@ module ActionController end # :api: private - def call(name, env) + def dispatch(name, env) @_env = env process(name) to_a @@ -95,7 +95,7 @@ module ActionController end def call(env) - controller = @controller.new.call(@action, env) + @controller.new.dispatch(@action, env) end end diff --git a/actionpack/lib/action_controller/metal/rack_convenience.rb b/actionpack/lib/action_controller/metal/rack_convenience.rb index a80569c530..131d20114d 100644 --- a/actionpack/lib/action_controller/metal/rack_convenience.rb +++ b/actionpack/lib/action_controller/metal/rack_convenience.rb @@ -8,7 +8,7 @@ module ActionController attr_internal :request end - def call(name, env) + def dispatch(action, env) @_request = ActionDispatch::Request.new(env) @_response = ActionDispatch::Response.new @_response.request = request diff --git a/actionpack/lib/action_controller/middleware.rb b/actionpack/lib/action_controller/middleware.rb index fac0ed2645..17275793b7 100644 --- a/actionpack/lib/action_controller/middleware.rb +++ b/actionpack/lib/action_controller/middleware.rb @@ -1,34 +1,34 @@ module ActionController class Middleware < Metal class ActionMiddleware - def initialize(controller) - @controller = controller + def initialize(controller, app) + @controller, @app = controller, app end def call(env) - controller = @controller.allocate - controller.send(:initialize) - controller.app = @app - controller._call(env) + @controller.build(@app).dispatch(:index, env) end + end + + class << self + alias build new - def app=(app) - @app = app + def new(app) + ActionMiddleware.new(self, app) end end - - def self.new(app) - middleware = ActionMiddleware.new(self) - middleware.app = app - middleware + + attr_internal :app + + def process(action) + response = super + self.status, self.headers, self.response_body = response if response.is_a?(Array) + response end - - def _call(env) - @_env = env - @_request = ActionDispatch::Request.new(env) - @_response = ActionDispatch::Response.new - @_response.request = @_request - process(:index) + + def initialize(app) + super() + @_app = app end def index -- cgit v1.2.3 From 73a36b599ae21d444d3b1f4114306a80b37ec8d4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 5 Nov 2009 16:04:05 -0800 Subject: Shush --- actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb index ab1a828471..0ddc525213 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb @@ -43,6 +43,7 @@ module Racc class Parser + old_verbose, $VERBOSE = $VERBOSE, nil Racc_Runtime_Version = '1.4.5' Racc_Runtime_Revision = '$Revision: 1.7 $'.split[1] @@ -71,6 +72,7 @@ module Racc Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R Racc_Runtime_Type = 'ruby' end + $VERBOSE = old_verbose def Parser.racc_runtime_type Racc_Runtime_Type -- cgit v1.2.3 From 60911c39336fea92536f78a4deb6b52535b613cd Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 5 Nov 2009 16:04:43 -0800 Subject: Ruby 1.9: Rack apps must *always* take an env arg on 1.9 --- railties/test/metal_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/test/metal_test.rb b/railties/test/metal_test.rb index 6864254e4c..2256b191e2 100644 --- a/railties/test/metal_test.rb +++ b/railties/test/metal_test.rb @@ -85,7 +85,7 @@ class MetalTest < Test::Unit::TestCase private def app - lambda{[402,{},["End of the Line"]]} + lambda{|env|[402,{},["End of the Line"]]} end def use_appdir(root) -- cgit v1.2.3 From 1c047be0fc06c74d4b5b9e1682c79749f47109f5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 5 Nov 2009 16:11:08 -0800 Subject: If class doesn't have a name, there's no implied layout name, so don't set up a _layout method --- actionpack/lib/abstract_controller/layouts.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 8293e79b0a..1616f8030a 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -89,7 +89,7 @@ module AbstractController # ==== Returns # String:: A template name def _implied_layout_name - name.underscore + name && name.underscore end # Takes the specified layout and creates a _layout method to be called @@ -119,17 +119,19 @@ module AbstractController when true raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil" when nil - self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def _layout(details) - self.class.cache_layout(details) do - if template_exists?("#{_implied_layout_name}", details, :_prefix => "layouts") - "#{_implied_layout_name}" - else - super + if name + self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 + def _layout(details) + self.class.cache_layout(details) do + if template_exists?("#{_implied_layout_name}", details, :_prefix => "layouts") + "#{_implied_layout_name}" + else + super + end end end - end - RUBY + RUBY + end end self.class_eval { private :_layout } end -- cgit v1.2.3 From cb9a1759c0b8ad104b8e591b952bc440f9e06dc0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 5 Nov 2009 16:11:52 -0800 Subject: Fix generators tests that expect a class name --- railties/lib/rails/generators/base.rb | 17 ++++++++++------- railties/test/generators_test.rb | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index e6baf2fc79..af1bf26f4a 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -211,9 +211,8 @@ module Rails # def self.inherited(base) #:nodoc: super - base.source_root # Cache source root - if Rails.root && base.name !~ /Base$/ + if base.name && base.name !~ /Base$/ && defined?(Rails.root) && Rails.root path = File.expand_path(File.join(Rails.root, 'lib', 'templates')) if base.name.include?('::') base.source_paths << File.join(path, base.base_name, base.generator_name) @@ -273,17 +272,21 @@ module Rails # Sets the base_name taking into account the current class namespace. # def self.base_name - @base_name ||= self.name.split('::').first.underscore + if name + @base_name ||= name.split('::').first.underscore + end end # Removes the namespaces and get the generator name. For example, # Rails::Generators::MetalGenerator will return "metal" as generator name. # def self.generator_name - @generator_name ||= begin - klass_name = self.name.split('::').last - klass_name.sub!(/Generator$/, '') - klass_name.underscore + if name + @generator_name ||= begin + klass_name = name.to_s.split('::').last + klass_name.sub!(/Generator$/, '') + klass_name.underscore + end end end diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 07f51eca01..9c9a4e6016 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__), 'generators', 'generators_test_helper') +require 'generators/generators_test_helper' require 'rails/generators/rails/model/model_generator' require 'rails/generators/test_unit/model/model_generator' require 'mocha' -- cgit v1.2.3 From cbded53671bccccbaf7e9fdfa93ef86cb097daa3 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 5 Nov 2009 20:07:14 -0800 Subject: When rendering layouts with blocks, use #capture to avoid assuming that the return value is the block's content. Signed-off-by: Yehuda Katz --- actionpack/lib/action_view/render/rendering.rb | 6 ++---- actionpack/test/fixtures/layouts/block_with_layout.erb | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index fc89726670..7006a5b968 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -71,12 +71,10 @@ module ActionView # In this case, the layout would receive the block passed into render :layout, # and the Struct specified in the layout would be passed into the block. The result # would be Hello David. - def _layout_for(name = nil) + def _layout_for(name = nil, &block) return @_content_for[name || :layout] if !block_given? || name - with_output_buffer do - return yield - end + capture(&block) end def _render_inline(inline, layout, options) diff --git a/actionpack/test/fixtures/layouts/block_with_layout.erb b/actionpack/test/fixtures/layouts/block_with_layout.erb index 6a8b41914b..f25b41271d 100644 --- a/actionpack/test/fixtures/layouts/block_with_layout.erb +++ b/actionpack/test/fixtures/layouts/block_with_layout.erb @@ -1,3 +1,3 @@ -<% render(:layout => "layout_for_partial", :locals => { :name => "Anthony" }) do %>Inside from first block in layout<% end %> +<% render(:layout => "layout_for_partial", :locals => { :name => "Anthony" }) do %>Inside from first block in layout<% "Return value should be discarded" %><% end %> <%= yield %> <% render(:layout => "layout_for_partial", :locals => { :name => "Ramm" }) do %>Inside from second block in layout<% end %> -- cgit v1.2.3 From b43964d6061f4a31320906172f763dd3dd188f4d Mon Sep 17 00:00:00 2001 From: Chris Hapgood Date: Fri, 6 Nov 2009 16:25:11 -0500 Subject: Make some assertions in the ActionView::TestCase tests actually do something. [#3468 state:resolved] Signed-off-by: Eloy Duran --- actionpack/test/template/test_case_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index ca72c13ffa..37dcb86d80 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -24,7 +24,7 @@ module ActionView test_case.class_eval do test "helpers defined on ActionView::TestCase are available" do assert test_case.ancestors.include?(ASharedTestHelper) - assert 'Holla!', from_shared_helper + assert_equal 'Holla!', from_shared_helper end end end @@ -41,7 +41,7 @@ module ActionView helper AnotherTestHelper test "additional helper classes can be specified as in a controller" do assert test_case.ancestors.include?(AnotherTestHelper) - assert 'Howdy!', from_another_helper + assert_equal 'Howdy!', from_another_helper end end @@ -58,14 +58,14 @@ module ActionView helper AnotherTestHelper test "additional helper classes can be specified as in a controller" do assert test_case.ancestors.include?(AnotherTestHelper) - assert 'Howdy!', from_another_helper + assert_equal 'Howdy!', from_another_helper test_case.helper_class.module_eval do def render_from_helper from_another_helper end end - assert 'Howdy!', render(:partial => 'test/from_helper') + assert_equal 'Howdy!', render(:partial => 'test/from_helper') end end -- cgit v1.2.3 From c2cfb201984f8dff2b3534163b6145fe2560eb80 Mon Sep 17 00:00:00 2001 From: Chris Hapgood Date: Fri, 6 Nov 2009 17:02:55 -0500 Subject: Share ActionView::TestCase's output_buffer with view for concat support. [#3467 state:resolved] Signed-off-by: Eloy Duran --- actionpack/lib/action_view/test_case.rb | 1 + actionpack/test/template/test_case_test.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index 8beda24aba..86bbad822d 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -120,6 +120,7 @@ module ActionView def _view view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller) view.class.send :include, _helpers + view.output_buffer = self.output_buffer view end diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index 37dcb86d80..05a409d05a 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -38,6 +38,11 @@ module ActionView assert_equal 'Eloy', render('developers/developer', :developer => stub(:name => 'Eloy')) end + test "can render a layout with block" do + assert_equal "Before (ChrisCruft)\n!\nAfter", + render(:layout => "test/layout_for_partial", :locals => {:name => "ChrisCruft"}) {"!"} + end + helper AnotherTestHelper test "additional helper classes can be specified as in a controller" do assert test_case.ancestors.include?(AnotherTestHelper) -- cgit v1.2.3 From f125a34501e21b1e0da2b80d149df7a739482804 Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Fri, 6 Nov 2009 23:53:33 +0100 Subject: Define autosave association callbacks when using accepts_nested_attributes_for. This way we don't define all the validation methods for all associations by default, but only when needed. [#3355 state:resolved] --- activerecord/lib/active_record/nested_attributes.rb | 2 ++ activerecord/test/models/pirate.rb | 2 +- activerecord/test/models/ship.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index edcf547e01..ca3110a374 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -250,6 +250,8 @@ module ActiveRecord assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes) end }, __FILE__, __LINE__ + + add_autosave_association_callbacks(reflection) else raise ArgumentError, "No association found for name `#{association_name}'. Has it been defined yet?" end diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index 05c5b666ae..f2c05dd48f 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -18,7 +18,7 @@ class Pirate < ActiveRecord::Base has_many :treasure_estimates, :through => :treasures, :source => :price_estimates # These both have :autosave enabled because accepts_nested_attributes_for is used on them. - has_one :ship, :validate => true + has_one :ship has_one :non_validated_ship, :class_name => 'Ship' has_many :birds has_many :birds_with_method_callbacks, :class_name => "Bird", diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb index d0df951622..06759d64b8 100644 --- a/activerecord/test/models/ship.rb +++ b/activerecord/test/models/ship.rb @@ -1,7 +1,7 @@ class Ship < ActiveRecord::Base self.record_timestamps = false - belongs_to :pirate, :validate => true + belongs_to :pirate has_many :parts, :class_name => 'ShipPart', :autosave => true accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? } -- cgit v1.2.3 From e1b5e3cc709df12d2d8495737e524f60015e6f5c Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sat, 7 Nov 2009 11:23:21 -0800 Subject: Break up inflector to reduce the dependency burden on dependency-les methods like constantize. --- actionpack/lib/action_dispatch/http/request.rb | 1 + actionpack/lib/action_dispatch/middleware/stack.rb | 6 +- .../lib/active_support/core_ext/string/access.rb | 2 + activesupport/lib/active_support/inflector.rb | 411 +-------------------- .../lib/active_support/inflector/inflections.rb | 213 +++++++++++ .../lib/active_support/inflector/methods.rb | 139 +++++++ .../lib/active_support/inflector/transliterate.rb | 61 +++ 7 files changed, 424 insertions(+), 409 deletions(-) create mode 100644 activesupport/lib/active_support/inflector/inflections.rb create mode 100644 activesupport/lib/active_support/inflector/methods.rb create mode 100644 activesupport/lib/active_support/inflector/transliterate.rb diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 75be2cc260..9314ff5c53 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -6,6 +6,7 @@ require 'active_support/memoizable' require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/object/tap' +require 'active_support/core_ext/string/access' module ActionDispatch class Request < Rack::Request diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index 4f71ea6165..3b27309f58 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -1,3 +1,5 @@ +require "active_support/inflector/methods" + module ActionDispatch class MiddlewareStack < Array class Middleware @@ -32,7 +34,7 @@ module ActionDispatch elsif @klass.respond_to?(:call) @klass.call else - @klass.to_s.constantize + ActiveSupport::Inflector.constantize(@klass.to_s) end end @@ -53,7 +55,7 @@ module ActionDispatch when Class klass == middleware else - klass == middleware.to_s.constantize + klass == ActiveSupport::Inflector.constantize(middleware.to_s) end end diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 57385d86d2..182b3e745d 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -1,3 +1,5 @@ +require "active_support/multibyte" + class String unless '1.9'.respond_to?(:force_encoding) # Returns the character at the +position+ treating the string as an array (where 0 is the first character). diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb index 67aea2782f..215a60eba7 100644 --- a/activesupport/lib/active_support/inflector.rb +++ b/activesupport/lib/active_support/inflector.rb @@ -1,410 +1,7 @@ -# encoding: utf-8 -require 'iconv' -require 'active_support/core_ext/object/blank' -require 'active_support/core_ext/string/access' -require 'active_support/core_ext/string/multibyte' - -module ActiveSupport - # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without, - # and class names to foreign keys. The default inflections for pluralization, singularization, and uncountable words are kept - # in inflections.rb. - # - # The Rails core team has stated patches for the inflections library will not be accepted - # in order to avoid breaking legacy applications which may be relying on errant inflections. - # If you discover an incorrect inflection and require it for your application, you'll need - # to correct it yourself (explained below). - module Inflector - extend self - - # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional - # inflection rules. Examples: - # - # ActiveSupport::Inflector.inflections do |inflect| - # inflect.plural /^(ox)$/i, '\1\2en' - # inflect.singular /^(ox)en/i, '\1' - # - # inflect.irregular 'octopus', 'octopi' - # - # inflect.uncountable "equipment" - # end - # - # New rules are added at the top. So in the example above, the irregular rule for octopus will now be the first of the - # pluralization and singularization rules that is runs. This guarantees that your rules run before any of the rules that may - # already have been loaded. - class Inflections - def self.instance - @__instance__ ||= new - end - - attr_reader :plurals, :singulars, :uncountables, :humans - - def initialize - @plurals, @singulars, @uncountables, @humans = [], [], [], [] - end - - # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression. - # The replacement should always be a string that may include references to the matched data from the rule. - def plural(rule, replacement) - @uncountables.delete(rule) if rule.is_a?(String) - @uncountables.delete(replacement) - @plurals.insert(0, [rule, replacement]) - end - - # Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression. - # The replacement should always be a string that may include references to the matched data from the rule. - def singular(rule, replacement) - @uncountables.delete(rule) if rule.is_a?(String) - @uncountables.delete(replacement) - @singulars.insert(0, [rule, replacement]) - end - - # Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used - # for strings, not regular expressions. You simply pass the irregular in singular and plural form. - # - # Examples: - # irregular 'octopus', 'octopi' - # irregular 'person', 'people' - def irregular(singular, plural) - @uncountables.delete(singular) - @uncountables.delete(plural) - if singular[0,1].upcase == plural[0,1].upcase - plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1]) - plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + plural[1..-1]) - singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1]) - else - plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1]) - plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1]) - plural(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), plural[0,1].upcase + plural[1..-1]) - plural(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), plural[0,1].downcase + plural[1..-1]) - singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1]) - singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1]) - end - end - - # Add uncountable words that shouldn't be attempted inflected. - # - # Examples: - # uncountable "money" - # uncountable "money", "information" - # uncountable %w( money information rice ) - def uncountable(*words) - (@uncountables << words).flatten! - end - - # Specifies a humanized form of a string by a regular expression rule or by a string mapping. - # When using a regular expression based replacement, the normal humanize formatting is called after the replacement. - # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name') - # - # Examples: - # human /_cnt$/i, '\1_count' - # human "legacy_col_person_name", "Name" - def human(rule, replacement) - @humans.insert(0, [rule, replacement]) - end - - # Clears the loaded inflections within a given scope (default is :all). - # Give the scope as a symbol of the inflection type, the options are: :plurals, - # :singulars, :uncountables, :humans. - # - # Examples: - # clear :all - # clear :plurals - def clear(scope = :all) - case scope - when :all - @plurals, @singulars, @uncountables = [], [], [] - else - instance_variable_set "@#{scope}", [] - end - end - end - - # Yields a singleton instance of Inflector::Inflections so you can specify additional - # inflector rules. - # - # Example: - # ActiveSupport::Inflector.inflections do |inflect| - # inflect.uncountable "rails" - # end - def inflections - if block_given? - yield Inflections.instance - else - Inflections.instance - end - end - - # Returns the plural form of the word in the string. - # - # Examples: - # "post".pluralize # => "posts" - # "octopus".pluralize # => "octopi" - # "sheep".pluralize # => "sheep" - # "words".pluralize # => "words" - # "CamelOctopus".pluralize # => "CamelOctopi" - def pluralize(word) - result = word.to_s.dup - - if word.empty? || inflections.uncountables.include?(result.downcase) - result - else - inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } - result - end - end - - # The reverse of +pluralize+, returns the singular form of a word in a string. - # - # Examples: - # "posts".singularize # => "post" - # "octopi".singularize # => "octopus" - # "sheep".singularize # => "sheep" - # "word".singularize # => "word" - # "CamelOctopi".singularize # => "CamelOctopus" - def singularize(word) - result = word.to_s.dup - - if inflections.uncountables.include?(result.downcase) - result - else - inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } - result - end - end - - # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+ - # is set to :lower then +camelize+ produces lowerCamelCase. - # - # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces. - # - # Examples: - # "active_record".camelize # => "ActiveRecord" - # "active_record".camelize(:lower) # => "activeRecord" - # "active_record/errors".camelize # => "ActiveRecord::Errors" - # "active_record/errors".camelize(:lower) # => "activeRecord::Errors" - def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) - if first_letter_in_uppercase - lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } - else - lower_case_and_underscored_word.to_s.first.downcase + camelize(lower_case_and_underscored_word)[1..-1] - end - end - - # Capitalizes all the words and replaces some characters in the string to create - # a nicer looking title. +titleize+ is meant for creating pretty output. It is not - # used in the Rails internals. - # - # +titleize+ is also aliased as as +titlecase+. - # - # Examples: - # "man from the boondocks".titleize # => "Man From The Boondocks" - # "x-men: the last stand".titleize # => "X Men: The Last Stand" - def titleize(word) - humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize } - end - - # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string. - # - # Changes '::' to '/' to convert namespaces to paths. - # - # Examples: - # "ActiveRecord".underscore # => "active_record" - # "ActiveRecord::Errors".underscore # => active_record/errors - def underscore(camel_cased_word) - camel_cased_word.to_s.gsub(/::/, '/'). - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). - gsub(/([a-z\d])([A-Z])/,'\1_\2'). - tr("-", "_"). - downcase - end - - # Replaces underscores with dashes in the string. - # - # Example: - # "puni_puni" # => "puni-puni" - def dasherize(underscored_word) - underscored_word.gsub(/_/, '-') - end - - # Capitalizes the first word and turns underscores into spaces and strips a - # trailing "_id", if any. Like +titleize+, this is meant for creating pretty output. - # - # Examples: - # "employee_salary" # => "Employee salary" - # "author_id" # => "Author" - def humanize(lower_case_and_underscored_word) - result = lower_case_and_underscored_word.to_s.dup - - inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } - result.gsub(/_id$/, "").gsub(/_/, " ").capitalize - end - - # Removes the module part from the expression in the string. - # - # Examples: - # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections" - # "Inflections".demodulize # => "Inflections" - def demodulize(class_name_in_module) - class_name_in_module.to_s.gsub(/^.*::/, '') - end - - # Replaces special characters in a string so that it may be used as part of a 'pretty' URL. - # - # ==== Examples - # - # class Person - # def to_param - # "#{id}-#{name.parameterize}" - # end - # end - # - # @person = Person.find(1) - # # => # - # - # <%= link_to(@person.name, person_path(@person)) %> - # # => Donald E. Knuth - def parameterize(string, sep = '-') - # replace accented chars with their ascii equivalents - parameterized_string = transliterate(string) - # Turn unwanted chars into the separator - parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep) - unless sep.blank? - re_sep = Regexp.escape(sep) - # No more than one of the separator in a row. - parameterized_string.gsub!(/#{re_sep}{2,}/, sep) - # Remove leading/trailing separator. - parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '') - end - parameterized_string.downcase - end - - - # Replaces accented characters with their ascii equivalents. - def transliterate(string) - Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s - end - - if RUBY_VERSION >= '1.9' - undef_method :transliterate - def transliterate(string) - warn "Ruby 1.9 doesn't support Unicode normalization yet" - string.dup - end - - # The iconv transliteration code doesn't function correctly - # on some platforms, but it's very fast where it does function. - elsif "foo" != (Inflector.transliterate("föö") rescue nil) - undef_method :transliterate - def transliterate(string) - string.mb_chars.normalize(:kd). # Decompose accented characters - gsub(/[^\x00-\x7F]+/, '') # Remove anything non-ASCII entirely (e.g. diacritics). - end - end - - # Create the name of a table like Rails does for models to table names. This method - # uses the +pluralize+ method on the last word in the string. - # - # Examples - # "RawScaledScorer".tableize # => "raw_scaled_scorers" - # "egg_and_ham".tableize # => "egg_and_hams" - # "fancyCategory".tableize # => "fancy_categories" - def tableize(class_name) - pluralize(underscore(class_name)) - end - - # Create a class name from a plural table name like Rails does for table names to models. - # Note that this returns a string and not a Class. (To convert to an actual class - # follow +classify+ with +constantize+.) - # - # Examples: - # "egg_and_hams".classify # => "EggAndHam" - # "posts".classify # => "Post" - # - # Singular names are not handled correctly: - # "business".classify # => "Busines" - def classify(table_name) - # strip out any leading schema name - camelize(singularize(table_name.to_s.sub(/.*\./, ''))) - end - - # Creates a foreign key name from a class name. - # +separate_class_name_and_id_with_underscore+ sets whether - # the method should put '_' between the name and 'id'. - # - # Examples: - # "Message".foreign_key # => "message_id" - # "Message".foreign_key(false) # => "messageid" - # "Admin::Post".foreign_key # => "post_id" - def foreign_key(class_name, separate_class_name_and_id_with_underscore = true) - underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id") - end - - # Ruby 1.9 introduces an inherit argument for Module#const_get and - # #const_defined? and changes their default behavior. - if Module.method(:const_get).arity == 1 - # Tries to find a constant with the name specified in the argument string: - # - # "Module".constantize # => Module - # "Test::Unit".constantize # => Test::Unit - # - # The name is assumed to be the one of a top-level constant, no matter whether - # it starts with "::" or not. No lexical context is taken into account: - # - # C = 'outside' - # module M - # C = 'inside' - # C # => 'inside' - # "C".constantize # => 'outside', same as ::C - # end - # - # NameError is raised when the name is not in CamelCase or the constant is - # unknown. - def constantize(camel_cased_word) - names = camel_cased_word.split('::') - names.shift if names.empty? || names.first.empty? - - constant = Object - names.each do |name| - constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) - end - constant - end - else - def constantize(camel_cased_word) #:nodoc: - names = camel_cased_word.split('::') - names.shift if names.empty? || names.first.empty? - - constant = Object - names.each do |name| - constant = constant.const_get(name, false) || constant.const_missing(name) - end - constant - end - end - - # Turns a number into an ordinal string used to denote the position in an - # ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # Examples: - # ordinalize(1) # => "1st" - # ordinalize(2) # => "2nd" - # ordinalize(1002) # => "1002nd" - # ordinalize(1003) # => "1003rd" - def ordinalize(number) - if (11..13).include?(number.to_i % 100) - "#{number}th" - else - case number.to_i % 10 - when 1; "#{number}st" - when 2; "#{number}nd" - when 3; "#{number}rd" - else "#{number}th" - end - end - end - end -end - # in case active_support/inflector is required without the rest of active_support +require 'active_support/inflector/inflections' +require 'active_support/inflector/transliterate' +require 'active_support/inflector/methods' + require 'active_support/inflections' require 'active_support/core_ext/string/inflections' diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb new file mode 100644 index 0000000000..24ce58e5c2 --- /dev/null +++ b/activesupport/lib/active_support/inflector/inflections.rb @@ -0,0 +1,213 @@ +# require "active_support/core_ext/string/access" + +module ActiveSupport + module Inflector + # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional + # inflection rules. Examples: + # + # ActiveSupport::Inflector.inflections do |inflect| + # inflect.plural /^(ox)$/i, '\1\2en' + # inflect.singular /^(ox)en/i, '\1' + # + # inflect.irregular 'octopus', 'octopi' + # + # inflect.uncountable "equipment" + # end + # + # New rules are added at the top. So in the example above, the irregular rule for octopus will now be the first of the + # pluralization and singularization rules that is runs. This guarantees that your rules run before any of the rules that may + # already have been loaded. + class Inflections + def self.instance + @__instance__ ||= new + end + + attr_reader :plurals, :singulars, :uncountables, :humans + + def initialize + @plurals, @singulars, @uncountables, @humans = [], [], [], [] + end + + # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression. + # The replacement should always be a string that may include references to the matched data from the rule. + def plural(rule, replacement) + @uncountables.delete(rule) if rule.is_a?(String) + @uncountables.delete(replacement) + @plurals.insert(0, [rule, replacement]) + end + + # Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression. + # The replacement should always be a string that may include references to the matched data from the rule. + def singular(rule, replacement) + @uncountables.delete(rule) if rule.is_a?(String) + @uncountables.delete(replacement) + @singulars.insert(0, [rule, replacement]) + end + + # Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used + # for strings, not regular expressions. You simply pass the irregular in singular and plural form. + # + # Examples: + # irregular 'octopus', 'octopi' + # irregular 'person', 'people' + def irregular(singular, plural) + @uncountables.delete(singular) + @uncountables.delete(plural) + if singular[0,1].upcase == plural[0,1].upcase + plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1]) + plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + plural[1..-1]) + singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1]) + else + plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1]) + plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1]) + plural(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), plural[0,1].upcase + plural[1..-1]) + plural(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), plural[0,1].downcase + plural[1..-1]) + singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1]) + singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1]) + end + end + + # Add uncountable words that shouldn't be attempted inflected. + # + # Examples: + # uncountable "money" + # uncountable "money", "information" + # uncountable %w( money information rice ) + def uncountable(*words) + (@uncountables << words).flatten! + end + + # Specifies a humanized form of a string by a regular expression rule or by a string mapping. + # When using a regular expression based replacement, the normal humanize formatting is called after the replacement. + # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name') + # + # Examples: + # human /_cnt$/i, '\1_count' + # human "legacy_col_person_name", "Name" + def human(rule, replacement) + @humans.insert(0, [rule, replacement]) + end + + # Clears the loaded inflections within a given scope (default is :all). + # Give the scope as a symbol of the inflection type, the options are: :plurals, + # :singulars, :uncountables, :humans. + # + # Examples: + # clear :all + # clear :plurals + def clear(scope = :all) + case scope + when :all + @plurals, @singulars, @uncountables = [], [], [] + else + instance_variable_set "@#{scope}", [] + end + end + end + + # Yields a singleton instance of Inflector::Inflections so you can specify additional + # inflector rules. + # + # Example: + # ActiveSupport::Inflector.inflections do |inflect| + # inflect.uncountable "rails" + # end + def inflections + if block_given? + yield Inflections.instance + else + Inflections.instance + end + end + + # Returns the plural form of the word in the string. + # + # Examples: + # "post".pluralize # => "posts" + # "octopus".pluralize # => "octopi" + # "sheep".pluralize # => "sheep" + # "words".pluralize # => "words" + # "CamelOctopus".pluralize # => "CamelOctopi" + def pluralize(word) + result = word.to_s.dup + + if word.empty? || inflections.uncountables.include?(result.downcase) + result + else + inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } + result + end + end + + # The reverse of +pluralize+, returns the singular form of a word in a string. + # + # Examples: + # "posts".singularize # => "post" + # "octopi".singularize # => "octopus" + # "sheep".singularize # => "sheep" + # "word".singularize # => "word" + # "CamelOctopi".singularize # => "CamelOctopus" + def singularize(word) + result = word.to_s.dup + + if inflections.uncountables.include?(result.downcase) + result + else + inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } + result + end + end + + # Capitalizes the first word and turns underscores into spaces and strips a + # trailing "_id", if any. Like +titleize+, this is meant for creating pretty output. + # + # Examples: + # "employee_salary" # => "Employee salary" + # "author_id" # => "Author" + def humanize(lower_case_and_underscored_word) + result = lower_case_and_underscored_word.to_s.dup + + inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } + result.gsub(/_id$/, "").gsub(/_/, " ").capitalize + end + + # Capitalizes all the words and replaces some characters in the string to create + # a nicer looking title. +titleize+ is meant for creating pretty output. It is not + # used in the Rails internals. + # + # +titleize+ is also aliased as as +titlecase+. + # + # Examples: + # "man from the boondocks".titleize # => "Man From The Boondocks" + # "x-men: the last stand".titleize # => "X Men: The Last Stand" + def titleize(word) + humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize } + end + + # Create the name of a table like Rails does for models to table names. This method + # uses the +pluralize+ method on the last word in the string. + # + # Examples + # "RawScaledScorer".tableize # => "raw_scaled_scorers" + # "egg_and_ham".tableize # => "egg_and_hams" + # "fancyCategory".tableize # => "fancy_categories" + def tableize(class_name) + pluralize(underscore(class_name)) + end + + # Create a class name from a plural table name like Rails does for table names to models. + # Note that this returns a string and not a Class. (To convert to an actual class + # follow +classify+ with +constantize+.) + # + # Examples: + # "egg_and_hams".classify # => "EggAndHam" + # "posts".classify # => "Post" + # + # Singular names are not handled correctly: + # "business".classify # => "Busines" + def classify(table_name) + # strip out any leading schema name + camelize(singularize(table_name.to_s.sub(/.*\./, ''))) + end + end +end \ No newline at end of file diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb new file mode 100644 index 0000000000..41277893e3 --- /dev/null +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -0,0 +1,139 @@ +module ActiveSupport + # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without, + # and class names to foreign keys. The default inflections for pluralization, singularization, and uncountable words are kept + # in inflections.rb. + # + # The Rails core team has stated patches for the inflections library will not be accepted + # in order to avoid breaking legacy applications which may be relying on errant inflections. + # If you discover an incorrect inflection and require it for your application, you'll need + # to correct it yourself (explained below). + module Inflector + extend self + + # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+ + # is set to :lower then +camelize+ produces lowerCamelCase. + # + # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces. + # + # Examples: + # "active_record".camelize # => "ActiveRecord" + # "active_record".camelize(:lower) # => "activeRecord" + # "active_record/errors".camelize # => "ActiveRecord::Errors" + # "active_record/errors".camelize(:lower) # => "activeRecord::Errors" + def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) + if first_letter_in_uppercase + lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + else + lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1] + end + end + + # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string. + # + # Changes '::' to '/' to convert namespaces to paths. + # + # Examples: + # "ActiveRecord".underscore # => "active_record" + # "ActiveRecord::Errors".underscore # => active_record/errors + def underscore(camel_cased_word) + camel_cased_word.to_s.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). + gsub(/([a-z\d])([A-Z])/,'\1_\2'). + tr("-", "_"). + downcase + end + + # Replaces underscores with dashes in the string. + # + # Example: + # "puni_puni" # => "puni-puni" + def dasherize(underscored_word) + underscored_word.gsub(/_/, '-') + end + + # Removes the module part from the expression in the string. + # + # Examples: + # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections" + # "Inflections".demodulize # => "Inflections" + def demodulize(class_name_in_module) + class_name_in_module.to_s.gsub(/^.*::/, '') + end + + # Creates a foreign key name from a class name. + # +separate_class_name_and_id_with_underscore+ sets whether + # the method should put '_' between the name and 'id'. + # + # Examples: + # "Message".foreign_key # => "message_id" + # "Message".foreign_key(false) # => "messageid" + # "Admin::Post".foreign_key # => "post_id" + def foreign_key(class_name, separate_class_name_and_id_with_underscore = true) + underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id") + end + + # Ruby 1.9 introduces an inherit argument for Module#const_get and + # #const_defined? and changes their default behavior. + if Module.method(:const_get).arity == 1 + # Tries to find a constant with the name specified in the argument string: + # + # "Module".constantize # => Module + # "Test::Unit".constantize # => Test::Unit + # + # The name is assumed to be the one of a top-level constant, no matter whether + # it starts with "::" or not. No lexical context is taken into account: + # + # C = 'outside' + # module M + # C = 'inside' + # C # => 'inside' + # "C".constantize # => 'outside', same as ::C + # end + # + # NameError is raised when the name is not in CamelCase or the constant is + # unknown. + def constantize(camel_cased_word) + names = camel_cased_word.split('::') + names.shift if names.empty? || names.first.empty? + + constant = Object + names.each do |name| + constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) + end + constant + end + else + def constantize(camel_cased_word) #:nodoc: + names = camel_cased_word.split('::') + names.shift if names.empty? || names.first.empty? + + constant = Object + names.each do |name| + constant = constant.const_get(name, false) || constant.const_missing(name) + end + constant + end + end + + # Turns a number into an ordinal string used to denote the position in an + # ordered sequence such as 1st, 2nd, 3rd, 4th. + # + # Examples: + # ordinalize(1) # => "1st" + # ordinalize(2) # => "2nd" + # ordinalize(1002) # => "1002nd" + # ordinalize(1003) # => "1003rd" + def ordinalize(number) + if (11..13).include?(number.to_i % 100) + "#{number}th" + else + case number.to_i % 10 + when 1; "#{number}st" + when 2; "#{number}nd" + when 3; "#{number}rd" + else "#{number}th" + end + end + end + end +end \ No newline at end of file diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb new file mode 100644 index 0000000000..30a9072ee1 --- /dev/null +++ b/activesupport/lib/active_support/inflector/transliterate.rb @@ -0,0 +1,61 @@ +# encoding: utf-8 +require 'iconv' +require 'active_support/core_ext/string/multibyte' + +module ActiveSupport + module Inflector + extend self + + # Replaces accented characters with their ascii equivalents. + def transliterate(string) + Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s + end + + if RUBY_VERSION >= '1.9' + undef_method :transliterate + def transliterate(string) + warn "Ruby 1.9 doesn't support Unicode normalization yet" + string.dup + end + + # The iconv transliteration code doesn't function correctly + # on some platforms, but it's very fast where it does function. + elsif "foo" != (Inflector.transliterate("föö") rescue nil) + undef_method :transliterate + def transliterate(string) + string.mb_chars.normalize(:kd). # Decompose accented characters + gsub(/[^\x00-\x7F]+/, '') # Remove anything non-ASCII entirely (e.g. diacritics). + end + end + + # Replaces special characters in a string so that it may be used as part of a 'pretty' URL. + # + # ==== Examples + # + # class Person + # def to_param + # "#{id}-#{name.parameterize}" + # end + # end + # + # @person = Person.find(1) + # # => # + # + # <%= link_to(@person.name, person_path(@person)) %> + # # => Donald E. Knuth + def parameterize(string, sep = '-') + # replace accented chars with their ascii equivalents + parameterized_string = transliterate(string) + # Turn unwanted chars into the separator + parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep) + unless sep.nil? || sep.empty? + re_sep = Regexp.escape(sep) + # No more than one of the separator in a row. + parameterized_string.gsub!(/#{re_sep}{2,}/, sep) + # Remove leading/trailing separator. + parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '') + end + parameterized_string.downcase + end + end +end \ No newline at end of file -- cgit v1.2.3 From 103b29831e6d6a6c4363fd0e59ffcc6c343a14aa Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sat, 7 Nov 2009 11:23:34 -0800 Subject: Since we require 1.8.7 we don't need to shim instance_exec anymore --- .../active_support/core_ext/object/extending.rb | 27 ---------------------- 1 file changed, 27 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/object/extending.rb b/activesupport/lib/active_support/core_ext/object/extending.rb index bbf6f8563b..0cc74c8298 100644 --- a/activesupport/lib/active_support/core_ext/object/extending.rb +++ b/activesupport/lib/active_support/core_ext/object/extending.rb @@ -50,31 +50,4 @@ class Object def extend_with_included_modules_from(object) #:nodoc: object.extended_by.each { |mod| extend mod } end - - unless defined? instance_exec # 1.9 - module InstanceExecMethods #:nodoc: - end - include InstanceExecMethods - - # Evaluate the block with the given arguments within the context of - # this object, so self is set to the method receiver. - # - # From Mauricio's http://eigenclass.org/hiki/bounded+space+instance_exec - def instance_exec(*args, &block) - begin - old_critical, Thread.critical = Thread.critical, true - n = 0 - n += 1 while respond_to?(method_name = "__instance_exec#{n}") - InstanceExecMethods.module_eval { define_method(method_name, &block) } - ensure - Thread.critical = old_critical - end - - begin - send(method_name, *args) - ensure - InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil - end - end - end end -- cgit v1.2.3 From a595abff211eee97d75c51c085cfdc821b1edb46 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 12:12:45 -0800 Subject: Unknown :format param should result in empty request.formats --- actionpack/lib/action_dispatch/http/request.rb | 2 +- actionpack/test/dispatch/request_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 9314ff5c53..c24b404e2f 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -167,7 +167,7 @@ module ActionDispatch @env["action_dispatch.request.formats"] ||= if parameters[:format] - [Mime[parameters[:format]]] + Array.wrap(Mime[parameters[:format]]) elsif xhr? || (accept && !accept.include?(?,)) accepts else diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 239fda98e0..b62df9a6b2 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -432,6 +432,10 @@ class RequestTest < ActiveSupport::TestCase request = stub_request request.expects(:parameters).at_least_once.returns({ :format => :txt }) assert_equal with_set(Mime::TEXT), request.formats + + request = stub_request + request.expects(:parameters).at_least_once.returns({ :format => :unknown }) + assert request.formats.empty? end test "negotiate_mime" do -- cgit v1.2.3 From 216e8c6bfad6800f5f2a772d40cab29442efdaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 6 Nov 2009 23:28:58 -0200 Subject: Update Rails Generators to use Thor 0.12.0. Signed-off-by: Yehuda Katz --- railties/lib/rails/generators.rb | 2 +- railties/lib/rails/generators/base.rb | 4 + .../lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc | 77 --- railties/lib/rails/vendor/thor-0.11.8/LICENSE | 20 - railties/lib/rails/vendor/thor-0.11.8/README.rdoc | 234 ---------- railties/lib/rails/vendor/thor-0.11.8/Thorfile | 63 --- railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb | 242 ---------- .../rails/vendor/thor-0.11.8/lib/thor/actions.rb | 273 ----------- .../thor-0.11.8/lib/thor/actions/create_file.rb | 102 ---- .../thor-0.11.8/lib/thor/actions/directory.rb | 89 ---- .../lib/thor/actions/empty_directory.rb | 133 ------ .../lib/thor/actions/file_manipulation.rb | 219 --------- .../lib/thor/actions/inject_into_file.rb | 101 ---- .../lib/rails/vendor/thor-0.11.8/lib/thor/base.rb | 517 --------------------- .../thor/core_ext/hash_with_indifferent_access.rb | 75 --- .../thor-0.11.8/lib/thor/core_ext/ordered_hash.rb | 100 ---- .../lib/rails/vendor/thor-0.11.8/lib/thor/error.rb | 27 -- .../lib/rails/vendor/thor-0.11.8/lib/thor/group.rb | 263 ----------- .../vendor/thor-0.11.8/lib/thor/invocation.rb | 178 ------- .../rails/vendor/thor-0.11.8/lib/thor/parser.rb | 4 - .../vendor/thor-0.11.8/lib/thor/parser/argument.rb | 67 --- .../thor-0.11.8/lib/thor/parser/arguments.rb | 145 ------ .../vendor/thor-0.11.8/lib/thor/parser/option.rb | 132 ------ .../vendor/thor-0.11.8/lib/thor/parser/options.rb | 142 ------ .../vendor/thor-0.11.8/lib/thor/rake_compat.rb | 66 --- .../rails/vendor/thor-0.11.8/lib/thor/runner.rb | 299 ------------ .../lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb | 78 ---- .../vendor/thor-0.11.8/lib/thor/shell/basic.rb | 219 --------- .../vendor/thor-0.11.8/lib/thor/shell/color.rb | 108 ----- .../lib/rails/vendor/thor-0.11.8/lib/thor/task.rb | 122 ----- .../lib/rails/vendor/thor-0.11.8/lib/thor/util.rb | 251 ---------- .../rails/vendor/thor-0.11.8/lib/thor/version.rb | 3 - .../lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc | 82 ++++ railties/lib/rails/vendor/thor-0.12.0/LICENSE | 20 + railties/lib/rails/vendor/thor-0.12.0/README.rdoc | 234 ++++++++++ railties/lib/rails/vendor/thor-0.12.0/Thorfile | 63 +++ railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb | 242 ++++++++++ .../rails/vendor/thor-0.12.0/lib/thor/actions.rb | 273 +++++++++++ .../thor-0.12.0/lib/thor/actions/create_file.rb | 103 ++++ .../thor-0.12.0/lib/thor/actions/directory.rb | 93 ++++ .../lib/thor/actions/empty_directory.rb | 134 ++++++ .../lib/thor/actions/file_manipulation.rb | 219 +++++++++ .../lib/thor/actions/inject_into_file.rb | 101 ++++ .../lib/rails/vendor/thor-0.12.0/lib/thor/base.rb | 517 +++++++++++++++++++++ .../thor/core_ext/hash_with_indifferent_access.rb | 75 +++ .../thor-0.12.0/lib/thor/core_ext/ordered_hash.rb | 100 ++++ .../lib/rails/vendor/thor-0.12.0/lib/thor/error.rb | 27 ++ .../lib/rails/vendor/thor-0.12.0/lib/thor/group.rb | 263 +++++++++++ .../vendor/thor-0.12.0/lib/thor/invocation.rb | 178 +++++++ .../rails/vendor/thor-0.12.0/lib/thor/parser.rb | 4 + .../vendor/thor-0.12.0/lib/thor/parser/argument.rb | 67 +++ .../thor-0.12.0/lib/thor/parser/arguments.rb | 145 ++++++ .../vendor/thor-0.12.0/lib/thor/parser/option.rb | 132 ++++++ .../vendor/thor-0.12.0/lib/thor/parser/options.rb | 142 ++++++ .../vendor/thor-0.12.0/lib/thor/rake_compat.rb | 66 +++ .../rails/vendor/thor-0.12.0/lib/thor/runner.rb | 299 ++++++++++++ .../lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb | 78 ++++ .../vendor/thor-0.12.0/lib/thor/shell/basic.rb | 219 +++++++++ .../vendor/thor-0.12.0/lib/thor/shell/color.rb | 108 +++++ .../lib/rails/vendor/thor-0.12.0/lib/thor/task.rb | 122 +++++ .../lib/rails/vendor/thor-0.12.0/lib/thor/util.rb | 251 ++++++++++ .../rails/vendor/thor-0.12.0/lib/thor/version.rb | 3 + 62 files changed, 4365 insertions(+), 4350 deletions(-) delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/LICENSE delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/README.rdoc delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/Thorfile delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/color.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/task.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb delete mode 100644 railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc create mode 100644 railties/lib/rails/vendor/thor-0.12.0/LICENSE create mode 100644 railties/lib/rails/vendor/thor-0.12.0/README.rdoc create mode 100644 railties/lib/rails/vendor/thor-0.12.0/Thorfile create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/color.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/task.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb create mode 100644 railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index fa2c11795b..19412c259e 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -9,7 +9,7 @@ require 'active_support/core_ext/module/attribute_accessors' require 'active_support/core_ext/string/inflections' # TODO: Do not always push on vendored thor -$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/vendor/thor-0.11.8/lib") +$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/vendor/thor-0.12.0/lib") require 'rails/generators/base' require 'rails/generators/named_base' diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index af1bf26f4a..a64005497b 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -212,6 +212,10 @@ module Rails def self.inherited(base) #:nodoc: super + # Cache source root, we need to do this, since __FILE__ is a relative value + # and can point to wrong directions when inside an specified directory. + base.source_root + if base.name && base.name !~ /Base$/ && defined?(Rails.root) && Rails.root path = File.expand_path(File.join(Rails.root, 'lib', 'templates')) if base.name.include?('::') diff --git a/railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc b/railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc deleted file mode 100644 index dba25b7205..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/CHANGELOG.rdoc +++ /dev/null @@ -1,77 +0,0 @@ -== TODO - -* Improve spec coverage for Thor::Runner - -== 0.11.x, released 2009-07-01 - -* Added a rake compatibility layer. It allows you to use spec and rdoc tasks on - Thor classes. - -* BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore - since it wrong behavior to the invocation system. - -* thor help now show information about any class/task. All those calls are - possible: - - thor help describe - thor help describe:amazing - - Or even with default namespaces: - - thor help :spec - -* Thor::Runner now invokes the default task if none is supplied: - - thor describe # invokes the default task, usually help - -* Thor::Runner now works with mappings: - - thor describe -h - -* Added some documentation and code refactoring. - -== 0.9.8, released 2008-10-20 - -* Fixed some tiny issues that were introduced lately. - -== 0.9.7, released 2008-10-13 - -* Setting global method options on the initialize method works as expected: - All other tasks will accept these global options in addition to their own. -* Added 'group' notion to Thor task sets (class Thor); by default all tasks - are in the 'standard' group. Running 'thor -T' will only show the standard - tasks - adding --all will show all tasks. You can also filter on a specific - group using the --group option: thor -T --group advanced - -== 0.9.6, released 2008-09-13 - -* Generic improvements - -== 0.9.5, released 2008-08-27 - -* Improve Windows compatibility -* Update (incorrect) README and task.thor sample file -* Options hash is now frozen (once returned) -* Allow magic predicates on options object. For instance: `options.force?` -* Add support for :numeric type -* BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f]) -* Allow specifying optional args with default values: method_options(:user => "mislav") -* Don't write options for nil or false values. This allows, for example, turning color off when running specs. -* Exit with the status of the spec command to help CI stuff out some. - -== 0.9.4, released 2008-08-13 - -* Try to add Windows compatibility. -* BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore -* Allow options at the beginning of the argument list as well as the end. -* Make options available with symbol keys in addition to string keys. -* Allow true to be passed to Thor#method_options to denote a boolean option. -* If loading a thor file fails, don't give up, just print a warning and keep going. -* Make sure that we re-raise errors if they happened further down the pipe than we care about. -* Only delete the old file on updating when the installation of the new one is a success -* Make it Ruby 1.8.5 compatible. -* Don't raise an error if a boolean switch is defined multiple times. -* Thor::Options now doesn't parse through things that look like options but aren't. -* Add URI detection to install task, and make sure we don't append ".thor" to URIs -* Add rake2thor to the gem binfiles. -* Make sure local Thorfiles override system-wide ones. diff --git a/railties/lib/rails/vendor/thor-0.11.8/LICENSE b/railties/lib/rails/vendor/thor-0.11.8/LICENSE deleted file mode 100644 index 98722da459..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008 Yehuda Katz - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/railties/lib/rails/vendor/thor-0.11.8/README.rdoc b/railties/lib/rails/vendor/thor-0.11.8/README.rdoc deleted file mode 100644 index f1106f02b6..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/README.rdoc +++ /dev/null @@ -1,234 +0,0 @@ -= thor - -Map options to a class. Simply create a class with the appropriate annotations -and have options automatically map to functions and parameters. - -Example: - - class App < Thor # [1] - map "-L" => :list # [2] - - desc "install APP_NAME", "install one of the available apps" # [3] - method_options :force => :boolean, :alias => :string # [4] - def install(name) - user_alias = options[:alias] - if options.force? - # do something - end - # other code - end - - desc "list [SEARCH]", "list all of the available apps, limited by SEARCH" - def list(search="") - # list everything - end - end - -Thor automatically maps commands as such: - - thor app:install myname --force - -That gets converted to: - - App.new.install("myname") - # with {'force' => true} as options hash - -1. Inherit from Thor to turn a class into an option mapper -2. Map additional non-valid identifiers to specific methods. In this case, convert -L to :list -3. Describe the method immediately below. The first parameter is the usage information, and the second parameter is the description -4. Provide any additional options that will be available the instance method options. - -== Types for method_options - -* :boolean - is parsed as --option or --option=true -* :string - is parsed as --option=VALUE -* :numeric - is parsed as --option=N -* :array - is parsed as --option=one two three -* :hash - is parsed as --option=name:string age:integer - -Besides, method_option allows a default value to be given, examples: - - method_options :force => false - #=> Creates a boolean option with default value false - - method_options :alias => "bar" - #=> Creates a string option with default value "bar" - - method_options :threshold => 3.0 - #=> Creates a numeric option with default value 3.0 - -You can also supply :option => :required to mark an option as required. The -type is assumed to be string. If you want a required hash with default values -as option, you can use method_option which uses a more declarative style: - - method_option :attributes, :type => :hash, :default => {}, :required => true - -All arguments can be set to nil (except required arguments), by suppling a no or -skip variant. For example: - - thor app name --no-attributes - -In previous versions, aliases for options were created automatically, but now -they should be explicit. You can supply aliases in both short and declarative -styles: - - method_options %w( force -f ) => :boolean - -Or: - - method_option :force, :type => :boolean, :aliases => "-f" - -You can supply as many aliases as you want. - -NOTE: Type :optional available in Thor 0.9.0 was deprecated. Use :string or :boolean instead. - -== Namespaces - -By default, your Thor tasks are invoked using Ruby namespace. In the example -above, tasks are invoked as: - - thor app:install name --force - -However, you could namespace your class as: - - module Sinatra - class App < Thor - # tasks - end - end - -And then you should invoke your tasks as: - - thor sinatra:app:install name --force - -If desired, you can change the namespace: - - module Sinatra - class App < Thor - namespace :myapp - # tasks - end - end - -And then your tasks hould be invoked as: - - thor myapp:install name --force - -== Invocations - -Thor comes with a invocation-dependency system as well which allows a task to be -invoked only once. For example: - - class Counter < Thor - desc "one", "Prints 1, 2, 3" - def one - puts 1 - invoke :two - invoke :three - end - - desc "two", "Prints 2, 3" - def two - puts 2 - invoke :three - end - - desc "three", "Prints 3" - def three - puts 3 - end - end - -When invoking the task one: - - thor counter:one - -The output is "1 2 3", which means that the three task was invoked only once. -You can even invoke tasks from another class, so be sure to check the -documentation. - -== Thor::Group - -Thor has a special class called Thor::Group. The main difference to Thor class -is that it invokes all tasks at once. The example above could be rewritten in -Thor::Group as this: - - class Counter < Thor::Group - desc "Prints 1, 2, 3" - - def one - puts 1 - end - - def two - puts 2 - end - - def three - puts 3 - end - end - -When invoked: - - thor counter - -It prints "1 2 3" as well. Notice you should describe (using the method desc) -only the class and not each task anymore. Thor::Group is a great tool to create -generators, since you can define several steps which are invoked in the order they -are defined (Thor::Group is the tool use in generators in Rails 3.0). - -Besides, Thor::Group can parse arguments and options as Thor tasks: - - class Counter < Thor::Group - # number will be available as attr_accessor - argument :number, :type => :numeric, :desc => "The number to start counting" - desc "Prints the 'number' given upto 'number+2'" - - def one - puts number + 0 - end - - def two - puts number + 1 - end - - def three - puts number + 2 - end - end - -The counter above expects one parameter and has the folling outputs: - - thor counter 5 - # Prints "5 6 7" - - thor counter 11 - # Prints "11 12 13" - -You can also give options to Thor::Group, but instead of using method_option -and method_options, you should use class_option and class_options. -Both argument and class_options methods are available to Thor class as well. - -== Actions - -Thor comes with several actions which helps with script and generator tasks. You -might be familiar with them since some came from Rails Templates. They are: -say, ask, yes?, no?, add_file, -remove_file, copy_file, template, directory, -inside, run, inject_into_file and a couple more. - -To use them, you just need to include Thor::Actions in your Thor classes: - - class App < Thor - include Thor::Actions - # tasks - end - -Some actions like copy file requires that a class method called source_root is -defined in your class. This is the directory where your templates should be -placed. Be sure to check the documentation. - -== License - -See MIT LICENSE. diff --git a/railties/lib/rails/vendor/thor-0.11.8/Thorfile b/railties/lib/rails/vendor/thor-0.11.8/Thorfile deleted file mode 100644 index f71a1e57e2..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/Thorfile +++ /dev/null @@ -1,63 +0,0 @@ -# enconding: utf-8 - -require File.join(File.dirname(__FILE__), "lib", "thor", "version") -require 'thor/rake_compat' -require 'spec/rake/spectask' -require 'rdoc/task' - -GEM_NAME = 'thor' -EXTRA_RDOC_FILES = ["README.rdoc", "LICENSE", "CHANGELOG.rdoc", "VERSION", "Thorfile"] - -class Default < Thor - include Thor::RakeCompat - - Spec::Rake::SpecTask.new(:spec) do |t| - t.libs << 'lib' - t.spec_opts = ['--options', "spec/spec.opts"] - t.spec_files = FileList['spec/**/*_spec.rb'] - end - - Spec::Rake::SpecTask.new(:rcov) do |t| - t.libs << 'lib' - t.spec_opts = ['--options', "spec/spec.opts"] - t.spec_files = FileList['spec/**/*_spec.rb'] - t.rcov = true - t.rcov_dir = "rcov" - end - - RDoc::Task.new do |rdoc| - rdoc.main = "README.rdoc" - rdoc.rdoc_dir = "rdoc" - rdoc.title = GEM_NAME - rdoc.rdoc_files.include(*EXTRA_RDOC_FILES) - rdoc.rdoc_files.include('lib/**/*.rb') - rdoc.options << '--line-numbers' << '--inline-source' - end - - begin - require 'jeweler' - Jeweler::Tasks.new do |s| - s.name = GEM_NAME - s.version = Thor::VERSION - s.rubyforge_project = "textmate" - s.platform = Gem::Platform::RUBY - s.summary = "A scripting framework that replaces rake, sake and rubigen" - s.email = "ruby-thor@googlegroups.com" - s.homepage = "http://yehudakatz.com" - s.description = "A scripting framework that replaces rake, sake and rubigen" - s.authors = ['Yehuda Katz', 'José Valim'] - s.has_rdoc = true - s.extra_rdoc_files = EXTRA_RDOC_FILES - s.require_path = 'lib' - s.bindir = "bin" - s.executables = %w( thor rake2thor ) - s.files = s.extra_rdoc_files + Dir.glob("{bin,lib}/**/*") - s.files.exclude 'spec/sandbox/**/*' - s.test_files.exclude 'spec/sandbox/**/*' - end - - Jeweler::RubyforgeTasks.new - rescue LoadError - puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb deleted file mode 100644 index 68944f140d..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor.rb +++ /dev/null @@ -1,242 +0,0 @@ -require 'thor/base' -require 'thor/group' -require 'thor/actions' - -class Thor - class << self - # Sets the default task when thor is executed without an explicit task to be called. - # - # ==== Parameters - # meth:: name of the defaut task - # - def default_task(meth=nil) - case meth - when :none - @default_task = 'help' - when nil - @default_task ||= from_superclass(:default_task, 'help') - else - @default_task = meth.to_s - end - end - - # Defines the usage and the description of the next task. - # - # ==== Parameters - # usage - # description - # - def desc(usage, description, options={}) - if options[:for] - task = find_and_refresh_task(options[:for]) - task.usage = usage if usage - task.description = description if description - else - @usage, @desc = usage, description - end - end - - # Maps an input to a task. If you define: - # - # map "-T" => "list" - # - # Running: - # - # thor -T - # - # Will invoke the list task. - # - # ==== Parameters - # Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given task. - # - def map(mappings=nil) - @map ||= from_superclass(:map, {}) - - if mappings - mappings.each do |key, value| - if key.respond_to?(:each) - key.each {|subkey| @map[subkey] = value} - else - @map[key] = value - end - end - end - - @map - end - - # Declares the options for the next task to be declared. - # - # ==== Parameters - # Hash[Symbol => Object]:: The hash key is the name of the option and the value - # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric - # or :required (string). If you give a value, the type of the value is used. - # - def method_options(options=nil) - @method_options ||= {} - build_options(options, @method_options) if options - @method_options - end - - # Adds an option to the set of class options. If :for is given as option, - # it allows you to change the options from a previous defined task. - # - # def previous_task - # # magic - # end - # - # method_options :foo => :bar, :for => :previous_task - # - # def next_task - # # magic - # end - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described below. - # - # ==== Options - # :desc - Description for the argument. - # :required - If the argument is required or not. - # :default - Default value for this argument. It cannot be required and have default values. - # :aliases - Aliases for this option. - # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. - # :group - The group for this options. Use by class options to output options in different levels. - # :banner - String to show on usage notes. - # - def method_option(name, options={}) - scope = if options[:for] - find_and_refresh_task(options[:for]).options - else - method_options - end - - build_option(name, options, scope) - end - - # Parses the task and options from the given args, instantiate the class - # and invoke the task. This method is used when the arguments must be parsed - # from an array. If you are inside Ruby and want to use a Thor class, you - # can simply initialize it: - # - # script = MyScript.new(args, options, config) - # script.invoke(:task, first_arg, second_arg, third_arg) - # - def start(given_args=ARGV, config={}) - super do - meth = normalize_task_name(given_args.shift) - task = all_tasks[meth] - - if task - args, opts = Thor::Options.split(given_args) - config.merge!(:task_options => task.options) - else - args, opts = given_args, {} - end - - task ||= Thor::Task::Dynamic.new(meth) - trailing = args[Range.new(arguments.size, -1)] - new(args, opts, config).invoke(task, trailing || []) - end - end - - # Prints help information. If a task name is given, it shows information - # only about the specific task. - # - # ==== Parameters - # meth:: An optional task name to print usage information about. - # - # ==== Options - # namespace:: When true, shows the namespace in the output before the usage. - # skip_inherited:: When true, does not show tasks from superclass. - # - def help(shell, meth=nil, options={}) - meth, options = nil, meth if meth.is_a?(Hash) - - if meth - task = all_tasks[meth] - raise UndefinedTaskError, "task '#{meth}' could not be found in namespace '#{self.namespace}'" unless task - - shell.say "Usage:" - shell.say " #{banner(task, options[:namespace], false)}" - shell.say - class_options_help(shell, "Class", :Method => task.options.map { |_, o| o }) - shell.say task.description - else - list = (options[:short] ? tasks : all_tasks).map do |_, task| - item = [ banner(task, options[:namespace]) ] - item << "# #{task.short_description}" if task.short_description - item << " " - end - - options[:ident] ||= 2 - if options[:short] - shell.print_list(list, :ident => options[:ident]) - else - shell.say "Tasks:" - shell.print_list(list, :ident => options[:ident]) - end - - Thor::Util.thor_classes_in(self).each do |subclass| - namespace = options[:namespace] == true || subclass.namespace.gsub(/^#{self.namespace}:/, '') - subclass.help(shell, options.merge(:short => true, :namespace => namespace)) - end - - class_options_help(shell, "Class") unless options[:short] - end - end - - protected - - # The banner for this class. You can customize it if you are invoking the - # thor class by another ways which is not the Thor::Runner. It receives - # the task that is going to be invoked and a boolean which indicates if - # the namespace should be displayed as arguments. - # - def banner(task, namespace=true, show_options=true) - task.formatted_usage(self, namespace, show_options) - end - - def baseclass #:nodoc: - Thor - end - - def create_task(meth) #:nodoc: - if @usage && @desc - tasks[meth.to_s] = Thor::Task.new(meth, @desc, @usage, method_options) - @usage, @desc, @method_options = nil - true - elsif self.all_tasks[meth.to_s] || meth.to_sym == :method_missing - true - else - puts "[WARNING] Attempted to create task #{meth.inspect} without usage or description. " << - "Call desc if you want this method to be available as task or declare it inside a " << - "no_tasks{} block. Invoked from #{caller[1].inspect}." - false - end - end - - def initialize_added #:nodoc: - class_options.merge!(method_options) - @method_options = nil - end - - # Receives a task name (can be nil), and try to get a map from it. - # If a map can't be found use the sent name or the default task. - # - def normalize_task_name(meth) #:nodoc: - mapping = map[meth.to_s] - meth = mapping || meth || default_task - meth.to_s.gsub('-','_') # treat foo-bar > foo_bar - end - end - - include Thor::Base - - map HELP_MAPPINGS => :help - - desc "help [TASK]", "Describe available tasks or one specific task" - def help(task=nil) - self.class.help(shell, task, :namespace => task && task.include?(?:)) - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb deleted file mode 100644 index d561ccb2aa..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions.rb +++ /dev/null @@ -1,273 +0,0 @@ -require 'fileutils' - -Dir[File.join(File.dirname(__FILE__), "actions", "*.rb")].each do |action| - require action -end - -class Thor - module Actions - attr_accessor :behavior - - def self.included(base) #:nodoc: - base.extend ClassMethods - end - - module ClassMethods - # Hold source paths for one Thor instance. source_paths_for_search is the - # method responsible to gather source_paths from this current class, - # inherited paths and the source root. - # - def source_paths - @source_paths ||= [] - end - - # Returns the source paths in the following order: - # - # 1) This class source paths - # 2) Source root - # 3) Parents source paths - # - def source_paths_for_search - paths = [] - paths += self.source_paths - paths << self.source_root if self.respond_to?(:source_root) - paths += from_superclass(:source_paths, []) - paths - end - - # Add runtime options that help actions execution. - # - def add_runtime_options! - class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime, - :desc => "Run but do not make any changes" - - class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime, - :desc => "Overwrite files that already exist" - - class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime, - :desc => "Skip files that already exist" - - class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime, - :desc => "Supress status output" - end - end - - # Extends initializer to add more configuration options. - # - # ==== Configuration - # behavior:: The actions default behavior. Can be :invoke or :revoke. - # It also accepts :force, :skip and :pretend to set the behavior - # and the respective option. - # - # destination_root:: The root directory needed for some actions. - # - def initialize(args=[], options={}, config={}) - self.behavior = case config[:behavior].to_s - when "force", "skip" - _cleanup_options_and_set(options, config[:behavior]) - :invoke - when "revoke" - :revoke - else - :invoke - end - - super - self.destination_root = config[:destination_root] - end - - # Wraps an action object and call it accordingly to the thor class behavior. - # - def action(instance) #:nodoc: - if behavior == :revoke - instance.revoke! - else - instance.invoke! - end - end - - # Returns the root for this thor class (also aliased as destination root). - # - def destination_root - @destination_stack.last - end - - # Sets the root for this thor class. Relatives path are added to the - # directory where the script was invoked and expanded. - # - def destination_root=(root) - @destination_stack ||= [] - @destination_stack[0] = File.expand_path(root || '') - end - - # Returns the given path relative to the absolute root (ie, root where - # the script started). - # - def relative_to_original_destination_root(path, remove_dot=true) - path = path.gsub(@destination_stack[0], '.') - remove_dot ? (path[2..-1] || '') : path - end - - # Holds source paths in instance so they can be manipulated. - # - def source_paths - @source_paths ||= self.class.source_paths_for_search - end - - # Receives a file or directory and search for it in the source paths. - # - def find_in_source_paths(file) - relative_root = relative_to_original_destination_root(destination_root, false) - - source_paths.each do |source| - source_file = File.expand_path(file, File.join(source, relative_root)) - return source_file if File.exists?(source_file) - end - - if source_paths.empty? - raise Error, "You don't have any source path defined for class #{self.class.name}. To fix this, " << - "you can define a source_root in your class." - else - raise Error, "Could not find #{file.inspect} in source paths." - end - end - - # Do something in the root or on a provided subfolder. If a relative path - # is given it's referenced from the current root. The full path is yielded - # to the block you provide. The path is set back to the previous path when - # the method exits. - # - # ==== Parameters - # dir:: the directory to move to. - # config:: give :verbose => true to log and use padding. - # - def inside(dir='', config={}, &block) - verbose = config.fetch(:verbose, false) - - say_status :inside, dir, verbose - shell.padding += 1 if verbose - @destination_stack.push File.expand_path(dir, destination_root) - - FileUtils.mkdir_p(destination_root) unless File.exist?(destination_root) - FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield } - - @destination_stack.pop - shell.padding -= 1 if verbose - end - - # Goes to the root and execute the given block. - # - def in_root - inside(@destination_stack.first) { yield } - end - - # Loads an external file and execute it in the instance binding. - # - # ==== Parameters - # path:: The path to the file to execute. Can be a web address or - # a relative path from the source root. - # - # ==== Examples - # - # apply "http://gist.github.com/103208" - # - # apply "recipes/jquery.rb" - # - def apply(path, config={}) - verbose = config.fetch(:verbose, true) - path = find_in_source_paths(path) unless path =~ /^http\:\/\// - - say_status :apply, path, verbose - shell.padding += 1 if verbose - instance_eval(open(path).read) - shell.padding -= 1 if verbose - end - - # Executes a command. - # - # ==== Parameters - # command:: the command to be executed. - # config:: give :verbose => false to not log the status. Specify :with - # to append an executable to command executation. - # - # ==== Example - # - # inside('vendor') do - # run('ln -s ~/edge rails') - # end - # - def run(command, config={}) - return unless behavior == :invoke - - destination = relative_to_original_destination_root(destination_root, false) - desc = "#{command} from #{destination.inspect}" - - if config[:with] - desc = "#{File.basename(config[:with].to_s)} #{desc}" - command = "#{config[:with]} #{command}" - end - - say_status :run, desc, config.fetch(:verbose, true) - system(command) unless options[:pretend] - end - - # Executes a ruby script (taking into account WIN32 platform quirks). - # - # ==== Parameters - # command:: the command to be executed. - # config:: give :verbose => false to not log the status. - # - def run_ruby_script(command, config={}) - return unless behavior == :invoke - run "#{command}", config.merge(:with => Thor::Util.ruby_command) - end - - # Run a thor command. A hash of options can be given and it's converted to - # switches. - # - # ==== Parameters - # task:: the task to be invoked - # args:: arguments to the task - # config:: give :verbose => false to not log the status. Other options - # are given as parameter to Thor. - # - # ==== Examples - # - # thor :install, "http://gist.github.com/103208" - # #=> thor install http://gist.github.com/103208 - # - # thor :list, :all => true, :substring => 'rails' - # #=> thor list --all --substring=rails - # - def thor(task, *args) - config = args.last.is_a?(Hash) ? args.pop : {} - verbose = config.key?(:verbose) ? config.delete(:verbose) : true - - args.unshift task - args.push Thor::Options.to_switches(config) - command = args.join(' ').strip - - run command, :with => :thor, :verbose => verbose - end - - protected - - # Allow current root to be shared between invocations. - # - def _shared_configuration #:nodoc: - super.merge!(:destination_root => self.destination_root) - end - - def _cleanup_options_and_set(options, key) #:nodoc: - case options - when Array - %w(--force -f --skip -s).each { |i| options.delete(i) } - options << "--#{key}" - when Hash - [:force, :skip, "force", "skip"].each { |i| options.delete(i) } - options.merge!(key => true) - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb deleted file mode 100644 index 8f6badee27..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/create_file.rb +++ /dev/null @@ -1,102 +0,0 @@ -require 'thor/actions/empty_directory' - -class Thor - module Actions - - # Create a new file relative to the destination root with the given data, - # which is the return value of a block or a data string. - # - # ==== Parameters - # destination:: the relative path to the destination root. - # data:: the data to append to the file. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # create_file "lib/fun_party.rb" do - # hostname = ask("What is the virtual hostname I should use?") - # "vhost.name = #{hostname}" - # end - # - # create_file "config/apach.conf", "your apache config" - # - def create_file(destination, data=nil, config={}, &block) - action CreateFile.new(self, destination, block || data.to_s, config) - end - alias :add_file :create_file - - # AddFile is a subset of Template, which instead of rendering a file with - # ERB, it gets the content from the user. - # - class CreateFile < EmptyDirectory #:nodoc: - attr_reader :data - - def initialize(base, destination, data, config={}) - @data = data - super(base, destination, config) - end - - # Checks if the content of the file at the destination is identical to the rendered result. - # - # ==== Returns - # Boolean:: true if it is identical, false otherwise. - # - def identical? - exists? && File.read(destination) == render - end - - # Holds the content to be added to the file. - # - def render - @render ||= if data.is_a?(Proc) - data.call - else - data - end - end - - def invoke! - invoke_with_conflict_check do - FileUtils.mkdir_p(File.dirname(destination)) - File.open(destination, 'w'){ |f| f.write render } - end - end - - protected - - # Now on conflict we check if the file is identical or not. - # - def on_conflict_behavior(&block) - if identical? - say_status :identical, :blue - else - options = base.options.merge(config) - force_or_skip_or_conflict(options[:force], options[:skip], &block) - end - end - - # If force is true, run the action, otherwise check if it's not being - # skipped. If both are false, show the file_collision menu, if the menu - # returns true, force it, otherwise skip. - # - def force_or_skip_or_conflict(force, skip, &block) - if force - say_status :force, :yellow - block.call unless pretend? - elsif skip - say_status :skip, :yellow - else - say_status :conflict, :red - force_or_skip_or_conflict(force_on_collision?, true, &block) - end - end - - # Shows the file collision menu to the user and gets the result. - # - def force_on_collision? - base.shell.file_collision(destination){ render } - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb deleted file mode 100644 index 063ac57406..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/directory.rb +++ /dev/null @@ -1,89 +0,0 @@ -require 'thor/actions/empty_directory' - -class Thor - module Actions - - # Copies recursively the files from source directory to root directory. - # If any of the files finishes with .tt, it's considered to be a template - # and is placed in the destination without the extension .tt. If any - # empty directory is found, it's copied and all .empty_directory files are - # ignored. Remember that file paths can also be encoded, let's suppose a doc - # directory with the following files: - # - # doc/ - # components/.empty_directory - # README - # rdoc.rb.tt - # %app_name%.rb - # - # When invoked as: - # - # directory "doc" - # - # It will create a doc directory in the destination with the following - # files (assuming that the app_name is "blog"): - # - # doc/ - # components/ - # README - # rdoc.rb - # blog.rb - # - # ==== Parameters - # source:: the relative path to the source root. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # If :recursive => false, does not look for paths recursively. - # - # ==== Examples - # - # directory "doc" - # directory "doc", "docs", :recursive => false - # - def directory(source, destination=nil, config={}) - action Directory.new(self, source, destination || source, config) - end - - class Directory < EmptyDirectory #:nodoc: - attr_reader :source - - def initialize(base, source, destination=nil, config={}) - @source = File.expand_path(base.find_in_source_paths(source.to_s)) - super(base, destination, { :recursive => true }.merge(config)) - end - - def invoke! - base.empty_directory given_destination, config - execute! - end - - def revoke! - execute! - end - - protected - - def execute! - lookup = config[:recursive] ? File.join(source, '**') : source - lookup = File.join(lookup, '{*,.[a-z]*}') - - Dir[lookup].each do |file_source| - next if File.directory?(file_source) - file_destination = File.join(given_destination, file_source.gsub(source, '.')) - - case file_source - when /\.empty_directory$/ - dirname = File.dirname(file_destination).gsub(/\/\.$/, '') - next if dirname == given_destination - base.empty_directory(dirname, config) - when /\.tt$/ - base.template(file_source, file_destination[0..-4], config) - else - base.copy_file(file_source, file_destination, config) - end - end - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb deleted file mode 100644 index 03c1fe4af1..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/empty_directory.rb +++ /dev/null @@ -1,133 +0,0 @@ -class Thor - module Actions - - # Creates an empty directory. - # - # ==== Parameters - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # empty_directory "doc" - # - def empty_directory(destination, config={}) - action EmptyDirectory.new(self, destination, config) - end - - # Class which holds create directory logic. This is the base class for - # other actions like create_file and directory. - # - # This implementation is based in Templater actions, created by Jonas Nicklas - # and Michael S. Klishin under MIT LICENSE. - # - class EmptyDirectory #:nodoc: - attr_reader :base, :destination, :given_destination, :relative_destination, :config - - # Initializes given the source and destination. - # - # ==== Parameters - # base:: A Thor::Base instance - # source:: Relative path to the source of this file - # destination:: Relative path to the destination of this file - # config:: give :verbose => false to not log the status. - # - def initialize(base, destination, config={}) - @base, @config = base, { :verbose => true }.merge(config) - self.destination = destination - end - - # Checks if the destination file already exists. - # - # ==== Returns - # Boolean:: true if the file exists, false otherwise. - # - def exists? - ::File.exists?(destination) - end - - def invoke! - invoke_with_conflict_check do - ::FileUtils.mkdir_p(destination) - end - end - - def revoke! - say_status :remove, :red - ::FileUtils.rm_rf(destination) if !pretend? && exists? - end - - protected - - # Shortcut for pretend. - # - def pretend? - base.options[:pretend] - end - - # Sets the absolute destination value from a relative destination value. - # It also stores the given and relative destination. Let's suppose our - # script is being executed on "dest", it sets the destination root to - # "dest". The destination, given_destination and relative_destination - # are related in the following way: - # - # inside "bar" do - # empty_directory "baz" - # end - # - # destination #=> dest/bar/baz - # relative_destination #=> bar/baz - # given_destination #=> baz - # - def destination=(destination) - if destination - @given_destination = convert_encoded_instructions(destination.to_s) - @destination = ::File.expand_path(@given_destination, base.destination_root) - @relative_destination = base.relative_to_original_destination_root(@destination) - end - end - - # Filenames in the encoded form are converted. If you have a file: - # - # %class_name%.rb - # - # It gets the class name from the base and replace it: - # - # user.rb - # - def convert_encoded_instructions(filename) - filename.gsub(/%(.*?)%/) do |string| - instruction = $1.strip - base.respond_to?(instruction) ? base.send(instruction) : string - end - end - - # Receives a hash of options and just execute the block if some - # conditions are met. - # - def invoke_with_conflict_check(&block) - if exists? - on_conflict_behavior(&block) - else - say_status :create, :green - block.call unless pretend? - end - - destination - end - - # What to do when the destination file already exists. - # - def on_conflict_behavior(&block) - say_status :exist, :blue - end - - # Shortcut to say_status shell method. - # - def say_status(status, color) - base.shell.say_status status, relative_destination, color if config[:verbose] - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb deleted file mode 100644 index d77d90d448..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/file_manipulation.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'erb' -require 'open-uri' - -class Thor - module Actions - - # Copies the file from the relative source to the relative destination. If - # the destination is not given it's assumed to be equal to the source. - # - # ==== Parameters - # source:: the relative path to the source root. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # copy_file "README", "doc/README" - # - # copy_file "doc/README" - # - def copy_file(source, destination=nil, config={}) - destination ||= source - source = File.expand_path(find_in_source_paths(source.to_s)) - - create_file destination, nil, config do - File.read(source) - end - end - - # Gets the content at the given address and places it at the given relative - # destination. If a block is given instead of destination, the content of - # the url is yielded and used as location. - # - # ==== Parameters - # source:: the address of the given content. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # get "http://gist.github.com/103208", "doc/README" - # - # get "http://gist.github.com/103208" do |content| - # content.split("\n").first - # end - # - def get(source, destination=nil, config={}, &block) - source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ /^http\:\/\// - render = open(source).read - - destination ||= if block_given? - block.arity == 1 ? block.call(render) : block.call - else - File.basename(source) - end - - create_file destination, render, config - end - - # Gets an ERB template at the relative source, executes it and makes a copy - # at the relative destination. If the destination is not given it's assumed - # to be equal to the source removing .tt from the filename. - # - # ==== Parameters - # source:: the relative path to the source root. - # destination:: the relative path to the destination root. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # template "README", "doc/README" - # - # template "doc/README" - # - def template(source, destination=nil, config={}) - destination ||= source - source = File.expand_path(find_in_source_paths(source.to_s)) - context = instance_eval('binding') - - create_file destination, nil, config do - ERB.new(::File.read(source), nil, '-').result(context) - end - end - - # Changes the mode of the given file or directory. - # - # ==== Parameters - # mode:: the file mode - # path:: the name of the file to change mode - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # chmod "script/*", 0755 - # - def chmod(path, mode, config={}) - return unless behavior == :invoke - path = File.expand_path(path, destination_root) - say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true) - FileUtils.chmod_R(mode, path) unless options[:pretend] - end - - # Prepend text to a file. Since it depends on inject_into_file, it's reversible. - # - # ==== Parameters - # path:: path of the file to be changed - # data:: the data to prepend to the file, can be also given as a block. - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # prepend_file 'config/environments/test.rb', 'config.gem "rspec"' - # - # prepend_file 'config/environments/test.rb' do - # 'config.gem "rspec"' - # end - # - def prepend_file(path, *args, &block) - config = args.last.is_a?(Hash) ? args.pop : {} - config.merge!(:after => /\A/) - inject_into_file(path, *(args << config), &block) - end - - # Append text to a file. Since it depends on inject_into_file, it's reversible. - # - # ==== Parameters - # path:: path of the file to be changed - # data:: the data to append to the file, can be also given as a block. - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # append_file 'config/environments/test.rb', 'config.gem "rspec"' - # - # append_file 'config/environments/test.rb' do - # 'config.gem "rspec"' - # end - # - def append_file(path, *args, &block) - config = args.last.is_a?(Hash) ? args.pop : {} - config.merge!(:before => /\z/) - inject_into_file(path, *(args << config), &block) - end - - # Injects text right after the class definition. Since it depends on - # inject_into_file, it's reversible. - # - # ==== Parameters - # path:: path of the file to be changed - # klass:: the class to be manipulated - # data:: the data to append to the class, can be also given as a block. - # config:: give :verbose => false to not log the status. - # - # ==== Examples - # - # inject_into_class "app/controllers/application_controller.rb", " filter_parameter :password\n" - # - # inject_into_class "app/controllers/application_controller.rb", ApplicationController do - # " filter_parameter :password\n" - # end - # - def inject_into_class(path, klass, *args, &block) - config = args.last.is_a?(Hash) ? args.pop : {} - config.merge!(:after => /class #{klass}\n|class #{klass} .*\n/) - inject_into_file(path, *(args << config), &block) - end - - # Run a regular expression replacement on a file. - # - # ==== Parameters - # path:: path of the file to be changed - # flag:: the regexp or string to be replaced - # replacement:: the replacement, can be also given as a block - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1' - # - # gsub_file 'README', /rake/, :green do |match| - # match << " no more. Use thor!" - # end - # - def gsub_file(path, flag, *args, &block) - return unless behavior == :invoke - config = args.last.is_a?(Hash) ? args.pop : {} - - path = File.expand_path(path, destination_root) - say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true) - - unless options[:pretend] - content = File.read(path) - content.gsub!(flag, *args, &block) - File.open(path, 'wb') { |file| file.write(content) } - end - end - - # Removes a file at the given location. - # - # ==== Parameters - # path:: path of the file to be changed - # config:: give :verbose => false to not log the status. - # - # ==== Example - # - # remove_file 'README' - # remove_file 'app/controllers/application_controller.rb' - # - def remove_file(path, config={}) - return unless behavior == :invoke - path = File.expand_path(path, destination_root) - - say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) - ::FileUtils.rm_rf(path) if !options[:pretend] && File.exists?(path) - end - alias :remove_dir :remove_file - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb deleted file mode 100644 index 0636ec6591..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/actions/inject_into_file.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'thor/actions/empty_directory' - -class Thor - module Actions - - # Injects the given content into a file. Different from gsub_file, this - # method is reversible. - # - # ==== Parameters - # destination:: Relative path to the destination root - # data:: Data to add to the file. Can be given as a block. - # config:: give :verbose => false to not log the status and the flag - # for injection (:after or :before). - # - # ==== Examples - # - # inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n" - # - # inject_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do - # gems = ask "Which gems would you like to add?" - # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n") - # end - # - def inject_into_file(destination, *args, &block) - if block_given? - data, config = block, args.shift - else - data, config = args.shift, args.shift - end - action InjectIntoFile.new(self, destination, data, config) - end - - class InjectIntoFile < EmptyDirectory #:nodoc: - attr_reader :replacement, :flag, :behavior - - def initialize(base, destination, data, config) - super(base, destination, { :verbose => true }.merge(config)) - - @behavior, @flag = if @config.key?(:after) - [:after, @config.delete(:after)] - else - [:before, @config.delete(:before)] - end - - @replacement = data.is_a?(Proc) ? data.call : data - @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp) - end - - def invoke! - say_status :invoke - - content = if @behavior == :after - '\0' + replacement - else - replacement + '\0' - end - - replace!(/#{flag}/, content) - end - - def revoke! - say_status :revoke - - regexp = if @behavior == :after - content = '\1\2' - /(#{flag})(.*)(#{Regexp.escape(replacement)})/m - else - content = '\2\3' - /(#{Regexp.escape(replacement)})(.*)(#{flag})/m - end - - replace!(regexp, content) - end - - protected - - def say_status(behavior) - status = if flag == /\A/ - behavior == :invoke ? :prepend : :unprepend - elsif flag == /\z/ - behavior == :invoke ? :append : :unappend - else - behavior == :invoke ? :inject : :deinject - end - - super(status, config[:verbose]) - end - - # Adds the content to the file. - # - def replace!(regexp, string) - unless base.options[:pretend] - content = File.read(destination) - content.gsub!(regexp, string) - File.open(destination, 'wb') { |file| file.write(content) } - end - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb deleted file mode 100644 index 700d794123..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/base.rb +++ /dev/null @@ -1,517 +0,0 @@ -require 'thor/core_ext/hash_with_indifferent_access' -require 'thor/core_ext/ordered_hash' -require 'thor/error' -require 'thor/shell' -require 'thor/invocation' -require 'thor/parser' -require 'thor/task' -require 'thor/util' - -class Thor - # Shortcuts for help. - HELP_MAPPINGS = %w(-h -? --help -D) - - # Thor methods that should not be overwritten by the user. - THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root - action add_file create_file in_root inside run run_ruby_script) - - module Base - attr_accessor :options - - # It receives arguments in an Array and two hashes, one for options and - # other for configuration. - # - # Notice that it does not check if all required arguments were supplied. - # It should be done by the parser. - # - # ==== Parameters - # args:: An array of objects. The objects are applied to their - # respective accessors declared with argument. - # - # options:: An options hash that will be available as self.options. - # The hash given is converted to a hash with indifferent - # access, magic predicates (options.skip?) and then frozen. - # - # config:: Configuration for this Thor class. - # - def initialize(args=[], options={}, config={}) - Thor::Arguments.parse(self.class.arguments, args).each do |key, value| - send("#{key}=", value) - end - - parse_options = self.class.class_options - - if options.is_a?(Array) - task_options = config.delete(:task_options) # hook for start - parse_options = parse_options.merge(task_options) if task_options - array_options, hash_options = options, {} - else - array_options, hash_options = [], options - end - - options = Thor::Options.parse(parse_options, array_options) - self.options = Thor::CoreExt::HashWithIndifferentAccess.new(options).merge!(hash_options) - self.options.freeze - end - - class << self - def included(base) #:nodoc: - base.send :extend, ClassMethods - base.send :include, Invocation - base.send :include, Shell - end - - # Returns the classes that inherits from Thor or Thor::Group. - # - # ==== Returns - # Array[Class] - # - def subclasses - @subclasses ||= [] - end - - # Returns the files where the subclasses are kept. - # - # ==== Returns - # Hash[path => Class] - # - def subclass_files - @subclass_files ||= Hash.new{ |h,k| h[k] = [] } - end - - # Whenever a class inherits from Thor or Thor::Group, we should track the - # class and the file on Thor::Base. This is the method responsable for it. - # - def register_klass_file(klass) #:nodoc: - file = caller[1].match(/(.*):\d+/)[1] - Thor::Base.subclasses << klass unless Thor::Base.subclasses.include?(klass) - - file_subclasses = Thor::Base.subclass_files[File.expand_path(file)] - file_subclasses << klass unless file_subclasses.include?(klass) - end - end - - module ClassMethods - # Adds an argument to the class and creates an attr_accessor for it. - # - # Arguments are different from options in several aspects. The first one - # is how they are parsed from the command line, arguments are retrieved - # from position: - # - # thor task NAME - # - # Instead of: - # - # thor task --name=NAME - # - # Besides, arguments are used inside your code as an accessor (self.argument), - # while options are all kept in a hash (self.options). - # - # Finally, arguments cannot have type :default or :boolean but can be - # optional (supplying :optional => :true or :required => false), although - # you cannot have a required argument after a non-required argument. If you - # try it, an error is raised. - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described below. - # - # ==== Options - # :desc - Description for the argument. - # :required - If the argument is required or not. - # :optional - If the argument is optional or not. - # :type - The type of the argument, can be :string, :hash, :array, :numeric. - # :default - Default value for this argument. It cannot be required and have default values. - # :banner - String to show on usage notes. - # - # ==== Errors - # ArgumentError:: Raised if you supply a required argument after a non required one. - # - def argument(name, options={}) - is_thor_reserved_word?(name, :argument) - no_tasks { attr_accessor name } - - required = if options.key?(:optional) - !options[:optional] - elsif options.key?(:required) - options[:required] - else - options[:default].nil? - end - - remove_argument name - - arguments.each do |argument| - next if argument.required? - raise ArgumentError, "You cannot have #{name.to_s.inspect} as required argument after " << - "the non-required argument #{argument.human_name.inspect}." - end if required - - arguments << Thor::Argument.new(name, options[:desc], required, options[:type], - options[:default], options[:banner]) - end - - # Returns this class arguments, looking up in the ancestors chain. - # - # ==== Returns - # Array[Thor::Argument] - # - def arguments - @arguments ||= from_superclass(:arguments, []) - end - - # Adds a bunch of options to the set of class options. - # - # class_options :foo => false, :bar => :required, :baz => :string - # - # If you prefer more detailed declaration, check class_option. - # - # ==== Parameters - # Hash[Symbol => Object] - # - def class_options(options=nil) - @class_options ||= from_superclass(:class_options, {}) - build_options(options, @class_options) if options - @class_options - end - - # Adds an option to the set of class options - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described below. - # - # ==== Options - # :desc - Description for the argument. - # :required - If the argument is required or not. - # :default - Default value for this argument. - # :group - The group for this options. Use by class options to output options in different levels. - # :aliases - Aliases for this option. - # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. - # :banner - String to show on usage notes. - # - def class_option(name, options={}) - build_option(name, options, class_options) - end - - # Removes a previous defined argument. If :undefine is given, undefine - # accessors as well. - # - # ==== Paremeters - # names:: Arguments to be removed - # - # ==== Examples - # - # remove_argument :foo - # remove_argument :foo, :bar, :baz, :undefine => true - # - def remove_argument(*names) - options = names.last.is_a?(Hash) ? names.pop : {} - - names.each do |name| - arguments.delete_if { |a| a.name == name.to_s } - undef_method name, "#{name}=" if options[:undefine] - end - end - - # Removes a previous defined class option. - # - # ==== Paremeters - # names:: Class options to be removed - # - # ==== Examples - # - # remove_class_option :foo - # remove_class_option :foo, :bar, :baz - # - def remove_class_option(*names) - names.each do |name| - class_options.delete(name) - end - end - - # Defines the group. This is used when thor list is invoked so you can specify - # that only tasks from a pre-defined group will be shown. Defaults to standard. - # - # ==== Parameters - # name - # - def group(name=nil) - case name - when nil - @group ||= from_superclass(:group, 'standard') - else - @group = name.to_s - end - end - - # Returns the tasks for this Thor class. - # - # ==== Returns - # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task - # objects as values. - # - def tasks - @tasks ||= Thor::CoreExt::OrderedHash.new - end - - # Returns the tasks for this Thor class and all subclasses. - # - # ==== Returns - # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task - # objects as values. - # - def all_tasks - @all_tasks ||= from_superclass(:all_tasks, Thor::CoreExt::OrderedHash.new) - @all_tasks.merge(tasks) - end - - # Removes a given task from this Thor class. This is usually done if you - # are inheriting from another class and don't want it to be available - # anymore. - # - # By default it only remove the mapping to the task. But you can supply - # :undefine => true to undefine the method from the class as well. - # - # ==== Parameters - # name:: The name of the task to be removed - # options:: You can give :undefine => true if you want tasks the method - # to be undefined from the class as well. - # - def remove_task(*names) - options = names.last.is_a?(Hash) ? names.pop : {} - - names.each do |name| - tasks.delete(name.to_s) - all_tasks.delete(name.to_s) - undef_method name if options[:undefine] - end - end - - # All methods defined inside the given block are not added as tasks. - # - # So you can do: - # - # class MyScript < Thor - # no_tasks do - # def this_is_not_a_task - # end - # end - # end - # - # You can also add the method and remove it from the task list: - # - # class MyScript < Thor - # def this_is_not_a_task - # end - # remove_task :this_is_not_a_task - # end - # - def no_tasks - @no_tasks = true - yield - @no_tasks = false - end - - # Sets the namespace for the Thor or Thor::Group class. By default the - # namespace is retrieved from the class name. If your Thor class is named - # Scripts::MyScript, the help method, for example, will be called as: - # - # thor scripts:my_script -h - # - # If you change the namespace: - # - # namespace :my_scripts - # - # You change how your tasks are invoked: - # - # thor my_scripts -h - # - # Finally, if you change your namespace to default: - # - # namespace :default - # - # Your tasks can be invoked with a shortcut. Instead of: - # - # thor :my_task - # - def namespace(name=nil) - case name - when nil - @namespace ||= Thor::Util.namespace_from_thor_class(self, false) - else - @namespace = name.to_s - end - end - - # Default way to start generators from the command line. - # - def start(given_args=ARGV, config={}) - config[:shell] ||= Thor::Base.shell.new - yield - rescue Thor::Error => e - if given_args.include?("--debug") - raise e - else - config[:shell].error e.message - end - exit(1) if exit_on_failure? - end - - protected - - # Prints the class options per group. If an option does not belong to - # any group, it uses the ungrouped name value. This method provide to - # hooks to add extra options, one of them if the third argument called - # extra_group that should be a hash in the format :group => Array[Options]. - # - # The second is by returning a lambda used to print values. The lambda - # requires two options: the group name and the array of options. - # - def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: - groups = {} - - class_options.each do |_, value| - groups[value.group] ||= [] - groups[value.group] << value - end - - printer = proc do |group_name, options| - list = [] - padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 - - options.each do |option| - item = [ option.usage(padding) ] - item.push(option.description ? "# #{option.description}" : "") - - list << item - list << [ "", "# Default: #{option.default}" ] if option.show_default? - end - - unless list.empty? - shell.say(group_name ? "#{group_name} options:" : "Options:") - shell.print_table(list, :ident => 2) - shell.say "" - end - end - - # Deal with default group - global_options = groups.delete(nil) || [] - printer.call(ungrouped_name, global_options) if global_options - - # Print all others - groups = extra_group.merge(groups) if extra_group - groups.each(&printer) - printer - end - - # Raises an error if the word given is a Thor reserved word. - # - def is_thor_reserved_word?(word, type) #:nodoc: - return false unless THOR_RESERVED_WORDS.include?(word.to_s) - raise "#{word.inspect} is a Thor reserved word and cannot be defined as #{type}" - end - - # Build an option and adds it to the given scope. - # - # ==== Parameters - # name:: The name of the argument. - # options:: Described in both class_option and method_option. - # - def build_option(name, options, scope) #:nodoc: - scope[name] = Thor::Option.new(name, options[:desc], options[:required], - options[:type], options[:default], options[:banner], - options[:group], options[:aliases]) - end - - # Receives a hash of options, parse them and add to the scope. This is a - # fast way to set a bunch of options: - # - # build_options :foo => true, :bar => :required, :baz => :string - # - # ==== Parameters - # Hash[Symbol => Object] - # - def build_options(options, scope) #:nodoc: - options.each do |key, value| - scope[key] = Thor::Option.parse(key, value) - end - end - - # Finds a task with the given name. If the task belongs to the current - # class, just return it, otherwise dup it and add the fresh copy to the - # current task hash. - # - def find_and_refresh_task(name) #:nodoc: - task = if task = tasks[name.to_s] - task - elsif task = all_tasks[name.to_s] - tasks[name.to_s] = task.clone - else - raise ArgumentError, "You supplied :for => #{name.inspect}, but the task #{name.inspect} could not be found." - end - end - - # Everytime someone inherits from a Thor class, register the klass - # and file into baseclass. - # - def inherited(klass) - Thor::Base.register_klass_file(klass) - end - - # Fire this callback whenever a method is added. Added methods are - # tracked as tasks by invoking the create_task method. - # - def method_added(meth) - meth = meth.to_s - - if meth == "initialize" - initialize_added - return - end - - # Return if it's not a public instance method - return unless public_instance_methods.include?(meth) || - public_instance_methods.include?(meth.to_sym) - - return if @no_tasks || !create_task(meth) - - is_thor_reserved_word?(meth, :task) - Thor::Base.register_klass_file(self) - end - - # Retrieves a value from superclass. If it reaches the baseclass, - # returns default. - # - def from_superclass(method, default=nil) - if self == baseclass || !superclass.respond_to?(method, true) - default - else - value = superclass.send(method) - value.dup if value - end - end - - # A flag that makes the process exit with status 1 if any error happens. - # - def exit_on_failure? - false - end - - # SIGNATURE: Sets the baseclass. This is where the superclass lookup - # finishes. - def baseclass #:nodoc: - end - - # SIGNATURE: Creates a new task if valid_task? is true. This method is - # called when a new method is added to the class. - def create_task(meth) #:nodoc: - end - - # SIGNATURE: Defines behavior when the initialize method is added to the - # class. - def initialize_added #:nodoc: - end - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb deleted file mode 100644 index 78bc5cf4bf..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/hash_with_indifferent_access.rb +++ /dev/null @@ -1,75 +0,0 @@ -class Thor - module CoreExt #:nodoc: - - # A hash with indifferent access and magic predicates. - # - # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true - # - # hash[:foo] #=> 'bar' - # hash['foo'] #=> 'bar' - # hash.foo? #=> true - # - class HashWithIndifferentAccess < ::Hash #:nodoc: - - def initialize(hash={}) - super() - hash.each do |key, value| - self[convert_key(key)] = value - end - end - - def [](key) - super(convert_key(key)) - end - - def []=(key, value) - super(convert_key(key), value) - end - - def delete(key) - super(convert_key(key)) - end - - def values_at(*indices) - indices.collect { |key| self[convert_key(key)] } - end - - def merge(other) - dup.merge!(other) - end - - def merge!(other) - other.each do |key, value| - self[convert_key(key)] = value - end - self - end - - protected - - def convert_key(key) - key.is_a?(Symbol) ? key.to_s : key - end - - # Magic predicates. For instance: - # - # options.force? # => !!options['force'] - # options.shebang # => "/usr/lib/local/ruby" - # options.test_framework?(:rspec) # => options[:test_framework] == :rspec - # - def method_missing(method, *args, &block) - method = method.to_s - if method =~ /^(\w+)\?$/ - if args.empty? - !!self[$1] - else - self[$1] == args.first - end - else - self[method] - end - end - - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb deleted file mode 100644 index 27fea5bb35..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/core_ext/ordered_hash.rb +++ /dev/null @@ -1,100 +0,0 @@ -class Thor - module CoreExt #:nodoc: - - if RUBY_VERSION >= '1.9' - class OrderedHash < ::Hash - end - else - # This class is based on the Ruby 1.9 ordered hashes. - # - # It keeps the semantics and most of the efficiency of normal hashes - # while also keeping track of the order in which elements were set. - # - class OrderedHash #:nodoc: - include Enumerable - - Node = Struct.new(:key, :value, :next, :prev) - - def initialize - @hash = {} - end - - def [](key) - @hash[key] && @hash[key].value - end - - def []=(key, value) - if node = @hash[key] - node.value = value - else - node = Node.new(key, value) - - if @first.nil? - @first = @last = node - else - node.prev = @last - @last.next = node - @last = node - end - end - - @hash[key] = node - value - end - - def delete(key) - if node = @hash[key] - prev_node = node.prev - next_node = node.next - - next_node.prev = prev_node if next_node - prev_node.next = next_node if prev_node - - @first = next_node if @first == node - @last = prev_node if @last == node - - value = node.value - end - - @hash.delete(key) - value - end - - def keys - self.map { |k, v| k } - end - - def values - self.map { |k, v| v } - end - - def each - return unless @first - yield [@first.key, @first.value] - node = @first - yield [node.key, node.value] while node = node.next - self - end - - def merge(other) - hash = self.class.new - - self.each do |key, value| - hash[key] = value - end - - other.each do |key, value| - hash[key] = value - end - - hash - end - - def empty? - @hash.empty? - end - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb deleted file mode 100644 index f9b31a35d1..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/error.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Thor - # Thor::Error is raised when it's caused by wrong usage of thor classes. Those - # errors have their backtrace supressed and are nicely shown to the user. - # - # Errors that are caused by the developer, like declaring a method which - # overwrites a thor keyword, it SHOULD NOT raise a Thor::Error. This way, we - # ensure that developer errors are shown with full backtrace. - # - class Error < StandardError - end - - # Raised when a task was not found. - # - class UndefinedTaskError < Error - end - - # Raised when a task was found, but not invoked properly. - # - class InvocationError < Error - end - - class RequiredArgumentMissingError < InvocationError - end - - class MalformattedArgumentError < InvocationError - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb deleted file mode 100644 index 1e59df2313..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/group.rb +++ /dev/null @@ -1,263 +0,0 @@ -# Thor has a special class called Thor::Group. The main difference to Thor class -# is that it invokes all tasks at once. It also include some methods that allows -# invocations to be done at the class method, which are not available to Thor -# tasks. -# -class Thor::Group - class << self - # The descrition for this Thor::Group. If none is provided, but a source root - # exists, tries to find the USAGE one folder above it, otherwise searches - # in the superclass. - # - # ==== Parameters - # description:: The description for this Thor::Group. - # - def desc(description=nil) - case description - when nil - @desc ||= from_superclass(:desc, nil) - else - @desc = description - end - end - - # Start works differently in Thor::Group, it simply invokes all tasks - # inside the class. - # - def start(given_args=ARGV, config={}) - super do - if Thor::HELP_MAPPINGS.include?(given_args.first) - help(config[:shell]) - return - end - - args, opts = Thor::Options.split(given_args) - new(args, opts, config).invoke - end - end - - # Prints help information. - # - # ==== Options - # short:: When true, shows only usage. - # - def help(shell, options={}) - if options[:short] - shell.say banner - else - shell.say "Usage:" - shell.say " #{banner}" - shell.say - class_options_help(shell) - shell.say self.desc if self.desc - end - end - - # Stores invocations for this class merging with superclass values. - # - def invocations #:nodoc: - @invocations ||= from_superclass(:invocations, {}) - end - - # Stores invocation blocks used on invoke_from_option. - # - def invocation_blocks #:nodoc: - @invocation_blocks ||= from_superclass(:invocation_blocks, {}) - end - - # Invoke the given namespace or class given. It adds an instance - # method that will invoke the klass and task. You can give a block to - # configure how it will be invoked. - # - # The namespace/class given will have its options showed on the help - # usage. Check invoke_from_option for more information. - # - def invoke(*names, &block) - options = names.last.is_a?(Hash) ? names.pop : {} - verbose = options.fetch(:verbose, :white) - - names.each do |name| - invocations[name] = false - invocation_blocks[name] = block if block_given? - - class_eval <<-METHOD, __FILE__, __LINE__ - def _invoke_#{name.to_s.gsub(/\W/, '_')} - klass, task = self.class.prepare_for_invocation(nil, #{name.inspect}) - - if klass - say_status :invoke, #{name.inspect}, #{verbose.inspect} - block = self.class.invocation_blocks[#{name.inspect}] - _invoke_for_class_method klass, task, &block - else - say_status :error, %(#{name.inspect} [not found]), :red - end - end - METHOD - end - end - - # Invoke a thor class based on the value supplied by the user to the - # given option named "name". A class option must be created before this - # method is invoked for each name given. - # - # ==== Examples - # - # class GemGenerator < Thor::Group - # class_option :test_framework, :type => :string - # invoke_from_option :test_framework - # end - # - # ==== Boolean options - # - # In some cases, you want to invoke a thor class if some option is true or - # false. This is automatically handled by invoke_from_option. Then the - # option name is used to invoke the generator. - # - # ==== Preparing for invocation - # - # In some cases you want to customize how a specified hook is going to be - # invoked. You can do that by overwriting the class method - # prepare_for_invocation. The class method must necessarily return a klass - # and an optional task. - # - # ==== Custom invocations - # - # You can also supply a block to customize how the option is giong to be - # invoked. The block receives two parameters, an instance of the current - # class and the klass to be invoked. - # - def invoke_from_option(*names, &block) - options = names.last.is_a?(Hash) ? names.pop : {} - verbose = options.fetch(:verbose, :white) - - names.each do |name| - unless class_options.key?(name) - raise ArgumentError, "You have to define the option #{name.inspect} " << - "before setting invoke_from_option." - end - - invocations[name] = true - invocation_blocks[name] = block if block_given? - - class_eval <<-METHOD, __FILE__, __LINE__ - def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')} - return unless options[#{name.inspect}] - - value = options[#{name.inspect}] - value = #{name.inspect} if TrueClass === value - klass, task = self.class.prepare_for_invocation(#{name.inspect}, value) - - if klass - say_status :invoke, value, #{verbose.inspect} - block = self.class.invocation_blocks[#{name.inspect}] - _invoke_for_class_method klass, task, &block - else - say_status :error, %(\#{value} [not found]), :red - end - end - METHOD - end - end - - # Remove a previously added invocation. - # - # ==== Examples - # - # remove_invocation :test_framework - # - def remove_invocation(*names) - names.each do |name| - remove_task(name) - remove_class_option(name) - invocations.delete(name) - invocation_blocks.delete(name) - end - end - - # Overwrite class options help to allow invoked generators options to be - # shown recursively when invoking a generator. - # - def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: - group_options = {} - - get_options_from_invocations(group_options, class_options) do |klass| - klass.send(:get_options_from_invocations, group_options, class_options) - end - - group_options.merge!(extra_group) if extra_group - super(shell, ungrouped_name, group_options) - end - - # Get invocations array and merge options from invocations. Those - # options are added to group_options hash. Options that already exists - # in base_options are not added twice. - # - def get_options_from_invocations(group_options, base_options) #:nodoc: - invocations.each do |name, from_option| - value = if from_option - option = class_options[name] - option.type == :boolean ? name : option.default - else - name - end - next unless value - - klass, task = prepare_for_invocation(name, value) - next unless klass && klass.respond_to?(:class_options) - - value = value.to_s - human_name = value.respond_to?(:classify) ? value.classify : value - - group_options[human_name] ||= [] - group_options[human_name] += klass.class_options.values.select do |option| - base_options[option.name.to_sym].nil? && option.group.nil? && - !group_options.values.flatten.any? { |i| i.name == option.name } - end - - yield klass if block_given? - end - end - - protected - - # The banner for this class. You can customize it if you are invoking the - # thor class by another ways which is not the Thor::Runner. - # - def banner - "#{self.namespace} #{self.arguments.map {|a| a.usage }.join(' ')}" - end - - def baseclass #:nodoc: - Thor::Group - end - - def create_task(meth) #:nodoc: - tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) - true - end - end - - include Thor::Base - - protected - - # Shortcut to invoke with padding and block handling. Use internally by - # invoke and invoke_from_option class methods. - # - def _invoke_for_class_method(klass, task=nil, *args, &block) #:nodoc: - shell.padding += 1 - - result = if block_given? - if block.arity == 2 - block.call(self, klass) - else - block.call(self, klass, task) - end - else - invoke klass, task, *args - end - - shell.padding -= 1 - result - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb deleted file mode 100644 index 32e6a72454..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/invocation.rb +++ /dev/null @@ -1,178 +0,0 @@ -class Thor - module Invocation - def self.included(base) #:nodoc: - base.extend ClassMethods - end - - module ClassMethods - # Prepare for class methods invocations. This method must return a klass to - # have the invoked class options showed in help messages in generators. - # - def prepare_for_invocation(key, name) #:nodoc: - case name - when Symbol, String - Thor::Util.namespace_to_thor_class_and_task(name.to_s, false) - else - name - end - end - end - - # Make initializer aware of invocations and the initializer proc. - # - def initialize(args=[], options={}, config={}, &block) #:nodoc: - @_invocations = config[:invocations] || Hash.new { |h,k| h[k] = [] } - @_initializer = [ args, options, config ] - super - end - - # Receives a name and invokes it. The name can be a string (either "task" or - # "namespace:task"), a Thor::Task, a Class or a Thor instance. If the task - # cannot be guessed by name, it can also be supplied as second argument. - # - # You can also supply the arguments, options and configuration values for - # the task to be invoked, if none is given, the same values used to - # initialize the invoker are used to initialize the invoked. - # - # ==== Examples - # - # class A < Thor - # def foo - # invoke :bar - # invoke "b:hello", ["José"] - # end - # - # def bar - # invoke "b:hello", ["José"] - # end - # end - # - # class B < Thor - # def hello(name) - # puts "hello #{name}" - # end - # end - # - # You can notice that the method "foo" above invokes two tasks: "bar", - # which belongs to the same class and "hello" which belongs to the class B. - # - # By using an invocation system you ensure that a task is invoked only once. - # In the example above, invoking "foo" will invoke "b:hello" just once, even - # if it's invoked later by "bar" method. - # - # When class A invokes class B, all arguments used on A initialization are - # supplied to B. This allows lazy parse of options. Let's suppose you have - # some rspec tasks: - # - # class Rspec < Thor::Group - # class_option :mock_framework, :type => :string, :default => :rr - # - # def invoke_mock_framework - # invoke "rspec:#{options[:mock_framework]}" - # end - # end - # - # As you noticed, it invokes the given mock framework, which might have its - # own options: - # - # class Rspec::RR < Thor::Group - # class_option :style, :type => :string, :default => :mock - # end - # - # Since it's not rspec concern to parse mock framework options, when RR - # is invoked all options are parsed again, so RR can extract only the options - # that it's going to use. - # - # If you want Rspec::RR to be initialized with its own set of options, you - # have to do that explicitely: - # - # invoke "rspec:rr", [], :style => :foo - # - # Besides giving an instance, you can also give a class to invoke: - # - # invoke Rspec::RR, [], :style => :foo - # - def invoke(name=nil, task=nil, args=nil, opts=nil, config=nil) - task, args, opts, config = nil, task, args, opts if task.nil? || task.is_a?(Array) - args, opts, config = nil, args, opts if args.is_a?(Hash) - - object, task = _prepare_for_invocation(name, task) - klass, instance = _initialize_klass_with_initializer(object, args, opts, config) - - method_args = [] - current = @_invocations[klass] - - iterator = proc do |_, task| - unless current.include?(task.name) - current << task.name - task.run(instance, method_args) - end - end - - if task - args ||= [] - method_args = args[Range.new(klass.arguments.size, -1)] || [] - iterator.call(nil, task) - else - klass.all_tasks.map(&iterator) - end - end - - protected - - # Configuration values that are shared between invocations. - # - def _shared_configuration #:nodoc: - { :invocations => @_invocations } - end - - # Prepare for invocation in the instance level. In this case, we have to - # take into account that a just a task name from the current class was - # given or even a Thor::Task object. - # - def _prepare_for_invocation(name, sent_task=nil) #:nodoc: - if name.is_a?(Thor::Task) - task = name - elsif task = self.class.all_tasks[name.to_s] - object = self - else - object, task = self.class.prepare_for_invocation(nil, name) - task ||= sent_task - end - - # If the object was not set, use self and use the name as task. - object, task = self, name unless object - return object, _validate_task(object, task) - end - - # Check if the object given is a Thor class object and get a task object - # for it. - # - def _validate_task(object, task) #:nodoc: - klass = object.is_a?(Class) ? object : object.class - raise "Expected Thor class, got #{klass}" unless klass <= Thor::Base - - task ||= klass.default_task if klass <= Thor - task = klass.all_tasks[task.to_s] || Thor::Task::Dynamic.new(task) if task && !task.is_a?(Thor::Task) - task - end - - # Initialize klass using values stored in the @_initializer. - # - def _initialize_klass_with_initializer(object, args, opts, config) #:nodoc: - if object.is_a?(Class) - klass = object - - stored_args, stored_opts, stored_config = @_initializer - args ||= stored_args.dup - opts ||= stored_opts.dup - - config ||= {} - config = stored_config.merge(_shared_configuration).merge!(config) - [ klass, klass.new(args, opts, config) ] - else - [ object.class, object ] - end - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb deleted file mode 100644 index 57a3f6e1a5..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'thor/parser/argument' -require 'thor/parser/arguments' -require 'thor/parser/option' -require 'thor/parser/options' diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb deleted file mode 100644 index aa8ace4719..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/argument.rb +++ /dev/null @@ -1,67 +0,0 @@ -class Thor - class Argument #:nodoc: - VALID_TYPES = [ :numeric, :hash, :array, :string ] - - attr_reader :name, :description, :required, :type, :default, :banner - alias :human_name :name - - def initialize(name, description=nil, required=true, type=:string, default=nil, banner=nil) - class_name = self.class.name.split("::").last - - raise ArgumentError, "#{class_name} name can't be nil." if name.nil? - raise ArgumentError, "Type :#{type} is not valid for #{class_name.downcase}s." if type && !valid_type?(type) - - @name = name.to_s - @description = description - @required = required || false - @type = (type || :string).to_sym - @default = default - @banner = banner || default_banner - - validate! # Trigger specific validations - end - - def usage - required? ? banner : "[#{banner}]" - end - - def required? - required - end - - def show_default? - case default - when Array, String, Hash - !default.empty? - else - default - end - end - - protected - - def validate! - raise ArgumentError, "An argument cannot be required and have default value." if required? && !default.nil? - end - - def valid_type?(type) - VALID_TYPES.include?(type.to_sym) - end - - def default_banner - case type - when :boolean - nil - when :string, :default - human_name.upcase - when :numeric - "N" - when :hash - "key:value" - when :array - "one two three" - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb deleted file mode 100644 index fb5d965e06..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/arguments.rb +++ /dev/null @@ -1,145 +0,0 @@ -class Thor - class Arguments #:nodoc: - NUMERIC = /(\d*\.\d+|\d+)/ - - # Receives an array of args and returns two arrays, one with arguments - # and one with switches. - # - def self.split(args) - arguments = [] - - args.each do |item| - break if item =~ /^-/ - arguments << item - end - - return arguments, args[Range.new(arguments.size, -1)] - end - - def self.parse(base, args) - new(base).parse(args) - end - - # Takes an array of Thor::Argument objects. - # - def initialize(arguments=[]) - @assigns, @non_assigned_required = {}, [] - @switches = arguments - - arguments.each do |argument| - if argument.default - @assigns[argument.human_name] = argument.default - elsif argument.required? - @non_assigned_required << argument - end - end - end - - def parse(args) - @pile = args.dup - - @switches.each do |argument| - break unless peek - @non_assigned_required.delete(argument) - @assigns[argument.human_name] = send(:"parse_#{argument.type}", argument.human_name) - end - - check_requirement! - @assigns - end - - private - - def peek - @pile.first - end - - def shift - @pile.shift - end - - def unshift(arg) - unless arg.kind_of?(Array) - @pile.unshift(arg) - else - @pile = arg + @pile - end - end - - def current_is_value? - peek && peek.to_s !~ /^-/ - end - - # Runs through the argument array getting strings that contains ":" and - # mark it as a hash: - # - # [ "name:string", "age:integer" ] - # - # Becomes: - # - # { "name" => "string", "age" => "integer" } - # - def parse_hash(name) - return shift if peek.is_a?(Hash) - hash = {} - - while current_is_value? && peek.include?(?:) - key, value = shift.split(':') - hash[key] = value - end - hash - end - - # Runs through the argument array getting all strings until no string is - # found or a switch is found. - # - # ["a", "b", "c"] - # - # And returns it as an array: - # - # ["a", "b", "c"] - # - def parse_array(name) - return shift if peek.is_a?(Array) - array = [] - - while current_is_value? - array << shift - end - array - end - - # Check if the peel is numeric ofrmat and return a Float or Integer. - # Otherwise raises an error. - # - def parse_numeric(name) - return shift if peek.is_a?(Numeric) - - unless peek =~ NUMERIC && $& == peek - raise MalformattedArgumentError, "expected numeric value for '#{name}'; got #{peek.inspect}" - end - - $&.index('.') ? shift.to_f : shift.to_i - end - - # Parse string, i.e., just return the current value in the pile. - # - def parse_string(name) - shift - end - - # Raises an error if @non_assigned_required array is not empty. - # - def check_requirement! - unless @non_assigned_required.empty? - names = @non_assigned_required.map do |o| - o.respond_to?(:switch_name) ? o.switch_name : o.human_name - end.join("', '") - - class_name = self.class.name.split('::').last.downcase - raise RequiredArgumentMissingError, "no value provided for required #{class_name} '#{names}'" - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb deleted file mode 100644 index 9e40ec73fa..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/option.rb +++ /dev/null @@ -1,132 +0,0 @@ -class Thor - class Option < Argument #:nodoc: - attr_reader :aliases, :group - - VALID_TYPES = [:boolean, :numeric, :hash, :array, :string] - - def initialize(name, description=nil, required=nil, type=nil, default=nil, banner=nil, group=nil, aliases=nil) - super(name, description, required, type, default, banner) - @aliases = [*aliases].compact - @group = group.to_s.capitalize if group - end - - # This parse quick options given as method_options. It makes several - # assumptions, but you can be more specific using the option method. - # - # parse :foo => "bar" - # #=> Option foo with default value bar - # - # parse [:foo, :baz] => "bar" - # #=> Option foo with default value bar and alias :baz - # - # parse :foo => :required - # #=> Required option foo without default value - # - # parse :foo => 2 - # #=> Option foo with default value 2 and type numeric - # - # parse :foo => :numeric - # #=> Option foo without default value and type numeric - # - # parse :foo => true - # #=> Option foo with default value true and type boolean - # - # The valid types are :boolean, :numeric, :hash, :array and :string. If none - # is given a default type is assumed. This default type accepts arguments as - # string (--foo=value) or booleans (just --foo). - # - # By default all options are optional, unless :required is given. - # - def self.parse(key, value) - if key.is_a?(Array) - name, *aliases = key - else - name, aliases = key, [] - end - - name = name.to_s - default = value - - type = case value - when Symbol - default = nil - - if VALID_TYPES.include?(value) - value - elsif required = (value == :required) - :string - elsif value == :optional - # TODO Remove this warning in the future. - warn "Optional type is deprecated. Choose :boolean or :string instead. Assumed to be :boolean." - :boolean - end - when TrueClass, FalseClass - :boolean - when Numeric - :numeric - when Hash, Array, String - value.class.name.downcase.to_sym - end - - self.new(name.to_s, nil, required, type, default, nil, nil, aliases) - end - - def switch_name - @switch_name ||= dasherized? ? name : dasherize(name) - end - - def human_name - @human_name ||= dasherized? ? undasherize(name) : name - end - - def usage(padding=0) - sample = if banner && !banner.to_s.empty? - "#{switch_name}=#{banner}" - else - switch_name - end - - sample = "[#{sample}]" unless required? - - if aliases.empty? - (" " * padding) << sample - else - "#{aliases.join(', ')}, #{sample}" - end - end - - # Allow some type predicates as: boolean?, string? and etc. - # - def method_missing(method, *args, &block) - given = method.to_s.sub(/\?$/, '').to_sym - if valid_type?(given) - self.type == given - else - super - end - end - - protected - - def validate! - raise ArgumentError, "An option cannot be boolean and required." if boolean? && required? - end - - def valid_type?(type) - VALID_TYPES.include?(type.to_sym) - end - - def dasherized? - name.index('-') == 0 - end - - def undasherize(str) - str.sub(/^-{1,2}/, '') - end - - def dasherize(str) - (str.length > 1 ? "--" : "-") + str.gsub('_', '-') - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb deleted file mode 100644 index 75092308b5..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/parser/options.rb +++ /dev/null @@ -1,142 +0,0 @@ -class Thor - # This is a modified version of Daniel Berger's Getopt::Long class, licensed - # under Ruby's license. - # - class Options < Arguments #:nodoc: - LONG_RE = /^(--\w+[-\w+]*)$/ - SHORT_RE = /^(-[a-z])$/i - EQ_RE = /^(--\w+[-\w+]*|-[a-z])=(.*)$/i - SHORT_SQ_RE = /^-([a-z]{2,})$/i # Allow either -x -v or -xv style for single char args - SHORT_NUM = /^(-[a-z])#{NUMERIC}$/i - - # Receives a hash and makes it switches. - # - def self.to_switches(options) - options.map do |key, value| - case value - when true - "--#{key}" - when Array - "--#{key} #{value.map{ |v| v.inspect }.join(' ')}" - when Hash - "--#{key} #{value.map{ |k,v| "#{k}:#{v}" }.join(' ')}" - when nil, false - "" - else - "--#{key} #{value.inspect}" - end - end.join(" ") - end - - # Takes a hash of Thor::Option objects. - # - def initialize(options={}) - options = options.values - super(options) - @shorts, @switches = {}, {} - - options.each do |option| - @switches[option.switch_name] = option - - option.aliases.each do |short| - @shorts[short.to_s] ||= option.switch_name - end - end - end - - def parse(args) - @pile = args.dup - - while peek - if current_is_switch? - case shift - when SHORT_SQ_RE - unshift($1.split('').map { |f| "-#{f}" }) - next - when EQ_RE, SHORT_NUM - unshift($2) - switch = $1 - when LONG_RE, SHORT_RE - switch = $1 - end - - switch = normalize_switch(switch) - next unless option = switch_option(switch) - - @assigns[option.human_name] = parse_peek(switch, option) - else - shift - end - end - - check_requirement! - @assigns - end - - protected - - # Returns true if the current value in peek is a registered switch. - # - def current_is_switch? - case peek - when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM - switch?($1) - when SHORT_SQ_RE - $1.split('').any? { |f| switch?("-#{f}") } - end - end - - def switch?(arg) - switch_option(arg) || @shorts.key?(arg) - end - - def switch_option(arg) - if match = no_or_skip?(arg) - @switches[arg] || @switches["--#{match}"] - else - @switches[arg] - end - end - - def no_or_skip?(arg) - arg =~ /^--(no|skip)-([-\w]+)$/ - $2 - end - - # Check if the given argument is actually a shortcut. - # - def normalize_switch(arg) - @shorts.key?(arg) ? @shorts[arg] : arg - end - - # Parse boolean values which can be given as --foo=true, --foo or --no-foo. - # - def parse_boolean(switch) - if current_is_value? - ["true", "TRUE", "t", "T", true].include?(shift) - else - @switches.key?(switch) || !no_or_skip?(switch) - end - end - - # Parse the value at the peek analyzing if it requires an input or not. - # - def parse_peek(switch, option) - unless current_is_value? - if option.boolean? - # No problem for boolean types - elsif no_or_skip?(switch) - return nil # User set value to nil - elsif option.string? && !option.required? - return option.human_name # Return the option name - else - raise MalformattedArgumentError, "no value provided for option '#{switch}'" - end - end - - @non_assigned_required.delete(option) - send(:"parse_#{option.type}", switch) - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb deleted file mode 100644 index 0d0757fdda..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/rake_compat.rb +++ /dev/null @@ -1,66 +0,0 @@ -require 'rake' - -class Thor - # Adds a compatibility layer to your Thor classes which allows you to use - # rake package tasks. For example, to use rspec rake tasks, one can do: - # - # require 'thor/rake_compat' - # - # class Default < Thor - # include Thor::RakeCompat - # - # Spec::Rake::SpecTask.new(:spec) do |t| - # t.spec_opts = ['--options', "spec/spec.opts"] - # t.spec_files = FileList['spec/**/*_spec.rb'] - # end - # end - # - module RakeCompat - def self.rake_classes - @rake_classes ||= [] - end - - def self.included(base) - # Hack. Make rakefile point to invoker, so rdoc task is generated properly. - rakefile = File.basename(caller[0].match(/(.*):\d+/)[1]) - Rake.application.instance_variable_set(:@rakefile, rakefile) - self.rake_classes << base - end - end -end - -class Object #:nodoc: - alias :rake_task :task - alias :rake_namespace :namespace - - def task(*args, &block) - task = rake_task(*args, &block) - - if klass = Thor::RakeCompat.rake_classes.last - non_namespaced_name = task.name.split(':').last - - description = non_namespaced_name - description << task.arg_names.map{ |n| n.to_s.upcase }.join(' ') - description.strip! - - klass.desc description, task.comment || non_namespaced_name - klass.send :define_method, non_namespaced_name do |*args| - Rake::Task[task.name.to_sym].invoke(*args) - end - end - - task - end - - def namespace(name, &block) - if klass = Thor::RakeCompat.rake_classes.last - const_name = Thor::Util.camel_case(name.to_s).to_sym - klass.const_set(const_name, Class.new(Thor)) - new_klass = klass.const_get(const_name) - Thor::RakeCompat.rake_classes << new_klass - end - - rake_namespace(name, &block) - Thor::RakeCompat.rake_classes.pop - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb deleted file mode 100644 index 9dc70ea069..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/runner.rb +++ /dev/null @@ -1,299 +0,0 @@ -require 'fileutils' -require 'open-uri' -require 'yaml' -require 'digest/md5' -require 'pathname' - -class Thor::Runner < Thor #:nodoc: - map "-T" => :list, "-i" => :install, "-u" => :update - - # Override Thor#help so it can give information about any class and any method. - # - def help(meth=nil) - if meth && !self.respond_to?(meth) - initialize_thorfiles(meth) - klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) - # Send mapping -h because it works with Thor::Group too - klass.start(["-h", task].compact, :shell => self.shell) - else - super - end - end - - # If a task is not found on Thor::Runner, method missing is invoked and - # Thor::Runner is then responsable for finding the task in all classes. - # - def method_missing(meth, *args) - meth = meth.to_s - initialize_thorfiles(meth) - klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) - args.unshift(task) if task - klass.start(args, :shell => shell) - end - - desc "install NAME", "Install an optionally named Thor file into your system tasks" - method_options :as => :string, :relative => :boolean - def install(name) - initialize_thorfiles - - # If a directory name is provided as the argument, look for a 'main.thor' - # task in said directory. - begin - if File.directory?(File.expand_path(name)) - base, package = File.join(name, "main.thor"), :directory - contents = open(base).read - else - base, package = name, :file - contents = open(name).read - end - rescue OpenURI::HTTPError - raise Error, "Error opening URI '#{name}'" - rescue Errno::ENOENT - raise Error, "Error opening file '#{name}'" - end - - say "Your Thorfile contains:" - say contents - - return false if no?("Do you wish to continue [y/N]?") - - as = options["as"] || begin - first_line = contents.split("\n")[0] - (match = first_line.match(/\s*#\s*module:\s*([^\n]*)/)) ? match[1].strip : nil - end - - unless as - basename = File.basename(name) - as = ask("Please specify a name for #{name} in the system repository [#{basename}]:") - as = basename if as.empty? - end - - location = if options[:relative] || name =~ /^http:\/\// - name - else - File.expand_path(name) - end - - thor_yaml[as] = { - :filename => Digest::MD5.hexdigest(name + as), - :location => location, - :namespaces => Thor::Util.namespaces_in_content(contents, base) - } - - save_yaml(thor_yaml) - say "Storing thor file in your system repository" - destination = File.join(thor_root, thor_yaml[as][:filename]) - - if package == :file - File.open(destination, "w") { |f| f.puts contents } - else - FileUtils.cp_r(name, destination) - end - - thor_yaml[as][:filename] # Indicate success - end - - desc "uninstall NAME", "Uninstall a named Thor module" - def uninstall(name) - raise Error, "Can't find module '#{name}'" unless thor_yaml[name] - say "Uninstalling #{name}." - FileUtils.rm_rf(File.join(thor_root, "#{thor_yaml[name][:filename]}")) - - thor_yaml.delete(name) - save_yaml(thor_yaml) - - puts "Done." - end - - desc "update NAME", "Update a Thor file from its original location" - def update(name) - raise Error, "Can't find module '#{name}'" if !thor_yaml[name] || !thor_yaml[name][:location] - - say "Updating '#{name}' from #{thor_yaml[name][:location]}" - - old_filename = thor_yaml[name][:filename] - self.options = self.options.merge("as" => name) - filename = install(thor_yaml[name][:location]) - - unless filename == old_filename - File.delete(File.join(thor_root, old_filename)) - end - end - - desc "installed", "List the installed Thor modules and tasks" - method_options :internal => :boolean - def installed - initialize_thorfiles(nil, true) - - klasses = Thor::Base.subclasses - klasses -= [Thor, Thor::Runner] unless options["internal"] - - display_klasses(true, klasses) - end - - desc "list [SEARCH]", "List the available thor tasks (--substring means .*SEARCH)" - method_options :substring => :boolean, :group => :string, :all => :boolean - def list(search="") - initialize_thorfiles - - search = ".*#{search}" if options["substring"] - search = /^#{search}.*/i - group = options[:group] || "standard" - - klasses = Thor::Base.subclasses.select do |k| - (options[:all] || k.group == group) && k.namespace =~ search - end - - display_klasses(false, klasses) - end - - private - - def thor_root - Thor::Util.thor_root - end - - def thor_yaml - @thor_yaml ||= begin - yaml_file = File.join(thor_root, "thor.yml") - yaml = YAML.load_file(yaml_file) if File.exists?(yaml_file) - yaml || {} - end - end - - # Save the yaml file. If none exists in thor root, creates one. - # - def save_yaml(yaml) - yaml_file = File.join(thor_root, "thor.yml") - - unless File.exists?(yaml_file) - FileUtils.mkdir_p(thor_root) - yaml_file = File.join(thor_root, "thor.yml") - FileUtils.touch(yaml_file) - end - - File.open(yaml_file, "w") { |f| f.puts yaml.to_yaml } - end - - def self.exit_on_failure? - true - end - - # Load the thorfiles. If relevant_to is supplied, looks for specific files - # in the thor_root instead of loading them all. - # - # By default, it also traverses the current path until find Thor files, as - # described in thorfiles. This look up can be skipped by suppliying - # skip_lookup true. - # - def initialize_thorfiles(relevant_to=nil, skip_lookup=false) - thorfiles(relevant_to, skip_lookup).each do |f| - Thor::Util.load_thorfile(f) unless Thor::Base.subclass_files.keys.include?(File.expand_path(f)) - end - end - - # Finds Thorfiles by traversing from your current directory down to the root - # directory of your system. If at any time we find a Thor file, we stop. - # - # We also ensure that system-wide Thorfiles are loaded first, so local - # Thorfiles can override them. - # - # ==== Example - # - # If we start at /Users/wycats/dev/thor ... - # - # 1. /Users/wycats/dev/thor - # 2. /Users/wycats/dev - # 3. /Users/wycats <-- we find a Thorfile here, so we stop - # - # Suppose we start at c:\Documents and Settings\james\dev\thor ... - # - # 1. c:\Documents and Settings\james\dev\thor - # 2. c:\Documents and Settings\james\dev - # 3. c:\Documents and Settings\james - # 4. c:\Documents and Settings - # 5. c:\ <-- no Thorfiles found! - # - def thorfiles(relevant_to=nil, skip_lookup=false) - # TODO Remove this dealing with deprecated thor when :namespaces: is available as constants - save_yaml(thor_yaml) if Thor::Util.convert_constants_to_namespaces(thor_yaml) - - thorfiles = [] - - unless skip_lookup - Pathname.pwd.ascend do |path| - thorfiles = Thor::Util.globs_for(path).map { |g| Dir[g] }.flatten - break unless thorfiles.empty? - end - end - - files = (relevant_to ? thorfiles_relevant_to(relevant_to) : Thor::Util.thor_root_glob) - files += thorfiles - files -= ["#{thor_root}/thor.yml"] - - files.map! do |file| - File.directory?(file) ? File.join(file, "main.thor") : file - end - end - - # Load thorfiles relevant to the given method. If you provide "foo:bar" it - # will load all thor files in the thor.yaml that has "foo" e "foo:bar" - # namespaces registered. - # - def thorfiles_relevant_to(meth) - lookup = [ meth, meth.split(":")[0...-1].join(":") ] - - files = thor_yaml.select do |k, v| - v[:namespaces] && !(v[:namespaces] & lookup).empty? - end - - files.map { |k, v| File.join(thor_root, "#{v[:filename]}") } - end - - # Display information about the given klasses. If with_module is given, - # it shows a table with information extracted from the yaml file. - # - def display_klasses(with_modules=false, klasses=Thor.subclasses) - klasses -= [Thor, Thor::Runner] unless with_modules - raise Error, "No Thor tasks available" if klasses.empty? - - if with_modules && !thor_yaml.empty? - info = [] - labels = ["Modules", "Namespaces"] - - info << labels - info << [ "-" * labels[0].size, "-" * labels[1].size ] - - thor_yaml.each do |name, hash| - info << [ name, hash[:namespaces].join(", ") ] - end - - print_table info - say "" - end - - unless klasses.empty? - klasses.dup.each do |klass| - klasses -= Thor::Util.thor_classes_in(klass) - end - - klasses.each { |k| display_tasks(k) } - else - say "\033[1;34mNo Thor tasks available\033[0m" - end - end - - # Display tasks from the given Thor class. - # - def display_tasks(klass) - unless klass.tasks.empty? - base = klass.namespace - - color = base == "default" ? :magenta : :blue - say shell.set_color(base, color, true) - say "-" * base.length - - klass.help(shell, :short => true, :ident => 0, :namespace => true) - end - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb deleted file mode 100644 index 1dc8f0e5b4..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell.rb +++ /dev/null @@ -1,78 +0,0 @@ -require 'rbconfig' -require 'thor/shell/color' - -class Thor - module Base - # Returns the shell used in all Thor classes. If you are in a Unix platform - # it will use a colored log, otherwise it will use a basic one without color. - # - def self.shell - @shell ||= if Config::CONFIG['host_os'] =~ /mswin|mingw/ - Thor::Shell::Basic - else - Thor::Shell::Color - end - end - - # Sets the shell used in all Thor classes. - # - def self.shell=(klass) - @shell = klass - end - end - - module Shell - SHELL_DELEGATED_METHODS = [:ask, :yes?, :no?, :say, :say_status, :print_list, :print_table] - - # Add shell to initialize config values. - # - # ==== Configuration - # shell:: An instance of the shell to be used. - # - # ==== Examples - # - # class MyScript < Thor - # argument :first, :type => :numeric - # end - # - # MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new - # - def initialize(args=[], options={}, config={}) - super - self.shell = config[:shell] - self.shell.base ||= self if self.shell.respond_to?(:base) - end - - # Holds the shell for the given Thor instance. If no shell is given, - # it gets a default shell from Thor::Base.shell. - # - def shell - @shell ||= Thor::Base.shell.new - end - - # Sets the shell for this thor class. - # - def shell=(shell) - @shell = shell - end - - # Common methods that are delegated to the shell. - # - SHELL_DELEGATED_METHODS.each do |method| - module_eval <<-METHOD, __FILE__, __LINE__ - def #{method}(*args) - shell.#{method}(*args) - end - METHOD - end - - protected - - # Allow shell to be shared between invocations. - # - def _shared_configuration #:nodoc: - super.merge!(:shell => self.shell) - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb deleted file mode 100644 index ea9665380b..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/shell/basic.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'tempfile' - -class Thor - module Shell - class Basic - attr_accessor :base, :padding - - # Initialize base and padding to nil. - # - def initialize #:nodoc: - @base, @padding = nil, 0 - end - - # Sets the output padding, not allowing less than zero values. - # - def padding=(value) - @padding = [0, value].max - end - - # Ask something to the user and receives a response. - # - # ==== Example - # ask("What is your name?") - # - def ask(statement, color=nil) - say("#{statement} ", color) - $stdin.gets.strip - end - - # Say (print) something to the user. If the sentence ends with a whitespace - # or tab character, a new line is not appended (print + flush). Otherwise - # are passed straight to puts (behavior got from Highline). - # - # ==== Example - # say("I know you knew that.") - # - def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)$/)) - message = message.to_s - message = set_color(message, color) if color - - if force_new_line - $stdout.puts(message) - else - $stdout.print(message) - $stdout.flush - end - end - - # Say a status with the given color and appends the message. Since this - # method is used frequently by actions, it allows nil or false to be given - # in log_status, avoiding the message from being shown. If a Symbol is - # given in log_status, it's used as the color. - # - def say_status(status, message, log_status=true) - return if quiet? || log_status == false - spaces = " " * (padding + 1) - color = log_status.is_a?(Symbol) ? log_status : :green - - status = status.to_s.rjust(12) - status = set_color status, color, true if color - say "#{status}#{spaces}#{message}", nil, true - end - - # Make a question the to user and returns true if the user replies "y" or - # "yes". - # - def yes?(statement, color=nil) - ask(statement, color) =~ is?(:yes) - end - - # Make a question the to user and returns true if the user replies "n" or - # "no". - # - def no?(statement, color=nil) - !yes?(statement, color) - end - - # Prints a list of items. - # - # ==== Parameters - # list - # - # ==== Options - # mode:: Can be :rows or :inline. Defaults to :rows. - # ident:: Ident each item with the value given. - # - def print_list(list, options={}) - return if list.empty? - - ident = " " * (options[:ident] || 0) - content = case options[:mode] - when :inline - last = list.pop - "#{list.join(", ")}, and #{last}" - else # rows - ident + list.join("\n#{ident}") - end - - $stdout.puts content - end - - # Prints a table. - # - # ==== Parameters - # Array[Array[String, String, ...]] - # - # ==== Options - # ident:: Ident the first column by ident value. - # - def print_table(table, options={}) - return if table.empty? - - formats = [] - 0.upto(table.first.length - 2) do |i| - maxima = table.max{ |a,b| a[i].size <=> b[i].size }[i].size - formats << "%-#{maxima + 2}s" - end - - formats[0] = formats[0].insert(0, " " * options[:ident]) if options[:ident] - formats << "%s" - - table.each do |row| - row.each_with_index do |column, i| - $stdout.print formats[i] % column.to_s - end - $stdout.puts - end - end - - # Deals with file collision and returns true if the file should be - # overwriten and false otherwise. If a block is given, it uses the block - # response as the content for the diff. - # - # ==== Parameters - # destination:: the destination file to solve conflicts - # block:: an optional block that returns the value to be used in diff - # - def file_collision(destination) - return true if @always_force - options = block_given? ? "[Ynaqdh]" : "[Ynaqh]" - - while true - answer = ask %[Overwrite #{destination}? (enter "h" for help) #{options}] - - case answer - when is?(:yes), is?(:force) - return true - when is?(:no), is?(:skip) - return false - when is?(:always) - return @always_force = true - when is?(:quit) - say 'Aborting...' - raise SystemExit - when is?(:diff) - show_diff(destination, yield) if block_given? - say 'Retrying...' - else - say file_collision_help - end - end - end - - # Called if something goes wrong during the execution. This is used by Thor - # internally and should not be used inside your scripts. If someone went - # wrong, you can always raise an exception. If you raise a Thor::Error, it - # will be rescued and wrapped in the method below. - # - def error(statement) - $stderr.puts statement - end - - # Apply color to the given string with optional bold. Disabled in the - # Thor::Shell::Basic class. - # - def set_color(string, color, bold=false) #:nodoc: - string - end - - protected - - def is?(value) #:nodoc: - value = value.to_s - - if value.size == 1 - /\A#{value}\z/i - else - /\A(#{value}|#{value[0,1]})\z/i - end - end - - def file_collision_help #:nodoc: -< e - parse_argument_error(instance, e, caller) - rescue NoMethodError => e - parse_no_method_error(instance, e) - end - - # Returns the formatted usage. If a class is given, the class arguments are - # injected in the usage. - # - def formatted_usage(klass=nil, namespace=false, show_options=true) - formatted = if namespace.is_a?(String) - "#{namespace}:" - elsif klass && namespace - "#{klass.namespace.gsub(/^default/,'')}:" - else - "" - end - - formatted << formatted_arguments(klass) - formatted << " #{formatted_options}" if show_options - formatted.strip! - formatted - end - - # Injects the class arguments into the task usage. - # - def formatted_arguments(klass) - if klass && !klass.arguments.empty? - usage.to_s.gsub(/^#{name}/) do |match| - match << " " << klass.arguments.map{ |a| a.usage }.join(' ') - end - else - usage.to_s - end - end - - # Returns the options usage for this task. - # - def formatted_options - @formatted_options ||= options.map{ |_, o| o.usage }.sort.join(" ") - end - - protected - - # Given a target, checks if this class name is not a private/protected method. - # - def public_method?(instance) #:nodoc: - collection = instance.private_methods + instance.protected_methods - (collection & [name.to_s, name.to_sym]).empty? - end - - # Clean everything that comes from the Thor gempath and remove the caller. - # - def sans_backtrace(backtrace, caller) #:nodoc: - dirname = /^#{Regexp.escape(File.dirname(__FILE__))}/ - saned = backtrace.reject { |frame| frame =~ dirname } - saned -= caller - end - - def parse_argument_error(instance, e, caller) #:nodoc: - backtrace = sans_backtrace(e.backtrace, caller) - - if backtrace.empty? && e.message =~ /wrong number of arguments/ - if instance.is_a?(Thor::Group) - raise e, "'#{name}' was called incorrectly. Are you sure it has arity equals to 0?" - else - raise InvocationError, "'#{name}' was called incorrectly. Call as " << - "'#{formatted_usage(instance.class, true)}'" - end - else - raise e - end - end - - def parse_no_method_error(instance, e) #:nodoc: - if e.message =~ /^undefined method `#{name}' for #{Regexp.escape(instance.to_s)}$/ - raise UndefinedTaskError, "The #{instance.class.namespace} namespace " << - "doesn't have a '#{name}' task" - else - raise e - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb deleted file mode 100644 index ebae0a3193..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/util.rb +++ /dev/null @@ -1,251 +0,0 @@ -require 'rbconfig' - -class Thor - module Sandbox #:nodoc: - end - - # This module holds several utilities: - # - # 1) Methods to convert thor namespaces to constants and vice-versa. - # - # Thor::Utils.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz" - # - # 2) Loading thor files and sandboxing: - # - # Thor::Utils.load_thorfile("~/.thor/foo") - # - module Util - - # Receives a namespace and search for it in the Thor::Base subclasses. - # - # ==== Parameters - # namespace:: The namespace to search for. - # - def self.find_by_namespace(namespace) - namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/ - - Thor::Base.subclasses.find do |klass| - klass.namespace == namespace - end - end - - # Receives a constant and converts it to a Thor namespace. Since Thor tasks - # can be added to a sandbox, this method is also responsable for removing - # the sandbox namespace. - # - # This method should not be used in general because it's used to deal with - # older versions of Thor. On current versions, if you need to get the - # namespace from a class, just call namespace on it. - # - # ==== Parameters - # constant:: The constant to be converted to the thor path. - # - # ==== Returns - # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz" - # - def self.namespace_from_thor_class(constant, remove_default=true) - constant = constant.to_s.gsub(/^Thor::Sandbox::/, "") - constant = snake_case(constant).squeeze(":") - constant.gsub!(/^default/, '') if remove_default - constant - end - - # Given the contents, evaluate it inside the sandbox and returns the - # namespaces defined in the sandbox. - # - # ==== Parameters - # contents - # - # ==== Returns - # Array[Object] - # - def self.namespaces_in_content(contents, file=__FILE__) - old_constants = Thor::Base.subclasses.dup - Thor::Base.subclasses.clear - - load_thorfile(file, contents) - - new_constants = Thor::Base.subclasses.dup - Thor::Base.subclasses.replace(old_constants) - - new_constants.map!{ |c| c.namespace } - new_constants.compact! - new_constants - end - - # Returns the thor classes declared inside the given class. - # - def self.thor_classes_in(klass) - Thor::Base.subclasses.select do |subclass| - klass.constants.include?(subclass.name.gsub("#{klass.name}::", '')) - end - end - - # Receives a string and convert it to snake case. SnakeCase returns snake_case. - # - # ==== Parameters - # String - # - # ==== Returns - # String - # - def self.snake_case(str) - return str.downcase if str =~ /^[A-Z_]+$/ - str.gsub(/\B[A-Z]/, '_\&').squeeze('_') =~ /_*(.*)/ - return $+.downcase - end - - # Receives a string and convert it to camel case. camel_case returns CamelCase. - # - # ==== Parameters - # String - # - # ==== Returns - # String - # - def self.camel_case(str) - return str if str !~ /_/ && str =~ /[A-Z]+.*/ - str.split('_').map { |i| i.capitalize }.join - end - - # Receives a namespace and tries to retrieve a Thor or Thor::Group class - # from it. It first searches for a class using the all the given namespace, - # if it's not found, removes the highest entry and searches for the class - # again. If found, returns the highest entry as the class name. - # - # ==== Examples - # - # class Foo::Bar < Thor - # def baz - # end - # end - # - # class Baz::Foo < Thor::Group - # end - # - # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default task - # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil - # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz" - # - # ==== Parameters - # namespace - # - # ==== Errors - # Thor::Error:: raised if the namespace cannot be found. - # - # Thor::Error:: raised if the namespace evals to a class which does not - # inherit from Thor or Thor::Group. - # - def self.namespace_to_thor_class_and_task(namespace, raise_if_nil=true) - if namespace.include?(?:) - pieces = namespace.split(":") - task = pieces.pop - klass = Thor::Util.find_by_namespace(pieces.join(":")) - end - - unless klass - klass, task = Thor::Util.find_by_namespace(namespace), nil - end - - raise Error, "could not find Thor class or task '#{namespace}'" if raise_if_nil && klass.nil? - return klass, task - end - - # Receives a path and load the thor file in the path. The file is evaluated - # inside the sandbox to avoid namespacing conflicts. - # - def self.load_thorfile(path, content=nil) - content ||= File.read(path) - - begin - Thor::Sandbox.class_eval(content, path) - rescue Exception => e - $stderr.puts "WARNING: unable to load thorfile #{path.inspect}: #{e.message}" - end - end - - # Receives a yaml (hash) and updates all constants entries to namespace. - # This was added to deal with deprecated versions of Thor. - # - # TODO Deprecate this method in the future. - # - # ==== Returns - # TrueClass|FalseClass:: Returns true if any change to the yaml file was made. - # - def self.convert_constants_to_namespaces(yaml) - yaml_changed = false - - yaml.each do |k, v| - next unless v[:constants] && v[:namespaces].nil? - yaml_changed = true - yaml[k][:namespaces] = v[:constants].map{|c| Thor::Util.namespace_from_thor_class(c)} - end - - yaml_changed - end - - def self.user_home - @@user_home ||= if ENV["HOME"] - ENV["HOME"] - elsif ENV["USERPROFILE"] - ENV["USERPROFILE"] - elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"] - File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]) - elsif ENV["APPDATA"] - ENV["APPDATA"] - else - begin - File.expand_path("~") - rescue - if File::ALT_SEPARATOR - "C:/" - else - "/" - end - end - end - end - - # Returns the root where thor files are located, dependending on the OS. - # - def self.thor_root - File.join(user_home, ".thor").gsub(/\\/, '/') - end - - # Returns the files in the thor root. On Windows thor_root will be something - # like this: - # - # C:\Documents and Settings\james\.thor - # - # If we don't #gsub the \ character, Dir.glob will fail. - # - def self.thor_root_glob - files = Dir["#{thor_root}/*"] - - files.map! do |file| - File.directory?(file) ? File.join(file, "main.thor") : file - end - end - - # Where to look for Thor files. - # - def self.globs_for(path) - ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"] - end - - # Return the path to the ruby interpreter taking into account multiple - # installations and windows extensions. - # - def self.ruby_command - @ruby_command ||= begin - ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) - ruby << Config::CONFIG['EXEEXT'] - - # escape string in case path to ruby executable contain spaces. - ruby.sub!(/.*\s.*/m, '"\&"') - ruby - end - end - - end -end diff --git a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb b/railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb deleted file mode 100644 index 885230fac4..0000000000 --- a/railties/lib/rails/vendor/thor-0.11.8/lib/thor/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Thor - VERSION = "0.11.8".freeze -end diff --git a/railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc b/railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc new file mode 100644 index 0000000000..adedfeca9d --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/CHANGELOG.rdoc @@ -0,0 +1,82 @@ +== TODO + +* Improve spec coverage for Thor::Runner + +== 0.12, released 2009-11-06 + +* [#7] Do not force white color on status +* [#8] Yield a block with the filename on directory + +== 0.11, released 2009-07-01 + +* Added a rake compatibility layer. It allows you to use spec and rdoc tasks on + Thor classes. + +* BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore + since it wrong behavior to the invocation system. + +* thor help now show information about any class/task. All those calls are + possible: + + thor help describe + thor help describe:amazing + + Or even with default namespaces: + + thor help :spec + +* Thor::Runner now invokes the default task if none is supplied: + + thor describe # invokes the default task, usually help + +* Thor::Runner now works with mappings: + + thor describe -h + +* Added some documentation and code refactoring. + +== 0.9.8, released 2008-10-20 + +* Fixed some tiny issues that were introduced lately. + +== 0.9.7, released 2008-10-13 + +* Setting global method options on the initialize method works as expected: + All other tasks will accept these global options in addition to their own. +* Added 'group' notion to Thor task sets (class Thor); by default all tasks + are in the 'standard' group. Running 'thor -T' will only show the standard + tasks - adding --all will show all tasks. You can also filter on a specific + group using the --group option: thor -T --group advanced + +== 0.9.6, released 2008-09-13 + +* Generic improvements + +== 0.9.5, released 2008-08-27 + +* Improve Windows compatibility +* Update (incorrect) README and task.thor sample file +* Options hash is now frozen (once returned) +* Allow magic predicates on options object. For instance: `options.force?` +* Add support for :numeric type +* BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f]) +* Allow specifying optional args with default values: method_options(:user => "mislav") +* Don't write options for nil or false values. This allows, for example, turning color off when running specs. +* Exit with the status of the spec command to help CI stuff out some. + +== 0.9.4, released 2008-08-13 + +* Try to add Windows compatibility. +* BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore +* Allow options at the beginning of the argument list as well as the end. +* Make options available with symbol keys in addition to string keys. +* Allow true to be passed to Thor#method_options to denote a boolean option. +* If loading a thor file fails, don't give up, just print a warning and keep going. +* Make sure that we re-raise errors if they happened further down the pipe than we care about. +* Only delete the old file on updating when the installation of the new one is a success +* Make it Ruby 1.8.5 compatible. +* Don't raise an error if a boolean switch is defined multiple times. +* Thor::Options now doesn't parse through things that look like options but aren't. +* Add URI detection to install task, and make sure we don't append ".thor" to URIs +* Add rake2thor to the gem binfiles. +* Make sure local Thorfiles override system-wide ones. diff --git a/railties/lib/rails/vendor/thor-0.12.0/LICENSE b/railties/lib/rails/vendor/thor-0.12.0/LICENSE new file mode 100644 index 0000000000..98722da459 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/railties/lib/rails/vendor/thor-0.12.0/README.rdoc b/railties/lib/rails/vendor/thor-0.12.0/README.rdoc new file mode 100644 index 0000000000..f1106f02b6 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/README.rdoc @@ -0,0 +1,234 @@ += thor + +Map options to a class. Simply create a class with the appropriate annotations +and have options automatically map to functions and parameters. + +Example: + + class App < Thor # [1] + map "-L" => :list # [2] + + desc "install APP_NAME", "install one of the available apps" # [3] + method_options :force => :boolean, :alias => :string # [4] + def install(name) + user_alias = options[:alias] + if options.force? + # do something + end + # other code + end + + desc "list [SEARCH]", "list all of the available apps, limited by SEARCH" + def list(search="") + # list everything + end + end + +Thor automatically maps commands as such: + + thor app:install myname --force + +That gets converted to: + + App.new.install("myname") + # with {'force' => true} as options hash + +1. Inherit from Thor to turn a class into an option mapper +2. Map additional non-valid identifiers to specific methods. In this case, convert -L to :list +3. Describe the method immediately below. The first parameter is the usage information, and the second parameter is the description +4. Provide any additional options that will be available the instance method options. + +== Types for method_options + +* :boolean - is parsed as --option or --option=true +* :string - is parsed as --option=VALUE +* :numeric - is parsed as --option=N +* :array - is parsed as --option=one two three +* :hash - is parsed as --option=name:string age:integer + +Besides, method_option allows a default value to be given, examples: + + method_options :force => false + #=> Creates a boolean option with default value false + + method_options :alias => "bar" + #=> Creates a string option with default value "bar" + + method_options :threshold => 3.0 + #=> Creates a numeric option with default value 3.0 + +You can also supply :option => :required to mark an option as required. The +type is assumed to be string. If you want a required hash with default values +as option, you can use method_option which uses a more declarative style: + + method_option :attributes, :type => :hash, :default => {}, :required => true + +All arguments can be set to nil (except required arguments), by suppling a no or +skip variant. For example: + + thor app name --no-attributes + +In previous versions, aliases for options were created automatically, but now +they should be explicit. You can supply aliases in both short and declarative +styles: + + method_options %w( force -f ) => :boolean + +Or: + + method_option :force, :type => :boolean, :aliases => "-f" + +You can supply as many aliases as you want. + +NOTE: Type :optional available in Thor 0.9.0 was deprecated. Use :string or :boolean instead. + +== Namespaces + +By default, your Thor tasks are invoked using Ruby namespace. In the example +above, tasks are invoked as: + + thor app:install name --force + +However, you could namespace your class as: + + module Sinatra + class App < Thor + # tasks + end + end + +And then you should invoke your tasks as: + + thor sinatra:app:install name --force + +If desired, you can change the namespace: + + module Sinatra + class App < Thor + namespace :myapp + # tasks + end + end + +And then your tasks hould be invoked as: + + thor myapp:install name --force + +== Invocations + +Thor comes with a invocation-dependency system as well which allows a task to be +invoked only once. For example: + + class Counter < Thor + desc "one", "Prints 1, 2, 3" + def one + puts 1 + invoke :two + invoke :three + end + + desc "two", "Prints 2, 3" + def two + puts 2 + invoke :three + end + + desc "three", "Prints 3" + def three + puts 3 + end + end + +When invoking the task one: + + thor counter:one + +The output is "1 2 3", which means that the three task was invoked only once. +You can even invoke tasks from another class, so be sure to check the +documentation. + +== Thor::Group + +Thor has a special class called Thor::Group. The main difference to Thor class +is that it invokes all tasks at once. The example above could be rewritten in +Thor::Group as this: + + class Counter < Thor::Group + desc "Prints 1, 2, 3" + + def one + puts 1 + end + + def two + puts 2 + end + + def three + puts 3 + end + end + +When invoked: + + thor counter + +It prints "1 2 3" as well. Notice you should describe (using the method desc) +only the class and not each task anymore. Thor::Group is a great tool to create +generators, since you can define several steps which are invoked in the order they +are defined (Thor::Group is the tool use in generators in Rails 3.0). + +Besides, Thor::Group can parse arguments and options as Thor tasks: + + class Counter < Thor::Group + # number will be available as attr_accessor + argument :number, :type => :numeric, :desc => "The number to start counting" + desc "Prints the 'number' given upto 'number+2'" + + def one + puts number + 0 + end + + def two + puts number + 1 + end + + def three + puts number + 2 + end + end + +The counter above expects one parameter and has the folling outputs: + + thor counter 5 + # Prints "5 6 7" + + thor counter 11 + # Prints "11 12 13" + +You can also give options to Thor::Group, but instead of using method_option +and method_options, you should use class_option and class_options. +Both argument and class_options methods are available to Thor class as well. + +== Actions + +Thor comes with several actions which helps with script and generator tasks. You +might be familiar with them since some came from Rails Templates. They are: +say, ask, yes?, no?, add_file, +remove_file, copy_file, template, directory, +inside, run, inject_into_file and a couple more. + +To use them, you just need to include Thor::Actions in your Thor classes: + + class App < Thor + include Thor::Actions + # tasks + end + +Some actions like copy file requires that a class method called source_root is +defined in your class. This is the directory where your templates should be +placed. Be sure to check the documentation. + +== License + +See MIT LICENSE. diff --git a/railties/lib/rails/vendor/thor-0.12.0/Thorfile b/railties/lib/rails/vendor/thor-0.12.0/Thorfile new file mode 100644 index 0000000000..f71a1e57e2 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/Thorfile @@ -0,0 +1,63 @@ +# enconding: utf-8 + +require File.join(File.dirname(__FILE__), "lib", "thor", "version") +require 'thor/rake_compat' +require 'spec/rake/spectask' +require 'rdoc/task' + +GEM_NAME = 'thor' +EXTRA_RDOC_FILES = ["README.rdoc", "LICENSE", "CHANGELOG.rdoc", "VERSION", "Thorfile"] + +class Default < Thor + include Thor::RakeCompat + + Spec::Rake::SpecTask.new(:spec) do |t| + t.libs << 'lib' + t.spec_opts = ['--options', "spec/spec.opts"] + t.spec_files = FileList['spec/**/*_spec.rb'] + end + + Spec::Rake::SpecTask.new(:rcov) do |t| + t.libs << 'lib' + t.spec_opts = ['--options', "spec/spec.opts"] + t.spec_files = FileList['spec/**/*_spec.rb'] + t.rcov = true + t.rcov_dir = "rcov" + end + + RDoc::Task.new do |rdoc| + rdoc.main = "README.rdoc" + rdoc.rdoc_dir = "rdoc" + rdoc.title = GEM_NAME + rdoc.rdoc_files.include(*EXTRA_RDOC_FILES) + rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.options << '--line-numbers' << '--inline-source' + end + + begin + require 'jeweler' + Jeweler::Tasks.new do |s| + s.name = GEM_NAME + s.version = Thor::VERSION + s.rubyforge_project = "textmate" + s.platform = Gem::Platform::RUBY + s.summary = "A scripting framework that replaces rake, sake and rubigen" + s.email = "ruby-thor@googlegroups.com" + s.homepage = "http://yehudakatz.com" + s.description = "A scripting framework that replaces rake, sake and rubigen" + s.authors = ['Yehuda Katz', 'José Valim'] + s.has_rdoc = true + s.extra_rdoc_files = EXTRA_RDOC_FILES + s.require_path = 'lib' + s.bindir = "bin" + s.executables = %w( thor rake2thor ) + s.files = s.extra_rdoc_files + Dir.glob("{bin,lib}/**/*") + s.files.exclude 'spec/sandbox/**/*' + s.test_files.exclude 'spec/sandbox/**/*' + end + + Jeweler::RubyforgeTasks.new + rescue LoadError + puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb new file mode 100644 index 0000000000..68944f140d --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor.rb @@ -0,0 +1,242 @@ +require 'thor/base' +require 'thor/group' +require 'thor/actions' + +class Thor + class << self + # Sets the default task when thor is executed without an explicit task to be called. + # + # ==== Parameters + # meth:: name of the defaut task + # + def default_task(meth=nil) + case meth + when :none + @default_task = 'help' + when nil + @default_task ||= from_superclass(:default_task, 'help') + else + @default_task = meth.to_s + end + end + + # Defines the usage and the description of the next task. + # + # ==== Parameters + # usage + # description + # + def desc(usage, description, options={}) + if options[:for] + task = find_and_refresh_task(options[:for]) + task.usage = usage if usage + task.description = description if description + else + @usage, @desc = usage, description + end + end + + # Maps an input to a task. If you define: + # + # map "-T" => "list" + # + # Running: + # + # thor -T + # + # Will invoke the list task. + # + # ==== Parameters + # Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given task. + # + def map(mappings=nil) + @map ||= from_superclass(:map, {}) + + if mappings + mappings.each do |key, value| + if key.respond_to?(:each) + key.each {|subkey| @map[subkey] = value} + else + @map[key] = value + end + end + end + + @map + end + + # Declares the options for the next task to be declared. + # + # ==== Parameters + # Hash[Symbol => Object]:: The hash key is the name of the option and the value + # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric + # or :required (string). If you give a value, the type of the value is used. + # + def method_options(options=nil) + @method_options ||= {} + build_options(options, @method_options) if options + @method_options + end + + # Adds an option to the set of class options. If :for is given as option, + # it allows you to change the options from a previous defined task. + # + # def previous_task + # # magic + # end + # + # method_options :foo => :bar, :for => :previous_task + # + # def next_task + # # magic + # end + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described below. + # + # ==== Options + # :desc - Description for the argument. + # :required - If the argument is required or not. + # :default - Default value for this argument. It cannot be required and have default values. + # :aliases - Aliases for this option. + # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. + # :group - The group for this options. Use by class options to output options in different levels. + # :banner - String to show on usage notes. + # + def method_option(name, options={}) + scope = if options[:for] + find_and_refresh_task(options[:for]).options + else + method_options + end + + build_option(name, options, scope) + end + + # Parses the task and options from the given args, instantiate the class + # and invoke the task. This method is used when the arguments must be parsed + # from an array. If you are inside Ruby and want to use a Thor class, you + # can simply initialize it: + # + # script = MyScript.new(args, options, config) + # script.invoke(:task, first_arg, second_arg, third_arg) + # + def start(given_args=ARGV, config={}) + super do + meth = normalize_task_name(given_args.shift) + task = all_tasks[meth] + + if task + args, opts = Thor::Options.split(given_args) + config.merge!(:task_options => task.options) + else + args, opts = given_args, {} + end + + task ||= Thor::Task::Dynamic.new(meth) + trailing = args[Range.new(arguments.size, -1)] + new(args, opts, config).invoke(task, trailing || []) + end + end + + # Prints help information. If a task name is given, it shows information + # only about the specific task. + # + # ==== Parameters + # meth:: An optional task name to print usage information about. + # + # ==== Options + # namespace:: When true, shows the namespace in the output before the usage. + # skip_inherited:: When true, does not show tasks from superclass. + # + def help(shell, meth=nil, options={}) + meth, options = nil, meth if meth.is_a?(Hash) + + if meth + task = all_tasks[meth] + raise UndefinedTaskError, "task '#{meth}' could not be found in namespace '#{self.namespace}'" unless task + + shell.say "Usage:" + shell.say " #{banner(task, options[:namespace], false)}" + shell.say + class_options_help(shell, "Class", :Method => task.options.map { |_, o| o }) + shell.say task.description + else + list = (options[:short] ? tasks : all_tasks).map do |_, task| + item = [ banner(task, options[:namespace]) ] + item << "# #{task.short_description}" if task.short_description + item << " " + end + + options[:ident] ||= 2 + if options[:short] + shell.print_list(list, :ident => options[:ident]) + else + shell.say "Tasks:" + shell.print_list(list, :ident => options[:ident]) + end + + Thor::Util.thor_classes_in(self).each do |subclass| + namespace = options[:namespace] == true || subclass.namespace.gsub(/^#{self.namespace}:/, '') + subclass.help(shell, options.merge(:short => true, :namespace => namespace)) + end + + class_options_help(shell, "Class") unless options[:short] + end + end + + protected + + # The banner for this class. You can customize it if you are invoking the + # thor class by another ways which is not the Thor::Runner. It receives + # the task that is going to be invoked and a boolean which indicates if + # the namespace should be displayed as arguments. + # + def banner(task, namespace=true, show_options=true) + task.formatted_usage(self, namespace, show_options) + end + + def baseclass #:nodoc: + Thor + end + + def create_task(meth) #:nodoc: + if @usage && @desc + tasks[meth.to_s] = Thor::Task.new(meth, @desc, @usage, method_options) + @usage, @desc, @method_options = nil + true + elsif self.all_tasks[meth.to_s] || meth.to_sym == :method_missing + true + else + puts "[WARNING] Attempted to create task #{meth.inspect} without usage or description. " << + "Call desc if you want this method to be available as task or declare it inside a " << + "no_tasks{} block. Invoked from #{caller[1].inspect}." + false + end + end + + def initialize_added #:nodoc: + class_options.merge!(method_options) + @method_options = nil + end + + # Receives a task name (can be nil), and try to get a map from it. + # If a map can't be found use the sent name or the default task. + # + def normalize_task_name(meth) #:nodoc: + mapping = map[meth.to_s] + meth = mapping || meth || default_task + meth.to_s.gsub('-','_') # treat foo-bar > foo_bar + end + end + + include Thor::Base + + map HELP_MAPPINGS => :help + + desc "help [TASK]", "Describe available tasks or one specific task" + def help(task=nil) + self.class.help(shell, task, :namespace => task && task.include?(?:)) + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb new file mode 100644 index 0000000000..d561ccb2aa --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions.rb @@ -0,0 +1,273 @@ +require 'fileutils' + +Dir[File.join(File.dirname(__FILE__), "actions", "*.rb")].each do |action| + require action +end + +class Thor + module Actions + attr_accessor :behavior + + def self.included(base) #:nodoc: + base.extend ClassMethods + end + + module ClassMethods + # Hold source paths for one Thor instance. source_paths_for_search is the + # method responsible to gather source_paths from this current class, + # inherited paths and the source root. + # + def source_paths + @source_paths ||= [] + end + + # Returns the source paths in the following order: + # + # 1) This class source paths + # 2) Source root + # 3) Parents source paths + # + def source_paths_for_search + paths = [] + paths += self.source_paths + paths << self.source_root if self.respond_to?(:source_root) + paths += from_superclass(:source_paths, []) + paths + end + + # Add runtime options that help actions execution. + # + def add_runtime_options! + class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime, + :desc => "Run but do not make any changes" + + class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime, + :desc => "Overwrite files that already exist" + + class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime, + :desc => "Skip files that already exist" + + class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime, + :desc => "Supress status output" + end + end + + # Extends initializer to add more configuration options. + # + # ==== Configuration + # behavior:: The actions default behavior. Can be :invoke or :revoke. + # It also accepts :force, :skip and :pretend to set the behavior + # and the respective option. + # + # destination_root:: The root directory needed for some actions. + # + def initialize(args=[], options={}, config={}) + self.behavior = case config[:behavior].to_s + when "force", "skip" + _cleanup_options_and_set(options, config[:behavior]) + :invoke + when "revoke" + :revoke + else + :invoke + end + + super + self.destination_root = config[:destination_root] + end + + # Wraps an action object and call it accordingly to the thor class behavior. + # + def action(instance) #:nodoc: + if behavior == :revoke + instance.revoke! + else + instance.invoke! + end + end + + # Returns the root for this thor class (also aliased as destination root). + # + def destination_root + @destination_stack.last + end + + # Sets the root for this thor class. Relatives path are added to the + # directory where the script was invoked and expanded. + # + def destination_root=(root) + @destination_stack ||= [] + @destination_stack[0] = File.expand_path(root || '') + end + + # Returns the given path relative to the absolute root (ie, root where + # the script started). + # + def relative_to_original_destination_root(path, remove_dot=true) + path = path.gsub(@destination_stack[0], '.') + remove_dot ? (path[2..-1] || '') : path + end + + # Holds source paths in instance so they can be manipulated. + # + def source_paths + @source_paths ||= self.class.source_paths_for_search + end + + # Receives a file or directory and search for it in the source paths. + # + def find_in_source_paths(file) + relative_root = relative_to_original_destination_root(destination_root, false) + + source_paths.each do |source| + source_file = File.expand_path(file, File.join(source, relative_root)) + return source_file if File.exists?(source_file) + end + + if source_paths.empty? + raise Error, "You don't have any source path defined for class #{self.class.name}. To fix this, " << + "you can define a source_root in your class." + else + raise Error, "Could not find #{file.inspect} in source paths." + end + end + + # Do something in the root or on a provided subfolder. If a relative path + # is given it's referenced from the current root. The full path is yielded + # to the block you provide. The path is set back to the previous path when + # the method exits. + # + # ==== Parameters + # dir:: the directory to move to. + # config:: give :verbose => true to log and use padding. + # + def inside(dir='', config={}, &block) + verbose = config.fetch(:verbose, false) + + say_status :inside, dir, verbose + shell.padding += 1 if verbose + @destination_stack.push File.expand_path(dir, destination_root) + + FileUtils.mkdir_p(destination_root) unless File.exist?(destination_root) + FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield } + + @destination_stack.pop + shell.padding -= 1 if verbose + end + + # Goes to the root and execute the given block. + # + def in_root + inside(@destination_stack.first) { yield } + end + + # Loads an external file and execute it in the instance binding. + # + # ==== Parameters + # path:: The path to the file to execute. Can be a web address or + # a relative path from the source root. + # + # ==== Examples + # + # apply "http://gist.github.com/103208" + # + # apply "recipes/jquery.rb" + # + def apply(path, config={}) + verbose = config.fetch(:verbose, true) + path = find_in_source_paths(path) unless path =~ /^http\:\/\// + + say_status :apply, path, verbose + shell.padding += 1 if verbose + instance_eval(open(path).read) + shell.padding -= 1 if verbose + end + + # Executes a command. + # + # ==== Parameters + # command:: the command to be executed. + # config:: give :verbose => false to not log the status. Specify :with + # to append an executable to command executation. + # + # ==== Example + # + # inside('vendor') do + # run('ln -s ~/edge rails') + # end + # + def run(command, config={}) + return unless behavior == :invoke + + destination = relative_to_original_destination_root(destination_root, false) + desc = "#{command} from #{destination.inspect}" + + if config[:with] + desc = "#{File.basename(config[:with].to_s)} #{desc}" + command = "#{config[:with]} #{command}" + end + + say_status :run, desc, config.fetch(:verbose, true) + system(command) unless options[:pretend] + end + + # Executes a ruby script (taking into account WIN32 platform quirks). + # + # ==== Parameters + # command:: the command to be executed. + # config:: give :verbose => false to not log the status. + # + def run_ruby_script(command, config={}) + return unless behavior == :invoke + run "#{command}", config.merge(:with => Thor::Util.ruby_command) + end + + # Run a thor command. A hash of options can be given and it's converted to + # switches. + # + # ==== Parameters + # task:: the task to be invoked + # args:: arguments to the task + # config:: give :verbose => false to not log the status. Other options + # are given as parameter to Thor. + # + # ==== Examples + # + # thor :install, "http://gist.github.com/103208" + # #=> thor install http://gist.github.com/103208 + # + # thor :list, :all => true, :substring => 'rails' + # #=> thor list --all --substring=rails + # + def thor(task, *args) + config = args.last.is_a?(Hash) ? args.pop : {} + verbose = config.key?(:verbose) ? config.delete(:verbose) : true + + args.unshift task + args.push Thor::Options.to_switches(config) + command = args.join(' ').strip + + run command, :with => :thor, :verbose => verbose + end + + protected + + # Allow current root to be shared between invocations. + # + def _shared_configuration #:nodoc: + super.merge!(:destination_root => self.destination_root) + end + + def _cleanup_options_and_set(options, key) #:nodoc: + case options + when Array + %w(--force -f --skip -s).each { |i| options.delete(i) } + options << "--#{key}" + when Hash + [:force, :skip, "force", "skip"].each { |i| options.delete(i) } + options.merge!(key => true) + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb new file mode 100644 index 0000000000..a3d9296823 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/create_file.rb @@ -0,0 +1,103 @@ +require 'thor/actions/empty_directory' + +class Thor + module Actions + + # Create a new file relative to the destination root with the given data, + # which is the return value of a block or a data string. + # + # ==== Parameters + # destination:: the relative path to the destination root. + # data:: the data to append to the file. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # create_file "lib/fun_party.rb" do + # hostname = ask("What is the virtual hostname I should use?") + # "vhost.name = #{hostname}" + # end + # + # create_file "config/apach.conf", "your apache config" + # + def create_file(destination, data=nil, config={}, &block) + action CreateFile.new(self, destination, block || data.to_s, config) + end + alias :add_file :create_file + + # AddFile is a subset of Template, which instead of rendering a file with + # ERB, it gets the content from the user. + # + class CreateFile < EmptyDirectory #:nodoc: + attr_reader :data + + def initialize(base, destination, data, config={}) + @data = data + super(base, destination, config) + end + + # Checks if the content of the file at the destination is identical to the rendered result. + # + # ==== Returns + # Boolean:: true if it is identical, false otherwise. + # + def identical? + exists? && File.read(destination) == render + end + + # Holds the content to be added to the file. + # + def render + @render ||= if data.is_a?(Proc) + data.call + else + data + end + end + + def invoke! + invoke_with_conflict_check do + FileUtils.mkdir_p(File.dirname(destination)) + File.open(destination, 'w'){ |f| f.write render } + end + given_destination + end + + protected + + # Now on conflict we check if the file is identical or not. + # + def on_conflict_behavior(&block) + if identical? + say_status :identical, :blue + else + options = base.options.merge(config) + force_or_skip_or_conflict(options[:force], options[:skip], &block) + end + end + + # If force is true, run the action, otherwise check if it's not being + # skipped. If both are false, show the file_collision menu, if the menu + # returns true, force it, otherwise skip. + # + def force_or_skip_or_conflict(force, skip, &block) + if force + say_status :force, :yellow + block.call unless pretend? + elsif skip + say_status :skip, :yellow + else + say_status :conflict, :red + force_or_skip_or_conflict(force_on_collision?, true, &block) + end + end + + # Shows the file collision menu to the user and gets the result. + # + def force_on_collision? + base.shell.file_collision(destination){ render } + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb new file mode 100644 index 0000000000..467e63732a --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/directory.rb @@ -0,0 +1,93 @@ +require 'thor/actions/empty_directory' + +class Thor + module Actions + + # Copies recursively the files from source directory to root directory. + # If any of the files finishes with .tt, it's considered to be a template + # and is placed in the destination without the extension .tt. If any + # empty directory is found, it's copied and all .empty_directory files are + # ignored. Remember that file paths can also be encoded, let's suppose a doc + # directory with the following files: + # + # doc/ + # components/.empty_directory + # README + # rdoc.rb.tt + # %app_name%.rb + # + # When invoked as: + # + # directory "doc" + # + # It will create a doc directory in the destination with the following + # files (assuming that the app_name is "blog"): + # + # doc/ + # components/ + # README + # rdoc.rb + # blog.rb + # + # ==== Parameters + # source:: the relative path to the source root. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # If :recursive => false, does not look for paths recursively. + # + # ==== Examples + # + # directory "doc" + # directory "doc", "docs", :recursive => false + # + def directory(source, destination=nil, config={}, &block) + action Directory.new(self, source, destination || source, config, &block) + end + + class Directory < EmptyDirectory #:nodoc: + attr_reader :source + + def initialize(base, source, destination=nil, config={}, &block) + @source = File.expand_path(base.find_in_source_paths(source.to_s)) + @block = block + super(base, destination, { :recursive => true }.merge(config)) + end + + def invoke! + base.empty_directory given_destination, config + execute! + end + + def revoke! + execute! + end + + protected + + def execute! + lookup = config[:recursive] ? File.join(source, '**') : source + lookup = File.join(lookup, '{*,.[a-z]*}') + + Dir[lookup].each do |file_source| + next if File.directory?(file_source) + file_destination = File.join(given_destination, file_source.gsub(source, '.')) + file_destination.gsub!('/./', '/') + + case file_source + when /\.empty_directory$/ + dirname = File.dirname(file_destination).gsub(/\/\.$/, '') + next if dirname == given_destination + base.empty_directory(dirname, config) + when /\.tt$/ + destination = base.template(file_source, file_destination[0..-4], config) + @block.call(destination) if @block + else + destination = base.copy_file(file_source, file_destination, config) + @block.call(destination) if @block + end + end + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb new file mode 100644 index 0000000000..484cb820f8 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/empty_directory.rb @@ -0,0 +1,134 @@ +class Thor + module Actions + + # Creates an empty directory. + # + # ==== Parameters + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # empty_directory "doc" + # + def empty_directory(destination, config={}) + action EmptyDirectory.new(self, destination, config) + end + + # Class which holds create directory logic. This is the base class for + # other actions like create_file and directory. + # + # This implementation is based in Templater actions, created by Jonas Nicklas + # and Michael S. Klishin under MIT LICENSE. + # + class EmptyDirectory #:nodoc: + attr_reader :base, :destination, :given_destination, :relative_destination, :config + + # Initializes given the source and destination. + # + # ==== Parameters + # base:: A Thor::Base instance + # source:: Relative path to the source of this file + # destination:: Relative path to the destination of this file + # config:: give :verbose => false to not log the status. + # + def initialize(base, destination, config={}) + @base, @config = base, { :verbose => true }.merge(config) + self.destination = destination + end + + # Checks if the destination file already exists. + # + # ==== Returns + # Boolean:: true if the file exists, false otherwise. + # + def exists? + ::File.exists?(destination) + end + + def invoke! + invoke_with_conflict_check do + ::FileUtils.mkdir_p(destination) + end + end + + def revoke! + say_status :remove, :red + ::FileUtils.rm_rf(destination) if !pretend? && exists? + given_destination + end + + protected + + # Shortcut for pretend. + # + def pretend? + base.options[:pretend] + end + + # Sets the absolute destination value from a relative destination value. + # It also stores the given and relative destination. Let's suppose our + # script is being executed on "dest", it sets the destination root to + # "dest". The destination, given_destination and relative_destination + # are related in the following way: + # + # inside "bar" do + # empty_directory "baz" + # end + # + # destination #=> dest/bar/baz + # relative_destination #=> bar/baz + # given_destination #=> baz + # + def destination=(destination) + if destination + @given_destination = convert_encoded_instructions(destination.to_s) + @destination = ::File.expand_path(@given_destination, base.destination_root) + @relative_destination = base.relative_to_original_destination_root(@destination) + end + end + + # Filenames in the encoded form are converted. If you have a file: + # + # %class_name%.rb + # + # It gets the class name from the base and replace it: + # + # user.rb + # + def convert_encoded_instructions(filename) + filename.gsub(/%(.*?)%/) do |string| + instruction = $1.strip + base.respond_to?(instruction) ? base.send(instruction) : string + end + end + + # Receives a hash of options and just execute the block if some + # conditions are met. + # + def invoke_with_conflict_check(&block) + if exists? + on_conflict_behavior(&block) + else + say_status :create, :green + block.call unless pretend? + end + + destination + end + + # What to do when the destination file already exists. + # + def on_conflict_behavior(&block) + say_status :exist, :blue + end + + # Shortcut to say_status shell method. + # + def say_status(status, color) + base.shell.say_status status, relative_destination, color if config[:verbose] + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb new file mode 100644 index 0000000000..d77d90d448 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/file_manipulation.rb @@ -0,0 +1,219 @@ +require 'erb' +require 'open-uri' + +class Thor + module Actions + + # Copies the file from the relative source to the relative destination. If + # the destination is not given it's assumed to be equal to the source. + # + # ==== Parameters + # source:: the relative path to the source root. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # copy_file "README", "doc/README" + # + # copy_file "doc/README" + # + def copy_file(source, destination=nil, config={}) + destination ||= source + source = File.expand_path(find_in_source_paths(source.to_s)) + + create_file destination, nil, config do + File.read(source) + end + end + + # Gets the content at the given address and places it at the given relative + # destination. If a block is given instead of destination, the content of + # the url is yielded and used as location. + # + # ==== Parameters + # source:: the address of the given content. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # get "http://gist.github.com/103208", "doc/README" + # + # get "http://gist.github.com/103208" do |content| + # content.split("\n").first + # end + # + def get(source, destination=nil, config={}, &block) + source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ /^http\:\/\// + render = open(source).read + + destination ||= if block_given? + block.arity == 1 ? block.call(render) : block.call + else + File.basename(source) + end + + create_file destination, render, config + end + + # Gets an ERB template at the relative source, executes it and makes a copy + # at the relative destination. If the destination is not given it's assumed + # to be equal to the source removing .tt from the filename. + # + # ==== Parameters + # source:: the relative path to the source root. + # destination:: the relative path to the destination root. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # template "README", "doc/README" + # + # template "doc/README" + # + def template(source, destination=nil, config={}) + destination ||= source + source = File.expand_path(find_in_source_paths(source.to_s)) + context = instance_eval('binding') + + create_file destination, nil, config do + ERB.new(::File.read(source), nil, '-').result(context) + end + end + + # Changes the mode of the given file or directory. + # + # ==== Parameters + # mode:: the file mode + # path:: the name of the file to change mode + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # chmod "script/*", 0755 + # + def chmod(path, mode, config={}) + return unless behavior == :invoke + path = File.expand_path(path, destination_root) + say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true) + FileUtils.chmod_R(mode, path) unless options[:pretend] + end + + # Prepend text to a file. Since it depends on inject_into_file, it's reversible. + # + # ==== Parameters + # path:: path of the file to be changed + # data:: the data to prepend to the file, can be also given as a block. + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # prepend_file 'config/environments/test.rb', 'config.gem "rspec"' + # + # prepend_file 'config/environments/test.rb' do + # 'config.gem "rspec"' + # end + # + def prepend_file(path, *args, &block) + config = args.last.is_a?(Hash) ? args.pop : {} + config.merge!(:after => /\A/) + inject_into_file(path, *(args << config), &block) + end + + # Append text to a file. Since it depends on inject_into_file, it's reversible. + # + # ==== Parameters + # path:: path of the file to be changed + # data:: the data to append to the file, can be also given as a block. + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # append_file 'config/environments/test.rb', 'config.gem "rspec"' + # + # append_file 'config/environments/test.rb' do + # 'config.gem "rspec"' + # end + # + def append_file(path, *args, &block) + config = args.last.is_a?(Hash) ? args.pop : {} + config.merge!(:before => /\z/) + inject_into_file(path, *(args << config), &block) + end + + # Injects text right after the class definition. Since it depends on + # inject_into_file, it's reversible. + # + # ==== Parameters + # path:: path of the file to be changed + # klass:: the class to be manipulated + # data:: the data to append to the class, can be also given as a block. + # config:: give :verbose => false to not log the status. + # + # ==== Examples + # + # inject_into_class "app/controllers/application_controller.rb", " filter_parameter :password\n" + # + # inject_into_class "app/controllers/application_controller.rb", ApplicationController do + # " filter_parameter :password\n" + # end + # + def inject_into_class(path, klass, *args, &block) + config = args.last.is_a?(Hash) ? args.pop : {} + config.merge!(:after => /class #{klass}\n|class #{klass} .*\n/) + inject_into_file(path, *(args << config), &block) + end + + # Run a regular expression replacement on a file. + # + # ==== Parameters + # path:: path of the file to be changed + # flag:: the regexp or string to be replaced + # replacement:: the replacement, can be also given as a block + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1' + # + # gsub_file 'README', /rake/, :green do |match| + # match << " no more. Use thor!" + # end + # + def gsub_file(path, flag, *args, &block) + return unless behavior == :invoke + config = args.last.is_a?(Hash) ? args.pop : {} + + path = File.expand_path(path, destination_root) + say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true) + + unless options[:pretend] + content = File.read(path) + content.gsub!(flag, *args, &block) + File.open(path, 'wb') { |file| file.write(content) } + end + end + + # Removes a file at the given location. + # + # ==== Parameters + # path:: path of the file to be changed + # config:: give :verbose => false to not log the status. + # + # ==== Example + # + # remove_file 'README' + # remove_file 'app/controllers/application_controller.rb' + # + def remove_file(path, config={}) + return unless behavior == :invoke + path = File.expand_path(path, destination_root) + + say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) + ::FileUtils.rm_rf(path) if !options[:pretend] && File.exists?(path) + end + alias :remove_dir :remove_file + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb new file mode 100644 index 0000000000..0636ec6591 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/actions/inject_into_file.rb @@ -0,0 +1,101 @@ +require 'thor/actions/empty_directory' + +class Thor + module Actions + + # Injects the given content into a file. Different from gsub_file, this + # method is reversible. + # + # ==== Parameters + # destination:: Relative path to the destination root + # data:: Data to add to the file. Can be given as a block. + # config:: give :verbose => false to not log the status and the flag + # for injection (:after or :before). + # + # ==== Examples + # + # inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n" + # + # inject_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do + # gems = ask "Which gems would you like to add?" + # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n") + # end + # + def inject_into_file(destination, *args, &block) + if block_given? + data, config = block, args.shift + else + data, config = args.shift, args.shift + end + action InjectIntoFile.new(self, destination, data, config) + end + + class InjectIntoFile < EmptyDirectory #:nodoc: + attr_reader :replacement, :flag, :behavior + + def initialize(base, destination, data, config) + super(base, destination, { :verbose => true }.merge(config)) + + @behavior, @flag = if @config.key?(:after) + [:after, @config.delete(:after)] + else + [:before, @config.delete(:before)] + end + + @replacement = data.is_a?(Proc) ? data.call : data + @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp) + end + + def invoke! + say_status :invoke + + content = if @behavior == :after + '\0' + replacement + else + replacement + '\0' + end + + replace!(/#{flag}/, content) + end + + def revoke! + say_status :revoke + + regexp = if @behavior == :after + content = '\1\2' + /(#{flag})(.*)(#{Regexp.escape(replacement)})/m + else + content = '\2\3' + /(#{Regexp.escape(replacement)})(.*)(#{flag})/m + end + + replace!(regexp, content) + end + + protected + + def say_status(behavior) + status = if flag == /\A/ + behavior == :invoke ? :prepend : :unprepend + elsif flag == /\z/ + behavior == :invoke ? :append : :unappend + else + behavior == :invoke ? :inject : :deinject + end + + super(status, config[:verbose]) + end + + # Adds the content to the file. + # + def replace!(regexp, string) + unless base.options[:pretend] + content = File.read(destination) + content.gsub!(regexp, string) + File.open(destination, 'wb') { |file| file.write(content) } + end + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb new file mode 100644 index 0000000000..700d794123 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/base.rb @@ -0,0 +1,517 @@ +require 'thor/core_ext/hash_with_indifferent_access' +require 'thor/core_ext/ordered_hash' +require 'thor/error' +require 'thor/shell' +require 'thor/invocation' +require 'thor/parser' +require 'thor/task' +require 'thor/util' + +class Thor + # Shortcuts for help. + HELP_MAPPINGS = %w(-h -? --help -D) + + # Thor methods that should not be overwritten by the user. + THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root + action add_file create_file in_root inside run run_ruby_script) + + module Base + attr_accessor :options + + # It receives arguments in an Array and two hashes, one for options and + # other for configuration. + # + # Notice that it does not check if all required arguments were supplied. + # It should be done by the parser. + # + # ==== Parameters + # args:: An array of objects. The objects are applied to their + # respective accessors declared with argument. + # + # options:: An options hash that will be available as self.options. + # The hash given is converted to a hash with indifferent + # access, magic predicates (options.skip?) and then frozen. + # + # config:: Configuration for this Thor class. + # + def initialize(args=[], options={}, config={}) + Thor::Arguments.parse(self.class.arguments, args).each do |key, value| + send("#{key}=", value) + end + + parse_options = self.class.class_options + + if options.is_a?(Array) + task_options = config.delete(:task_options) # hook for start + parse_options = parse_options.merge(task_options) if task_options + array_options, hash_options = options, {} + else + array_options, hash_options = [], options + end + + options = Thor::Options.parse(parse_options, array_options) + self.options = Thor::CoreExt::HashWithIndifferentAccess.new(options).merge!(hash_options) + self.options.freeze + end + + class << self + def included(base) #:nodoc: + base.send :extend, ClassMethods + base.send :include, Invocation + base.send :include, Shell + end + + # Returns the classes that inherits from Thor or Thor::Group. + # + # ==== Returns + # Array[Class] + # + def subclasses + @subclasses ||= [] + end + + # Returns the files where the subclasses are kept. + # + # ==== Returns + # Hash[path => Class] + # + def subclass_files + @subclass_files ||= Hash.new{ |h,k| h[k] = [] } + end + + # Whenever a class inherits from Thor or Thor::Group, we should track the + # class and the file on Thor::Base. This is the method responsable for it. + # + def register_klass_file(klass) #:nodoc: + file = caller[1].match(/(.*):\d+/)[1] + Thor::Base.subclasses << klass unless Thor::Base.subclasses.include?(klass) + + file_subclasses = Thor::Base.subclass_files[File.expand_path(file)] + file_subclasses << klass unless file_subclasses.include?(klass) + end + end + + module ClassMethods + # Adds an argument to the class and creates an attr_accessor for it. + # + # Arguments are different from options in several aspects. The first one + # is how they are parsed from the command line, arguments are retrieved + # from position: + # + # thor task NAME + # + # Instead of: + # + # thor task --name=NAME + # + # Besides, arguments are used inside your code as an accessor (self.argument), + # while options are all kept in a hash (self.options). + # + # Finally, arguments cannot have type :default or :boolean but can be + # optional (supplying :optional => :true or :required => false), although + # you cannot have a required argument after a non-required argument. If you + # try it, an error is raised. + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described below. + # + # ==== Options + # :desc - Description for the argument. + # :required - If the argument is required or not. + # :optional - If the argument is optional or not. + # :type - The type of the argument, can be :string, :hash, :array, :numeric. + # :default - Default value for this argument. It cannot be required and have default values. + # :banner - String to show on usage notes. + # + # ==== Errors + # ArgumentError:: Raised if you supply a required argument after a non required one. + # + def argument(name, options={}) + is_thor_reserved_word?(name, :argument) + no_tasks { attr_accessor name } + + required = if options.key?(:optional) + !options[:optional] + elsif options.key?(:required) + options[:required] + else + options[:default].nil? + end + + remove_argument name + + arguments.each do |argument| + next if argument.required? + raise ArgumentError, "You cannot have #{name.to_s.inspect} as required argument after " << + "the non-required argument #{argument.human_name.inspect}." + end if required + + arguments << Thor::Argument.new(name, options[:desc], required, options[:type], + options[:default], options[:banner]) + end + + # Returns this class arguments, looking up in the ancestors chain. + # + # ==== Returns + # Array[Thor::Argument] + # + def arguments + @arguments ||= from_superclass(:arguments, []) + end + + # Adds a bunch of options to the set of class options. + # + # class_options :foo => false, :bar => :required, :baz => :string + # + # If you prefer more detailed declaration, check class_option. + # + # ==== Parameters + # Hash[Symbol => Object] + # + def class_options(options=nil) + @class_options ||= from_superclass(:class_options, {}) + build_options(options, @class_options) if options + @class_options + end + + # Adds an option to the set of class options + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described below. + # + # ==== Options + # :desc - Description for the argument. + # :required - If the argument is required or not. + # :default - Default value for this argument. + # :group - The group for this options. Use by class options to output options in different levels. + # :aliases - Aliases for this option. + # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. + # :banner - String to show on usage notes. + # + def class_option(name, options={}) + build_option(name, options, class_options) + end + + # Removes a previous defined argument. If :undefine is given, undefine + # accessors as well. + # + # ==== Paremeters + # names:: Arguments to be removed + # + # ==== Examples + # + # remove_argument :foo + # remove_argument :foo, :bar, :baz, :undefine => true + # + def remove_argument(*names) + options = names.last.is_a?(Hash) ? names.pop : {} + + names.each do |name| + arguments.delete_if { |a| a.name == name.to_s } + undef_method name, "#{name}=" if options[:undefine] + end + end + + # Removes a previous defined class option. + # + # ==== Paremeters + # names:: Class options to be removed + # + # ==== Examples + # + # remove_class_option :foo + # remove_class_option :foo, :bar, :baz + # + def remove_class_option(*names) + names.each do |name| + class_options.delete(name) + end + end + + # Defines the group. This is used when thor list is invoked so you can specify + # that only tasks from a pre-defined group will be shown. Defaults to standard. + # + # ==== Parameters + # name + # + def group(name=nil) + case name + when nil + @group ||= from_superclass(:group, 'standard') + else + @group = name.to_s + end + end + + # Returns the tasks for this Thor class. + # + # ==== Returns + # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task + # objects as values. + # + def tasks + @tasks ||= Thor::CoreExt::OrderedHash.new + end + + # Returns the tasks for this Thor class and all subclasses. + # + # ==== Returns + # OrderedHash:: An ordered hash with tasks names as keys and Thor::Task + # objects as values. + # + def all_tasks + @all_tasks ||= from_superclass(:all_tasks, Thor::CoreExt::OrderedHash.new) + @all_tasks.merge(tasks) + end + + # Removes a given task from this Thor class. This is usually done if you + # are inheriting from another class and don't want it to be available + # anymore. + # + # By default it only remove the mapping to the task. But you can supply + # :undefine => true to undefine the method from the class as well. + # + # ==== Parameters + # name:: The name of the task to be removed + # options:: You can give :undefine => true if you want tasks the method + # to be undefined from the class as well. + # + def remove_task(*names) + options = names.last.is_a?(Hash) ? names.pop : {} + + names.each do |name| + tasks.delete(name.to_s) + all_tasks.delete(name.to_s) + undef_method name if options[:undefine] + end + end + + # All methods defined inside the given block are not added as tasks. + # + # So you can do: + # + # class MyScript < Thor + # no_tasks do + # def this_is_not_a_task + # end + # end + # end + # + # You can also add the method and remove it from the task list: + # + # class MyScript < Thor + # def this_is_not_a_task + # end + # remove_task :this_is_not_a_task + # end + # + def no_tasks + @no_tasks = true + yield + @no_tasks = false + end + + # Sets the namespace for the Thor or Thor::Group class. By default the + # namespace is retrieved from the class name. If your Thor class is named + # Scripts::MyScript, the help method, for example, will be called as: + # + # thor scripts:my_script -h + # + # If you change the namespace: + # + # namespace :my_scripts + # + # You change how your tasks are invoked: + # + # thor my_scripts -h + # + # Finally, if you change your namespace to default: + # + # namespace :default + # + # Your tasks can be invoked with a shortcut. Instead of: + # + # thor :my_task + # + def namespace(name=nil) + case name + when nil + @namespace ||= Thor::Util.namespace_from_thor_class(self, false) + else + @namespace = name.to_s + end + end + + # Default way to start generators from the command line. + # + def start(given_args=ARGV, config={}) + config[:shell] ||= Thor::Base.shell.new + yield + rescue Thor::Error => e + if given_args.include?("--debug") + raise e + else + config[:shell].error e.message + end + exit(1) if exit_on_failure? + end + + protected + + # Prints the class options per group. If an option does not belong to + # any group, it uses the ungrouped name value. This method provide to + # hooks to add extra options, one of them if the third argument called + # extra_group that should be a hash in the format :group => Array[Options]. + # + # The second is by returning a lambda used to print values. The lambda + # requires two options: the group name and the array of options. + # + def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: + groups = {} + + class_options.each do |_, value| + groups[value.group] ||= [] + groups[value.group] << value + end + + printer = proc do |group_name, options| + list = [] + padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 + + options.each do |option| + item = [ option.usage(padding) ] + item.push(option.description ? "# #{option.description}" : "") + + list << item + list << [ "", "# Default: #{option.default}" ] if option.show_default? + end + + unless list.empty? + shell.say(group_name ? "#{group_name} options:" : "Options:") + shell.print_table(list, :ident => 2) + shell.say "" + end + end + + # Deal with default group + global_options = groups.delete(nil) || [] + printer.call(ungrouped_name, global_options) if global_options + + # Print all others + groups = extra_group.merge(groups) if extra_group + groups.each(&printer) + printer + end + + # Raises an error if the word given is a Thor reserved word. + # + def is_thor_reserved_word?(word, type) #:nodoc: + return false unless THOR_RESERVED_WORDS.include?(word.to_s) + raise "#{word.inspect} is a Thor reserved word and cannot be defined as #{type}" + end + + # Build an option and adds it to the given scope. + # + # ==== Parameters + # name:: The name of the argument. + # options:: Described in both class_option and method_option. + # + def build_option(name, options, scope) #:nodoc: + scope[name] = Thor::Option.new(name, options[:desc], options[:required], + options[:type], options[:default], options[:banner], + options[:group], options[:aliases]) + end + + # Receives a hash of options, parse them and add to the scope. This is a + # fast way to set a bunch of options: + # + # build_options :foo => true, :bar => :required, :baz => :string + # + # ==== Parameters + # Hash[Symbol => Object] + # + def build_options(options, scope) #:nodoc: + options.each do |key, value| + scope[key] = Thor::Option.parse(key, value) + end + end + + # Finds a task with the given name. If the task belongs to the current + # class, just return it, otherwise dup it and add the fresh copy to the + # current task hash. + # + def find_and_refresh_task(name) #:nodoc: + task = if task = tasks[name.to_s] + task + elsif task = all_tasks[name.to_s] + tasks[name.to_s] = task.clone + else + raise ArgumentError, "You supplied :for => #{name.inspect}, but the task #{name.inspect} could not be found." + end + end + + # Everytime someone inherits from a Thor class, register the klass + # and file into baseclass. + # + def inherited(klass) + Thor::Base.register_klass_file(klass) + end + + # Fire this callback whenever a method is added. Added methods are + # tracked as tasks by invoking the create_task method. + # + def method_added(meth) + meth = meth.to_s + + if meth == "initialize" + initialize_added + return + end + + # Return if it's not a public instance method + return unless public_instance_methods.include?(meth) || + public_instance_methods.include?(meth.to_sym) + + return if @no_tasks || !create_task(meth) + + is_thor_reserved_word?(meth, :task) + Thor::Base.register_klass_file(self) + end + + # Retrieves a value from superclass. If it reaches the baseclass, + # returns default. + # + def from_superclass(method, default=nil) + if self == baseclass || !superclass.respond_to?(method, true) + default + else + value = superclass.send(method) + value.dup if value + end + end + + # A flag that makes the process exit with status 1 if any error happens. + # + def exit_on_failure? + false + end + + # SIGNATURE: Sets the baseclass. This is where the superclass lookup + # finishes. + def baseclass #:nodoc: + end + + # SIGNATURE: Creates a new task if valid_task? is true. This method is + # called when a new method is added to the class. + def create_task(meth) #:nodoc: + end + + # SIGNATURE: Defines behavior when the initialize method is added to the + # class. + def initialize_added #:nodoc: + end + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb new file mode 100644 index 0000000000..78bc5cf4bf --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/hash_with_indifferent_access.rb @@ -0,0 +1,75 @@ +class Thor + module CoreExt #:nodoc: + + # A hash with indifferent access and magic predicates. + # + # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true + # + # hash[:foo] #=> 'bar' + # hash['foo'] #=> 'bar' + # hash.foo? #=> true + # + class HashWithIndifferentAccess < ::Hash #:nodoc: + + def initialize(hash={}) + super() + hash.each do |key, value| + self[convert_key(key)] = value + end + end + + def [](key) + super(convert_key(key)) + end + + def []=(key, value) + super(convert_key(key), value) + end + + def delete(key) + super(convert_key(key)) + end + + def values_at(*indices) + indices.collect { |key| self[convert_key(key)] } + end + + def merge(other) + dup.merge!(other) + end + + def merge!(other) + other.each do |key, value| + self[convert_key(key)] = value + end + self + end + + protected + + def convert_key(key) + key.is_a?(Symbol) ? key.to_s : key + end + + # Magic predicates. For instance: + # + # options.force? # => !!options['force'] + # options.shebang # => "/usr/lib/local/ruby" + # options.test_framework?(:rspec) # => options[:test_framework] == :rspec + # + def method_missing(method, *args, &block) + method = method.to_s + if method =~ /^(\w+)\?$/ + if args.empty? + !!self[$1] + else + self[$1] == args.first + end + else + self[method] + end + end + + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb new file mode 100644 index 0000000000..27fea5bb35 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/core_ext/ordered_hash.rb @@ -0,0 +1,100 @@ +class Thor + module CoreExt #:nodoc: + + if RUBY_VERSION >= '1.9' + class OrderedHash < ::Hash + end + else + # This class is based on the Ruby 1.9 ordered hashes. + # + # It keeps the semantics and most of the efficiency of normal hashes + # while also keeping track of the order in which elements were set. + # + class OrderedHash #:nodoc: + include Enumerable + + Node = Struct.new(:key, :value, :next, :prev) + + def initialize + @hash = {} + end + + def [](key) + @hash[key] && @hash[key].value + end + + def []=(key, value) + if node = @hash[key] + node.value = value + else + node = Node.new(key, value) + + if @first.nil? + @first = @last = node + else + node.prev = @last + @last.next = node + @last = node + end + end + + @hash[key] = node + value + end + + def delete(key) + if node = @hash[key] + prev_node = node.prev + next_node = node.next + + next_node.prev = prev_node if next_node + prev_node.next = next_node if prev_node + + @first = next_node if @first == node + @last = prev_node if @last == node + + value = node.value + end + + @hash.delete(key) + value + end + + def keys + self.map { |k, v| k } + end + + def values + self.map { |k, v| v } + end + + def each + return unless @first + yield [@first.key, @first.value] + node = @first + yield [node.key, node.value] while node = node.next + self + end + + def merge(other) + hash = self.class.new + + self.each do |key, value| + hash[key] = value + end + + other.each do |key, value| + hash[key] = value + end + + hash + end + + def empty? + @hash.empty? + end + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb new file mode 100644 index 0000000000..f9b31a35d1 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/error.rb @@ -0,0 +1,27 @@ +class Thor + # Thor::Error is raised when it's caused by wrong usage of thor classes. Those + # errors have their backtrace supressed and are nicely shown to the user. + # + # Errors that are caused by the developer, like declaring a method which + # overwrites a thor keyword, it SHOULD NOT raise a Thor::Error. This way, we + # ensure that developer errors are shown with full backtrace. + # + class Error < StandardError + end + + # Raised when a task was not found. + # + class UndefinedTaskError < Error + end + + # Raised when a task was found, but not invoked properly. + # + class InvocationError < Error + end + + class RequiredArgumentMissingError < InvocationError + end + + class MalformattedArgumentError < InvocationError + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb new file mode 100644 index 0000000000..0964a9667a --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/group.rb @@ -0,0 +1,263 @@ +# Thor has a special class called Thor::Group. The main difference to Thor class +# is that it invokes all tasks at once. It also include some methods that allows +# invocations to be done at the class method, which are not available to Thor +# tasks. +# +class Thor::Group + class << self + # The descrition for this Thor::Group. If none is provided, but a source root + # exists, tries to find the USAGE one folder above it, otherwise searches + # in the superclass. + # + # ==== Parameters + # description:: The description for this Thor::Group. + # + def desc(description=nil) + case description + when nil + @desc ||= from_superclass(:desc, nil) + else + @desc = description + end + end + + # Start works differently in Thor::Group, it simply invokes all tasks + # inside the class. + # + def start(given_args=ARGV, config={}) + super do + if Thor::HELP_MAPPINGS.include?(given_args.first) + help(config[:shell]) + return + end + + args, opts = Thor::Options.split(given_args) + new(args, opts, config).invoke + end + end + + # Prints help information. + # + # ==== Options + # short:: When true, shows only usage. + # + def help(shell, options={}) + if options[:short] + shell.say banner + else + shell.say "Usage:" + shell.say " #{banner}" + shell.say + class_options_help(shell) + shell.say self.desc if self.desc + end + end + + # Stores invocations for this class merging with superclass values. + # + def invocations #:nodoc: + @invocations ||= from_superclass(:invocations, {}) + end + + # Stores invocation blocks used on invoke_from_option. + # + def invocation_blocks #:nodoc: + @invocation_blocks ||= from_superclass(:invocation_blocks, {}) + end + + # Invoke the given namespace or class given. It adds an instance + # method that will invoke the klass and task. You can give a block to + # configure how it will be invoked. + # + # The namespace/class given will have its options showed on the help + # usage. Check invoke_from_option for more information. + # + def invoke(*names, &block) + options = names.last.is_a?(Hash) ? names.pop : {} + verbose = options.fetch(:verbose, true) + + names.each do |name| + invocations[name] = false + invocation_blocks[name] = block if block_given? + + class_eval <<-METHOD, __FILE__, __LINE__ + def _invoke_#{name.to_s.gsub(/\W/, '_')} + klass, task = self.class.prepare_for_invocation(nil, #{name.inspect}) + + if klass + say_status :invoke, #{name.inspect}, #{verbose.inspect} + block = self.class.invocation_blocks[#{name.inspect}] + _invoke_for_class_method klass, task, &block + else + say_status :error, %(#{name.inspect} [not found]), :red + end + end + METHOD + end + end + + # Invoke a thor class based on the value supplied by the user to the + # given option named "name". A class option must be created before this + # method is invoked for each name given. + # + # ==== Examples + # + # class GemGenerator < Thor::Group + # class_option :test_framework, :type => :string + # invoke_from_option :test_framework + # end + # + # ==== Boolean options + # + # In some cases, you want to invoke a thor class if some option is true or + # false. This is automatically handled by invoke_from_option. Then the + # option name is used to invoke the generator. + # + # ==== Preparing for invocation + # + # In some cases you want to customize how a specified hook is going to be + # invoked. You can do that by overwriting the class method + # prepare_for_invocation. The class method must necessarily return a klass + # and an optional task. + # + # ==== Custom invocations + # + # You can also supply a block to customize how the option is giong to be + # invoked. The block receives two parameters, an instance of the current + # class and the klass to be invoked. + # + def invoke_from_option(*names, &block) + options = names.last.is_a?(Hash) ? names.pop : {} + verbose = options.fetch(:verbose, :white) + + names.each do |name| + unless class_options.key?(name) + raise ArgumentError, "You have to define the option #{name.inspect} " << + "before setting invoke_from_option." + end + + invocations[name] = true + invocation_blocks[name] = block if block_given? + + class_eval <<-METHOD, __FILE__, __LINE__ + def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')} + return unless options[#{name.inspect}] + + value = options[#{name.inspect}] + value = #{name.inspect} if TrueClass === value + klass, task = self.class.prepare_for_invocation(#{name.inspect}, value) + + if klass + say_status :invoke, value, #{verbose.inspect} + block = self.class.invocation_blocks[#{name.inspect}] + _invoke_for_class_method klass, task, &block + else + say_status :error, %(\#{value} [not found]), :red + end + end + METHOD + end + end + + # Remove a previously added invocation. + # + # ==== Examples + # + # remove_invocation :test_framework + # + def remove_invocation(*names) + names.each do |name| + remove_task(name) + remove_class_option(name) + invocations.delete(name) + invocation_blocks.delete(name) + end + end + + # Overwrite class options help to allow invoked generators options to be + # shown recursively when invoking a generator. + # + def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: + group_options = {} + + get_options_from_invocations(group_options, class_options) do |klass| + klass.send(:get_options_from_invocations, group_options, class_options) + end + + group_options.merge!(extra_group) if extra_group + super(shell, ungrouped_name, group_options) + end + + # Get invocations array and merge options from invocations. Those + # options are added to group_options hash. Options that already exists + # in base_options are not added twice. + # + def get_options_from_invocations(group_options, base_options) #:nodoc: + invocations.each do |name, from_option| + value = if from_option + option = class_options[name] + option.type == :boolean ? name : option.default + else + name + end + next unless value + + klass, task = prepare_for_invocation(name, value) + next unless klass && klass.respond_to?(:class_options) + + value = value.to_s + human_name = value.respond_to?(:classify) ? value.classify : value + + group_options[human_name] ||= [] + group_options[human_name] += klass.class_options.values.select do |option| + base_options[option.name.to_sym].nil? && option.group.nil? && + !group_options.values.flatten.any? { |i| i.name == option.name } + end + + yield klass if block_given? + end + end + + protected + + # The banner for this class. You can customize it if you are invoking the + # thor class by another ways which is not the Thor::Runner. + # + def banner + "#{self.namespace} #{self.arguments.map {|a| a.usage }.join(' ')}" + end + + def baseclass #:nodoc: + Thor::Group + end + + def create_task(meth) #:nodoc: + tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) + true + end + end + + include Thor::Base + + protected + + # Shortcut to invoke with padding and block handling. Use internally by + # invoke and invoke_from_option class methods. + # + def _invoke_for_class_method(klass, task=nil, *args, &block) #:nodoc: + shell.padding += 1 + + result = if block_given? + if block.arity == 2 + block.call(self, klass) + else + block.call(self, klass, task) + end + else + invoke klass, task, *args + end + + shell.padding -= 1 + result + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb new file mode 100644 index 0000000000..32e6a72454 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/invocation.rb @@ -0,0 +1,178 @@ +class Thor + module Invocation + def self.included(base) #:nodoc: + base.extend ClassMethods + end + + module ClassMethods + # Prepare for class methods invocations. This method must return a klass to + # have the invoked class options showed in help messages in generators. + # + def prepare_for_invocation(key, name) #:nodoc: + case name + when Symbol, String + Thor::Util.namespace_to_thor_class_and_task(name.to_s, false) + else + name + end + end + end + + # Make initializer aware of invocations and the initializer proc. + # + def initialize(args=[], options={}, config={}, &block) #:nodoc: + @_invocations = config[:invocations] || Hash.new { |h,k| h[k] = [] } + @_initializer = [ args, options, config ] + super + end + + # Receives a name and invokes it. The name can be a string (either "task" or + # "namespace:task"), a Thor::Task, a Class or a Thor instance. If the task + # cannot be guessed by name, it can also be supplied as second argument. + # + # You can also supply the arguments, options and configuration values for + # the task to be invoked, if none is given, the same values used to + # initialize the invoker are used to initialize the invoked. + # + # ==== Examples + # + # class A < Thor + # def foo + # invoke :bar + # invoke "b:hello", ["José"] + # end + # + # def bar + # invoke "b:hello", ["José"] + # end + # end + # + # class B < Thor + # def hello(name) + # puts "hello #{name}" + # end + # end + # + # You can notice that the method "foo" above invokes two tasks: "bar", + # which belongs to the same class and "hello" which belongs to the class B. + # + # By using an invocation system you ensure that a task is invoked only once. + # In the example above, invoking "foo" will invoke "b:hello" just once, even + # if it's invoked later by "bar" method. + # + # When class A invokes class B, all arguments used on A initialization are + # supplied to B. This allows lazy parse of options. Let's suppose you have + # some rspec tasks: + # + # class Rspec < Thor::Group + # class_option :mock_framework, :type => :string, :default => :rr + # + # def invoke_mock_framework + # invoke "rspec:#{options[:mock_framework]}" + # end + # end + # + # As you noticed, it invokes the given mock framework, which might have its + # own options: + # + # class Rspec::RR < Thor::Group + # class_option :style, :type => :string, :default => :mock + # end + # + # Since it's not rspec concern to parse mock framework options, when RR + # is invoked all options are parsed again, so RR can extract only the options + # that it's going to use. + # + # If you want Rspec::RR to be initialized with its own set of options, you + # have to do that explicitely: + # + # invoke "rspec:rr", [], :style => :foo + # + # Besides giving an instance, you can also give a class to invoke: + # + # invoke Rspec::RR, [], :style => :foo + # + def invoke(name=nil, task=nil, args=nil, opts=nil, config=nil) + task, args, opts, config = nil, task, args, opts if task.nil? || task.is_a?(Array) + args, opts, config = nil, args, opts if args.is_a?(Hash) + + object, task = _prepare_for_invocation(name, task) + klass, instance = _initialize_klass_with_initializer(object, args, opts, config) + + method_args = [] + current = @_invocations[klass] + + iterator = proc do |_, task| + unless current.include?(task.name) + current << task.name + task.run(instance, method_args) + end + end + + if task + args ||= [] + method_args = args[Range.new(klass.arguments.size, -1)] || [] + iterator.call(nil, task) + else + klass.all_tasks.map(&iterator) + end + end + + protected + + # Configuration values that are shared between invocations. + # + def _shared_configuration #:nodoc: + { :invocations => @_invocations } + end + + # Prepare for invocation in the instance level. In this case, we have to + # take into account that a just a task name from the current class was + # given or even a Thor::Task object. + # + def _prepare_for_invocation(name, sent_task=nil) #:nodoc: + if name.is_a?(Thor::Task) + task = name + elsif task = self.class.all_tasks[name.to_s] + object = self + else + object, task = self.class.prepare_for_invocation(nil, name) + task ||= sent_task + end + + # If the object was not set, use self and use the name as task. + object, task = self, name unless object + return object, _validate_task(object, task) + end + + # Check if the object given is a Thor class object and get a task object + # for it. + # + def _validate_task(object, task) #:nodoc: + klass = object.is_a?(Class) ? object : object.class + raise "Expected Thor class, got #{klass}" unless klass <= Thor::Base + + task ||= klass.default_task if klass <= Thor + task = klass.all_tasks[task.to_s] || Thor::Task::Dynamic.new(task) if task && !task.is_a?(Thor::Task) + task + end + + # Initialize klass using values stored in the @_initializer. + # + def _initialize_klass_with_initializer(object, args, opts, config) #:nodoc: + if object.is_a?(Class) + klass = object + + stored_args, stored_opts, stored_config = @_initializer + args ||= stored_args.dup + opts ||= stored_opts.dup + + config ||= {} + config = stored_config.merge(_shared_configuration).merge!(config) + [ klass, klass.new(args, opts, config) ] + else + [ object.class, object ] + end + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb new file mode 100644 index 0000000000..57a3f6e1a5 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser.rb @@ -0,0 +1,4 @@ +require 'thor/parser/argument' +require 'thor/parser/arguments' +require 'thor/parser/option' +require 'thor/parser/options' diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb new file mode 100644 index 0000000000..aa8ace4719 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/argument.rb @@ -0,0 +1,67 @@ +class Thor + class Argument #:nodoc: + VALID_TYPES = [ :numeric, :hash, :array, :string ] + + attr_reader :name, :description, :required, :type, :default, :banner + alias :human_name :name + + def initialize(name, description=nil, required=true, type=:string, default=nil, banner=nil) + class_name = self.class.name.split("::").last + + raise ArgumentError, "#{class_name} name can't be nil." if name.nil? + raise ArgumentError, "Type :#{type} is not valid for #{class_name.downcase}s." if type && !valid_type?(type) + + @name = name.to_s + @description = description + @required = required || false + @type = (type || :string).to_sym + @default = default + @banner = banner || default_banner + + validate! # Trigger specific validations + end + + def usage + required? ? banner : "[#{banner}]" + end + + def required? + required + end + + def show_default? + case default + when Array, String, Hash + !default.empty? + else + default + end + end + + protected + + def validate! + raise ArgumentError, "An argument cannot be required and have default value." if required? && !default.nil? + end + + def valid_type?(type) + VALID_TYPES.include?(type.to_sym) + end + + def default_banner + case type + when :boolean + nil + when :string, :default + human_name.upcase + when :numeric + "N" + when :hash + "key:value" + when :array + "one two three" + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb new file mode 100644 index 0000000000..fb5d965e06 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/arguments.rb @@ -0,0 +1,145 @@ +class Thor + class Arguments #:nodoc: + NUMERIC = /(\d*\.\d+|\d+)/ + + # Receives an array of args and returns two arrays, one with arguments + # and one with switches. + # + def self.split(args) + arguments = [] + + args.each do |item| + break if item =~ /^-/ + arguments << item + end + + return arguments, args[Range.new(arguments.size, -1)] + end + + def self.parse(base, args) + new(base).parse(args) + end + + # Takes an array of Thor::Argument objects. + # + def initialize(arguments=[]) + @assigns, @non_assigned_required = {}, [] + @switches = arguments + + arguments.each do |argument| + if argument.default + @assigns[argument.human_name] = argument.default + elsif argument.required? + @non_assigned_required << argument + end + end + end + + def parse(args) + @pile = args.dup + + @switches.each do |argument| + break unless peek + @non_assigned_required.delete(argument) + @assigns[argument.human_name] = send(:"parse_#{argument.type}", argument.human_name) + end + + check_requirement! + @assigns + end + + private + + def peek + @pile.first + end + + def shift + @pile.shift + end + + def unshift(arg) + unless arg.kind_of?(Array) + @pile.unshift(arg) + else + @pile = arg + @pile + end + end + + def current_is_value? + peek && peek.to_s !~ /^-/ + end + + # Runs through the argument array getting strings that contains ":" and + # mark it as a hash: + # + # [ "name:string", "age:integer" ] + # + # Becomes: + # + # { "name" => "string", "age" => "integer" } + # + def parse_hash(name) + return shift if peek.is_a?(Hash) + hash = {} + + while current_is_value? && peek.include?(?:) + key, value = shift.split(':') + hash[key] = value + end + hash + end + + # Runs through the argument array getting all strings until no string is + # found or a switch is found. + # + # ["a", "b", "c"] + # + # And returns it as an array: + # + # ["a", "b", "c"] + # + def parse_array(name) + return shift if peek.is_a?(Array) + array = [] + + while current_is_value? + array << shift + end + array + end + + # Check if the peel is numeric ofrmat and return a Float or Integer. + # Otherwise raises an error. + # + def parse_numeric(name) + return shift if peek.is_a?(Numeric) + + unless peek =~ NUMERIC && $& == peek + raise MalformattedArgumentError, "expected numeric value for '#{name}'; got #{peek.inspect}" + end + + $&.index('.') ? shift.to_f : shift.to_i + end + + # Parse string, i.e., just return the current value in the pile. + # + def parse_string(name) + shift + end + + # Raises an error if @non_assigned_required array is not empty. + # + def check_requirement! + unless @non_assigned_required.empty? + names = @non_assigned_required.map do |o| + o.respond_to?(:switch_name) ? o.switch_name : o.human_name + end.join("', '") + + class_name = self.class.name.split('::').last.downcase + raise RequiredArgumentMissingError, "no value provided for required #{class_name} '#{names}'" + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb new file mode 100644 index 0000000000..9e40ec73fa --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/option.rb @@ -0,0 +1,132 @@ +class Thor + class Option < Argument #:nodoc: + attr_reader :aliases, :group + + VALID_TYPES = [:boolean, :numeric, :hash, :array, :string] + + def initialize(name, description=nil, required=nil, type=nil, default=nil, banner=nil, group=nil, aliases=nil) + super(name, description, required, type, default, banner) + @aliases = [*aliases].compact + @group = group.to_s.capitalize if group + end + + # This parse quick options given as method_options. It makes several + # assumptions, but you can be more specific using the option method. + # + # parse :foo => "bar" + # #=> Option foo with default value bar + # + # parse [:foo, :baz] => "bar" + # #=> Option foo with default value bar and alias :baz + # + # parse :foo => :required + # #=> Required option foo without default value + # + # parse :foo => 2 + # #=> Option foo with default value 2 and type numeric + # + # parse :foo => :numeric + # #=> Option foo without default value and type numeric + # + # parse :foo => true + # #=> Option foo with default value true and type boolean + # + # The valid types are :boolean, :numeric, :hash, :array and :string. If none + # is given a default type is assumed. This default type accepts arguments as + # string (--foo=value) or booleans (just --foo). + # + # By default all options are optional, unless :required is given. + # + def self.parse(key, value) + if key.is_a?(Array) + name, *aliases = key + else + name, aliases = key, [] + end + + name = name.to_s + default = value + + type = case value + when Symbol + default = nil + + if VALID_TYPES.include?(value) + value + elsif required = (value == :required) + :string + elsif value == :optional + # TODO Remove this warning in the future. + warn "Optional type is deprecated. Choose :boolean or :string instead. Assumed to be :boolean." + :boolean + end + when TrueClass, FalseClass + :boolean + when Numeric + :numeric + when Hash, Array, String + value.class.name.downcase.to_sym + end + + self.new(name.to_s, nil, required, type, default, nil, nil, aliases) + end + + def switch_name + @switch_name ||= dasherized? ? name : dasherize(name) + end + + def human_name + @human_name ||= dasherized? ? undasherize(name) : name + end + + def usage(padding=0) + sample = if banner && !banner.to_s.empty? + "#{switch_name}=#{banner}" + else + switch_name + end + + sample = "[#{sample}]" unless required? + + if aliases.empty? + (" " * padding) << sample + else + "#{aliases.join(', ')}, #{sample}" + end + end + + # Allow some type predicates as: boolean?, string? and etc. + # + def method_missing(method, *args, &block) + given = method.to_s.sub(/\?$/, '').to_sym + if valid_type?(given) + self.type == given + else + super + end + end + + protected + + def validate! + raise ArgumentError, "An option cannot be boolean and required." if boolean? && required? + end + + def valid_type?(type) + VALID_TYPES.include?(type.to_sym) + end + + def dasherized? + name.index('-') == 0 + end + + def undasherize(str) + str.sub(/^-{1,2}/, '') + end + + def dasherize(str) + (str.length > 1 ? "--" : "-") + str.gsub('_', '-') + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb new file mode 100644 index 0000000000..75092308b5 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/parser/options.rb @@ -0,0 +1,142 @@ +class Thor + # This is a modified version of Daniel Berger's Getopt::Long class, licensed + # under Ruby's license. + # + class Options < Arguments #:nodoc: + LONG_RE = /^(--\w+[-\w+]*)$/ + SHORT_RE = /^(-[a-z])$/i + EQ_RE = /^(--\w+[-\w+]*|-[a-z])=(.*)$/i + SHORT_SQ_RE = /^-([a-z]{2,})$/i # Allow either -x -v or -xv style for single char args + SHORT_NUM = /^(-[a-z])#{NUMERIC}$/i + + # Receives a hash and makes it switches. + # + def self.to_switches(options) + options.map do |key, value| + case value + when true + "--#{key}" + when Array + "--#{key} #{value.map{ |v| v.inspect }.join(' ')}" + when Hash + "--#{key} #{value.map{ |k,v| "#{k}:#{v}" }.join(' ')}" + when nil, false + "" + else + "--#{key} #{value.inspect}" + end + end.join(" ") + end + + # Takes a hash of Thor::Option objects. + # + def initialize(options={}) + options = options.values + super(options) + @shorts, @switches = {}, {} + + options.each do |option| + @switches[option.switch_name] = option + + option.aliases.each do |short| + @shorts[short.to_s] ||= option.switch_name + end + end + end + + def parse(args) + @pile = args.dup + + while peek + if current_is_switch? + case shift + when SHORT_SQ_RE + unshift($1.split('').map { |f| "-#{f}" }) + next + when EQ_RE, SHORT_NUM + unshift($2) + switch = $1 + when LONG_RE, SHORT_RE + switch = $1 + end + + switch = normalize_switch(switch) + next unless option = switch_option(switch) + + @assigns[option.human_name] = parse_peek(switch, option) + else + shift + end + end + + check_requirement! + @assigns + end + + protected + + # Returns true if the current value in peek is a registered switch. + # + def current_is_switch? + case peek + when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM + switch?($1) + when SHORT_SQ_RE + $1.split('').any? { |f| switch?("-#{f}") } + end + end + + def switch?(arg) + switch_option(arg) || @shorts.key?(arg) + end + + def switch_option(arg) + if match = no_or_skip?(arg) + @switches[arg] || @switches["--#{match}"] + else + @switches[arg] + end + end + + def no_or_skip?(arg) + arg =~ /^--(no|skip)-([-\w]+)$/ + $2 + end + + # Check if the given argument is actually a shortcut. + # + def normalize_switch(arg) + @shorts.key?(arg) ? @shorts[arg] : arg + end + + # Parse boolean values which can be given as --foo=true, --foo or --no-foo. + # + def parse_boolean(switch) + if current_is_value? + ["true", "TRUE", "t", "T", true].include?(shift) + else + @switches.key?(switch) || !no_or_skip?(switch) + end + end + + # Parse the value at the peek analyzing if it requires an input or not. + # + def parse_peek(switch, option) + unless current_is_value? + if option.boolean? + # No problem for boolean types + elsif no_or_skip?(switch) + return nil # User set value to nil + elsif option.string? && !option.required? + return option.human_name # Return the option name + else + raise MalformattedArgumentError, "no value provided for option '#{switch}'" + end + end + + @non_assigned_required.delete(option) + send(:"parse_#{option.type}", switch) + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb new file mode 100644 index 0000000000..0d0757fdda --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/rake_compat.rb @@ -0,0 +1,66 @@ +require 'rake' + +class Thor + # Adds a compatibility layer to your Thor classes which allows you to use + # rake package tasks. For example, to use rspec rake tasks, one can do: + # + # require 'thor/rake_compat' + # + # class Default < Thor + # include Thor::RakeCompat + # + # Spec::Rake::SpecTask.new(:spec) do |t| + # t.spec_opts = ['--options', "spec/spec.opts"] + # t.spec_files = FileList['spec/**/*_spec.rb'] + # end + # end + # + module RakeCompat + def self.rake_classes + @rake_classes ||= [] + end + + def self.included(base) + # Hack. Make rakefile point to invoker, so rdoc task is generated properly. + rakefile = File.basename(caller[0].match(/(.*):\d+/)[1]) + Rake.application.instance_variable_set(:@rakefile, rakefile) + self.rake_classes << base + end + end +end + +class Object #:nodoc: + alias :rake_task :task + alias :rake_namespace :namespace + + def task(*args, &block) + task = rake_task(*args, &block) + + if klass = Thor::RakeCompat.rake_classes.last + non_namespaced_name = task.name.split(':').last + + description = non_namespaced_name + description << task.arg_names.map{ |n| n.to_s.upcase }.join(' ') + description.strip! + + klass.desc description, task.comment || non_namespaced_name + klass.send :define_method, non_namespaced_name do |*args| + Rake::Task[task.name.to_sym].invoke(*args) + end + end + + task + end + + def namespace(name, &block) + if klass = Thor::RakeCompat.rake_classes.last + const_name = Thor::Util.camel_case(name.to_s).to_sym + klass.const_set(const_name, Class.new(Thor)) + new_klass = klass.const_get(const_name) + Thor::RakeCompat.rake_classes << new_klass + end + + rake_namespace(name, &block) + Thor::RakeCompat.rake_classes.pop + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb new file mode 100644 index 0000000000..9dc70ea069 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/runner.rb @@ -0,0 +1,299 @@ +require 'fileutils' +require 'open-uri' +require 'yaml' +require 'digest/md5' +require 'pathname' + +class Thor::Runner < Thor #:nodoc: + map "-T" => :list, "-i" => :install, "-u" => :update + + # Override Thor#help so it can give information about any class and any method. + # + def help(meth=nil) + if meth && !self.respond_to?(meth) + initialize_thorfiles(meth) + klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) + # Send mapping -h because it works with Thor::Group too + klass.start(["-h", task].compact, :shell => self.shell) + else + super + end + end + + # If a task is not found on Thor::Runner, method missing is invoked and + # Thor::Runner is then responsable for finding the task in all classes. + # + def method_missing(meth, *args) + meth = meth.to_s + initialize_thorfiles(meth) + klass, task = Thor::Util.namespace_to_thor_class_and_task(meth) + args.unshift(task) if task + klass.start(args, :shell => shell) + end + + desc "install NAME", "Install an optionally named Thor file into your system tasks" + method_options :as => :string, :relative => :boolean + def install(name) + initialize_thorfiles + + # If a directory name is provided as the argument, look for a 'main.thor' + # task in said directory. + begin + if File.directory?(File.expand_path(name)) + base, package = File.join(name, "main.thor"), :directory + contents = open(base).read + else + base, package = name, :file + contents = open(name).read + end + rescue OpenURI::HTTPError + raise Error, "Error opening URI '#{name}'" + rescue Errno::ENOENT + raise Error, "Error opening file '#{name}'" + end + + say "Your Thorfile contains:" + say contents + + return false if no?("Do you wish to continue [y/N]?") + + as = options["as"] || begin + first_line = contents.split("\n")[0] + (match = first_line.match(/\s*#\s*module:\s*([^\n]*)/)) ? match[1].strip : nil + end + + unless as + basename = File.basename(name) + as = ask("Please specify a name for #{name} in the system repository [#{basename}]:") + as = basename if as.empty? + end + + location = if options[:relative] || name =~ /^http:\/\// + name + else + File.expand_path(name) + end + + thor_yaml[as] = { + :filename => Digest::MD5.hexdigest(name + as), + :location => location, + :namespaces => Thor::Util.namespaces_in_content(contents, base) + } + + save_yaml(thor_yaml) + say "Storing thor file in your system repository" + destination = File.join(thor_root, thor_yaml[as][:filename]) + + if package == :file + File.open(destination, "w") { |f| f.puts contents } + else + FileUtils.cp_r(name, destination) + end + + thor_yaml[as][:filename] # Indicate success + end + + desc "uninstall NAME", "Uninstall a named Thor module" + def uninstall(name) + raise Error, "Can't find module '#{name}'" unless thor_yaml[name] + say "Uninstalling #{name}." + FileUtils.rm_rf(File.join(thor_root, "#{thor_yaml[name][:filename]}")) + + thor_yaml.delete(name) + save_yaml(thor_yaml) + + puts "Done." + end + + desc "update NAME", "Update a Thor file from its original location" + def update(name) + raise Error, "Can't find module '#{name}'" if !thor_yaml[name] || !thor_yaml[name][:location] + + say "Updating '#{name}' from #{thor_yaml[name][:location]}" + + old_filename = thor_yaml[name][:filename] + self.options = self.options.merge("as" => name) + filename = install(thor_yaml[name][:location]) + + unless filename == old_filename + File.delete(File.join(thor_root, old_filename)) + end + end + + desc "installed", "List the installed Thor modules and tasks" + method_options :internal => :boolean + def installed + initialize_thorfiles(nil, true) + + klasses = Thor::Base.subclasses + klasses -= [Thor, Thor::Runner] unless options["internal"] + + display_klasses(true, klasses) + end + + desc "list [SEARCH]", "List the available thor tasks (--substring means .*SEARCH)" + method_options :substring => :boolean, :group => :string, :all => :boolean + def list(search="") + initialize_thorfiles + + search = ".*#{search}" if options["substring"] + search = /^#{search}.*/i + group = options[:group] || "standard" + + klasses = Thor::Base.subclasses.select do |k| + (options[:all] || k.group == group) && k.namespace =~ search + end + + display_klasses(false, klasses) + end + + private + + def thor_root + Thor::Util.thor_root + end + + def thor_yaml + @thor_yaml ||= begin + yaml_file = File.join(thor_root, "thor.yml") + yaml = YAML.load_file(yaml_file) if File.exists?(yaml_file) + yaml || {} + end + end + + # Save the yaml file. If none exists in thor root, creates one. + # + def save_yaml(yaml) + yaml_file = File.join(thor_root, "thor.yml") + + unless File.exists?(yaml_file) + FileUtils.mkdir_p(thor_root) + yaml_file = File.join(thor_root, "thor.yml") + FileUtils.touch(yaml_file) + end + + File.open(yaml_file, "w") { |f| f.puts yaml.to_yaml } + end + + def self.exit_on_failure? + true + end + + # Load the thorfiles. If relevant_to is supplied, looks for specific files + # in the thor_root instead of loading them all. + # + # By default, it also traverses the current path until find Thor files, as + # described in thorfiles. This look up can be skipped by suppliying + # skip_lookup true. + # + def initialize_thorfiles(relevant_to=nil, skip_lookup=false) + thorfiles(relevant_to, skip_lookup).each do |f| + Thor::Util.load_thorfile(f) unless Thor::Base.subclass_files.keys.include?(File.expand_path(f)) + end + end + + # Finds Thorfiles by traversing from your current directory down to the root + # directory of your system. If at any time we find a Thor file, we stop. + # + # We also ensure that system-wide Thorfiles are loaded first, so local + # Thorfiles can override them. + # + # ==== Example + # + # If we start at /Users/wycats/dev/thor ... + # + # 1. /Users/wycats/dev/thor + # 2. /Users/wycats/dev + # 3. /Users/wycats <-- we find a Thorfile here, so we stop + # + # Suppose we start at c:\Documents and Settings\james\dev\thor ... + # + # 1. c:\Documents and Settings\james\dev\thor + # 2. c:\Documents and Settings\james\dev + # 3. c:\Documents and Settings\james + # 4. c:\Documents and Settings + # 5. c:\ <-- no Thorfiles found! + # + def thorfiles(relevant_to=nil, skip_lookup=false) + # TODO Remove this dealing with deprecated thor when :namespaces: is available as constants + save_yaml(thor_yaml) if Thor::Util.convert_constants_to_namespaces(thor_yaml) + + thorfiles = [] + + unless skip_lookup + Pathname.pwd.ascend do |path| + thorfiles = Thor::Util.globs_for(path).map { |g| Dir[g] }.flatten + break unless thorfiles.empty? + end + end + + files = (relevant_to ? thorfiles_relevant_to(relevant_to) : Thor::Util.thor_root_glob) + files += thorfiles + files -= ["#{thor_root}/thor.yml"] + + files.map! do |file| + File.directory?(file) ? File.join(file, "main.thor") : file + end + end + + # Load thorfiles relevant to the given method. If you provide "foo:bar" it + # will load all thor files in the thor.yaml that has "foo" e "foo:bar" + # namespaces registered. + # + def thorfiles_relevant_to(meth) + lookup = [ meth, meth.split(":")[0...-1].join(":") ] + + files = thor_yaml.select do |k, v| + v[:namespaces] && !(v[:namespaces] & lookup).empty? + end + + files.map { |k, v| File.join(thor_root, "#{v[:filename]}") } + end + + # Display information about the given klasses. If with_module is given, + # it shows a table with information extracted from the yaml file. + # + def display_klasses(with_modules=false, klasses=Thor.subclasses) + klasses -= [Thor, Thor::Runner] unless with_modules + raise Error, "No Thor tasks available" if klasses.empty? + + if with_modules && !thor_yaml.empty? + info = [] + labels = ["Modules", "Namespaces"] + + info << labels + info << [ "-" * labels[0].size, "-" * labels[1].size ] + + thor_yaml.each do |name, hash| + info << [ name, hash[:namespaces].join(", ") ] + end + + print_table info + say "" + end + + unless klasses.empty? + klasses.dup.each do |klass| + klasses -= Thor::Util.thor_classes_in(klass) + end + + klasses.each { |k| display_tasks(k) } + else + say "\033[1;34mNo Thor tasks available\033[0m" + end + end + + # Display tasks from the given Thor class. + # + def display_tasks(klass) + unless klass.tasks.empty? + base = klass.namespace + + color = base == "default" ? :magenta : :blue + say shell.set_color(base, color, true) + say "-" * base.length + + klass.help(shell, :short => true, :ident => 0, :namespace => true) + end + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb new file mode 100644 index 0000000000..1dc8f0e5b4 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell.rb @@ -0,0 +1,78 @@ +require 'rbconfig' +require 'thor/shell/color' + +class Thor + module Base + # Returns the shell used in all Thor classes. If you are in a Unix platform + # it will use a colored log, otherwise it will use a basic one without color. + # + def self.shell + @shell ||= if Config::CONFIG['host_os'] =~ /mswin|mingw/ + Thor::Shell::Basic + else + Thor::Shell::Color + end + end + + # Sets the shell used in all Thor classes. + # + def self.shell=(klass) + @shell = klass + end + end + + module Shell + SHELL_DELEGATED_METHODS = [:ask, :yes?, :no?, :say, :say_status, :print_list, :print_table] + + # Add shell to initialize config values. + # + # ==== Configuration + # shell:: An instance of the shell to be used. + # + # ==== Examples + # + # class MyScript < Thor + # argument :first, :type => :numeric + # end + # + # MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new + # + def initialize(args=[], options={}, config={}) + super + self.shell = config[:shell] + self.shell.base ||= self if self.shell.respond_to?(:base) + end + + # Holds the shell for the given Thor instance. If no shell is given, + # it gets a default shell from Thor::Base.shell. + # + def shell + @shell ||= Thor::Base.shell.new + end + + # Sets the shell for this thor class. + # + def shell=(shell) + @shell = shell + end + + # Common methods that are delegated to the shell. + # + SHELL_DELEGATED_METHODS.each do |method| + module_eval <<-METHOD, __FILE__, __LINE__ + def #{method}(*args) + shell.#{method}(*args) + end + METHOD + end + + protected + + # Allow shell to be shared between invocations. + # + def _shared_configuration #:nodoc: + super.merge!(:shell => self.shell) + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb new file mode 100644 index 0000000000..ea9665380b --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/shell/basic.rb @@ -0,0 +1,219 @@ +require 'tempfile' + +class Thor + module Shell + class Basic + attr_accessor :base, :padding + + # Initialize base and padding to nil. + # + def initialize #:nodoc: + @base, @padding = nil, 0 + end + + # Sets the output padding, not allowing less than zero values. + # + def padding=(value) + @padding = [0, value].max + end + + # Ask something to the user and receives a response. + # + # ==== Example + # ask("What is your name?") + # + def ask(statement, color=nil) + say("#{statement} ", color) + $stdin.gets.strip + end + + # Say (print) something to the user. If the sentence ends with a whitespace + # or tab character, a new line is not appended (print + flush). Otherwise + # are passed straight to puts (behavior got from Highline). + # + # ==== Example + # say("I know you knew that.") + # + def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)$/)) + message = message.to_s + message = set_color(message, color) if color + + if force_new_line + $stdout.puts(message) + else + $stdout.print(message) + $stdout.flush + end + end + + # Say a status with the given color and appends the message. Since this + # method is used frequently by actions, it allows nil or false to be given + # in log_status, avoiding the message from being shown. If a Symbol is + # given in log_status, it's used as the color. + # + def say_status(status, message, log_status=true) + return if quiet? || log_status == false + spaces = " " * (padding + 1) + color = log_status.is_a?(Symbol) ? log_status : :green + + status = status.to_s.rjust(12) + status = set_color status, color, true if color + say "#{status}#{spaces}#{message}", nil, true + end + + # Make a question the to user and returns true if the user replies "y" or + # "yes". + # + def yes?(statement, color=nil) + ask(statement, color) =~ is?(:yes) + end + + # Make a question the to user and returns true if the user replies "n" or + # "no". + # + def no?(statement, color=nil) + !yes?(statement, color) + end + + # Prints a list of items. + # + # ==== Parameters + # list + # + # ==== Options + # mode:: Can be :rows or :inline. Defaults to :rows. + # ident:: Ident each item with the value given. + # + def print_list(list, options={}) + return if list.empty? + + ident = " " * (options[:ident] || 0) + content = case options[:mode] + when :inline + last = list.pop + "#{list.join(", ")}, and #{last}" + else # rows + ident + list.join("\n#{ident}") + end + + $stdout.puts content + end + + # Prints a table. + # + # ==== Parameters + # Array[Array[String, String, ...]] + # + # ==== Options + # ident:: Ident the first column by ident value. + # + def print_table(table, options={}) + return if table.empty? + + formats = [] + 0.upto(table.first.length - 2) do |i| + maxima = table.max{ |a,b| a[i].size <=> b[i].size }[i].size + formats << "%-#{maxima + 2}s" + end + + formats[0] = formats[0].insert(0, " " * options[:ident]) if options[:ident] + formats << "%s" + + table.each do |row| + row.each_with_index do |column, i| + $stdout.print formats[i] % column.to_s + end + $stdout.puts + end + end + + # Deals with file collision and returns true if the file should be + # overwriten and false otherwise. If a block is given, it uses the block + # response as the content for the diff. + # + # ==== Parameters + # destination:: the destination file to solve conflicts + # block:: an optional block that returns the value to be used in diff + # + def file_collision(destination) + return true if @always_force + options = block_given? ? "[Ynaqdh]" : "[Ynaqh]" + + while true + answer = ask %[Overwrite #{destination}? (enter "h" for help) #{options}] + + case answer + when is?(:yes), is?(:force) + return true + when is?(:no), is?(:skip) + return false + when is?(:always) + return @always_force = true + when is?(:quit) + say 'Aborting...' + raise SystemExit + when is?(:diff) + show_diff(destination, yield) if block_given? + say 'Retrying...' + else + say file_collision_help + end + end + end + + # Called if something goes wrong during the execution. This is used by Thor + # internally and should not be used inside your scripts. If someone went + # wrong, you can always raise an exception. If you raise a Thor::Error, it + # will be rescued and wrapped in the method below. + # + def error(statement) + $stderr.puts statement + end + + # Apply color to the given string with optional bold. Disabled in the + # Thor::Shell::Basic class. + # + def set_color(string, color, bold=false) #:nodoc: + string + end + + protected + + def is?(value) #:nodoc: + value = value.to_s + + if value.size == 1 + /\A#{value}\z/i + else + /\A(#{value}|#{value[0,1]})\z/i + end + end + + def file_collision_help #:nodoc: +< e + parse_argument_error(instance, e, caller) + rescue NoMethodError => e + parse_no_method_error(instance, e) + end + + # Returns the formatted usage. If a class is given, the class arguments are + # injected in the usage. + # + def formatted_usage(klass=nil, namespace=false, show_options=true) + formatted = if namespace.is_a?(String) + "#{namespace}:" + elsif klass && namespace + "#{klass.namespace.gsub(/^default/,'')}:" + else + "" + end + + formatted << formatted_arguments(klass) + formatted << " #{formatted_options}" if show_options + formatted.strip! + formatted + end + + # Injects the class arguments into the task usage. + # + def formatted_arguments(klass) + if klass && !klass.arguments.empty? + usage.to_s.gsub(/^#{name}/) do |match| + match << " " << klass.arguments.map{ |a| a.usage }.join(' ') + end + else + usage.to_s + end + end + + # Returns the options usage for this task. + # + def formatted_options + @formatted_options ||= options.map{ |_, o| o.usage }.sort.join(" ") + end + + protected + + # Given a target, checks if this class name is not a private/protected method. + # + def public_method?(instance) #:nodoc: + collection = instance.private_methods + instance.protected_methods + (collection & [name.to_s, name.to_sym]).empty? + end + + # Clean everything that comes from the Thor gempath and remove the caller. + # + def sans_backtrace(backtrace, caller) #:nodoc: + dirname = /^#{Regexp.escape(File.dirname(__FILE__))}/ + saned = backtrace.reject { |frame| frame =~ dirname } + saned -= caller + end + + def parse_argument_error(instance, e, caller) #:nodoc: + backtrace = sans_backtrace(e.backtrace, caller) + + if backtrace.empty? && e.message =~ /wrong number of arguments/ + if instance.is_a?(Thor::Group) + raise e, "'#{name}' was called incorrectly. Are you sure it has arity equals to 0?" + else + raise InvocationError, "'#{name}' was called incorrectly. Call as " << + "'#{formatted_usage(instance.class, true)}'" + end + else + raise e + end + end + + def parse_no_method_error(instance, e) #:nodoc: + if e.message =~ /^undefined method `#{name}' for #{Regexp.escape(instance.to_s)}$/ + raise UndefinedTaskError, "The #{instance.class.namespace} namespace " << + "doesn't have a '#{name}' task" + else + raise e + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb new file mode 100644 index 0000000000..ebae0a3193 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/util.rb @@ -0,0 +1,251 @@ +require 'rbconfig' + +class Thor + module Sandbox #:nodoc: + end + + # This module holds several utilities: + # + # 1) Methods to convert thor namespaces to constants and vice-versa. + # + # Thor::Utils.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz" + # + # 2) Loading thor files and sandboxing: + # + # Thor::Utils.load_thorfile("~/.thor/foo") + # + module Util + + # Receives a namespace and search for it in the Thor::Base subclasses. + # + # ==== Parameters + # namespace:: The namespace to search for. + # + def self.find_by_namespace(namespace) + namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/ + + Thor::Base.subclasses.find do |klass| + klass.namespace == namespace + end + end + + # Receives a constant and converts it to a Thor namespace. Since Thor tasks + # can be added to a sandbox, this method is also responsable for removing + # the sandbox namespace. + # + # This method should not be used in general because it's used to deal with + # older versions of Thor. On current versions, if you need to get the + # namespace from a class, just call namespace on it. + # + # ==== Parameters + # constant:: The constant to be converted to the thor path. + # + # ==== Returns + # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz" + # + def self.namespace_from_thor_class(constant, remove_default=true) + constant = constant.to_s.gsub(/^Thor::Sandbox::/, "") + constant = snake_case(constant).squeeze(":") + constant.gsub!(/^default/, '') if remove_default + constant + end + + # Given the contents, evaluate it inside the sandbox and returns the + # namespaces defined in the sandbox. + # + # ==== Parameters + # contents + # + # ==== Returns + # Array[Object] + # + def self.namespaces_in_content(contents, file=__FILE__) + old_constants = Thor::Base.subclasses.dup + Thor::Base.subclasses.clear + + load_thorfile(file, contents) + + new_constants = Thor::Base.subclasses.dup + Thor::Base.subclasses.replace(old_constants) + + new_constants.map!{ |c| c.namespace } + new_constants.compact! + new_constants + end + + # Returns the thor classes declared inside the given class. + # + def self.thor_classes_in(klass) + Thor::Base.subclasses.select do |subclass| + klass.constants.include?(subclass.name.gsub("#{klass.name}::", '')) + end + end + + # Receives a string and convert it to snake case. SnakeCase returns snake_case. + # + # ==== Parameters + # String + # + # ==== Returns + # String + # + def self.snake_case(str) + return str.downcase if str =~ /^[A-Z_]+$/ + str.gsub(/\B[A-Z]/, '_\&').squeeze('_') =~ /_*(.*)/ + return $+.downcase + end + + # Receives a string and convert it to camel case. camel_case returns CamelCase. + # + # ==== Parameters + # String + # + # ==== Returns + # String + # + def self.camel_case(str) + return str if str !~ /_/ && str =~ /[A-Z]+.*/ + str.split('_').map { |i| i.capitalize }.join + end + + # Receives a namespace and tries to retrieve a Thor or Thor::Group class + # from it. It first searches for a class using the all the given namespace, + # if it's not found, removes the highest entry and searches for the class + # again. If found, returns the highest entry as the class name. + # + # ==== Examples + # + # class Foo::Bar < Thor + # def baz + # end + # end + # + # class Baz::Foo < Thor::Group + # end + # + # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default task + # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil + # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz" + # + # ==== Parameters + # namespace + # + # ==== Errors + # Thor::Error:: raised if the namespace cannot be found. + # + # Thor::Error:: raised if the namespace evals to a class which does not + # inherit from Thor or Thor::Group. + # + def self.namespace_to_thor_class_and_task(namespace, raise_if_nil=true) + if namespace.include?(?:) + pieces = namespace.split(":") + task = pieces.pop + klass = Thor::Util.find_by_namespace(pieces.join(":")) + end + + unless klass + klass, task = Thor::Util.find_by_namespace(namespace), nil + end + + raise Error, "could not find Thor class or task '#{namespace}'" if raise_if_nil && klass.nil? + return klass, task + end + + # Receives a path and load the thor file in the path. The file is evaluated + # inside the sandbox to avoid namespacing conflicts. + # + def self.load_thorfile(path, content=nil) + content ||= File.read(path) + + begin + Thor::Sandbox.class_eval(content, path) + rescue Exception => e + $stderr.puts "WARNING: unable to load thorfile #{path.inspect}: #{e.message}" + end + end + + # Receives a yaml (hash) and updates all constants entries to namespace. + # This was added to deal with deprecated versions of Thor. + # + # TODO Deprecate this method in the future. + # + # ==== Returns + # TrueClass|FalseClass:: Returns true if any change to the yaml file was made. + # + def self.convert_constants_to_namespaces(yaml) + yaml_changed = false + + yaml.each do |k, v| + next unless v[:constants] && v[:namespaces].nil? + yaml_changed = true + yaml[k][:namespaces] = v[:constants].map{|c| Thor::Util.namespace_from_thor_class(c)} + end + + yaml_changed + end + + def self.user_home + @@user_home ||= if ENV["HOME"] + ENV["HOME"] + elsif ENV["USERPROFILE"] + ENV["USERPROFILE"] + elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"] + File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]) + elsif ENV["APPDATA"] + ENV["APPDATA"] + else + begin + File.expand_path("~") + rescue + if File::ALT_SEPARATOR + "C:/" + else + "/" + end + end + end + end + + # Returns the root where thor files are located, dependending on the OS. + # + def self.thor_root + File.join(user_home, ".thor").gsub(/\\/, '/') + end + + # Returns the files in the thor root. On Windows thor_root will be something + # like this: + # + # C:\Documents and Settings\james\.thor + # + # If we don't #gsub the \ character, Dir.glob will fail. + # + def self.thor_root_glob + files = Dir["#{thor_root}/*"] + + files.map! do |file| + File.directory?(file) ? File.join(file, "main.thor") : file + end + end + + # Where to look for Thor files. + # + def self.globs_for(path) + ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"] + end + + # Return the path to the ruby interpreter taking into account multiple + # installations and windows extensions. + # + def self.ruby_command + @ruby_command ||= begin + ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + ruby << Config::CONFIG['EXEEXT'] + + # escape string in case path to ruby executable contain spaces. + ruby.sub!(/.*\s.*/m, '"\&"') + ruby + end + end + + end +end diff --git a/railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb new file mode 100644 index 0000000000..885230fac4 --- /dev/null +++ b/railties/lib/rails/vendor/thor-0.12.0/lib/thor/version.rb @@ -0,0 +1,3 @@ +class Thor + VERSION = "0.11.8".freeze +end -- cgit v1.2.3 From 51fe6d05e73a4e0f8481f4e441f4ca886d65a69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 6 Nov 2009 23:40:18 -0200 Subject: Refactor generators a little bit. Signed-off-by: Yehuda Katz --- railties/lib/rails/commands/destroy.rb | 3 +++ railties/lib/rails/commands/generate.rb | 3 +++ railties/lib/rails/generators/rails/app/app_generator.rb | 6 ++++-- railties/lib/rails/generators/rails/app/templates/script/about | 3 +++ railties/lib/rails/generators/rails/app/templates/script/about.tt | 4 ---- railties/lib/rails/generators/rails/app/templates/script/console | 2 ++ railties/lib/rails/generators/rails/app/templates/script/console.tt | 3 --- railties/lib/rails/generators/rails/app/templates/script/dbconsole | 2 ++ .../lib/rails/generators/rails/app/templates/script/dbconsole.tt | 3 --- railties/lib/rails/generators/rails/app/templates/script/destroy | 2 ++ railties/lib/rails/generators/rails/app/templates/script/destroy.tt | 5 ----- railties/lib/rails/generators/rails/app/templates/script/generate | 2 ++ .../lib/rails/generators/rails/app/templates/script/generate.tt | 5 ----- .../generators/rails/app/templates/script/performance/benchmarker | 2 ++ .../rails/app/templates/script/performance/benchmarker.tt | 3 --- .../generators/rails/app/templates/script/performance/profiler | 2 ++ .../generators/rails/app/templates/script/performance/profiler.tt | 3 --- railties/lib/rails/generators/rails/app/templates/script/plugin | 2 ++ railties/lib/rails/generators/rails/app/templates/script/plugin.tt | 3 --- railties/lib/rails/generators/rails/app/templates/script/runner | 2 ++ railties/lib/rails/generators/rails/app/templates/script/runner.tt | 3 --- railties/lib/rails/generators/rails/app/templates/script/server | 2 ++ railties/lib/rails/generators/rails/app/templates/script/server.tt | 3 --- 23 files changed, 31 insertions(+), 37 deletions(-) create mode 100755 railties/lib/rails/generators/rails/app/templates/script/about delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/about.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/console delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/console.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/dbconsole delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/destroy delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/destroy.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/generate delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/generate.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/performance/profiler delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/plugin delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/plugin.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/runner delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/runner.tt create mode 100755 railties/lib/rails/generators/rails/app/templates/script/server delete mode 100755 railties/lib/rails/generators/rails/app/templates/script/server.tt diff --git a/railties/lib/rails/commands/destroy.rb b/railties/lib/rails/commands/destroy.rb index 15ff90f78a..f85c17bb94 100644 --- a/railties/lib/rails/commands/destroy.rb +++ b/railties/lib/rails/commands/destroy.rb @@ -1,3 +1,6 @@ +require 'rails/generators' +Rails::Generators.configure! + if ARGV.size == 0 Rails::Generators.help exit diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index 82a658e2ed..c5e3ae3529 100755 --- a/railties/lib/rails/commands/generate.rb +++ b/railties/lib/rails/commands/generate.rb @@ -1,3 +1,6 @@ +require 'rails/generators' +Rails::Generators.configure! + if ARGV.size == 0 Rails::Generators.help exit diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index e552cc4520..2bcea4bc8f 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -123,8 +123,10 @@ module Rails::Generators end def create_script_files - directory "script" - chmod "script", 0755, :verbose => false + directory "script" do |file| + prepend_file file, "#{shebang}\n", :verbose => false + chmod file, 0755, :verbose => false + end end def create_test_files diff --git a/railties/lib/rails/generators/rails/app/templates/script/about b/railties/lib/rails/generators/rails/app/templates/script/about new file mode 100755 index 0000000000..93fd007649 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/about @@ -0,0 +1,3 @@ +require File.expand_path('../../config/environment', __FILE__) +$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" +require 'rails/commands/about' diff --git a/railties/lib/rails/generators/rails/app/templates/script/about.tt b/railties/lib/rails/generators/rails/app/templates/script/about.tt deleted file mode 100755 index 7639d4040f..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/about.tt +++ /dev/null @@ -1,4 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/environment', __FILE__) -$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" -require 'rails/commands/about' diff --git a/railties/lib/rails/generators/rails/app/templates/script/console b/railties/lib/rails/generators/rails/app/templates/script/console new file mode 100755 index 0000000000..20aa799d2f --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/console @@ -0,0 +1,2 @@ +require File.expand_path('../../config/application', __FILE__) +require 'rails/commands/console' diff --git a/railties/lib/rails/generators/rails/app/templates/script/console.tt b/railties/lib/rails/generators/rails/app/templates/script/console.tt deleted file mode 100755 index 1cd2eb8b53..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/console.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/application', __FILE__) -require 'rails/commands/console' diff --git a/railties/lib/rails/generators/rails/app/templates/script/dbconsole b/railties/lib/rails/generators/rails/app/templates/script/dbconsole new file mode 100755 index 0000000000..e6a1c59394 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/dbconsole @@ -0,0 +1,2 @@ +require File.expand_path('../../config/application', __FILE__) +require 'rails/commands/dbconsole' diff --git a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt b/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt deleted file mode 100755 index 94beb13715..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/application', __FILE__) -require 'rails/commands/dbconsole' diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy b/railties/lib/rails/generators/rails/app/templates/script/destroy new file mode 100755 index 0000000000..adfa8e8426 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/destroy @@ -0,0 +1,2 @@ +require File.expand_path('../../config/environment', __FILE__) +require 'rails/commands/destroy' diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt b/railties/lib/rails/generators/rails/app/templates/script/destroy.tt deleted file mode 100755 index 6adc90b2c3..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/destroy.tt +++ /dev/null @@ -1,5 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/environment', __FILE__) -require 'rails/generators' -Rails::Generators.configure! -require 'rails/commands/destroy' diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate b/railties/lib/rails/generators/rails/app/templates/script/generate new file mode 100755 index 0000000000..6fb8ad0395 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/generate @@ -0,0 +1,2 @@ +require File.expand_path('../../config/environment', __FILE__) +require 'rails/commands/generate' diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate.tt b/railties/lib/rails/generators/rails/app/templates/script/generate.tt deleted file mode 100755 index 71d47dec92..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/generate.tt +++ /dev/null @@ -1,5 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/environment', __FILE__) -require 'rails/generators' -Rails::Generators.configure! -require 'rails/commands/generate' diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker b/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker new file mode 100755 index 0000000000..9647d8f10a --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker @@ -0,0 +1,2 @@ +require File.expand_path('../../../config/environment', __FILE__) +require 'rails/commands/performance/benchmarker' diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt b/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt deleted file mode 100755 index 9ebc4c92fc..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../../config/environment', __FILE__) -require 'rails/commands/performance/benchmarker' diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler b/railties/lib/rails/generators/rails/app/templates/script/performance/profiler new file mode 100755 index 0000000000..a5822042d2 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/performance/profiler @@ -0,0 +1,2 @@ +require File.expand_path('../../../config/environment', __FILE__) +require 'rails/commands/performance/profiler' diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt b/railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt deleted file mode 100755 index 5f4c763f9d..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../../config/environment', __FILE__) -require 'rails/commands/performance/profiler' diff --git a/railties/lib/rails/generators/rails/app/templates/script/plugin b/railties/lib/rails/generators/rails/app/templates/script/plugin new file mode 100755 index 0000000000..1f1af6c880 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/plugin @@ -0,0 +1,2 @@ +require File.expand_path('../../config/application', __FILE__) +require 'rails/commands/plugin' diff --git a/railties/lib/rails/generators/rails/app/templates/script/plugin.tt b/railties/lib/rails/generators/rails/app/templates/script/plugin.tt deleted file mode 100755 index 4a335ee33c..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/plugin.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/application', __FILE__) -require 'rails/commands/plugin' diff --git a/railties/lib/rails/generators/rails/app/templates/script/runner b/railties/lib/rails/generators/rails/app/templates/script/runner new file mode 100755 index 0000000000..7a70828e90 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/runner @@ -0,0 +1,2 @@ +require File.expand_path('../../config/environment', __FILE__) +require 'rails/commands/runner' diff --git a/railties/lib/rails/generators/rails/app/templates/script/runner.tt b/railties/lib/rails/generators/rails/app/templates/script/runner.tt deleted file mode 100755 index 34ad7c18eb..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/runner.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/environment', __FILE__) -require 'rails/commands/runner' diff --git a/railties/lib/rails/generators/rails/app/templates/script/server b/railties/lib/rails/generators/rails/app/templates/script/server new file mode 100755 index 0000000000..a7aaee2953 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/script/server @@ -0,0 +1,2 @@ +require File.expand_path('../../config/application', __FILE__) +require 'rails/commands/server' diff --git a/railties/lib/rails/generators/rails/app/templates/script/server.tt b/railties/lib/rails/generators/rails/app/templates/script/server.tt deleted file mode 100755 index 932e72ea58..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/script/server.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= shebang %> -require File.expand_path('../../config/application', __FILE__) -require 'rails/commands/server' -- cgit v1.2.3 From c44fb4ced5cbe61adb12f3431db05afa492bd176 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 21:30:34 -0800 Subject: Ruby 1.9: use method_name to work around miniunit API changes --- activesupport/lib/active_support/testing/setup_and_teardown.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index 7952eb50c3..0e998d2dbe 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -21,12 +21,12 @@ module ActiveSupport run_callbacks :setup result = super rescue Exception => e - result = runner.puke(self.class, self.name, e) + result = runner.puke(self.class, method_name, e) ensure begin run_callbacks :teardown, :enumerator => :reverse_each rescue Exception => e - result = runner.puke(self.class, self.name, e) + result = runner.puke(self.class, method_name, e) end end result -- cgit v1.2.3 From 7ad461b44dabb586fbad190493ac4ecd96104597 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 21:31:06 -0800 Subject: Ruby 1.9.2: avoid Array#to_s and Array(nil) --- .../lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb index 1b49debc05..7487b96b8c 100755 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb @@ -195,10 +195,19 @@ module I18n # Merges the given locale, key and scope into a single array of keys. # Splits keys that contain dots into multiple keys. Makes sure all # keys are Symbols. - def normalize_translation_keys(locale, key, scope) - keys = [locale] + Array(scope) + [key] - keys = keys.map { |k| k.to_s.split(/\./) } - keys.flatten.map { |k| k.to_sym } + def normalize_translation_keys(*keys) + normalized = [] + keys.each do |key| + case key + when Array + normalized.concat normalize_translation_keys(*key) + when nil + # skip + else + normalized.concat key.to_s.split('.').map { |sub| sub.to_sym } + end + end + normalized end end end -- cgit v1.2.3 From 20cdaddfd27dfeef5c853e85fafa4e13b6da05f3 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 21:55:43 -0800 Subject: Ruby 1.9.2: work around changes to flatten and nil.to_str --- activesupport/lib/active_support/cache.rb | 3 ++- .../lib/active_support/core_ext/hash/conversions.rb | 3 ++- activesupport/lib/active_support/dependencies.rb | 2 +- .../lib/active_support/deprecated_callbacks.rb | 5 +++-- .../lib/active_support/json/backends/jsongem.rb | 21 ++++++++++++--------- activesupport/test/multibyte_chars_test.rb | 6 +++--- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index b91ae65e9f..2f714c62ee 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -43,7 +43,8 @@ module ActiveSupport # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new) # # => returns MyOwnCacheStore.new def self.lookup_store(*store_option) - store, *parameters = *([ store_option ].flatten) + store = store_option.shift + parameters = store_option case store when Symbol diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index 190173f8a0..35ccec5df4 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -1,4 +1,5 @@ require 'active_support/time' +require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/hash/reverse_merge' class Hash @@ -138,7 +139,7 @@ class Hash case value.class.to_s when 'Hash' if value['type'] == 'array' - child_key, entries = value.detect { |k,v| k != 'type' } # child_key is throwaway + child_key, entries = Array.wrap(value.detect { |k,v| k != 'type' }) # child_key is throwaway if entries.nil? || (c = value['__content__'] && c.blank?) [] else diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 7f6f012721..e858bcdc80 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -339,7 +339,7 @@ module ActiveSupport #:nodoc: next end [ nesting_camel ] - end.flatten.compact.uniq + end.compact.flatten.compact.uniq end # Search for a file in load_paths matching the provided suffix. diff --git a/activesupport/lib/active_support/deprecated_callbacks.rb b/activesupport/lib/active_support/deprecated_callbacks.rb index 20fb03cbeb..f56fef0b6d 100644 --- a/activesupport/lib/active_support/deprecated_callbacks.rb +++ b/activesupport/lib/active_support/deprecated_callbacks.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/array/extract_options' +require 'active_support/core_ext/array/wrap' module ActiveSupport # Callbacks are hooks into the lifecycle of an object that allow you to trigger logic @@ -194,8 +195,8 @@ module ActiveSupport end def should_run_callback?(*args) - [options[:if]].flatten.compact.all? { |a| evaluate_method(a, *args) } && - ![options[:unless]].flatten.compact.any? { |a| evaluate_method(a, *args) } + Array.wrap(options[:if]).flatten.compact.all? { |a| evaluate_method(a, *args) } && + !Array.wrap(options[:unless]).flatten.compact.any? { |a| evaluate_method(a, *args) } end end diff --git a/activesupport/lib/active_support/json/backends/jsongem.rb b/activesupport/lib/active_support/json/backends/jsongem.rb index c6c17a3c4e..cfe28d7bb9 100644 --- a/activesupport/lib/active_support/json/backends/jsongem.rb +++ b/activesupport/lib/active_support/json/backends/jsongem.rb @@ -23,15 +23,18 @@ module ActiveSupport private def convert_dates_from(data) case data - when DATE_REGEX - DateTime.parse(data) - when Array - data.map! { |d| convert_dates_from(d) } - when Hash - data.each do |key, value| - data[key] = convert_dates_from(value) - end - else data + when nil + nil + when DATE_REGEX + DateTime.parse(data) + when Array + data.map! { |d| convert_dates_from(d) } + when Hash + data.each do |key, value| + data[key] = convert_dates_from(value) + end + else + data end end end diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 4ff74abf61..9245263270 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -228,8 +228,8 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase assert !@chars.include?('a') end - def test_include_raises_type_error_when_nil_is_passed - assert_raise(TypeError) do + def test_include_raises_when_nil_is_passed + assert_raise(RUBY_VERSION >= '1.9.2' ? NoMethodError : TypeError) do @chars.include?(nil) end end @@ -659,4 +659,4 @@ class MultibyteInternalsTest < ActiveSupport::TestCase "Expected byte offset #{byte_offset} to translate to #{character_offset}" end end -end \ No newline at end of file +end -- cgit v1.2.3 From deddd55086ad3e9ae43bb0fa44911a77c8ee4495 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 22:01:50 -0800 Subject: Work around assert_raise limitation --- activesupport/test/multibyte_chars_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 9245263270..0e489c10e1 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -229,9 +229,9 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase end def test_include_raises_when_nil_is_passed - assert_raise(RUBY_VERSION >= '1.9.2' ? NoMethodError : TypeError) do - @chars.include?(nil) - end + @chars.include?(nil) + flunk "Expected chars.include?(nil) to raise TypeError or NoMethodError" + rescue Exception => e end def test_index_should_return_character_offset -- cgit v1.2.3 From 8e32830412c051d97613ea4b84c0d8b64e612538 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 22:31:54 -0800 Subject: Fix unresolved string extension dependencies --- activesupport/lib/active_support/multibyte/chars.rb | 5 +++-- activesupport/lib/active_support/values/time_zone.rb | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index d372b0ab1f..c7225fec06 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +require 'active_support/core_ext/string/access' require 'active_support/core_ext/string/behavior' module ActiveSupport #:nodoc: @@ -197,7 +198,7 @@ module ActiveSupport #:nodoc: # 'Café périferôl'.mb_chars.index('ô') #=> 12 # 'Café périferôl'.mb_chars.index(/\w/u) #=> 0 def index(needle, offset=0) - wrapped_offset = self.first(offset).wrapped_string.length + wrapped_offset = first(offset).wrapped_string.length index = @wrapped_string.index(needle, wrapped_offset) index ? (self.class.u_unpack(@wrapped_string.slice(0...index)).size) : nil end @@ -211,7 +212,7 @@ module ActiveSupport #:nodoc: # 'Café périferôl'.mb_chars.rindex(/\w/u) #=> 13 def rindex(needle, offset=nil) offset ||= length - wrapped_offset = self.first(offset).wrapped_string.length + wrapped_offset = first(offset).wrapped_string.length index = @wrapped_string.rindex(needle, wrapped_offset) index ? (self.class.u_unpack(@wrapped_string.slice(0...index)).size) : nil end diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 53a4c7acf5..e7583bef1b 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/object/blank' require 'active_support/core_ext/time' require 'active_support/core_ext/date' require 'active_support/core_ext/date_time' -- cgit v1.2.3 From b1164adda12268b38bba9b0d81c0d26b7251b8bb Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Nov 2009 23:29:33 -0800 Subject: Fix arg destructure --- activesupport/lib/active_support/cache.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 2f714c62ee..f2d957f154 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -1,4 +1,5 @@ require 'benchmark' +require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/benchmark' require 'active_support/core_ext/exception' require 'active_support/core_ext/class/attribute_accessors' @@ -43,8 +44,7 @@ module ActiveSupport # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new) # # => returns MyOwnCacheStore.new def self.lookup_store(*store_option) - store = store_option.shift - parameters = store_option + store, *parameters = *Array.wrap(store_option).flatten case store when Symbol -- cgit v1.2.3 From ee0d41c38d06802bec420d4e0948249146c92cd9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 03:18:54 -0800 Subject: Remove string access core extension dependency --- activesupport/lib/active_support/inflector/inflections.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb index 24ce58e5c2..785e245ea4 100644 --- a/activesupport/lib/active_support/inflector/inflections.rb +++ b/activesupport/lib/active_support/inflector/inflections.rb @@ -1,5 +1,3 @@ -# require "active_support/core_ext/string/access" - module ActiveSupport module Inflector # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional @@ -210,4 +208,4 @@ module ActiveSupport camelize(singularize(table_name.to_s.sub(/.*\./, ''))) end end -end \ No newline at end of file +end -- cgit v1.2.3 From a038b3d1bc20ba225bf8a7672478300f60a41e77 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 03:31:59 -0800 Subject: Make Rakefile usable outside of base dir --- activemodel/Rakefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/activemodel/Rakefile b/activemodel/Rakefile index 8897987518..a63e1982b9 100755 --- a/activemodel/Rakefile +++ b/activemodel/Rakefile @@ -1,4 +1,5 @@ -require File.join(File.dirname(__FILE__), 'lib', 'active_model', 'version') +dir = File.dirname(__FILE__) +require "#{dir}/lib/active_model/version" PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' PKG_NAME = 'activemodel' @@ -12,16 +13,16 @@ require 'rake/testtask' task :default => :test Rake::TestTask.new do |t| - t.libs << "test" - t.test_files = Dir.glob("test/cases/**/*_test.rb").sort + t.libs << "#{dir}/test" + t.test_files = Dir.glob("#{dir}/test/cases/**/*_test.rb").sort t.verbose = true t.warning = true end task :isolated_test do ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) - Dir.glob("test/**/*_test.rb").all? do |file| - system(ruby, '-w', '-Ilib:test', file) + Dir.glob("#{dir}/test/**/*_test.rb").all? do |file| + system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file) end or raise "Failures" end @@ -30,20 +31,20 @@ require 'rake/rdoctask' # Generate the RDoc documentation Rake::RDocTask.new do |rdoc| - rdoc.rdoc_dir = 'doc' + rdoc.rdoc_dir = "#{dir}/doc" rdoc.title = "Active Model" rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' - rdoc.rdoc_files.include('README', 'CHANGES') - rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.rdoc_files.include("#{dir}/README", "#{dir}/CHANGES") + rdoc.rdoc_files.include("#{dir}/lib/**/*.rb") end require 'rake/packagetask' require 'rake/gempackagetask' -spec = eval(File.read('activemodel.gemspec')) +spec = eval(File.read("#{dir}/activemodel.gemspec")) Rake::GemPackageTask.new(spec) do |p| p.gem_spec = spec -- cgit v1.2.3 From 7f0fcadd3650eaee5bd6a8ab8032ed3c5627385b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 04:05:22 -0800 Subject: Revert "Ruby 1.9.2: avoid Array#to_s and Array(nil)" This reverts commit 7ad461b44dabb586fbad190493ac4ecd96104597. --- .../lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb index 7487b96b8c..1b49debc05 100755 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb @@ -195,19 +195,10 @@ module I18n # Merges the given locale, key and scope into a single array of keys. # Splits keys that contain dots into multiple keys. Makes sure all # keys are Symbols. - def normalize_translation_keys(*keys) - normalized = [] - keys.each do |key| - case key - when Array - normalized.concat normalize_translation_keys(*key) - when nil - # skip - else - normalized.concat key.to_s.split('.').map { |sub| sub.to_sym } - end - end - normalized + def normalize_translation_keys(locale, key, scope) + keys = [locale] + Array(scope) + [key] + keys = keys.map { |k| k.to_s.split(/\./) } + keys.flatten.map { |k| k.to_sym } end end end -- cgit v1.2.3 From 6d808cf494e0434c814c0be9594020ad6f00ef18 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 04:59:26 -0800 Subject: Remove reliance on string access core extension --- activeresource/lib/active_resource/base.rb | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index bd2abdd38e..bfe4208d98 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -1152,15 +1152,16 @@ module ActiveResource def respond_to?(method, include_priv = false) method_name = method.to_s if attributes.nil? - return super + super elsif attributes.has_key?(method_name) - return true - elsif ['?','='].include?(method_name.last) && attributes.has_key?(method_name.first(-1)) - return true + true + elsif method_name =~ /(?:=|\?)$/ && attributes.include?($`) + true + else + # super must be called at the end of the method, because the inherited respond_to? + # would return true for generated readers, even if the attribute wasn't present + super end - # super must be called at the end of the method, because the inherited respond_to? - # would return true for generated readers, even if the attribute wasn't present - super end protected @@ -1249,13 +1250,15 @@ module ActiveResource def method_missing(method_symbol, *arguments) #:nodoc: method_name = method_symbol.to_s - case method_name.last + if method_name =~ /(=|\?)$/ + case $1 when "=" - attributes[method_name.first(-1)] = arguments.first + attributes[$`] = arguments.first when "?" - attributes[method_name.first(-1)] - else - attributes.has_key?(method_name) ? attributes[method_name] : super + attributes[$`] + end + else + attributes.include?(method_name) ? attributes[method_name] : super end end end -- cgit v1.2.3 From 76b2d3e33730fce9680d0b6e97df12b1744fb23d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 05:07:58 -0800 Subject: Ruby 1.9.2: URI.parse and .decode are deprecated --- activeresource/lib/active_resource/base.rb | 12 ++++++++---- activeresource/lib/active_resource/connection.rb | 9 +++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index bfe4208d98..18105e8887 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -274,8 +274,8 @@ module ActiveResource @site = nil else @site = create_site_uri_from(site) - @user = URI.decode(@site.user) if @site.user - @password = URI.decode(@site.password) if @site.password + @user = uri_parser.unescape(@site.user) if @site.user + @password = uri_parser.unescape(@site.password) if @site.password end end @@ -737,12 +737,12 @@ module ActiveResource # Accepts a URI and creates the site URI from that. def create_site_uri_from(site) - site.is_a?(URI) ? site.dup : URI.parse(site) + site.is_a?(URI) ? site.dup : uri_parser.parse(site) end # Accepts a URI and creates the proxy URI from that. def create_proxy_uri_from(proxy) - proxy.is_a?(URI) ? proxy.dup : URI.parse(proxy) + proxy.is_a?(URI) ? proxy.dup : uri_parser.parse(proxy) end # contains a set of the current prefix parameters. @@ -767,6 +767,10 @@ module ActiveResource [ prefix_options, query_options ] end + + def uri_parser + @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI + end end attr_accessor :attributes #:nodoc: diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 98cb1a932b..193be89a82 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -31,20 +31,21 @@ module ActiveResource def initialize(site, format = ActiveResource::Formats::XmlFormat) raise ArgumentError, 'Missing site URI' unless site @user = @password = nil + @uri_parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI self.site = site self.format = format end # Set URI for remote service. def site=(site) - @site = site.is_a?(URI) ? site : URI.parse(site) - @user = URI.decode(@site.user) if @site.user - @password = URI.decode(@site.password) if @site.password + @site = site.is_a?(URI) ? site : @uri_parser.parse(site) + @user = @uri_parser.unescape(@site.user) if @site.user + @password = @uri_parser.unescape(@site.password) if @site.password end # Set the proxy for remote service. def proxy=(proxy) - @proxy = proxy.is_a?(URI) ? proxy : URI.parse(proxy) + @proxy = proxy.is_a?(URI) ? proxy : @uri_parser.parse(proxy) end # Sets the user for remote service. -- cgit v1.2.3 From 303991288633effea5a1d1774dbd861951303fe5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 05:09:04 -0800 Subject: Silence spurious warning --- activesupport/lib/active_support/notifications.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 9eae3bebe2..6304f496f5 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -111,7 +111,7 @@ module ActiveSupport def subscribe @queue.subscribe(@pattern) do |*args| - yield *args + yield(*args) end end end -- cgit v1.2.3 From 83f329f5f30567a10bc96410da230bf986db8ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 9 Nov 2009 16:19:47 -0200 Subject: Bundle I18n 0.2.0. --- Gemfile | 5 +- .../core_ext/string/interpolation.rb | 2 +- activesupport/lib/active_support/vendor.rb | 2 +- .../active_support/vendor/i18n-0.1.3/MIT-LICENSE | 20 - .../vendor/i18n-0.1.3/README.textile | 20 - .../lib/active_support/vendor/i18n-0.1.3/Rakefile | 5 - .../active_support/vendor/i18n-0.1.3/i18n.gemspec | 27 - .../active_support/vendor/i18n-0.1.3/lib/i18n.rb | 204 -------- .../vendor/i18n-0.1.3/lib/i18n/backend/simple.rb | 215 -------- .../vendor/i18n-0.1.3/lib/i18n/exceptions.rb | 53 -- .../active_support/vendor/i18n-0.1.3/test/all.rb | 5 - .../vendor/i18n-0.1.3/test/i18n_exceptions_test.rb | 99 ---- .../vendor/i18n-0.1.3/test/i18n_test.rb | 124 ----- .../vendor/i18n-0.1.3/test/locale/en.rb | 1 - .../vendor/i18n-0.1.3/test/locale/en.yml | 3 - .../vendor/i18n-0.1.3/test/simple_backend_test.rb | 567 --------------------- 16 files changed, 5 insertions(+), 1347 deletions(-) delete mode 100755 activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec delete mode 100755 activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml delete mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb diff --git a/Gemfile b/Gemfile index a60c1010d9..85a1ee0fef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ clear_sources source 'http://gemcutter.org' -gem "rails", "3.0.pre", :vendored_at => "railties" +gem "rails", "3.0.pre", :path => "railties" %w( activesupport activemodel @@ -10,8 +10,9 @@ gem "rails", "3.0.pre", :vendored_at => "railties" activerecord activeresource ).each do |lib| - gem lib, '3.0.pre', :vendored_at => lib + gem lib, '3.0.pre', :path => lib end +gem "i18n", "0.2.0" gem "rack", "1.0.1" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", "~> 0.5.0" diff --git a/activesupport/lib/active_support/core_ext/string/interpolation.rb b/activesupport/lib/active_support/core_ext/string/interpolation.rb index d9159b690a..c4a5c0ca35 100644 --- a/activesupport/lib/active_support/core_ext/string/interpolation.rb +++ b/activesupport/lib/active_support/core_ext/string/interpolation.rb @@ -5,7 +5,7 @@ You may redistribute it and/or modify it under the same license terms as Ruby. =end -if RUBY_VERSION < '1.9' +if RUBY_VERSION < '1.9' && !"".respond_to?(:interpolate_without_ruby_19_syntax) require 'active_support/core_ext/string/bytesize' # KeyError is raised by String#% when the string contains a named placeholder diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index 4a711b7e25..15898d153c 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -4,7 +4,7 @@ def ActiveSupport.requirable?(file) $LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? } end -[%w(builder 2.1.2), %w(i18n 0.1.3), %w(memcache-client 1.7.5), %w(tzinfo 0.3.15)].each do |lib, version| +[%w(builder 2.1.2), %w(memcache-client 1.7.5), %w(tzinfo 0.3.15)].each do |lib, version| # If the lib is not already requirable unless ActiveSupport.requirable? lib # Try to activate a gem ~> satisfying the requested version first. diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE b/activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE deleted file mode 100755 index ed8e9ee66d..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008 The Ruby I18n team - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile b/activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile deleted file mode 100644 index a07fc8426d..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile +++ /dev/null @@ -1,20 +0,0 @@ -h1. Ruby I18n gem - -I18n and localization solution for Ruby. - -For information please refer to http://rails-i18n.org - -h2. Authors - -* "Matt Aimonetti":http://railsontherun.com -* "Sven Fuchs":http://www.artweb-design.de -* "Joshua Harvey":http://www.workingwithrails.com/person/759-joshua-harvey -* "Saimon Moore":http://saimonmoore.net -* "Stephan Soller":http://www.arkanis-development.de - -h2. License - -MIT License. See the included MIT-LICENCE file. - - - diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile b/activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile deleted file mode 100644 index 2164e13e69..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile +++ /dev/null @@ -1,5 +0,0 @@ -task :default => [:test] - -task :test do - ruby "test/all.rb" -end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec b/activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec deleted file mode 100644 index f102689a6f..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec +++ /dev/null @@ -1,27 +0,0 @@ -Gem::Specification.new do |s| - s.name = "i18n" - s.version = "0.1.3" - s.date = "2009-01-09" - s.summary = "Internationalization support for Ruby" - s.email = "rails-i18n@googlegroups.com" - s.homepage = "http://rails-i18n.org" - s.description = "Add Internationalization support to your Ruby application." - s.has_rdoc = false - s.authors = ['Sven Fuchs', 'Joshua Harvey', 'Matt Aimonetti', 'Stephan Soller', 'Saimon Moore'] - s.files = [ - 'i18n.gemspec', - 'lib/i18n/backend/simple.rb', - 'lib/i18n/exceptions.rb', - 'lib/i18n.rb', - 'MIT-LICENSE', - 'README.textile' - ] - s.test_files = [ - 'test/all.rb', - 'test/i18n_exceptions_test.rb', - 'test/i18n_test.rb', - 'test/locale/en.rb', - 'test/locale/en.yml', - 'test/simple_backend_test.rb' - ] -end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb deleted file mode 100755 index 1b49debc05..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb +++ /dev/null @@ -1,204 +0,0 @@ -#-- -# Authors:: Matt Aimonetti (http://railsontherun.com/), -# Sven Fuchs (http://www.artweb-design.de), -# Joshua Harvey (http://www.workingwithrails.com/person/759-joshua-harvey), -# Saimon Moore (http://saimonmoore.net), -# Stephan Soller (http://www.arkanis-development.de/) -# Copyright:: Copyright (c) 2008 The Ruby i18n Team -# License:: MIT -#++ - -module I18n - autoload :ArgumentError, 'i18n/exceptions' - module Backend - autoload :Simple, 'i18n/backend/simple' - end - - @@backend = nil - @@load_path = nil - @@default_locale = :'en' - @@exception_handler = :default_exception_handler - - class << self - # Returns the current backend. Defaults to +Backend::Simple+. - def backend - @@backend ||= Backend::Simple.new - end - - # Sets the current backend. Used to set a custom backend. - def backend=(backend) - @@backend = backend - end - - # Returns the current default locale. Defaults to :'en' - def default_locale - @@default_locale - end - - # Sets the current default locale. Used to set a custom default locale. - def default_locale=(locale) - @@default_locale = locale - end - - # Returns the current locale. Defaults to I18n.default_locale. - def locale - Thread.current[:locale] ||= default_locale - end - - # Sets the current locale pseudo-globally, i.e. in the Thread.current hash. - def locale=(locale) - Thread.current[:locale] = locale - end - - # Returns an array of locales for which translations are available - def available_locales - backend.available_locales - end - - # Sets the exception handler. - def exception_handler=(exception_handler) - @@exception_handler = exception_handler - end - - # Allow clients to register paths providing translation data sources. The - # backend defines acceptable sources. - # - # E.g. the provided SimpleBackend accepts a list of paths to translation - # files which are either named *.rb and contain plain Ruby Hashes or are - # named *.yml and contain YAML data. So for the SimpleBackend clients may - # register translation files like this: - # I18n.load_path << 'path/to/locale/en.yml' - def load_path - @@load_path ||= [] - end - - # Sets the load path instance. Custom implementations are expected to - # behave like a Ruby Array. - def load_path=(load_path) - @@load_path = load_path - end - - # Tells the backend to reload translations. Used in situations like the - # Rails development environment. Backends can implement whatever strategy - # is useful. - def reload! - backend.reload! - end - - # Translates, pluralizes and interpolates a given key using a given locale, - # scope, and default, as well as interpolation values. - # - # *LOOKUP* - # - # Translation data is organized as a nested hash using the upper-level keys - # as namespaces. E.g., ActionView ships with the translation: - # :date => {:formats => {:short => "%b %d"}}. - # - # Translations can be looked up at any level of this hash using the key argument - # and the scope option. E.g., in this example I18n.t :date - # returns the whole translations hash {:formats => {:short => "%b %d"}}. - # - # Key can be either a single key or a dot-separated key (both Strings and Symbols - # work). E.g., the short format can be looked up using both: - # I18n.t 'date.formats.short' - # I18n.t :'date.formats.short' - # - # Scope can be either a single key, a dot-separated key or an array of keys - # or dot-separated keys. Keys and scopes can be combined freely. So these - # examples will all look up the same short date format: - # I18n.t 'date.formats.short' - # I18n.t 'formats.short', :scope => 'date' - # I18n.t 'short', :scope => 'date.formats' - # I18n.t 'short', :scope => %w(date formats) - # - # *INTERPOLATION* - # - # Translations can contain interpolation variables which will be replaced by - # values passed to #translate as part of the options hash, with the keys matching - # the interpolation variable names. - # - # E.g., with a translation :foo => "foo {{bar}}" the option - # value for the key +bar+ will be interpolated into the translation: - # I18n.t :foo, :bar => 'baz' # => 'foo baz' - # - # *PLURALIZATION* - # - # Translation data can contain pluralized translations. Pluralized translations - # are arrays of singluar/plural versions of translations like ['Foo', 'Foos']. - # - # Note that I18n::Backend::Simple only supports an algorithm for English - # pluralization rules. Other algorithms can be supported by custom backends. - # - # This returns the singular version of a pluralized translation: - # I18n.t :foo, :count => 1 # => 'Foo' - # - # These both return the plural version of a pluralized translation: - # I18n.t :foo, :count => 0 # => 'Foos' - # I18n.t :foo, :count => 2 # => 'Foos' - # - # The :count option can be used both for pluralization and interpolation. - # E.g., with the translation - # :foo => ['{{count}} foo', '{{count}} foos'], count will - # be interpolated to the pluralized translation: - # I18n.t :foo, :count => 1 # => '1 foo' - # - # *DEFAULTS* - # - # This returns the translation for :foo or default if no translation was found: - # I18n.t :foo, :default => 'default' - # - # This returns the translation for :foo or the translation for :bar if no - # translation for :foo was found: - # I18n.t :foo, :default => :bar - # - # Returns the translation for :foo or the translation for :bar - # or default if no translations for :foo and :bar were found. - # I18n.t :foo, :default => [:bar, 'default'] - # - # BULK LOOKUP - # - # This returns an array with the translations for :foo and :bar. - # I18n.t [:foo, :bar] - # - # Can be used with dot-separated nested keys: - # I18n.t [:'baz.foo', :'baz.bar'] - # - # Which is the same as using a scope option: - # I18n.t [:foo, :bar], :scope => :baz - def translate(key, options = {}) - locale = options.delete(:locale) || I18n.locale - backend.translate(locale, key, options) - rescue I18n::ArgumentError => e - raise e if options[:raise] - send(@@exception_handler, e, locale, key, options) - end - alias :t :translate - - # Localizes certain objects, such as dates and numbers to local formatting. - def localize(object, options = {}) - locale = options[:locale] || I18n.locale - format = options[:format] || :default - backend.localize(locale, object, format) - end - alias :l :localize - - protected - # Handles exceptions raised in the backend. All exceptions except for - # MissingTranslationData exceptions are re-raised. When a MissingTranslationData - # was caught and the option :raise is not set the handler returns an error - # message string containing the key/scope. - def default_exception_handler(exception, locale, key, options) - return exception.message if MissingTranslationData === exception - raise exception - end - - # Merges the given locale, key and scope into a single array of keys. - # Splits keys that contain dots into multiple keys. Makes sure all - # keys are Symbols. - def normalize_translation_keys(locale, key, scope) - keys = [locale] + Array(scope) + [key] - keys = keys.map { |k| k.to_s.split(/\./) } - keys.flatten.map { |k| k.to_sym } - end - end -end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb deleted file mode 100644 index c32cc76f34..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb +++ /dev/null @@ -1,215 +0,0 @@ -require 'i18n/exceptions' - -module I18n - module Backend - class Simple - INTERPOLATION_RESERVED_KEYS = %w(scope default) - MATCH = /(\\\\)?\{\{([^\}]+)\}\}/ - - # Accepts a list of paths to translation files. Loads translations from - # plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml - # for details. - def load_translations(*filenames) - filenames.each { |filename| load_file(filename) } - end - - # Stores translations for the given locale in memory. - # This uses a deep merge for the translations hash, so existing - # translations will be overwritten by new ones only at the deepest - # level of the hash. - def store_translations(locale, data) - merge_translations(locale, data) - end - - def translate(locale, key, options = {}) - raise InvalidLocale.new(locale) if locale.nil? - return key.map { |k| translate(locale, k, options) } if key.is_a? Array - - reserved = :scope, :default - count, scope, default = options.values_at(:count, *reserved) - options.delete(:default) - values = options.reject { |name, value| reserved.include?(name) } - - entry = lookup(locale, key, scope) - if entry.nil? - entry = default(locale, default, options) - if entry.nil? - raise(I18n::MissingTranslationData.new(locale, key, options)) - end - end - entry = pluralize(locale, entry, count) - entry = interpolate(locale, entry, values) - entry - end - - # Acts the same as +strftime+, but returns a localized version of the - # formatted date string. Takes a key from the date/time formats - # translations as a format argument (e.g., :short in :'date.formats'). - def localize(locale, object, format = :default) - raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime) - - type = object.respond_to?(:sec) ? 'time' : 'date' - # TODO only translate these if format is a String? - formats = translate(locale, :"#{type}.formats") - format = formats[format.to_sym] if formats && formats[format.to_sym] - # TODO raise exception unless format found? - format = format.to_s.dup - - # TODO only translate these if the format string is actually present - # TODO check which format strings are present, then bulk translate then, then replace them - format.gsub!(/%a/, translate(locale, :"date.abbr_day_names")[object.wday]) - format.gsub!(/%A/, translate(locale, :"date.day_names")[object.wday]) - format.gsub!(/%b/, translate(locale, :"date.abbr_month_names")[object.mon]) - format.gsub!(/%B/, translate(locale, :"date.month_names")[object.mon]) - format.gsub!(/%p/, translate(locale, :"time.#{object.hour < 12 ? :am : :pm}")) if object.respond_to? :hour - object.strftime(format) - end - - def initialized? - @initialized ||= false - end - - # Returns an array of locales for which translations are available - def available_locales - init_translations unless initialized? - translations.keys - end - - def reload! - @initialized = false - @translations = nil - end - - protected - def init_translations - load_translations(*I18n.load_path.flatten) - @initialized = true - end - - def translations - @translations ||= {} - end - - # Looks up a translation from the translations hash. Returns nil if - # eiher key is nil, or locale, scope or key do not exist as a key in the - # nested translations hash. Splits keys or scopes containing dots - # into multiple keys, i.e. currency.format is regarded the same as - # %w(currency format). - def lookup(locale, key, scope = []) - return unless key - init_translations unless initialized? - keys = I18n.send(:normalize_translation_keys, locale, key, scope) - keys.inject(translations) do |result, k| - if (x = result[k.to_sym]).nil? - return nil - else - x - end - end - end - - # Evaluates a default translation. - # If the given default is a String it is used literally. If it is a Symbol - # it will be translated with the given options. If it is an Array the first - # translation yielded will be returned. - # - # I.e., default(locale, [:foo, 'default']) will return +default+ if - # translate(locale, :foo) does not yield a result. - def default(locale, default, options = {}) - case default - when String then default - when Symbol then translate locale, default, options - when Array then default.each do |obj| - result = default(locale, obj, options.dup) and return result - end and nil - end - rescue MissingTranslationData - nil - end - - # Picks a translation from an array according to English pluralization - # rules. It will pick the first translation if count is not equal to 1 - # and the second translation if it is equal to 1. Other backends can - # implement more flexible or complex pluralization rules. - def pluralize(locale, entry, count) - return entry unless entry.is_a?(Hash) and count - # raise InvalidPluralizationData.new(entry, count) unless entry.is_a?(Hash) - key = :zero if count == 0 && entry.has_key?(:zero) - key ||= count == 1 ? :one : :other - raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key) - entry[key] - end - - # Interpolates values into a given string. - # - # interpolate "file {{file}} opened by \\{{user}}", :file => 'test.txt', :user => 'Mr. X' - # # => "file test.txt opened by {{user}}" - # - # Note that you have to double escape the \\ when you want to escape - # the {{...}} key in a string (once for the string and once for the - # interpolation). - def interpolate(locale, string, values = {}) - return string unless string.is_a?(String) - - string.gsub(MATCH) do - escaped, pattern, key = $1, $2, $2.to_sym - - if escaped - pattern - elsif INTERPOLATION_RESERVED_KEYS.include?(pattern) - raise ReservedInterpolationKey.new(pattern, string) - elsif !values.include?(key) - raise MissingInterpolationArgument.new(pattern, string) - else - values[key].to_s - end - end - end - - # Loads a single translations file by delegating to #load_rb or - # #load_yml depending on the file extension and directly merges the - # data to the existing translations. Raises I18n::UnknownFileType - # for all other file extensions. - def load_file(filename) - type = File.extname(filename).tr('.', '').downcase - raise UnknownFileType.new(type, filename) unless respond_to?(:"load_#{type}") - data = send :"load_#{type}", filename # TODO raise a meaningful exception if this does not yield a Hash - data.each { |locale, d| merge_translations(locale, d) } - end - - # Loads a plain Ruby translations file. eval'ing the file must yield - # a Hash containing translation data with locales as toplevel keys. - def load_rb(filename) - eval(IO.read(filename), binding, filename) - end - - # Loads a YAML translations file. The data must have locales as - # toplevel keys. - def load_yml(filename) - require 'yaml' unless defined? :YAML - YAML::load(IO.read(filename)) - end - - # Deep merges the given translations hash with the existing translations - # for the given locale - def merge_translations(locale, data) - locale = locale.to_sym - translations[locale] ||= {} - data = deep_symbolize_keys(data) - - # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809 - merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 } - translations[locale].merge!(data, &merger) - end - - # Return a new hash with all keys and nested keys converted to symbols. - def deep_symbolize_keys(hash) - hash.inject({}) { |result, (key, value)| - value = deep_symbolize_keys(value) if value.is_a? Hash - result[(key.to_sym rescue key) || key] = value - result - } - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb deleted file mode 100644 index 6897055d6d..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb +++ /dev/null @@ -1,53 +0,0 @@ -module I18n - class ArgumentError < ::ArgumentError; end - - class InvalidLocale < ArgumentError - attr_reader :locale - def initialize(locale) - @locale = locale - super "#{locale.inspect} is not a valid locale" - end - end - - class MissingTranslationData < ArgumentError - attr_reader :locale, :key, :options - def initialize(locale, key, options) - @key, @locale, @options = key, locale, options - keys = I18n.send(:normalize_translation_keys, locale, key, options[:scope]) - keys << 'no key' if keys.size < 2 - super "translation missing: #{keys.join(', ')}" - end - end - - class InvalidPluralizationData < ArgumentError - attr_reader :entry, :count - def initialize(entry, count) - @entry, @count = entry, count - super "translation data #{entry.inspect} can not be used with :count => #{count}" - end - end - - class MissingInterpolationArgument < ArgumentError - attr_reader :key, :string - def initialize(key, string) - @key, @string = key, string - super "interpolation argument #{key} missing in #{string.inspect}" - end - end - - class ReservedInterpolationKey < ArgumentError - attr_reader :key, :string - def initialize(key, string) - @key, @string = key, string - super "reserved key #{key.inspect} used in #{string.inspect}" - end - end - - class UnknownFileType < ArgumentError - attr_reader :type, :filename - def initialize(type, filename) - @type, @filename = type, filename - super "can not load translations from #{filename}, the file type #{type} is not known" - end - end -end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb deleted file mode 100644 index 353712da49..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb +++ /dev/null @@ -1,5 +0,0 @@ -dir = File.dirname(__FILE__) -require dir + '/i18n_test.rb' -require dir + '/simple_backend_test.rb' -require dir + '/i18n_exceptions_test.rb' -# *require* dir + '/custom_backend_test.rb' \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb deleted file mode 100644 index 4e78e71b34..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb +++ /dev/null @@ -1,99 +0,0 @@ -$:.unshift "lib" - -require 'rubygems' -require 'test/unit' -require 'i18n' -require 'active_support' - -class I18nExceptionsTest < Test::Unit::TestCase - def test_invalid_locale_stores_locale - force_invalid_locale - rescue I18n::ArgumentError => e - assert_nil e.locale - end - - def test_invalid_locale_message - force_invalid_locale - rescue I18n::ArgumentError => e - assert_equal 'nil is not a valid locale', e.message - end - - def test_missing_translation_data_stores_locale_key_and_options - force_missing_translation_data - rescue I18n::ArgumentError => e - options = {:scope => :bar} - assert_equal 'de', e.locale - assert_equal :foo, e.key - assert_equal options, e.options - end - - def test_missing_translation_data_message - force_missing_translation_data - rescue I18n::ArgumentError => e - assert_equal 'translation missing: de, bar, foo', e.message - end - - def test_invalid_pluralization_data_stores_entry_and_count - force_invalid_pluralization_data - rescue I18n::ArgumentError => e - assert_equal [:bar], e.entry - assert_equal 1, e.count - end - - def test_invalid_pluralization_data_message - force_invalid_pluralization_data - rescue I18n::ArgumentError => e - assert_equal 'translation data [:bar] can not be used with :count => 1', e.message - end - - def test_missing_interpolation_argument_stores_key_and_string - force_missing_interpolation_argument - rescue I18n::ArgumentError => e - assert_equal 'bar', e.key - assert_equal "{{bar}}", e.string - end - - def test_missing_interpolation_argument_message - force_missing_interpolation_argument - rescue I18n::ArgumentError => e - assert_equal 'interpolation argument bar missing in "{{bar}}"', e.message - end - - def test_reserved_interpolation_key_stores_key_and_string - force_reserved_interpolation_key - rescue I18n::ArgumentError => e - assert_equal 'scope', e.key - assert_equal "{{scope}}", e.string - end - - def test_reserved_interpolation_key_message - force_reserved_interpolation_key - rescue I18n::ArgumentError => e - assert_equal 'reserved key "scope" used in "{{scope}}"', e.message - end - - private - def force_invalid_locale - I18n.backend.translate nil, :foo - end - - def force_missing_translation_data - I18n.backend.store_translations 'de', :bar => nil - I18n.backend.translate 'de', :foo, :scope => :bar - end - - def force_invalid_pluralization_data - I18n.backend.store_translations 'de', :foo => [:bar] - I18n.backend.translate 'de', :foo, :count => 1 - end - - def force_missing_interpolation_argument - I18n.backend.store_translations 'de', :foo => "{{bar}}" - I18n.backend.translate 'de', :foo, :baz => 'baz' - end - - def force_reserved_interpolation_key - I18n.backend.store_translations 'de', :foo => "{{scope}}" - I18n.backend.translate 'de', :foo, :baz => 'baz' - end -end \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb deleted file mode 100644 index 2835ec4eab..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb +++ /dev/null @@ -1,124 +0,0 @@ -$:.unshift "lib" - -require 'rubygems' -require 'test/unit' -require 'i18n' -require 'active_support' - -class I18nTest < Test::Unit::TestCase - def setup - I18n.backend.store_translations :'en', { - :currency => { - :format => { - :separator => '.', - :delimiter => ',', - } - } - } - end - - def test_uses_simple_backend_set_by_default - assert I18n.backend.is_a?(I18n::Backend::Simple) - end - - def test_can_set_backend - assert_nothing_raised{ I18n.backend = self } - assert_equal self, I18n.backend - I18n.backend = I18n::Backend::Simple.new - end - - def test_uses_en_us_as_default_locale_by_default - assert_equal 'en', I18n.default_locale - end - - def test_can_set_default_locale - assert_nothing_raised{ I18n.default_locale = 'de' } - assert_equal 'de', I18n.default_locale - I18n.default_locale = 'en' - end - - def test_uses_default_locale_as_locale_by_default - assert_equal I18n.default_locale, I18n.locale - end - - def test_can_set_locale_to_thread_current - assert_nothing_raised{ I18n.locale = 'de' } - assert_equal 'de', I18n.locale - assert_equal 'de', Thread.current[:locale] - I18n.locale = 'en' - end - - def test_can_set_exception_handler - assert_nothing_raised{ I18n.exception_handler = :custom_exception_handler } - I18n.exception_handler = :default_exception_handler # revert it - end - - def test_uses_custom_exception_handler - I18n.exception_handler = :custom_exception_handler - I18n.expects(:custom_exception_handler) - I18n.translate :bogus - I18n.exception_handler = :default_exception_handler # revert it - end - - def test_delegates_translate_to_backend - I18n.backend.expects(:translate).with 'de', :foo, {} - I18n.translate :foo, :locale => 'de' - end - - def test_delegates_localize_to_backend - I18n.backend.expects(:localize).with 'de', :whatever, :default - I18n.localize :whatever, :locale => 'de' - end - - def test_translate_given_no_locale_uses_i18n_locale - I18n.backend.expects(:translate).with 'en', :foo, {} - I18n.translate :foo - end - - def test_translate_on_nested_symbol_keys_works - assert_equal ".", I18n.t(:'currency.format.separator') - end - - def test_translate_with_nested_string_keys_works - assert_equal ".", I18n.t('currency.format.separator') - end - - def test_translate_with_array_as_scope_works - assert_equal ".", I18n.t(:separator, :scope => ['currency.format']) - end - - def test_translate_with_array_containing_dot_separated_strings_as_scope_works - assert_equal ".", I18n.t(:separator, :scope => ['currency.format']) - end - - def test_translate_with_key_array_and_dot_separated_scope_works - assert_equal [".", ","], I18n.t(%w(separator delimiter), :scope => 'currency.format') - end - - def test_translate_with_dot_separated_key_array_and_scope_works - assert_equal [".", ","], I18n.t(%w(format.separator format.delimiter), :scope => 'currency') - end - - def test_translate_with_options_using_scope_works - I18n.backend.expects(:translate).with('de', :precision, :scope => :"currency.format") - I18n.with_options :locale => 'de', :scope => :'currency.format' do |locale| - locale.t :precision - end - end - - # def test_translate_given_no_args_raises_missing_translation_data - # assert_equal "translation missing: en, no key", I18n.t - # end - - def test_translate_given_a_bogus_key_raises_missing_translation_data - assert_equal "translation missing: en, bogus", I18n.t(:bogus) - end - - def test_localize_nil_raises_argument_error - assert_raise(I18n::ArgumentError) { I18n.l nil } - end - - def test_localize_object_raises_argument_error - assert_raise(I18n::ArgumentError) { I18n.l Object.new } - end -end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb deleted file mode 100644 index 6044ce10d9..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb +++ /dev/null @@ -1 +0,0 @@ -{:'en-Ruby' => {:foo => {:bar => "baz"}}} \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml deleted file mode 100644 index 0b298c9c0e..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml +++ /dev/null @@ -1,3 +0,0 @@ -en-Yaml: - foo: - bar: baz \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb deleted file mode 100644 index a1696c77f6..0000000000 --- a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb +++ /dev/null @@ -1,567 +0,0 @@ -# encoding: utf-8 -$:.unshift "lib" - -require 'rubygems' -require 'test/unit' -require 'i18n' -require 'time' -require 'yaml' - -module I18nSimpleBackendTestSetup - def setup_backend - # backend_reset_translations! - @backend = I18n::Backend::Simple.new - @backend.store_translations 'en', :foo => {:bar => 'bar', :baz => 'baz'} - @locale_dir = File.dirname(__FILE__) + '/locale' - end - alias :setup :setup_backend - - # def backend_reset_translations! - # I18n::Backend::Simple::ClassMethods.send :class_variable_set, :@@translations, {} - # end - - def backend_get_translations - # I18n::Backend::Simple::ClassMethods.send :class_variable_get, :@@translations - @backend.instance_variable_get :@translations - end - - def add_datetime_translations - @backend.store_translations :'de', { - :date => { - :formats => { - :default => "%d.%m.%Y", - :short => "%d. %b", - :long => "%d. %B %Y", - }, - :day_names => %w(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag), - :abbr_day_names => %w(So Mo Di Mi Do Fr Sa), - :month_names => %w(Januar Februar März April Mai Juni Juli August September Oktober November Dezember).unshift(nil), - :abbr_month_names => %w(Jan Feb Mar Apr Mai Jun Jul Aug Sep Okt Nov Dez).unshift(nil), - :order => [:day, :month, :year] - }, - :time => { - :formats => { - :default => "%a, %d. %b %Y %H:%M:%S %z", - :short => "%d. %b %H:%M", - :long => "%d. %B %Y %H:%M", - }, - :am => 'am', - :pm => 'pm' - }, - :datetime => { - :distance_in_words => { - :half_a_minute => 'half a minute', - :less_than_x_seconds => { - :one => 'less than 1 second', - :other => 'less than {{count}} seconds' - }, - :x_seconds => { - :one => '1 second', - :other => '{{count}} seconds' - }, - :less_than_x_minutes => { - :one => 'less than a minute', - :other => 'less than {{count}} minutes' - }, - :x_minutes => { - :one => '1 minute', - :other => '{{count}} minutes' - }, - :about_x_hours => { - :one => 'about 1 hour', - :other => 'about {{count}} hours' - }, - :x_days => { - :one => '1 day', - :other => '{{count}} days' - }, - :about_x_months => { - :one => 'about 1 month', - :other => 'about {{count}} months' - }, - :x_months => { - :one => '1 month', - :other => '{{count}} months' - }, - :about_x_years => { - :one => 'about 1 year', - :other => 'about {{count}} year' - }, - :over_x_years => { - :one => 'over 1 year', - :other => 'over {{count}} years' - } - } - } - } - end -end - -class I18nSimpleBackendTranslationsTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def test_store_translations_adds_translations # no, really :-) - @backend.store_translations :'en', :foo => 'bar' - assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations - end - - def test_store_translations_deep_merges_translations - @backend.store_translations :'en', :foo => {:bar => 'bar'} - @backend.store_translations :'en', :foo => {:baz => 'baz'} - assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations - end - - def test_store_translations_forces_locale_to_sym - @backend.store_translations 'en', :foo => 'bar' - assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations - end - - def test_store_translations_converts_keys_to_symbols - # backend_reset_translations! - @backend.store_translations 'en', 'foo' => {'bar' => 'bar', 'baz' => 'baz'} - assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations - end -end - -class I18nSimpleBackendAvailableLocalesTest < Test::Unit::TestCase - def test_available_locales - @backend = I18n::Backend::Simple.new - @backend.store_translations 'de', :foo => 'bar' - @backend.store_translations 'en', :foo => 'foo' - - assert_equal ['de', 'en'], @backend.available_locales.map{|locale| locale.to_s }.sort - end -end - -class I18nSimpleBackendTranslateTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def test_translate_calls_lookup_with_locale_given - @backend.expects(:lookup).with('de', :bar, [:foo]).returns 'bar' - @backend.translate 'de', :bar, :scope => [:foo] - end - - def test_given_no_keys_it_returns_the_default - assert_equal 'default', @backend.translate('en', nil, :default => 'default') - end - - def test_translate_given_a_symbol_as_a_default_translates_the_symbol - assert_equal 'bar', @backend.translate('en', nil, :scope => [:foo], :default => :bar) - end - - def test_translate_given_an_array_as_default_uses_the_first_match - assert_equal 'bar', @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :bar]) - end - - def test_translate_given_an_array_of_inexistent_keys_it_raises_missing_translation_data - assert_raise I18n::MissingTranslationData do - @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :does_not_exist_3]) - end - end - - def test_translate_an_array_of_keys_translates_all_of_them - assert_equal %w(bar baz), @backend.translate('en', [:bar, :baz], :scope => [:foo]) - end - - def test_translate_calls_pluralize - @backend.expects(:pluralize).with 'en', 'bar', 1 - @backend.translate 'en', :bar, :scope => [:foo], :count => 1 - end - - def test_translate_calls_interpolate - @backend.expects(:interpolate).with 'en', 'bar', {} - @backend.translate 'en', :bar, :scope => [:foo] - end - - def test_translate_calls_interpolate_including_count_as_a_value - @backend.expects(:interpolate).with 'en', 'bar', {:count => 1} - @backend.translate 'en', :bar, :scope => [:foo], :count => 1 - end - - def test_translate_given_nil_as_a_locale_raises_an_argument_error - assert_raise(I18n::InvalidLocale){ @backend.translate nil, :bar } - end - - def test_translate_with_a_bogus_key_and_no_default_raises_missing_translation_data - assert_raise(I18n::MissingTranslationData){ @backend.translate 'de', :bogus } - end -end - -class I18nSimpleBackendLookupTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - # useful because this way we can use the backend with no key for interpolation/pluralization - def test_lookup_given_nil_as_a_key_returns_nil - assert_nil @backend.send(:lookup, 'en', nil) - end - - def test_lookup_given_nested_keys_looks_up_a_nested_hash_value - assert_equal 'bar', @backend.send(:lookup, 'en', :bar, [:foo]) - end -end - -class I18nSimpleBackendPluralizeTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def test_pluralize_given_nil_returns_the_given_entry - entry = {:one => 'bar', :other => 'bars'} - assert_equal entry, @backend.send(:pluralize, nil, entry, nil) - end - - def test_pluralize_given_0_returns_zero_string_if_zero_key_given - assert_equal 'zero', @backend.send(:pluralize, nil, {:zero => 'zero', :one => 'bar', :other => 'bars'}, 0) - end - - def test_pluralize_given_0_returns_plural_string_if_no_zero_key_given - assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 0) - end - - def test_pluralize_given_1_returns_singular_string - assert_equal 'bar', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 1) - end - - def test_pluralize_given_2_returns_plural_string - assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 2) - end - - def test_pluralize_given_3_returns_plural_string - assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 3) - end - - def test_interpolate_given_incomplete_pluralization_data_raises_invalid_pluralization_data - assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, {:one => 'bar'}, 2) } - end - - # def test_interpolate_given_a_string_raises_invalid_pluralization_data - # assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, 'bar', 2) } - # end - # - # def test_interpolate_given_an_array_raises_invalid_pluralization_data - # assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, ['bar'], 2) } - # end -end - -class I18nSimpleBackendInterpolateTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def test_interpolate_given_a_value_hash_interpolates_the_values_to_the_string - assert_equal 'Hi David!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'David') - end - - def test_interpolate_given_a_value_hash_interpolates_into_unicode_string - assert_equal 'Häi David!', @backend.send(:interpolate, nil, 'Häi {{name}}!', :name => 'David') - end - - def test_interpolate_given_an_unicode_value_hash_interpolates_to_the_string - assert_equal 'Hi ゆきひろ!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'ゆきひろ') - end - - def test_interpolate_given_an_unicode_value_hash_interpolates_into_unicode_string - assert_equal 'こんにちは、ゆきひろさん!', @backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => 'ゆきひろ') - end - - if Kernel.const_defined?(:Encoding) - def test_interpolate_given_a_non_unicode_multibyte_value_hash_interpolates_into_a_string_with_the_same_encoding - assert_equal euc_jp('Hi ゆきひろ!'), @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => euc_jp('ゆきひろ')) - end - - def test_interpolate_given_an_unicode_value_hash_into_a_non_unicode_multibyte_string_raises_encoding_compatibility_error - assert_raise(Encoding::CompatibilityError) do - @backend.send(:interpolate, nil, euc_jp('こんにちは、{{name}}さん!'), :name => 'ゆきひろ') - end - end - - def test_interpolate_given_a_non_unicode_multibyte_value_hash_into_an_unicode_string_raises_encoding_compatibility_error - assert_raise(Encoding::CompatibilityError) do - @backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => euc_jp('ゆきひろ')) - end - end - end - - def test_interpolate_given_nil_as_a_string_returns_nil - assert_nil @backend.send(:interpolate, nil, nil, :name => 'David') - end - - def test_interpolate_given_an_non_string_as_a_string_returns_nil - assert_equal [], @backend.send(:interpolate, nil, [], :name => 'David') - end - - def test_interpolate_given_a_values_hash_with_nil_values_interpolates_the_string - assert_equal 'Hi !', @backend.send(:interpolate, nil, 'Hi {{name}}!', {:name => nil}) - end - - def test_interpolate_given_an_empty_values_hash_raises_missing_interpolation_argument - assert_raise(I18n::MissingInterpolationArgument) { @backend.send(:interpolate, nil, 'Hi {{name}}!', {}) } - end - - def test_interpolate_given_a_string_containing_a_reserved_key_raises_reserved_interpolation_key - assert_raise(I18n::ReservedInterpolationKey) { @backend.send(:interpolate, nil, '{{default}}', {:default => nil}) } - end - - private - - def euc_jp(string) - string.encode!(Encoding::EUC_JP) - end -end - -class I18nSimpleBackendLocalizeDateTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def setup - @backend = I18n::Backend::Simple.new - add_datetime_translations - @date = Date.new 2008, 1, 1 - end - - def test_translate_given_the_short_format_it_uses_it - assert_equal '01. Jan', @backend.localize('de', @date, :short) - end - - def test_translate_given_the_long_format_it_uses_it - assert_equal '01. Januar 2008', @backend.localize('de', @date, :long) - end - - def test_translate_given_the_default_format_it_uses_it - assert_equal '01.01.2008', @backend.localize('de', @date, :default) - end - - def test_translate_given_a_day_name_format_it_returns_a_day_name - assert_equal 'Dienstag', @backend.localize('de', @date, '%A') - end - - def test_translate_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name - assert_equal 'Di', @backend.localize('de', @date, '%a') - end - - def test_translate_given_a_month_name_format_it_returns_a_month_name - assert_equal 'Januar', @backend.localize('de', @date, '%B') - end - - def test_translate_given_an_abbr_month_name_format_it_returns_an_abbrevated_month_name - assert_equal 'Jan', @backend.localize('de', @date, '%b') - end - - def test_translate_given_no_format_it_does_not_fail - assert_nothing_raised{ @backend.localize 'de', @date } - end - - def test_translate_given_an_unknown_format_it_does_not_fail - assert_nothing_raised{ @backend.localize 'de', @date, '%x' } - end - - def test_localize_nil_raises_argument_error - assert_raise(I18n::ArgumentError) { @backend.localize 'de', nil } - end - - def test_localize_object_raises_argument_error - assert_raise(I18n::ArgumentError) { @backend.localize 'de', Object.new } - end -end - -class I18nSimpleBackendLocalizeDateTimeTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def setup - @backend = I18n::Backend::Simple.new - add_datetime_translations - @morning = DateTime.new 2008, 1, 1, 6 - @evening = DateTime.new 2008, 1, 1, 18 - end - - def test_translate_given_the_short_format_it_uses_it - assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short) - end - - def test_translate_given_the_long_format_it_uses_it - assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long) - end - - def test_translate_given_the_default_format_it_uses_it - assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default) - end - - def test_translate_given_a_day_name_format_it_returns_the_correct_day_name - assert_equal 'Dienstag', @backend.localize('de', @morning, '%A') - end - - def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name - assert_equal 'Di', @backend.localize('de', @morning, '%a') - end - - def test_translate_given_a_month_name_format_it_returns_the_correct_month_name - assert_equal 'Januar', @backend.localize('de', @morning, '%B') - end - - def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name - assert_equal 'Jan', @backend.localize('de', @morning, '%b') - end - - def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator - assert_equal 'am', @backend.localize('de', @morning, '%p') - assert_equal 'pm', @backend.localize('de', @evening, '%p') - end - - def test_translate_given_no_format_it_does_not_fail - assert_nothing_raised{ @backend.localize 'de', @morning } - end - - def test_translate_given_an_unknown_format_it_does_not_fail - assert_nothing_raised{ @backend.localize 'de', @morning, '%x' } - end -end - -class I18nSimpleBackendLocalizeTimeTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def setup - @old_timezone, ENV['TZ'] = ENV['TZ'], 'UTC' - @backend = I18n::Backend::Simple.new - add_datetime_translations - @morning = Time.parse '2008-01-01 6:00 UTC' - @evening = Time.parse '2008-01-01 18:00 UTC' - end - - def teardown - @old_timezone ? ENV['TZ'] = @old_timezone : ENV.delete('TZ') - end - - def test_translate_given_the_short_format_it_uses_it - assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short) - end - - def test_translate_given_the_long_format_it_uses_it - assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long) - end - - # TODO Seems to break on Windows because ENV['TZ'] is ignored. What's a better way to do this? - # def test_translate_given_the_default_format_it_uses_it - # assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default) - # end - - def test_translate_given_a_day_name_format_it_returns_the_correct_day_name - assert_equal 'Dienstag', @backend.localize('de', @morning, '%A') - end - - def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name - assert_equal 'Di', @backend.localize('de', @morning, '%a') - end - - def test_translate_given_a_month_name_format_it_returns_the_correct_month_name - assert_equal 'Januar', @backend.localize('de', @morning, '%B') - end - - def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name - assert_equal 'Jan', @backend.localize('de', @morning, '%b') - end - - def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator - assert_equal 'am', @backend.localize('de', @morning, '%p') - assert_equal 'pm', @backend.localize('de', @evening, '%p') - end - - def test_translate_given_no_format_it_does_not_fail - assert_nothing_raised{ @backend.localize 'de', @morning } - end - - def test_translate_given_an_unknown_format_it_does_not_fail - assert_nothing_raised{ @backend.localize 'de', @morning, '%x' } - end -end - -class I18nSimpleBackendHelperMethodsTest < Test::Unit::TestCase - def setup - @backend = I18n::Backend::Simple.new - end - - def test_deep_symbolize_keys_works - result = @backend.send :deep_symbolize_keys, 'foo' => {'bar' => {'baz' => 'bar'}} - expected = {:foo => {:bar => {:baz => 'bar'}}} - assert_equal expected, result - end -end - -class I18nSimpleBackendLoadTranslationsTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def test_load_translations_with_unknown_file_type_raises_exception - assert_raise(I18n::UnknownFileType) { @backend.load_translations "#{@locale_dir}/en.xml" } - end - - def test_load_translations_with_ruby_file_type_does_not_raise_exception - assert_nothing_raised { @backend.load_translations "#{@locale_dir}/en.rb" } - end - - def test_load_rb_loads_data_from_ruby_file - data = @backend.send :load_rb, "#{@locale_dir}/en.rb" - assert_equal({:'en-Ruby' => {:foo => {:bar => "baz"}}}, data) - end - - def test_load_rb_loads_data_from_yaml_file - data = @backend.send :load_yml, "#{@locale_dir}/en.yml" - assert_equal({'en-Yaml' => {'foo' => {'bar' => 'baz'}}}, data) - end - - def test_load_translations_loads_from_different_file_formats - @backend = I18n::Backend::Simple.new - @backend.load_translations "#{@locale_dir}/en.rb", "#{@locale_dir}/en.yml" - expected = { - :'en-Ruby' => {:foo => {:bar => "baz"}}, - :'en-Yaml' => {:foo => {:bar => "baz"}} - } - assert_equal expected, backend_get_translations - end -end - -class I18nSimpleBackendLoadPathTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def teardown - I18n.load_path = [] - end - - def test_nested_load_paths_do_not_break_locale_loading - @backend = I18n::Backend::Simple.new - I18n.load_path = [[File.dirname(__FILE__) + '/locale/en.yml']] - assert_nil backend_get_translations - assert_nothing_raised { @backend.send :init_translations } - assert_not_nil backend_get_translations - end - - def test_adding_arrays_of_filenames_to_load_path_do_not_break_locale_loading - @backend = I18n::Backend::Simple.new - I18n.load_path << Dir[File.dirname(__FILE__) + '/locale/*.{rb,yml}'] - assert_nil backend_get_translations - assert_nothing_raised { @backend.send :init_translations } - assert_not_nil backend_get_translations - end -end - -class I18nSimpleBackendReloadTranslationsTest < Test::Unit::TestCase - include I18nSimpleBackendTestSetup - - def setup - @backend = I18n::Backend::Simple.new - I18n.load_path = [File.dirname(__FILE__) + '/locale/en.yml'] - assert_nil backend_get_translations - @backend.send :init_translations - end - - def teardown - I18n.load_path = [] - end - - def test_setup - assert_not_nil backend_get_translations - end - - def test_reload_translations_unloads_translations - @backend.reload! - assert_nil backend_get_translations - end - - def test_reload_translations_uninitializes_translations - @backend.reload! - assert_equal @backend.initialized?, false - end -end -- cgit v1.2.3 From 4a1f43878105d701fd2dd769ec3cf7e81d133c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 9 Nov 2009 16:35:31 -0200 Subject: Change mailer subjects lookup. --- actionmailer/lib/action_mailer/base.rb | 4 ++-- actionmailer/test/mail_service_test.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 293af01bbf..6a5a598f94 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -465,8 +465,8 @@ module ActionMailer #:nodoc: create_parts # Set the subject if not set yet - @subject ||= I18n.t(method_name, :scope => [:actionmailer, :subjects, mailer_name], - :default => method_name.humanize) + @subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name], + :default => method_name.humanize) # build the mail object itself @mail = create_mail diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index f9365ea90c..c98f0a7601 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -402,7 +402,7 @@ class ActionMailerTest < Test::Unit::TestCase assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) } assert_equal "Subject with i18n", ActionMailer::Base.deliveries.first.subject - I18n.backend.store_translations('en', :actionmailer => {:subjects => {:test_mailer => {:subject_with_i18n => "New Subject!"}}}) + I18n.backend.store_translations('en', :actionmailer => {:test_mailer => {:subject_with_i18n => {:subject => "New Subject!"}}}) assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) } assert_equal "New Subject!", ActionMailer::Base.deliveries.last.subject end -- cgit v1.2.3 From 0f1da1cb5cfac1343958daef4c5e7c37a9ce0da3 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 9 Nov 2009 11:33:47 -0800 Subject: Revert "Bundle I18n 0.2.0." This reverts commit 83f329f5f30567a10bc96410da230bf986db8ad4. --- Gemfile | 5 +- .../core_ext/string/interpolation.rb | 2 +- activesupport/lib/active_support/vendor.rb | 2 +- .../active_support/vendor/i18n-0.1.3/MIT-LICENSE | 20 + .../vendor/i18n-0.1.3/README.textile | 20 + .../lib/active_support/vendor/i18n-0.1.3/Rakefile | 5 + .../active_support/vendor/i18n-0.1.3/i18n.gemspec | 27 + .../active_support/vendor/i18n-0.1.3/lib/i18n.rb | 204 ++++++++ .../vendor/i18n-0.1.3/lib/i18n/backend/simple.rb | 215 ++++++++ .../vendor/i18n-0.1.3/lib/i18n/exceptions.rb | 53 ++ .../active_support/vendor/i18n-0.1.3/test/all.rb | 5 + .../vendor/i18n-0.1.3/test/i18n_exceptions_test.rb | 99 ++++ .../vendor/i18n-0.1.3/test/i18n_test.rb | 124 +++++ .../vendor/i18n-0.1.3/test/locale/en.rb | 1 + .../vendor/i18n-0.1.3/test/locale/en.yml | 3 + .../vendor/i18n-0.1.3/test/simple_backend_test.rb | 567 +++++++++++++++++++++ 16 files changed, 1347 insertions(+), 5 deletions(-) create mode 100755 activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec create mode 100755 activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml create mode 100644 activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb diff --git a/Gemfile b/Gemfile index 85a1ee0fef..a60c1010d9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ clear_sources source 'http://gemcutter.org' -gem "rails", "3.0.pre", :path => "railties" +gem "rails", "3.0.pre", :vendored_at => "railties" %w( activesupport activemodel @@ -10,9 +10,8 @@ gem "rails", "3.0.pre", :path => "railties" activerecord activeresource ).each do |lib| - gem lib, '3.0.pre', :path => lib + gem lib, '3.0.pre', :vendored_at => lib end -gem "i18n", "0.2.0" gem "rack", "1.0.1" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", "~> 0.5.0" diff --git a/activesupport/lib/active_support/core_ext/string/interpolation.rb b/activesupport/lib/active_support/core_ext/string/interpolation.rb index c4a5c0ca35..d9159b690a 100644 --- a/activesupport/lib/active_support/core_ext/string/interpolation.rb +++ b/activesupport/lib/active_support/core_ext/string/interpolation.rb @@ -5,7 +5,7 @@ You may redistribute it and/or modify it under the same license terms as Ruby. =end -if RUBY_VERSION < '1.9' && !"".respond_to?(:interpolate_without_ruby_19_syntax) +if RUBY_VERSION < '1.9' require 'active_support/core_ext/string/bytesize' # KeyError is raised by String#% when the string contains a named placeholder diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index 15898d153c..4a711b7e25 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -4,7 +4,7 @@ def ActiveSupport.requirable?(file) $LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? } end -[%w(builder 2.1.2), %w(memcache-client 1.7.5), %w(tzinfo 0.3.15)].each do |lib, version| +[%w(builder 2.1.2), %w(i18n 0.1.3), %w(memcache-client 1.7.5), %w(tzinfo 0.3.15)].each do |lib, version| # If the lib is not already requirable unless ActiveSupport.requirable? lib # Try to activate a gem ~> satisfying the requested version first. diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE b/activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE new file mode 100755 index 0000000000..ed8e9ee66d --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 The Ruby I18n team + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile b/activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile new file mode 100644 index 0000000000..a07fc8426d --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/README.textile @@ -0,0 +1,20 @@ +h1. Ruby I18n gem + +I18n and localization solution for Ruby. + +For information please refer to http://rails-i18n.org + +h2. Authors + +* "Matt Aimonetti":http://railsontherun.com +* "Sven Fuchs":http://www.artweb-design.de +* "Joshua Harvey":http://www.workingwithrails.com/person/759-joshua-harvey +* "Saimon Moore":http://saimonmoore.net +* "Stephan Soller":http://www.arkanis-development.de + +h2. License + +MIT License. See the included MIT-LICENCE file. + + + diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile b/activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile new file mode 100644 index 0000000000..2164e13e69 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/Rakefile @@ -0,0 +1,5 @@ +task :default => [:test] + +task :test do + ruby "test/all.rb" +end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec b/activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec new file mode 100644 index 0000000000..f102689a6f --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec @@ -0,0 +1,27 @@ +Gem::Specification.new do |s| + s.name = "i18n" + s.version = "0.1.3" + s.date = "2009-01-09" + s.summary = "Internationalization support for Ruby" + s.email = "rails-i18n@googlegroups.com" + s.homepage = "http://rails-i18n.org" + s.description = "Add Internationalization support to your Ruby application." + s.has_rdoc = false + s.authors = ['Sven Fuchs', 'Joshua Harvey', 'Matt Aimonetti', 'Stephan Soller', 'Saimon Moore'] + s.files = [ + 'i18n.gemspec', + 'lib/i18n/backend/simple.rb', + 'lib/i18n/exceptions.rb', + 'lib/i18n.rb', + 'MIT-LICENSE', + 'README.textile' + ] + s.test_files = [ + 'test/all.rb', + 'test/i18n_exceptions_test.rb', + 'test/i18n_test.rb', + 'test/locale/en.rb', + 'test/locale/en.yml', + 'test/simple_backend_test.rb' + ] +end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb new file mode 100755 index 0000000000..1b49debc05 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb @@ -0,0 +1,204 @@ +#-- +# Authors:: Matt Aimonetti (http://railsontherun.com/), +# Sven Fuchs (http://www.artweb-design.de), +# Joshua Harvey (http://www.workingwithrails.com/person/759-joshua-harvey), +# Saimon Moore (http://saimonmoore.net), +# Stephan Soller (http://www.arkanis-development.de/) +# Copyright:: Copyright (c) 2008 The Ruby i18n Team +# License:: MIT +#++ + +module I18n + autoload :ArgumentError, 'i18n/exceptions' + module Backend + autoload :Simple, 'i18n/backend/simple' + end + + @@backend = nil + @@load_path = nil + @@default_locale = :'en' + @@exception_handler = :default_exception_handler + + class << self + # Returns the current backend. Defaults to +Backend::Simple+. + def backend + @@backend ||= Backend::Simple.new + end + + # Sets the current backend. Used to set a custom backend. + def backend=(backend) + @@backend = backend + end + + # Returns the current default locale. Defaults to :'en' + def default_locale + @@default_locale + end + + # Sets the current default locale. Used to set a custom default locale. + def default_locale=(locale) + @@default_locale = locale + end + + # Returns the current locale. Defaults to I18n.default_locale. + def locale + Thread.current[:locale] ||= default_locale + end + + # Sets the current locale pseudo-globally, i.e. in the Thread.current hash. + def locale=(locale) + Thread.current[:locale] = locale + end + + # Returns an array of locales for which translations are available + def available_locales + backend.available_locales + end + + # Sets the exception handler. + def exception_handler=(exception_handler) + @@exception_handler = exception_handler + end + + # Allow clients to register paths providing translation data sources. The + # backend defines acceptable sources. + # + # E.g. the provided SimpleBackend accepts a list of paths to translation + # files which are either named *.rb and contain plain Ruby Hashes or are + # named *.yml and contain YAML data. So for the SimpleBackend clients may + # register translation files like this: + # I18n.load_path << 'path/to/locale/en.yml' + def load_path + @@load_path ||= [] + end + + # Sets the load path instance. Custom implementations are expected to + # behave like a Ruby Array. + def load_path=(load_path) + @@load_path = load_path + end + + # Tells the backend to reload translations. Used in situations like the + # Rails development environment. Backends can implement whatever strategy + # is useful. + def reload! + backend.reload! + end + + # Translates, pluralizes and interpolates a given key using a given locale, + # scope, and default, as well as interpolation values. + # + # *LOOKUP* + # + # Translation data is organized as a nested hash using the upper-level keys + # as namespaces. E.g., ActionView ships with the translation: + # :date => {:formats => {:short => "%b %d"}}. + # + # Translations can be looked up at any level of this hash using the key argument + # and the scope option. E.g., in this example I18n.t :date + # returns the whole translations hash {:formats => {:short => "%b %d"}}. + # + # Key can be either a single key or a dot-separated key (both Strings and Symbols + # work). E.g., the short format can be looked up using both: + # I18n.t 'date.formats.short' + # I18n.t :'date.formats.short' + # + # Scope can be either a single key, a dot-separated key or an array of keys + # or dot-separated keys. Keys and scopes can be combined freely. So these + # examples will all look up the same short date format: + # I18n.t 'date.formats.short' + # I18n.t 'formats.short', :scope => 'date' + # I18n.t 'short', :scope => 'date.formats' + # I18n.t 'short', :scope => %w(date formats) + # + # *INTERPOLATION* + # + # Translations can contain interpolation variables which will be replaced by + # values passed to #translate as part of the options hash, with the keys matching + # the interpolation variable names. + # + # E.g., with a translation :foo => "foo {{bar}}" the option + # value for the key +bar+ will be interpolated into the translation: + # I18n.t :foo, :bar => 'baz' # => 'foo baz' + # + # *PLURALIZATION* + # + # Translation data can contain pluralized translations. Pluralized translations + # are arrays of singluar/plural versions of translations like ['Foo', 'Foos']. + # + # Note that I18n::Backend::Simple only supports an algorithm for English + # pluralization rules. Other algorithms can be supported by custom backends. + # + # This returns the singular version of a pluralized translation: + # I18n.t :foo, :count => 1 # => 'Foo' + # + # These both return the plural version of a pluralized translation: + # I18n.t :foo, :count => 0 # => 'Foos' + # I18n.t :foo, :count => 2 # => 'Foos' + # + # The :count option can be used both for pluralization and interpolation. + # E.g., with the translation + # :foo => ['{{count}} foo', '{{count}} foos'], count will + # be interpolated to the pluralized translation: + # I18n.t :foo, :count => 1 # => '1 foo' + # + # *DEFAULTS* + # + # This returns the translation for :foo or default if no translation was found: + # I18n.t :foo, :default => 'default' + # + # This returns the translation for :foo or the translation for :bar if no + # translation for :foo was found: + # I18n.t :foo, :default => :bar + # + # Returns the translation for :foo or the translation for :bar + # or default if no translations for :foo and :bar were found. + # I18n.t :foo, :default => [:bar, 'default'] + # + # BULK LOOKUP + # + # This returns an array with the translations for :foo and :bar. + # I18n.t [:foo, :bar] + # + # Can be used with dot-separated nested keys: + # I18n.t [:'baz.foo', :'baz.bar'] + # + # Which is the same as using a scope option: + # I18n.t [:foo, :bar], :scope => :baz + def translate(key, options = {}) + locale = options.delete(:locale) || I18n.locale + backend.translate(locale, key, options) + rescue I18n::ArgumentError => e + raise e if options[:raise] + send(@@exception_handler, e, locale, key, options) + end + alias :t :translate + + # Localizes certain objects, such as dates and numbers to local formatting. + def localize(object, options = {}) + locale = options[:locale] || I18n.locale + format = options[:format] || :default + backend.localize(locale, object, format) + end + alias :l :localize + + protected + # Handles exceptions raised in the backend. All exceptions except for + # MissingTranslationData exceptions are re-raised. When a MissingTranslationData + # was caught and the option :raise is not set the handler returns an error + # message string containing the key/scope. + def default_exception_handler(exception, locale, key, options) + return exception.message if MissingTranslationData === exception + raise exception + end + + # Merges the given locale, key and scope into a single array of keys. + # Splits keys that contain dots into multiple keys. Makes sure all + # keys are Symbols. + def normalize_translation_keys(locale, key, scope) + keys = [locale] + Array(scope) + [key] + keys = keys.map { |k| k.to_s.split(/\./) } + keys.flatten.map { |k| k.to_sym } + end + end +end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb new file mode 100644 index 0000000000..c32cc76f34 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb @@ -0,0 +1,215 @@ +require 'i18n/exceptions' + +module I18n + module Backend + class Simple + INTERPOLATION_RESERVED_KEYS = %w(scope default) + MATCH = /(\\\\)?\{\{([^\}]+)\}\}/ + + # Accepts a list of paths to translation files. Loads translations from + # plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml + # for details. + def load_translations(*filenames) + filenames.each { |filename| load_file(filename) } + end + + # Stores translations for the given locale in memory. + # This uses a deep merge for the translations hash, so existing + # translations will be overwritten by new ones only at the deepest + # level of the hash. + def store_translations(locale, data) + merge_translations(locale, data) + end + + def translate(locale, key, options = {}) + raise InvalidLocale.new(locale) if locale.nil? + return key.map { |k| translate(locale, k, options) } if key.is_a? Array + + reserved = :scope, :default + count, scope, default = options.values_at(:count, *reserved) + options.delete(:default) + values = options.reject { |name, value| reserved.include?(name) } + + entry = lookup(locale, key, scope) + if entry.nil? + entry = default(locale, default, options) + if entry.nil? + raise(I18n::MissingTranslationData.new(locale, key, options)) + end + end + entry = pluralize(locale, entry, count) + entry = interpolate(locale, entry, values) + entry + end + + # Acts the same as +strftime+, but returns a localized version of the + # formatted date string. Takes a key from the date/time formats + # translations as a format argument (e.g., :short in :'date.formats'). + def localize(locale, object, format = :default) + raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime) + + type = object.respond_to?(:sec) ? 'time' : 'date' + # TODO only translate these if format is a String? + formats = translate(locale, :"#{type}.formats") + format = formats[format.to_sym] if formats && formats[format.to_sym] + # TODO raise exception unless format found? + format = format.to_s.dup + + # TODO only translate these if the format string is actually present + # TODO check which format strings are present, then bulk translate then, then replace them + format.gsub!(/%a/, translate(locale, :"date.abbr_day_names")[object.wday]) + format.gsub!(/%A/, translate(locale, :"date.day_names")[object.wday]) + format.gsub!(/%b/, translate(locale, :"date.abbr_month_names")[object.mon]) + format.gsub!(/%B/, translate(locale, :"date.month_names")[object.mon]) + format.gsub!(/%p/, translate(locale, :"time.#{object.hour < 12 ? :am : :pm}")) if object.respond_to? :hour + object.strftime(format) + end + + def initialized? + @initialized ||= false + end + + # Returns an array of locales for which translations are available + def available_locales + init_translations unless initialized? + translations.keys + end + + def reload! + @initialized = false + @translations = nil + end + + protected + def init_translations + load_translations(*I18n.load_path.flatten) + @initialized = true + end + + def translations + @translations ||= {} + end + + # Looks up a translation from the translations hash. Returns nil if + # eiher key is nil, or locale, scope or key do not exist as a key in the + # nested translations hash. Splits keys or scopes containing dots + # into multiple keys, i.e. currency.format is regarded the same as + # %w(currency format). + def lookup(locale, key, scope = []) + return unless key + init_translations unless initialized? + keys = I18n.send(:normalize_translation_keys, locale, key, scope) + keys.inject(translations) do |result, k| + if (x = result[k.to_sym]).nil? + return nil + else + x + end + end + end + + # Evaluates a default translation. + # If the given default is a String it is used literally. If it is a Symbol + # it will be translated with the given options. If it is an Array the first + # translation yielded will be returned. + # + # I.e., default(locale, [:foo, 'default']) will return +default+ if + # translate(locale, :foo) does not yield a result. + def default(locale, default, options = {}) + case default + when String then default + when Symbol then translate locale, default, options + when Array then default.each do |obj| + result = default(locale, obj, options.dup) and return result + end and nil + end + rescue MissingTranslationData + nil + end + + # Picks a translation from an array according to English pluralization + # rules. It will pick the first translation if count is not equal to 1 + # and the second translation if it is equal to 1. Other backends can + # implement more flexible or complex pluralization rules. + def pluralize(locale, entry, count) + return entry unless entry.is_a?(Hash) and count + # raise InvalidPluralizationData.new(entry, count) unless entry.is_a?(Hash) + key = :zero if count == 0 && entry.has_key?(:zero) + key ||= count == 1 ? :one : :other + raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key) + entry[key] + end + + # Interpolates values into a given string. + # + # interpolate "file {{file}} opened by \\{{user}}", :file => 'test.txt', :user => 'Mr. X' + # # => "file test.txt opened by {{user}}" + # + # Note that you have to double escape the \\ when you want to escape + # the {{...}} key in a string (once for the string and once for the + # interpolation). + def interpolate(locale, string, values = {}) + return string unless string.is_a?(String) + + string.gsub(MATCH) do + escaped, pattern, key = $1, $2, $2.to_sym + + if escaped + pattern + elsif INTERPOLATION_RESERVED_KEYS.include?(pattern) + raise ReservedInterpolationKey.new(pattern, string) + elsif !values.include?(key) + raise MissingInterpolationArgument.new(pattern, string) + else + values[key].to_s + end + end + end + + # Loads a single translations file by delegating to #load_rb or + # #load_yml depending on the file extension and directly merges the + # data to the existing translations. Raises I18n::UnknownFileType + # for all other file extensions. + def load_file(filename) + type = File.extname(filename).tr('.', '').downcase + raise UnknownFileType.new(type, filename) unless respond_to?(:"load_#{type}") + data = send :"load_#{type}", filename # TODO raise a meaningful exception if this does not yield a Hash + data.each { |locale, d| merge_translations(locale, d) } + end + + # Loads a plain Ruby translations file. eval'ing the file must yield + # a Hash containing translation data with locales as toplevel keys. + def load_rb(filename) + eval(IO.read(filename), binding, filename) + end + + # Loads a YAML translations file. The data must have locales as + # toplevel keys. + def load_yml(filename) + require 'yaml' unless defined? :YAML + YAML::load(IO.read(filename)) + end + + # Deep merges the given translations hash with the existing translations + # for the given locale + def merge_translations(locale, data) + locale = locale.to_sym + translations[locale] ||= {} + data = deep_symbolize_keys(data) + + # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809 + merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 } + translations[locale].merge!(data, &merger) + end + + # Return a new hash with all keys and nested keys converted to symbols. + def deep_symbolize_keys(hash) + hash.inject({}) { |result, (key, value)| + value = deep_symbolize_keys(value) if value.is_a? Hash + result[(key.to_sym rescue key) || key] = value + result + } + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb new file mode 100644 index 0000000000..6897055d6d --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb @@ -0,0 +1,53 @@ +module I18n + class ArgumentError < ::ArgumentError; end + + class InvalidLocale < ArgumentError + attr_reader :locale + def initialize(locale) + @locale = locale + super "#{locale.inspect} is not a valid locale" + end + end + + class MissingTranslationData < ArgumentError + attr_reader :locale, :key, :options + def initialize(locale, key, options) + @key, @locale, @options = key, locale, options + keys = I18n.send(:normalize_translation_keys, locale, key, options[:scope]) + keys << 'no key' if keys.size < 2 + super "translation missing: #{keys.join(', ')}" + end + end + + class InvalidPluralizationData < ArgumentError + attr_reader :entry, :count + def initialize(entry, count) + @entry, @count = entry, count + super "translation data #{entry.inspect} can not be used with :count => #{count}" + end + end + + class MissingInterpolationArgument < ArgumentError + attr_reader :key, :string + def initialize(key, string) + @key, @string = key, string + super "interpolation argument #{key} missing in #{string.inspect}" + end + end + + class ReservedInterpolationKey < ArgumentError + attr_reader :key, :string + def initialize(key, string) + @key, @string = key, string + super "reserved key #{key.inspect} used in #{string.inspect}" + end + end + + class UnknownFileType < ArgumentError + attr_reader :type, :filename + def initialize(type, filename) + @type, @filename = type, filename + super "can not load translations from #{filename}, the file type #{type} is not known" + end + end +end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb new file mode 100644 index 0000000000..353712da49 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/all.rb @@ -0,0 +1,5 @@ +dir = File.dirname(__FILE__) +require dir + '/i18n_test.rb' +require dir + '/simple_backend_test.rb' +require dir + '/i18n_exceptions_test.rb' +# *require* dir + '/custom_backend_test.rb' \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb new file mode 100644 index 0000000000..4e78e71b34 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb @@ -0,0 +1,99 @@ +$:.unshift "lib" + +require 'rubygems' +require 'test/unit' +require 'i18n' +require 'active_support' + +class I18nExceptionsTest < Test::Unit::TestCase + def test_invalid_locale_stores_locale + force_invalid_locale + rescue I18n::ArgumentError => e + assert_nil e.locale + end + + def test_invalid_locale_message + force_invalid_locale + rescue I18n::ArgumentError => e + assert_equal 'nil is not a valid locale', e.message + end + + def test_missing_translation_data_stores_locale_key_and_options + force_missing_translation_data + rescue I18n::ArgumentError => e + options = {:scope => :bar} + assert_equal 'de', e.locale + assert_equal :foo, e.key + assert_equal options, e.options + end + + def test_missing_translation_data_message + force_missing_translation_data + rescue I18n::ArgumentError => e + assert_equal 'translation missing: de, bar, foo', e.message + end + + def test_invalid_pluralization_data_stores_entry_and_count + force_invalid_pluralization_data + rescue I18n::ArgumentError => e + assert_equal [:bar], e.entry + assert_equal 1, e.count + end + + def test_invalid_pluralization_data_message + force_invalid_pluralization_data + rescue I18n::ArgumentError => e + assert_equal 'translation data [:bar] can not be used with :count => 1', e.message + end + + def test_missing_interpolation_argument_stores_key_and_string + force_missing_interpolation_argument + rescue I18n::ArgumentError => e + assert_equal 'bar', e.key + assert_equal "{{bar}}", e.string + end + + def test_missing_interpolation_argument_message + force_missing_interpolation_argument + rescue I18n::ArgumentError => e + assert_equal 'interpolation argument bar missing in "{{bar}}"', e.message + end + + def test_reserved_interpolation_key_stores_key_and_string + force_reserved_interpolation_key + rescue I18n::ArgumentError => e + assert_equal 'scope', e.key + assert_equal "{{scope}}", e.string + end + + def test_reserved_interpolation_key_message + force_reserved_interpolation_key + rescue I18n::ArgumentError => e + assert_equal 'reserved key "scope" used in "{{scope}}"', e.message + end + + private + def force_invalid_locale + I18n.backend.translate nil, :foo + end + + def force_missing_translation_data + I18n.backend.store_translations 'de', :bar => nil + I18n.backend.translate 'de', :foo, :scope => :bar + end + + def force_invalid_pluralization_data + I18n.backend.store_translations 'de', :foo => [:bar] + I18n.backend.translate 'de', :foo, :count => 1 + end + + def force_missing_interpolation_argument + I18n.backend.store_translations 'de', :foo => "{{bar}}" + I18n.backend.translate 'de', :foo, :baz => 'baz' + end + + def force_reserved_interpolation_key + I18n.backend.store_translations 'de', :foo => "{{scope}}" + I18n.backend.translate 'de', :foo, :baz => 'baz' + end +end \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb new file mode 100644 index 0000000000..2835ec4eab --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb @@ -0,0 +1,124 @@ +$:.unshift "lib" + +require 'rubygems' +require 'test/unit' +require 'i18n' +require 'active_support' + +class I18nTest < Test::Unit::TestCase + def setup + I18n.backend.store_translations :'en', { + :currency => { + :format => { + :separator => '.', + :delimiter => ',', + } + } + } + end + + def test_uses_simple_backend_set_by_default + assert I18n.backend.is_a?(I18n::Backend::Simple) + end + + def test_can_set_backend + assert_nothing_raised{ I18n.backend = self } + assert_equal self, I18n.backend + I18n.backend = I18n::Backend::Simple.new + end + + def test_uses_en_us_as_default_locale_by_default + assert_equal 'en', I18n.default_locale + end + + def test_can_set_default_locale + assert_nothing_raised{ I18n.default_locale = 'de' } + assert_equal 'de', I18n.default_locale + I18n.default_locale = 'en' + end + + def test_uses_default_locale_as_locale_by_default + assert_equal I18n.default_locale, I18n.locale + end + + def test_can_set_locale_to_thread_current + assert_nothing_raised{ I18n.locale = 'de' } + assert_equal 'de', I18n.locale + assert_equal 'de', Thread.current[:locale] + I18n.locale = 'en' + end + + def test_can_set_exception_handler + assert_nothing_raised{ I18n.exception_handler = :custom_exception_handler } + I18n.exception_handler = :default_exception_handler # revert it + end + + def test_uses_custom_exception_handler + I18n.exception_handler = :custom_exception_handler + I18n.expects(:custom_exception_handler) + I18n.translate :bogus + I18n.exception_handler = :default_exception_handler # revert it + end + + def test_delegates_translate_to_backend + I18n.backend.expects(:translate).with 'de', :foo, {} + I18n.translate :foo, :locale => 'de' + end + + def test_delegates_localize_to_backend + I18n.backend.expects(:localize).with 'de', :whatever, :default + I18n.localize :whatever, :locale => 'de' + end + + def test_translate_given_no_locale_uses_i18n_locale + I18n.backend.expects(:translate).with 'en', :foo, {} + I18n.translate :foo + end + + def test_translate_on_nested_symbol_keys_works + assert_equal ".", I18n.t(:'currency.format.separator') + end + + def test_translate_with_nested_string_keys_works + assert_equal ".", I18n.t('currency.format.separator') + end + + def test_translate_with_array_as_scope_works + assert_equal ".", I18n.t(:separator, :scope => ['currency.format']) + end + + def test_translate_with_array_containing_dot_separated_strings_as_scope_works + assert_equal ".", I18n.t(:separator, :scope => ['currency.format']) + end + + def test_translate_with_key_array_and_dot_separated_scope_works + assert_equal [".", ","], I18n.t(%w(separator delimiter), :scope => 'currency.format') + end + + def test_translate_with_dot_separated_key_array_and_scope_works + assert_equal [".", ","], I18n.t(%w(format.separator format.delimiter), :scope => 'currency') + end + + def test_translate_with_options_using_scope_works + I18n.backend.expects(:translate).with('de', :precision, :scope => :"currency.format") + I18n.with_options :locale => 'de', :scope => :'currency.format' do |locale| + locale.t :precision + end + end + + # def test_translate_given_no_args_raises_missing_translation_data + # assert_equal "translation missing: en, no key", I18n.t + # end + + def test_translate_given_a_bogus_key_raises_missing_translation_data + assert_equal "translation missing: en, bogus", I18n.t(:bogus) + end + + def test_localize_nil_raises_argument_error + assert_raise(I18n::ArgumentError) { I18n.l nil } + end + + def test_localize_object_raises_argument_error + assert_raise(I18n::ArgumentError) { I18n.l Object.new } + end +end diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb new file mode 100644 index 0000000000..6044ce10d9 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb @@ -0,0 +1 @@ +{:'en-Ruby' => {:foo => {:bar => "baz"}}} \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml new file mode 100644 index 0000000000..0b298c9c0e --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml @@ -0,0 +1,3 @@ +en-Yaml: + foo: + bar: baz \ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb new file mode 100644 index 0000000000..a1696c77f6 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb @@ -0,0 +1,567 @@ +# encoding: utf-8 +$:.unshift "lib" + +require 'rubygems' +require 'test/unit' +require 'i18n' +require 'time' +require 'yaml' + +module I18nSimpleBackendTestSetup + def setup_backend + # backend_reset_translations! + @backend = I18n::Backend::Simple.new + @backend.store_translations 'en', :foo => {:bar => 'bar', :baz => 'baz'} + @locale_dir = File.dirname(__FILE__) + '/locale' + end + alias :setup :setup_backend + + # def backend_reset_translations! + # I18n::Backend::Simple::ClassMethods.send :class_variable_set, :@@translations, {} + # end + + def backend_get_translations + # I18n::Backend::Simple::ClassMethods.send :class_variable_get, :@@translations + @backend.instance_variable_get :@translations + end + + def add_datetime_translations + @backend.store_translations :'de', { + :date => { + :formats => { + :default => "%d.%m.%Y", + :short => "%d. %b", + :long => "%d. %B %Y", + }, + :day_names => %w(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag), + :abbr_day_names => %w(So Mo Di Mi Do Fr Sa), + :month_names => %w(Januar Februar März April Mai Juni Juli August September Oktober November Dezember).unshift(nil), + :abbr_month_names => %w(Jan Feb Mar Apr Mai Jun Jul Aug Sep Okt Nov Dez).unshift(nil), + :order => [:day, :month, :year] + }, + :time => { + :formats => { + :default => "%a, %d. %b %Y %H:%M:%S %z", + :short => "%d. %b %H:%M", + :long => "%d. %B %Y %H:%M", + }, + :am => 'am', + :pm => 'pm' + }, + :datetime => { + :distance_in_words => { + :half_a_minute => 'half a minute', + :less_than_x_seconds => { + :one => 'less than 1 second', + :other => 'less than {{count}} seconds' + }, + :x_seconds => { + :one => '1 second', + :other => '{{count}} seconds' + }, + :less_than_x_minutes => { + :one => 'less than a minute', + :other => 'less than {{count}} minutes' + }, + :x_minutes => { + :one => '1 minute', + :other => '{{count}} minutes' + }, + :about_x_hours => { + :one => 'about 1 hour', + :other => 'about {{count}} hours' + }, + :x_days => { + :one => '1 day', + :other => '{{count}} days' + }, + :about_x_months => { + :one => 'about 1 month', + :other => 'about {{count}} months' + }, + :x_months => { + :one => '1 month', + :other => '{{count}} months' + }, + :about_x_years => { + :one => 'about 1 year', + :other => 'about {{count}} year' + }, + :over_x_years => { + :one => 'over 1 year', + :other => 'over {{count}} years' + } + } + } + } + end +end + +class I18nSimpleBackendTranslationsTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def test_store_translations_adds_translations # no, really :-) + @backend.store_translations :'en', :foo => 'bar' + assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations + end + + def test_store_translations_deep_merges_translations + @backend.store_translations :'en', :foo => {:bar => 'bar'} + @backend.store_translations :'en', :foo => {:baz => 'baz'} + assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations + end + + def test_store_translations_forces_locale_to_sym + @backend.store_translations 'en', :foo => 'bar' + assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations + end + + def test_store_translations_converts_keys_to_symbols + # backend_reset_translations! + @backend.store_translations 'en', 'foo' => {'bar' => 'bar', 'baz' => 'baz'} + assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations + end +end + +class I18nSimpleBackendAvailableLocalesTest < Test::Unit::TestCase + def test_available_locales + @backend = I18n::Backend::Simple.new + @backend.store_translations 'de', :foo => 'bar' + @backend.store_translations 'en', :foo => 'foo' + + assert_equal ['de', 'en'], @backend.available_locales.map{|locale| locale.to_s }.sort + end +end + +class I18nSimpleBackendTranslateTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def test_translate_calls_lookup_with_locale_given + @backend.expects(:lookup).with('de', :bar, [:foo]).returns 'bar' + @backend.translate 'de', :bar, :scope => [:foo] + end + + def test_given_no_keys_it_returns_the_default + assert_equal 'default', @backend.translate('en', nil, :default => 'default') + end + + def test_translate_given_a_symbol_as_a_default_translates_the_symbol + assert_equal 'bar', @backend.translate('en', nil, :scope => [:foo], :default => :bar) + end + + def test_translate_given_an_array_as_default_uses_the_first_match + assert_equal 'bar', @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :bar]) + end + + def test_translate_given_an_array_of_inexistent_keys_it_raises_missing_translation_data + assert_raise I18n::MissingTranslationData do + @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :does_not_exist_3]) + end + end + + def test_translate_an_array_of_keys_translates_all_of_them + assert_equal %w(bar baz), @backend.translate('en', [:bar, :baz], :scope => [:foo]) + end + + def test_translate_calls_pluralize + @backend.expects(:pluralize).with 'en', 'bar', 1 + @backend.translate 'en', :bar, :scope => [:foo], :count => 1 + end + + def test_translate_calls_interpolate + @backend.expects(:interpolate).with 'en', 'bar', {} + @backend.translate 'en', :bar, :scope => [:foo] + end + + def test_translate_calls_interpolate_including_count_as_a_value + @backend.expects(:interpolate).with 'en', 'bar', {:count => 1} + @backend.translate 'en', :bar, :scope => [:foo], :count => 1 + end + + def test_translate_given_nil_as_a_locale_raises_an_argument_error + assert_raise(I18n::InvalidLocale){ @backend.translate nil, :bar } + end + + def test_translate_with_a_bogus_key_and_no_default_raises_missing_translation_data + assert_raise(I18n::MissingTranslationData){ @backend.translate 'de', :bogus } + end +end + +class I18nSimpleBackendLookupTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + # useful because this way we can use the backend with no key for interpolation/pluralization + def test_lookup_given_nil_as_a_key_returns_nil + assert_nil @backend.send(:lookup, 'en', nil) + end + + def test_lookup_given_nested_keys_looks_up_a_nested_hash_value + assert_equal 'bar', @backend.send(:lookup, 'en', :bar, [:foo]) + end +end + +class I18nSimpleBackendPluralizeTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def test_pluralize_given_nil_returns_the_given_entry + entry = {:one => 'bar', :other => 'bars'} + assert_equal entry, @backend.send(:pluralize, nil, entry, nil) + end + + def test_pluralize_given_0_returns_zero_string_if_zero_key_given + assert_equal 'zero', @backend.send(:pluralize, nil, {:zero => 'zero', :one => 'bar', :other => 'bars'}, 0) + end + + def test_pluralize_given_0_returns_plural_string_if_no_zero_key_given + assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 0) + end + + def test_pluralize_given_1_returns_singular_string + assert_equal 'bar', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 1) + end + + def test_pluralize_given_2_returns_plural_string + assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 2) + end + + def test_pluralize_given_3_returns_plural_string + assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 3) + end + + def test_interpolate_given_incomplete_pluralization_data_raises_invalid_pluralization_data + assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, {:one => 'bar'}, 2) } + end + + # def test_interpolate_given_a_string_raises_invalid_pluralization_data + # assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, 'bar', 2) } + # end + # + # def test_interpolate_given_an_array_raises_invalid_pluralization_data + # assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, ['bar'], 2) } + # end +end + +class I18nSimpleBackendInterpolateTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def test_interpolate_given_a_value_hash_interpolates_the_values_to_the_string + assert_equal 'Hi David!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'David') + end + + def test_interpolate_given_a_value_hash_interpolates_into_unicode_string + assert_equal 'Häi David!', @backend.send(:interpolate, nil, 'Häi {{name}}!', :name => 'David') + end + + def test_interpolate_given_an_unicode_value_hash_interpolates_to_the_string + assert_equal 'Hi ゆきひろ!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'ゆきひろ') + end + + def test_interpolate_given_an_unicode_value_hash_interpolates_into_unicode_string + assert_equal 'こんにちは、ゆきひろさん!', @backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => 'ゆきひろ') + end + + if Kernel.const_defined?(:Encoding) + def test_interpolate_given_a_non_unicode_multibyte_value_hash_interpolates_into_a_string_with_the_same_encoding + assert_equal euc_jp('Hi ゆきひろ!'), @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => euc_jp('ゆきひろ')) + end + + def test_interpolate_given_an_unicode_value_hash_into_a_non_unicode_multibyte_string_raises_encoding_compatibility_error + assert_raise(Encoding::CompatibilityError) do + @backend.send(:interpolate, nil, euc_jp('こんにちは、{{name}}さん!'), :name => 'ゆきひろ') + end + end + + def test_interpolate_given_a_non_unicode_multibyte_value_hash_into_an_unicode_string_raises_encoding_compatibility_error + assert_raise(Encoding::CompatibilityError) do + @backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => euc_jp('ゆきひろ')) + end + end + end + + def test_interpolate_given_nil_as_a_string_returns_nil + assert_nil @backend.send(:interpolate, nil, nil, :name => 'David') + end + + def test_interpolate_given_an_non_string_as_a_string_returns_nil + assert_equal [], @backend.send(:interpolate, nil, [], :name => 'David') + end + + def test_interpolate_given_a_values_hash_with_nil_values_interpolates_the_string + assert_equal 'Hi !', @backend.send(:interpolate, nil, 'Hi {{name}}!', {:name => nil}) + end + + def test_interpolate_given_an_empty_values_hash_raises_missing_interpolation_argument + assert_raise(I18n::MissingInterpolationArgument) { @backend.send(:interpolate, nil, 'Hi {{name}}!', {}) } + end + + def test_interpolate_given_a_string_containing_a_reserved_key_raises_reserved_interpolation_key + assert_raise(I18n::ReservedInterpolationKey) { @backend.send(:interpolate, nil, '{{default}}', {:default => nil}) } + end + + private + + def euc_jp(string) + string.encode!(Encoding::EUC_JP) + end +end + +class I18nSimpleBackendLocalizeDateTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def setup + @backend = I18n::Backend::Simple.new + add_datetime_translations + @date = Date.new 2008, 1, 1 + end + + def test_translate_given_the_short_format_it_uses_it + assert_equal '01. Jan', @backend.localize('de', @date, :short) + end + + def test_translate_given_the_long_format_it_uses_it + assert_equal '01. Januar 2008', @backend.localize('de', @date, :long) + end + + def test_translate_given_the_default_format_it_uses_it + assert_equal '01.01.2008', @backend.localize('de', @date, :default) + end + + def test_translate_given_a_day_name_format_it_returns_a_day_name + assert_equal 'Dienstag', @backend.localize('de', @date, '%A') + end + + def test_translate_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name + assert_equal 'Di', @backend.localize('de', @date, '%a') + end + + def test_translate_given_a_month_name_format_it_returns_a_month_name + assert_equal 'Januar', @backend.localize('de', @date, '%B') + end + + def test_translate_given_an_abbr_month_name_format_it_returns_an_abbrevated_month_name + assert_equal 'Jan', @backend.localize('de', @date, '%b') + end + + def test_translate_given_no_format_it_does_not_fail + assert_nothing_raised{ @backend.localize 'de', @date } + end + + def test_translate_given_an_unknown_format_it_does_not_fail + assert_nothing_raised{ @backend.localize 'de', @date, '%x' } + end + + def test_localize_nil_raises_argument_error + assert_raise(I18n::ArgumentError) { @backend.localize 'de', nil } + end + + def test_localize_object_raises_argument_error + assert_raise(I18n::ArgumentError) { @backend.localize 'de', Object.new } + end +end + +class I18nSimpleBackendLocalizeDateTimeTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def setup + @backend = I18n::Backend::Simple.new + add_datetime_translations + @morning = DateTime.new 2008, 1, 1, 6 + @evening = DateTime.new 2008, 1, 1, 18 + end + + def test_translate_given_the_short_format_it_uses_it + assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short) + end + + def test_translate_given_the_long_format_it_uses_it + assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long) + end + + def test_translate_given_the_default_format_it_uses_it + assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default) + end + + def test_translate_given_a_day_name_format_it_returns_the_correct_day_name + assert_equal 'Dienstag', @backend.localize('de', @morning, '%A') + end + + def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name + assert_equal 'Di', @backend.localize('de', @morning, '%a') + end + + def test_translate_given_a_month_name_format_it_returns_the_correct_month_name + assert_equal 'Januar', @backend.localize('de', @morning, '%B') + end + + def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name + assert_equal 'Jan', @backend.localize('de', @morning, '%b') + end + + def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator + assert_equal 'am', @backend.localize('de', @morning, '%p') + assert_equal 'pm', @backend.localize('de', @evening, '%p') + end + + def test_translate_given_no_format_it_does_not_fail + assert_nothing_raised{ @backend.localize 'de', @morning } + end + + def test_translate_given_an_unknown_format_it_does_not_fail + assert_nothing_raised{ @backend.localize 'de', @morning, '%x' } + end +end + +class I18nSimpleBackendLocalizeTimeTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def setup + @old_timezone, ENV['TZ'] = ENV['TZ'], 'UTC' + @backend = I18n::Backend::Simple.new + add_datetime_translations + @morning = Time.parse '2008-01-01 6:00 UTC' + @evening = Time.parse '2008-01-01 18:00 UTC' + end + + def teardown + @old_timezone ? ENV['TZ'] = @old_timezone : ENV.delete('TZ') + end + + def test_translate_given_the_short_format_it_uses_it + assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short) + end + + def test_translate_given_the_long_format_it_uses_it + assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long) + end + + # TODO Seems to break on Windows because ENV['TZ'] is ignored. What's a better way to do this? + # def test_translate_given_the_default_format_it_uses_it + # assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default) + # end + + def test_translate_given_a_day_name_format_it_returns_the_correct_day_name + assert_equal 'Dienstag', @backend.localize('de', @morning, '%A') + end + + def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name + assert_equal 'Di', @backend.localize('de', @morning, '%a') + end + + def test_translate_given_a_month_name_format_it_returns_the_correct_month_name + assert_equal 'Januar', @backend.localize('de', @morning, '%B') + end + + def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name + assert_equal 'Jan', @backend.localize('de', @morning, '%b') + end + + def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator + assert_equal 'am', @backend.localize('de', @morning, '%p') + assert_equal 'pm', @backend.localize('de', @evening, '%p') + end + + def test_translate_given_no_format_it_does_not_fail + assert_nothing_raised{ @backend.localize 'de', @morning } + end + + def test_translate_given_an_unknown_format_it_does_not_fail + assert_nothing_raised{ @backend.localize 'de', @morning, '%x' } + end +end + +class I18nSimpleBackendHelperMethodsTest < Test::Unit::TestCase + def setup + @backend = I18n::Backend::Simple.new + end + + def test_deep_symbolize_keys_works + result = @backend.send :deep_symbolize_keys, 'foo' => {'bar' => {'baz' => 'bar'}} + expected = {:foo => {:bar => {:baz => 'bar'}}} + assert_equal expected, result + end +end + +class I18nSimpleBackendLoadTranslationsTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def test_load_translations_with_unknown_file_type_raises_exception + assert_raise(I18n::UnknownFileType) { @backend.load_translations "#{@locale_dir}/en.xml" } + end + + def test_load_translations_with_ruby_file_type_does_not_raise_exception + assert_nothing_raised { @backend.load_translations "#{@locale_dir}/en.rb" } + end + + def test_load_rb_loads_data_from_ruby_file + data = @backend.send :load_rb, "#{@locale_dir}/en.rb" + assert_equal({:'en-Ruby' => {:foo => {:bar => "baz"}}}, data) + end + + def test_load_rb_loads_data_from_yaml_file + data = @backend.send :load_yml, "#{@locale_dir}/en.yml" + assert_equal({'en-Yaml' => {'foo' => {'bar' => 'baz'}}}, data) + end + + def test_load_translations_loads_from_different_file_formats + @backend = I18n::Backend::Simple.new + @backend.load_translations "#{@locale_dir}/en.rb", "#{@locale_dir}/en.yml" + expected = { + :'en-Ruby' => {:foo => {:bar => "baz"}}, + :'en-Yaml' => {:foo => {:bar => "baz"}} + } + assert_equal expected, backend_get_translations + end +end + +class I18nSimpleBackendLoadPathTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def teardown + I18n.load_path = [] + end + + def test_nested_load_paths_do_not_break_locale_loading + @backend = I18n::Backend::Simple.new + I18n.load_path = [[File.dirname(__FILE__) + '/locale/en.yml']] + assert_nil backend_get_translations + assert_nothing_raised { @backend.send :init_translations } + assert_not_nil backend_get_translations + end + + def test_adding_arrays_of_filenames_to_load_path_do_not_break_locale_loading + @backend = I18n::Backend::Simple.new + I18n.load_path << Dir[File.dirname(__FILE__) + '/locale/*.{rb,yml}'] + assert_nil backend_get_translations + assert_nothing_raised { @backend.send :init_translations } + assert_not_nil backend_get_translations + end +end + +class I18nSimpleBackendReloadTranslationsTest < Test::Unit::TestCase + include I18nSimpleBackendTestSetup + + def setup + @backend = I18n::Backend::Simple.new + I18n.load_path = [File.dirname(__FILE__) + '/locale/en.yml'] + assert_nil backend_get_translations + @backend.send :init_translations + end + + def teardown + I18n.load_path = [] + end + + def test_setup + assert_not_nil backend_get_translations + end + + def test_reload_translations_unloads_translations + @backend.reload! + assert_nil backend_get_translations + end + + def test_reload_translations_uninitializes_translations + @backend.reload! + assert_equal @backend.initialized?, false + end +end -- cgit v1.2.3 From afc129e2707daa0de1dd85c0796a1f9d73e7107f Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 29 Oct 2009 14:39:59 -0400 Subject: Fix some Ruby warnings: `*' interpreted as argument prefix --- actionpack/lib/action_controller/translation.rb | 4 ++-- actionpack/lib/action_view/helpers/translation_helper.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_controller/translation.rb b/actionpack/lib/action_controller/translation.rb index 9bb63cdb15..65e9eddb0a 100644 --- a/actionpack/lib/action_controller/translation.rb +++ b/actionpack/lib/action_controller/translation.rb @@ -1,12 +1,12 @@ module ActionController module Translation def translate(*args) - I18n.translate *args + I18n.translate(*args) end alias :t :translate def localize(*args) - I18n.localize *args + I18n.localize(*args) end alias :l :localize end diff --git a/actionpack/lib/action_view/helpers/translation_helper.rb b/actionpack/lib/action_view/helpers/translation_helper.rb index 4aed10f640..564f12c955 100644 --- a/actionpack/lib/action_view/helpers/translation_helper.rb +++ b/actionpack/lib/action_view/helpers/translation_helper.rb @@ -21,7 +21,7 @@ module ActionView # Delegates to I18n.localize with no additional functionality. def localize(*args) - I18n.localize *args + I18n.localize(*args) end alias :l :localize -- cgit v1.2.3 From 17dee01b6f2186888629859fe2e99232225ae5ea Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 29 Oct 2009 14:43:25 -0400 Subject: Fix Ruby warning: method redefined; discarding old breakpoint --- activesupport/lib/active_support/core_ext/kernel/debugger.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb index 0813a51383..59e03e3df7 100644 --- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb +++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb @@ -7,6 +7,7 @@ module Kernel end end + undef :breakpoint if respond_to?(:breakpoint) def breakpoint message = "\n***** The 'breakpoint' command has been renamed 'debugger' -- please change *****\n" defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message) -- cgit v1.2.3 From 047007fa9ddff03e1979f16a54cf059f4f592d46 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 9 Nov 2009 15:12:33 -0500 Subject: Silence warning: discarding old h --- actionpack/lib/action_view/erb/util.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/actionpack/lib/action_view/erb/util.rb b/actionpack/lib/action_view/erb/util.rb index f767a5e27e..aef859b3ac 100644 --- a/actionpack/lib/action_view/erb/util.rb +++ b/actionpack/lib/action_view/erb/util.rb @@ -23,6 +23,7 @@ class ERB end end + undef :h alias h html_escape module_function :html_escape -- cgit v1.2.3 From d4513ac69958063de3cad9aa655fe9d63e82ec76 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 20:26:46 +0100 Subject: Object#instance_variable_defined? is not needed for Ruby >= 1.8.7 --- .../lib/active_support/core_ext/object/instance_variables.rb | 7 ------- activesupport/test/core_ext/object_and_class_ext_test.rb | 7 ------- 2 files changed, 14 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb index 4ecaab3bbb..866317b17a 100644 --- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb +++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb @@ -1,11 +1,4 @@ class Object - # Available in 1.8.6 and later. - unless respond_to?(:instance_variable_defined?) - def instance_variable_defined?(variable) - instance_variables.include?(variable.to_s) - end - end - # Returns a hash that maps instance variable names without "@" to their # corresponding values. Keys are strings both in Ruby 1.8 and 1.9. # diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb index f0121b862d..e6fbdb637b 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -182,13 +182,6 @@ class ObjectInstanceVariableTest < Test::Unit::TestCase assert_equal %w(@bar @baz), @source.instance_variable_names.sort end - def test_instance_variable_defined - assert @source.instance_variable_defined?('@bar') - assert @source.instance_variable_defined?(:@bar) - assert !@source.instance_variable_defined?(:@foo) - assert !@source.instance_variable_defined?('@foo') - end - def test_copy_instance_variables_from_without_explicit_excludes assert_equal [], @dest.instance_variables @dest.copy_instance_variables_from(@source) -- cgit v1.2.3 From 1979e9c8553f4d7905822fdcc99e52d179e78c3c Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:11:26 +0100 Subject: Symbol#to_proc is not needed for Ruby >= 1.8.7 --- actionpack/test/controller/filters_test.rb | 1 - activerecord/lib/active_record/base.rb | 1 - activeresource/test/cases/base/load_test.rb | 1 - activesupport/lib/active_support/core_ext/symbol.rb | 1 - .../lib/active_support/core_ext/symbol/to_proc.rb | 14 -------------- activesupport/lib/active_support/ruby/shim.rb | 2 -- activesupport/test/core_ext/enumerable_test.rb | 1 - activesupport/test/core_ext/symbol_test.rb | 9 --------- activesupport/test/dependencies_test.rb | 1 - 9 files changed, 31 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/symbol.rb delete mode 100644 activesupport/lib/active_support/core_ext/symbol/to_proc.rb delete mode 100644 activesupport/test/core_ext/symbol_test.rb diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 2da97a9d86..8445428e8f 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -1,5 +1,4 @@ require 'abstract_unit' -require 'active_support/core_ext/symbol' class ActionController::Base class << self diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4e6090458a..056f29f029 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -12,7 +12,6 @@ require 'active_support/core_ext/hash/deep_merge' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/string/behavior' -require 'active_support/core_ext/symbol' require 'active_support/core_ext/object/metaclass' module ActiveRecord #:nodoc: diff --git a/activeresource/test/cases/base/load_test.rb b/activeresource/test/cases/base/load_test.rb index 189a4d81fe..7745a9439b 100644 --- a/activeresource/test/cases/base/load_test.rb +++ b/activeresource/test/cases/base/load_test.rb @@ -1,7 +1,6 @@ require 'abstract_unit' require "fixtures/person" require "fixtures/street_address" -require 'active_support/core_ext/symbol' require 'active_support/core_ext/hash/conversions' module Highrise diff --git a/activesupport/lib/active_support/core_ext/symbol.rb b/activesupport/lib/active_support/core_ext/symbol.rb deleted file mode 100644 index c103cd9dcf..0000000000 --- a/activesupport/lib/active_support/core_ext/symbol.rb +++ /dev/null @@ -1 +0,0 @@ -require 'active_support/core_ext/symbol/to_proc' diff --git a/activesupport/lib/active_support/core_ext/symbol/to_proc.rb b/activesupport/lib/active_support/core_ext/symbol/to_proc.rb deleted file mode 100644 index 520369452b..0000000000 --- a/activesupport/lib/active_support/core_ext/symbol/to_proc.rb +++ /dev/null @@ -1,14 +0,0 @@ -class Symbol - # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples: - # - # # The same as people.collect { |p| p.name } - # people.collect(&:name) - # - # # The same as people.select { |p| p.manager? }.collect { |p| p.salary } - # people.select(&:manager?).collect(&:salary) - # - # This is a builtin method in Ruby 1.8.7 and later. - def to_proc - Proc.new { |*args| args.shift.__send__(self, *args) } - end unless :to_proc.respond_to?(:to_proc) -end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index 37c57c485a..43e7ffc938 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -9,7 +9,6 @@ # Process Process.daemon # REXML security fix # String ord -# Symbol to_proc # Time to_date, to_time, to_datetime require 'active_support' require 'active_support/core_ext/date/calculations' @@ -20,5 +19,4 @@ require 'active_support/core_ext/object/tap' require 'active_support/core_ext/process/daemon' require 'active_support/core_ext/string/conversions' require 'active_support/core_ext/rexml' -require 'active_support/core_ext/symbol/to_proc' require 'active_support/core_ext/time/conversions' diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 4170de3dce..a8e98891d3 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -1,6 +1,5 @@ require 'abstract_unit' require 'active_support/core_ext/array' -require 'active_support/core_ext/symbol' require 'active_support/core_ext/enumerable' Payment = Struct.new(:price) diff --git a/activesupport/test/core_ext/symbol_test.rb b/activesupport/test/core_ext/symbol_test.rb deleted file mode 100644 index 1eaccb9965..0000000000 --- a/activesupport/test/core_ext/symbol_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'abstract_unit' - -class SymbolTests < Test::Unit::TestCase - def test_to_proc - assert_equal %w(one two three), [:one, :two, :three].map(&:to_s) - assert_equal(%w(one two three), - {1 => "one", 2 => "two", 3 => "three"}.sort_by(&:first).map(&:last)) - end -end diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 97d70cf8c4..0fcf1eaf00 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -3,7 +3,6 @@ require 'pp' require 'active_support/dependencies' require 'active_support/core_ext/module/loading' require 'active_support/core_ext/kernel/reporting' -require 'active_support/core_ext/symbol/to_proc' module ModuleWithMissing mattr_accessor :missing_count -- cgit v1.2.3 From f8e713f488bba264ba73251b56ad56385b8ed824 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:23:19 +0100 Subject: Object#tap is not needed for Ruby >= 1.8.7 --- actionpack/lib/action_dispatch/http/request.rb | 1 - .../lib/active_record/attribute_methods/dirty.rb | 2 -- activesupport/lib/active_support/core_ext/object/misc.rb | 1 - activesupport/lib/active_support/core_ext/object/tap.rb | 16 ---------------- activesupport/lib/active_support/ruby/shim.rb | 2 -- activesupport/test/core_ext/object_ext_test.rb | 9 --------- 6 files changed, 31 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/object/tap.rb delete mode 100644 activesupport/test/core_ext/object_ext_test.rb diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index c24b404e2f..b3bb8c623f 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -5,7 +5,6 @@ require 'strscan' require 'active_support/memoizable' require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/hash/indifferent_access' -require 'active_support/core_ext/object/tap' require 'active_support/core_ext/string/access' module ActionDispatch diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 4df0f1af69..4a3ab9ea82 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -1,5 +1,3 @@ -require 'active_support/core_ext/object/tap' - module ActiveRecord module AttributeMethods module Dirty diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb index 80011dfbed..3e3af03cc5 100644 --- a/activesupport/lib/active_support/core_ext/object/misc.rb +++ b/activesupport/lib/active_support/core_ext/object/misc.rb @@ -1,3 +1,2 @@ require 'active_support/core_ext/object/returning' -require 'active_support/core_ext/object/tap' require 'active_support/core_ext/object/with_options' diff --git a/activesupport/lib/active_support/core_ext/object/tap.rb b/activesupport/lib/active_support/core_ext/object/tap.rb deleted file mode 100644 index db7e715e2d..0000000000 --- a/activesupport/lib/active_support/core_ext/object/tap.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Object - # Yields x to the block, and then returns x. - # The primary purpose of this method is to "tap into" a method chain, - # in order to perform operations on intermediate results within the chain. - # - # (1..10).tap { |x| puts "original: #{x.inspect}" }.to_a. - # tap { |x| puts "array: #{x.inspect}" }. - # select { |x| x%2 == 0 }. - # tap { |x| puts "evens: #{x.inspect}" }. - # map { |x| x*x }. - # tap { |x| puts "squares: #{x.inspect}" } - def tap - yield self - self - end unless Object.respond_to?(:tap) -end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index 43e7ffc938..1f47c04826 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -5,7 +5,6 @@ # DateTime to_date, to_datetime, xmlschema # Enumerable group_by, each_with_object, none? # Integer even?, odd? -# Object tap # Process Process.daemon # REXML security fix # String ord @@ -15,7 +14,6 @@ require 'active_support/core_ext/date/calculations' require 'active_support/core_ext/date_time/conversions' require 'active_support/core_ext/enumerable' require 'active_support/core_ext/integer/even_odd' -require 'active_support/core_ext/object/tap' require 'active_support/core_ext/process/daemon' require 'active_support/core_ext/string/conversions' require 'active_support/core_ext/rexml' diff --git a/activesupport/test/core_ext/object_ext_test.rb b/activesupport/test/core_ext/object_ext_test.rb deleted file mode 100644 index 04c19ed2aa..0000000000 --- a/activesupport/test/core_ext/object_ext_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'abstract_unit' -require 'active_support/core_ext/object/metaclass' - -class ObjectExtTest < Test::Unit::TestCase - def test_tap_yields_and_returns_self - foo = Object.new - assert_equal foo, foo.tap { |x| assert_equal foo, x; :bar } - end -end -- cgit v1.2.3 From 004db18cb0f690486336f0fa141ad383c79f9558 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:27:58 +0100 Subject: String#bytesize is not needed for Ruby >= 1.8.7 --- actionpack/lib/action_controller/metal/streaming.rb | 2 -- activesupport/lib/active_support/core_ext/string/bytesize.rb | 5 ----- activesupport/lib/active_support/core_ext/string/interpolation.rb | 1 - activesupport/lib/active_support/message_verifier.rb | 2 -- activesupport/test/core_ext/string_ext_test.rb | 7 ------- 5 files changed, 17 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/string/bytesize.rb diff --git a/actionpack/lib/action_controller/metal/streaming.rb b/actionpack/lib/action_controller/metal/streaming.rb index 4761763a26..43c661bef4 100644 --- a/actionpack/lib/action_controller/metal/streaming.rb +++ b/actionpack/lib/action_controller/metal/streaming.rb @@ -1,5 +1,3 @@ -require 'active_support/core_ext/string/bytesize' - module ActionController #:nodoc: # Methods for sending arbitrary data and for streaming files to the browser, # instead of rendering. diff --git a/activesupport/lib/active_support/core_ext/string/bytesize.rb b/activesupport/lib/active_support/core_ext/string/bytesize.rb deleted file mode 100644 index ed051b921e..0000000000 --- a/activesupport/lib/active_support/core_ext/string/bytesize.rb +++ /dev/null @@ -1,5 +0,0 @@ -unless '1.9'.respond_to?(:bytesize) - class String - alias :bytesize :size - end -end diff --git a/activesupport/lib/active_support/core_ext/string/interpolation.rb b/activesupport/lib/active_support/core_ext/string/interpolation.rb index d9159b690a..41a061c1a4 100644 --- a/activesupport/lib/active_support/core_ext/string/interpolation.rb +++ b/activesupport/lib/active_support/core_ext/string/interpolation.rb @@ -6,7 +6,6 @@ =end if RUBY_VERSION < '1.9' - require 'active_support/core_ext/string/bytesize' # KeyError is raised by String#% when the string contains a named placeholder # that is not contained in the given arguments hash. Ruby 1.9 includes and diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb index 282346b1a6..87e4b1ad33 100644 --- a/activesupport/lib/active_support/message_verifier.rb +++ b/activesupport/lib/active_support/message_verifier.rb @@ -1,5 +1,3 @@ -require 'active_support/core_ext/string/bytesize' - module ActiveSupport # MessageVerifier makes it easy to generate and verify messages which are signed # to prevent tampering. diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 584a41b631..0f988e78a4 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -350,13 +350,6 @@ class TestGetTextString < Test::Unit::TestCase end end -class StringBytesizeTest < Test::Unit::TestCase - def test_bytesize - assert_respond_to 'foo', :bytesize - assert_equal 3, 'foo'.bytesize - end -end - class OutputSafetyTest < ActiveSupport::TestCase def setup @string = "hello" -- cgit v1.2.3 From c0bb4c6ed2f5a5676569746e7bfd70405346ef8f Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:35:43 +0100 Subject: String#start_with? and String#end_with? are not needed for Ruby >= 1.8.7, leaves their plural aliases though --- .../lib/active_support/core_ext/string/starts_ends_with.rb | 14 -------------- activesupport/test/core_ext/string_ext_test.rb | 8 -------- 2 files changed, 22 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb b/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb index f65bb8f75b..641acf62d0 100644 --- a/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +++ b/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb @@ -1,18 +1,4 @@ class String - unless '1.8.7 and up'.respond_to?(:start_with?) - # Does the string start with the specified +prefix+? - def start_with?(prefix) - prefix = prefix.to_s - self[0, prefix.length] == prefix - end - - # Does the string end with the specified +suffix+? - def end_with?(suffix) - suffix = suffix.to_s - self[-suffix.length, suffix.length] == suffix - end - end - alias_method :starts_with?, :start_with? alias_method :ends_with?, :end_with? end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 0f988e78a4..dd9e9e0ebb 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -185,17 +185,9 @@ class StringInflectionsTest < Test::Unit::TestCase assert s.starts_with?('hel') assert !s.starts_with?('el') - assert s.start_with?('h') - assert s.start_with?('hel') - assert !s.start_with?('el') - assert s.ends_with?('o') assert s.ends_with?('lo') assert !s.ends_with?('el') - - assert s.end_with?('o') - assert s.end_with?('lo') - assert !s.end_with?('el') end def test_string_squish -- cgit v1.2.3 From b6598c683bb8f8ef484f54755cced77a5d6200bb Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:39:32 +0100 Subject: String#each_char is not needed for Ruby >= 1.8.7 --- activesupport/lib/active_support/core_ext/string.rb | 1 - .../lib/active_support/core_ext/string/iterators.rb | 13 ------------- activesupport/test/core_ext/string_ext_test.rb | 11 ----------- 3 files changed, 25 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/string/iterators.rb diff --git a/activesupport/lib/active_support/core_ext/string.rb b/activesupport/lib/active_support/core_ext/string.rb index 6c52f12712..0365b6af1c 100644 --- a/activesupport/lib/active_support/core_ext/string.rb +++ b/activesupport/lib/active_support/core_ext/string.rb @@ -4,7 +4,6 @@ require 'active_support/core_ext/string/multibyte' require 'active_support/core_ext/string/starts_ends_with' require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/string/access' -require 'active_support/core_ext/string/iterators' require 'active_support/core_ext/string/xchar' require 'active_support/core_ext/string/behavior' require 'active_support/core_ext/string/interpolation' diff --git a/activesupport/lib/active_support/core_ext/string/iterators.rb b/activesupport/lib/active_support/core_ext/string/iterators.rb deleted file mode 100644 index 2f8aa84024..0000000000 --- a/activesupport/lib/active_support/core_ext/string/iterators.rb +++ /dev/null @@ -1,13 +0,0 @@ -unless '1.9'.respond_to?(:each_char) - class String - # Yields a single-character string for each character in the string. - # When $KCODE = 'UTF8', multi-byte characters are yielded appropriately. - def each_char - require 'strscan' unless defined? ::StringScanner - scanner, char = ::StringScanner.new(self), /./mu - while c = scanner.scan(char) - yield c - end - end - end -end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index dd9e9e0ebb..ffcd086716 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -206,17 +206,6 @@ class StringInflectionsTest < Test::Unit::TestCase # And changes the original string: assert_equal original, expected end - - if RUBY_VERSION < '1.9' - def test_each_char_with_utf8_string_when_kcode_is_utf8 - with_kcode('UTF8') do - '€2.99'.each_char do |char| - assert_not_equal 1, char.length - break - end - end - end - end end class StringBehaviourTest < Test::Unit::TestCase -- cgit v1.2.3 From 329e7f44417c00a8d6fee337c288a463e9d64346 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 21:46:16 +0100 Subject: Integer#even? and Integer#odd? are not needed for Ruby >= 1.8.7 --- activerecord/lib/active_record/validations.rb | 2 -- activesupport/lib/active_support/core_ext/integer.rb | 2 +- .../lib/active_support/core_ext/integer/even_odd.rb | 16 ---------------- .../lib/active_support/core_ext/integer/multiple.rb | 6 ++++++ activesupport/lib/active_support/ruby/shim.rb | 2 -- activesupport/test/core_ext/integer_ext_test.rb | 16 ---------------- 6 files changed, 7 insertions(+), 37 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/integer/even_odd.rb create mode 100644 activesupport/lib/active_support/core_ext/integer/multiple.rb diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 0365cb592f..e8a2a72735 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -1,5 +1,3 @@ -require 'active_support/core_ext/integer/even_odd' - module ActiveRecord # Raised by save! and create! when the record is invalid. Use the # +record+ method to retrieve the record which did not validate. diff --git a/activesupport/lib/active_support/core_ext/integer.rb b/activesupport/lib/active_support/core_ext/integer.rb index 7ba018ed7f..a44a1b4c74 100644 --- a/activesupport/lib/active_support/core_ext/integer.rb +++ b/activesupport/lib/active_support/core_ext/integer.rb @@ -1,3 +1,3 @@ -require 'active_support/core_ext/integer/even_odd' +require 'active_support/core_ext/integer/multiple' require 'active_support/core_ext/integer/inflections' require 'active_support/core_ext/integer/time' diff --git a/activesupport/lib/active_support/core_ext/integer/even_odd.rb b/activesupport/lib/active_support/core_ext/integer/even_odd.rb deleted file mode 100644 index 8f9a97b44c..0000000000 --- a/activesupport/lib/active_support/core_ext/integer/even_odd.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Integer - # Check whether the integer is evenly divisible by the argument. - def multiple_of?(number) - self % number == 0 - end - - # Is the integer a multiple of 2? - def even? - multiple_of? 2 - end unless method_defined?(:even?) - - # Is the integer not a multiple of 2? - def odd? - !even? - end unless method_defined?(:odd?) -end diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb new file mode 100644 index 0000000000..40bea54c67 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb @@ -0,0 +1,6 @@ +class Integer + # Check whether the integer is evenly divisible by the argument. + def multiple_of?(number) + self % number == 0 + end +end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index 1f47c04826..f811239077 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -4,7 +4,6 @@ # Date next_year, next_month # DateTime to_date, to_datetime, xmlschema # Enumerable group_by, each_with_object, none? -# Integer even?, odd? # Process Process.daemon # REXML security fix # String ord @@ -13,7 +12,6 @@ require 'active_support' require 'active_support/core_ext/date/calculations' require 'active_support/core_ext/date_time/conversions' require 'active_support/core_ext/enumerable' -require 'active_support/core_ext/integer/even_odd' require 'active_support/core_ext/process/daemon' require 'active_support/core_ext/string/conversions' require 'active_support/core_ext/rexml' diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index 956ae5189d..e1591089f5 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -2,22 +2,6 @@ require 'abstract_unit' require 'active_support/core_ext/integer' class IntegerExtTest < Test::Unit::TestCase - def test_even - assert [ -2, 0, 2, 4 ].all? { |i| i.even? } - assert ![ -1, 1, 3 ].all? { |i| i.even? } - - assert 22953686867719691230002707821868552601124472329079.odd? - assert !22953686867719691230002707821868552601124472329079.even? - assert 22953686867719691230002707821868552601124472329080.even? - assert !22953686867719691230002707821868552601124472329080.odd? - end - - def test_odd - assert ![ -2, 0, 2, 4 ].all? { |i| i.odd? } - assert [ -1, 1, 3 ].all? { |i| i.odd? } - assert 1000000000000000000000000000000000000000000000000000000001.odd? - end - def test_multiple_of [ -7, 0, 7, 14 ].each { |i| assert i.multiple_of?(7) } [ -7, 7, 14 ].each { |i| assert ! i.multiple_of?(6) } -- cgit v1.2.3 From db2c0d79e3f9ba4fa921b7a122e9e7849729de64 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 22:05:31 +0100 Subject: Enumerable#none? is not needed for Ruby >= 1.8.7 --- activesupport/lib/active_support/core_ext/enumerable.rb | 9 --------- activesupport/test/core_ext/enumerable_test.rb | 11 ----------- 2 files changed, 20 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index 15a303cf04..b11c916f61 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -101,15 +101,6 @@ module Enumerable size = block_given? ? select(&block).size : self.size size > 1 end - - # Returns true if none of the elements match the given block. - # - # success = responses.none? {|r| r.status / 100 == 5 } - # - # This is a builtin method in Ruby 1.8.7 and later. - def none?(&block) - !any?(&block) - end unless [].respond_to?(:none?) end class Range #:nodoc: diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index a8e98891d3..66f5f9fbde 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -89,15 +89,4 @@ class EnumerableTests < Test::Unit::TestCase assert ![ 1, 2 ].many? {|x| x > 1 } assert [ 1, 2, 2 ].many? {|x| x > 1 } end - - def test_none - assert [].none? - assert [nil, false].none? - assert ![1].none? - - assert [].none? {|x| x > 1 } - assert ![ 2 ].none? {|x| x > 1 } - assert ![ 1, 2 ].none? {|x| x > 1 } - assert [ 1, 1 ].none? {|x| x > 1 } - end end -- cgit v1.2.3 From a48f49e56bf53e0a2386da898576ef12d5258358 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 22:14:21 +0100 Subject: the REXML security fix is not needed for Ruby >= 1.8.7 --- activesupport/lib/active_support/core_ext/rexml.rb | 43 ---------------------- activesupport/lib/active_support/ruby/shim.rb | 2 - 2 files changed, 45 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/rexml.rb diff --git a/activesupport/lib/active_support/core_ext/rexml.rb b/activesupport/lib/active_support/core_ext/rexml.rb deleted file mode 100644 index 5288b639a6..0000000000 --- a/activesupport/lib/active_support/core_ext/rexml.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'active_support/core_ext/kernel/reporting' - -# Fixes the rexml vulnerability disclosed at: -# http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/ -# This fix is identical to rexml-expansion-fix version 1.0.1 -require 'rexml/rexml' - -# Earlier versions of rexml defined REXML::Version, newer ones REXML::VERSION -unless (defined?(REXML::VERSION) ? REXML::VERSION : REXML::Version) > "3.1.7.2" - silence_warnings { require 'rexml/document' } - - # REXML in 1.8.7 has the patch but early patchlevels didn't update Version from 3.1.7.2. - unless REXML::Document.respond_to?(:entity_expansion_limit=) - silence_warnings { require 'rexml/entity' } - - module REXML #:nodoc: - class Entity < Child #:nodoc: - undef_method :unnormalized - def unnormalized - document.record_entity_expansion! if document - v = value() - return nil if v.nil? - @unnormalized = Text::unnormalize(v, parent) - @unnormalized - end - end - class Document < Element #:nodoc: - @@entity_expansion_limit = 10_000 - def self.entity_expansion_limit= val - @@entity_expansion_limit = val - end - - def record_entity_expansion! - @number_of_expansions ||= 0 - @number_of_expansions += 1 - if @number_of_expansions > @@entity_expansion_limit - raise "Number of entity expansions exceeded, processing aborted." - end - end - end - end - end -end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index f811239077..af6e8aa91e 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -5,7 +5,6 @@ # DateTime to_date, to_datetime, xmlschema # Enumerable group_by, each_with_object, none? # Process Process.daemon -# REXML security fix # String ord # Time to_date, to_time, to_datetime require 'active_support' @@ -14,5 +13,4 @@ require 'active_support/core_ext/date_time/conversions' require 'active_support/core_ext/enumerable' require 'active_support/core_ext/process/daemon' require 'active_support/core_ext/string/conversions' -require 'active_support/core_ext/rexml' require 'active_support/core_ext/time/conversions' -- cgit v1.2.3 From d5fd09246edbaf2d73ee13dabf2b7b378203a530 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 13:27:58 -0800 Subject: Bump AP gem dependencies to upgrade Rack to 1.0.1 and to include rack-mount and erubis. --- actionpack/actionpack.gemspec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index 1930416358..ae5985120e 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -16,8 +16,10 @@ Gem::Specification.new do |s| s.add_dependency('activesupport', '= 3.0.pre') s.add_dependency('activemodel', '= 3.0.pre') - s.add_dependency('rack', '~> 1.0.0') - s.add_dependency('rack-test', '~> 0.5.0') + s.add_dependency('rack', '~> 1.0.1') + s.add_dependency('rack-test', '~> 0.5.0') + s.add_dependency('rack-mount', '~> 0.0.1') + s.add_dependency('erubis', '~> 2.6.0') s.require_path = 'lib' s.autorequire = 'action_controller' -- cgit v1.2.3 From a66449d85255fc3ec69aa842b8059f954d7b76e2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 14:36:49 -0800 Subject: Ruby 1.9.2: work around inherited hook being called before yielding to block --- railties/test/generators_test.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 9c9a4e6016..5579e0f40d 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -165,15 +165,13 @@ class GeneratorsTest < GeneratorsTestCase def test_developer_options_are_overwriten_by_user_options Rails::Generators.options[:new_generator] = { :generate => false } - klass = Class.new(Rails::Generators::Base) do - def self.name - "NewGenerator" + self.class.class_eval <<-end_eval + class NewGenerator < Rails::Generators::Base + class_option :generate, :default => true end + end_eval - class_option :generate, :default => true - end - - assert_equal false, klass.class_options[:generate].default + assert_equal false, NewGenerator.class_options[:generate].default end def test_source_paths_for_not_namespaced_generators -- cgit v1.2.3 From 0ac88af998ead6c77d05f669e3494fed25bb6103 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 16:10:37 -0800 Subject: Remark when bundled env require fails --- actionpack/test/abstract_unit.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 214d79cd87..5b7dc2d4fc 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -2,6 +2,7 @@ root = File.expand_path('../../..', __FILE__) begin require "#{root}/vendor/gems/environment" rescue LoadError + $stderr.puts "Missing bundled environment, continuing: #{$!}" $:.unshift "#{root}/activesupport/lib" $:.unshift "#{root}/activemodel/lib" end -- cgit v1.2.3 From eeac054d59dd9373313596dc3ef9db30c4b227d5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 16:57:10 -0800 Subject: Fix missing dependency --- activesupport/test/core_ext/string_ext_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index ffcd086716..1e8a1c4f08 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -5,6 +5,7 @@ require 'inflector_test_cases' require 'active_support/core_ext/string' require 'active_support/core_ext/time' +require 'active_support/core_ext/kernel/reporting' class StringInflectionsTest < Test::Unit::TestCase include InflectorTestCases -- cgit v1.2.3 From feaa762e40e7ca7fd9b43172dea92b14ed6b3584 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 16:59:38 -0800 Subject: Ditto --- activesupport/test/multibyte_utils_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/activesupport/test/multibyte_utils_test.rb b/activesupport/test/multibyte_utils_test.rb index 0a2f20d282..1dff944922 100644 --- a/activesupport/test/multibyte_utils_test.rb +++ b/activesupport/test/multibyte_utils_test.rb @@ -2,6 +2,7 @@ require 'abstract_unit' require 'multibyte_test_helpers' +require 'active_support/core_ext/kernel/reporting' class MultibyteUtilsTest < ActiveSupport::TestCase include MultibyteTestHelpers -- cgit v1.2.3 From 703d31c20a7b531053d5c009972a89e857b07376 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 17:01:57 -0800 Subject: Clarify failed assertion --- activerecord/test/cases/relations_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 4833d04aff..1a2c8030fb 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -78,7 +78,7 @@ class RelationTest < ActiveRecord::TestCase relation = Topic.all ["map", "uniq", "sort", "insert", "delete", "update"].each do |method| - assert relation.respond_to?(method) + assert relation.respond_to?(method), "Topic.all should respond to #{method.inspect}" end end -- cgit v1.2.3 From 08f7c4dd8951053c443371f786be59d04448c225 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 19:30:02 -0800 Subject: Revert "the REXML security fix is not needed for Ruby >= 1.8.7" Still required on older 1.8.7 patchlevels. This reverts commit a48f49e56bf53e0a2386da898576ef12d5258358. --- activesupport/lib/active_support/core_ext/rexml.rb | 43 ++++++++++++++++++++++ activesupport/lib/active_support/ruby/shim.rb | 2 + 2 files changed, 45 insertions(+) create mode 100644 activesupport/lib/active_support/core_ext/rexml.rb diff --git a/activesupport/lib/active_support/core_ext/rexml.rb b/activesupport/lib/active_support/core_ext/rexml.rb new file mode 100644 index 0000000000..5288b639a6 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/rexml.rb @@ -0,0 +1,43 @@ +require 'active_support/core_ext/kernel/reporting' + +# Fixes the rexml vulnerability disclosed at: +# http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/ +# This fix is identical to rexml-expansion-fix version 1.0.1 +require 'rexml/rexml' + +# Earlier versions of rexml defined REXML::Version, newer ones REXML::VERSION +unless (defined?(REXML::VERSION) ? REXML::VERSION : REXML::Version) > "3.1.7.2" + silence_warnings { require 'rexml/document' } + + # REXML in 1.8.7 has the patch but early patchlevels didn't update Version from 3.1.7.2. + unless REXML::Document.respond_to?(:entity_expansion_limit=) + silence_warnings { require 'rexml/entity' } + + module REXML #:nodoc: + class Entity < Child #:nodoc: + undef_method :unnormalized + def unnormalized + document.record_entity_expansion! if document + v = value() + return nil if v.nil? + @unnormalized = Text::unnormalize(v, parent) + @unnormalized + end + end + class Document < Element #:nodoc: + @@entity_expansion_limit = 10_000 + def self.entity_expansion_limit= val + @@entity_expansion_limit = val + end + + def record_entity_expansion! + @number_of_expansions ||= 0 + @number_of_expansions += 1 + if @number_of_expansions > @@entity_expansion_limit + raise "Number of entity expansions exceeded, processing aborted." + end + end + end + end + end +end diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb index af6e8aa91e..f811239077 100644 --- a/activesupport/lib/active_support/ruby/shim.rb +++ b/activesupport/lib/active_support/ruby/shim.rb @@ -5,6 +5,7 @@ # DateTime to_date, to_datetime, xmlschema # Enumerable group_by, each_with_object, none? # Process Process.daemon +# REXML security fix # String ord # Time to_date, to_time, to_datetime require 'active_support' @@ -13,4 +14,5 @@ require 'active_support/core_ext/date_time/conversions' require 'active_support/core_ext/enumerable' require 'active_support/core_ext/process/daemon' require 'active_support/core_ext/string/conversions' +require 'active_support/core_ext/rexml' require 'active_support/core_ext/time/conversions' -- cgit v1.2.3 From 1004fcb76761aa42ff18d8aa373614a41a259d3c Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 21:37:37 -0600 Subject: Fixed AD assertion autoloads [#3470 state:resolved] --- actionpack/lib/action_dispatch/testing/assertions.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_dispatch/testing/assertions.rb b/actionpack/lib/action_dispatch/testing/assertions.rb index 96f08f2355..0e4a92048f 100644 --- a/actionpack/lib/action_dispatch/testing/assertions.rb +++ b/actionpack/lib/action_dispatch/testing/assertions.rb @@ -1,8 +1,21 @@ module ActionDispatch module Assertions - %w(response selector tag dom routing model).each do |kind| - require "action_dispatch/testing/assertions/#{kind}" - include const_get("#{kind.camelize}Assertions") + autoload :DomAssertions, 'action_dispatch/testing/assertions/dom' + autoload :ModelAssertions, 'action_dispatch/testing/assertions/model' + autoload :ResponseAssertions, 'action_dispatch/testing/assertions/response' + autoload :RoutingAssertions, 'action_dispatch/testing/assertions/routing' + autoload :SelectorAssertions, 'action_dispatch/testing/assertions/selector' + autoload :TagAssertions, 'action_dispatch/testing/assertions/tag' + + extend ActiveSupport::Concern + + included do + include DomAssertions + include ModelAssertions + include ResponseAssertions + include RoutingAssertions + include SelectorAssertions + include TagAssertions end end end -- cgit v1.2.3 From 763489ce064b92609634638c93022b6916976e4f Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 21:54:50 -0600 Subject: Add pending test for route generation with default param --- actionpack/test/controller/routing_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index bb0b9247f3..71ae17a418 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -1645,6 +1645,22 @@ class RouteSetTest < ActiveSupport::TestCase assert_uri_equal '/foo?x=hello+world', default_route_set.generate({:controller => 'foo', :x => 'hello world'}) end + def test_generate_with_default_params + set.draw do |map| + map.connect 'dummy/page/:page', :controller => 'dummy' + map.connect 'dummy/dots/page.:page', :controller => 'dummy', :action => 'dots' + map.connect 'ibocorp/:page', :controller => 'ibocorp', + :requirements => { :page => /\d+/ }, + :defaults => { :page => 1 } + + map.connect ':controller/:action/:id' + end + + pending do + assert_equal '/ibocorp', set.generate({:controller => 'ibocorp', :page => 1}) + end + end + private def assert_uri_equal(expected, actual) assert_equal(sort_query_string_params(expected), sort_query_string_params(actual)) -- cgit v1.2.3 From 3ce6a10b67b8a683c2543b29ac71102ca452e8b8 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Nov 2009 20:09:55 -0800 Subject: Contortions to work around brittle naming dependency --- railties/lib/rails/generators/base.rb | 52 +++++++++++++++++------------------ railties/test/generators_test.rb | 11 ++++---- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index a64005497b..226ae63963 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -25,8 +25,11 @@ module Rails # Automatically sets the source root based on the class name. # def self.source_root - @_rails_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), - base_name, generator_name, 'templates')) + @_rails_source_root ||= begin + if base_name && generator_name + File.expand_path(File.join(File.dirname(__FILE__), base_name, generator_name, 'templates')) + end + end end # Tries to get the description from a USAGE file one folder above the source @@ -216,7 +219,7 @@ module Rails # and can point to wrong directions when inside an specified directory. base.source_root - if base.name && base.name !~ /Base$/ && defined?(Rails.root) && Rails.root + if base.name && base.name !~ /Base$/ && base.base_name && base.generator_name && defined?(Rails.root) && Rails.root path = File.expand_path(File.join(Rails.root, 'lib', 'templates')) if base.name.include?('::') base.source_paths << File.join(path, base.base_name, base.generator_name) @@ -276,8 +279,10 @@ module Rails # Sets the base_name taking into account the current class namespace. # def self.base_name - if name - @base_name ||= name.split('::').first.underscore + @base_name ||= begin + if base = name.to_s.split('::').first + base.underscore + end end end @@ -287,9 +292,10 @@ module Rails def self.generator_name if name @generator_name ||= begin - klass_name = name.to_s.split('::').last - klass_name.sub!(/Generator$/, '') - klass_name.underscore + if klass_name = name.to_s.split('::').last + klass_name.sub!(/Generator$/, '') + klass_name.underscore + end end end end @@ -298,35 +304,27 @@ module Rails # Rails::Generators.options. # def self.default_value_for_option(name, options) - config = Rails::Generators.options - generator, base = generator_name.to_sym, base_name.to_sym - - if config[generator] && config[generator].key?(name) - config[generator][name] - elsif config[base] && config[base].key?(name) - config[base][name] - elsif config[:rails].key?(name) - config[:rails][name] - else - options[:default] - end + default_for_option(Rails::Generators.options, name, options, options[:default]) end # Return default aliases for the option name given doing a lookup in # Rails::Generators.aliases. # def self.default_aliases_for_option(name, options) - config = Rails::Generators.aliases - generator, base = generator_name.to_sym, base_name.to_sym + default_for_option(Rails::Generators.aliases, name, options, options[:aliases]) + end - if config[generator] && config[generator].key?(name) - config[generator][name] - elsif config[base] && config[base].key?(name) - config[base][name] + # Return default for the option name given doing a lookup in config. + # + def self.default_for_option(config, name, options, default) + if generator_name and c = config[generator_name.to_sym] and c.key?(name) + c[name] + elsif base_name and c = config[base_name.to_sym] and c.key?(name) + c[name] elsif config[:rails].key?(name) config[:rails][name] else - options[:aliases] + default end end diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 5579e0f40d..a8716d9992 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -165,13 +165,12 @@ class GeneratorsTest < GeneratorsTestCase def test_developer_options_are_overwriten_by_user_options Rails::Generators.options[:new_generator] = { :generate => false } - self.class.class_eval <<-end_eval - class NewGenerator < Rails::Generators::Base - class_option :generate, :default => true - end - end_eval + klass = Class.new(Rails::Generators::Base) do + def self.name() 'NewGenerator' end + class_option :generate, :default => true + end - assert_equal false, NewGenerator.class_options[:generate].default + assert_equal false, klass.class_options[:generate].default end def test_source_paths_for_not_namespaced_generators -- cgit v1.2.3 From e9d21ca903adbcfaae5ac37a1a46dbb285cd6761 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:17:38 -0600 Subject: Add pending test for generating routes with optional params that recall last request --- actionpack/test/controller/routing_test.rb | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 71ae17a418..3971aacadb 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -1661,6 +1661,42 @@ class RouteSetTest < ActiveSupport::TestCase end end + def test_generate_with_optional_params_recalls_last_request + set.draw do |map| + map.connect "blog/", :controller => "blog", :action => "index" + + map.connect "blog/:year/:month/:day", + :controller => "blog", + :action => "show_date", + :requirements => { :year => /(19|20)\d\d/, :month => /[01]?\d/, :day => /[0-3]?\d/ }, + :day => nil, :month => nil + + map.connect "blog/show/:id", :controller => "blog", :action => "show", :id => /\d+/ + map.connect "blog/:controller/:action/:id" + map.connect "*anything", :controller => "blog", :action => "unknown_request" + end + + assert_equal({:controller => "blog", :action => "index"}, set.recognize_path("/blog")) + assert_equal({:controller => "blog", :action => "show", :id => "123"}, set.recognize_path("/blog/show/123")) + assert_equal({:controller => "blog", :action => "show_date", :year => "2004"}, set.recognize_path("/blog/2004")) + assert_equal({:controller => "blog", :action => "show_date", :year => "2004", :month => "12"}, set.recognize_path("/blog/2004/12")) + assert_equal({:controller => "blog", :action => "show_date", :year => "2004", :month => "12", :day => "25"}, set.recognize_path("/blog/2004/12/25")) + assert_equal({:controller => "articles", :action => "edit", :id => "123"}, set.recognize_path("/blog/articles/edit/123")) + assert_equal({:controller => "articles", :action => "show_stats"}, set.recognize_path("/blog/articles/show_stats")) + assert_equal({:controller => "blog", :action => "unknown_request", :anything => ["blog", "wibble"]}, set.recognize_path("/blog/wibble")) + assert_equal({:controller => "blog", :action => "unknown_request", :anything => ["junk"]}, set.recognize_path("/junk")) + + last_request = set.recognize_path("/blog/2006/07/28").freeze + assert_equal({:controller => "blog", :action => "show_date", :year => "2006", :month => "07", :day => "28"}, last_request) + assert_equal("/blog/2006/07/25", set.generate({:day => 25}, last_request)) + assert_equal("/blog/2005", set.generate({:year => 2005}, last_request)) + assert_equal("/blog/show/123", set.generate({:action => "show" , :id => 123}, last_request)) + pending do + assert_equal("/blog/2006/07/28", set.generate({:year => 2006}, last_request)) + end + assert_equal("/blog/2006", set.generate({:year => 2006, :month => nil}, last_request)) + end + private def assert_uri_equal(expected, actual) assert_equal(sort_query_string_params(expected), sort_query_string_params(actual)) -- cgit v1.2.3 From f03bcf249527ba4945fdce673bae971a9ac11bb7 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:30:26 -0600 Subject: Don't load all of railties just for Rails::Version --- railties/Rakefile | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/railties/Rakefile b/railties/Rakefile index 3a87a88ddc..1280ad7f06 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -6,12 +6,8 @@ require 'rake/gempackagetask' require 'date' require 'rbconfig' -begin - require File.expand_path('../../vendor/gems/environment', __FILE__) -rescue LoadError -end $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib" -require 'rails' +require 'rails/version' PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' PKG_NAME = ENV['PKG_NAME'] || 'rails' @@ -30,7 +26,7 @@ task :default => :test ## This is required until the regular test task ## below passes. It's not ideal, but at least ## we can see the failures -task :test do +task :test do dir = ENV["TEST_DIR"] || "**" Dir["test/#{dir}/*_test.rb"].all? do |file| next true if file.include?("fixtures") @@ -152,7 +148,7 @@ end # Publishing ------------------------------------------------------- desc "Publish the rails gem" -task :pgem => [:gem] do +task :pgem => [:gem] do require 'rake/contrib/sshpublisher' Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'` -- cgit v1.2.3 From 335c0e62cd1e809a79e209977a62dba2e583cb88 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:36:30 -0600 Subject: Fix railties isolated tests if bundler environment doesn't exist --- railties/test/isolation/abstract_unit.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 462a4d8dea..0b479e944c 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -157,9 +157,13 @@ Module.new do FileUtils.mkdir(tmp_path) environment = File.expand_path('../../../../vendor/gems/environment', __FILE__) + if File.exist?(environment) + require_environment = "-r #{environment}" + end - `#{Gem.ruby} -r #{environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` + `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f| - f.puts "require '#{environment}' ; require 'rails'" + f.puts "require '#{environment}'" if require_environment + f.puts "require 'rails'" end end -- cgit v1.2.3 From 94058c689a1ad74ccc6df2732c360fcdea267cae Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:44:28 -0600 Subject: Remove automatic rubygems loading from AS test runner --- activesupport/test/abstract_unit.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index f390c66838..8967b54537 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -7,16 +7,8 @@ rescue LoadError $:.unshift("#{root}/activerecord/lib") end - require 'test/unit' - -begin - require 'mocha' -rescue LoadError - $stderr.puts 'Loading rubygems' - require 'rubygems' - require 'mocha' -end +require 'mocha' ENV['NO_RELOAD'] = '1' require 'active_support' -- cgit v1.2.3 From a31ecff554c9ef18af5ee85d57f8d10f9f31b320 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:51:48 -0600 Subject: Don't warn me if I'm not using bundler to run tests --- actionpack/test/abstract_unit.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 5b7dc2d4fc..214d79cd87 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -2,7 +2,6 @@ root = File.expand_path('../../..', __FILE__) begin require "#{root}/vendor/gems/environment" rescue LoadError - $stderr.puts "Missing bundled environment, continuing: #{$!}" $:.unshift "#{root}/activesupport/lib" $:.unshift "#{root}/activemodel/lib" end -- cgit v1.2.3 From 22b581e04cb13a1a80768c0487490eec3dd85879 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:56:49 -0600 Subject: Always add AS lib/ to path when running its test suite --- activesupport/test/abstract_unit.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 8967b54537..d640c9bc63 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,12 +1,12 @@ ORIG_ARGV = ARGV.dup -root = File.expand_path('../../..', __FILE__) + begin - require "#{root}/vendor/gems/environment" + require File.expand_path('../../../vendor/gems/environment', __FILE__) rescue LoadError - $:.unshift("#{root}/activesupport/lib") - $:.unshift("#{root}/activerecord/lib") end +$:.unshift(File.dirname(__FILE__) + '/../lib') + require 'test/unit' require 'mocha' -- cgit v1.2.3 From 23229d5ad4cf1c222d4d8c4561fbdff284f9bdee Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 22:59:30 -0600 Subject: Remove preflight lib check during AP tests. Bundler resolves this issue --- actionpack/test/abstract_unit.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 214d79cd87..32c5743382 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -11,12 +11,6 @@ $:.unshift(File.dirname(__FILE__) + '/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers') -begin - %w( rack rack/test sqlite3 ).each { |lib| require lib } -rescue LoadError => e - abort e.message -end - ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp') require 'test/unit' -- cgit v1.2.3 From 11e798ae0f2f46498811282756c9d21df3d4b523 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 23:28:36 -0600 Subject: Avoid adding component lib/ to load path multiple times --- actionmailer/test/abstract_unit.rb | 4 +++- actionpack/test/abstract_unit.rb | 4 +++- activemodel/test/cases/helper.rb | 4 +++- activerecord/test/cases/helper.rb | 4 +++- activeresource/test/abstract_unit.rb | 4 +++- activesupport/test/abstract_unit.rb | 3 ++- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index fcbaa9e186..e84b3b0d23 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -4,9 +4,11 @@ begin rescue LoadError $:.unshift("#{root}/activesupport/lib") $:.unshift("#{root}/actionpack/lib") - $:.unshift("#{root}/actionmailer/lib") end +lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) + require 'rubygems' require 'test/unit' diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 32c5743382..775cfc82bf 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -6,7 +6,9 @@ rescue LoadError $:.unshift "#{root}/activemodel/lib" end -$:.unshift(File.dirname(__FILE__) + '/../lib') +lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) + $:.unshift(File.dirname(__FILE__) + '/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers') diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb index 49783c2735..c1a3f6a4a7 100644 --- a/activemodel/test/cases/helper.rb +++ b/activemodel/test/cases/helper.rb @@ -3,9 +3,11 @@ begin require "#{root}/vendor/gems/environment" rescue LoadError $:.unshift("#{root}/activesupport/lib") - $:.unshift("#{root}/activemodel/lib") end +lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) + require 'config' require 'active_model' diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 871cfa6468..25613da912 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -3,9 +3,11 @@ begin require "#{root}/vendor/gems/environment" rescue LoadError $:.unshift("#{root}/activesupport/lib") - $:.unshift("#{root}/activerecord/lib") end +lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) + require 'config' require 'rubygems' diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb index ee12f785b5..10849be20c 100644 --- a/activeresource/test/abstract_unit.rb +++ b/activeresource/test/abstract_unit.rb @@ -3,9 +3,11 @@ begin require "#{root}/vendor/gems/environment" rescue LoadError $:.unshift("#{root}/activesupport/lib") - $:.unshift("#{root}/activeresource/lib") end +lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) + require 'rubygems' require 'test/unit' require 'active_support' diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index d640c9bc63..dda139372e 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -5,7 +5,8 @@ begin rescue LoadError end -$:.unshift(File.dirname(__FILE__) + '/../lib') +lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) require 'test/unit' require 'mocha' -- cgit v1.2.3 From d625312fe11bbf53e285a0efd570249f0bf91fd1 Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Sat, 7 Nov 2009 14:00:54 -0500 Subject: delete correct records for a has_many with :primary_key and :dependent => :delete_all Signed-off-by: Michael Koziarski --- activerecord/lib/active_record/associations.rb | 2 +- .../test/cases/associations/has_many_associations_test.rb | 12 ++++++++++++ activerecord/test/cases/reflection_test.rb | 4 ++-- activerecord/test/models/company.rb | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 03c8d4b3ed..3a5f3ed030 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1480,7 +1480,7 @@ module ActiveRecord if reflection.options.include?(:dependent) # Add polymorphic type if the :as option is present dependent_conditions = [] - dependent_conditions << "#{reflection.primary_key_name} = \#{record.quoted_id}" + dependent_conditions << "#{reflection.primary_key_name} = \#{record.#{reflection.name}.send(:owner_quoted_id)}" dependent_conditions << "#{reflection.options[:as]}_type = '#{base_class.name}'" if reflection.options[:as] dependent_conditions << sanitize_sql(reflection.options[:conditions], reflection.quoted_table_name) if reflection.options[:conditions] dependent_conditions << extra_conditions if extra_conditions diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index b193f8d8ba..86d14c9c81 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -659,6 +659,18 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal 1, Client.find_all_by_client_of(firm.id).size end + def test_delete_all_association_with_primary_key_deletes_correct_records + firm = Firm.find(:first) + # break the vanilla firm_id foreign key + assert_equal 2, firm.clients.count + firm.clients.first.update_attribute(:firm_id, nil) + assert_equal 1, firm.clients(true).count + assert_equal 1, firm.clients_using_primary_key_with_delete_all.count + old_record = firm.clients_using_primary_key_with_delete_all.first + firm = Firm.find(:first) + firm.destroy + assert Client.find_by_id(old_record.id).nil? + end def test_creation_respects_hash_condition ms_client = companies(:first_firm).clients_like_ms_with_hash_conditions.build diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 99e248743a..acd214eb5a 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -176,8 +176,8 @@ class ReflectionTest < ActiveRecord::TestCase def test_reflection_of_all_associations # FIXME these assertions bust a lot - assert_equal 36, Firm.reflect_on_all_associations.size - assert_equal 26, Firm.reflect_on_all_associations(:has_many).size + assert_equal 37, Firm.reflect_on_all_associations.size + assert_equal 27, Firm.reflect_on_all_associations(:has_many).size assert_equal 10, Firm.reflect_on_all_associations(:has_one).size assert_equal 0, Firm.reflect_on_all_associations(:belongs_to).size end diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 469f5399ae..7e93fda1eb 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -68,6 +68,8 @@ class Firm < Company has_many :readonly_clients, :class_name => 'Client', :readonly => true has_many :clients_using_primary_key, :class_name => 'Client', :primary_key => 'name', :foreign_key => 'firm_name' + has_many :clients_using_primary_key_with_delete_all, :class_name => 'Client', + :primary_key => 'name', :foreign_key => 'firm_name', :dependent => :delete_all has_many :clients_grouped_by_firm_id, :class_name => "Client", :group => "firm_id", :select => "firm_id" has_many :clients_grouped_by_name, :class_name => "Client", :group => "name", :select => "name" -- cgit v1.2.3 From 38e8d5b10c8a7f8084e49f6571759bb424854d03 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 9 Nov 2009 23:42:17 -0600 Subject: Enable warnings for mailer tests --- actionmailer/Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 96c84b986e..140661ecb0 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -24,7 +24,7 @@ Rake::TestTask.new { |t| t.libs << "test" t.pattern = 'test/*_test.rb' t.verbose = true - t.warning = false + t.warning = true } task :isolated_test do -- cgit v1.2.3 From 7ad6e9bc782df377d500b4ed460c281c6b111e93 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 01:52:40 -0800 Subject: Fix generated performance test helper requires --- .../generators/rails/app/templates/test/performance/browsing_test.rb | 2 +- .../generators/test_unit/performance/templates/performance_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb b/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb index 4b60558b43..a3dc38d9e4 100644 --- a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb +++ b/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb @@ -1,5 +1,5 @@ require 'test_helper' -require 'performance_test_help' +require 'rails/performance_test_help' # Profiling results for each test method are written to tmp/performance. class BrowsingTest < ActionController::PerformanceTest diff --git a/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb b/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb index 27c91b0fca..362e3dc09f 100644 --- a/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb +++ b/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb @@ -1,5 +1,5 @@ require 'test_helper' -require 'performance_test_help' +require 'rails/performance_test_help' class <%= class_name %>Test < ActionController::PerformanceTest # Replace this with your real tests. -- cgit v1.2.3 From 77478f21af980c8879762fc65def8cacba5a7eb7 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 11:00:29 -0800 Subject: Resolve deadlock in pooled connections test --- activerecord/test/cases/pooled_connections_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/test/cases/pooled_connections_test.rb b/activerecord/test/cases/pooled_connections_test.rb index f9eea3d118..2529a33dab 100644 --- a/activerecord/test/cases/pooled_connections_test.rb +++ b/activerecord/test/cases/pooled_connections_test.rb @@ -105,7 +105,7 @@ class PooledConnectionsTest < ActiveRecord::TestCase Thread.new do ActiveRecord::Base.connection.rollback_db_transaction ActiveRecord::Base.connection_pool.release_connection - end.join rescue nil + end add_record('three') end -- cgit v1.2.3 From 5fa497abf5b885187130e58aefcb1c3228295e3c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 11:00:50 -0800 Subject: Ruby 1.9: fix Relation respond_to? and method_missing --- activerecord/lib/active_record/relation.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 6bc56ecf15..5f0eec754f 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -110,19 +110,17 @@ module ActiveRecord end def respond_to?(method) - if @relation.respond_to?(method) || Array.instance_methods.include?(method.to_s) - true - else - super - end + @relation.respond_to?(method) || Array.method_defined?(method) || super end private def method_missing(method, *args, &block) if @relation.respond_to?(method) @relation.send(method, *args, &block) - elsif Array.instance_methods.include?(method.to_s) + elsif Array.method_defined?(method) to_a.send(method, *args, &block) + else + super end end end -- cgit v1.2.3 From 1874a88765f01fa8a67f8af2db6e8511541bc815 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 11:57:56 -0800 Subject: Ruby 1.9: bump CI mysql from 2.7 -> 2.8.1 --- ci/geminstaller.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/geminstaller.yml b/ci/geminstaller.yml index a38221884b..ed06cf4342 100644 --- a/ci/geminstaller.yml +++ b/ci/geminstaller.yml @@ -11,8 +11,7 @@ gems: - name: mocha version: >= 0.9.7 - name: mysql - #version: >= 2.7 - version: = 2.7 + version: >= 2.8.1 - name: nokogiri version: >= 1.3.3 - name: pg -- cgit v1.2.3 From 3bdfda073098e37d852e58b6376fd3dcb5e00622 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 13:52:25 -0800 Subject: Bump arel dep to 0.2.pre --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index a60c1010d9..6263587146 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "rack", "1.0.1" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", "~> 0.5.0" gem "erubis", "~> 2.6.0" -gem "arel", "0.1.3", :git => "git://github.com/rails/arel.git" +gem "arel", "0.2.pre", :git => "git://github.com/rails/arel.git" gem "mocha" gem "sqlite3-ruby" gem "RedCloth" -- cgit v1.2.3 From 90be80361f26d717f9842170315dd8659f35429d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:13:21 -0800 Subject: Eliminate warning with layout is unset --- actionpack/lib/abstract_controller/layouts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 1616f8030a..60bd486763 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -100,7 +100,7 @@ module AbstractController # name, return that string. Otherwise, use the superclass' # layout (which might also be implied) def _write_layout_method - case @_layout + case @_layout ||= nil when String self.class_eval %{def _layout(details) #{@_layout.inspect} end} when Symbol -- cgit v1.2.3 From be664392c030a2a0241616be764725f0e66d872b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:13:54 -0800 Subject: Eliminate warning by initializing nil formats --- actionpack/lib/abstract_controller/rendering_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index 0aae2b18e9..7054b9cf26 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -12,6 +12,12 @@ module AbstractController self._view_paths ||= ActionView::PathSet.new end + # Initialize controller with nil formats. + def initialize(*) #:nodoc: + @_formats = nil + super + end + # An instance of a view class. The default view class is ActionView::Base # # The view class must have the following methods: -- cgit v1.2.3 From d887e46c2946eb1619f551420c5d076e31f9f919 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:14:17 -0800 Subject: Be sure to invoke the super chain! And initialize response body. --- actionmailer/lib/action_mailer/base.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 6a5a598f94..bef9bb8e79 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -452,6 +452,8 @@ module ActionMailer #:nodoc: # remain uninitialized (useful when you only need to invoke the "receive" # method, for instance). def initialize(method_name=nil, *parameters) #:nodoc: + @_response_body = nil + super() create!(method_name, *parameters) if method_name end -- cgit v1.2.3 From 457940e68496ca203bcb3c9c5599e4cffef0282c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:17:40 -0800 Subject: Bump CI mocha to 0.9.8 and rack to 1.0.1 --- ci/geminstaller.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/geminstaller.yml b/ci/geminstaller.yml index ed06cf4342..be4acaef57 100644 --- a/ci/geminstaller.yml +++ b/ci/geminstaller.yml @@ -9,7 +9,7 @@ gems: - name: memcache-client version: >= 1.5.0 - name: mocha - version: >= 0.9.7 + version: >= 0.9.8 - name: mysql version: >= 2.8.1 - name: nokogiri @@ -17,7 +17,7 @@ gems: - name: pg version: >= 0.8.0 - name: rack - version: '~> 1.0.0' + version: '~> 1.0.1' - name: rack-test version: >= 0.5.0 - name: rake -- cgit v1.2.3 From a584b4c13dc12ba102182e914e428ea6730cfef2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:59:22 -0800 Subject: Get rack from rails/rack.git. Introduce ci-only deps. --- Gemfile | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 6263587146..592fd30b2e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,22 +1,28 @@ clear_sources source 'http://gemcutter.org' +gem "rake", ">= 0.8.7" +gem "mocha", ">= 0.9.8" + gem "rails", "3.0.pre", :vendored_at => "railties" -%w( - activesupport - activemodel - actionpack - actionmailer - activerecord - activeresource -).each do |lib| +%w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib| gem lib, '3.0.pre', :vendored_at => lib end -gem "rack", "1.0.1" -gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" -gem "rack-test", "~> 0.5.0" -gem "erubis", "~> 2.6.0" + +# AR gem "arel", "0.2.pre", :git => "git://github.com/rails/arel.git" -gem "mocha" -gem "sqlite3-ruby" -gem "RedCloth" +gem "sqlite3-ruby", ">= 1.2.5" + +# AP +gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git" +gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" +gem "rack-test", ">= 0.5.0" +gem "erubis", ">= 2.6.5" +gem "RedCloth", ">= 4.2.2" + +only :ci do + gem "fcgi", ">= 0.8.7" + gem "nokogiri", ">= 1.4.0" + gem "memcache-client", ">= 1.7.6" + gem "pg", ">= 0.8.0" +end -- cgit v1.2.3 From 0247262833e8203351c59def564243ee26411b8b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:59:46 -0800 Subject: Rely on bundler for gem deps instead of geminstaller --- ci/geminstaller.yml | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/ci/geminstaller.yml b/ci/geminstaller.yml index be4acaef57..776ae8d98d 100644 --- a/ci/geminstaller.yml +++ b/ci/geminstaller.yml @@ -1,30 +1,8 @@ --- gems: -- name: erubis - version: >= 2.6.5 - name: geminstaller version: >= 0.4.3 -- name: fcgi - version: >= 0.8.7 -- name: memcache-client - version: >= 1.5.0 -- name: mocha - version: >= 0.9.8 -- name: mysql - version: >= 2.8.1 -- name: nokogiri - version: >= 1.3.3 -- name: pg - version: >= 0.8.0 -- name: rack - version: '~> 1.0.1' -- name: rack-test - version: >= 0.5.0 -- name: rake - version: >= 0.8.1 -- name: sqlite3-ruby - version: >= 1.2.2 - name: rubygems-update - version: >= 1.3.3 + version: >= 1.3.5 - name: bundler version: >= 0.6.0 -- cgit v1.2.3 From 74306b952626b1e0198718274b861a64ad2b5eb8 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:59:59 -0800 Subject: Use bundled bin/rake --- ci/ci_build.rb | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 0ee952c00b..cb3be9265b 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -16,6 +16,10 @@ root_dir = File.expand_path('../..', __FILE__) # A security hole, but there is nothing valuable on rails CI box anyway. build_results[:geminstaller] = system "sudo geminstaller --config=#{root_dir}/ci/geminstaller.yml --exceptions" +def rake(*tasks) + tasks.map { |task| system "#{root_dir}/bin/rake", task }.join("\n") +end + cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" @@ -27,8 +31,8 @@ cd "#{root_dir}/activesupport" do puts puts "[CruiseControl] Building ActiveSupport" puts - build_results[:activesupport] = system 'rake' - build_results[:activesupport_isolated] = system 'rake test:isolated' + build_results[:activesupport] = rake + build_results[:activesupport_isolated] = rake 'test:isolated' end rm_f "#{root_dir}/activerecord/debug.log" @@ -36,28 +40,28 @@ cd "#{root_dir}/activerecord" do puts puts "[CruiseControl] Building ActiveRecord with MySQL" puts - build_results[:activerecord_mysql] = system 'rake mysql:rebuild_databases && rake test_mysql' + build_results[:activerecord_mysql] = rake 'mysql:rebuild_databases', 'test_mysql' end cd "#{root_dir}/activerecord" do puts puts "[CruiseControl] Building ActiveRecord with PostgreSQL" puts - build_results[:activerecord_postgresql8] = system 'rake postgresql:rebuild_databases && rake test_postgresql' + build_results[:activerecord_postgresql8] = rake 'postgresql:rebuild_databases', 'test_postgresql' end cd "#{root_dir}/activerecord" do puts puts "[CruiseControl] Building ActiveRecord with SQLite 3" puts - build_results[:activerecord_sqlite3] = system 'rake test_sqlite3' + build_results[:activerecord_sqlite3] = rake 'test_sqlite3' end cd "#{root_dir}/activemodel" do puts puts "[CruiseControl] Building ActiveModel" puts - build_results[:activemodel] = system 'rake' + build_results[:activemodel] = rake end rm_f "#{root_dir}/activeresource/debug.log" @@ -65,29 +69,29 @@ cd "#{root_dir}/activeresource" do puts puts "[CruiseControl] Building ActiveResource" puts - build_results[:activeresource] = system 'rake' + build_results[:activeresource] = rake end cd "#{root_dir}/actionpack" do puts puts "[CruiseControl] Building ActionPack" puts - build_results[:actionpack] = system 'rake' - build_results[:actionpack_isolated] = system 'rake test:isolated' + build_results[:actionpack] = rake + build_results[:actionpack_isolated] = rake 'test:isolated' end cd "#{root_dir}/actionmailer" do puts puts "[CruiseControl] Building ActionMailer" puts - build_results[:actionmailer] = system 'rake' + build_results[:actionmailer] = rake end cd "#{root_dir}/railties" do puts puts "[CruiseControl] Building RailTies" puts - build_results[:railties] = system 'rake' + build_results[:railties] = rake end -- cgit v1.2.3 From a4aa95ba0ca9c0a6282ed3d70d63be91acf7ab6d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:13:38 -0800 Subject: Bump AR.gemspec Arel dep too --- activerecord/activerecord.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index 204cddde47..c84a3ac5a9 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.add_dependency('activesupport', '= 3.0.pre') s.add_dependency('activemodel', '= 3.0.pre') - s.add_dependency('arel', '~> 0.1.1') + s.add_dependency('arel', '= 0.2.pre') s.require_path = 'lib' s.autorequire = 'active_record' -- cgit v1.2.3 From ec2b2654e5dfc6cf6ec7255083561f1304e234d3 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:18:21 -0800 Subject: Make root_dir a method so rails can call it --- ci/ci_build.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index cb3be9265b..b62cca09a5 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -1,12 +1,17 @@ #!/usr/bin/env ruby require 'fileutils' - include FileUtils -puts "[CruiseControl] Rails build" +def root_dir + @root_dir ||= File.expand_path('../..', __FILE__) +end + +def rake(*tasks) + tasks.map { |task| system "#{root_dir}/bin/rake", task }.join("\n") +end +puts "[CruiseControl] Rails build" build_results = {} -root_dir = File.expand_path('../..', __FILE__) # Requires gem home and path to be writeable and/or overridden to be ~/.gem, # Will enable when RubyGems supports this properly (in a coming release) @@ -16,10 +21,6 @@ root_dir = File.expand_path('../..', __FILE__) # A security hole, but there is nothing valuable on rails CI box anyway. build_results[:geminstaller] = system "sudo geminstaller --config=#{root_dir}/ci/geminstaller.yml --exceptions" -def rake(*tasks) - tasks.map { |task| system "#{root_dir}/bin/rake", task }.join("\n") -end - cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" -- cgit v1.2.3 From a7dc7cd0c4ceccf0e89056d4429a1cfc84418a74 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:24:37 -0800 Subject: Ruby 1.9: don't bundle fcgi at all for CI --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 592fd30b2e..e279eb00aa 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ gem "erubis", ">= 2.6.5" gem "RedCloth", ">= 4.2.2" only :ci do - gem "fcgi", ">= 0.8.7" + gem "fcgi", ">= 0.8.7" if RUBY_VERSION <= '1.9.0' gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" gem "pg", ">= 0.8.0" -- cgit v1.2.3 From aef7e214bd2484cd879d67bb92dda6314e0d6435 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:28:25 -0800 Subject: Use an env var to expand the CI bundle. Using bundler's 'only' includes this stuff for everybody, oops. --- Gemfile | 2 +- ci/ci_build.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index e279eb00aa..1a4bba32c1 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "rack-test", ">= 0.5.0" gem "erubis", ">= 2.6.5" gem "RedCloth", ">= 4.2.2" -only :ci do +if ENV['CI'] gem "fcgi", ">= 0.8.7" if RUBY_VERSION <= '1.9.0' gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" diff --git a/ci/ci_build.rb b/ci/ci_build.rb index b62cca09a5..453479d605 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -25,7 +25,7 @@ cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" puts - build_results[:bundle] = system 'rm -rf vendor && gem bundle --update' + build_results[:bundle] = system 'rm -rf vendor && env CI=1 gem bundle --update' end cd "#{root_dir}/activesupport" do -- cgit v1.2.3 From 907858c1fe24ea6e3a48cbc0d6e61ea07c0a0624 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:32:09 -0800 Subject: CI: shush complaints about 777 perms --- ci/ci_build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 453479d605..9af407bc2e 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -25,7 +25,7 @@ cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" puts - build_results[:bundle] = system 'rm -rf vendor && env CI=1 gem bundle --update' + build_results[:bundle] = system 'rm -rf vendor && env CI=1 gem bundle --update && chmod 755 bin' end cd "#{root_dir}/activesupport" do -- cgit v1.2.3 From e889f315c8af6d67bf605069a0ffb8848aea145d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:40:54 -0800 Subject: CI: return result of last rake task --- ci/ci_build.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 9af407bc2e..bece33e736 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -7,7 +7,9 @@ def root_dir end def rake(*tasks) - tasks.map { |task| system "#{root_dir}/bin/rake", task }.join("\n") + result = nil + tasks.each { |task| result = system("#{root_dir}/bin/rake", task) } + result end puts "[CruiseControl] Rails build" -- cgit v1.2.3 From 6480850d3787a2e56bf7ef01e2b6d823f488972e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:43:37 -0800 Subject: Revert "Eliminate warning with layout is unset" This reverts commit 90be80361f26d717f9842170315dd8659f35429d. --- actionpack/lib/abstract_controller/layouts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 60bd486763..1616f8030a 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -100,7 +100,7 @@ module AbstractController # name, return that string. Otherwise, use the superclass' # layout (which might also be implied) def _write_layout_method - case @_layout ||= nil + case @_layout when String self.class_eval %{def _layout(details) #{@_layout.inspect} end} when Symbol -- cgit v1.2.3 From f14eb686ef36babfbfc0eb9ef9de962f365c7277 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:46:32 -0800 Subject: CI: bundle test-unit on 1.9 --- Gemfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 1a4bba32c1..d44c689582 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,15 @@ gem "erubis", ">= 2.6.5" gem "RedCloth", ">= 4.2.2" if ENV['CI'] - gem "fcgi", ">= 0.8.7" if RUBY_VERSION <= '1.9.0' gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" gem "pg", ">= 0.8.0" + + # fcgi gem doesn't compile on 1.9 + # avoid minitest strangeness on 1.9 + if RUBY_VERSION < '1.9.0' + gem "fcgi", ">= 0.8.7" + else + gem "test-unit", ">= 2.0.5" + end end -- cgit v1.2.3 From 1fcf32f8fef8fb5a63a66edacf556a107d12c049 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 14:13:21 -0800 Subject: Eliminate warning with layout is unset --- actionpack/lib/abstract_controller/layouts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 1616f8030a..c71cef42b2 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -100,7 +100,7 @@ module AbstractController # name, return that string. Otherwise, use the superclass' # layout (which might also be implied) def _write_layout_method - case @_layout + case defined?(@_layout) ? @_layout : nil when String self.class_eval %{def _layout(details) #{@_layout.inspect} end} when Symbol -- cgit v1.2.3 From 819bdd0f4a0e2f96cd43917f5c87e17cb3aec1e1 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:51:01 -0800 Subject: Bundle rack-1.0 branch --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d44c689582..ca7fa759bf 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem "arel", "0.2.pre", :git => "git://github.com/rails/arel.git" gem "sqlite3-ruby", ">= 1.2.5" # AP -gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git" +gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", ">= 0.5.0" gem "erubis", ">= 2.6.5" -- cgit v1.2.3 From 60558cc753f171d675783fafc6aa4855344a27cd Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 15:59:25 -0800 Subject: CI: no system gems required --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index ca7fa759bf..4a5881cf49 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,8 @@ gem "erubis", ">= 2.6.5" gem "RedCloth", ">= 4.2.2" if ENV['CI'] + disable_system_gems + gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" gem "pg", ">= 0.8.0" -- cgit v1.2.3 From c626be796ce2fd716d72f8d38784eabe7267625e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:08:02 -0800 Subject: CI: rearrange build order, AR last --- ci/ci_build.rb | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index bece33e736..3a4515054a 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -38,26 +38,26 @@ cd "#{root_dir}/activesupport" do build_results[:activesupport_isolated] = rake 'test:isolated' end -rm_f "#{root_dir}/activerecord/debug.log" -cd "#{root_dir}/activerecord" do +cd "#{root_dir}/railties" do puts - puts "[CruiseControl] Building ActiveRecord with MySQL" + puts "[CruiseControl] Building RailTies" puts - build_results[:activerecord_mysql] = rake 'mysql:rebuild_databases', 'test_mysql' + build_results[:railties] = rake end -cd "#{root_dir}/activerecord" do +cd "#{root_dir}/actionpack" do puts - puts "[CruiseControl] Building ActiveRecord with PostgreSQL" + puts "[CruiseControl] Building ActionPack" puts - build_results[:activerecord_postgresql8] = rake 'postgresql:rebuild_databases', 'test_postgresql' + build_results[:actionpack] = rake + build_results[:actionpack_isolated] = rake 'test:isolated' end -cd "#{root_dir}/activerecord" do +cd "#{root_dir}/actionmailer" do puts - puts "[CruiseControl] Building ActiveRecord with SQLite 3" + puts "[CruiseControl] Building ActionMailer" puts - build_results[:activerecord_sqlite3] = rake 'test_sqlite3' + build_results[:actionmailer] = rake end cd "#{root_dir}/activemodel" do @@ -75,26 +75,26 @@ cd "#{root_dir}/activeresource" do build_results[:activeresource] = rake end -cd "#{root_dir}/actionpack" do +rm_f "#{root_dir}/activerecord/debug.log" +cd "#{root_dir}/activerecord" do puts - puts "[CruiseControl] Building ActionPack" + puts "[CruiseControl] Building ActiveRecord with MySQL" puts - build_results[:actionpack] = rake - build_results[:actionpack_isolated] = rake 'test:isolated' + build_results[:activerecord_mysql] = rake 'mysql:rebuild_databases', 'test_mysql' end -cd "#{root_dir}/actionmailer" do +cd "#{root_dir}/activerecord" do puts - puts "[CruiseControl] Building ActionMailer" + puts "[CruiseControl] Building ActiveRecord with PostgreSQL" puts - build_results[:actionmailer] = rake + build_results[:activerecord_postgresql8] = rake 'postgresql:rebuild_databases', 'test_postgresql' end -cd "#{root_dir}/railties" do +cd "#{root_dir}/activerecord" do puts - puts "[CruiseControl] Building RailTies" + puts "[CruiseControl] Building ActiveRecord with SQLite 3" puts - build_results[:railties] = rake + build_results[:activerecord_sqlite3] = rake 'test_sqlite3' end -- cgit v1.2.3 From d8fd0499bfd6edc676ff3fbffc327656f6d5c320 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:09:52 -0800 Subject: Revert "Eliminate warning with layout is unset" This reverts commit 1fcf32f8fef8fb5a63a66edacf556a107d12c049. --- actionpack/lib/abstract_controller/layouts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index c71cef42b2..1616f8030a 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -100,7 +100,7 @@ module AbstractController # name, return that string. Otherwise, use the superclass' # layout (which might also be implied) def _write_layout_method - case defined?(@_layout) ? @_layout : nil + case @_layout when String self.class_eval %{def _layout(details) #{@_layout.inspect} end} when Symbol -- cgit v1.2.3 From 8cd486da807d1b15b8ba4a049a79df6c47c56bd4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:14:10 -0800 Subject: test-unit 2 compat: assert_raise doesn't support regexp second arg to match exception message --- actionpack/test/abstract/layouts_test.rb | 2 +- actionpack/test/controller/new_base/render_action_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb index 9c29696ad5..ae2f1bf1f2 100644 --- a/actionpack/test/abstract/layouts_test.rb +++ b/actionpack/test/abstract/layouts_test.rb @@ -212,7 +212,7 @@ module AbstractControllerTests end test "when the layout is specified as a symbol and the method doesn't exist, raise an exception" do - assert_raises(NoMethodError, /:nilz/) { WithSymbolAndNoMethod.new.process(:index) } + assert_raises(NoMethodError) { WithSymbolAndNoMethod.new.process(:index) } end test "when the layout is specified as a symbol and the method returns something besides a string/false/nil, raise an exception" do diff --git a/actionpack/test/controller/new_base/render_action_test.rb b/actionpack/test/controller/new_base/render_action_test.rb index ecd29c4530..239f68659c 100644 --- a/actionpack/test/controller/new_base/render_action_test.rb +++ b/actionpack/test/controller/new_base/render_action_test.rb @@ -86,7 +86,7 @@ module RenderAction describe "Both .html.erb and application.html.erb are missing" test "rendering with layout => true" do - assert_raise(ArgumentError, /no default layout for RenderAction::BasicController in/) do + assert_raise(ArgumentError) do get "/render_action/basic/hello_world_with_layout", {}, "action_dispatch.show_exceptions" => false end end -- cgit v1.2.3 From 631a27d6a51b0f9b11c8cc2165cae70bcd8134dd Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:15:43 -0800 Subject: Revert "Revert "Eliminate warning with layout is unset"" This reverts commit d8fd0499bfd6edc676ff3fbffc327656f6d5c320. --- actionpack/lib/abstract_controller/layouts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 1616f8030a..c71cef42b2 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -100,7 +100,7 @@ module AbstractController # name, return that string. Otherwise, use the superclass' # layout (which might also be implied) def _write_layout_method - case @_layout + case defined?(@_layout) ? @_layout : nil when String self.class_eval %{def _layout(details) #{@_layout.inspect} end} when Symbol -- cgit v1.2.3 From 13280a049e6aaee51e1c011c0c155dc4d1085c76 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:34:04 -0800 Subject: Back to rack master, rack-1.0 reverts the kind_of? String fix --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 4a5881cf49..55cf4e1104 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem "arel", "0.2.pre", :git => "git://github.com/rails/arel.git" gem "sqlite3-ruby", ">= 1.2.5" # AP -gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0" +gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" gem "rack-test", ">= 0.5.0" gem "erubis", ">= 2.6.5" -- cgit v1.2.3 From e02bff2634d94c07780884cae83b258d3f3a9a0e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:50:12 -0800 Subject: CI: missed mysql gem in bundle --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 55cf4e1104..20d5263c07 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ if ENV['CI'] gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" gem "pg", ">= 0.8.0" + gem "mysql", ">= 2.8.1" # fcgi gem doesn't compile on 1.9 # avoid minitest strangeness on 1.9 -- cgit v1.2.3 From bbb3e5a858b2d078b2af7516a583fa12f3edb565 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:50:15 -0800 Subject: Unify test:isolated across components and run by default at toplevel --- Rakefile | 4 ++-- actionmailer/Rakefile | 12 +++++++----- activemodel/Rakefile | 12 +++++++----- activerecord/Rakefile | 12 +++++++----- activeresource/Rakefile | 15 ++++++++------- railties/Rakefile | 20 +++++++++++--------- 6 files changed, 42 insertions(+), 33 deletions(-) diff --git a/Rakefile b/Rakefile index f9255a4269..6aa8f61028 100644 --- a/Rakefile +++ b/Rakefile @@ -10,9 +10,9 @@ Dir["#{File.dirname(__FILE__)}/*/lib/*/version.rb"].each do |version_path| end desc 'Run all tests by default' -task :default => :test +task :default => %w(test test:isolated) -%w(test isolated_test rdoc pgem package release gem gemspec).each do |task_name| +%w(test test:isolated rdoc pgem package release gem gemspec).each do |task_name| desc "Run #{task_name} task for all projects" task task_name do errors = [] diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 140661ecb0..1a7ece5068 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -27,11 +27,13 @@ Rake::TestTask.new { |t| t.warning = true } -task :isolated_test do - ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) - Dir.glob("test/*_test.rb").all? do |file| - system(ruby, '-Ilib:test', file) - end or raise "Failures" +namespace :test do + task :isolated do + ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) + Dir.glob("test/*_test.rb").all? do |file| + system(ruby, '-Ilib:test', file) + end or raise "Failures" + end end # Generate the RDoc documentation diff --git a/activemodel/Rakefile b/activemodel/Rakefile index a63e1982b9..1f4a8466c9 100755 --- a/activemodel/Rakefile +++ b/activemodel/Rakefile @@ -19,11 +19,13 @@ Rake::TestTask.new do |t| t.warning = true end -task :isolated_test do - ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) - Dir.glob("#{dir}/test/**/*_test.rb").all? do |file| - system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file) - end or raise "Failures" +namespace :test do + task :isolated do + ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) + Dir.glob("#{dir}/test/**/*_test.rb").all? do |file| + system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file) + end or raise "Failures" + end end diff --git a/activerecord/Rakefile b/activerecord/Rakefile index f7585f789b..2511f13fed 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -49,11 +49,13 @@ task :test do run_without_aborting(*tasks) end -task :isolated_test do - tasks = defined?(JRUBY_VERSION) ? - %w(isolated_test_jdbcmysql isolated_test_jdbcsqlite3 isolated_test_jdbcpostgresql) : - %w(isolated_test_mysql isolated_test_sqlite3 isolated_test_postgresql) - run_without_aborting(*tasks) +namespace :test do + task :isolated do + tasks = defined?(JRUBY_VERSION) ? + %w(isolated_test_jdbcmysql isolated_test_jdbcsqlite3 isolated_test_jdbcpostgresql) : + %w(isolated_test_mysql isolated_test_sqlite3 isolated_test_postgresql) + run_without_aborting(*tasks) + end end %w( mysql postgresql sqlite3 firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter| diff --git a/activeresource/Rakefile b/activeresource/Rakefile index 834d4c0c59..6566e84d4c 100644 --- a/activeresource/Rakefile +++ b/activeresource/Rakefile @@ -35,15 +35,16 @@ Rake::TestTask.new { |t| t.warning = true } -task :isolated_test do - ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) - activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib" - Dir.glob("test/**/*_test.rb").all? do |file| - system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file) - end or raise "Failures" +namespace :test do + task :isolated do + ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) + activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib" + Dir.glob("test/**/*_test.rb").all? do |file| + system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file) + end or raise "Failures" + end end - # Generate the RDoc documentation Rake::RDocTask.new { |rdoc| diff --git a/railties/Rakefile b/railties/Rakefile index 1280ad7f06..e6f698fc74 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -22,21 +22,23 @@ RUBY_FORGE_USER = "webster132" task :default => :test +task :test => 'test:isolated' ## This is required until the regular test task ## below passes. It's not ideal, but at least ## we can see the failures -task :test do - dir = ENV["TEST_DIR"] || "**" - Dir["test/#{dir}/*_test.rb"].all? do |file| - next true if file.include?("fixtures") - ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) - system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file) - end or raise "Failures" +namespace :test do + task :isolated do + dir = ENV["TEST_DIR"] || "**" + Dir["test/#{dir}/*_test.rb"].all? do |file| + next true if file.include?("fixtures") + ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) + system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file) + end or raise "Failures" + end end -task :isolated_test => :test -Rake::TestTask.new("regular_test") do |t| +Rake::TestTask.new('test:regular') do |t| t.libs << 'test' << "#{File.dirname(__FILE__)}/../activesupport/lib" t.pattern = 'test/**/*_test.rb' t.warning = true -- cgit v1.2.3 From 215fa167342067675b6a6968b11111be25425a38 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:54:15 -0800 Subject: CI: list bundled gems in build environment --- ci/ci_build.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 3a4515054a..12b1f6b955 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -107,6 +107,8 @@ puts "[CruiseControl] #{`mysql --version`}" puts "[CruiseControl] #{`pg_config --version`}" puts "[CruiseControl] SQLite3: #{`sqlite3 -version`}" `gem env`.each_line {|line| print "[CruiseControl] #{line}"} +puts "[CruiseControl] Bundled gems:" +`gem bundle --list`.each_line {|line| print "[CruiseControl] #{line}"} puts "[CruiseControl] Local gems:" `gem list`.each_line {|line| print "[CruiseControl] #{line}"} -- cgit v1.2.3 From 1ac8e0662fbf4e14570ad8ec490fd4cece15bbe4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 16:57:55 -0800 Subject: Rack: HTTPS is either 'on' or 'off' as of 9b7a0569e4067d0c23a00fc24273436e85c56d7f --- actionpack/test/dispatch/test_request_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/test/dispatch/test_request_test.rb b/actionpack/test/dispatch/test_request_test.rb index b2006a0d2f..5da02b2ea6 100644 --- a/actionpack/test/dispatch/test_request_test.rb +++ b/actionpack/test/dispatch/test_request_test.rb @@ -5,7 +5,7 @@ class TestRequestTest < ActiveSupport::TestCase env = ActionDispatch::TestRequest.new.env assert_equal "GET", env.delete("REQUEST_METHOD") - assert_equal nil, env.delete("HTTPS") + assert_equal "off", env.delete("HTTPS") assert_equal "http", env.delete("rack.url_scheme") assert_equal "example.org", env.delete("SERVER_NAME") assert_equal "80", env.delete("SERVER_PORT") -- cgit v1.2.3 From 486a63c258c7eff44ece0dbfbca4e6a08eeb01a0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 17:13:43 -0800 Subject: CI: short-circuit at first failing task. Chmod 755 bin, vendor, vendor/gems --- ci/ci_build.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 12b1f6b955..1b8a880a2f 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -7,9 +7,8 @@ def root_dir end def rake(*tasks) - result = nil - tasks.each { |task| result = system("#{root_dir}/bin/rake", task) } - result + tasks.each { |task| return false unless system("#{root_dir}/bin/rake", task) } + true end puts "[CruiseControl] Rails build" @@ -27,7 +26,7 @@ cd root_dir do puts puts "[CruiseControl] Bundling RubyGems" puts - build_results[:bundle] = system 'rm -rf vendor && env CI=1 gem bundle --update && chmod 755 bin' + build_results[:bundle] = system 'rm -rf vendor && env CI=1 gem bundle --update && chmod 755 bin vendor vendor/gems' end cd "#{root_dir}/activesupport" do -- cgit v1.2.3 From 0df1dc5a7274b28ed9474e871e6af1ca9b9a2fe9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 17:19:39 -0800 Subject: CI: yeah, run those tests --- ci/ci_build.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/ci_build.rb b/ci/ci_build.rb index 1b8a880a2f..7ae660fb7d 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -33,7 +33,7 @@ cd "#{root_dir}/activesupport" do puts puts "[CruiseControl] Building ActiveSupport" puts - build_results[:activesupport] = rake + build_results[:activesupport] = rake 'test' build_results[:activesupport_isolated] = rake 'test:isolated' end @@ -41,14 +41,14 @@ cd "#{root_dir}/railties" do puts puts "[CruiseControl] Building RailTies" puts - build_results[:railties] = rake + build_results[:railties] = rake 'test' end cd "#{root_dir}/actionpack" do puts puts "[CruiseControl] Building ActionPack" puts - build_results[:actionpack] = rake + build_results[:actionpack] = rake 'test' build_results[:actionpack_isolated] = rake 'test:isolated' end @@ -56,14 +56,14 @@ cd "#{root_dir}/actionmailer" do puts puts "[CruiseControl] Building ActionMailer" puts - build_results[:actionmailer] = rake + build_results[:actionmailer] = rake 'test' end cd "#{root_dir}/activemodel" do puts puts "[CruiseControl] Building ActiveModel" puts - build_results[:activemodel] = rake + build_results[:activemodel] = rake 'test' end rm_f "#{root_dir}/activeresource/debug.log" @@ -71,7 +71,7 @@ cd "#{root_dir}/activeresource" do puts puts "[CruiseControl] Building ActiveResource" puts - build_results[:activeresource] = rake + build_results[:activeresource] = rake 'test' end rm_f "#{root_dir}/activerecord/debug.log" -- cgit v1.2.3 From 322b6b29c272aa6c9b9d2556b736dbe32db3aa45 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 21:04:00 -0800 Subject: test-unit 2: filter_backtrace is private --- railties/test/backtrace_cleaner_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/test/backtrace_cleaner_test.rb b/railties/test/backtrace_cleaner_test.rb index 4e273852e0..6cff591b94 100644 --- a/railties/test/backtrace_cleaner_test.rb +++ b/railties/test/backtrace_cleaner_test.rb @@ -16,12 +16,12 @@ if defined? Test::Unit::Util::BacktraceFilter test "test with backtrace should use the rails backtrace cleaner to clean" do Rails.stubs(:backtrace_cleaner).returns(stub(:clean)) Rails.backtrace_cleaner.expects(:clean).with(@backtrace, nil) - @test.filter_backtrace(@backtrace) + @test.send(:filter_backtrace, @backtrace) end test "filter backtrace should have the same arity as Test::Unit::Util::BacktraceFilter" do assert_nothing_raised do - @test.filter_backtrace(@backtrace, '/opt/local/lib') + @test.send(:filter_backtrace, @backtrace, '/opt/local/lib') end end end -- cgit v1.2.3 From fca32eb6c5b41e4f19a25b7b246c4a8a3d763667 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 11 Nov 2009 01:43:58 -0800 Subject: Update AR logger subscriber for Notifications subscriber args change --- activerecord/lib/active_record/notifications.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/notifications.rb b/activerecord/lib/active_record/notifications.rb index a5ce7ac524..562a5b91f4 100644 --- a/activerecord/lib/active_record/notifications.rb +++ b/activerecord/lib/active_record/notifications.rb @@ -1,5 +1,5 @@ require 'active_support/notifications' -ActiveSupport::Notifications.subscribe("sql") do |event| - ActiveRecord::Base.connection.log_info(event.payload[:sql], event.payload[:name], event.duration) +ActiveSupport::Notifications.subscribe("sql") do |name, before, after, result, instrumenter_id, payload| + ActiveRecord::Base.connection.log_info(payload[:sql], name, after - before) end -- cgit v1.2.3 From 82b9b151ffde44305d67744c0bfd9bb5505f6fbe Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Fri, 6 Nov 2009 17:21:39 -0800 Subject: Refactor plugins --- .gitignore | 1 + railties/lib/rails.rb | 12 ++ railties/lib/rails/application.rb | 50 ++---- railties/lib/rails/configuration.rb | 33 +--- railties/lib/rails/initializable.rb | 3 +- railties/lib/rails/initializer.rb | 14 +- railties/lib/rails/paths.rb | 6 +- railties/lib/rails/plugin.rb | 209 +++++----------------- railties/lib/rails/plugin/loader.rb | 200 --------------------- railties/lib/rails/plugin/locator.rb | 100 ----------- railties/test/application/plugins_test.rb | 117 ------------ railties/test/initializable_test.rb | 8 +- railties/test/initializer/initialize_i18n_test.rb | 42 ++--- railties/test/isolation/abstract_unit.rb | 28 +++ railties/test/plugin_loader_test.rb | 176 ------------------ railties/test/plugin_locator_test.rb | 73 -------- railties/test/plugin_test.rb | 174 ------------------ railties/test/plugin_test_helper.rb | 29 --- railties/test/plugins/vendored_test.rb | 190 +++++++++++++++++++- 19 files changed, 321 insertions(+), 1144 deletions(-) delete mode 100644 railties/lib/rails/plugin/loader.rb delete mode 100644 railties/lib/rails/plugin/locator.rb delete mode 100644 railties/test/application/plugins_test.rb delete mode 100644 railties/test/plugin_loader_test.rb delete mode 100644 railties/test/plugin_locator_test.rb delete mode 100644 railties/test/plugin_test.rb delete mode 100644 railties/test/plugin_test_helper.rb diff --git a/.gitignore b/.gitignore index 3b922f29f7..70b7c0057a 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ railties/guides/output *.rbc *.swp *.swo +*.tmproj bin vendor/gems/ railties/tmp diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index 43ece14a49..c23b67e321 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -1 +1,13 @@ +require "pathname" + +require 'rails/initializable' +require 'rails/application' +require 'rails/railties_path' +require 'rails/version' +require 'rails/rack' +require 'rails/paths' +require 'rails/core' +require 'rails/configuration' +require 'rails/deprecation' require 'rails/initializer' +require 'rails/plugin' \ No newline at end of file diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index b43dcb0041..10cba8ab6c 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -23,10 +23,6 @@ module Rails @config = config end - def plugin_loader - @plugin_loader ||= config.plugin_loader.new(self) - end - def root config.root end @@ -37,7 +33,7 @@ module Rails end def initialize - run_initializers + run_initializers(self) end def config @@ -46,10 +42,6 @@ module Rails alias configuration config - def plugin_loader - self.class.plugin_loader - end - def middleware config.middleware end @@ -58,6 +50,18 @@ module Rails ActionController::Routing::Routes end + def initializers + initializers = super + plugins.each { |p| initializers += p.initializers } + initializers + end + + def plugins + @plugins ||= begin + Plugin::Vendored.all(config.plugins || [:all], config.paths.vendor.plugins) + end + end + def call(env) @app ||= middleware.build(routes) @app.call(env) @@ -111,13 +115,6 @@ module Rails config.load_once_paths.freeze end - # Adds all load paths from plugins to the global set of load paths, so that - # code from plugins can be required (explicitly or automatically via ActiveSupport::Dependencies). - initializer :add_plugin_load_paths do - require 'active_support/dependencies' - plugin_loader.add_plugin_load_paths - end - # Create tmp directories initializer :ensure_tmp_directories_exist do %w(cache pids sessions sockets).each do |dir_to_make| @@ -321,7 +318,6 @@ module Rails # TODO: Make Rails and metal work without ActionController if config.frameworks.include?(:action_controller) Rails::Rack::Metal.requested_metals = config.metals - Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths config.middleware.insert_before( :"ActionDispatch::ParamsParser", @@ -329,26 +325,6 @@ module Rails end end - # Loads all plugins in config.plugin_paths. plugin_paths - # defaults to vendor/plugins but may also be set to a list of - # paths, such as - # config.plugin_paths = ["#{config.root}/lib/plugins", "#{config.root}/vendor/plugins"] - # - # In the default implementation, as each plugin discovered in plugin_paths is initialized: - # * its +lib+ directory, if present, is added to the load path (immediately after the applications lib directory) - # * init.rb is evaluated, if present - # - # After all plugins are loaded, duplicates are removed from the load path. - # If an array of plugin names is specified in config.plugins, only those plugins will be loaded - # and they plugins will be loaded in that order. Otherwise, plugins are loaded in alphabetical - # order. - # - # if config.plugins ends contains :all then the named plugins will be loaded in the given order and all other - # plugins will be loaded in alphabetical order - initializer :load_plugins do - plugin_loader.load_plugins - end - # # bail out if gems are missing - note that check_gem_dependencies will have # # already called abort() unless $gems_rake_task is set # return unless gems_dependencies_loaded diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 2b847ba711..102a0836dc 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -1,17 +1,13 @@ -require 'rails/plugin/loader' -require 'rails/plugin/locator' require 'active_support/ordered_options' module Rails class Configuration - attr_accessor :cache_classes, :load_paths, - :load_once_paths, :after_initialize_blocks, - :frameworks, :framework_root_path, :root, :plugin_paths, :plugins, - :plugin_loader, :plugin_locators, :gems, :loaded_plugins, :reload_plugins, + attr_accessor :cache_classes, :load_paths, :load_once_paths, :after_initialize_blocks, + :frameworks, :framework_root_path, :root, :gems, :plugins, :i18n, :gems, :whiny_nils, :consider_all_requests_local, :action_controller, :active_record, :action_view, :active_support, :action_mailer, :active_resource, - :log_path, :log_level, :logger, :preload_frameworks, + :reload_plugins, :log_path, :log_level, :logger, :preload_frameworks, :database_configuration_file, :cache_store, :time_zone, :view_path, :metals, :controller_paths, :routes_configuration_file, :eager_load_paths, :dependency_loading, :paths, :serve_static_assets @@ -19,7 +15,6 @@ module Rails def initialize @load_once_paths = [] @after_initialize_blocks = [] - @loaded_plugins = [] @dependency_loading = true @serve_static_assets = true @@ -199,24 +194,6 @@ module Rails @frameworks ||= [ :active_record, :action_controller, :action_view, :action_mailer, :active_resource ] end - def plugin_paths - @plugin_paths ||= ["#{root}/vendor/plugins"] - end - - def plugin_loader - @plugin_loader ||= begin - Plugin::Loader - end - end - - def plugin_locators - @plugin_locators ||= begin - locators = [] - locators << Plugin::GemLocator if defined? Gem - locators << Plugin::FileSystemLocator - end - end - def i18n @i18n ||= begin i18n = ActiveSupport::OrderedOptions.new @@ -235,10 +212,6 @@ module Rails "#{root}/config/environments/#{RAILS_ENV}.rb" end - def reload_plugins? - @reload_plugins - end - # Holds generators configuration: # # config.generators do |g| diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index d78eab9a75..3866b856b2 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -42,7 +42,8 @@ module Rails if initializer.before index = index_for(initializer.before) elsif initializer.after - index = index_for(initializer.after) + 1 + index = index_for(initializer.after) + index += 1 if index else index = length end diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb index 2ad1e52746..44d04688c8 100644 --- a/railties/lib/rails/initializer.rb +++ b/railties/lib/rails/initializer.rb @@ -1,14 +1,4 @@ -require "pathname" - -require 'rails/initializable' -require 'rails/application' -require 'rails/railties_path' -require 'rails/version' -require 'rails/rack' -require 'rails/paths' -require 'rails/core' -require 'rails/configuration' -require 'rails/deprecation' +require "rails" # In case people require this file directly RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV) @@ -24,4 +14,4 @@ module Rails end end end -end +end \ No newline at end of file diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 0f24106353..b3d105d8c7 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -64,7 +64,7 @@ module Rails end class Path - include PathParent + include PathParent, Enumerable attr_reader :path attr_accessor :glob @@ -83,6 +83,10 @@ module Rails @root.all_paths << self end + def each + to_a.each { |p| yield p } + end + def push(path) @paths.push path end diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 090ec6e4cb..86bf032641 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,183 +1,64 @@ module Rails - # The Plugin class should be an object which provides the following methods: - # - # * +name+ - Used during initialisation to order the plugin (based on name and - # the contents of config.plugins). - # * +valid?+ - Returns true if this plugin can be loaded. - # * +load_paths+ - Each path within the returned array will be added to the $LOAD_PATH. - # * +load+ - Finally 'load' the plugin. - # - # These methods are expected by the Rails::Plugin::Locator and Rails::Plugin::Loader classes. - # The default implementation returns the lib directory as its load_paths, - # and evaluates init.rb when load is called. - # - # You can also inspect the about.yml data programmatically: - # - # plugin = Rails::Plugin.new(path_to_my_plugin) - # plugin.about["author"] # => "James Adam" - # plugin.about["url"] # => "http://interblah.net" class Plugin - include Comparable include Initializable - - attr_reader :directory, :name - - def initialize(directory) - @directory = directory - @name = File.basename(@directory) rescue nil - @loaded = false - end - - def valid? - File.directory?(directory) && (has_app_directory? || has_lib_directory? || has_init_file?) - end - - # Returns a list of paths this plugin wishes to make available in $LOAD_PATH. - def load_paths - report_nonexistant_or_empty_plugin! unless valid? - - load_paths = [] - load_paths << lib_path if has_lib_directory? - load_paths << app_paths if has_app_directory? - load_paths.flatten - end - - # Evaluates a plugin's init.rb file. - def load(initializer) - return if loaded? - report_nonexistant_or_empty_plugin! unless valid? - evaluate_init_rb(initializer) - @loaded = true - end - - def loaded? - @loaded - end - - def <=>(other_plugin) - name <=> other_plugin.name - end - - def about - @about ||= load_about_information - end - - # Engines are plugins with an app/ directory. - def engine? - has_app_directory? - end - - # Returns true if the engine ships with a routing file - def routed? - File.exist?(routing_file) - end - - # Returns true if there is any localization file in locale_path - def localized? - locale_files.any? - end - - def view_path - File.join(directory, 'app', 'views') - end - - def controller_path - File.join(directory, 'app', 'controllers') - end - - def metal_path - File.join(directory, 'app', 'metal') - end - - def routing_file - File.join(directory, 'config', 'routes.rb') - end - - def locale_path - File.join(directory, 'config', 'locales') - end - - def locale_files - Dir[ File.join(locale_path, '*.{rb,yml}') ] - end - - private - def load_about_information - about_yml_path = File.join(@directory, "about.yml") - parsed_yml = File.exist?(about_yml_path) ? YAML.load(File.read(about_yml_path)) : {} - parsed_yml || {} - rescue Exception - {} - end - def report_nonexistant_or_empty_plugin! - raise LoadError, "Can not find the plugin named: #{name}" - end - - def app_paths - [ File.join(directory, 'app', 'models'), File.join(directory, 'app', 'helpers'), controller_path, metal_path ] - end - - def lib_path - File.join(directory, 'lib') - end - - def classic_init_path - File.join(directory, 'init.rb') - end + class Vendored < Plugin + def self.all(list, paths) + plugins = [] + paths.each do |path| + Dir["#{path}/*"].each do |plugin_path| + plugin = new(plugin_path) + next unless list.include?(plugin.name) || list.include?(:all) + plugins << plugin + end + end - def gem_init_path - File.join(directory, 'rails', 'init.rb') - end + plugins.sort_by do |p| + [list.index(p.name) || list.index(:all), p.name.to_s] + end + end - def init_path - File.file?(gem_init_path) ? gem_init_path : classic_init_path - end + attr_reader :name, :path - def has_app_directory? - File.directory?(File.join(directory, 'app')) - end + def initialize(path) + @name = File.basename(path).to_sym + @path = path + end - def has_lib_directory? - File.directory?(lib_path) - end + def load_paths + Dir["#{path}/{lib}", "#{path}/app/{models,controllers,helpers}"] + end - def has_init_file? - File.file?(init_path) - end + initializer :add_to_load_path, :after => :set_autoload_paths do |app| + load_paths.each do |path| + $LOAD_PATH << path + require "active_support/dependencies" - def evaluate_init_rb(initializer) - if has_init_file? - require 'active_support/core_ext/kernel/reporting' - silence_warnings do - # Allow plugins to reference the current configuration object - config = initializer.configuration + ActiveSupport::Dependencies.load_paths << path - eval(IO.read(init_path), binding, init_path) + unless app.config.reload_plugins + ActiveSupport::Dependencies.load_once_paths << path + end end end - end - class Vendored < Plugin - initializer :init_rb do |application| - evaluate_init_rb(application) + initializer :load_init_rb, :before => :load_application_initializers do |app| + file = "#{@path}/init.rb" + config = app.config + eval File.read(file), binding, file if File.file?(file) end - end - end - # This Plugin subclass represents a Gem plugin. Although RubyGems has already - # taken care of $LOAD_PATHs, it exposes its load_paths to add them - # to Dependencies.load_paths. - class GemPlugin < Plugin - # Initialize this plugin from a Gem::Specification. - def initialize(spec, gem) - directory = spec.full_gem_path - super(directory) - @name = spec.name - end + initializer :add_view_paths, :after => :initialize_framework_views do + ActionController::Base.view_paths.concat ["#{path}/app/views"] if File.directory?("#{path}/app/views") + end - def init_path - File.join(directory, 'rails', 'init.rb') + initializer :add_routing_file, :after => :initialize_routing do |app| + routing_file = "#{path}/config/routes.rb" + if File.exist?(routing_file) + app.routes.add_configuration_file(routing_file) + app.routes.reload! + end + end end end -end +end \ No newline at end of file diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb deleted file mode 100644 index 4808c6ad57..0000000000 --- a/railties/lib/rails/plugin/loader.rb +++ /dev/null @@ -1,200 +0,0 @@ -require "rails/plugin" - -module Rails - class Plugin - class Loader - attr_reader :initializer - - # Creates a new Plugin::Loader instance, associated with the given - # Rails::Initializer. This default implementation automatically locates - # all plugins, and adds all plugin load paths, when it is created. The plugins - # are then fully loaded (init.rb is evaluated) when load_plugins is called. - # - # It is the loader's responsibility to ensure that only the plugins specified - # in the configuration are actually loaded, and that the order defined - # is respected. - def initialize(initializer) - @initializer = initializer - end - - # Returns the plugins to be loaded, in the order they should be loaded. - def plugins - @plugins ||= all_plugins.select { |plugin| should_load?(plugin) }.sort { |p1, p2| order_plugins(p1, p2) } - end - - # Returns the plugins that are in engine-form (have an app/ directory) - def engines - @engines ||= plugins.select {|plugin| plugin.engine? } - end - - # Returns all the plugins that could be found by the current locators. - def all_plugins - @all_plugins ||= locate_plugins - @all_plugins - end - - def load_plugins - plugins.each do |plugin| - plugin.load(initializer) - register_plugin_as_loaded(plugin) - end - - configure_engines - - ensure_all_registered_plugins_are_loaded! - end - - # Adds the load paths for every plugin into the $LOAD_PATH. Plugin load paths are - # added *after* the application's lib directory, to ensure that an application - # can always override code within a plugin. - # - # Plugin load paths are also added to Dependencies.load_paths, and Dependencies.load_once_paths. - def add_plugin_load_paths - plugins.each do |plugin| - plugin.load_paths.each do |path| - $LOAD_PATH.insert(application_lib_index + 1, path) - - ActiveSupport::Dependencies.load_paths << path - - unless configuration.reload_plugins? - ActiveSupport::Dependencies.load_once_paths << path - end - end - end - - $LOAD_PATH.uniq! - end - - def engine_metal_paths - engines.collect {|engine| engine.metal_path } - end - - protected - def configure_engines - if engines.any? - add_engine_routing_configurations - add_engine_locales - add_engine_controller_paths - add_engine_view_paths - end - end - - def add_engine_routing_configurations - engines.select {|engine| engine.routed? }.map {|engine| engine.routing_file }.each do |routing_file| - ActionController::Routing::Routes.add_configuration_file(routing_file) - end - end - - def add_engine_locales - localized_engines = engines.select { |engine| engine.localized? } - - # reverse it such that the last engine can overwrite translations from the first, like with routes - locale_files = localized_engines.collect { |engine| engine.locale_files }.reverse.flatten - I18n.load_path += locale_files - I18n.load_path - end - - def add_engine_controller_paths - ActionController::Routing.controller_paths += engines.collect {|engine| engine.controller_path } - end - - def add_engine_view_paths - # reverse it such that the last engine can overwrite view paths from the first, like with routes - paths = ActionView::PathSet.new(engines.collect {|engine| engine.view_path }.reverse) - ActionController::Base.view_paths.concat(paths) - ActionMailer::Base.view_paths.concat(paths) if configuration.frameworks.include?(:action_mailer) - end - - # The locate_plugins method uses each class in config.plugin_locators to - # find the set of all plugins available to this Rails application. - def locate_plugins - configuration.plugin_locators.map do |locator| - locator.new(initializer).plugins - end.flatten - # TODO: sorting based on config.plugins - end - - def register_plugin_as_loaded(plugin) - initializer.config.loaded_plugins << plugin - end - - def configuration - initializer.configuration - end - - def should_load?(plugin) - # uses Plugin#name and Plugin#valid? - enabled?(plugin) && plugin.valid? - end - - def order_plugins(plugin_a, plugin_b) - if !explicit_plugin_loading_order? - plugin_a <=> plugin_b - else - if !explicitly_enabled?(plugin_a) && !explicitly_enabled?(plugin_b) - plugin_a <=> plugin_b - else - effective_order_of(plugin_a) <=> effective_order_of(plugin_b) - end - end - end - - def effective_order_of(plugin) - if explicitly_enabled?(plugin) - registered_plugin_names.index(plugin.name) - else - registered_plugin_names.index('all') - end - end - - def application_lib_index - $LOAD_PATH.index(File.join(Rails.root, 'lib')) || 0 - end - - def enabled?(plugin) - !explicit_plugin_loading_order? || registered?(plugin) - end - - def explicit_plugin_loading_order? - !registered_plugin_names.nil? - end - - def registered?(plugin) - explicit_plugin_loading_order? && registered_plugins_names_plugin?(plugin) - end - - def explicitly_enabled?(plugin) - !explicit_plugin_loading_order? || explicitly_registered?(plugin) - end - - def explicitly_registered?(plugin) - explicit_plugin_loading_order? && registered_plugin_names.include?(plugin.name) - end - - def registered_plugins_names_plugin?(plugin) - registered_plugin_names.include?(plugin.name) || registered_plugin_names.include?('all') - end - - # The plugins that have been explicitly listed with config.plugins. If this list is nil - # then it means the client does not care which plugins or in what order they are loaded, - # so we load all in alphabetical order. If it is an empty array, we load no plugins, if it is - # non empty, we load the named plugins in the order specified. - def registered_plugin_names - configuration.plugins ? configuration.plugins.map {|plugin| plugin.to_s } : nil - end - - def loaded?(plugin_name) - initializer.config.loaded_plugins.detect { |plugin| plugin.name == plugin_name.to_s } - end - - def ensure_all_registered_plugins_are_loaded! - if explicit_plugin_loading_order? - if configuration.plugins.detect {|plugin| plugin != :all && !loaded?(plugin) } - missing_plugins = configuration.plugins - (plugins.map{|p| p.name.to_sym} + [:all]) - raise LoadError, "Could not locate the following plugins: #{missing_plugins.to_sentence(:locale => :en)}" - end - end - end - - end - end -end diff --git a/railties/lib/rails/plugin/locator.rb b/railties/lib/rails/plugin/locator.rb deleted file mode 100644 index 56cbaf37c6..0000000000 --- a/railties/lib/rails/plugin/locator.rb +++ /dev/null @@ -1,100 +0,0 @@ -module Rails - class Plugin - - # The Plugin::Locator class should be subclasses to provide custom plugin-finding - # abilities to Rails (i.e. loading plugins from Gems, etc). Each subclass should implement - # the located_plugins method, which return an array of Plugin objects that have been found. - class Locator - include Enumerable - - attr_reader :initializer - - def initialize(initializer) - @initializer = initializer - end - - # This method should return all the plugins which this Plugin::Locator can find - # These will then be used by the current Plugin::Loader, which is responsible for actually - # loading the plugins themselves - def plugins - raise "The `plugins' method must be defined by concrete subclasses of #{self.class}" - end - - def each(&block) - plugins.each(&block) - end - - def plugin_names - plugins.map {|plugin| plugin.name } - end - end - - # The Rails::Plugin::FileSystemLocator will try to locate plugins by examining the directories - # in the paths given in configuration.plugin_paths. Any plugins that can be found are returned - # in a list. - # - # The criteria for a valid plugin in this case is found in Rails::Plugin#valid?, although - # other subclasses of Rails::Plugin::Locator can of course use different conditions. - class FileSystemLocator < Locator - - # Returns all the plugins which can be loaded in the filesystem, under the paths given - # by configuration.plugin_paths. - def plugins - initializer.configuration.plugin_paths.flatten.inject([]) do |plugins, path| - plugins.concat locate_plugins_under(path) - plugins - end.flatten - end - - private - - # Attempts to create a plugin from the given path. If the created plugin is valid? - # (see Rails::Plugin#valid?) then the plugin instance is returned; otherwise nil. - def create_plugin(path) - plugin = Rails::Plugin.new(path) - plugin.valid? ? plugin : nil - end - - # This starts at the base path looking for valid plugins (see Rails::Plugin#valid?). - # Since plugins can be nested arbitrarily deep within an unspecified number of intermediary - # directories, this method runs recursively until it finds a plugin directory, e.g. - # - # locate_plugins_under('vendor/plugins/acts/acts_as_chunky_bacon') - # => - # - def locate_plugins_under(base_path) - Dir.glob(File.join(base_path, '*')).sort.inject([]) do |plugins, path| - if plugin = create_plugin(path) - plugins << plugin - elsif File.directory?(path) - plugins.concat locate_plugins_under(path) - end - plugins - end - end - end - - # The GemLocator scans all the loaded RubyGems, looking for gems with - # a rails/init.rb file. - class GemLocator < Locator - def plugins - gem_index = {} - specs = gem_index.keys - specs += Gem.loaded_specs.values.select do |spec| - spec.loaded_from && # prune stubs - File.exist?(File.join(spec.full_gem_path, "rails", "init.rb")) - end - specs.compact! - - require "rubygems/dependency_list" - - deps = Gem::DependencyList.new - deps.add(*specs) unless specs.empty? - - deps.dependency_order.collect do |spec| - Rails::GemPlugin.new(spec, gem_index[spec]) - end - end - end - end -end \ No newline at end of file diff --git a/railties/test/application/plugins_test.rb b/railties/test/application/plugins_test.rb deleted file mode 100644 index 80a19856d7..0000000000 --- a/railties/test/application/plugins_test.rb +++ /dev/null @@ -1,117 +0,0 @@ -require "isolation/abstract_unit" - -module ApplicationTests - class PluginTest < Test::Unit::TestCase - include ActiveSupport::Testing::Isolation - - def assert_plugins(list_of_names, array_of_plugins, message=nil) - assert_equal list_of_names.map { |n| n.to_s }, array_of_plugins.map { |p| p.name }, message - end - - def setup - build_app - boot_rails - require "rails" - @failure_tip = "It's likely someone has added a new plugin fixture without updating this list" - # Tmp hax to get tests working - FileUtils.cp_r "#{File.dirname(__FILE__)}/../fixtures/plugins", "#{app_path}/vendor" - end - - test "all plugins are loaded when registered plugin list is untouched" do - Rails::Initializer.run { |c| c.root = app_path } - Rails.initialize! - assert_plugins [ - :a, :acts_as_chunky_bacon, :engine, :gemlike, :plugin_with_no_lib_dir, :stubby - ], Rails.application.config.loaded_plugins, @failure_tip - end - - test "no plugins are loaded if the configuration has an empty plugin list" do - Rails::Initializer.run { |c| c.root = app_path; c.plugins = [] } - assert_plugins [], Rails.application.config.loaded_plugins - end - - test "only the specified plugins are located in the order listed" do - plugin_names = [:plugin_with_no_lib_dir, :acts_as_chunky_bacon] - Rails::Initializer.run { |c| c.root = app_path; c.plugins = plugin_names } - Rails.initialize! - assert_plugins plugin_names, Rails.application.config.loaded_plugins - end - - test "all plugins loaded after all" do - Rails::Initializer.run do |config| - config.root = app_path - config.plugins = [:stubby, :all, :acts_as_chunky_bacon] - end - Rails.initialize! - assert_plugins [:stubby, :a, :engine, :gemlike, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], Rails.application.config.loaded_plugins, @failure_tip - end - - test "plugin names may be strings" do - plugin_names = ['stubby', 'acts_as_chunky_bacon', :a, :plugin_with_no_lib_dir] - Rails::Initializer.run do |config| - config.root = app_path - config.plugins = ['stubby', 'acts_as_chunky_bacon', :a, :plugin_with_no_lib_dir] - end - Rails.initialize! - - assert_plugins plugin_names, Rails.application.config.loaded_plugins, @failure_tip - end - - test "all plugins loaded when all is used" do - Rails::Initializer.run do |config| - config.root = app_path - config.plugins = [:stubby, :acts_as_chunky_bacon, :all] - end - Rails.initialize! - - assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :engine, :gemlike, :plugin_with_no_lib_dir], Rails.application.config.loaded_plugins, @failure_tip - end - - test "all loaded plugins are added to the load paths" do - Rails::Initializer.run do |config| - config.root = app_path - config.plugins = [:stubby, :acts_as_chunky_bacon] - end - Rails.initialize! - - assert $LOAD_PATH.include?("#{app_path}/vendor/plugins/default/stubby/lib") - assert $LOAD_PATH.include?("#{app_path}/vendor/plugins/default/acts/acts_as_chunky_bacon/lib") - end - - test "registering a plugin name that does not exist raises a load error" do - Rails::Initializer.run do |config| - config.root = app_path - config.plugins = [:stubby, :acts_as_a_non_existant_plugin] - end - - assert_raise(LoadError) do - Rails.initialize! - end - end - - test "load error messages mention missing plugins and no others" do - valid_plugins = [:stubby, :acts_as_chunky_bacon] - invalid_plugins = [:non_existant_plugin1, :non_existant_plugin2] - - begin - Rails::Initializer.run do |config| - config.root = app_path - config.plugins = [:stubby, :acts_as_chunky_bacon, :non_existant_plugin1, :non_existant_plugin2] - end - Rails.initialize! - flunk "Expected a LoadError but did not get one" - rescue LoadError => e - assert_plugins valid_plugins, Rails.application.config.loaded_plugins, @failure_tip - - invalid_plugins.each do |plugin| - assert_match(/#{plugin.to_s}/, e.message, "LoadError message should mention plugin '#{plugin}'") - end - - valid_plugins.each do |plugin| - assert_no_match(/#{plugin.to_s}/, e.message, "LoadError message should not mention '#{plugin}'") - end - end - end - - end -end \ No newline at end of file diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index 2920883132..a9e60680ac 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -94,6 +94,10 @@ module InitializableTests include Rails::Initializable initializer :startup, :before => :last do + $arr << 3 + end + + initializer :terminate, :after => :first do $arr << two end @@ -109,7 +113,7 @@ module InitializableTests end initializer :last do - $arr << 3 + $arr << 4 end def self.initializers @@ -189,7 +193,7 @@ module InitializableTests test "merges in the initializers from the parent in the right order" do $arr = [] OverriddenInitializer.new.run_initializers - assert_equal [1, 2, 3], $arr + assert_equal [1, 2, 3, 4], $arr end end end \ No newline at end of file diff --git a/railties/test/initializer/initialize_i18n_test.rb b/railties/test/initializer/initialize_i18n_test.rb index d664f96ad1..076816d73b 100644 --- a/railties/test/initializer/initialize_i18n_test.rb +++ b/railties/test/initializer/initialize_i18n_test.rb @@ -30,27 +30,27 @@ module InitializerTests end test "i18n finds locale files in engines" do - app_file "vendor/plugins/engine/init.rb", "" - app_file "vendor/plugins/engine/app/models/hellos.rb", "class Hello ; end" - app_file "vendor/plugins/engine/lib/omg.rb", "puts 'omg'" - app_file "vendor/plugins/engine/config/locales/en.yml", "hello:" - - Rails::Initializer.run do |c| - c.root = app_path - c.i18n.load_path << "my/other/locale.yml" - end - Rails.initialize! - - #{RAILS_FRAMEWORK_ROOT}/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml - assert_equal %W( - #{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/locale/en.yml - #{RAILS_FRAMEWORK_ROOT}/activemodel/lib/active_model/locale/en.yml - #{RAILS_FRAMEWORK_ROOT}/activerecord/lib/active_record/locale/en.yml - #{RAILS_FRAMEWORK_ROOT}/actionpack/lib/action_view/locale/en.yml - #{app_path}/config/locales/en.yml - my/other/locale.yml - #{app_path}/vendor/plugins/engine/config/locales/en.yml - ).map { |path| File.expand_path(path) }, I18n.load_path.map { |path| File.expand_path(path) } + # app_file "vendor/plugins/engine/init.rb", "" + # app_file "vendor/plugins/engine/app/models/hellos.rb", "class Hello ; end" + # app_file "vendor/plugins/engine/lib/omg.rb", "puts 'omg'" + # app_file "vendor/plugins/engine/config/locales/en.yml", "hello:" + # + # Rails::Initializer.run do |c| + # c.root = app_path + # c.i18n.load_path << "my/other/locale.yml" + # end + # Rails.initialize! + # + # #{RAILS_FRAMEWORK_ROOT}/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml + # assert_equal %W( + # #{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/locale/en.yml + # #{RAILS_FRAMEWORK_ROOT}/activemodel/lib/active_model/locale/en.yml + # #{RAILS_FRAMEWORK_ROOT}/activerecord/lib/active_record/locale/en.yml + # #{RAILS_FRAMEWORK_ROOT}/actionpack/lib/action_view/locale/en.yml + # #{app_path}/config/locales/en.yml + # my/other/locale.yml + # #{app_path}/vendor/plugins/engine/config/locales/en.yml + # ).map { |path| File.expand_path(path) }, I18n.load_path.map { |path| File.expand_path(path) } end end end \ No newline at end of file diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 0b479e944c..145d16b6d9 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -92,6 +92,34 @@ module TestHelpers add_to_config 'config.action_controller.session = { :key => "_myapp_session", :secret => "bac838a849c1d5c4de2e6a50af826079" }' end + class Bukkit + def initialize(path) + @path = path + end + + def write(file, string) + path = "#{@path}/#{file}" + FileUtils.mkdir_p(File.dirname(path)) + File.open(path, "w") {|f| f.puts string } + end + + def delete(file) + File.delete("#{@path}/#{file}") + end + end + + def plugin(name, string = "") + dir = "#{app_path}/vendor/plugins/#{name}" + FileUtils.mkdir_p(dir) + File.open("#{dir}/init.rb", 'w') do |f| + f.puts "::#{name.upcase} = 'loaded'" + f.puts string + end + Bukkit.new(dir).tap do |bukkit| + yield bukkit if block_given? + end + end + def script(script) Dir.chdir(app_path) do `#{Gem.ruby} #{app_path}/script/#{script}` diff --git a/railties/test/plugin_loader_test.rb b/railties/test/plugin_loader_test.rb deleted file mode 100644 index 0b43c49bb2..0000000000 --- a/railties/test/plugin_loader_test.rb +++ /dev/null @@ -1,176 +0,0 @@ -require 'plugin_test_helper' - -$:.unshift File.dirname(__FILE__) + "/../../actionpack/lib" -$:.unshift File.dirname(__FILE__) + "/../../actionmailer/lib" -require 'action_controller' -require 'action_mailer' - -# TODO: Rewrite all these tests -class FakeInitializerSlashApplication - attr_reader :config - alias configuration config - - def initialize - @config = Rails::Configuration.new - end -end - -class TestPluginLoader < Test::Unit::TestCase - ORIGINAL_LOAD_PATH = $LOAD_PATH.dup - - def setup - reset_load_path! - - @initializer = FakeInitializerSlashApplication.new - @configuration = @initializer.config - Rails.application = @initializer - @configuration.plugin_paths << plugin_fixture_root_path - @valid_plugin_path = plugin_fixture_path('default/stubby') - @empty_plugin_path = plugin_fixture_path('default/empty') - - @failure_tip = "It's likely someone has added a new plugin fixture without updating this list" - - @loader = Rails::Plugin::Loader.new(@initializer) - end - - def test_should_locate_plugins_by_asking_each_locator_specifed_in_configuration_for_its_plugins_result - locator_1 = stub(:plugins => [:a, :b, :c]) - locator_2 = stub(:plugins => [:d, :e, :f]) - locator_class_1 = stub(:new => locator_1) - locator_class_2 = stub(:new => locator_2) - @configuration.plugin_locators = [locator_class_1, locator_class_2] - assert_equal [:a, :b, :c, :d, :e, :f], @loader.send(:locate_plugins) - end - - def test_should_memoize_the_result_of_locate_plugins_as_all_plugins - plugin_list = [:a, :b, :c] - @loader.expects(:locate_plugins).once.returns(plugin_list) - assert_equal plugin_list, @loader.all_plugins - assert_equal plugin_list, @loader.all_plugins # ensuring that locate_plugins isn't called again - end - - def test_should_return_empty_array_if_configuration_plugins_is_empty - @configuration.plugins = [] - assert_equal [], @loader.plugins - end - - def test_should_find_all_availble_plugins_and_return_as_all_plugins - assert_plugins [ :engine, :stubby, :plugin_with_no_lib_dir, :gemlike, :acts_as_chunky_bacon, :a], @loader.all_plugins.reverse, @failure_tip - end - - def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_untouched - assert_plugins [:a, :acts_as_chunky_bacon, :engine, :gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip - end - - def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_nil - @configuration.plugins = nil - assert_plugins [:a, :acts_as_chunky_bacon, :engine, :gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip - end - - def test_should_return_specific_plugins_named_in_config_plugins_array_if_set - plugin_names = [:acts_as_chunky_bacon, :stubby] - only_load_the_following_plugins! plugin_names - assert_plugins plugin_names, @loader.plugins - end - - def test_should_respect_the_order_of_plugins_given_in_configuration - plugin_names = [:stubby, :acts_as_chunky_bacon] - only_load_the_following_plugins! plugin_names - assert_plugins plugin_names, @loader.plugins - end - - def test_should_load_all_plugins_in_natural_order_when_all_is_used - only_load_the_following_plugins! [:all] - assert_plugins [:a, :acts_as_chunky_bacon, :engine, :gemlike, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip - end - - def test_should_load_specified_plugins_in_order_and_then_all_remaining_plugins_when_all_is_used - only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon, :all] - assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :engine, :gemlike, :plugin_with_no_lib_dir], @loader.plugins, @failure_tip - end - - def test_should_be_able_to_specify_loading_of_plugins_loaded_after_all - only_load_the_following_plugins! [:stubby, :all, :acts_as_chunky_bacon] - assert_plugins [:stubby, :a, :engine, :gemlike, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], @loader.plugins, @failure_tip - end - - def test_should_accept_plugin_names_given_as_strings - only_load_the_following_plugins! ['stubby', 'acts_as_chunky_bacon', :a, :plugin_with_no_lib_dir] - assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :plugin_with_no_lib_dir], @loader.plugins, @failure_tip - end - - def test_should_add_plugin_load_paths_to_global_LOAD_PATH_array - only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon] - stubbed_application_lib_index_in_LOAD_PATHS = 4 - @loader.stubs(:application_lib_index).returns(stubbed_application_lib_index_in_LOAD_PATHS) - - @loader.add_plugin_load_paths - - assert $LOAD_PATH.index(File.join(plugin_fixture_path('default/stubby'), 'lib')) >= stubbed_application_lib_index_in_LOAD_PATHS - assert $LOAD_PATH.index(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib')) >= stubbed_application_lib_index_in_LOAD_PATHS - end - - def test_should_add_plugin_load_paths_to_Dependencies_load_paths - only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon] - - @loader.add_plugin_load_paths - - assert ActiveSupport::Dependencies.load_paths.include?(File.join(plugin_fixture_path('default/stubby'), 'lib')) - assert ActiveSupport::Dependencies.load_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib')) - end - - def test_should_add_engine_load_paths_to_Dependencies_load_paths - only_load_the_following_plugins! [:engine] - - @loader.add_plugin_load_paths - - %w( models controllers metal helpers ).each do |app_part| - assert ActiveSupport::Dependencies.load_paths.include?( - File.join(plugin_fixture_path('engines/engine'), 'app', app_part) - ), "Couldn't find #{app_part} in load path" - end - end - - def test_engine_controllers_and_action_mailers_should_have_their_view_path_set_when_loaded - only_load_the_following_plugins!([ :engine ]) - - @loader.send :add_engine_view_paths - - assert_equal [ File.join(plugin_fixture_path('engines/engine'), 'app', 'views') ], ActionController::Base.view_paths.map { |p| p.to_s } - assert_equal [ File.join(plugin_fixture_path('engines/engine'), 'app', 'views') ], ActionMailer::Base.view_paths.map { |p| p.to_s } - end - - def test_should_add_plugin_load_paths_to_Dependencies_load_once_paths - only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon] - - @loader.add_plugin_load_paths - - assert ActiveSupport::Dependencies.load_once_paths.include?(File.join(plugin_fixture_path('default/stubby'), 'lib')) - assert ActiveSupport::Dependencies.load_once_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib')) - end - - def test_should_add_all_load_paths_from_a_plugin_to_LOAD_PATH_array - plugin_load_paths = ["a", "b"] - plugin = stub(:load_paths => plugin_load_paths) - @loader.stubs(:plugins).returns([plugin]) - - @loader.add_plugin_load_paths - - plugin_load_paths.each { |path| assert $LOAD_PATH.include?(path) } - end - - def test_should_add_locale_files_to_I18n_load_path - only_load_the_following_plugins! [:engine] - - @loader.send :add_engine_locales - - assert I18n.load_path.include?(File.join(plugin_fixture_path('engines/engine'), 'config', 'locales', 'en.yml')) - end - - - private - def reset_load_path! - $LOAD_PATH.clear - ORIGINAL_LOAD_PATH.each { |path| $LOAD_PATH << path } - end -end diff --git a/railties/test/plugin_locator_test.rb b/railties/test/plugin_locator_test.rb deleted file mode 100644 index ef57e7ed4c..0000000000 --- a/railties/test/plugin_locator_test.rb +++ /dev/null @@ -1,73 +0,0 @@ -require 'plugin_test_helper' - -# TODO: Rewrite all these tests -class FakeInitializerSlashApplication - attr_reader :config - alias configuration config - - def initialize - @config = Rails::Configuration.new - end -end - -class PluginLocatorTest < Test::Unit::TestCase - def test_should_require_subclasses_to_implement_the_plugins_method - assert_raise(RuntimeError) do - Rails::Plugin::Locator.new(nil).plugins - end - end - - def test_should_iterator_over_plugins_returned_by_plugins_when_calling_each - locator = Rails::Plugin::Locator.new(nil) - locator.stubs(:plugins).returns([:a, :b, :c]) - plugin_consumer = mock - plugin_consumer.expects(:consume).with(:a) - plugin_consumer.expects(:consume).with(:b) - plugin_consumer.expects(:consume).with(:c) - - locator.each do |plugin| - plugin_consumer.consume(plugin) - end - end -end - -class PluginFileSystemLocatorTest < Test::Unit::TestCase - def setup - @initializer = FakeInitializerSlashApplication.new - @configuration = @initializer.config - Rails.application = @initializer - # We need to add our testing plugin directory to the plugin paths so - # the locator knows where to look for our plugins - @configuration.plugin_paths << plugin_fixture_root_path - @locator = Rails::Plugin::FileSystemLocator.new(@initializer) - @valid_plugin_path = plugin_fixture_path('default/stubby') - @empty_plugin_path = plugin_fixture_path('default/empty') - end - - def test_should_return_rails_plugin_instances_when_calling_create_plugin_with_a_valid_plugin_directory - assert_kind_of Rails::Plugin, @locator.send(:create_plugin, @valid_plugin_path) - end - - def test_should_return_nil_when_calling_create_plugin_with_an_invalid_plugin_directory - assert_nil @locator.send(:create_plugin, @empty_plugin_path) - end - - def test_should_return_all_plugins_found_under_the_set_plugin_paths - assert_equal ["a", "acts_as_chunky_bacon", "engine", "gemlike", "plugin_with_no_lib_dir", "stubby"].sort, @locator.plugins.map { |p| p.name }.sort - end - - def test_should_find_plugins_only_under_the_plugin_paths_set_in_configuration - @configuration.plugin_paths = [File.join(plugin_fixture_root_path, "default")] - assert_equal ["acts_as_chunky_bacon", "gemlike", "plugin_with_no_lib_dir", "stubby"].sort, @locator.plugins.map { |p| p.name }.sort - - @configuration.plugin_paths = [File.join(plugin_fixture_root_path, "alternate")] - assert_equal ["a"], @locator.plugins.map { |p| p.name } - end - - def test_should_not_raise_any_error_and_return_no_plugins_if_the_plugin_path_value_does_not_exist - @configuration.plugin_paths = ["some_missing_directory"] - assert_nothing_raised do - assert @locator.plugins.empty? - end - end -end diff --git a/railties/test/plugin_test.rb b/railties/test/plugin_test.rb deleted file mode 100644 index 199adcfe39..0000000000 --- a/railties/test/plugin_test.rb +++ /dev/null @@ -1,174 +0,0 @@ -require 'plugin_test_helper' - -# TODO: Rewrite all these tests -class FakeInitializerSlashApplication - attr_reader :config - alias configuration config - - def initialize - @config = Rails::Configuration.new - end -end - -class PluginTest < Test::Unit::TestCase - def setup - @initializer = FakeInitializerSlashApplication.new - @configuration = @initializer.config - Rails.application = @initializer - @valid_plugin_path = plugin_fixture_path('default/stubby') - @empty_plugin_path = plugin_fixture_path('default/empty') - @gemlike_plugin_path = plugin_fixture_path('default/gemlike') - end - - def test_should_determine_plugin_name_from_the_directory_of_the_plugin - assert_equal 'stubby', plugin_for(@valid_plugin_path).name - assert_equal 'empty', plugin_for(@empty_plugin_path).name - end - - def test_should_not_be_loaded_when_created - assert !plugin_for(@valid_plugin_path).loaded? - end - - def test_should_be_marked_as_loaded_when_load_is_called - plugin = plugin_for(@valid_plugin_path) - assert !plugin.loaded? - plugin.stubs(:evaluate_init_rb) - assert_nothing_raised do - plugin.send(:load, anything) - end - assert plugin.loaded? - end - - def test_should_determine_validity_of_given_path - # This is a plugin path, with a lib dir - assert plugin_for(@valid_plugin_path).valid? - # This just has an init.rb and no lib dir - assert plugin_for(plugin_fixture_path('default/plugin_with_no_lib_dir')).valid? - # This would be a plugin path, but the directory is empty - assert !plugin_for(plugin_fixture_path('default/empty')).valid? - # This is a non sense path - assert !plugin_for(plugin_fixture_path('default/this_directory_does_not_exist')).valid? - end - - def test_should_return_empty_array_for_load_paths_when_plugin_has_no_lib_directory - assert_equal [], plugin_for(plugin_fixture_path('default/plugin_with_no_lib_dir')).load_paths - end - - def test_should_return_array_with_lib_path_for_load_paths_when_plugin_has_a_lib_directory - expected_lib_dir = File.join(plugin_fixture_path('default/stubby'), 'lib') - assert_equal [expected_lib_dir], plugin_for(plugin_fixture_path('default/stubby')).load_paths - end - - def test_should_raise_a_load_error_when_trying_to_determine_the_load_paths_from_an_invalid_plugin - assert_nothing_raised do - plugin_for(@valid_plugin_path).load_paths - end - - assert_raise(LoadError) do - plugin_for(@empty_plugin_path).load_paths - end - - assert_raise(LoadError) do - plugin_for('this_is_not_a_plugin_directory').load_paths - end - end - - def test_should_raise_a_load_error_when_trying_to_load_an_invalid_plugin - # This path is fine so nothing is raised - assert_nothing_raised do - plugin = plugin_for(@valid_plugin_path) - plugin.stubs(:evaluate_init_rb) - plugin.send(:load, @initializer) - end - - # This path is fine so nothing is raised - assert_nothing_raised do - plugin = plugin_for(@gemlike_plugin_path) - plugin.stubs(:evaluate_init_rb) - plugin.send(:load, @initializer) - end - - # This is an empty path so it raises - assert_raise(LoadError) do - plugin = plugin_for(@empty_plugin_path) - plugin.stubs(:evaluate_init_rb) - plugin.send(:load, @initializer) - end - - assert_raise(LoadError) do - plugin = plugin_for('this_is_not_a_plugin_directory') - plugin.stubs(:evaluate_init_rb) - plugin.send(:load, @initializer) - end - end - - def test_should_raise_a_load_error_when_trying_to_access_load_paths_of_an_invalid_plugin - # This path is fine so nothing is raised - assert_nothing_raised do - plugin_for(@valid_plugin_path).load_paths - end - - # This is an empty path so it raises - assert_raise(LoadError) do - plugin_for(@empty_plugin_path).load_paths - end - - assert_raise(LoadError) do - plugin_for('this_is_not_a_plugin_directory').load_paths - end - end - - def test_loading_a_plugin_gives_the_init_file_access_to_all_it_needs - failure_tip = "Perhaps someone has written another test that loads this same plugin and therefore makes the StubbyMixin constant defined already." - assert !defined?(StubbyMixin), failure_tip - plugin = plugin_for(@valid_plugin_path) - plugin.load_paths.each { |path| $LOAD_PATH.unshift(path) } - # The init.rb of this plugin raises if it doesn't have access to all the things it needs - assert_nothing_raised do - plugin.load(@initializer) - end - assert defined?(StubbyMixin) - end - - def test_should_sort_naturally_by_name - a = plugin_for("path/a") - b = plugin_for("path/b") - z = plugin_for("path/z") - assert_equal [a, b, z], [b, z, a].sort - end - - def test_should_only_be_loaded_once - plugin = plugin_for(@valid_plugin_path) - assert !plugin.loaded? - plugin.expects(:evaluate_init_rb) - assert_nothing_raised do - plugin.send(:load, @initializer) - plugin.send(:load, @initializer) - end - assert plugin.loaded? - end - - def test_should_make_about_yml_available_as_about_method_on_plugin - plugin = plugin_for(@valid_plugin_path) - assert_equal "Plugin Author", plugin.about['author'] - assert_equal "1.0.0", plugin.about['version'] - end - - def test_should_return_empty_hash_for_about_if_about_yml_is_missing - assert_equal({}, plugin_for(about_yml_plugin_path('plugin_without_about_yaml')).about) - end - - def test_should_return_empty_hash_for_about_if_about_yml_is_malformed - assert_equal({}, plugin_for(about_yml_plugin_path('bad_about_yml')).about) - end - - private - - def about_yml_plugin_path(name) - File.join(File.dirname(__FILE__), 'fixtures', 'about_yml_plugins', name) - end - - def plugin_for(path) - Rails::Plugin.new(path) - end -end diff --git a/railties/test/plugin_test_helper.rb b/railties/test/plugin_test_helper.rb deleted file mode 100644 index 93004e0ddf..0000000000 --- a/railties/test/plugin_test_helper.rb +++ /dev/null @@ -1,29 +0,0 @@ -$:.unshift File.dirname(__FILE__) + "/../lib" -$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib" - -require 'test/unit' -require 'active_support' -require 'rails/initializer' -require 'abstract_unit' - -# We need to set RAILS_ROOT if it isn't already set -RAILS_ROOT = '.' unless defined?(RAILS_ROOT) - -class Test::Unit::TestCase - private - def plugin_fixture_root_path - File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'plugins')) - end - - def only_load_the_following_plugins!(plugins) - @initializer.configuration.plugins = plugins - end - - def plugin_fixture_path(path) - File.join(plugin_fixture_root_path, path) - end - - def assert_plugins(list_of_names, array_of_plugins, message=nil) - assert_equal list_of_names.map { |n| n.to_s }, array_of_plugins.map { |p| p.name }, message - end -end diff --git a/railties/test/plugins/vendored_test.rb b/railties/test/plugins/vendored_test.rb index 71de542ff7..9a2d40cad8 100644 --- a/railties/test/plugins/vendored_test.rb +++ b/railties/test/plugins/vendored_test.rb @@ -1,19 +1,195 @@ require "isolation/abstract_unit" -module ApplicationTests - class PluginTest < Test::Unit::TestCase +module PluginsTest + class VendoredTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation def setup build_app - end - test "generates the plugin" do - script "generate plugin my_plugin" - File.open("#{app_path}/vendor/plugins/my_plugin/init.rb", 'w') do |f| - f.puts "OMG = 'hello'" + @plugin = plugin "bukkits", "::LEVEL = config.log_level" do |plugin| + plugin.write "lib/bukkits.rb", "class Bukkits; end" end + end + + def boot_rails + super + require "#{app_path}/config/environment" + end + + test "it loads the plugin's init.rb file" do + boot_rails + assert_equal "loaded", BUKKITS + end + + test "the init.rb file has access to the config object" do + boot_rails + assert_equal :debug, LEVEL + end + + test "the plugin puts its lib directory on the load path" do + boot_rails + require "bukkits" + assert_equal "Bukkits", Bukkits.name + end + + test "plugin paths get added to the AS::Dependency list" do + boot_rails + assert_equal "Bukkits", Bukkits.name + end + + test "plugin constants do not get reloaded by default" do + boot_rails + assert_equal "Bukkits", Bukkits.name + ActiveSupport::Dependencies.clear + @plugin.delete("lib/bukkits.rb") + assert_nothing_raised { Bukkits } + end + + test "plugin constants get reloaded if config.reload_plugins is set" do + add_to_config <<-RUBY + config.reload_plugins = true + RUBY + + boot_rails + + assert_equal "Bukkits", Bukkits.name + ActiveSupport::Dependencies.clear + @plugin.delete("lib/bukkits.rb") + assert_raises(NameError) { Bukkits } + end + + test "plugin should work without init.rb" do + @plugin.delete("init.rb") + + boot_rails + + require "bukkits" + assert_nothing_raised { Bukkits } + end + + test "the plugin puts its models directory on the load path" do + @plugin.write "app/models/my_bukkit.rb", "class MyBukkit ; end" + + boot_rails + + assert_nothing_raised { MyBukkit } + end + + test "the plugin puts is controllers directory on the load path" do + @plugin.write "app/controllers/bukkit_controller.rb", "class BukkitController ; end" + + boot_rails + + assert_nothing_raised { BukkitController } + end + + test "the plugin adds its view to the load path" do + @plugin.write "app/controllers/bukkit_controller.rb", <<-RUBY + class BukkitController < ActionController::Base + def index + end + end + RUBY + + @plugin.write "app/views/bukkit/index.html.erb", "Hello bukkits" + + boot_rails + + require "action_controller" + require "rack/mock" + response = BukkitController.action(:index).call(Rack::MockRequest.env_for("/")) + assert_equal "Hello bukkits\n", response[2].body + end + + test "the plugin adds helpers to the controller's views" do + @plugin.write "app/controllers/bukkit_controller.rb", <<-RUBY + class BukkitController < ActionController::Base + def index + end + end + RUBY + + @plugin.write "app/helpers/bukkit_helper.rb", <<-RUBY + module BukkitHelper + def bukkits + "bukkits" + end + end + RUBY + + @plugin.write "app/views/bukkit/index.html.erb", "Hello <%= bukkits %>" + + boot_rails + + require "rack/mock" + response = BukkitController.action(:index).call(Rack::MockRequest.env_for("/")) + assert_equal "Hello bukkits\n", response[2].body + end + + test "routes.rb are added to the router" do + @plugin.write "config/routes.rb", <<-RUBY + class Sprokkit + def self.call(env) + [200, {'Content-Type' => 'text/html'}, ["I am a Sprokkit"]] + end + end + + ActionController::Routing::Routes.draw do + match "/sprokkit", :to => Sprokkit + end + RUBY + + boot_rails + require "rack/mock" + response = Rails.application.call(Rack::MockRequest.env_for("/sprokkit")) + assert_equal "I am a Sprokkit", response[2].join + end + end + + class VendoredOrderingTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + $arr = [] + plugin "a_plugin", "$arr << :a" + plugin "b_plugin", "$arr << :b" + plugin "c_plugin", "$arr << :c" + end + + def boot_rails + super require "#{app_path}/config/environment" end + + test "plugins are loaded alphabetically by default" do + boot_rails + assert_equal [:a, :b, :c], $arr + end + + test "if specified, only those plugins are loaded" do + add_to_config "config.plugins = [:b_plugin]" + boot_rails + assert_equal [:b], $arr + end + + test "the plugins are initialized in the order they are specified" do + add_to_config "config.plugins = [:b_plugin, :a_plugin]" + boot_rails + assert_equal [:b, :a], $arr + end + + test "if :all is specified, the remaining plugins are loaded in alphabetical order" do + add_to_config "config.plugins = [:c_plugin, :all]" + boot_rails + assert_equal [:c, :a, :b], $arr + end + + test "if :all is at the beginning, it represents the plugins not otherwise specified" do + add_to_config "config.plugins = [:all, :b_plugin]" + boot_rails + assert_equal [:a, :c, :b], $arr + end end end \ No newline at end of file -- cgit v1.2.3 From af44b0764965a9ae1f77290056473b35eac79562 Mon Sep 17 00:00:00 2001 From: David Vrensk Date: Sun, 1 Nov 2009 16:46:12 +0100 Subject: Rdoc for changes introduced in e2ed1a1ca, 36058f450. [#3451 state:committed] Signed-off-by: Jeremy Kemper --- actionpack/lib/action_controller/caching.rb | 1 + activesupport/lib/active_support/cache/mem_cache_store.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 083d6328af..3caf759032 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -26,6 +26,7 @@ module ActionController #:nodoc: # config.action_controller.cache_store = :file_store, "/path/to/cache/directory" # config.action_controller.cache_store = :drb_store, "druby://localhost:9192" # config.action_controller.cache_store = :mem_cache_store, "localhost" + # config.action_controller.cache_store = :mem_cache_store, Memcached::Rails.new("localhost:11211") # config.action_controller.cache_store = MyOwnStore.new("parameter") module Caching extend ActiveSupport::Concern diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index bec9de86ed..1b6b820ca4 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -38,6 +38,11 @@ module ActiveSupport # # If no addresses are specified, then MemCacheStore will connect to # localhost port 11211 (the default memcached port). + # + # Instead of addresses one can pass in a MemCache-like object. For example: + # + # require 'memcached' # gem install memcached; uses C bindings to libmemcached + # ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211")) def initialize(*addresses) if addresses.first.respond_to?(:get) @data = addresses.first -- cgit v1.2.3 From 2da432dde33404b3149210725f4828e957b345bf Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 12 Nov 2009 11:26:55 -0800 Subject: Always bundle pg and mysql for AR tests --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 20d5263c07..f4a37a5e8b 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,8 @@ end # AR gem "arel", "0.2.pre", :git => "git://github.com/rails/arel.git" gem "sqlite3-ruby", ">= 1.2.5" +gem "pg", ">= 0.8.0" +gem "mysql", ">= 2.8.1" # AP gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git" @@ -25,8 +27,6 @@ if ENV['CI'] gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" - gem "pg", ">= 0.8.0" - gem "mysql", ">= 2.8.1" # fcgi gem doesn't compile on 1.9 # avoid minitest strangeness on 1.9 -- cgit v1.2.3 From a28d0ea33e04cd7bf785c26a95e74f78dff82ce0 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 10 Nov 2009 19:12:54 -0600 Subject: Remove rackmount const usage --- actionpack/lib/action_dispatch/routing/mapper.rb | 4 ++-- actionpack/lib/action_dispatch/routing/route_set.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index ebfb4c9be2..7d770dedd0 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -195,9 +195,9 @@ module ActionDispatch @constraints.each { |constraint| if constraint.respond_to?(:matches?) && !constraint.matches?(req) - return Rack::Mount::Const::EXPECTATION_FAILED_RESPONSE + return [417, {}, []] elsif constraint.respond_to?(:call) && !constraint.call(req) - return Rack::Mount::Const::EXPECTATION_FAILED_RESPONSE + return [417, {}, []] end } diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 28e5b806da..c28df76f3f 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -5,7 +5,7 @@ module ActionDispatch module Routing class RouteSet #:nodoc: NotFound = lambda { |env| - raise ActionController::RoutingError, "No route matches #{env[::Rack::Mount::Const::PATH_INFO].inspect} with #{env.inspect}" + raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect} with #{env.inspect}" } PARAMETERS_KEY = 'action_dispatch.request.path_parameters' -- cgit v1.2.3 From 2cb47c742fda56a50454f11eb2ccfbe5a9bd553f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 11 Nov 2009 14:45:21 -0200 Subject: Split mime responder into smaller chunks and allow action to be configured. Signed-off-by: Jeremy Kemper --- .../lib/action_controller/metal/responder.rb | 44 +++++++++++++--------- actionpack/test/controller/mime_responds_test.rb | 22 ++++++++++- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb index c6e847ba0f..e8e88e7479 100644 --- a/actionpack/lib/action_controller/metal/responder.rb +++ b/actionpack/lib/action_controller/metal/responder.rb @@ -14,12 +14,11 @@ module ActionController #:nodoc: # # When a request comes, for example with format :xml, three steps happen: # - # 1) respond_with searches for a template at people/index.xml; + # 1) responder searches for a template at people/index.xml; # - # 2) if the template is not available, it will create a responder, passing - # the controller and the resource and invoke :to_xml on it; + # 2) if the template is not available, it will invoke :to_xml in the given resource; # - # 3) if the responder does not respond_to :to_xml, call to_format on it. + # 3) if the responder does not respond_to :to_xml, call :to_format on it. # # === Builtin HTTP verb semantics # @@ -88,14 +87,16 @@ module ActionController #:nodoc: @resource = resources.is_a?(Array) ? resources.last : resources @resources = resources @options = options + @action = options.delete(:action) @default_response = options.delete(:default_response) end delegate :head, :render, :redirect_to, :to => :controller delegate :get?, :post?, :put?, :delete?, :to => :request - # Undefine :to_json since it's defined on Object + # Undefine :to_json and :to_yaml since it's defined on Object undef_method(:to_json) if method_defined?(:to_json) + undef_method(:to_yaml) if method_defined?(:to_yaml) # Initializes a new responder an invoke the proper format. If the format is # not defined, call to_format. @@ -111,14 +112,8 @@ module ActionController #:nodoc: # def to_html default_render - rescue ActionView::MissingTemplate - if get? - raise - elsif has_errors? - render :action => default_action - else - redirect_to resource_location - end + rescue ActionView::MissingTemplate => e + navigation_behavior(e) end # All others formats follow the procedure below. First we try to render a @@ -127,9 +122,26 @@ module ActionController #:nodoc: # def to_format default_render - rescue ActionView::MissingTemplate + rescue ActionView::MissingTemplate => e raise unless resourceful? + api_behavior(e) + end + protected + + # This is the common behavior for "navigation" requests, like :html, :iphone and so forth. + def navigation_behavior(error) + if get? + raise error + elsif has_errors? + render :action => default_action + else + redirect_to resource_location + end + end + + # This is the common behavior for "API" requests, like :xml and :json. + def api_behavior(error) if get? display resource elsif has_errors? @@ -141,8 +153,6 @@ module ActionController #:nodoc: end end - protected - # Checks whether the resource responds to the current format or not. # def resourceful? @@ -194,7 +204,7 @@ module ActionController #:nodoc: # the verb is post. # def default_action - request.post? ? :new : :edit + @action || (request.post? ? :new : :edit) end end end diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index b070f925d4..fee9cf46f9 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -501,6 +501,12 @@ class RespondWithController < ActionController::Base respond_with(Customer.new("david", 13), :responder => responder) end + def using_resource_with_action + respond_with(Customer.new("david", 13), :action => :foo) do |format| + format.html { raise ActionView::MissingTemplate.new([], "method") } + end + end + protected def _render_js(js, options) @@ -715,6 +721,20 @@ class RespondWithControllerTest < ActionController::TestCase assert_match /jamis<\/name>/, @response.body end + def test_using_resource_with_action + @controller.instance_eval do + def render(params={}) + self.response_body = "#{params[:action]} - #{formats}" + end + end + + errors = { :name => :invalid } + Customer.any_instance.stubs(:errors).returns(errors) + + post :using_resource_with_action + assert_equal "foo - #{[:html].to_s}", @controller.response_body + end + def test_clear_respond_to @controller = InheritedRespondWithController.new @request.accept = "text/html" @@ -760,7 +780,7 @@ class RespondWithControllerTest < ActionController::TestCase assert_equal "Resource name is david", @response.body end - def test_using_resource_with_responder + def test_using_resource_with_set_responder RespondWithController.responder = proc { |c, r, o| c.render :text => "Resource name is #{r.first.name}" } get :using_resource assert_equal "Resource name is david", @response.body -- cgit v1.2.3 From c0ebc2149380a59371553765053f55671c737533 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 12 Nov 2009 16:19:33 -0800 Subject: Test that Array.wrap works with proxy objects and structs --- activesupport/test/core_ext/array_ext_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 8198b9bd2c..f5f91ddd80 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -339,6 +339,11 @@ class ArrayWrapperTests < Test::Unit::TestCase end end + class Proxy + def initialize(target) @target = target end + def method_missing(*a) @target.send(*a) end + end + def test_array ary = %w(foo bar) assert_same ary, Array.wrap(ary) @@ -364,4 +369,19 @@ class ArrayWrapperTests < Test::Unit::TestCase def test_object_with_to_ary assert_equal ["foo", "bar"], Array.wrap(FakeCollection.new) end + + def test_proxy_object + p = Proxy.new(Object.new) + assert_equal [p], Array.wrap(p) + end + + def test_proxy_to_object_with_to_ary + p = Proxy.new(FakeCollection.new) + assert_equal [p], Array.wrap(p) + end + + def test_struct + o = Struct.new(:foo).new(123) + assert_equal [o], Array.wrap(o) + end end -- cgit v1.2.3 From f07bcf015e35c400f12bf8274dc9cc4ec38be986 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 12 Nov 2009 16:31:23 -0800 Subject: Ruby 1.9.2: work around Array allowing method_missing for to_ary --- activesupport/lib/active_support/core_ext/array/wrap.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index 38bb68c1ec..f48d5ce500 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -4,11 +4,10 @@ class Array def self.wrap(object) if object.nil? [] - # to_a doesn't work correctly with Array() but to_ary always does - elsif object.respond_to?(:to_a) && !object.respond_to?(:to_ary) - [object] + elsif object.respond_to?(:to_ary) + object.to_ary else - Array(object) + [object] end end end -- cgit v1.2.3 From 18d497651628c73287f3e808c3807121ad36e278 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 12 Nov 2009 16:50:55 -0800 Subject: Prefer Array.wrap to Array() --- activesupport/lib/active_support/rescuable.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index 879662c16c..dd0752b09d 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/class/inheritable_attributes' require 'active_support/core_ext/proc' @@ -81,7 +82,7 @@ module ActiveSupport def handler_for_rescue(exception) # We go from right to left because pairs are pushed onto rescue_handlers # as rescue_from declarations are found. - _, rescuer = Array(rescue_handlers).reverse.detect do |klass_name, handler| + _, rescuer = Array.wrap(rescue_handlers).reverse.detect do |klass_name, handler| # The purpose of allowing strings in rescue_from is to support the # declaration of handler associations for exception classes whose # definition is yet unknown. -- cgit v1.2.3 From fbbf0086ca8f13f76d2969f655bb1bfc2f4eb4d6 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 12 Nov 2009 17:21:41 -0800 Subject: Ruby 1.9.2: avoid #flatten --- .../lib/active_record/association_preload.rb | 20 ++++++++++++-------- activerecord/lib/active_record/associations.rb | 16 ++++++++++------ .../active_record/associations/association_proxy.rb | 20 ++++++++++++++++---- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb index e41fda7a4b..9f7b2a60b2 100644 --- a/activerecord/lib/active_record/association_preload.rb +++ b/activerecord/lib/active_record/association_preload.rb @@ -1,3 +1,6 @@ +require 'active_support/core_ext/array/wrap' +require 'active_support/core_ext/enumerable' + module ActiveRecord # See ActiveRecord::AssociationPreload::ClassMethods for documentation. module AssociationPreload #:nodoc: @@ -82,7 +85,7 @@ module ActiveRecord # only one level deep in the +associations+ argument, i.e. it's not passed # to the child associations when +associations+ is a Hash. def preload_associations(records, associations, preload_options={}) - records = [records].flatten.compact.uniq + records = Array.wrap(records).compact.uniq return if records.empty? case associations when Array then associations.each {|association| preload_associations(records, association, preload_options)} @@ -92,7 +95,7 @@ module ActiveRecord raise "parent must be an association name" unless parent.is_a?(String) || parent.is_a?(Symbol) preload_associations(records, parent, preload_options) reflection = reflections[parent] - parents = records.map {|record| record.send(reflection.name)}.flatten.compact + parents = records.sum { |record| Array.wrap(record.send(reflection.name)) } unless parents.empty? parents.first.class.preload_associations(parents, child) end @@ -123,7 +126,8 @@ module ActiveRecord parent_records.each do |parent_record| association_proxy = parent_record.send(reflection_name) association_proxy.loaded - association_proxy.target.push(*[associated_record].flatten) + association_proxy.target.push *Array.wrap(associated_record) + association_proxy.__send__(:set_inverse_instance, associated_record, parent_record) end end @@ -254,6 +258,7 @@ module ActiveRecord through_reflection = reflections[through_association] through_primary_key = through_reflection.primary_key_name + through_records = [] if reflection.options[:source_type] interface = reflection.source_reflection.options[:foreign_type] preload_options = {:conditions => ["#{connection.quote_column_name interface} = ?", reflection.options[:source_type]]} @@ -262,23 +267,22 @@ module ActiveRecord records.first.class.preload_associations(records, through_association, preload_options) # Dont cache the association - we would only be caching a subset - through_records = [] records.each do |record| proxy = record.send(through_association) if proxy.respond_to?(:target) - through_records << proxy.target + through_records.concat Array.wrap(proxy.target) proxy.reset else # this is a has_one :through reflection through_records << proxy if proxy end end - through_records.flatten! else records.first.class.preload_associations(records, through_association) - through_records = records.map {|record| record.send(through_association)}.flatten + records.each do |record| + through_records.concat Array.wrap(record.send(through_association)) + end end - through_records.compact! through_records end diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 3a5f3ed030..6c5e25010f 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1922,12 +1922,16 @@ module ActiveRecord reflection = base.reflections[name] is_collection = [:has_many, :has_and_belongs_to_many].include?(reflection.macro) - parent_records = records.map do |record| - descendant = record.send(reflection.name) - next unless descendant - descendant.target.uniq! if is_collection - descendant - end.flatten.compact + parent_records = [] + records.each do |record| + if descendant = record.send(reflection.name) + if is_collection + parent_records.concat descendant.target.uniq + else + parent_records << descendant + end + end + end remove_duplicate_results!(reflection.klass, parent_records, associations[name]) unless parent_records.empty? end diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 75218c01d2..9b96ec0cf4 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -256,10 +256,22 @@ module ActiveRecord end end - # Array#flatten has problems with recursive arrays. Going one level - # deeper solves the majority of the problems. - def flatten_deeper(array) - array.collect { |element| (element.respond_to?(:flatten) && !element.is_a?(Hash)) ? element.flatten : element }.flatten + if RUBY_VERSION < '1.9.2' + # Array#flatten has problems with recursive arrays before Ruby 1.9.2. + # Going one level deeper solves the majority of the problems. + def flatten_deeper(array) + array.collect { |element| (element.respond_to?(:flatten) && !element.is_a?(Hash)) ? element.flatten : element }.flatten + end + else + def flatten_deeper(array) + array.sum [] do |elem| + if elem.respond_to?(:each) + flatten_deeper(elem) + else + Array.wrap(elem) + end + end + end end # Returns the ID of the owner, quoted if needed. -- cgit v1.2.3 From 3fd2624be45cb3124641f53d9e520523d9bc49c9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 10:31:05 -0800 Subject: Uses Hash#reverse_merge --- activemodel/lib/active_model/translation.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb index 2ad8ca9dea..42ca463f82 100644 --- a/activemodel/lib/active_model/translation.rb +++ b/activemodel/lib/active_model/translation.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/hash/reverse_merge' + module ActiveModel module Translation include ActiveModel::Naming -- cgit v1.2.3 From 0da71980cd61aa6297749d0ea8520785c9a5280f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 10:38:23 -0800 Subject: Missing customers fixture --- activerecord/test/cases/copy_table_test_sqlite.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/test/cases/copy_table_test_sqlite.rb b/activerecord/test/cases/copy_table_test_sqlite.rb index de8af30997..575b4806c1 100644 --- a/activerecord/test/cases/copy_table_test_sqlite.rb +++ b/activerecord/test/cases/copy_table_test_sqlite.rb @@ -1,7 +1,7 @@ require "cases/helper" class CopyTableTest < ActiveRecord::TestCase - fixtures :companies, :comments + fixtures :customers, :companies, :comments def setup @connection = ActiveRecord::Base.connection @@ -27,8 +27,8 @@ class CopyTableTest < ActiveRecord::TestCase test_copy_table('customers', 'customers2', :rename => {'name' => 'person_name'}) do |from, to, options| expected = column_values(from, 'name') - assert expected.any?, 'only nils in resultset; real values are needed' assert_equal expected, column_values(to, 'person_name') + assert expected.any?, "No values in table: #{expected.inspect}" end end -- cgit v1.2.3 From bd51790895fc75a3b4e19e8dd7aa6dc389d77068 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 10:44:34 -0800 Subject: Split arel_table into method to get a relation and another to memoize the default relation. --- activerecord/lib/active_record/associations.rb | 4 ++-- .../associations/has_and_belongs_to_many_association.rb | 4 ++-- .../lib/active_record/associations/has_many_association.rb | 2 +- activerecord/lib/active_record/base.rb | 12 ++++++------ activerecord/lib/active_record/calculations.rb | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 6c5e25010f..fc18b53b9d 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1698,7 +1698,7 @@ module ActiveRecord def construct_finder_arel_with_included_associations(options, join_dependency) scope = scope(:find) - relation = arel_table((scope && scope[:from]) || options[:from]) + relation = arel_table_for((scope && scope[:from]) || options[:from]) for association in join_dependency.join_associations relation = association.join_relation(relation) @@ -1741,7 +1741,7 @@ module ActiveRecord def construct_finder_sql_for_association_limiting(options, join_dependency) scope = scope(:find) - relation = arel_table(options[:from]) + relation = arel_table_for(options[:from]) for association in join_dependency.join_associations relation = association.join_relation(relation) diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index c646fe488b..ce4e96637b 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -56,7 +56,7 @@ module ActiveRecord if @reflection.options[:insert_sql] @owner.connection.insert(interpolate_sql(@reflection.options[:insert_sql], record)) else - relation = arel_table(@reflection.options[:join_table]) + relation = arel_table_for(@reflection.options[:join_table]) attributes = columns.inject({}) do |attrs, column| case column.name.to_s when @reflection.primary_key_name.to_s @@ -82,7 +82,7 @@ module ActiveRecord if sql = @reflection.options[:delete_sql] records.each { |record| @owner.connection.delete(interpolate_sql(sql, record)) } else - relation = arel_table(@reflection.options[:join_table]) + relation = arel_table_for(@reflection.options[:join_table]) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). and(Arel::Predicates::In.new(relation[@reflection.association_foreign_key], records.map(&:id))) ).delete diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index cd31b0e211..36a668c284 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -69,7 +69,7 @@ module ActiveRecord when :delete_all @reflection.klass.delete(records.map { |record| record.id }) else - relation = arel_table(@reflection.table_name) + relation = arel_table_for(@reflection.table_name) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). and(Arel::Predicates::In.new(relation[@reflection.klass.primary_key], records.map(&:id))) ).update(relation[@reflection.primary_key_name] => nil) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 056f29f029..778c36361d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1493,11 +1493,11 @@ module ActiveRecord #:nodoc: def arel_table(table = nil) - table = table_name if table.blank? - if @arel_table.nil? || @arel_table.name != table - @arel_table = Relation.new(self, Arel::Table.new(table)) - end - @arel_table + @arel_table ||= arel_table_for(table_name) + end + + def arel_table_for(table_name) + Relation.new(self, Arel::Table.new(table_name)) end private @@ -1666,7 +1666,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - relation = arel_table(options[:from]). + relation = arel_table_for(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 40242333e5..46545d96a3 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -146,7 +146,7 @@ module ActiveRecord join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) construct_finder_arel_with_included_associations(options, join_dependency) else - relation = arel_table(options[:from]). + relation = arel_table_for(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). order(options[:order]). @@ -164,7 +164,7 @@ module ActiveRecord def execute_simple_calculation(operation, column_name, options, relation) #:nodoc: column = if column_names.include?(column_name.to_s) - Arel::Attribute.new(arel_table(options[:from] || table_name), + Arel::Attribute.new(arel_table_for(options[:from] || table_name), options[:select] || column_name) else Arel::SqlLiteral.new(options[:select] || -- cgit v1.2.3 From 0214d337b3b3301f4e1478248b386d43ca6c15e0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 11:00:18 -0800 Subject: Rescue handlers should never need array wrapping. Bug if so. --- activesupport/lib/active_support/rescuable.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index dd0752b09d..f0119f5994 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -1,4 +1,3 @@ -require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/class/inheritable_attributes' require 'active_support/core_ext/proc' @@ -82,7 +81,7 @@ module ActiveSupport def handler_for_rescue(exception) # We go from right to left because pairs are pushed onto rescue_handlers # as rescue_from declarations are found. - _, rescuer = Array.wrap(rescue_handlers).reverse.detect do |klass_name, handler| + _, rescuer = rescue_handlers.reverse.detect do |klass_name, handler| # The purpose of allowing strings in rescue_from is to support the # declaration of handler associations for exception classes whose # definition is yet unknown. -- cgit v1.2.3 From 9acc824d96db039486fc493c6f904035fe386967 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 12:15:49 -0800 Subject: Ruby 1.9.2: disallow explicit coercion via method_missing. Only give friendly nil errors for Array and Active Record methods. --- .../lib/active_support/core_ext/name_error.rb | 4 +++- activesupport/lib/active_support/whiny_nil.rb | 10 +++++++-- activesupport/test/core_ext/name_error_test.rb | 26 +++++++++------------- activesupport/test/whiny_nil_test.rb | 14 +++++++++++- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/name_error.rb b/activesupport/lib/active_support/core_ext/name_error.rb index cd165626c8..e1ebd4f91c 100644 --- a/activesupport/lib/active_support/core_ext/name_error.rb +++ b/activesupport/lib/active_support/core_ext/name_error.rb @@ -1,7 +1,9 @@ class NameError # Extract the name of the missing constant from the exception message. def missing_name - $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message + if /undefined local variable or method/ !~ message + $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message + end end # Was this exception raised because the given name was missing? diff --git a/activesupport/lib/active_support/whiny_nil.rb b/activesupport/lib/active_support/whiny_nil.rb index 36fe9510ba..c4aaba7ab3 100644 --- a/activesupport/lib/active_support/whiny_nil.rb +++ b/activesupport/lib/active_support/whiny_nil.rb @@ -43,7 +43,14 @@ class NilClass private def method_missing(method, *args, &block) - raise_nil_warning_for METHOD_CLASS_MAP[method], method, caller + # Ruby 1.9.2: disallow explicit coercion via method_missing. + if method == :to_ary || method == :to_str + super + elsif klass = METHOD_CLASS_MAP[method] + raise_nil_warning_for klass, method, caller + else + super + end end # Raises a NoMethodError when you attempt to call a method on +nil+. @@ -55,4 +62,3 @@ class NilClass raise NoMethodError, message, with_caller || caller end end - diff --git a/activesupport/test/core_ext/name_error_test.rb b/activesupport/test/core_ext/name_error_test.rb index 10913e2ade..6352484d04 100644 --- a/activesupport/test/core_ext/name_error_test.rb +++ b/activesupport/test/core_ext/name_error_test.rb @@ -3,23 +3,19 @@ require 'active_support/core_ext/name_error' class NameErrorTest < Test::Unit::TestCase def test_name_error_should_set_missing_name - begin - SomeNameThatNobodyWillUse____Really ? 1 : 0 - flunk "?!?!" - rescue NameError => exc - assert_equal "NameErrorTest::SomeNameThatNobodyWillUse____Really", exc.missing_name - assert exc.missing_name?(:SomeNameThatNobodyWillUse____Really) - assert exc.missing_name?("NameErrorTest::SomeNameThatNobodyWillUse____Really") - end + SomeNameThatNobodyWillUse____Really ? 1 : 0 + flunk "?!?!" + rescue NameError => exc + assert_equal "NameErrorTest::SomeNameThatNobodyWillUse____Really", exc.missing_name + assert exc.missing_name?(:SomeNameThatNobodyWillUse____Really) + assert exc.missing_name?("NameErrorTest::SomeNameThatNobodyWillUse____Really") end def test_missing_method_should_ignore_missing_name - begin - some_method_that_does_not_exist - flunk "?!?!" - rescue NameError => exc - assert_equal nil, exc.missing_name - assert ! exc.missing_name?(:Foo) - end + some_method_that_does_not_exist + flunk "?!?!" + rescue NameError => exc + assert !exc.missing_name?(:Foo) + assert_nil exc.missing_name end end diff --git a/activesupport/test/whiny_nil_test.rb b/activesupport/test/whiny_nil_test.rb index 4cb22c41b2..009d97940f 100644 --- a/activesupport/test/whiny_nil_test.rb +++ b/activesupport/test/whiny_nil_test.rb @@ -13,7 +13,7 @@ class WhinyNilTest < Test::Unit::TestCase def test_unchanged nil.method_thats_not_in_whiners rescue NoMethodError => nme - assert_match(/nil.method_thats_not_in_whiners/, nme.message) + assert(nme.message =~ /nil:NilClass/) end def test_active_record @@ -35,4 +35,16 @@ class WhinyNilTest < Test::Unit::TestCase rescue RuntimeError => nme assert(!(nme.message =~ /nil:NilClass/)) end + + def test_no_to_ary_coercion + nil.to_ary + rescue NoMethodError => nme + assert(nme.message =~ /nil:NilClass/) + end + + def test_no_to_str_coercion + nil.to_str + rescue NoMethodError => nme + assert(nme.message =~ /nil:NilClass/) + end end -- cgit v1.2.3 From 2841a14f4b26e093e88cdb6d84c82d120f53ca46 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 12:42:40 -0800 Subject: Ruby 1.9.2: fix broken to_ary expectation --- activesupport/test/caching_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 6a51ce9402..00e05f76fe 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -30,7 +30,9 @@ class CacheStoreSettingTest < ActiveSupport::TestCase def test_mem_cache_fragment_cache_store_with_given_mem_cache_like_object MemCache.expects(:new).never - store = ActiveSupport::Cache.lookup_store :mem_cache_store, stub("memcache", :get => true) + memcache = Object.new + def memcache.get() true end + store = ActiveSupport::Cache.lookup_store :mem_cache_store, memcache assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) end -- cgit v1.2.3 From 3f54f3100b6c262776ad324bd649ff268600e280 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 13:02:29 -0800 Subject: Ruby 1.9.2: StringIO no longer has #path --- actionpack/lib/action_dispatch/http/request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index b3bb8c623f..6a52854961 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -489,7 +489,7 @@ EOM def self.extended(object) object.class_eval do attr_accessor :original_path, :content_type - alias_method :local_path, :path + alias_method :local_path, :path if method_defined?(:path) end end -- cgit v1.2.3 From 7b3d85db4c58e2f719981efd6ef5a6b870f6ab49 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 15:30:51 -0800 Subject: Revert "Split arel_table into method to get a relation and another to memoize the default relation." This reverts commit bd51790895fc75a3b4e19e8dd7aa6dc389d77068. --- activerecord/lib/active_record/associations.rb | 4 ++-- .../associations/has_and_belongs_to_many_association.rb | 4 ++-- .../lib/active_record/associations/has_many_association.rb | 2 +- activerecord/lib/active_record/base.rb | 12 ++++++------ activerecord/lib/active_record/calculations.rb | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index fc18b53b9d..6c5e25010f 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1698,7 +1698,7 @@ module ActiveRecord def construct_finder_arel_with_included_associations(options, join_dependency) scope = scope(:find) - relation = arel_table_for((scope && scope[:from]) || options[:from]) + relation = arel_table((scope && scope[:from]) || options[:from]) for association in join_dependency.join_associations relation = association.join_relation(relation) @@ -1741,7 +1741,7 @@ module ActiveRecord def construct_finder_sql_for_association_limiting(options, join_dependency) scope = scope(:find) - relation = arel_table_for(options[:from]) + relation = arel_table(options[:from]) for association in join_dependency.join_associations relation = association.join_relation(relation) diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index ce4e96637b..c646fe488b 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -56,7 +56,7 @@ module ActiveRecord if @reflection.options[:insert_sql] @owner.connection.insert(interpolate_sql(@reflection.options[:insert_sql], record)) else - relation = arel_table_for(@reflection.options[:join_table]) + relation = arel_table(@reflection.options[:join_table]) attributes = columns.inject({}) do |attrs, column| case column.name.to_s when @reflection.primary_key_name.to_s @@ -82,7 +82,7 @@ module ActiveRecord if sql = @reflection.options[:delete_sql] records.each { |record| @owner.connection.delete(interpolate_sql(sql, record)) } else - relation = arel_table_for(@reflection.options[:join_table]) + relation = arel_table(@reflection.options[:join_table]) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). and(Arel::Predicates::In.new(relation[@reflection.association_foreign_key], records.map(&:id))) ).delete diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 36a668c284..cd31b0e211 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -69,7 +69,7 @@ module ActiveRecord when :delete_all @reflection.klass.delete(records.map { |record| record.id }) else - relation = arel_table_for(@reflection.table_name) + relation = arel_table(@reflection.table_name) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). and(Arel::Predicates::In.new(relation[@reflection.klass.primary_key], records.map(&:id))) ).update(relation[@reflection.primary_key_name] => nil) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 778c36361d..056f29f029 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1493,11 +1493,11 @@ module ActiveRecord #:nodoc: def arel_table(table = nil) - @arel_table ||= arel_table_for(table_name) - end - - def arel_table_for(table_name) - Relation.new(self, Arel::Table.new(table_name)) + table = table_name if table.blank? + if @arel_table.nil? || @arel_table.name != table + @arel_table = Relation.new(self, Arel::Table.new(table)) + end + @arel_table end private @@ -1666,7 +1666,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - relation = arel_table_for(options[:from]). + relation = arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 46545d96a3..40242333e5 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -146,7 +146,7 @@ module ActiveRecord join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) construct_finder_arel_with_included_associations(options, join_dependency) else - relation = arel_table_for(options[:from]). + relation = arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). order(options[:order]). @@ -164,7 +164,7 @@ module ActiveRecord def execute_simple_calculation(operation, column_name, options, relation) #:nodoc: column = if column_names.include?(column_name.to_s) - Arel::Attribute.new(arel_table_for(options[:from] || table_name), + Arel::Attribute.new(arel_table(options[:from] || table_name), options[:select] || column_name) else Arel::SqlLiteral.new(options[:select] || -- cgit v1.2.3 From 7ab78b9ccd1f760960a77b5be9aac0c27212abe2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 18:57:10 -0800 Subject: CI: slow down brittle notifications tests --- activesupport/test/notifications_test.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 9175c8f26e..334496374b 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -75,7 +75,7 @@ class NotificationsMainTest < Test::Unit::TestCase 1 + 1 end - sleep(0.1) + sleep 1 assert_equal 1, @events.size assert_equal :awesome, @events.last.name @@ -88,14 +88,14 @@ class NotificationsMainTest < Test::Unit::TestCase 1 + 1 end - sleep(0.1) + sleep 1 assert_equal 1, @events.size assert_equal :wot, @events.first.name assert_equal Hash[:payload => "child"], @events.first.payload end - sleep(0.1) + sleep 1 assert_equal 2, @events.size assert_equal :awesome, @events.last.name @@ -108,7 +108,7 @@ class NotificationsMainTest < Test::Unit::TestCase raise "OMG" end rescue RuntimeError - sleep(0.1) + sleep 1 assert_equal 1, @events.size assert_equal :awesome, @events.last.name @@ -117,7 +117,7 @@ class NotificationsMainTest < Test::Unit::TestCase def test_event_is_pushed_even_without_block ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications") - sleep(0.1) + sleep 1 assert_equal 1, @events.size assert_equal :awesome, @events.last.name @@ -137,8 +137,9 @@ class NotificationsMainTest < Test::Unit::TestCase end ActiveSupport::Notifications.instrument(:cache){ 1 } - sleep 0.1 + sleep 1 + assert_equal 3, @another.size before, during, after = @another.map {|e| e.transaction_id } assert_equal before, after assert_not_equal before, during @@ -153,7 +154,7 @@ class NotificationsMainTest < Test::Unit::TestCase ActiveSupport::Notifications.instrument(:cache){ 1 } - sleep(0.1) + sleep 1 assert_equal 1, @another.size assert_equal :cache, @another.first.name @@ -169,7 +170,7 @@ class NotificationsMainTest < Test::Unit::TestCase ActiveSupport::Notifications.instrument(:something){ 0 } ActiveSupport::Notifications.instrument(:cache){ 1 } - sleep(0.1) + sleep 1 assert_equal 1, @another.size assert_equal :cache, @another.first.name @@ -186,7 +187,7 @@ class NotificationsMainTest < Test::Unit::TestCase ActiveSupport::Notifications.instrument(:value){ i } end - sleep 0.1 + sleep 1 assert_equal 100, @events.size assert_equal :value, @events.first.name -- cgit v1.2.3 From 66fda6b8949cde07966ab098125e1da7969e9468 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 19:28:59 -0800 Subject: Fix duration check for longer sleep --- activesupport/test/notifications_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 334496374b..466af49931 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -100,7 +100,7 @@ class NotificationsMainTest < Test::Unit::TestCase assert_equal 2, @events.size assert_equal :awesome, @events.last.name assert_equal Hash[:payload => "notifications"], @events.last.payload - assert_in_delta 100, @events.last.duration, 70 + assert_in_delta 1000, @events.last.duration, 70 end def test_event_is_pushed_even_if_block_fails -- cgit v1.2.3 From 58c0d31487d158286576b0745a55a0941ed076ad Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 13 Nov 2009 20:58:38 -0800 Subject: Notifications: queue.drained? for testability in place of brittle sleeps --- activesupport/lib/active_support/notifications.rb | 16 +++++++-------- activesupport/test/notifications_test.rb | 24 +++++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 6304f496f5..7a9f76b26a 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -144,27 +144,21 @@ module ActiveSupport class LittleFanout def initialize @listeners = [] - @stream = Queue.new - Thread.new { consume } end def publish(*args) - @stream.push(args) + @listeners.each { |l| l.publish(*args) } end def subscribe(pattern=nil, &block) @listeners << Listener.new(pattern, &block) end - def consume - while args = @stream.shift - @listeners.each { |l| l.publish(*args) } - end + def drained? + @listeners.all? &:drained? end class Listener - # attr_reader :thread - def initialize(pattern, &block) @pattern = pattern @subscriber = block @@ -183,6 +177,10 @@ module ActiveSupport @subscriber.call(*args) end end + + def drained? + @queue.size.zero? + end end end end diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 466af49931..01106e83e9 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -75,7 +75,7 @@ class NotificationsMainTest < Test::Unit::TestCase 1 + 1 end - sleep 1 + drain assert_equal 1, @events.size assert_equal :awesome, @events.last.name @@ -88,19 +88,18 @@ class NotificationsMainTest < Test::Unit::TestCase 1 + 1 end - sleep 1 + drain assert_equal 1, @events.size assert_equal :wot, @events.first.name assert_equal Hash[:payload => "child"], @events.first.payload end - sleep 1 + drain assert_equal 2, @events.size assert_equal :awesome, @events.last.name assert_equal Hash[:payload => "notifications"], @events.last.payload - assert_in_delta 1000, @events.last.duration, 70 end def test_event_is_pushed_even_if_block_fails @@ -108,7 +107,7 @@ class NotificationsMainTest < Test::Unit::TestCase raise "OMG" end rescue RuntimeError - sleep 1 + drain assert_equal 1, @events.size assert_equal :awesome, @events.last.name @@ -117,7 +116,7 @@ class NotificationsMainTest < Test::Unit::TestCase def test_event_is_pushed_even_without_block ActiveSupport::Notifications.instrument(:awesome, :payload => "notifications") - sleep 1 + drain assert_equal 1, @events.size assert_equal :awesome, @events.last.name @@ -137,7 +136,7 @@ class NotificationsMainTest < Test::Unit::TestCase end ActiveSupport::Notifications.instrument(:cache){ 1 } - sleep 1 + drain assert_equal 3, @another.size before, during, after = @another.map {|e| e.transaction_id } @@ -154,7 +153,7 @@ class NotificationsMainTest < Test::Unit::TestCase ActiveSupport::Notifications.instrument(:cache){ 1 } - sleep 1 + drain assert_equal 1, @another.size assert_equal :cache, @another.first.name @@ -170,7 +169,7 @@ class NotificationsMainTest < Test::Unit::TestCase ActiveSupport::Notifications.instrument(:something){ 0 } ActiveSupport::Notifications.instrument(:cache){ 1 } - sleep 1 + drain assert_equal 1, @another.size assert_equal :cache, @another.first.name @@ -187,7 +186,7 @@ class NotificationsMainTest < Test::Unit::TestCase ActiveSupport::Notifications.instrument(:value){ i } end - sleep 1 + drain assert_equal 100, @events.size assert_equal :value, @events.first.name @@ -199,4 +198,9 @@ class NotificationsMainTest < Test::Unit::TestCase assert_equal 1, @another.first.result assert_equal 100, @another.last.result end + + private + def drain + sleep(0.1) until ActiveSupport::Notifications.queue.drained? + end end -- cgit v1.2.3 From 92253829dee9a1fb545f71f71894dee1df604f74 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 01:12:49 -0800 Subject: Ruby 1.9.2: fix flatten_deeper to preserve nils --- activerecord/lib/active_record/associations/association_proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 9b96ec0cf4..3cd1a1d922 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -268,7 +268,7 @@ module ActiveRecord if elem.respond_to?(:each) flatten_deeper(elem) else - Array.wrap(elem) + [elem] end end end -- cgit v1.2.3 From 7eb4f2ecc53831d850682d88634ccf41676e40a2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 01:13:54 -0800 Subject: Consolidate date & time landscape: require 'active_support/time' --- activesupport/lib/active_support/core_ext/date.rb | 7 ------- .../lib/active_support/core_ext/date_time.rb | 5 ----- activesupport/lib/active_support/core_ext/time.rb | 10 ---------- activesupport/lib/active_support/time.rb | 23 +++++++++++++++++++--- .../lib/active_support/values/time_zone.rb | 3 --- activesupport/test/core_ext/date_ext_test.rb | 2 +- activesupport/test/core_ext/date_time_ext_test.rb | 2 +- activesupport/test/core_ext/string_ext_test.rb | 2 +- 8 files changed, 23 insertions(+), 31 deletions(-) delete mode 100644 activesupport/lib/active_support/core_ext/date.rb delete mode 100644 activesupport/lib/active_support/core_ext/date_time.rb delete mode 100644 activesupport/lib/active_support/core_ext/time.rb diff --git a/activesupport/lib/active_support/core_ext/date.rb b/activesupport/lib/active_support/core_ext/date.rb deleted file mode 100644 index 6672129076..0000000000 --- a/activesupport/lib/active_support/core_ext/date.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'date' - -require 'active_support/core_ext/date/acts_like' -require 'active_support/core_ext/date/freeze' - -require 'active_support/core_ext/date/calculations' -require 'active_support/core_ext/date/conversions' diff --git a/activesupport/lib/active_support/core_ext/date_time.rb b/activesupport/lib/active_support/core_ext/date_time.rb deleted file mode 100644 index 004fd0ad29..0000000000 --- a/activesupport/lib/active_support/core_ext/date_time.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'active_support/core_ext/time' -require 'active_support/core_ext/date_time/acts_like' -require 'active_support/core_ext/date_time/calculations' -require 'active_support/core_ext/date_time/conversions' -require 'active_support/core_ext/date_time/zones' diff --git a/activesupport/lib/active_support/core_ext/time.rb b/activesupport/lib/active_support/core_ext/time.rb deleted file mode 100644 index b28f7f1a32..0000000000 --- a/activesupport/lib/active_support/core_ext/time.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'date' -require 'time' - -require 'active_support/core_ext/time/publicize_conversion_methods' -require 'active_support/core_ext/time/marshal_with_utc_flag' - -require 'active_support/core_ext/time/acts_like' -require 'active_support/core_ext/time/calculations' -require 'active_support/core_ext/time/conversions' -require 'active_support/core_ext/time/zones' diff --git a/activesupport/lib/active_support/time.rb b/activesupport/lib/active_support/time.rb index d36a683601..1362f6997c 100644 --- a/activesupport/lib/active_support/time.rb +++ b/activesupport/lib/active_support/time.rb @@ -1,7 +1,4 @@ require 'active_support' -require 'active_support/core_ext/time' -require 'active_support/core_ext/date' -require 'active_support/core_ext/date_time' module ActiveSupport autoload :Duration, 'active_support/duration' @@ -12,3 +9,23 @@ module ActiveSupport [Duration, TimeWithZone, TimeZone] end end + +require 'date' +require 'time' + +require 'active_support/core_ext/time/publicize_conversion_methods' +require 'active_support/core_ext/time/marshal_with_utc_flag' +require 'active_support/core_ext/time/acts_like' +require 'active_support/core_ext/time/calculations' +require 'active_support/core_ext/time/conversions' +require 'active_support/core_ext/time/zones' + +require 'active_support/core_ext/date/acts_like' +require 'active_support/core_ext/date/freeze' +require 'active_support/core_ext/date/calculations' +require 'active_support/core_ext/date/conversions' + +require 'active_support/core_ext/date_time/acts_like' +require 'active_support/core_ext/date_time/calculations' +require 'active_support/core_ext/date_time/conversions' +require 'active_support/core_ext/date_time/zones' diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index e7583bef1b..cbb8e890ae 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -1,7 +1,4 @@ require 'active_support/core_ext/object/blank' -require 'active_support/core_ext/time' -require 'active_support/core_ext/date' -require 'active_support/core_ext/date_time' # The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following: # diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index 18422d68bc..23c9bc7fb1 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -1,5 +1,5 @@ require 'abstract_unit' -require 'active_support/core_ext/date' +require 'active_support/time' class DateExtCalculationsTest < Test::Unit::TestCase def test_to_s diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index a7b179b2be..4341ead488 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -1,5 +1,5 @@ require 'abstract_unit' -require 'active_support/core_ext/date_time' +require 'active_support/time' class DateTimeExtCalculationsTest < Test::Unit::TestCase def test_to_s diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 1e8a1c4f08..56ed296dac 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -4,7 +4,7 @@ require 'abstract_unit' require 'inflector_test_cases' require 'active_support/core_ext/string' -require 'active_support/core_ext/time' +require 'active_support/time' require 'active_support/core_ext/kernel/reporting' class StringInflectionsTest < Test::Unit::TestCase -- cgit v1.2.3 From f0f4dffd3b469c0f4ba743c960110e8663955436 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 01:22:36 -0800 Subject: Skip pg locking test due to connection checkout deadlock detection --- activerecord/test/cases/locking_test.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index e177235591..7e51526370 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -282,11 +282,14 @@ unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter) assert first.end > second.end end - def test_second_lock_waits - assert [0.2, 1, 5].any? { |zzz| - first, second = duel(zzz) { Person.find 1, :lock => true } - second.end > first.end - } + # Hit by ruby deadlock detection since connection checkout is mutexed. + if RUBY_VERSION < '1.9.2' + def test_second_lock_waits + assert [0.2, 1, 5].any? { |zzz| + first, second = duel(zzz) { Person.find 1, :lock => true } + second.end > first.end + } + end end protected -- cgit v1.2.3 From 6ebb061b18cd5af087453879b3eac0f719ea4ec4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 01:50:47 -0800 Subject: Ruby 1.9.2: use recursive flatten --- activerecord/lib/active_record/associations/association_proxy.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 3cd1a1d922..7d8f4670fa 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -264,13 +264,7 @@ module ActiveRecord end else def flatten_deeper(array) - array.sum [] do |elem| - if elem.respond_to?(:each) - flatten_deeper(elem) - else - [elem] - end - end + array.flatten end end -- cgit v1.2.3 From 364a8f390216c4c5695ded89dacab0978fa6ae34 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 01:51:52 -0800 Subject: No need to check for generated method, just redispatch --- activerecord/lib/active_record/attribute_methods.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index ab7ad34b9e..3a9a67e3a2 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -31,11 +31,10 @@ module ActiveRecord self.class.define_attribute_methods method_name = method_id.to_s guard_private_attribute_method!(method_name, args) - if self.class.generated_attribute_methods.instance_methods.include?(method_name) - return self.send(method_id, *args, &block) - end + send(method_id, *args, &block) + else + super end - super end def respond_to?(*args) -- cgit v1.2.3 From 61843595eaa58fc3c7f30043f2e9d84e2ef2b401 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 02:14:43 -0800 Subject: No need for test stub --- activesupport/test/i18n_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb index 9868f1e87d..dfcd4f822d 100644 --- a/activesupport/test/i18n_test.rb +++ b/activesupport/test/i18n_test.rb @@ -9,8 +9,8 @@ class I18nTest < Test::Unit::TestCase end def test_time_zone_localization_with_default_format - Time.zone.stubs(:now).returns Time.local(2000) - assert_equal Time.zone.now.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(Time.zone.now) + now = Time.local(2000) + assert_equal now.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(now) end def test_date_localization_should_use_default_format -- cgit v1.2.3 From 313a7ea9d63f3df6e4ad0ef9941f83394f95fa0b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 02:38:22 -0800 Subject: Fix bundler environment check --- railties/test/isolation/abstract_unit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 145d16b6d9..ba8b35d5cc 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -185,7 +185,7 @@ Module.new do FileUtils.mkdir(tmp_path) environment = File.expand_path('../../../../vendor/gems/environment', __FILE__) - if File.exist?(environment) + if File.exist?("#{environment}.rb") require_environment = "-r #{environment}" end -- cgit v1.2.3 From 795213a5f44f750d431fccdfd00d8520264bba0e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 02:38:35 -0800 Subject: Just use abstract_unit --- railties/test/rails_info_test.rb | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/railties/test/rails_info_test.rb b/railties/test/rails_info_test.rb index dcf9966c0d..fc28d7e912 100644 --- a/railties/test/rails_info_test.rb +++ b/railties/test/rails_info_test.rb @@ -1,15 +1,4 @@ -$:.unshift File.dirname(__FILE__) + "/../lib" -$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info" -$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib" -$:.unshift File.dirname(__FILE__) + "/../../actionpack/lib" - -require 'rubygems' -gem 'rack', '~> 1.0.0' - -require 'test/unit' -require 'active_support' -require 'active_support/test_case' -require 'action_controller' +require 'abstract_unit' unless defined?(Rails) && defined?(Rails::Info) module Rails -- cgit v1.2.3 From 3ee9b8f2b28ecbff08617fba9a224b49ad7ad57e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 02:39:38 -0800 Subject: Remove Gemfile deps duplicated from AP gemspec --- Gemfile | 2 -- actionpack/actionpack.gemspec | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f4a37a5e8b..8f4fed2cdd 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,6 @@ gem "mysql", ">= 2.8.1" # AP gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git" gem "rack-mount", :git => "git://github.com/rails/rack-mount.git" -gem "rack-test", ">= 0.5.0" -gem "erubis", ">= 2.6.5" gem "RedCloth", ">= 4.2.2" if ENV['CI'] diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index ae5985120e..2c534642ab 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.add_dependency('rack', '~> 1.0.1') s.add_dependency('rack-test', '~> 0.5.0') s.add_dependency('rack-mount', '~> 0.0.1') - s.add_dependency('erubis', '~> 2.6.0') + s.add_dependency('erubis', '~> 2.6.5') s.require_path = 'lib' s.autorequire = 'action_controller' -- cgit v1.2.3 From 74e1ff9dc2ebd86c783a274710e2f762059e818b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 03:32:35 -0800 Subject: Loosen optional gem deps from ~> to >= --- activesupport/lib/active_support/vendor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index 4a711b7e25..eb5080888c 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -9,7 +9,7 @@ end unless ActiveSupport.requirable? lib # Try to activate a gem ~> satisfying the requested version first. begin - gem lib, "~> #{version}" + gem lib, ">= #{version}" # Use the vendored lib if the gem's missing or we aren't using RubyGems. rescue LoadError, NoMethodError # There could be symlinks -- cgit v1.2.3 From bc1538e9951847dd4d1d7e37816d91b791862a0c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 14 Nov 2009 11:37:06 -0800 Subject: Repair time dependencies --- activesupport/lib/active_support/core_ext/date/conversions.rb | 3 --- activesupport/lib/active_support/json/encoding.rb | 2 +- activesupport/lib/active_support/time.rb | 3 +++ activesupport/lib/active_support/time_with_zone.rb | 8 -------- activesupport/test/core_ext/range_ext_test.rb | 2 +- activesupport/test/json/decoding_test.rb | 1 + activesupport/test/message_encryptor_test.rb | 1 + activesupport/test/message_verifier_test.rb | 2 ++ 8 files changed, 9 insertions(+), 13 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb index b41ad5b686..f6c870035b 100644 --- a/activesupport/lib/active_support/core_ext/date/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date/conversions.rb @@ -1,7 +1,4 @@ require 'active_support/inflector' -require 'active_support/core_ext/time/conversions' -require 'active_support/core_ext/date_time/conversions' -require 'active_support/values/time_zone' class Date DATE_FORMATS = { diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index 8e8f9022c1..3c15056c41 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -6,7 +6,7 @@ require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/object/instance_variables' require 'active_support/deprecation' -require 'active_support/time_with_zone' +require 'active_support/time' # Hack to load json gem first so we can overwrite its to_json. begin diff --git a/activesupport/lib/active_support/time.rb b/activesupport/lib/active_support/time.rb index 1362f6997c..0f421421d0 100644 --- a/activesupport/lib/active_support/time.rb +++ b/activesupport/lib/active_support/time.rb @@ -29,3 +29,6 @@ require 'active_support/core_ext/date_time/acts_like' require 'active_support/core_ext/date_time/calculations' require 'active_support/core_ext/date_time/conversions' require 'active_support/core_ext/date_time/zones' + +require 'active_support/core_ext/integer/time' +require 'active_support/core_ext/numeric/time' diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index a64128e49e..8cd5c1de63 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -1,11 +1,3 @@ -require 'active_support/duration' -require 'active_support/values/time_zone' -require 'active_support/core_ext/numeric/time' -require 'active_support/core_ext/integer/time' -require 'active_support/core_ext/time/conversions' -require 'active_support/core_ext/date/conversions' -require 'active_support/core_ext/date_time/conversions' - module ActiveSupport # A Time-like class that can represent a time in any time zone. Necessary because standard Ruby Time instances are # limited to UTC and the system's ENV['TZ'] zone. diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index 2565c56b8a..5701eeef28 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' +require 'active_support/time' require 'active_support/core_ext/range' -require 'active_support/core_ext/date/conversions' class RangeTest < Test::Unit::TestCase def test_to_s_from_dates diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb index 7b5a4d0416..8fcb16abfb 100644 --- a/activesupport/test/json/decoding_test.rb +++ b/activesupport/test/json/decoding_test.rb @@ -1,6 +1,7 @@ # encoding: UTF-8 require 'abstract_unit' require 'active_support/json' +require 'active_support/time' require 'active_support/core_ext/kernel/reporting' class TestJSONDecoding < ActiveSupport::TestCase diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb index ed3461571a..5c2b44f188 100644 --- a/activesupport/test/message_encryptor_test.rb +++ b/activesupport/test/message_encryptor_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'active_support/time' class MessageEncryptorTest < Test::Unit::TestCase def setup diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb index ef300e4e26..714a3b3a39 100644 --- a/activesupport/test/message_verifier_test.rb +++ b/activesupport/test/message_verifier_test.rb @@ -7,6 +7,8 @@ rescue LoadError, NameError $stderr.puts "Skipping MessageVerifier test: broken OpenSSL install" else +require 'active_support/time' + class MessageVerifierTest < Test::Unit::TestCase def setup @verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!") -- cgit v1.2.3 From cc011bc2bef98bf8b1dc78351f243af7ad641269 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sat, 14 Nov 2009 19:33:58 -0800 Subject: Add TimeZone dependency --- activesupport/lib/active_support/time_with_zone.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 8cd5c1de63..8304f6c434 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -1,3 +1,5 @@ +require "active_support/values/time_zone" + module ActiveSupport # A Time-like class that can represent a time in any time zone. Necessary because standard Ruby Time instances are # limited to UTC and the system's ENV['TZ'] zone. -- cgit v1.2.3 From 7601d482bd187bdd06d3aa7ac1e8c7bb805f40a3 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 15 Nov 2009 10:28:48 -0800 Subject: Ruby 1.9: skip pg locking test for 1.9.1 also --- activerecord/test/cases/locking_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 7e51526370..f946e8699e 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -283,7 +283,7 @@ unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter) end # Hit by ruby deadlock detection since connection checkout is mutexed. - if RUBY_VERSION < '1.9.2' + if RUBY_VERSION < '1.9.0' def test_second_lock_waits assert [0.2, 1, 5].any? { |zzz| first, second = duel(zzz) { Person.find 1, :lock => true } -- cgit v1.2.3 From 7fadb3f261fc7cc753d303d0fbe2cbf019385f99 Mon Sep 17 00:00:00 2001 From: Will Read Date: Wed, 7 Oct 2009 18:47:26 -0700 Subject: Allow explicit placement of hidden id element for nested models. [#3259 state:resolved] Signed-off-by: Eloy Duran --- actionpack/lib/action_view/helpers/form_helper.rb | 13 ++++- actionpack/test/template/form_helper_test.rb | 66 +++++++++++++++++++---- 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index c46b39fc23..d0c66eda60 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -963,7 +963,7 @@ module ActionView end end - (field_helpers - %w(label check_box radio_button fields_for)).each do |selector| + (field_helpers - %w(label check_box radio_button fields_for hidden_field)).each do |selector| src = <<-end_src def #{selector}(method, options = {}) # def text_field(method, options = {}) @template.send( # @template.send( @@ -1022,6 +1022,11 @@ module ActionView def radio_button(method, tag_value, options = {}) @template.radio_button(@object_name, method, tag_value, objectify_options(options)) end + + def hidden_field(method, options = {}) + @emitted_hidden_id = true if method == :id + @template.hidden_field(@object_name, method, objectify_options(options)) + end def error_message_on(method, *args) @template.error_message_on(@object, method, *args) @@ -1035,6 +1040,10 @@ module ActionView @template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit")) end + def emitted_hidden_id? + @emitted_hidden_id + end + private def objectify_options(options) @default_options.merge(options.merge(:object => @object)) @@ -1069,8 +1078,8 @@ module ActionView @template.fields_for(name, object, *args, &block) else @template.fields_for(name, object, *args) do |builder| - @template.concat builder.hidden_field(:id) block.call(builder) + @template.concat builder.hidden_field(:id) unless builder.emitted_hidden_id? end end end diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 04c635e770..44734abb18 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -611,6 +611,26 @@ class FormHelperTest < ActionView::TestCase end end + expected = '
' + + '' + + '' + + '' + + '
' + + assert_dom_equal expected, output_buffer + end + + def test_nested_fields_for_with_existing_records_on_a_nested_attributes_one_to_one_association_with_explicit_hidden_field_placement + @post.author = Author.new(321) + + form_for(:post, @post) do |f| + concat f.text_field(:title) + f.fields_for(:author) do |af| + concat af.hidden_field(:id) + concat af.text_field(:name) + end + end + expected = '
' + '' + '' + @@ -632,6 +652,30 @@ class FormHelperTest < ActionView::TestCase end end + expected = '' + + '' + + '' + + '' + + '' + + '' + + '
' + + assert_dom_equal expected, output_buffer + end + + def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association_with_explicit_hidden_field_placement + @post.comments = Array.new(2) { |id| Comment.new(id + 1) } + + form_for(:post, @post) do |f| + concat f.text_field(:title) + @post.comments.each do |comment| + f.fields_for(:comments, comment) do |cf| + concat cf.hidden_field(:id) + concat cf.text_field(:name) + end + end + end + expected = '
' + '' + '' + @@ -678,8 +722,8 @@ class FormHelperTest < ActionView::TestCase expected = '' + '' + - '' + '' + + '' + '' + '
' @@ -713,10 +757,10 @@ class FormHelperTest < ActionView::TestCase expected = '
' + '' + - '' + '' + - '' + + '' + '' + + '' + '
' assert_dom_equal expected, output_buffer @@ -736,8 +780,8 @@ class FormHelperTest < ActionView::TestCase expected = '
' + '' + - '' + '' + + '' + '' + '
' @@ -755,8 +799,8 @@ class FormHelperTest < ActionView::TestCase end expected = '
' + - '' + '' + + '' + '
' assert_dom_equal expected, output_buffer @@ -790,18 +834,18 @@ class FormHelperTest < ActionView::TestCase end expected = '
' + - '' + '' + - '' + '' + - '' + + '' + + '' + '' + - '' + '' + - '' + + '' + + '' + '' + - '' + '' + + '' + + '' + '
' assert_dom_equal expected, output_buffer -- cgit v1.2.3 From c1f51680736a8c627c929895c17770768142f735 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 16 Nov 2009 12:29:38 -0800 Subject: Temporarily add submodules to the Rails repo for Arel and Rack::Mount. These submodules will be removed once we add proper Gemfile following to bundler --- .gitmodules | 6 ++++++ arel | 1 + rack-mount | 1 + 3 files changed, 8 insertions(+) create mode 100644 .gitmodules create mode 160000 arel create mode 160000 rack-mount diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..20ed3ed9c9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "arel"] + path = arel + url = git://github.com/rails/arel.git +[submodule "rack-mount"] + path = rack-mount + url = git://github.com/rails/rack-mount.git diff --git a/arel b/arel new file mode 160000 index 0000000000..0faeb50474 --- /dev/null +++ b/arel @@ -0,0 +1 @@ +Subproject commit 0faeb5047407348533db952d9cf93ea59d2526dc diff --git a/rack-mount b/rack-mount new file mode 160000 index 0000000000..3784e633b4 --- /dev/null +++ b/rack-mount @@ -0,0 +1 @@ +Subproject commit 3784e633b42f43a4131e02519be60080d179da21 -- cgit v1.2.3 From 2675ba9ef4ae1839f721aff77c255ee1cb8ac7ac Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 16 Nov 2009 12:37:43 -0800 Subject: Require action_dispatch, not action_controller --- railties/lib/rails/commands/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index 29359e49a4..37dfa3b9bb 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -1,4 +1,4 @@ -require 'action_controller' +require 'action_dispatch' require 'fileutils' require 'optparse' -- cgit v1.2.3 From c2997017f79321a8d90af84b1de35f87e3dd2445 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 16 Nov 2009 13:58:08 -0800 Subject: Make script/server work with correct application.rb --- railties/lib/rails/application.rb | 5 +++++ railties/lib/rails/commands/server.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 10cba8ab6c..7c2d8eab67 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -3,6 +3,11 @@ module Rails include Initializable class << self + def inherited(klass) + Rails.application ||= klass unless klass.name =~ /Rails/ + super + end + # Stub out App initialize def initialize! new diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index 37dfa3b9bb..2c90851fb2 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -42,7 +42,7 @@ unless server end puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}" -puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}}" +puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}" if options[:detach] Process.daemon -- cgit v1.2.3