sdr-client 0.27.0 → 0.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -7
- data/.rubocop_todo.yml +15 -3
- data/exe/sdr +2 -2
- data/lib/sdr_client.rb +1 -0
- data/lib/sdr_client/credentials.rb +6 -2
- data/lib/sdr_client/deposit/file_metadata_builder_operations/mime_type.rb +3 -2
- data/lib/sdr_client/version.rb +1 -1
- data/sdr-client.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6db2cf36687c4acd4edf26d6046299958450211f89a4e29984d4955c84c891a9
|
4
|
+
data.tar.gz: f614d2ae6ecf2a6ac35775d9b20f6ac800c805c1aa8e8700052ffef3531b214d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b84aec31d944071d118a997cc16a48149c562812da2173af9927db31ae92c4e8d44d0ad9d55e43ef434f9f5d9be6898fecebffc967d44ff0350caa0c2ba4b5
|
7
|
+
data.tar.gz: 744e993e54fa8dc5cffff643cd619879d4b4c65d63431f7892ca77bd79da63d353cb3d299a029f516bec2c3e16dcb534de112a664c2435f2d01f0130318bdd9d
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
inherit_from: .rubocop_todo.yml
|
3
2
|
|
4
3
|
AllCops:
|
@@ -7,11 +6,6 @@ AllCops:
|
|
7
6
|
- 'bin/console'
|
8
7
|
- 'vendor/**/*'
|
9
8
|
|
10
|
-
Layout/LineLength:
|
11
|
-
Max: 120
|
12
|
-
Exclude:
|
13
|
-
- 'spec/sdr_client/deposit/process_spec.rb'
|
14
|
-
|
15
9
|
Metrics/BlockLength:
|
16
10
|
Exclude:
|
17
11
|
- 'spec/**/*'
|
@@ -21,4 +15,4 @@ Metrics/BlockLength:
|
|
21
15
|
|
22
16
|
Naming/FileName:
|
23
17
|
Exclude:
|
24
|
-
- 'lib/sdr-client.rb'
|
18
|
+
- 'lib/sdr-client.rb'
|
data/.rubocop_todo.yml
CHANGED
@@ -1,17 +1,29 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-
|
3
|
+
# on 2020-06-24 17:02:25 -0700 using RuboCop version 0.79.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 2
|
10
|
-
# Configuration parameters: IgnoredMethods.
|
11
10
|
Metrics/AbcSize:
|
12
11
|
Max: 16
|
13
12
|
|
14
|
-
# Offense count:
|
13
|
+
# Offense count: 8
|
15
14
|
# Configuration parameters: CountComments, ExcludedMethods.
|
16
15
|
Metrics/MethodLength:
|
17
16
|
Max: 15
|
17
|
+
|
18
|
+
# Offense count: 1
|
19
|
+
# Cop supports --auto-correct.
|
20
|
+
Style/IfUnlessModifier:
|
21
|
+
Exclude:
|
22
|
+
- 'exe/sdr'
|
23
|
+
|
24
|
+
# Offense count: 187
|
25
|
+
# Cop supports --auto-correct.
|
26
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
27
|
+
# URISchemes: http, https
|
28
|
+
Layout/LineLength:
|
29
|
+
Max: 1228
|
data/exe/sdr
CHANGED
@@ -31,8 +31,8 @@ deposit_options = OptionParser.new do |opts|
|
|
31
31
|
|
32
32
|
opts.on('--type TYPE', 'The object type to create. ' \
|
33
33
|
'One of: "image", "book", "document", "map", "manuscript", "media", ' \
|
34
|
-
'"three_dimensional", "collection", or "admin_policy"') do |type|
|
35
|
-
if %w[image book document map manuscript media three_dimensional collection admin_policy].include?(type)
|
34
|
+
'"three_dimensional", "object", "collection", or "admin_policy"') do |type|
|
35
|
+
if %w[image book document map manuscript media three_dimensional object collection admin_policy].include?(type)
|
36
36
|
options[:type] = "http://cocina.sul.stanford.edu/models/#{type}.jsonld"
|
37
37
|
end
|
38
38
|
end
|
data/lib/sdr_client.rb
CHANGED
@@ -9,15 +9,19 @@ module SdrClient
|
|
9
9
|
def self.write(body)
|
10
10
|
json = JSON.parse(body)
|
11
11
|
Dir.mkdir(credentials_path, 0o700) unless Dir.exist?(credentials_path)
|
12
|
-
File.
|
12
|
+
File.atomic_write(credentials_file) do |file|
|
13
13
|
file.write(json.fetch('token'))
|
14
14
|
end
|
15
|
+
File.chmod(0o600, credentials_file)
|
15
16
|
end
|
16
17
|
|
17
18
|
def self.read
|
18
19
|
raise NoCredentialsError unless ::File.exist?(credentials_file)
|
19
20
|
|
20
|
-
IO.readlines(credentials_file, chomp: true).first
|
21
|
+
creds = IO.readlines(credentials_file, chomp: true).first if ::File.exist?(credentials_file)
|
22
|
+
raise NoCredentialsError if creds.nil?
|
23
|
+
|
24
|
+
creds
|
21
25
|
end
|
22
26
|
|
23
27
|
def self.credentials_path
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'shellwords'
|
4
4
|
|
5
5
|
module SdrClient
|
6
6
|
module Deposit
|
@@ -9,7 +9,8 @@ module SdrClient
|
|
9
9
|
class MimeType
|
10
10
|
NAME = 'mime_type'
|
11
11
|
def self.for(file_path:, **)
|
12
|
-
|
12
|
+
argv = Shellwords.escape(file_path)
|
13
|
+
`file --mime-type -b #{argv}`.chomp
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
data/lib/sdr_client/version.rb
CHANGED
data/sdr-client.gemspec
CHANGED
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
38
38
|
spec.add_development_dependency 'rubocop', '~> 0.79.0'
|
39
39
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.37.1'
|
40
|
-
spec.add_development_dependency 'simplecov'
|
40
|
+
spec.add_development_dependency 'simplecov', '~> 0.17.0' # CodeClimate cannot use SimpleCov >= 0.18.0 for generating test coverage
|
41
41
|
spec.add_development_dependency 'webmock', '~> 3.7'
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdr-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -140,16 +140,16 @@ dependencies:
|
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 0.17.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 0.17.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: webmock
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|