diff --git a/.release-version b/.release-version index 1545d966..40c341bd 100644 --- a/.release-version +++ b/.release-version @@ -1 +1 @@ -3.5.0 +3.6.0 diff --git a/Gemfile b/Gemfile index 0e7f6fc2..0c9ccd17 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,8 @@ gem 'mysql2' # Use SCSS for stylesheets gem 'sass-rails', '~> 6.0' +gem 'net-imap', require: false +gem 'net-pop', require: false gem 'net-smtp' # Use jquery as the JavaScript library diff --git a/Gemfile.lock b/Gemfile.lock index 37ac9eca..c4975236 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,6 +91,7 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) + date (3.3.3) diff-lcs (1.5.0) docile (1.4.0) erubi (1.12.0) @@ -126,7 +127,12 @@ GEM mini_mime (1.1.2) mini_portile2 (2.8.1) minitest (5.18.0) - mysql2 (0.5.4) + mysql2 (0.5.5) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol net-protocol (0.2.1) timeout net-smtp (0.3.3) @@ -138,13 +144,12 @@ GEM parallel (1.22.1) parser (3.2.1.1) ast (~> 2.4.1) - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) psych (4.0.4) stringio public_suffix (5.0.1) - nio4r (~> 2.0) puma (6.1.1) nio4r (~> 2.0) racc (1.6.2) @@ -204,7 +209,7 @@ GEM rspec-mocks (~> 3.5.0) rspec-support (~> 3.5.0) rspec-support (3.5.0) - rubocop (1.48.0) + rubocop (1.48.1) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) @@ -221,10 +226,10 @@ GEM rubocop-performance (1.16.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.15.1) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) + rubocop (>= 1.33.0, < 2.0) rubocop-rspec (2.19.0) rubocop (~> 1.33) rubocop-capybara (~> 2.17) @@ -252,7 +257,7 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - spring (4.0.0) + spring (4.1.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -304,6 +309,8 @@ DEPENDENCIES jquery-rails launchy mysql2 + net-imap + net-pop net-smtp pry puma diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 90242b60..dc39b81c 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -1,6 +1,16 @@ require './app/presenters/asset/index' class AssetsController < ApplicationController + def index + if params[:state].nil? && params[:identifier].nil? + redirect_to('/assets?state=in_progress') + else + assets = Asset.in_state(state) + .with_identifier(params[:identifier]) + @presenter = Presenter::AssetPresenter::Index.new(assets, search, state) + end + end + # Assets updater creates new events for assets and moves assets to the next state def update if assets_provided @@ -13,16 +23,6 @@ def update end end - def index - if params[:state].nil? && params[:identifier].nil? - redirect_to('/assets?state=in_progress') - else - assets = Asset.in_state(state) - .with_identifier(params[:identifier]) - @presenter = Presenter::AssetPresenter::Index.new(assets, search, state) - end - end - private def state diff --git a/app/controllers/batches_controller.rb b/app/controllers/batches_controller.rb index e9de15d5..e46b7c6f 100644 --- a/app/controllers/batches_controller.rb +++ b/app/controllers/batches_controller.rb @@ -4,12 +4,35 @@ class BatchesController < ApplicationController before_action :batch, only: %i[show update remove] + def show + @presenter = Presenter::BatchPresenter::Show.new(batch) + end + def new @presenter = Presenter::BatchPresenter::New.new end - def show - @presenter = Presenter::BatchPresenter::Show.new(batch) + def create + batch_creator = Batch::Creator.new( + study: params[:study], + project: params[:project], + workflow:, + pipeline_destination:, + begun_at: params[:begun_at], + cost_code:, + asset_type:, + assets:, + comment: params[:comment] + ) + if batch_creator.valid? + batch = batch_creator.create! + @presenter = Presenter::BatchPresenter::Show.new(batch) + flash[:notice] = I18n.t('batches.success.created') + redirect_to("/batches/#{@presenter.id}") + else + flash[:error] = batch_creator.errors.full_messages.join('; ') + redirect_back(fallback_location: root_path) + end end def update @@ -40,29 +63,6 @@ def destroy redirect_to('/batches/new') end - def create - batch_creator = Batch::Creator.new( - study: params[:study], - project: params[:project], - workflow:, - pipeline_destination:, - begun_at: params[:begun_at], - cost_code:, - asset_type:, - assets:, - comment: params[:comment] - ) - if batch_creator.valid? - batch = batch_creator.create! - @presenter = Presenter::BatchPresenter::Show.new(batch) - flash[:notice] = I18n.t('batches.success.created') - redirect_to("/batches/#{@presenter.id}") - else - flash[:error] = batch_creator.errors.full_messages.join('; ') - redirect_back(fallback_location: root_path) - end - end - private def workflow diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 56d12b5d..6c777c69 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -2,6 +2,8 @@ require './app/presenters/report/show' class ReportsController < ApplicationController + def show; end + def new @presenter = Presenter::ReportPresenter::New.new end @@ -18,8 +20,6 @@ def create end end - def show; end - def csv send_data params[:csv_file_content], type: 'text/csv', diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index 120a86f0..bb165efa 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -3,6 +3,10 @@ class WorkflowsController < ApplicationController include InitialState + def show + @presenter = Presenter::WorkflowPresenter::Show.new(workflow) + end + def create @workflow = Workflow.new(workflow_params) if @workflow.save @@ -14,10 +18,6 @@ def create end end - def show - @presenter = Presenter::WorkflowPresenter::Show.new(workflow) - end - def update workflow.assign_attributes(workflow_params) if workflow.save diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index b60d773f..b630e75d 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -84,7 +84,7 @@ def execute_command(cmd) end def read_file(filename) - File.open(Rails.root.join(filename), 'r', &:readline) + Rails.root.join(filename).open('r', &:readline) rescue Errno::ENOENT, EOFError '' end