diff options
| -rw-r--r-- | config/database.yml | 2 | ||||
| -rw-r--r-- | config/initializers/db_migrate_in_war.rb | 10 | ||||
| -rw-r--r-- | config/war_init.rb | 1 | ||||
| -rw-r--r-- | config/warble.rb | 6 | ||||
| -rw-r--r-- | lib/tasks/ci.rake | 2 |
5 files changed, 17 insertions, 4 deletions
diff --git a/config/database.yml b/config/database.yml index a3e357d3a..b2e8ca6dc 100644 --- a/config/database.yml +++ b/config/database.yml @@ -23,7 +23,7 @@ test: production: adapter: jdbcpostgresql - database: chouette2 + database: chouette_prod encoding: utf8 host: localhost username: chouette 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/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..cdc5583f9 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. @@ -139,4 +139,6 @@ Warbler::Config.new do |config| # JNDI data source name # config.webxml.jndi = 'jdbc/rails' + + config.init_contents << "config/war_init.rb" end diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake index 9c541129b..cfd68a1cf 100644 --- a/lib/tasks/ci.rake +++ b/lib/tasks/ci.rake @@ -3,7 +3,7 @@ namespace :ci do cp "config/database.yml.ccontrol", "config/database.yml" end task :deploy do - cp "workspace.war", "/var/lib/tomcat6/webapps/chouette2.war" + cp "chouette2.war", "/var/lib/tomcat6/webapps/" end task :build => ["db:migrate", "spec", "war", "ci:deploy"] end |
