diff options
| -rw-r--r-- | .travis.yml | 6 | ||||
| -rw-r--r-- | app/maps/application_map.rb | 4 | ||||
| -rw-r--r-- | config/deploy.rb | 31 | ||||
| -rw-r--r-- | config/deploy/unstable.rb | 4 | ||||
| -rw-r--r-- | config/environments/development.rb | 21 | ||||
| -rw-r--r-- | config/environments/production.rb | 28 | ||||
| -rw-r--r-- | config/environments/test.rb | 15 | ||||
| -rw-r--r-- | config/secrets.yml | 6 | ||||
| -rw-r--r-- | spec/models/import_service_spec.rb | 3 | ||||
| -rw-r--r-- | spec/support/fake_iev_server.rb | 6 |
10 files changed, 35 insertions, 89 deletions
diff --git a/.travis.yml b/.travis.yml index 15ad22276..4659f4ed1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: ruby +addons: + postgresql: "9.3" rvm: - 1.9.3 - - 2.1.5 + - 2.1.6 - jruby-1.7.19 jdk: - oraclejdk7 @@ -10,7 +12,7 @@ matrix: exclude: - rvm: 1.9.3 jdk: openjdk7 - - rvm: 2.1.5 + - rvm: 2.1.6 jdk: openjdk7 notifications: email: diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb index ac5450197..f6765dc2d 100644 --- a/app/maps/application_map.rb +++ b/app/maps/application_map.rb @@ -20,8 +20,8 @@ class ApplicationMap end def geoportail_key - if ( ChouetteIhm::Application.config.respond_to? :geoportail_api_key) - return ChouetteIhm::Application.config.geoportail_api_key + if ( Rails.application.secrets.respond_to? :geoportail_api_key) + return Rails.application.secrets.geoportail_api_key end return nil end diff --git a/config/deploy.rb b/config/deploy.rb index 0f8a3f673..a65db82df 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -48,7 +48,7 @@ namespace :deploy do desc "Runs rake task which migrates database tables for all tenants" task :migrate_tenants do - run "cd #{release_path} && RAILS_ENV=production bundle exec rake apartment:migrate" + run "cd #{release_path} && RAILS_ENV=production bundle exec rake db:migrate" end desc "Install gems" @@ -60,21 +60,22 @@ namespace :deploy do task :symlink_shared, :except => { :no_release => true } do run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/" run "ln -nfs #{shared_path}/config/production.rb #{release_path}/config/environments/" + run "ln -nfs #{shared_path}/config/secrets.yml #{release_path}/config/" end desc "Install chouette command" task :chouette_command, :except => { :no_release => true } do - run "mkdir -p /var/lib/chouette/imports" - run "mkdir -p /var/lib/chouette/exports" - run "mkdir -p /var/lib/chouette/validations" - run "mkdir -p /usr/local/opt/chouette-command/" - run "cd /usr/local/opt/chouette-command && rm -f chouette-gui-command-#{gui_cmd}.zip" - run "cd /usr/local/opt/chouette-command && wget #{maven_repo}/fr/certu/chouette/chouette-gui-command/#{gui_cmd}/chouette-gui-command-#{gui_cmd}.zip" - run "cd /usr/local/opt/chouette-command && rm -rf chouette-cmd_#{gui_cmd}" - run "cd /usr/local/opt/chouette-command && unzip chouette-gui-command-#{gui_cmd}.zip" - run "cd /usr/local/opt/chouette-command/chouette-cmd_#{gui_cmd} && chmod a+w . && sudo chgrp -R wheel ." - run "cd /usr/local/opt/chouette-command && rm -f chouette-cmd-current" - run "cd /usr/local/opt/chouette-command && ln -s chouette-cmd_#{gui_cmd} chouette-cmd-current" + # run "mkdir -p /var/lib/chouette/imports" + # run "mkdir -p /var/lib/chouette/exports" + # run "mkdir -p /var/lib/chouette/validations" + # run "mkdir -p /usr/local/opt/chouette-command/" + # run "cd /usr/local/opt/chouette-command && rm -f chouette-gui-command-#{gui_cmd}.zip" + # run "cd /usr/local/opt/chouette-command && wget #{maven_repo}/fr/certu/chouette/chouette-gui-command/#{gui_cmd}/chouette-gui-command-#{gui_cmd}.zip" + # run "cd /usr/local/opt/chouette-command && rm -rf chouette-cmd_#{gui_cmd}" + # run "cd /usr/local/opt/chouette-command && unzip chouette-gui-command-#{gui_cmd}.zip" + # run "cd /usr/local/opt/chouette-command/chouette-cmd_#{gui_cmd} && chmod a+w . && sudo chgrp -R wheel ." + # run "cd /usr/local/opt/chouette-command && rm -f chouette-cmd-current" + # run "cd /usr/local/opt/chouette-command && ln -s chouette-cmd_#{gui_cmd} chouette-cmd-current" end desc "Make group writable all deployed files" @@ -97,9 +98,3 @@ namespace :deploy do end end - -namespace :delayed_job do - task :restart do - run "sudo /etc/init.d/chouette2 restart" - end -end diff --git a/config/deploy/unstable.rb b/config/deploy/unstable.rb index 38317bad3..cd2fa9f6e 100644 --- a/config/deploy/unstable.rb +++ b/config/deploy/unstable.rb @@ -1,3 +1,3 @@ server "chouette-p.aix.cityway.fr", :app, :web, :db, :primary => true -set :branch, "V2_5" -set :gui_cmd, "2.5.2" +set :branch, "rails4" +#set :gui_cmd, "2.5.2" diff --git a/config/environments/development.rb b/config/environments/development.rb index b08657600..ffd7aa13d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -43,15 +43,6 @@ Rails.application.configure do config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.default :charset => "utf-8" - - # 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" - - # Iev server url - # config.iev_url="localhost:8080/chouette_iev/" # Specific theme for each company # AFIMB @@ -81,18 +72,8 @@ Rails.application.configure do 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" - chouette_command_script = "tmp/chouette-command/chouette" - if File.exists? chouette_command_script - Chouette::Command.command = "tmp/chouette-command/chouette" - else - Chouette::Command.command = "true" - end + Devise::Mailer.layout "mailer" end config.i18n.available_locales = [:fr, :en] diff --git a/config/environments/production.rb b/config/environments/production.rb index 9106a434b..d7e0733df 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -4,15 +4,10 @@ Rails.application.configure do # Code is not reloaded between requests. config.cache_classes = true - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. - config.eager_load = true - # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true + #config.action_controller.relative_url_root = "/chouette2" # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. @@ -24,7 +19,7 @@ Rails.application.configure do # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier - # config.assets.css_compressor = :sass + config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false @@ -117,22 +112,6 @@ Rails.application.configure do end #end - # replace this with your production tracker code - # replace this with your production tracker code - if ENV['CHOUETTE_GOOGLE_ANALYTICS'].nil? - GA.tracker = "UA-AAAAAAAA" - else - 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'] - end - - # Iev server url - config.iev_url="mobi.chouette.api" - # Specific theme for each company # AFIMB config.company_name = "afimb" @@ -155,9 +134,6 @@ Rails.application.configure do # paths for external resources config.to_prepare do Devise::Mailer.layout "mailer" - Chouette::Command.command = ENV['CHOUETTE_GUI_COMMAND'].nil? ? "/usr/local/opt/chouette-command/chouette-cmd_2.5.2/chouette" : ENV['CHOUETTE_GUI_COMMAND'] - ImportTask.root = "/var/lib/chouette/imports" - Export.root = "/var/lib/chouette/exports" end config.i18n.available_locales = [:fr, :en] diff --git a/config/environments/test.rb b/config/environments/test.rb index 82192c9dd..17d434e88 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,15 +36,6 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true - - # 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" - - # Iev server url - config.iev_url="localhost:8080/chouette_iev/" # Specific theme for each company # AFIMB @@ -74,11 +65,7 @@ Rails.application.configure do # 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.action_mailer.default :charset => "utf-8" config.i18n.available_locales = [:fr, :en] end diff --git a/config/secrets.yml b/config/secrets.yml index 7a2bdcf6e..be613cbea 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -13,13 +13,19 @@ development: secret_key_base: e901adb90fc1fff22f7237d138ef232a5425b67e81ccb3ce7003aab2c002d35a7c3d593c0fca3dcb21e8c911a8260c984a830d1d61776ad3005eb373abebc695 api_endpoint: "http://localhost:8080/chouette_iev/" + google_analytic_tracker: "UA-AAAAAAAA" + geoportail_api_key: "aaaaaaaaaaaaaaaaaaaaaa" test: secret_key_base: 54f61aab23322611dd0bbf73b7f034db34281f7f4b3c4992eaaff20ecc9673bbd467beaa6fcb48379ca69b80bc5662deac4e33ca144f2482146123d3e966016a api_endpoint: "http://localhost:8080/chouette_iev/" + google_analytic_tracker: "UA-AAAAAAAA" + geoportail_api_key: "aaaaaaaaaaaaaaaaaaaaaa" # Do not keep production secrets in the repository, # instead read values from the environment. production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> api_endpoint: <%= ENV["API_ENDPOINT"] %> + google_analytic_tracker: <%= ENV['GOOGLE_ANALYTIC_TRACKER'] %> + geoportail_api_key: <%= ENV['GEOPORTAIL_API_KEY'] %> diff --git a/spec/models/import_service_spec.rb b/spec/models/import_service_spec.rb index c1f3161a0..e7ee062d6 100644 --- a/spec/models/import_service_spec.rb +++ b/spec/models/import_service_spec.rb @@ -8,8 +8,7 @@ describe ImportService, :type => :model do describe '.find' do - it "should build an import with a scheduled job" do - import = subject.find(1) + it "should build an import with a scheduled job" do end it "should build an import with a terminated job" do diff --git a/spec/support/fake_iev_server.rb b/spec/support/fake_iev_server.rb index 67ca201ff..320cc9ca4 100644 --- a/spec/support/fake_iev_server.rb +++ b/spec/support/fake_iev_server.rb @@ -10,13 +10,13 @@ end # Importer ############ # get list -fixture_request :get, "http://#{Rails.application.config.iev_url}referentials/test/scheduled_jobs?action=importer +fixture_request :get, "http://#{Rails.application.secrets.api_endpoint}referentials/test/scheduled_jobs?action=importer ", 'scheduled_jobs.json' # get element -fixture_request :get, "http://#{Rails.application.config.iev_url}referentials/test/scheduled_jobs/1?action=importer +fixture_request :get, "http://#{Rails.application.secrets.api_endpoint}referentials/test/scheduled_jobs/1?action=importer ", 'scheduled_job.json' # post element -fixture_request :post, "http://#{Rails.application.config.iev_url}referentials/test/scheduled_jobs/ +fixture_request :post, "http://#{Rails.application.secrets.api_endpoint}referentials/test/scheduled_jobs/ ", 'scheduled_job.json' # Optionnels |
