Skip to content

Commit

Permalink
Merge branch 'master' of github.com:datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Apr 23, 2019
2 parents 2fe7496 + d65b7a2 commit bb2dee6
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ addons:
repo_token: $CODECLIMATE_REPO_TOKEN
apt:
packages:
- oracle-java8-set-default
- oracle-java9-set-default
- mysql-server
- mysql-client
sources:
Expand Down
32 changes: 18 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ GEM
audited (4.8.0)
activerecord (>= 4.0, < 5.3)
aws-eventstream (1.0.2)
aws-partitions (1.150.0)
aws-sdk-core (3.48.3)
aws-partitions (1.151.0)
aws-sdk-core (3.48.4)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.16.0)
aws-sdk-kms (1.17.0)
aws-sdk-core (~> 3, >= 3.48.2)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.36.0)
aws-sdk-s3 (1.36.1)
aws-sdk-core (~> 3, >= 3.48.2)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
Expand Down Expand Up @@ -98,7 +98,7 @@ GEM
latex-decode (~> 0.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bolognese (1.1.13)
bolognese (1.1.14)
activesupport (>= 4.2.5, < 6)
benchmark_methods (~> 0.7)
bibtex-ruby (~> 4.1)
Expand All @@ -110,7 +110,7 @@ GEM
edtf (~> 3.0, >= 3.0.4)
gender_detector (~> 0.1.2)
iso8601 (~> 0.9.1)
json-ld (~> 2.1, >= 2.1.2)
json-ld-preloaded (~> 3.0, >= 3.0.2)
jsonlint (~> 0.2.0)
loofah (~> 2.0, >= 2.0.3)
maremma (>= 3.5.7, < 5)
Expand All @@ -126,7 +126,7 @@ GEM
builder (3.2.3)
byebug (11.0.1)
cancancan (2.3.0)
capybara (3.16.2)
capybara (3.17.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
Expand Down Expand Up @@ -220,10 +220,10 @@ GEM
fast_jsonapi (1.5)
activesupport (>= 4.2)
ffi (1.10.0)
flipper (0.16.1)
flipper-active_support_cache_store (0.16.1)
flipper (0.16.2)
flipper-active_support_cache_store (0.16.2)
activesupport (>= 3.2, < 6)
flipper (~> 0.16.1)
flipper (~> 0.16.2)
gender_detector (0.1.2)
unicode_utils (>= 1.3.0)
git (1.5.0)
Expand All @@ -245,9 +245,13 @@ GEM
iso8601 (0.9.1)
jmespath (1.4.0)
json (1.8.6)
json-ld (2.2.1)
json-ld (3.0.2)
multi_json (~> 1.12)
rdf (>= 2.2.8, < 4.0)
json-ld-preloaded (3.0.2)
json-ld (~> 3.0)
multi_json (~> 1.12)
rdf (~> 3.0)
jsonapi-renderer (0.2.0)
jsonlint (0.2.0)
oj (~> 2)
Expand Down Expand Up @@ -310,7 +314,7 @@ GEM
minitest (5.11.3)
money (6.13.3)
i18n (>= 0.6.4, <= 2)
msgpack (1.2.9)
msgpack (1.2.10)
multi_json (1.13.1)
multipart-post (2.0.0)
mysql2 (0.4.10)
Expand Down Expand Up @@ -370,7 +374,7 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rdf (3.0.11)
rdf (3.0.12)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (2.2.1)
Expand Down Expand Up @@ -478,7 +482,7 @@ GEM
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unf_ext (0.0.7.6)
unicode_utils (1.4.0)
vcr (3.0.3)
webmock (3.5.1)
Expand Down
6 changes: 2 additions & 4 deletions app/models/concerns/helpable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ module ClassMethods
def get_dois(options={})
return OpenStruct.new(body: { "errors" => [{ "title" => "Prefix missing" }] }) unless options[:prefix].present?

count_url = Rails.env.production? ? "https://doi.org" : "https://handle.test.datacite.org"
count_url += "/api/handles?prefix=#{options[:prefix]}&pageSize=0"
count_url = ENV['HANDLE_URL'] + "/api/handles?prefix=#{options[:prefix]}&pageSize=0"
response = Maremma.get(count_url, username: "300%3A#{ENV['HANDLE_USERNAME']}", password: ENV['HANDLE_PASSWORD'], ssl_self_signed: true, timeout: 60)

total = response.body.dig("data", "totalCount").to_i
Expand All @@ -123,8 +122,7 @@ def get_dois(options={})
total_pages = (total.to_f / 1000).ceil

(0...total_pages).each do |page|
url = Rails.env.production? ? "https://doi.org" : "https://handle.test.datacite.org"
url += "/api/handles?prefix=#{options[:prefix]}&page=#{page}&pageSize=1000"
url = ENV['HANDLE_URL'] + "/api/handles?prefix=#{options[:prefix]}&page=#{page}&pageSize=1000"
response = Maremma.get(url, username: "300%3A#{ENV['HANDLE_USERNAME']}", password: ENV['HANDLE_PASSWORD'], ssl_self_signed: true, timeout: 60)
if response.status == 200
dois += (response.body.dig("data", "handles") || [])
Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require "active_storage/engine"
require "action_controller/railtie"
require "rails/test_unit/railtie"
require "active_job/logging"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Expand Down Expand Up @@ -79,6 +80,8 @@ class Application < Rails::Application
config.logger = ActiveSupport::TaggedLogging.new(logger)
config.log_level = ENV['LOG_LEVEL'].to_sym

config.active_job.logger = config.logger

# configure caching
config.cache_store = :dalli_store, nil, { :namespace => ENV['APPLICATION'] }

Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
config.eager_load = false

# don't use debug level
config.log_level = :info
config.log_level = :error

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
Expand Down
3 changes: 2 additions & 1 deletion config/initializers/_shoryuken.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Shoryuken.configure_server do |config|
logger = Shoryuken::Logging.logger
Rails.logger = Shoryuken::Logging.logger
Rails.logger.level = Logger.const_get(ENV["LOG_LEVEL"].upcase)
end

Shoryuken.active_job_queue_name_prefixing = true

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,7 @@
before { get "/dois/get-dois", headers: headers }

it 'returns all dois' do
expect(json["dois"].length).to eq(442)
expect(json["dois"].length).to eq(443)
expect(json["dois"].first).to eq("10.5438/0000-00SS")
end

Expand Down

0 comments on commit bb2dee6

Please sign in to comment.