aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMarc Florisson2012-06-01 12:20:57 +0200
committerMarc Florisson2012-06-01 12:20:57 +0200
commitee866a45955bac5cef7a8bdec58f86ffcb7cb702 (patch)
treee66d3da0e628034afc362b524b52a1a71977f4ff /config
parent7fd20ad1409398e06fb1167332c57b4ac4c9aadc (diff)
parent7082d66ec221aee194d64a17ab5d21eb2955f419 (diff)
downloadchouette-core-ee866a45955bac5cef7a8bdec58f86ffcb7cb702.tar.bz2
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
Diffstat (limited to 'config')
-rw-r--r--config/environments/production.rb2
-rw-r--r--config/initializers/apartment.rb2
-rw-r--r--config/initializers/db_migrate_in_war.rb10
-rw-r--r--config/locales/imports.yml42
-rw-r--r--config/routes.rb1
-rw-r--r--config/war_init.rb1
-rw-r--r--config/warble.rb21
-rw-r--r--config/web.xml.erb36
8 files changed, 108 insertions, 7 deletions
diff --git a/config/environments/production.rb b/config/environments/production.rb
index a121daab6..d79d98df7 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -36,7 +36,7 @@ ChouetteIhm::Application.configure do
# Use a different logger for distributed setups
require 'syslog_logger'
config.logger = SyslogLogger.new("rails/chouette2").tap do |logger|
- logger.level = Logger::INFO
+ # logger.level = Logger::INFO
end
# Use a different cache store in production
diff --git a/config/initializers/apartment.rb b/config/initializers/apartment.rb
index be6b7e933..20263f5c6 100644
--- a/config/initializers/apartment.rb
+++ b/config/initializers/apartment.rb
@@ -1,6 +1,6 @@
Apartment.configure do |config|
# set your options (described below) here
- config.excluded_models = ["Referential", "User", "Import", "Delayed::Backend::ActiveRecord::Job"] # these models will not be multi-tenanted, but remain in the global (public) namespace
+ config.excluded_models = ["Referential", "User", "Import", "ImportLogMessage", "Delayed::Backend::ActiveRecord::Job"] # these models will not be multi-tenanted, but remain in the global (public) namespace
# Dynamically get database names to migrate
config.database_names = lambda{ Referential.select(:slug).map(&:slug) }
diff --git a/config/initializers/db_migrate_in_war.rb b/config/initializers/db_migrate_in_war.rb
new file mode 100644
index 000000000..ccba79773
--- /dev/null
+++ b/config/initializers/db_migrate_in_war.rb
@@ -0,0 +1,10 @@
+Rails.configuration.after_initialize do
+ Rails.logger.info "Migrating database"
+ ActiveRecord::Migrator.migrate("db/migrate/", nil)
+
+ Apartment.database_names.each do |db|
+ Rails.logger.info "Migrating #{db} schema"
+ Apartment::Migrator.migrate db
+ end
+end if ENV["CHOUETTE_RUN_MIGRATIONS"] == "true"
+
diff --git a/config/locales/imports.yml b/config/locales/imports.yml
index d4c8b2d7c..40db6d65e 100644
--- a/config/locales/imports.yml
+++ b/config/locales/imports.yml
@@ -8,6 +8,21 @@ en:
title: New import
index:
title: Imports
+ show:
+ report: Report
+ statuses:
+ pending: Pending
+ completed: Completed
+ failed: Failed
+ import_log_messages:
+ messages:
+ started: Started import
+ completed: Completed import
+ failed: Failed import
+ severities:
+ info: Information
+ warning: Warning
+ error: Error
activerecord:
models:
import:
@@ -17,16 +32,36 @@ en:
attributes:
import:
resources: File to import
+ status: Status
+ import_log_message:
+ created_at: Date
+ position: N.
+ full_message: Message
fr:
imports:
actions:
new: Nouvel import
- destroy: Supprimer
+ destroy: Supprimer cet import
destroy_confirm: Etes vous sûr de détruire cet import ?
new:
title: Nouvel import
index:
title: Imports
+ show:
+ report: Rapport
+ statuses:
+ pending: En cours
+ completed: Achevé
+ failed: Echoué
+ import_log_messages:
+ messages:
+ started: Import démarré
+ completed: Import achevé avec succès
+ failed: Import interromptu
+ severities:
+ info: Information
+ warning: Alerte
+ error: Erreur
activerecord:
models:
import:
@@ -36,3 +71,8 @@ fr:
attributes:
import:
resources: Fichier à importer
+ status: Status
+ import_log_message:
+ created_at: Date
+ position: "No"
+ full_message: Message
diff --git a/config/routes.rb b/config/routes.rb
index 4e8d75a9c..5e5f68b72 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,6 +20,7 @@ ChouetteIhm::Application.routes.draw do
# resources :products
resources :referentials do
resources :stop_point_areas
+ match 'lines' => 'lines#destroy_all', :via => :delete
resources :lines, :networks do
resources :stop_areas do
resources :stop_area_parents
diff --git a/config/war_init.rb b/config/war_init.rb
new file mode 100644
index 000000000..756bc5926
--- /dev/null
+++ b/config/war_init.rb
@@ -0,0 +1 @@
+ENV["CHOUETTE_RUN_MIGRATIONS"] = "true"
diff --git a/config/warble.rb b/config/warble.rb
index 70a4ca946..11c6bf090 100644
--- a/config/warble.rb
+++ b/config/warble.rb
@@ -42,7 +42,7 @@ Warbler::Config.new do |config|
# An array of Bundler groups to avoid including in the war file.
# Defaults to ["development", "test"].
- # config.bundle_without = []
+ config.bundle_without = %w{development test assets}
# Other gems to be included. If you don't use Bundler or a gemspec
# file, you need to tell Warbler which gems your application needs
@@ -78,7 +78,7 @@ Warbler::Config.new do |config|
# Name of the archive (without the extension). Defaults to the basename
# of the project directory.
- # config.jar_name = "mywar"
+ config.jar_name = "chouette2"
# Name of the MANIFEST.MF template for the war file. Defaults to a simple
# MANIFEST.MF that contains the version of Warbler used to create the war file.
@@ -134,9 +134,22 @@ Warbler::Config.new do |config|
# Control the pool of Rails runtimes. Leaving unspecified means
# the pool will grow as needed to service requests. It is recommended
# that you fix these values when running a production server!
- # config.webxml.jruby.min.runtimes = 2
- # config.webxml.jruby.max.runtimes = 4
+ config.webxml.jruby.min.runtimes = 2
+ config.webxml.jruby.max.runtimes = 4
+
+ config.webxml.jruby.worker.script = <<EOF
+Rails.logger.info "start Delayed::JRubyWorker"
+begin
+require 'delayed/jruby_worker'
+Delayed::JRubyWorker.new(:quiet => false).start
+rescue => e
+ Rails.logger.fatal(e)
+ raise e
+end
+EOF
# JNDI data source name
# config.webxml.jndi = 'jdbc/rails'
+
+ config.init_contents << "config/war_init.rb"
end
diff --git a/config/web.xml.erb b/config/web.xml.erb
new file mode 100644
index 000000000..af962f3b7
--- /dev/null
+++ b/config/web.xml.erb
@@ -0,0 +1,36 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+<% webxml.context_params.each do |k,v| %>
+ <context-param>
+ <param-name><%= k %></param-name>
+ <param-value><%= v %></param-value>
+ </context-param>
+<% end %>
+
+ <filter>
+ <filter-name>RackFilter</filter-name>
+ <filter-class>org.jruby.rack.RackFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>RackFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class><%= webxml.servlet_context_listener %></listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.kares.jruby.rack.WorkerContextListener</listener-class>
+ </listener>
+
+<% if webxml.jndi then [webxml.jndi].flatten.each do |jndi| %>
+ <resource-ref>
+ <res-ref-name><%= jndi %></res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+<% end; end %>
+</web-app>