Skip to content

Commit

Permalink
Merge pull request #306 from sanger/develop
Browse files Browse the repository at this point in the history
Dependency updates and added net-imap and net-pop gem
  • Loading branch information
Sangeetha-Bheeman authored Mar 15, 2023
2 parents 510ec78 + c2fa5e1 commit c7e761a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.0
3.6.0
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -304,6 +309,8 @@ DEPENDENCIES
jquery-rails
launchy
mysql2
net-imap
net-pop
net-smtp
pry
puma
Expand Down
20 changes: 10 additions & 10 deletions app/controllers/assets_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
50 changes: 25 additions & 25 deletions app/controllers/batches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
require './app/presenters/report/show'

class ReportsController < ApplicationController
def show; end

def new
@presenter = Presenter::ReportPresenter::New.new
end
Expand All @@ -18,8 +20,6 @@ def create
end
end

def show; end

def csv
send_data params[:csv_file_content],
type: 'text/csv',
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/workflows_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/deployed_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7e761a

Please sign in to comment.