aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stif/dashboard.rb4
-rw-r--r--lib/stif/permission_translator.rb1
-rw-r--r--lib/tasks/ci.rake26
-rw-r--r--lib/tasks/imports.rake6
4 files changed, 29 insertions, 8 deletions
diff --git a/lib/stif/dashboard.rb b/lib/stif/dashboard.rb
index 46c635091..f558b79fb 100644
--- a/lib/stif/dashboard.rb
+++ b/lib/stif/dashboard.rb
@@ -1,7 +1,7 @@
module Stif
class Dashboard < ::Dashboard
def workbench
- @workbench ||= current_organisation.workbenches.find_by(name: "Gestion de l'offre")
+ @workbench ||= current_organisation.workbenches.default
end
def workgroup
@@ -13,7 +13,7 @@ module Stif
end
def calendars
- @calendars ||= Calendar.where('(organisation_id = ? OR shared = ?) AND workgroup_id = ?', current_organisation.id, true, workgroup.id)
+ workbench.calendars
end
end
end
diff --git a/lib/stif/permission_translator.rb b/lib/stif/permission_translator.rb
index 9e0feb9b8..09a7c610c 100644
--- a/lib/stif/permission_translator.rb
+++ b/lib/stif/permission_translator.rb
@@ -21,6 +21,7 @@ module Stif
calendars
footnotes
imports
+ exports
merges
journey_patterns
referentials
diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake
index 89f9aa9c8..5b2c8ae3c 100644
--- a/lib/tasks/ci.rake
+++ b/lib/tasks/ci.rake
@@ -1,9 +1,18 @@
namespace :ci do
+
+ def database_name
+ @database_name ||=
+ begin
+ config = YAML.load(ERB.new(File.read('config/database.yml')).result)
+ config["test"]["database"]
+ end
+ end
+
desc "Prepare CI build"
task :setup do
- cp "config/database/jenkins.yml", "config/database.yml"
+ cp "config/database/ci.yml", "config/database.yml"
+ puts "Use #{database_name} database"
sh "RAILS_ENV=test rake db:drop db:create db:migrate"
- sh "yarn --no-progress install"
end
def git_branch
@@ -59,7 +68,18 @@ namespace :ci do
sh "rm -rf log/test.log"
sh "RAILS_ENV=test bundle exec rake assets:clobber"
end
+
+ task :build => ["ci:setup", "ci:assets", "ci:i18n_js_export", "spec", "ci:jest", "cucumber", "ci:check_security"]
+
+ namespace :docker do
+ task :clean do
+ puts "Drop #{database_name} database"
+ sh "RAILS_ENV=test rake db:drop"
+ end
+ end
+
+ task :docker => ["ci:build"]
end
desc "Run continuous integration tasks (spec, ...)"
-task :ci => ["ci:setup", "ci:assets", "ci:i18n_js_export", "spec", "ci:jest", "cucumber", "ci:check_security", "ci:deploy", "ci:clean"]
+task :ci => ["ci:build", "ci:deploy", "ci:clean"]
diff --git a/lib/tasks/imports.rake b/lib/tasks/imports.rake
index cd9217e5a..7162f2ada 100644
--- a/lib/tasks/imports.rake
+++ b/lib/tasks/imports.rake
@@ -31,7 +31,7 @@ namespace :import do
end
desc "import the given file with the corresponding importer in the given StopAreaReferential"
- task :import_in_stop_area_referential, [:referential_id, :configuration_name, :filepath] => :environment do |t, args|
+ task :import_in_stop_area_referential, [:referential_id, :configuration_name, :filepath, :logs_output_dir] => :environment do |t, args|
args.with_defaults(logs_output_dir: "./log/importers/")
FileUtils.mkdir_p args[:logs_output_dir]
@@ -46,7 +46,7 @@ namespace :import do
end
desc "import the given routes files"
- task :import_routes, [:referential_id, :configuration_name, :mapping_filepath, :filepath] => :environment do |t, args|
+ task :import_routes, [:referential_id, :configuration_name, :mapping_filepath, :filepath, :logs_output_dir] => :environment do |t, args|
args.with_defaults(logs_output_dir: "./log/importers/")
FileUtils.mkdir_p args[:logs_output_dir]
@@ -56,7 +56,7 @@ namespace :import do
importer = SimpleImporter.create configuration_name: args[:configuration_name], filepath: args[:filepath]
importer.configure do |config|
config.add_value :stop_area_referential, referential
- config.context = {stop_area_referential: stop_area_referential, mapping_filepath: args[:mapping_filepath], logs_output_dir: args[:logs_output_dir]}
+ config.context = {stop_area_referential: stop_area_referential, line_referential: line_referential, mapping_filepath: args[:mapping_filepath], logs_output_dir: args[:logs_output_dir]}
end
SimpleInterfacesHelper.run_interface_controlling_interruption importer, :import, args