From cb7b56ab4995beb301ad38b18eb3fa4c64c0c762 Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Tue, 13 May 2014 17:56:52 +0200 Subject: [PATCH] rename CTT2013 class to CTT2013::Application --- application.rb | 6 ++++-- config.ru | 2 +- helpers/collection_filtering_helpers.rb | 2 +- helpers/data_presentation_helpers.rb | 2 +- helpers/form_helpers.rb | 2 +- helpers/google_maps_helpers.rb | 2 +- helpers/html_helpers.rb | 2 +- helpers/init.rb | 2 +- helpers/localisation_helpers.rb | 2 +- helpers/model_presentation_helpers.rb | 2 +- helpers/url_helpers.rb | 2 +- helpers/view_pagination_helpers.rb | 2 +- helpers/view_presentation_choice_helpers.rb | 2 +- init.rb | 1 + lib/for_sass.rb | 4 ++-- models/init.rb | 2 +- route_handlers/constants.rb | 2 +- route_handlers/filters.rb | 2 +- route_handlers/organiser_connexion.rb | 2 +- route_handlers/params_processing.rb | 2 +- route_handlers/private_methods.rb | 2 +- route_handlers/public.rb | 2 +- tests/tests.rb | 4 ++-- 23 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 init.rb diff --git a/application.rb b/application.rb index 6ee4903..7713a4b 100755 --- a/application.rb +++ b/application.rb @@ -36,7 +36,9 @@ require 'active_record' -class CTT2013 < Sinatra::Base +require_relative 'init' + +class CTT2013::Application < Sinatra::Base # Settings # ======== @@ -109,5 +111,5 @@ class CTT2013 < Sinatra::Base require_relative 'route_handlers/init' if __FILE__ == $0 - CTT2013.run! + CTT2013::Application.run! end diff --git a/config.ru b/config.ru index c67d135..57dfaee 100644 --- a/config.ru +++ b/config.ru @@ -22,4 +22,4 @@ require File.expand_path('application.rb', File.dirname(__FILE__)) # filter. use ActiveRecord::ConnectionAdapters::ConnectionManagement -run CTT2013.new +run CTT2013::Application.new diff --git a/helpers/collection_filtering_helpers.rb b/helpers/collection_filtering_helpers.rb index ed6e128..8a831b8 100644 --- a/helpers/collection_filtering_helpers.rb +++ b/helpers/collection_filtering_helpers.rb @@ -2,7 +2,7 @@ require './lib/nested_arrays' -class CTT2013 +class CTT2013::Application module CollectionFilteringHelpers def smart_filtering_fields(filtering_by, filtering_values, diff --git a/helpers/data_presentation_helpers.rb b/helpers/data_presentation_helpers.rb index c0cd561..7f101c4 100644 --- a/helpers/data_presentation_helpers.rb +++ b/helpers/data_presentation_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module DataPresentationHelpers module_function diff --git a/helpers/form_helpers.rb b/helpers/form_helpers.rb index f397dab..52bfcc9 100644 --- a/helpers/form_helpers.rb +++ b/helpers/form_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module FormHelpers def input_tag(type, name, value = nil, options = {}) diff --git a/helpers/google_maps_helpers.rb b/helpers/google_maps_helpers.rb index aa290f4..fb81dc4 100644 --- a/helpers/google_maps_helpers.rb +++ b/helpers/google_maps_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module GoogleMapsHelpers module_function def map_url_for_address(address) diff --git a/helpers/html_helpers.rb b/helpers/html_helpers.rb index 816ecbb..85b18f7 100644 --- a/helpers/html_helpers.rb +++ b/helpers/html_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module HTMLHelpers module_function diff --git a/helpers/init.rb b/helpers/init.rb index 939716c..4a074a7 100644 --- a/helpers/init.rb +++ b/helpers/init.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application require_relative 'url_helpers' helpers URLHelpers diff --git a/helpers/localisation_helpers.rb b/helpers/localisation_helpers.rb index 20a59e1..280936f 100644 --- a/helpers/localisation_helpers.rb +++ b/helpers/localisation_helpers.rb @@ -2,7 +2,7 @@ require 'i18n' # Internationalisation -class CTT2013 +class CTT2013::Application module LocalisationHelpers module_function diff --git a/helpers/model_presentation_helpers.rb b/helpers/model_presentation_helpers.rb index 705600e..3c037ef 100644 --- a/helpers/model_presentation_helpers.rb +++ b/helpers/model_presentation_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module ModelPresentationHelpers module AbstractSmarterModelHelpers def title_from_model_name(model) diff --git a/helpers/url_helpers.rb b/helpers/url_helpers.rb index 0b2007d..cf559c2 100644 --- a/helpers/url_helpers.rb +++ b/helpers/url_helpers.rb @@ -2,7 +2,7 @@ require 'i18n' # Internationalisation -class CTT2013 +class CTT2013::Application module URLHelpers # Patched url helper to work around missing sub URI part def fixed_url(path) diff --git a/helpers/view_pagination_helpers.rb b/helpers/view_pagination_helpers.rb index a19dfc8..43acac5 100644 --- a/helpers/view_pagination_helpers.rb +++ b/helpers/view_pagination_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module ViewPaginationHelpers def paginating_form(page_count = 1, paginating_parameters = {}, options = {}) per_page = paginating_parameters[:per_page] || 1 diff --git a/helpers/view_presentation_choice_helpers.rb b/helpers/view_presentation_choice_helpers.rb index 1c9f6ca..f74aca5 100644 --- a/helpers/view_presentation_choice_helpers.rb +++ b/helpers/view_presentation_choice_helpers.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application module ViewPresentationChoiceHelpers def presentation_choice_form(available_formats, current_format, options = {}) params_key_prefix = options[:params_key_prefix] || 'view' diff --git a/init.rb b/init.rb new file mode 100644 index 0000000..a2025b3 --- /dev/null +++ b/init.rb @@ -0,0 +1 @@ +CTT2013 = Module.new diff --git a/lib/for_sass.rb b/lib/for_sass.rb index ecfd8cf..74f3783 100644 --- a/lib/for_sass.rb +++ b/lib/for_sass.rb @@ -7,12 +7,12 @@ # module ::Sass::Script::Functions def banner_url - url = CTT2013::URLHelpers.simple_fixed_url('/images/bannerToulouse.jpg') + url = CTT2013::Application::URLHelpers.simple_fixed_url('/images/bannerToulouse.jpg') ::Sass::Script::String.new("url('#{ url }');") end def footer_home_button_background_url - url = CTT2013::URLHelpers.simple_fixed_url('/images/capitole.jpg') + url = CTT2013::Application::URLHelpers.simple_fixed_url('/images/capitole.jpg') ::Sass::Script::String.new("url('#{ url }');") end end diff --git a/models/init.rb b/models/init.rb index 2af7e67..3b66d67 100644 --- a/models/init.rb +++ b/models/init.rb @@ -6,7 +6,7 @@ require_relative 'models' -class CTT2013 +class CTT2013::Application environment = settings.environment ActiveRecord::Base.logger = Logger.new("log/#{ environment }.log") diff --git a/route_handlers/constants.rb b/route_handlers/constants.rb index aadfcd7..4405f74 100644 --- a/route_handlers/constants.rb +++ b/route_handlers/constants.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application # Pages # ----- diff --git a/route_handlers/filters.rb b/route_handlers/filters.rb index 37c9540..7b7f89a 100644 --- a/route_handlers/filters.rb +++ b/route_handlers/filters.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 < Sinatra::Base +class CTT2013::Application < Sinatra::Base # Set locale before '/:loc/*' do |loc, path| diff --git a/route_handlers/organiser_connexion.rb b/route_handlers/organiser_connexion.rb index 6835caa..499dadc 100644 --- a/route_handlers/organiser_connexion.rb +++ b/route_handlers/organiser_connexion.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 < Sinatra::Base +class CTT2013::Application < Sinatra::Base # == Authentication User model # ============================ diff --git a/route_handlers/params_processing.rb b/route_handlers/params_processing.rb index 7bc7881..7a9934d 100644 --- a/route_handlers/params_processing.rb +++ b/route_handlers/params_processing.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application private def view_parameters_from_params(submitted_view_parameters = params['view']) diff --git a/route_handlers/private_methods.rb b/route_handlers/private_methods.rb index f013d45..8bd7a9e 100644 --- a/route_handlers/private_methods.rb +++ b/route_handlers/private_methods.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 +class CTT2013::Application private diff --git a/route_handlers/public.rb b/route_handlers/public.rb index 6835172..2f5cad9 100644 --- a/route_handlers/public.rb +++ b/route_handlers/public.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 (magic comment) -class CTT2013 < Sinatra::Base +class CTT2013::Application < Sinatra::Base # Handlers # ======== diff --git a/tests/tests.rb b/tests/tests.rb index f423932..017beaa 100644 --- a/tests/tests.rb +++ b/tests/tests.rb @@ -4,11 +4,11 @@ ENV['RACK_ENV'] = 'test' -describe 'Test CTT2013 application' do +describe 'Test CTT2013::Application application' do include Rack::Test::Methods def self.app - CTT2013 + CTT2013::Application end def app