Skip to content

Commit

Permalink
Merge branch 'develop' into fix-well-library-delegate-error
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieing authored Jun 4, 2021
2 parents b51d875 + 3bf8661 commit 2ae4b5b
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.4
3.6.4
8 changes: 8 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ class ApplicationController < ActionController::Base
include JSONAPI::ActsAsResourceController
skip_before_action :verify_authenticity_token

on_server_error :send_exception_notification

def self.send_exception_notification(exception)
ExceptionNotifier.notify_exception(exception)
end

private

# Caution: Using this approach for a 'create' action is not strictly JSON API
# compliant.
def serialize_array(array)
Expand Down
10 changes: 10 additions & 0 deletions app/resources/v1/pacbio/run_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ class RunResource < JSONAPI::Resource
has_one :plate, foreign_key_on: :related, foreign_key: 'pacbio_run_id',
class_name: 'Runs::Plate'

def self.records_for_populate(*_args)
super.preload(plate: {
wells: {
libraries: {
request_libraries: { request: :sample }
}
}
})
end

def created_at
@model.created_at.to_s(:us)
end
Expand Down
7 changes: 6 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down Expand Up @@ -60,4 +59,10 @@
end
end

config.middleware.use ExceptionNotification::Rack

# We don't want to send emails in development mode, but its useful to see
# when the notifier has been triggered.
ExceptionNotifier.add_notifier :console_notifier,
->(exception, _) { puts "📧 Exception logged: #{exception.message}"}
end
51 changes: 51 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# https://github.com/Arkweid/lefthook
# Rubocop globs built based on https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml With globbing support povided by
# https://pkg.go.dev/github.com/gobwas/glob#section-documentation
# Has the advantage of quicker commits when no rubocop files
pre-commit:
parallel: true
commands:
rubocop:
glob: "{*.{rb,arb,axlsx,builder,fcgi,gemfile,gemspec,god,jb,jbuilder,mspec,opal,pluginspec,podspec,rabl,rake,rbuild,rbw,rbx,ru,ruby,spec,thor,watchr},.irbrc,.pryrc,.simplecov,buildfile,Appraisals,Berksfile,Brewfile,Buildfile,Capfile,Cheffile,Dangerfile,Deliverfile,Fastfile,*Fastfile,Gemfile,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,rakefile,Snapfile,Steepfile,Thorfile,Vagabondfile,Vagrantfile}"
run: rubocop --display-style-guide --extra-details --force-exclusion --parallel {staged_files} || (echo 'Run `lefthook run fix` to run autocorrect on staged files only'; exit 1)

fix:
parallel: true
commands:
rubocop:
glob: "{*.{rb,arb,axlsx,builder,fcgi,gemfile,gemspec,god,jb,jbuilder,mspec,opal,pluginspec,podspec,rabl,rake,rbuild,rbw,rbx,ru,ruby,spec,thor,watchr},.irbrc,.pryrc,.simplecov,buildfile,Appraisals,Berksfile,Brewfile,Buildfile,Capfile,Cheffile,Dangerfile,Deliverfile,Fastfile,*Fastfile,Gemfile,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,rakefile,Snapfile,Steepfile,Thorfile,Vagabondfile,Vagrantfile}"
run: rubocop --display-style-guide --extra-details --auto-correct --force-exclusion {staged_files}
# EXAMPLE USAGE
# Refer for explanation to following link:
# https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
#
# pre-push:
# commands:
# packages-audit:
# tags: frontend security
# run: yarn audit
# gems-audit:
# tags: backend security
# run: bundle audit
#
# pre-commit:
# parallel: true
# commands:
# eslint:
# glob: "*.{js,ts}"
# run: yarn eslint {staged_files}
# rubocop:
# tags: backend style
# glob: "*.rb"
# exclude: "application.rb|routes.rb"
# run: bundle exec rubocop --force-exclusion {all_files}
# govet:
# tags: backend style
# files: git ls-files -m
# glob: "*.go"
# run: go vet {files}
# scripts:
# "hello.js":
# runner: node
# "any.go":
# runner: go run
1 change: 1 addition & 0 deletions lib/tasks/ont_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require_relative '../traction_graphql'

namespace :ont_data do
desc 'Populate the database with ont plates and runs'
task :create, [:num] => :environment do |_t, args|
puts '-> Creating ONT data using GraphQL'

Expand Down
1 change: 1 addition & 0 deletions lib/tasks/pacbio_data.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

namespace :pacbio_data do
desc 'Populate the database with pacbio plates and runs'
task create: :environment do
require 'factory_bot'

Expand Down
1 change: 1 addition & 0 deletions lib/tasks/saphyr_runs.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

namespace :saphyr_runs do
desc 'Populate the database with saphyr tubes and runs'
task create: :environment do
attributes = (1..5).collect { |i| { name: "Sample#{i}", external_id: i, external_study_id: i, species: "Species#{i}" } }

Expand Down

0 comments on commit 2ae4b5b

Please sign in to comment.