assembly-objectfile 2.0.0 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3c456d372ab0804ebcaad06ac2b8695376f9ffe57ccb8a23b8a57d711df5561
4
- data.tar.gz: 1797606727f148ee128dedc102ad68480fbd9f55983c318b91c8f5f52a546a9b
3
+ metadata.gz: 101baff5dcb53ae691341818de800b9836bc5c2db2483b3cdac08afa8fed479e
4
+ data.tar.gz: 0265e4b3d35ecf91a07b48129e4485e9844e6e1c940a08ae4f32246b209d2260
5
5
  SHA512:
6
- metadata.gz: c927cb2cffef41a699c0f2e1f0fa0d8e6d4b1cc92c9fdb26b80ca5c9e851d7de0a9b1204cc4a4290213a9d7a642c2d3233db56396efb3b626cdd4d6e7b3bfdda
7
- data.tar.gz: 473f2ead345feaf0afd518da399751a86f526f27b19dd0bfd75fb55354bd055d00ccbbb06a96ca905f2e0de6fcdbf25d4e42e8da23fc167225afb8a9958038e3
6
+ metadata.gz: fa0814a3a51d7d98f7eeb91611193e367accb4161ab18967b1afdb7caeb54476994f078ed58eff684dfba37dd2358a75fba98b181df74f165f82c65537723ebc
7
+ data.tar.gz: 91272e14724ff23ac668bf65339f29a272606712da691a7e13018d70c7e2a00ac8d242723ae6b4a9e05007543174e43e6ade6abb8f71a922ff9a4f4b230b10bb
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@3.0.1
3
+ ruby-rails: sul-dlss/ruby-rails@3.1.2
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/.rubocop.yml CHANGED
@@ -9,11 +9,31 @@ AllCops:
9
9
  - '**/*.md'
10
10
  - 'vendor/**/*' # avoid running rubocop on cached bundler
11
11
 
12
+ Layout/LineLength:
13
+ Max: 120
14
+
15
+ Naming/FileName:
16
+ Exclude:
17
+ - 'lib/assembly-objectfile.rb'
18
+
19
+ Naming/PredicateName:
20
+ NamePrefix:
21
+ - 'is_'
22
+
12
23
  Metrics/BlockLength:
13
24
  Exclude:
14
25
  - 'spec/**/*.rb'
15
26
  - '**/*.gemspec'
16
27
 
28
+ RSpec/ExampleLength:
29
+ Max: 10
30
+
31
+ RSpec/MultipleExpectations:
32
+ Max: 10
33
+
34
+ RSpec/NestedGroups:
35
+ Max: 4
36
+
17
37
  Gemspec/DeprecatedAttributeAssignment: # (new in 1.10)
18
38
  Enabled: true
19
39
 
@@ -207,3 +227,16 @@ RSpec/ChangeByZero: # new in 2.11.0
207
227
  Enabled: true
208
228
  RSpec/VerifiedDoubleReference: # new in 2.10.0
209
229
  Enabled: true
230
+
231
+ Layout/LineContinuationLeadingSpace: # new in 1.31
232
+ Enabled: true
233
+ Layout/LineContinuationSpacing: # new in 1.31
234
+ Enabled: true
235
+ Lint/ConstantOverwrittenInRescue: # new in 1.31
236
+ Enabled: true
237
+ Lint/NonAtomicFileOperation: # new in 1.31
238
+ Enabled: true
239
+ RSpec/Capybara/SpecificMatcher: # new in 2.12
240
+ Enabled: true
241
+ RSpec/Rails/HaveHttpStatus: # new in 2.12
242
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,63 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-07-07 21:26:21 UTC using RuboCop version 1.31.0.
3
+ # on 2022-07-19 19:06:39 UTC using RuboCop version 1.31.2.
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
- # Offense count: 1
10
- Lint/UselessAssignment:
11
- Exclude:
12
- - 'config/boot.rb'
13
-
14
9
  # Offense count: 1
15
10
  # Configuration parameters: CountComments, CountAsOne.
16
11
  Metrics/ClassLength:
17
- Max: 122
18
-
19
- # Offense count: 1
20
- # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
21
- # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
22
- # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
23
- Naming/FileName:
24
- Exclude:
25
- - 'lib/assembly-objectfile.rb'
26
-
27
- # Offense count: 1
28
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
29
- # NamePrefix: is_, has_, have_
30
- # ForbiddenPrefixes: is_, has_, have_
31
- # AllowedMethods: is_a?
32
- # MethodDefinitionMacros: define_method, define_singleton_method
33
- Naming/PredicateName:
34
- Exclude:
35
- - 'spec/**/*'
36
- - 'lib/assembly-objectfile/object_file.rb'
37
-
38
- # Offense count: 2
39
- # Configuration parameters: CountAsOne.
40
- RSpec/ExampleLength:
41
- Max: 7
42
-
43
- # Offense count: 1
44
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
45
- # Include: **/*_spec*rb*, **/spec/**/*
46
- RSpec/FilePath:
47
- Exclude:
48
- - 'spec/object_file_spec.rb'
49
-
50
- # Offense count: 8
51
- RSpec/MultipleExpectations:
52
- Max: 6
53
-
54
- # Offense count: 3
55
- RSpec/NestedGroups:
56
- Max: 4
57
-
58
- # Offense count: 24
59
- # This cop supports safe autocorrection (--autocorrect).
60
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
61
- # URISchemes: http, https
62
- Layout/LineLength:
63
- Max: 187
12
+ Max: 118
data/Gemfile.lock CHANGED
@@ -1,17 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- assembly-objectfile (2.0.0)
4
+ assembly-objectfile (2.1.0)
5
5
  activesupport (>= 5.2.0)
6
- deprecation
7
6
  mime-types (> 3)
8
7
  mini_exiftool
9
- nokogiri
10
8
 
11
9
  GEM
12
10
  remote: http://rubygems.org/
13
11
  specs:
14
- activesupport (7.0.3)
12
+ activesupport (7.0.3.1)
15
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
14
  i18n (>= 1.6, < 2)
17
15
  minitest (>= 5.1)
@@ -20,11 +18,9 @@ GEM
20
18
  byebug (11.1.3)
21
19
  coderay (1.1.3)
22
20
  concurrent-ruby (1.1.10)
23
- deprecation (1.1.0)
24
- activesupport
25
21
  diff-lcs (1.5.0)
26
22
  docile (1.4.0)
27
- i18n (1.10.0)
23
+ i18n (1.12.0)
28
24
  concurrent-ruby (~> 1.0)
29
25
  json (2.6.2)
30
26
  method_source (1.0.0)
@@ -32,11 +28,7 @@ GEM
32
28
  mime-types-data (~> 3.2015)
33
29
  mime-types-data (3.2022.0105)
34
30
  mini_exiftool (2.10.2)
35
- mini_portile2 (2.8.0)
36
31
  minitest (5.16.2)
37
- nokogiri (1.13.6)
38
- mini_portile2 (~> 2.8.0)
39
- racc (~> 1.4)
40
32
  parallel (1.22.1)
41
33
  parser (3.1.2.0)
42
34
  ast (~> 2.4.1)
@@ -46,7 +38,6 @@ GEM
46
38
  pry-byebug (3.9.0)
47
39
  byebug (~> 11.0)
48
40
  pry (~> 0.13.0)
49
- racc (1.6.0)
50
41
  rainbow (3.1.1)
51
42
  rake (13.0.6)
52
43
  regexp_parser (2.5.0)
@@ -64,7 +55,8 @@ GEM
64
55
  diff-lcs (>= 1.2.0, < 2.0)
65
56
  rspec-support (~> 3.11.0)
66
57
  rspec-support (3.11.0)
67
- rubocop (1.31.0)
58
+ rubocop (1.31.2)
59
+ json (~> 2.3)
68
60
  parallel (~> 1.10)
69
61
  parser (>= 3.1.0.0)
70
62
  rainbow (>= 2.2.2, < 4.0)
@@ -73,10 +65,10 @@ GEM
73
65
  rubocop-ast (>= 1.18.0, < 2.0)
74
66
  ruby-progressbar (~> 1.7)
75
67
  unicode-display_width (>= 1.4.0, < 3.0)
76
- rubocop-ast (1.18.0)
68
+ rubocop-ast (1.19.1)
77
69
  parser (>= 3.1.1.0)
78
- rubocop-rspec (2.11.1)
79
- rubocop (~> 1.19)
70
+ rubocop-rspec (2.12.1)
71
+ rubocop (~> 1.31)
80
72
  ruby-progressbar (1.11.0)
81
73
  simplecov (0.21.2)
82
74
  docile (~> 1.1)
@@ -94,7 +86,6 @@ PLATFORMS
94
86
  DEPENDENCIES
95
87
  assembly-objectfile!
96
88
  byebug
97
- json
98
89
  pry-byebug
99
90
  rake
100
91
  rspec (~> 3.0)
@@ -103,4 +94,4 @@ DEPENDENCIES
103
94
  simplecov
104
95
 
105
96
  BUNDLED WITH
106
- 2.3.4
97
+ 2.3.17
data/README.md CHANGED
@@ -8,15 +8,15 @@
8
8
  ## Overview
9
9
  This gem contains classes used by the Stanford University Digital Library to
10
10
  perform file operations necessary for accessioning of content. It is also
11
- used by related gems to perform content type specific operations (such as jp2
12
- generation).
11
+ used by related gems that perform content type specific operations (e.g.
12
+ assembly-image for jp2 generation).
13
13
 
14
14
  ## Usage
15
15
 
16
16
  The gem currently has methods for:
17
17
  * filesize
18
- * exif
19
- * generate content metadata
18
+ * mimetype
19
+ * exif - consumers use ExifTool to get file information
20
20
 
21
21
  ## Running tests
22
22
 
@@ -34,8 +34,8 @@ rake release
34
34
 
35
35
  1. Exiftool
36
36
 
37
- RHEL: (RPM to install comming soon) Download latest version from:
38
- http://www.sno.phy.queensu.ca/~phil/exiftool
37
+ RHEL: (RPM to install coming soon) Download latest version from:
38
+ https://exiftool.org/
39
39
 
40
40
  tar -xf Image-ExifTool-#.##.tar.gz
41
41
  cd Image-ExifTool-#.##
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  $LOAD_PATH.push File.expand_path('lib', __dir__)
4
- require 'assembly-objectfile/version'
4
+ require 'assembly/object_file/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'assembly-objectfile'
@@ -10,7 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Peter Mangiafico', 'Renzo Sanchez-Silva', 'Monty Hindman', 'Tony Calavano']
11
11
  s.email = ['pmangiafico@stanford.edu']
12
12
  s.homepage = 'https://github.com/sul-dlss/assembly-objectfile'
13
- s.summary = 'Ruby immplementation of file services needed to prepare objects to be accessioned in SULAIR digital library'
13
+ s.summary = 'Ruby implementation of file services needed to prepare objects to be accessioned ' \
14
+ 'into the Stanford Digital Repository'
14
15
  s.description = 'Get exif data, file sizes and more.'
15
16
  s.license = 'ALv2'
16
17
  s.metadata['rubygems_mfa_required'] = 'true'
@@ -23,12 +24,9 @@ Gem::Specification.new do |s|
23
24
  s.required_ruby_version = '>= 3.0'
24
25
 
25
26
  s.add_dependency 'activesupport', '>= 5.2.0'
26
- s.add_dependency 'deprecation'
27
27
  s.add_dependency 'mime-types', '> 3'
28
28
  s.add_dependency 'mini_exiftool'
29
- s.add_dependency 'nokogiri'
30
29
 
31
- s.add_development_dependency 'json'
32
30
  s.add_development_dependency 'pry-byebug'
33
31
  s.add_development_dependency 'rake'
34
32
  s.add_development_dependency 'rspec', '~> 3.0'
data/config/boot.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rubygems'
4
4
 
5
- environment = ENV['ENVIRONMENT'] ||= 'development'
6
5
  project_root = File.expand_path("#{File.dirname(__FILE__)}/..")
7
6
 
8
7
  # Load config for current environment.
@@ -4,6 +4,6 @@
4
4
  module Assembly
5
5
  class ObjectFile
6
6
  # Gem version
7
- VERSION = '2.0.0'
7
+ VERSION = '2.1.0'
8
8
  end
9
9
  end
@@ -7,13 +7,15 @@ require 'active_support/core_ext/object/blank'
7
7
  module Assembly
8
8
  # This class contains generic methods to operate on any file.
9
9
  class ObjectFile
10
- # Class level method that given an array of strings, return the longest common initial path. Useful for removing a common path from a set of filenames when producing content metadata
10
+ # Class level method that given an array of strings, return the longest common initial path.
11
+ # Useful for removing a common path from a set of filenames when producing content metadata
11
12
  #
12
13
  # @param [Array] strings Array of filenames with paths to operate on
13
14
  # @return [String] longest common initial part of path of filenames passed in
14
15
  #
15
16
  # Example:
16
- # puts Assembly::ObjectFile.common_prefix(['/Users/peter/00/test.tif','/Users/peter/05/test.jp2']) # '/Users/peter/0'
17
+ # puts Assembly::ObjectFile.common_prefix(['/Users/peter/00/test.tif','/Users/peter/05/test.jp2'])
18
+ # # => '/Users/peter/0'
17
19
  def self.common_path(strings)
18
20
  return nil if strings.empty?
19
21
 
@@ -34,15 +36,22 @@ module Assembly
34
36
 
35
37
  # @param [String] path full path to the file to be worked with
36
38
  # @param [Hash<Symbol => Object>] params options used during content metadata generation
37
- # @option params [Hash<Symbol => ['yes', 'no']>] :file_attributes e.g. {:preserve=>'yes',:shelve=>'no',:publish=>'no'}, defaults pulled from mimetype
38
- # @option params [String] :label a resource label (files bundlded together will just get the first file's label attribute if set)
39
+ # @option params [Hash<Symbol => ['yes', 'no']>] :file_attributes e.g.:
40
+ # {:preserve=>'yes',:shelve=>'no',:publish=>'no'},
41
+ # defaults pulled from mimetype
42
+ # @option params [String] :label a resource label (files bundled together will just get the first
43
+ # file's label attribute if set)
39
44
  # @option params [String] :provider_md5 pre-computed MD5 checksum
40
45
  # @option params [String] :provider_sha1 pre-computed SHA1 checksum
41
- # @option params [String] :relative_path if you want the file ids in the content metadata it can be set, otherwise content metadata will get the full path
46
+ # @option params [String] :relative_path if you want the file ids in the content metadata it can be set,
47
+ # otherwise content metadata will get the full path
42
48
  # @option params [Array] :mime_type_order can be set to the order in which you want mimetypes to be determined
43
- # options are :override (from manual overide mapping if exists), :exif (from exif if exists),
44
- # :extension (from file extension), and :file (from unix file system command)
45
- # the default is defined in the private `default_mime_type_order` method but you can override to set your own order
49
+ # options are :override (from manual overide mapping if exists),
50
+ # :exif (from exif if exists)
51
+ # :extension (from file extension)
52
+ # :file (from unix file system command)
53
+ # the default is defined in the private `default_mime_type_order` method
54
+ # but you can override to set your own order
46
55
  # @example
47
56
  # Assembly::ObjectFile.new('/input/path_to_file.tif')
48
57
  def initialize(path, params = {})
@@ -136,7 +145,8 @@ module Assembly
136
145
  end
137
146
  end
138
147
 
139
- # @return [Symbol] the type of object, could be :application (for PDF or Word, etc), :audio, :image, :message, :model, :multipart, :text or :video
148
+ # @return [Symbol] the type of object, could be :application (for PDF or Word, etc),
149
+ # :audio, :image, :message, :model, :multipart, :text or :video
140
150
  # @example
141
151
  # source_file = Assembly::ObjectFile.new('/input/path_to_file.tif')
142
152
  # puts source_file.object_type # :image
@@ -165,18 +175,10 @@ module Assembly
165
175
  mimetype == 'image/jp2' || jp2able?
166
176
  end
167
177
 
168
- # @return [Boolean] true if image has a color profile, false if not.
169
- # @example
170
- # source_img = Assembly::ObjectFile.new('/input/path_to_file.tif')
171
- # puts source_img.has_color_profile? # true
172
- def has_color_profile?
173
- return false unless exif
174
-
175
- exif['profiledescription'] || exif['colorspace'] ? true : false
176
- end
177
-
178
- # Examines the input image for validity to create a jp2. Same as valid_image? but also confirms the existence of a profile description and further restricts mimetypes.
179
- # It is used by the assembly robots to decide if a jp2 will be created and is also called before you create a jp2 using assembly-image.
178
+ # Examines the input image for validity to create a jp2. Same as valid_image? but also confirms
179
+ # the existence of a profile description and further restricts mimetypes.
180
+ # It is used by the assembly robots to decide if a jp2 will be created and is also called before
181
+ # you create a jp2 using assembly-image.
180
182
  # @return [Boolean] true if image should have a jp2 created, false if not.
181
183
  # @example
182
184
  # source_img = Assembly::ObjectFile.new('/input/path_to_file.tif')
@@ -238,11 +240,12 @@ module Assembly
238
240
  def file_mimetype
239
241
  @file_mimetype ||= begin
240
242
  check_for_file
241
- `file --mime-type "#{path}"`.delete("\n").split(':')[1].strip # first try and get the mimetype from the unix file command
243
+ `file --mime-type "#{path}"`.delete("\n").split(':')[1].strip # get the mimetype from the unix file command
242
244
  end
243
245
  end
244
246
 
245
- # Returns mimetype information for the current file based on exif data (if available and not a trusted source that we'd rather get from the file system command)
247
+ # Returns mimetype information for the current file based on exif data
248
+ # (if available and not a trusted source that we'd rather get from the file system command)
246
249
  # @return [String] mime type for supplied file
247
250
  # @example
248
251
  # source_file = Assembly::ObjectFile.new('/input/path_to_file.txt')
@@ -250,7 +253,8 @@ module Assembly
250
253
  def exif_mimetype
251
254
  @exif_mimetype ||= begin
252
255
  check_for_file
253
- prefer_exif = !Assembly::TRUSTED_MIMETYPES.include?(file_mimetype) # if it's not a "trusted" mimetype and there is exif data; get the mimetype from the exif
256
+ # if it's not a "trusted" mimetype and there is exif data; get the mimetype from the exif
257
+ prefer_exif = !Assembly::TRUSTED_MIMETYPES.include?(file_mimetype)
254
258
  exif.mimetype if exif&.mimetype && prefer_exif
255
259
  end
256
260
  end
@@ -4,22 +4,24 @@ module Assembly
4
4
  # the path to the gem, used to access profiles stored with the gem
5
5
  PATH_TO_GEM = File.expand_path("#{File.dirname(__FILE__)}/..")
6
6
 
7
- # if input image is not one of these mime types, it will not be regarded as a valid image for the purpose of generating a JP2 derivative
7
+ # If input image is not one of these mime types, it will not be regarded as a valid image
8
+ # for the purpose of generating a JP2 derivative
8
9
  VALID_IMAGE_MIMETYPES = ['image/jpeg', 'image/tiff', 'image/tif', 'image/png'].freeze
9
10
 
10
- # the list of mimetypes that will be "trusted" by the unix file command; if a mimetype other than one of these is returned
11
- # by the file command, then a check will be made to see if exif data exists...if so, the mimetype returned by the exif data will be used
12
- # if no exif data exists, then the mimetype returned by the unix file command will be used
11
+ # The list of mimetypes that will be "trusted" by the unix file command; if a mimetype other than
12
+ # one of these is returned by the file command, then a check will be made to see if exif data exists...
13
+ # if so, the mimetype returned by the exif data will be used if no exif data exists, then the
14
+ # mimetype returned by the unix file command will be used
13
15
  TRUSTED_MIMETYPES = ['text/plain', 'plain/text', 'application/pdf', 'text/html', 'application/xml'].freeze
14
16
 
15
- # this is a manual override mapping of file extension to mimetype; if a file with the given extension is found, the mapped
16
- # mimetype will be returned and no further methods will be used - this is used to force a specific mimetype to be returned for
17
- # for a given file extension regardless of what exif or the unix file system command returns
18
- # the mapping format is "extension with period: returned mimetype", e.g. for any .json file, you will always get `application/json`
17
+ # This is a manual override mapping of file extension to mimetype; if a file with the given extension
18
+ # is found, the mapped mimetype will be returned and no further methods will be used - this is used
19
+ # to force a specific mimetype to be returned for a given file extension regardless of what exif or
20
+ # the unix file system command returns the mapping format is "extension with period: returned mimetype",
21
+ # e.g. for any .json file, you will always get `application/json`
19
22
  OVERRIDE_MIMETYPES = {
20
23
  '.json': 'application/json'
21
24
  }.freeze
22
25
  end
23
26
 
24
- require 'assembly-objectfile/object_file'
25
- require 'assembly-objectfile/version'
27
+ require 'assembly/object_file'
@@ -6,13 +6,15 @@ describe Assembly::ObjectFile do
6
6
  describe '.common_path' do
7
7
  context 'when common path is 2 nodes out of 4' do
8
8
  it 'returns the common directory' do
9
- expect(described_class.common_path(['/Users/peter/00/test.tif', '/Users/peter/05/test.jp2'])).to eq('/Users/peter/')
9
+ expect(described_class.common_path(['/Users/peter/00/test.tif',
10
+ '/Users/peter/05/test.jp2'])).to eq('/Users/peter/')
10
11
  end
11
12
  end
12
13
 
13
14
  context 'when common path is 3 nodes out of 4' do
14
15
  it 'returns the common directory' do
15
- expect(described_class.common_path(['/Users/peter/00/test.tif', '/Users/peter/00/test.jp2'])).to eq('/Users/peter/00/')
16
+ expect(described_class.common_path(['/Users/peter/00/test.tif',
17
+ '/Users/peter/00/test.jp2'])).to eq('/Users/peter/00/')
16
18
  end
17
19
  end
18
20
 
@@ -25,8 +27,9 @@ describe Assembly::ObjectFile do
25
27
 
26
28
  describe '#new' do
27
29
  context 'without params' do
30
+ let(:object_file) { described_class.new('/some/file.txt') }
31
+
28
32
  it 'does not set attributes' do
29
- object_file = described_class.new('/some/file.txt')
30
33
  expect(object_file.path).to eq('/some/file.txt')
31
34
  expect(object_file.label).to be_nil
32
35
  expect(object_file.file_attributes).to be_nil
@@ -37,8 +40,15 @@ describe Assembly::ObjectFile do
37
40
  end
38
41
 
39
42
  context 'with params' do
43
+ let(:object_file) do
44
+ described_class.new('/some/file.txt', label: 'some label',
45
+ file_attributes: { 'shelve' => 'yes',
46
+ 'publish' => 'yes',
47
+ 'preserve' => 'no' },
48
+ relative_path: '/tmp')
49
+ end
50
+
40
51
  it 'sets attributes to passed params' do
41
- object_file = described_class.new('/some/file.txt', label: 'some label', file_attributes: { 'shelve' => 'yes', 'publish' => 'yes', 'preserve' => 'no' }, relative_path: '/tmp')
42
52
  expect(object_file.path).to eq('/some/file.txt')
43
53
  expect(object_file.label).to eq('some label')
44
54
  expect(object_file.file_attributes).to eq('shelve' => 'yes', 'publish' => 'yes', 'preserve' => 'no')
@@ -47,9 +57,12 @@ describe Assembly::ObjectFile do
47
57
  expect(object_file.relative_path).to eq('/tmp')
48
58
  end
49
59
 
50
- it 'sets provider_md5 to passed param' do
51
- object_file = described_class.new('/some/file.txt', provider_md5: 'XYZ')
52
- expect(object_file.provider_md5).to eq('XYZ')
60
+ context 'with provider_md5' do
61
+ let(:object_file) { described_class.new('/some/file.txt', provider_md5: 'XYZ') }
62
+
63
+ it 'sets provider_md5 to passed param' do
64
+ expect(object_file.provider_md5).to eq('XYZ')
65
+ end
53
66
  end
54
67
  end
55
68
  end
@@ -100,7 +113,7 @@ describe Assembly::ObjectFile do
100
113
 
101
114
  context 'with ruby file' do
102
115
  it 'false' do
103
- non_image_file = File.join(Assembly::PATH_TO_GEM, 'spec/object_file_spec.rb')
116
+ non_image_file = File.join(Assembly::PATH_TO_GEM, 'spec/assembly/object_file_spec.rb')
104
117
  object_file = described_class.new(non_image_file)
105
118
  expect(object_file.image?).to be(false)
106
119
  end
@@ -132,7 +145,7 @@ describe Assembly::ObjectFile do
132
145
 
133
146
  context 'with ruby file' do
134
147
  it ':text' do
135
- non_image_file = File.join(Assembly::PATH_TO_GEM, 'spec/object_file_spec.rb')
148
+ non_image_file = File.join(Assembly::PATH_TO_GEM, 'spec/assembly/object_file_spec.rb')
136
149
  object_file = described_class.new(non_image_file)
137
150
  expect(object_file.object_type).to eq(:text)
138
151
  end
@@ -178,7 +191,7 @@ describe Assembly::ObjectFile do
178
191
 
179
192
  context 'with ruby file' do
180
193
  it 'false' do
181
- non_image_file = File.join(Assembly::PATH_TO_GEM, 'spec/object_file_spec.rb')
194
+ non_image_file = File.join(Assembly::PATH_TO_GEM, 'spec/assembly/object_file_spec.rb')
182
195
  object_file = described_class.new(non_image_file)
183
196
  expect(object_file.valid_image?).to be(false)
184
197
  end
@@ -320,29 +333,6 @@ describe Assembly::ObjectFile do
320
333
  end
321
334
  end
322
335
 
323
- describe '#has_color_profile?' do
324
- context 'with jp2 file' do
325
- it 'true' do
326
- object_file = described_class.new(TEST_JP2_INPUT_FILE)
327
- expect(object_file.has_color_profile?).to be(true)
328
- end
329
- end
330
-
331
- context 'with tiff file' do
332
- it 'true' do
333
- object_file = described_class.new(TEST_RES1_TIF1)
334
- expect(object_file.has_color_profile?).to be(true)
335
- end
336
- end
337
-
338
- context 'with tiff no color file' do
339
- it 'false' do
340
- object_file = described_class.new(TEST_TIFF_NO_COLOR_FILE)
341
- expect(object_file.has_color_profile?).to be(false)
342
- end
343
- end
344
- end
345
-
346
336
  describe '#md5' do
347
337
  it 'computes md5 for an image file' do
348
338
  object_file = described_class.new(TEST_TIF_INPUT_FILE)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assembly-objectfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2022-07-08 00:00:00.000000000 Z
14
+ date: 2022-07-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -27,20 +27,6 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 5.2.0
30
- - !ruby/object:Gem::Dependency
31
- name: deprecation
32
- requirement: !ruby/object:Gem::Requirement
33
- requirements:
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: '0'
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
30
  - !ruby/object:Gem::Dependency
45
31
  name: mime-types
46
32
  requirement: !ruby/object:Gem::Requirement
@@ -69,34 +55,6 @@ dependencies:
69
55
  - - ">="
70
56
  - !ruby/object:Gem::Version
71
57
  version: '0'
72
- - !ruby/object:Gem::Dependency
73
- name: nokogiri
74
- requirement: !ruby/object:Gem::Requirement
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: '0'
79
- type: :runtime
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- - !ruby/object:Gem::Dependency
87
- name: json
88
- requirement: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- type: :development
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: '0'
100
58
  - !ruby/object:Gem::Dependency
101
59
  name: pry-byebug
102
60
  requirement: !ruby/object:Gem::Requirement
@@ -205,12 +163,9 @@ files:
205
163
  - bin/run_all_tests
206
164
  - config/boot.rb
207
165
  - lib/assembly-objectfile.rb
208
- - lib/assembly-objectfile/object_file.rb
209
- - lib/assembly-objectfile/version.rb
210
- - profiles/AdobeRGB1998.icc
211
- - profiles/DotGain20.icc
212
- - profiles/sRGBIEC6196621.icc
213
- - spec/object_file_spec.rb
166
+ - lib/assembly/object_file.rb
167
+ - lib/assembly/object_file/version.rb
168
+ - spec/assembly/object_file_spec.rb
214
169
  - spec/spec_helper.rb
215
170
  - spec/test_data/empty.txt
216
171
  - spec/test_data/input/.empty
@@ -244,9 +199,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
199
  - !ruby/object:Gem::Version
245
200
  version: '0'
246
201
  requirements: []
247
- rubygems_version: 3.3.7
202
+ rubygems_version: 3.2.32
248
203
  signing_key:
249
204
  specification_version: 4
250
- summary: Ruby immplementation of file services needed to prepare objects to be accessioned
251
- in SULAIR digital library
205
+ summary: Ruby implementation of file services needed to prepare objects to be accessioned
206
+ into the Stanford Digital Repository
252
207
  test_files: []
Binary file
Binary file
Binary file