From: Tom Hughes Date: Fri, 2 Jun 2017 14:38:45 +0000 (+0100) Subject: Move monkey patch modules to the OpenStreetMap namespace X-Git-Tag: live~3390 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/f8f7054fc2348378dacb244fa4f3192952fb34fe Move monkey patch modules to the OpenStreetMap namespace Having them in the OSM namespace risks blocking autoloading of the lib/osm.rb code by defining the OSM constant. --- diff --git a/config/initializers/abstract_adapter.rb b/config/initializers/abstract_adapter.rb index 290e2493d..2bc4f5e59 100644 --- a/config/initializers/abstract_adapter.rb +++ b/config/initializers/abstract_adapter.rb @@ -1,5 +1,5 @@ if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdapter) - module OSM + module OpenStreetMap module AbstractAdapter module PropagateTimeouts def translate_exception_class(e, sql) @@ -13,5 +13,5 @@ if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdapter) end end - ActiveRecord::ConnectionAdaptors::AbstractAdapter.prepend(OSM::AbstractAdapter::PropagateTimeouts) + ActiveRecord::ConnectionAdaptors::AbstractAdapter.prepend(OpenStreetMap::AbstractAdapter::PropagateTimeouts) end diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index fff69378b..89ff677fb 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -11,7 +11,7 @@ module I18n end end -module OSM +module OpenStreetMap module I18n module NormaliseLocales def store_translations(locale, data, options = {}) @@ -31,8 +31,8 @@ module OSM end end -I18n::Backend::Simple.prepend(OSM::I18n::NormaliseLocales) -I18n::JS::FallbackLocales.prepend(OSM::I18n::ValidateLocales) +I18n::Backend::Simple.prepend(OpenStreetMap::I18n::NormaliseLocales) +I18n::JS::FallbackLocales.prepend(OpenStreetMap::I18n::ValidateLocales) I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback) I18n::Backend::Simple.include(I18n::Backend::Fallbacks) diff --git a/config/initializers/router.rb b/config/initializers/router.rb index 0987fa018..4357a87f2 100644 --- a/config/initializers/router.rb +++ b/config/initializers/router.rb @@ -1,7 +1,7 @@ # Some versions of ruby seem to accidentally force the encoding # as part of normalize_path and some don't -module OSM +module OpenStreetMap module Router module ForceEncoding def normalize_path(path) @@ -11,4 +11,4 @@ module OSM end end -ActionDispatch::Journey::Router::Utils.singleton_class.prepend(OSM::Router::ForceEncoding) +ActionDispatch::Journey::Router::Utils.singleton_class.prepend(OpenStreetMap::Router::ForceEncoding) diff --git a/lib/migrate.rb b/lib/migrate.rb index b16fa523c..182a2a086 100644 --- a/lib/migrate.rb +++ b/lib/migrate.rb @@ -1,4 +1,4 @@ -module OSM +module OpenStreetMap module ActiveRecord module AbstractAdapter def add_index_options(table_name, column_name, options = {}) @@ -41,5 +41,5 @@ module OSM end end -ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(OSM::ActiveRecord::AbstractAdapter) -ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(OSM::ActiveRecord::PostgreSQLAdapter) +ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(OpenStreetMap::ActiveRecord::AbstractAdapter) +ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(OpenStreetMap::ActiveRecord::PostgreSQLAdapter)