2019-02-13 12:59:28 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# OpenLab Projects tasks
|
2016-04-21 11:42:43 +02:00
|
|
|
namespace :fablab do
|
|
|
|
namespace :openlab do
|
2016-09-29 21:28:51 +02:00
|
|
|
desc 'bulk and export projects to openlab'
|
2016-04-21 11:42:43 +02:00
|
|
|
task bulk_export: :environment do
|
2022-04-20 18:30:46 +02:00
|
|
|
if Setting.get('openlab_app_id').present? && Setting.get('openlab_app_secret').present?
|
2016-04-21 11:42:43 +02:00
|
|
|
Project.find_each do |project|
|
|
|
|
project.openlab_create
|
2016-09-29 20:50:27 +02:00
|
|
|
puts '-> Done'
|
2016-04-21 11:42:43 +02:00
|
|
|
end
|
|
|
|
else
|
2022-04-20 18:30:46 +02:00
|
|
|
warn "openlab_app_id or openlab_app_secret was not configured. Export can't be done."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'bulk update projects to openlab'
|
|
|
|
task bulk_update: :environment do
|
|
|
|
if Setting.get('openlab_app_id').present? && Setting.get('openlab_app_secret').present?
|
|
|
|
Project.find_each do |project|
|
|
|
|
project.openlab_update
|
|
|
|
puts '-> Done'
|
|
|
|
end
|
|
|
|
else
|
|
|
|
warn "openlab_app_id or openlab_app_secret was not configured. Update can't be done."
|
2016-04-21 11:42:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|