assembly-image 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b213d29d1bbd1206e9268adeff0d7eba4f9e8b26
4
- data.tar.gz: 04d757adec2931a7ca42ac9f1cf7f29d6b7dbbc0
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGE0YzJiODk5NThlM2U1OTU1YjM2N2VhMzY1MTFiNmZhZWI2ZTBkNA==
5
+ data.tar.gz: !binary |-
6
+ OWE0YzZiMDMyNDM0MDc4NTM5NzNjNzdiYWQ5YzQwZjQ5ZWFkZDE4Ng==
5
7
  SHA512:
6
- metadata.gz: 84120410f44ab8fdbf8fe2f7e9943d6209058e6bc4ffc707e149ba134c65b3165e1839ec869bf40b33a823ab395ed7ddfbbb22582f8aee53c2a5befaf8d31b62
7
- data.tar.gz: fb93f15796aacf0500337b0afe7997cec9d832edb39f23f6078cacaef061c36efb5e85b48b4f40607f2b7d86bd3d58afdd569f33f3babfe1c980de90179b89d6
8
+ metadata.gz: !binary |-
9
+ ZjlhNmFiMmQxNDdlMjc2NTgzMTIzYmYxMWRlNGExZTQwNzY2NzI2ZGQwMzEx
10
+ ZWU5ZjRjNzMxZmIzODBkYWY1NzM1NTg5ZDJkMWFlMTRmYjliNmZhMTVhNmJl
11
+ OTQ0ZWY1YTBhYzQ2ZTgwNGZjYzU5ODgwNGNmZGUyNWMyNDI4MzE=
12
+ data.tar.gz: !binary |-
13
+ ODQxM2Y0ODBhNzk2YTkwZDA2NTIyZWIxMzlkNTQ4ZDdhN2VhZmVkZTY2MTdh
14
+ NDljNGI5MDk0YjI4OTQ2MmRkM2I1YzJhMDg2YTJiNzI1OWE2NWViMGI4MjBj
15
+ MmRhYjJlMDcyOTZkNTVkZGE1YWYwY2Q1NTg3MjRkMmY2ZjNkNDA=
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source "http://rubygems.org"
2
+ source "http://sul-gems.stanford.edu"
2
3
 
3
4
  # Specify your gem's dependencies in assembly-image.gemspec
4
5
  gemspec
data/README.rdoc CHANGED
@@ -44,8 +44,8 @@ image operations necessary for accessioning of content.
44
44
  - 1.6.1 bump version number of assembly-objectfile required to fix UTF-8 errors during JP2-create
45
45
  - 1.6.2-1.6.3 small change to jp2 generation to try and fix bug with tiffs that have multiple input profile layers
46
46
  - 1.6.4 added in some additional checks to try and create jp2s with mismatching exif data
47
- - 1.6.5 fix problem with lack of extension in incoming tif causing a problem when creating jp2
48
- - 1.6.7 release to github/rubygems
47
+ - 1.6.5-1.6.6 fix problem with lack of extension in incoming tif causing a problem when creating jp2
48
+ - 1.6.7-1.6.8 tweaks to gemspec
49
49
  ==Notes
50
50
 
51
51
  1. The gem assumes that the user context in which it is executed has write access to the 'tmp' folder.
@@ -59,6 +59,11 @@ folder so they can be re-used and do not need to be extracted.
59
59
  3. If an image is passed in with a color profile that cannot be determined by examining the exif header data, an exception will be thrown.
60
60
  This can commonally occur in basic test TIFs that are black/white and have no profile, so beware during testing.
61
61
 
62
+ ==Deploy new gem
63
+
64
+ gem build assembly-image.gemspec
65
+ gem push assembly-image-1.6.8.gem # update version as needed
66
+
62
67
  ==Usage
63
68
 
64
69
  To use the JP2 creation method, you first instantiate the image object with an input image and then operate on it.
@@ -78,7 +83,7 @@ To generate documentation into the "doc" folder:
78
83
 
79
84
  yard
80
85
 
81
- To keep a local server running with up to date code documentation that you can view in your browser:
86
+ To keep a local server running with up to date code documentation that you can view in your browser at http://0.0.0.0:8808:
82
87
 
83
88
  yard server --reload
84
89
 
@@ -137,3 +142,4 @@ To keep a local server running with up to date code documentation that you can v
137
142
  Mac users:
138
143
 
139
144
  brew install exiftool
145
+
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ require 'dlss/rake/dlss_release'
4
+ Dlss::Release.new
5
+
3
6
  require 'rspec/core/rake_task'
4
7
 
5
8
  desc "Run specs"
6
9
  RSpec::Core::RakeTask.new(:spec)
7
10
 
8
- task :default => :spec
11
+ task :default => :spec
@@ -20,11 +20,11 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'uuidtools'
21
21
  s.add_dependency 'assembly-objectfile', ">= 1.6.4"
22
22
  s.add_dependency 'mini_exiftool', "~> 1.6"
23
- s.add_dependency 'activesupport'
23
+ s.add_dependency 'activesupport', '>3'
24
24
  s.add_dependency 'nokogiri'
25
25
 
26
- s.add_development_dependency "rspec", "~> 3.0"
26
+ s.add_development_dependency "rspec", "~> 2.6"
27
+ s.add_development_dependency "lyberteam-gems-devel", "> 1.0.0"
27
28
  s.add_development_dependency "yard"
28
- s.add_development_dependency "rake"
29
29
 
30
- end
30
+ end
@@ -1,16 +1,7 @@
1
- require 'logger'
2
1
  module Assembly
3
2
 
4
3
  # The Images class contains methods to operate on multiple images in batch.
5
4
  class Images
6
-
7
- def self.logger
8
- @logger ||= Logger.new(STDERR)
9
- end
10
-
11
- def self.logger= logger
12
- @logger = logger
13
- end
14
5
 
15
6
  # Pass in a source path and have exif color profile descriptions added to all images contained.
16
7
  # This is useful if your source TIFFs do not have color profile descriptions in the EXIF data, but you know what it should be.
@@ -36,13 +27,13 @@ module Assembly
36
27
 
37
28
  raise "Input path does not exist" unless File.directory?(source)
38
29
 
39
- logger.debug "Source: #{source}"
30
+ puts "Source: #{source}"
40
31
 
41
32
  # iterate over input directory looking for tifs
42
33
  pattern = recursive ? "**/*.#{extension}" : "*.#{extension}*"
43
34
  Dir.glob(File.join(source,pattern)).each do |file|
44
35
  img=Assembly::Image.new(file)
45
- logger.debug "Processing #{file}"
36
+ puts "Processing #{file}"
46
37
  img.add_exif_profile_description(profile_name,force)
47
38
  end
48
39
  return "Complete"
@@ -74,8 +65,8 @@ module Assembly
74
65
  Dir.mkdir(output) unless File.directory?(output) # attemp to make output directory
75
66
  raise "Output path does not exist or could not be created" unless File.directory?(output)
76
67
 
77
- logger.debug "Source: #{source}"
78
- logger.debug "Destination: #{output}"
68
+ puts "Source: #{source}"
69
+ puts "Destination: #{output}"
79
70
 
80
71
  pattern = recursive ? "**/*.#{extension}" : "*.#{extension}*"
81
72
 
@@ -85,9 +76,9 @@ module Assembly
85
76
  output_img=File.join(output,File.basename(file,File.extname(file))+'.jp2') # output image gets same file name as source, but with a jp2 extension and in the correct output directory
86
77
  begin
87
78
  derivative_img=source_img.create_jp2(:overwrite=>overwrite,:output=>output_img)
88
- logger.debug "Generated jp2 for #{File.basename(file)}"
79
+ puts "Generated jp2 for #{File.basename(file)}"
89
80
  rescue Exception => e
90
- logger.debug "** Error for #{File.basename(file)}: #{e.message}"
81
+ puts "** Error for #{File.basename(file)}: #{e.message}"
91
82
  end
92
83
  end
93
84
  return 'Complete'
@@ -3,6 +3,6 @@ module Assembly
3
3
  # Main Image class
4
4
  class Image
5
5
  # Project version number
6
- VERSION = "1.6.7"
6
+ VERSION = "1.6.8"
7
7
  end
8
8
  end
data/spec/image_spec.rb CHANGED
@@ -4,27 +4,27 @@ describe Assembly::Image do
4
4
 
5
5
  it "should not run if no input file is passed in" do
6
6
  @ai=Assembly::Image.new('')
7
- expect{@ai.create_jp2}.to raise_error
7
+ lambda{@ai.create_jp2}.should raise_error
8
8
  end
9
9
 
10
10
  it "should indicate the default jp2 filename" do
11
11
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
12
- expect(@ai.jp2_filename).to eq TEST_TIF_INPUT_FILE.gsub('.tif','.jp2')
12
+ @ai.jp2_filename.should == TEST_TIF_INPUT_FILE.gsub('.tif','.jp2')
13
13
  end
14
14
 
15
15
  it "should indicate the default jp2 filename" do
16
16
  @ai = Assembly::Image.new("/path/to/a/file_with_no_extension")
17
- expect(@ai.jp2_filename).to eq "/path/to/a/file_with_no_extension.jp2"
17
+ @ai.jp2_filename.should == "/path/to/a/file_with_no_extension.jp2"
18
18
  end
19
19
 
20
20
  it "should indicate the default DPG jp2 filename" do
21
21
  @ai = Assembly::Image.new(TEST_DPG_TIF_INPUT_FILE)
22
- expect(@ai.dpg_jp2_filename).to eq TEST_DPG_TIF_INPUT_FILE.gsub('.tif','.jp2').gsub('_00_','_05_')
22
+ @ai.dpg_jp2_filename.should == TEST_DPG_TIF_INPUT_FILE.gsub('.tif','.jp2').gsub('_00_','_05_')
23
23
  end
24
24
 
25
25
  it "should indicate the default jp2 filename" do
26
26
  @ai = Assembly::Image.new("/path/to/a/file_with_no_00_extension")
27
- expect(@ai.dpg_jp2_filename).to eq "/path/to/a/file_with_no_05_extension.jp2"
27
+ @ai.dpg_jp2_filename.should == "/path/to/a/file_with_no_05_extension.jp2"
28
28
  end
29
29
 
30
30
  it "should create jp2 when given an RGB tif" do
@@ -33,13 +33,13 @@ describe Assembly::Image do
33
33
  expect(File).to_not exist TEST_JP2_OUTPUT_FILE
34
34
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
35
35
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)
36
- expect(result).to be_a_kind_of Assembly::Image
37
- expect(result.path).to eq TEST_JP2_OUTPUT_FILE
38
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
39
- expect(result.exif.colorspace).to eq "sRGB"
36
+ result.class.should be Assembly::Image
37
+ result.path.should == TEST_JP2_OUTPUT_FILE
38
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
39
+ result.exif.colorspace.should == "sRGB"
40
40
  @jp2=Assembly::Image.new(TEST_JP2_OUTPUT_FILE)
41
- expect(@jp2.height).to eq 100
42
- expect(@jp2.width).to eq 100
41
+ @jp2.height.should == 100
42
+ @jp2.width.should == 100
43
43
  end
44
44
 
45
45
  it "should create grayscale jp2 when given a bitonal tif" do
@@ -47,10 +47,10 @@ describe Assembly::Image do
47
47
  expect(File).to exist TEST_TIF_INPUT_FILE
48
48
  expect(File).to_not exist TEST_JP2_OUTPUT_FILE
49
49
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
50
- expect(@ai).to have_color_profile
50
+ @ai.has_color_profile?.should be true
51
51
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)
52
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
53
- expect(result.exif.colorspace).to eq "Grayscale"
52
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
53
+ result.exif.colorspace.should == "Grayscale"
54
54
  end
55
55
 
56
56
  it "should create color jp2 when given a color tif but bitonal image data (1 channels and 1 bits per pixel)" do
@@ -58,10 +58,10 @@ describe Assembly::Image do
58
58
  expect(File).to exist TEST_TIF_INPUT_FILE
59
59
  expect(File).to_not exist TEST_JP2_OUTPUT_FILE
60
60
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
61
- expect(@ai).to_not have_color_profile
61
+ @ai.has_color_profile?.should be false
62
62
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)
63
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
64
- expect(result.exif.colorspace).to eq "sRGB"
63
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
64
+ result.exif.colorspace.should == "sRGB"
65
65
  end
66
66
 
67
67
  it "should create grayscale jp2 when given a graycale tif but with bitonal image data (1 channel and 1 bits per pixel)" do
@@ -69,10 +69,10 @@ describe Assembly::Image do
69
69
  expect(File).to exist TEST_TIF_INPUT_FILE
70
70
  expect(File).to_not exist TEST_JP2_OUTPUT_FILE
71
71
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
72
- expect(@ai).to_not have_color_profile
72
+ @ai.has_color_profile?.should be false
73
73
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)
74
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
75
- expect(result.exif.colorspace).to eq "Grayscale"
74
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
75
+ result.exif.colorspace.should == "Grayscale"
76
76
  end
77
77
 
78
78
  it "should create color jp2 when given a color tif but with greyscale image data (1 channel and 8 bits per pixel)" do
@@ -80,10 +80,10 @@ describe Assembly::Image do
80
80
  expect(File).to exist TEST_TIF_INPUT_FILE
81
81
  expect(File).to_not exist TEST_JP2_OUTPUT_FILE
82
82
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
83
- expect(@ai).to_not have_color_profile
83
+ @ai.has_color_profile?.should be false
84
84
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)
85
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
86
- expect(result.exif.colorspace).to eq "sRGB"
85
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
86
+ result.exif.colorspace.should == "sRGB"
87
87
  end
88
88
 
89
89
  it "should create a jp2 when the source image has no profile" do
@@ -91,11 +91,11 @@ describe Assembly::Image do
91
91
  expect(File).to exist TEST_TIF_INPUT_FILE
92
92
  expect(File).to_not exist TEST_JP2_OUTPUT_FILE
93
93
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
94
- expect(@ai).to_not have_color_profile
95
- expect(@ai).to be_a_valid_image
96
- expect(@ai).to be_jp2able
94
+ @ai.has_color_profile?.should be false
95
+ @ai.valid_image?.should be true
96
+ @ai.jp2able?.should be true
97
97
  @ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)
98
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
98
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
99
99
  end
100
100
 
101
101
  it "should not run if the output file exists and you don't allow overwriting" do
@@ -104,23 +104,23 @@ describe Assembly::Image do
104
104
  expect(File).to exist TEST_TIF_INPUT_FILE
105
105
  expect(File).to exist TEST_JP2_OUTPUT_FILE
106
106
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
107
- expect{@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)}.to raise_error(SecurityError)
107
+ lambda{@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE)}.should raise_error(SecurityError)
108
108
  end
109
109
 
110
110
  it "should get the correct image height and width" do
111
111
  generate_test_image(TEST_TIF_INPUT_FILE)
112
112
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
113
- expect(@ai.height).to eq 100
114
- expect(@ai.width).to eq 100
113
+ @ai.height.should == 100
114
+ @ai.width.should == 100
115
115
  end
116
116
 
117
117
  it "should not run if the input file is a jp2" do
118
118
  generate_test_image(TEST_JP2_OUTPUT_FILE)
119
119
  expect(File).to exist TEST_JP2_OUTPUT_FILE
120
120
  @ai = Assembly::Image.new(TEST_JP2_OUTPUT_FILE)
121
- expect(@ai).to be_valid_image
122
- expect(@ai).to_not be_jp2able
123
- expect { @ai.create_jp2 }.to raise_error
121
+ @ai.valid_image?.should be true
122
+ @ai.jp2able?.should be false
123
+ lambda{@ai.create_jp2}.should raise_error
124
124
  end
125
125
 
126
126
  it "should run if you specify a bogus output profile, because this is not currently an option" do
@@ -128,10 +128,10 @@ describe Assembly::Image do
128
128
  expect(File).to exist TEST_TIF_INPUT_FILE
129
129
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
130
130
  result=@ai.create_jp2(:output_profile=>'bogusness')
131
- expect(result).to be_a_kind_of Assembly::Image
132
- expect(result.path).to eq TEST_JP2_INPUT_FILE
133
- expect(TEST_JP2_INPUT_FILE).to be_a_jp2
134
- expect(result.exif.colorspace).to eq "sRGB"
131
+ result.class.should be Assembly::Image
132
+ result.path.should == TEST_JP2_INPUT_FILE
133
+ is_jp2?(TEST_JP2_INPUT_FILE).should be true
134
+ result.exif.colorspace.should == "sRGB"
135
135
  end
136
136
 
137
137
  it "should not run if you specify a bogus tmp folder" do
@@ -140,7 +140,7 @@ describe Assembly::Image do
140
140
  expect(File).to exist TEST_TIF_INPUT_FILE
141
141
  expect(File).to_not exist bogus_folder
142
142
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
143
- expect { @ai.create_jp2(:tmp_folder=>bogus_folder) }.to raise_error
143
+ lambda{@ai.create_jp2(:tmp_folder=>bogus_folder)}.should raise_error
144
144
  end
145
145
 
146
146
  it "should create a jp2 and preserve the temporary file if specified" do
@@ -148,24 +148,24 @@ describe Assembly::Image do
148
148
  expect(File).to exist TEST_TIF_INPUT_FILE
149
149
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
150
150
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE, :preserve_tmp_source=>true)
151
- expect(result).to be_a_kind_of Assembly::Image
152
- expect(result.path).to eq TEST_JP2_OUTPUT_FILE
153
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
154
- expect(result.exif.colorspace).to eq "sRGB"
155
- expect(File.exists?(@ai.tmp_path)).to be true
151
+ result.class.should be Assembly::Image
152
+ result.path.should == TEST_JP2_OUTPUT_FILE
153
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
154
+ result.exif.colorspace.should == "sRGB"
155
+ File.exists?(@ai.tmp_path).should be true
156
156
  end
157
157
 
158
158
  it "should create jp2 of the same filename and in the same location as the input if no output file is specified, and should cleanup tmp file" do
159
159
  generate_test_image(TEST_TIF_INPUT_FILE)
160
160
  expect(File).to exist TEST_TIF_INPUT_FILE
161
- expect(File.exists?(TEST_JP2_INPUT_FILE)).to be false
161
+ File.exists?(TEST_JP2_INPUT_FILE).should be false
162
162
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
163
163
  result=@ai.create_jp2
164
- expect(result).to be_a_kind_of Assembly::Image
165
- expect(result.path).to eq TEST_JP2_INPUT_FILE
166
- expect(TEST_JP2_INPUT_FILE).to be_a_jp2
167
- expect(result.exif.colorspace).to eq "sRGB"
168
- expect(File.exists?(@ai.tmp_path)).to be false
164
+ result.class.should be Assembly::Image
165
+ result.path.should == TEST_JP2_INPUT_FILE
166
+ is_jp2?(TEST_JP2_INPUT_FILE).should be true
167
+ result.exif.colorspace.should == "sRGB"
168
+ File.exists?(@ai.tmp_path).should be false
169
169
  end
170
170
 
171
171
  it "should create jp2 from input JPEG of the same filename and in the same location as the input if no output file is specified, and should cleanup tmp file" do
@@ -174,11 +174,11 @@ describe Assembly::Image do
174
174
  expect(File).to_not exist TEST_JP2_INPUT_FILE
175
175
  @ai = Assembly::Image.new(TEST_JPEG_INPUT_FILE)
176
176
  result=@ai.create_jp2
177
- expect(result).to be_a_kind_of Assembly::Image
178
- expect(result.path).to eq TEST_JP2_INPUT_FILE
179
- expect(TEST_JP2_INPUT_FILE).to be_a_jp2
180
- expect(result.exif.colorspace).to eq "sRGB"
181
- expect(File.exists?(@ai.tmp_path)).to be false
177
+ result.class.should be Assembly::Image
178
+ result.path.should == TEST_JP2_INPUT_FILE
179
+ is_jp2?(TEST_JP2_INPUT_FILE).should be true
180
+ result.exif.colorspace.should == "sRGB"
181
+ File.exists?(@ai.tmp_path).should be false
182
182
  end
183
183
 
184
184
  it "should recreate jp2 if the output file exists and if you allow overwriting" do
@@ -188,10 +188,10 @@ describe Assembly::Image do
188
188
  expect(File).to exist TEST_JP2_OUTPUT_FILE
189
189
  @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
190
190
  result=@ai.create_jp2(:output => TEST_JP2_OUTPUT_FILE,:overwrite => true)
191
- expect(result).to be_a_kind_of Assembly::Image
192
- expect(result.path).to eq TEST_JP2_OUTPUT_FILE
193
- expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
194
- expect(result.exif.colorspace).to eq "sRGB"
191
+ result.class.should be Assembly::Image
192
+ result.path.should == TEST_JP2_OUTPUT_FILE
193
+ is_jp2?(TEST_JP2_OUTPUT_FILE).should be true
194
+ result.exif.colorspace.should == "sRGB"
195
195
  end
196
196
 
197
197
  after(:each) do
data/spec/images_spec.rb CHANGED
@@ -3,39 +3,39 @@ require 'spec_helper'
3
3
  describe Assembly::Images do
4
4
 
5
5
  it "should not run if no input folder is passed in" do
6
- expect{Assembly::Images.batch_generate_jp2('')}.to raise_error
6
+ lambda{Assembly::Images.batch_generate_jp2('')}.should raise_error
7
7
  end
8
8
 
9
9
  it "should not run if a non-existent input folder is passed in" do
10
- expect{Assembly::Images.batch_generate_jp2('/junk/path')}.to raise_error
10
+ lambda{Assembly::Images.batch_generate_jp2('/junk/path')}.should raise_error
11
11
  end
12
12
 
13
13
  it "should run and batch produe jp2s from input tiffs" do
14
14
  ['test1','test2','test3'].each {|image| generate_test_image(File.join(TEST_INPUT_DIR,"#{image}.tif")) }
15
15
  Assembly::Images.batch_generate_jp2(TEST_INPUT_DIR,:output=>TEST_OUTPUT_DIR)
16
- expect(File.directory?(TEST_OUTPUT_DIR)).to be true
17
- ['test1','test2','test3'].each {|image| expect(File.join(TEST_OUTPUT_DIR,"#{image}.jp2")).to be_a_jp2 }
16
+ File.directory?(TEST_OUTPUT_DIR).should be true
17
+ ['test1','test2','test3'].each {|image| is_jp2?(File.join(TEST_OUTPUT_DIR,"#{image}.jp2")).should be_true }
18
18
  end
19
19
 
20
20
  it "should run and batch add color profile descriptions input tiffs with no color profile descriptions" do
21
21
  ['test1','test2','test3'].each {|image| generate_test_image(File.join(TEST_INPUT_DIR,"#{image}.tif"),:profile=>'') }
22
- ['test1','test2','test3'].each {|image| expect(Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription).to be nil}
22
+ ['test1','test2','test3'].each {|image| Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription.should be nil}
23
23
  Assembly::Images.batch_add_exif_profile_description(TEST_INPUT_DIR,'Adobe RGB 1998')
24
- ['test1','test2','test3'].each {|image| expect(Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription).to eq 'Adobe RGB (1998)'}
24
+ ['test1','test2','test3'].each {|image| Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription.should == 'Adobe RGB (1998)'}
25
25
  end
26
26
 
27
27
  it "should run and batch add color profile descriptions input tiffs, forcing over existing color profile descriptions" do
28
28
  ['test1','test2','test3'].each {|image| generate_test_image(File.join(TEST_INPUT_DIR,"#{image}.tif")) }
29
- ['test1','test2','test3'].each {|image| expect(Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription).to eq 'sRGB IEC61966-2.1'}
29
+ ['test1','test2','test3'].each {|image| Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription.should == 'sRGB IEC61966-2.1'}
30
30
  Assembly::Images.batch_add_exif_profile_description(TEST_INPUT_DIR,'Adobe RGB 1998',:force=>true) # force overwrite
31
- ['test1','test2','test3'].each {|image| expect(Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription).to eq 'Adobe RGB (1998)'}
31
+ ['test1','test2','test3'].each {|image| Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription.should == 'Adobe RGB (1998)'}
32
32
  end
33
33
 
34
34
  it "should run and batch add color profile descriptions input tiffs, not overwriting existing color profile descriptions" do
35
35
  ['test1','test2','test3'].each {|image| generate_test_image(File.join(TEST_INPUT_DIR,"#{image}.tif")) }
36
- ['test1','test2','test3'].each {|image| expect(Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription).to eq 'sRGB IEC61966-2.1'}
36
+ ['test1','test2','test3'].each {|image| Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription.should == 'sRGB IEC61966-2.1'}
37
37
  Assembly::Images.batch_add_exif_profile_description(TEST_INPUT_DIR,'Adobe RGB 1998') # do not force overwrite
38
- ['test1','test2','test3'].each {|image| expect(Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription).to eq 'sRGB IEC61966-2.1'}
38
+ ['test1','test2','test3'].each {|image| Assembly::Image.new(File.join(TEST_INPUT_DIR,"#{image}.tif")).exif.profiledescription.should == 'sRGB IEC61966-2.1'}
39
39
  end
40
40
 
41
41
 
data/spec/spec_helper.rb CHANGED
@@ -19,24 +19,19 @@ def generate_test_image(file,params={})
19
19
  create_command += " -profile " + File.join(Assembly::PATH_TO_IMAGE_GEM,'profiles',profile+'.icc') + " " unless profile == ''
20
20
  create_command += " -type #{image_type} " if image_type
21
21
  create_command += file
22
- create_command += " 2>&1"
23
- output = `#{create_command}`
24
- unless $?.success?
25
- raise "Failed to create test image #{file} (#{params}): \n#{output}"
26
- end
22
+ system(create_command)
27
23
  end
28
24
 
29
25
  def remove_files(dir)
30
26
  Dir.foreach(dir) {|f| fn = File.join(dir, f); File.delete(fn) if !File.directory?(fn) && File.basename(fn) != '.empty'}
31
27
  end
32
28
 
33
- RSpec::Matchers.define :be_a_jp2 do
34
- match do |actual|
35
- if File.exists?(actual)
36
- exif = MiniExiftool.new actual
37
- exif['mimetype'] == 'image/jp2'
38
- else
39
- false
40
- end
29
+ # check the existence and mime_type of the supplied file and confirm if it's jp2
30
+ def is_jp2?(file)
31
+ if File.exists?(file)
32
+ exif = MiniExiftool.new file
33
+ return exif['mimetype'] == 'image/jp2'
34
+ else
35
+ false
41
36
  end
42
- end
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assembly-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
@@ -11,118 +11,118 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-07-25 00:00:00.000000000 Z
14
+ date: 2015-01-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: uuidtools
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - ">="
20
+ - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: assembly-objectfile
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ">="
34
+ - - ! '>='
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.6.4
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.6.4
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: mini_exiftool
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - "~>"
48
+ - - ~>
49
49
  - !ruby/object:Gem::Version
50
50
  version: '1.6'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - ~>
56
56
  - !ruby/object:Gem::Version
57
57
  version: '1.6'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activesupport
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ">="
62
+ - - ! '>'
63
63
  - !ruby/object:Gem::Version
64
- version: '0'
64
+ version: '3'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - ! '>'
70
70
  - !ruby/object:Gem::Version
71
- version: '0'
71
+ version: '3'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: nokogiri
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ">="
83
+ - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: rspec
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - "~>"
90
+ - - ~>
91
91
  - !ruby/object:Gem::Version
92
- version: '3.0'
92
+ version: '2.6'
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - "~>"
97
+ - - ~>
98
98
  - !ruby/object:Gem::Version
99
- version: '3.0'
99
+ version: '2.6'
100
100
  - !ruby/object:Gem::Dependency
101
- name: yard
101
+ name: lyberteam-gems-devel
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ">="
104
+ - - ! '>'
105
105
  - !ruby/object:Gem::Version
106
- version: '0'
106
+ version: 1.0.0
107
107
  type: :development
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ">="
111
+ - - ! '>'
112
112
  - !ruby/object:Gem::Version
113
- version: '0'
113
+ version: 1.0.0
114
114
  - !ruby/object:Gem::Dependency
115
- name: rake
115
+ name: yard
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ">="
118
+ - - ! '>='
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ">="
125
+ - - ! '>='
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  description: Contains classes to create derivative image files and perform other image
@@ -135,8 +135,8 @@ executables:
135
135
  extensions: []
136
136
  extra_rdoc_files: []
137
137
  files:
138
- - ".gitignore"
139
- - ".rvmrc.example"
138
+ - .gitignore
139
+ - .rvmrc.example
140
140
  - Gemfile
141
141
  - LICENSE
142
142
  - README.rdoc
@@ -166,17 +166,17 @@ require_paths:
166
166
  - lib
167
167
  required_ruby_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ">="
169
+ - - ! '>='
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ">="
174
+ - - ! '>='
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
178
  rubyforge_project: assembly-image
179
- rubygems_version: 2.2.2
179
+ rubygems_version: 2.4.2
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Ruby immplementation of image services needed to prepare objects to be accessioned