diff options
| -rwxr-xr-x | bin/bundle | 3 | ||||
| -rwxr-xr-x | bin/rails | 6 | ||||
| -rwxr-xr-x | bin/rake | 5 | ||||
| -rw-r--r-- | config/application.rb | 38 | ||||
| -rw-r--r-- | config/boot.rb | 4 | ||||
| -rw-r--r-- | config/environment.rb | 7 | ||||
| -rw-r--r-- | config/environments/development.rb | 38 | ||||
| -rw-r--r-- | config/environments/production.rb | 80 | ||||
| -rw-r--r-- | config/environments/test.rb | 55 | ||||
| -rw-r--r-- | config/initializers/assets.rb | 8 | ||||
| -rw-r--r-- | config/initializers/cookies_serializer.rb | 3 | ||||
| -rw-r--r-- | config/initializers/devise.rb | 2 | ||||
| -rw-r--r-- | config/initializers/inflections.rb | 11 | ||||
| -rw-r--r-- | config/initializers/session_store.rb | 7 | ||||
| -rw-r--r-- | config/secrets.yml | 24 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 7 |
16 files changed, 124 insertions, 174 deletions
diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 000000000..66e9889e8 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') @@ -1,10 +1,8 @@ -#!/usr/bin/env jruby +#!/usr/bin/env ruby begin load File.expand_path("../spring", __FILE__) rescue LoadError end -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +require_relative '../config/boot' require 'rails/commands' @@ -3,5 +3,6 @@ begin load File.expand_path("../spring", __FILE__) rescue LoadError end -require 'bundler/setup' -load Gem.bin_path('rake', 'rake') +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/config/application.rb b/config/application.rb index 7c0a6c42a..52da477a5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,15 +2,7 @@ require File.expand_path('../boot', __FILE__) ENV['RANSACK_FORM_BUILDER'] = '::SimpleForm::FormBuilder' - -# Pick the frameworks you want: -require "active_model/railtie" -require "active_record/railtie" -require "action_controller/railtie" -require "action_mailer/railtie" -require "action_view/railtie" -require "sprockets/railtie" -# require "rails/test_unit/railtie" +require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -19,46 +11,20 @@ Bundler.require(*Rails.groups) module ChouetteIhm class Application < Rails::Application - config.generators do |g| - g.test_framework :rspec - end - # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += %W(#{config.root}/lib) - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - # custom exception pages config.exceptions_app = self.routes # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - config.time_zone = "Paris" + config.time_zone = 'Paris' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = :fr - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - end end diff --git a/config/boot.rb b/config/boot.rb index 4489e5868..5e5f0c1fa 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,4 @@ -require 'rubygems' - # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/environment.rb b/config/environment.rb index 4524c894c..f9896ef9d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,9 +1,8 @@ -# Load the rails application +# Load the Rails application. require File.expand_path('../application', __FILE__) - -# Initialize the rails application -ChouetteIhm::Application.initialize! +# Initialize the Rails application. +Rails.application.initialize! # Fix version APP_VERSION = '2.5.2' diff --git a/config/environments/development.rb b/config/environments/development.rb index 8398242e6..f74798e78 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,26 +1,22 @@ -# ENV["CHOUETTE_RUN_MIGRATIONS"] = "true" -ChouetteIhm::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Don't care if the mailer can't send + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - # Print deprecation notices to the Rails logger + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. @@ -31,7 +27,7 @@ ChouetteIhm::Application.configure do # number of complex assets. config.assets.debug = true - # Adds additional error checking when serving assets at runtime. + # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true @@ -39,11 +35,6 @@ ChouetteIhm::Application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true - # uncomment to show chouette error view in development - #config.consider_all_requests_local = false - - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - # replace this with your production tracker code GA.tracker = "UA-AAAAAAAA" @@ -62,25 +53,27 @@ ChouetteIhm::Application.configure do # config.company_theme = "#32adb0" # config.company_contact = "http://www.cityway.fr/contact/?rub_code=14" # config.accept_user_creation = false - + # file to data for demo config.demo_data = "tmp/demo.zip" - + # link to validation specification pages config.validation_spec = "http://www.chouette.mobi/neptune-validation/v20/" + config.action_mailer.default_url_options = { :host => 'localhost:3000' } + # Configure the e-mail address which will be shown in Devise::Maile config.mailer_sender = "appli@chouette.mobi" - config.action_mailer.delivery_method = :sendmail + config.action_mailer.delivery_method = :sendmail # change to true to allow email to be sent during development config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.default :charset => "utf-8" - + # api key to geoportail IGN (development key 3 month validity) # config.geoportail_api_key = "f1t6wihbh98njlbaf5cuzxy4" - + config.to_prepare do Devise::Mailer.layout "mailer" #ApplicationMap.ign_api_key = "i2aqyge3x3iovnuhz7z06flp" @@ -91,7 +84,6 @@ ChouetteIhm::Application.configure do Chouette::Command.command = "true" end end - + config.i18n.available_locales = [:fr, :en] - end diff --git a/config/environments/production.rb b/config/environments/production.rb index fbc3b3330..fab960e90 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,7 +1,7 @@ -ChouetteIhm::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. - # Code is not reloaded between requests + # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and @@ -29,12 +29,11 @@ ChouetteIhm::Application.configure do # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs + # Generate digests for assets URLs. config.assets.digest = true - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' - + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx @@ -57,10 +56,6 @@ ChouetteIhm::Application.configure do # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) - # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false @@ -80,7 +75,7 @@ ChouetteIhm::Application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - + # Use a different logger for distributed setups #if ENV['OS'] == 'Windows_NT' # # args = log_path,number of files,file sizes @@ -91,52 +86,33 @@ ChouetteIhm::Application.configure do logger.level = Logger::INFO end #end - + if ENV['CHOUETTE_BASE_URL'].nil? - config.action_mailer.default_url_options = { :host => 'my-domain-name.com' } + config.action_mailer.default_url_options = { :host => 'my-domain-name.com' } else - config.action_mailer.default_url_options = { :host => ENV['CHOUETTE_BASE_URL'] } + config.action_mailer.default_url_options = { :host => ENV['CHOUETTE_BASE_URL'] } end # Configure the e-mail address which will be shown in Devise::Maile if ENV['CHOUETTE_MAIL_SENDER'].nil? - config.mailer_sender = "chouette-production@my-domain-name.com" - else - config.mailer_sender = ENV['CHOUETTE_MAIL_SENDER'] - end - - # mailer configuration : - # by default : set to smtp on windows platforms and sendmail on unix one - # may be changed as convenience - #if ENV['OS'] == 'Windows_NT' - # ## using SMTP (maybe useful for Windows or VM platforms): - # ActionMailer::Base.delivery_method = :smtp - # ActionMailer::Base.smtp_settings = { - # :address => "smtp.sample.com", - # :domain => "sample.com", - # :user_name => "username", - # } - #else - mailer = "" - if ENV['CHOUETTE_MAILER'].nil? - mailer = "smtp" + config.mailer_sender = "chouette-production@my-domain-name.com" else - mailer = ENV['CHOUETTE_MAILER'] + config.mailer_sender = ENV['CHOUETTE_MAIL_SENDER'] end if mailer == "smtp" if ENV['CHOUETTE_SMTP_USER'].nil? ActionMailer::Base.smtp_settings = { - :address => ENV['CHOUETTE_SMTP_ADDRESS'].nil? ? "smtp.sample.com" : ENV['CHOUETTE_SMTP_ADDRESS'], - :port => ENV['CHOUETTE_SMTP_PORT'].nil? ? 25 : ENV['CHOUETTE_SMTP_PORT'].to_i, - :domain => ENV['CHOUETTE_SMTP_DOMAIN'].nil? ? "sample.com" : ENV['CHOUETTE_SMTP_DOMAIN'] } + :address => ENV['CHOUETTE_SMTP_ADDRESS'].nil? ? "smtp.sample.com" : ENV['CHOUETTE_SMTP_ADDRESS'], + :port => ENV['CHOUETTE_SMTP_PORT'].nil? ? 25 : ENV['CHOUETTE_SMTP_PORT'].to_i, + :domain => ENV['CHOUETTE_SMTP_DOMAIN'].nil? ? "sample.com" : ENV['CHOUETTE_SMTP_DOMAIN'] } else ActionMailer::Base.smtp_settings = { - :address => ENV['CHOUETTE_SMTP_ADDRESS'], - :port => ENV['CHOUETTE_SMTP_PORT'].nil? ? 25 : ENV['CHOUETTE_SMTP_PORT'].to_i, - :domain => ENV['CHOUETTE_SMTP_DOMAIN'], - :user_name => ENV['CHOUETTE_SMTP_USER'], - :password => ENV['CHOUETTE_SMTP_PASSWORD'], - :authentication => ENV['CHOUETTE_SMTP_AUTH'] } + :address => ENV['CHOUETTE_SMTP_ADDRESS'], + :port => ENV['CHOUETTE_SMTP_PORT'].nil? ? 25 : ENV['CHOUETTE_SMTP_PORT'].to_i, + :domain => ENV['CHOUETTE_SMTP_DOMAIN'], + :user_name => ENV['CHOUETTE_SMTP_USER'], + :password => ENV['CHOUETTE_SMTP_PASSWORD'], + :authentication => ENV['CHOUETTE_SMTP_AUTH'] } end end #end @@ -144,14 +120,14 @@ ChouetteIhm::Application.configure do # replace this with your production tracker code # replace this with your production tracker code if ENV['CHOUETTE_GOOGLE_ANALYTICS'].nil? - GA.tracker = "UA-AAAAAAAA" + GA.tracker = "UA-AAAAAAAA" else - GA.tracker = ENV['CHOUETTE_GOOGLE_ANALYTICS'] + GA.tracker = ENV['CHOUETTE_GOOGLE_ANALYTICS'] end - + # api key to geoportail IGN (production key link to application url root referer) if !ENV['CHOUETTE_GEOPORTAIL_KEY'].nil? - config.geoportail_api_key = ENV['CHOUETTE_GEOPORTAIL_KEY'] + config.geoportail_api_key = ENV['CHOUETTE_GEOPORTAIL_KEY'] end # Specific theme for each company @@ -166,13 +142,13 @@ ChouetteIhm::Application.configure do # config.company_theme = "#32adb0" # config.company_contact = "http://www.cityway.fr/contact/?rub_code=14" # config.accept_user_creation = false - + # file to data for demo config.demo_data = ENV['CHOUETTE_DEMO_DATA'].nil? ? "/path/to/demo.zip" : ENV['CHOUETTE_DEMO_DATA'] - + # link to validation specification pages config.validation_spec = "http://www.chouette.mobi/neptune-validation/v20/" - + # paths for external resources config.to_prepare do Devise::Mailer.layout "mailer" diff --git a/config/environments/test.rb b/config/environments/test.rb index a138599bb..e878822cd 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,49 +1,37 @@ -ChouetteIhm::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that + # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! + # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true + # Configure static asset server for tests with Cache-Control for performance. + config.serve_static_assets = true + config.static_cache_control = 'public, max-age=3600' - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Raise exceptions instead of rendering exception templates + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Configure the e-mail address which will be shown in Devise::Maile - config.mailer_sender = "appli@chouette.mobi" + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raises error for missing translations @@ -51,10 +39,10 @@ ChouetteIhm::Application.configure do # replace this with your production tracker code GA.tracker = "UA-AAAAAAAA" - + # api key to geoportail IGN (production key link to application url root referer) config.geoportail_api_key = "aaaaaaaaaaaaaa" - + # Specific theme for each company # AFIMB config.company_name = "afimb" @@ -70,13 +58,24 @@ ChouetteIhm::Application.configure do # file to data for demo config.demo_data = "tmp/demo.zip" - + # link to validation specification pages config.validation_spec = "http://www.chouette.mobi/neptune-validation/v20/" + config.action_mailer.default_url_options = { :host => 'localhost:3000' } + + # Configure the e-mail address which will be shown in Devise::Maile + config.mailer_sender = "appli@chouette.mobi" + + config.action_mailer.delivery_method = :sendmail + # change to true to allow email to be sent during development + config.action_mailer.perform_deliveries = false + config.action_mailer.raise_delivery_errors = false + config.action_mailer.default :charset => "utf-8" + config.to_prepare do Chouette::Command.command = "true" end - + config.i18n.available_locales = [:fr, :en] end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 000000000..d2f4ec33a --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..ac5f8b663 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :marshal diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index c3f251477..8553853c4 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -10,7 +10,7 @@ Devise.setup do |config| # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - config.mailer_sender = ChouetteIhm::Application.config.mailer_sender + config.mailer_sender = Rails.application.config.mailer_sender # Configure the class responsible to send e-mails. # config.mailer = "Devise::Mailer" diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 100171d40..5f618b7d5 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format -# (all these examples are active by default): -ActiveSupport::Inflector.inflections do |inflect| +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' @@ -11,3 +12,7 @@ ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'réseau', 'réseaux' end +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index a5cc92f42..67a518005 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,8 +1,3 @@ # Be sure to restart your server when you modify this file. -ChouetteIhm::Application.config.session_store :cookie_store, :key => '_chouette_ihm_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# ChouetteIhm::Application.config.session_store :active_record_store +Rails.application.config.session_store :cookie_store, key: '_chouette_ihm_session' diff --git a/config/secrets.yml b/config/secrets.yml index f05cb338c..e3d675f54 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -1,8 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + development: - secret_key_base: '6077b8f7e765718f4b9bcd963dd859c412a96a19db8ba71d6dc2aad7316ff20150c945e0e61aa727fc0a373e884d3f91de372cc913e532a01558d9263e587539' - + secret_key_base: e901adb90fc1fff22f7237d138ef232a5425b67e81ccb3ce7003aab2c002d35a7c3d593c0fca3dcb21e8c911a8260c984a830d1d61776ad3005eb373abebc695 + test: - secret_key_base: '6077b8f7e765718f4b9bcd963dd859c412a96a19db8ba71d6dc2aad7316ff20150c945e0e61aa727fc0a373e884d3f91de372cc913e532a01558d9263e587539' - + secret_key_base: 54f61aab23322611dd0bbf73b7f034db34281f7f4b3c4992eaaff20ecc9673bbd467beaa6fcb48379ca69b80bc5662deac4e33ca144f2482146123d3e966016a + +# Do not keep production secrets in the repository, +# instead read values from the environment. production: - secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
\ No newline at end of file + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 21dbac2ff..1f9c353dc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,13 +8,6 @@ require 'rspec/rails' require 'capybara/rspec' require 'capybara/rails' require 'capybara/poltergeist' - -# FIXME FactoryGirl not found in jenkins build #13 -unless defined?(FactoryGirl) - require 'factory_girl' - require 'spec/factories.rb' -end -require 'chouette_factories' require 'georuby-ext' require 'will_paginate/array' |
