sdr-client 0.96.0 → 0.97.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74e0b90a6bacfc70362321764e79a26db88ca6b17bb37debcdfbafbba4cf117c
4
- data.tar.gz: 512f7e341236bcfd30fba4b45cf8844b851c62335abc39139185913dbca375e1
3
+ metadata.gz: c562c90ba48ff8d6168c1c7488537bde46faab61ec81963de5917776ffa9f079
4
+ data.tar.gz: 1e22559c270a5312f975a382c87daac40af750c24755f62c02873775d07c0855
5
5
  SHA512:
6
- metadata.gz: fff091c59cf01f92fb978987e123814916ce791e9d965007a82641cf7a7ceb41011e34854ad7efed3afc454c31ffa6515de77dbfa3f2f1f55226213787f2b041
7
- data.tar.gz: f3273189c211b9c82141aa7e10b76387d6a6a2105bca12b7d5867363ea6b2c35e136ab2dd5b72586c63f7ff9123c322db31f6741e57dc0883a7254735fcd5a4e
6
+ metadata.gz: 5aa3b0ff99dfedf0751c5c0f9782d5c17b0092a5aa98a222e9f15c0011945f6fa67403f82334bcdfc6d405883e49682032dee0b498a1a0f56d7b84a52cf36756
7
+ data.tar.gz: ed9acb2561e273f516804b60b734d3a4c900b79c3648bfa62cde33d3164ab42e27d13d675233ca45f3f1f0d75314cca3702810a0a9ed3a9f7b68359332f12a89
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sdr-client (0.96.0)
4
+ sdr-client (0.97.0)
5
5
  activesupport
6
6
  cocina-models (~> 0.86.0)
7
7
  dry-monads
@@ -45,33 +45,38 @@ GEM
45
45
  docile (1.4.0)
46
46
  dry-container (0.11.0)
47
47
  concurrent-ruby (~> 1.0)
48
- dry-core (0.8.1)
48
+ dry-core (0.9.1)
49
49
  concurrent-ruby (~> 1.0)
50
+ zeitwerk (~> 2.6)
50
51
  dry-inflector (0.3.0)
51
- dry-logic (1.2.0)
52
+ dry-logic (1.3.0)
52
53
  concurrent-ruby (~> 1.0)
53
- dry-core (~> 0.5, >= 0.5)
54
- dry-monads (1.4.0)
54
+ dry-core (~> 0.9, >= 0.9)
55
+ zeitwerk (~> 2.6)
56
+ dry-monads (1.5.0)
55
57
  concurrent-ruby (~> 1.0)
56
- dry-core (~> 0.7)
57
- dry-struct (1.4.0)
58
- dry-core (~> 0.5, >= 0.5)
59
- dry-types (~> 1.5)
58
+ dry-core (~> 0.9, >= 0.9)
59
+ zeitwerk (~> 2.6)
60
+ dry-struct (1.5.2)
61
+ dry-core (~> 0.9, >= 0.9)
62
+ dry-types (~> 1.6)
60
63
  ice_nine (~> 0.11)
61
- dry-types (1.5.1)
64
+ zeitwerk (~> 2.6)
65
+ dry-types (1.6.1)
62
66
  concurrent-ruby (~> 1.0)
63
67
  dry-container (~> 0.3)
64
- dry-core (~> 0.5, >= 0.5)
68
+ dry-core (~> 0.9, >= 0.9)
65
69
  dry-inflector (~> 0.1, >= 0.1.2)
66
- dry-logic (~> 1.0, >= 1.0.2)
70
+ dry-logic (~> 1.3, >= 1.3)
71
+ zeitwerk (~> 2.6)
67
72
  edtf (3.1.0)
68
73
  activesupport (>= 3.0, < 8.0)
69
74
  equivalent-xml (0.6.0)
70
75
  nokogiri (>= 1.4.3)
71
- faraday (2.5.2)
76
+ faraday (2.6.0)
72
77
  faraday-net_http (>= 2.0, < 3.1)
73
78
  ruby2_keywords (>= 0.0.4)
74
- faraday-net_http (3.0.0)
79
+ faraday-net_http (3.0.1)
75
80
  hashdiff (1.0.1)
76
81
  i18n (1.12.0)
77
82
  concurrent-ruby (~> 1.0)
@@ -81,9 +86,9 @@ GEM
81
86
  multi_json
82
87
  minitest (5.16.3)
83
88
  multi_json (1.15.0)
84
- nokogiri (1.13.8-x86_64-darwin)
89
+ nokogiri (1.13.9-x86_64-darwin)
85
90
  racc (~> 1.4)
86
- nokogiri (1.13.8-x86_64-linux)
91
+ nokogiri (1.13.9-x86_64-linux)
87
92
  racc (~> 1.4)
88
93
  openapi3_parser (0.9.2)
89
94
  commonmarker (~> 0.17)
@@ -98,40 +103,40 @@ GEM
98
103
  racc (1.6.0)
99
104
  rainbow (3.1.1)
100
105
  rake (13.0.6)
101
- regexp_parser (2.5.0)
106
+ regexp_parser (2.6.0)
102
107
  rexml (3.2.5)
103
- rspec (3.11.0)
104
- rspec-core (~> 3.11.0)
105
- rspec-expectations (~> 3.11.0)
106
- rspec-mocks (~> 3.11.0)
107
- rspec-core (3.11.0)
108
- rspec-support (~> 3.11.0)
109
- rspec-expectations (3.11.1)
108
+ rspec (3.12.0)
109
+ rspec-core (~> 3.12.0)
110
+ rspec-expectations (~> 3.12.0)
111
+ rspec-mocks (~> 3.12.0)
112
+ rspec-core (3.12.0)
113
+ rspec-support (~> 3.12.0)
114
+ rspec-expectations (3.12.0)
110
115
  diff-lcs (>= 1.2.0, < 2.0)
111
- rspec-support (~> 3.11.0)
112
- rspec-mocks (3.11.1)
116
+ rspec-support (~> 3.12.0)
117
+ rspec-mocks (3.12.0)
113
118
  diff-lcs (>= 1.2.0, < 2.0)
114
- rspec-support (~> 3.11.0)
115
- rspec-support (3.11.1)
116
- rspec_junit_formatter (0.5.1)
119
+ rspec-support (~> 3.12.0)
120
+ rspec-support (3.12.0)
121
+ rspec_junit_formatter (0.6.0)
117
122
  rspec-core (>= 2, < 4, != 2.12.0)
118
123
  rss (0.2.9)
119
124
  rexml
120
- rubocop (1.36.0)
125
+ rubocop (1.37.1)
121
126
  json (~> 2.3)
122
127
  parallel (~> 1.10)
123
128
  parser (>= 3.1.2.1)
124
129
  rainbow (>= 2.2.2, < 4.0)
125
130
  regexp_parser (>= 1.8, < 3.0)
126
131
  rexml (>= 3.2.5, < 4.0)
127
- rubocop-ast (>= 1.20.1, < 2.0)
132
+ rubocop-ast (>= 1.23.0, < 2.0)
128
133
  ruby-progressbar (~> 1.7)
129
134
  unicode-display_width (>= 1.4.0, < 3.0)
130
- rubocop-ast (1.21.0)
135
+ rubocop-ast (1.23.0)
131
136
  parser (>= 3.1.1.0)
132
137
  rubocop-rake (0.6.0)
133
138
  rubocop (~> 1.0)
134
- rubocop-rspec (2.13.2)
139
+ rubocop-rspec (2.14.2)
135
140
  rubocop (~> 1.33)
136
141
  ruby-progressbar (1.11.0)
137
142
  ruby2_keywords (0.0.5)
@@ -153,7 +158,7 @@ GEM
153
158
  addressable (>= 2.8.0)
154
159
  crack (>= 0.3.2)
155
160
  hashdiff (>= 0.4.0, < 2.0.0)
156
- zeitwerk (2.6.0)
161
+ zeitwerk (2.6.4)
157
162
 
158
163
  PLATFORMS
159
164
  x86_64-darwin-19
data/README.md CHANGED
@@ -11,9 +11,10 @@ This provides a way for consumers to easily and correctly deposit files to the S
11
11
 
12
12
  ## Install
13
13
 
14
- We recommend using the latest 3.x release of Ruby.
14
+ Ruby 3 is required. The latest 3.x release is recommended.
15
15
 
16
16
  `gem install sdr-client`
17
+ Note that some commands require the lastest version of the client. Use this command to update the client as necessary.
17
18
 
18
19
  ## Usage
19
20
 
@@ -35,6 +36,7 @@ Log in:
35
36
  ```
36
37
  sdr login --url https://sdr-api-server:3000
37
38
  ```
39
+ You will be prompted for an email and password. Note that this is for an SDR API account, not SUNET account.
38
40
 
39
41
  Display version of sdr-client:
40
42
  ```
@@ -31,13 +31,12 @@ module SdrClient
31
31
  # @return [Hash<String, Hash<String, String>>]
32
32
  def build
33
33
  files.each do |file_path|
34
- file_key = ::File.basename(file_path)
35
34
  OPERATIONS.each do |operation|
36
35
  result = operation.for(file_path: file_path)
37
36
  next if result.nil?
38
37
 
39
- files_metadata[file_key] ||= {}
40
- files_metadata[file_key][operation::NAME] = result
38
+ files_metadata[file_path] ||= {}
39
+ files_metadata[file_path][operation::NAME] = result
41
40
  end
42
41
  end
43
42
  files_metadata
@@ -41,7 +41,7 @@ module SdrClient
41
41
  def file_args(upload, upload_metadata)
42
42
  args = {
43
43
  external_identifier: upload.signed_id,
44
- label: upload.filename,
44
+ label: ::File.basename(upload.filename),
45
45
  filename: upload.filename
46
46
  }
47
47
  args.merge!(upload_metadata)
@@ -10,7 +10,7 @@ module SdrClient
10
10
  # Call `#values` on the result of the grouping operation because 1)
11
11
  # `Process#build_filesets` expects an array of arrays, not an array of
12
12
  # hashes, and 2) the keys aren't used anywhere
13
- uploads.group_by { |ul| ::File.basename(ul.filename, '.*') }.values
13
+ uploads.group_by { |ul| ::File.join(::File.dirname(ul.filename), ::File.basename(ul.filename, '.*')) }.values
14
14
  end
15
15
  end
16
16
  end
@@ -61,15 +61,12 @@ module SdrClient
61
61
  def child_files_match
62
62
  # Files without request files.
63
63
  files.each do |filepath|
64
- filename = ::File.basename(filepath)
65
-
66
- raise "Request file not provided for #{filepath}" if request_files[filename].nil?
64
+ raise "Request file not provided for #{filepath}" if request_files[filepath].nil?
67
65
  end
68
66
 
69
67
  # Request files without files
70
- filenames = files.map { |filepath| ::File.basename(filepath) }
71
68
  request_files.each_key do |request_filename|
72
- raise "File not provided for request file #{request_filename}" unless filenames.include?(request_filename)
69
+ raise "File not provided for request file #{request_filename}" unless files.include?(request_filename)
73
70
  end
74
71
  end
75
72
 
@@ -77,8 +77,7 @@ module SdrClient
77
77
  def mime_types
78
78
  @mime_types ||=
79
79
  files.to_h do |filepath|
80
- filename = ::File.basename(filepath)
81
- [filename, metadata.for(filename)['mime_type']]
80
+ [filepath, metadata.for(filepath)['mime_type']]
82
81
  end
83
82
  end
84
83
  end
@@ -28,6 +28,8 @@ module SdrClient
28
28
  def run
29
29
  file_metadata.map do |filename, metadata|
30
30
  direct_upload(metadata.to_json).tap do |response|
31
+ # ActiveStorage modifies the filename provided in response, so setting here.
32
+ response.filename = filename
31
33
  upload_file(filename: filename,
32
34
  url: response.direct_upload.fetch('url'),
33
35
  content_type: response.content_type,
@@ -34,7 +34,7 @@ module SdrClient
34
34
  # This can be overridden in the case that the file on disk has a different
35
35
  # name than we want to repo to know about.
36
36
  def filename_for(file_path)
37
- ::File.basename(file_path)
37
+ file_path
38
38
  end
39
39
 
40
40
  def mime_type_for(file_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.96.0'
4
+ VERSION = '0.97.0'
5
5
  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.96.0
4
+ version: 0.97.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-27 00:00:00.000000000 Z
11
+ date: 2022-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
- rubygems_version: 3.2.32
277
+ rubygems_version: 3.3.7
278
278
  signing_key:
279
279
  specification_version: 4
280
280
  summary: The CLI for https://github.com/sul-dlss/sdr-api