diff --git a/VERSION b/VERSION index c78c4964..32b93c0c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.6.2 +4.7.7 diff --git a/config/application.rb b/config/application.rb index 71830f8e..e958a84f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -73,5 +73,9 @@ class Application < Rails::Application config.active_job.queue_adapter = :async config.active_storage.service = :local + + ENVIRONMENTS = Dir.glob(Rails.root.join("config/environments/*.rb")).map { |file| + File.basename(file, ".rb") + }.freeze end end diff --git a/config/resque.yml b/config/resque.yml new file mode 100644 index 00000000..29255eda --- /dev/null +++ b/config/resque.yml @@ -0,0 +1,16 @@ +development: + workers: + "*": 2 +test: + workers: + "*": 4 +prod: + workers: + "*": 6 + +academiccommons_test: + workers: + "*": 4 +academiccommons_prod: + workers: + "*": 6 diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index ab907e2f..7e6a9941 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -96,14 +96,14 @@ namespace :resque do err = Rails.root.join('log', 'resque.log').to_s out = Rails.root.join('log', 'resque.log').to_s rails_env = ENV['RAILS_ENV'] + return unless AcademicCommons::Application::ENVIRONMENTS.include(rails_env) worker_config.each do |queues, count| queues = queues.to_s count.times do |index| number = index + 1 pidfile = Rails.root.join('tmp/pids/', "resque_work_#{number}.pid").to_s - _stdout_str, _stderr_str, status = Open3.capture3("RAILS_ENV=#{rails_env} QUEUE=\"#{queues}\" PIDFILE=#{pidfile} BACKGROUND=yes VERBOSE=1 INTERVAL=#{interval} rake resque:work >> #{out} 2>> #{err}") - puts "Worker #{number} started, status: #{status}" + Open3.capture3("RAILS_ENV=#{rails_env} QUEUE=\"#{queues}\" PIDFILE=#{pidfile} BACKGROUND=yes VERBOSE=1 INTERVAL=#{interval} rake resque:work >> #{out} 2>> #{err}") end end end diff --git a/spec/api_spec.rb b/spec/api_spec.rb new file mode 100755 index 00000000..aab642ce --- /dev/null +++ b/spec/api_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'rake' + +RSpec.describe 'ac:generate_api_token', type: :task do + before do + Token.delete_all + end + + after do + Rake.application.clear + end + + xit 'generates a new token record' do + email = 'test@test.org' + description = 'test description' + Rake::Task['ac:generate_api_token'].invoke(email, description) + expect(Token.count).to eq(1) + end +end