hydra-derivatives 0.0.8 → 0.1.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
  SHA1:
3
- metadata.gz: 1bc8abf9416fda90a423323e7717b6ff5b889f70
4
- data.tar.gz: db345a163681b8b2d981f5f4aad33e868951d03c
3
+ metadata.gz: e5c7df4967dcb508c79af83f929109d51177b4c9
4
+ data.tar.gz: 8e6337d340b299ebde7aabc85f7b0157ff37382e
5
5
  SHA512:
6
- metadata.gz: 57b97d9fbd4b63233ae73d58da47546f2c466a78de5bea3ef687f818cf3d493d17ed4c128f8a0c312f3a872d17bf0771a754479fbac1ddcdb359f5f02ef6f81f
7
- data.tar.gz: 30f51ea9f6b6fc4be16631b89d46c090a7ee26e96b46a2d0f70c3e76f71eedcf890d0940db488413082e6446d5b059bd71a54e6fefc3cf8b37274f13cc49fbd0
6
+ metadata.gz: 571c14601cbe8d592c123e6522fc29ddc43071d61e6208d7c061ccebc717a0fa13a6cfcaec423ca6e7a4be7be9de942a6885df4eb724c388df12a5c2f7f963bb
7
+ data.tar.gz: 0e2612a962f3f9c5d0da7114d89b1fcf78c7e5a11233b9dd347bc500a0ad8264f9c9d6cbf7d23e3ac974d9f3670b9015725c4f92338787c27afc001a90b00324
data/.gitignore CHANGED
@@ -3,3 +3,5 @@ tmp/
3
3
  jetty/
4
4
  pkg/
5
5
  .bundle/
6
+ .ruby-version
7
+ .ruby-gemset
data/Gemfile CHANGED
@@ -3,3 +3,6 @@ source 'https://rubygems.org'
3
3
  # Please see hydra-derivatives.gemspec for dependency information.
4
4
  gemspec
5
5
 
6
+ group :development, :test do
7
+ gem 'byebug' unless ENV['TRAVIS']
8
+ end
data/History.md CHANGED
@@ -1,7 +1,10 @@
1
- ## 0.0.8 (2013-04-09)
1
+ ## 0.1.0 (2014-05-09)
2
+ - Add support for thumbnailing documents
3
+
4
+ ## 0.0.8 (2014-04-09)
2
5
  - Add support for JPEG2000 Derivatives
3
6
  - Correcting Railtie initializer
4
- - Added ImageMagick dependency
7
+ - Added ImageMagick dependency
5
8
  - Updated FITS URL
6
9
  - Adding input and output options to ffmpeg and video processor
7
10
  - Revert "Switch to streamio_ffmpeg for easier handling of ffmpeg arguments"
@@ -12,7 +15,7 @@
12
15
  - Restore `Hydra::Derivatives::ExtractMetadata#to_tempfile`
13
16
 
14
17
  ## 0.0.6 (2013-10-10)
15
- - Added version badge
18
+ - Added version badge
16
19
  - Adding Hydra::FileCharacterization
17
20
  - Updating CONTRIBUTING.md as per Hydra v6.0.0
18
21
  - Adding microsoft openxmlformats as output formats
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # hydra-derivatives [![Version](https://badge.fury.io/rb/hydra-derivatives.png)](http://badge.fury.io/rb/hydra-derivatives) [![Build Status](https://travis-ci.org/projecthydra/hydra-derivatives.png?branch=master)](https://travis-ci.org/projecthydra/hydra-derivatives) [![Dependency Status](https://gemnasium.com/projecthydra/hydra-derivatives.png)](https://gemnasium.com/projecthydra/hydra-derivatives)
1
+ # hydra-derivatives [![Version](https://badge.fury.io/rb/hydra-derivatives.png)](http://badge.fury.io/rb/hydra-derivatives) [![Build Status](https://travis-ci.org/projecthydra-labs/hydra-derivatives.png?branch=master)](https://travis-ci.org/projecthydra-labs/hydra-derivatives) [![Dependency Status](https://gemnasium.com/projecthydra-labs/hydra-derivatives.png)](https://gemnasium.com/projecthydra-labs/hydra-derivatives)
2
2
 
3
3
  Derivative generation for hydra
4
4
 
@@ -6,12 +6,12 @@ If you have an ActiveFedora class like this:
6
6
  ```ruby
7
7
  class GenericFile < ActiveFedora::Base
8
8
  include Hydra::Derivatives
9
-
9
+
10
10
  has_file_datastream :content
11
11
  attr_accessor :mime_type
12
-
12
+
13
13
  # Use a block to declare which derivatives you want to generate
14
- makes_derivatives do |obj|
14
+ makes_derivatives do |obj|
15
15
  case obj.mime_type
16
16
  when 'application/pdf'
17
17
  obj.transform_datastream :content, { :thumb => "100x100>" }
@@ -33,13 +33,13 @@ Or a class like this:
33
33
  ```ruby
34
34
  class GenericFile < ActiveFedora::Base
35
35
  include Hydra::Derivatives
36
-
36
+
37
37
  has_file_datastream :content
38
38
  attr_accessor :mime_type
39
39
 
40
40
  # Use a callback method to declare which derivatives you want
41
41
  makes_derivatives :generate_derivatives
42
-
42
+
43
43
  def generate_derivatives
44
44
  case mime_type
45
45
  when 'application/pdf'
@@ -70,7 +70,7 @@ Then when you call `obj.create_derivatives` two new datastreams, 'thumbnail' and
70
70
 
71
71
  We recommend you run `obj.create_derivatives` in a background worker, because some derivative creation (especially videos) can take a long time.
72
72
 
73
- # Installation
73
+ # Installation
74
74
 
75
75
  Just add `gem 'hydra-derivatives'` to your Gemfile.
76
76
 
@@ -101,7 +101,7 @@ Hydra::Derivatives.kdu_compress_path = '/usr/local/bin/kdu_compress'
101
101
 
102
102
  ## JPEG2k Directives
103
103
 
104
- Unlike the other processors, the `Jpeg2kImage` processor does not generally accept arguments that directly (or nearly so) translate to the arguments you would give to the corresponding command line utility.
104
+ Unlike the other processors, the `Jpeg2kImage` processor does not generally accept arguments that directly (or nearly so) translate to the arguments you would give to the corresponding command line utility.
105
105
 
106
106
  Instead, each directive may contain these arguments:
107
107
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.1.0
@@ -25,8 +25,7 @@ module Hydra
25
25
  @config = Config.new
26
26
  end
27
27
 
28
-
29
- [:ffmpeg_path, :libreoffice_path, :temp_file_base, :fits_path, :kdu_compress_path,
28
+ [:ffmpeg_path, :libreoffice_path, :temp_file_base, :fits_path, :kdu_compress_path,
30
29
  :kdu_compress_recipes, :enable_ffmpeg].each do |method|
31
30
  module_eval <<-RUBY
32
31
  def self.#{method.to_s}
@@ -42,14 +41,13 @@ module Hydra
42
41
  class_attribute :transformation_schemes
43
42
  end
44
43
 
45
-
46
44
  # Runs all of the transformations immediately.
47
45
  # You may want to run this job in the background as it may take a long time.
48
- def create_derivatives
46
+ def create_derivatives
49
47
  if transformation_schemes.present?
50
48
  transformation_schemes.each do |transform_scheme|
51
49
  if transform_scheme.instance_of?(Proc)
52
- transform_scheme.call(self)
50
+ transform_scheme.call(self)
53
51
  else
54
52
  send(transform_scheme)
55
53
  end
@@ -60,10 +58,10 @@ module Hydra
60
58
  end
61
59
 
62
60
  # Create derivatives from a datastream according to transformation directives
63
- # @param datastream_name
61
+ # @param datastream_name
64
62
  # @param [Hash] transform_directives - each key corresponds to a desired derivative. Associated values vary according to processor being used.
65
63
  # @param [Hash] opts for specifying things like choice of :processor (processor defaults to :image)
66
- #
64
+ #
67
65
  # @example This will create content_thumb
68
66
  # transform_datastream :content, { :thumb => "100x100>" }
69
67
  #
@@ -82,13 +80,12 @@ module Hydra
82
80
  "Hydra::Derivatives::#{processor.to_s.classify}".constantize.new(self, datastream_name, transform_directives).process
83
81
  end
84
82
 
85
-
86
83
  module ClassMethods
87
- # Register transformation schemes for generating derivatives.
84
+ # Register transformation schemes for generating derivatives.
88
85
  # You can do this using a block or by defining a callback method.
89
86
  #
90
87
  # @example Define transformation scheme using a block
91
- # makes_derivatives do |obj|
88
+ # makes_derivatives do |obj|
92
89
  # case obj.mime_type
93
90
  # when 'application/pdf'
94
91
  # obj.transform_datastream :content, { :thumb => "100x100>" }
@@ -2,6 +2,7 @@ module Hydra
2
2
  module Derivatives
3
3
  class Document < Processor
4
4
  include ShellBasedProcessor
5
+
5
6
  def self.encode(path, options, output_file)
6
7
  format = File.extname(output_file).sub('.', '')
7
8
  outdir = File.dirname(output_file)
@@ -9,18 +10,25 @@ module Hydra
9
10
  end
10
11
 
11
12
  def encode_datastream(dest_dsid, file_suffix, mime_type, options = '')
12
- output_file = Dir::Tmpname.create(['sufia', ".#{file_suffix}"], Hydra::Derivatives.temp_file_base){}
13
+ output_file = Dir::Tmpname.create(["#{object.id}-content.", ".#{file_suffix}"], Hydra::Derivatives.temp_file_base){}
13
14
  new_output = ''
14
15
  source_datastream.to_tempfile do |f|
15
- self.class.encode(f.path, options, output_file)
16
- new_output = File.join(Hydra::Derivatives.temp_file_base, [File.basename(f.path).sub(File.extname(f.path), ''), file_suffix].join('.'))
16
+ if mime_type == 'image/jpeg'
17
+ temp_file = File.join(Hydra::Derivatives.temp_file_base, [File.basename(f.path).sub(File.extname(f.path), ''), 'pdf'].join('.'))
18
+ new_output = File.join(Hydra::Derivatives.temp_file_base, [File.basename(temp_file).sub(File.extname(temp_file), ''), file_suffix].join('.'))
19
+ self.class.encode(f.path, options, temp_file)
20
+ self.class.encode(temp_file, options, output_file)
21
+ File.unlink(temp_file)
22
+ else
23
+ self.class.encode(f.path, options, output_file)
24
+ new_output = File.join(Hydra::Derivatives.temp_file_base, [File.basename(f.path).sub(File.extname(f.path), ''), file_suffix].join('.'))
25
+ end
17
26
  end
18
27
  out_file = File.open(new_output, "rb")
19
- object.add_file_datastream(out_file.read, :dsid=>dest_dsid, :mimeType=>mime_type)
28
+ object.add_file_datastream(out_file.read, dsid: dest_dsid, mimeType: mime_type)
20
29
  File.unlink(out_file)
21
30
  end
22
31
 
23
-
24
32
  def new_mime_type(format)
25
33
  case format
26
34
  when 'pdf'
@@ -28,11 +36,13 @@ module Hydra
28
36
  when 'odf'
29
37
  'application/vnd.oasis.opendocument.text'
30
38
  when 'docx'
31
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
39
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
32
40
  when 'xslx'
33
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
41
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
34
42
  when 'pptx'
35
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
43
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
44
+ when 'jpg'
45
+ 'image/jpeg'
36
46
  else
37
47
  raise "I don't know about the format '#{format}'"
38
48
  end
@@ -5,7 +5,7 @@ require 'open3'
5
5
 
6
6
  module Hydra
7
7
  module Derivatives
8
- module ShellBasedProcessor
8
+ module ShellBasedProcessor
9
9
  extend ActiveSupport::Concern
10
10
 
11
11
  included do
@@ -13,7 +13,7 @@ module Hydra
13
13
  end
14
14
 
15
15
  def process
16
- directives.each do |name, args|
16
+ directives.each do |name, args|
17
17
  format = args[:format]
18
18
  raise ArgumentError, "You must provide the :format you want to transcode into. You provided #{args}" unless format
19
19
  # TODO if the source is in the correct format, we could just copy it and skip transcoding.
@@ -38,7 +38,6 @@ module Hydra
38
38
  end
39
39
 
40
40
  module ClassMethods
41
-
42
41
  def execute(command)
43
42
  stdin, stdout, stderr, wait_thr = popen3(command)
44
43
  stdin.close
@@ -48,11 +47,7 @@ module Hydra
48
47
  stderr.close
49
48
  raise "Unable to execute command \"#{command}\"\n#{err}" unless wait_thr.value.success?
50
49
  end
51
-
52
50
  end
53
-
54
51
  end
55
52
  end
56
53
  end
57
-
58
-
Binary file
Binary file
Binary file
@@ -5,10 +5,11 @@ describe "Transcoder" do
5
5
  class ContentDatastream < ActiveFedora::Datastream
6
6
  include Hydra::Derivatives::ExtractMetadata
7
7
  end
8
+
8
9
  class GenericFile < ActiveFedora::Base
9
10
  include Hydra::Derivatives
10
11
  has_metadata 'characterization', type: ActiveFedora::SimpleDatastream do |m|
11
- m.field "mime_type", :string
12
+ m.field "mime_type", :string
12
13
  end
13
14
 
14
15
  has_attributes :mime_type, datastream: :characterization, multiple: false
@@ -17,65 +18,67 @@ describe "Transcoder" do
17
18
  makes_derivatives do |obj|
18
19
  case obj.mime_type
19
20
  when 'application/pdf'
20
- obj.transform_datastream :content, { :thumb => "100x100>" }
21
+ obj.transform_datastream :content, { thumb: '100x100>' }
21
22
  when 'audio/wav'
22
- obj.transform_datastream :content, { :mp3 => {format: 'mp3'}, :ogg => {format: 'ogg'} }, processor: :audio
23
+ obj.transform_datastream :content, { mp3: { format: 'mp3' }, ogg: { format: 'ogg'} }, processor: :audio
23
24
  when 'video/avi'
24
- obj.transform_datastream :content, { :mp4 => {format: 'mp4'}, :webm => {format: 'webm'},
25
- :thumbnail=> {:format => 'jpg' , datastream: 'thumbnail'} }, processor: :video
25
+ obj.transform_datastream :content, { mp4: { format: 'mp4' }, webm: { format: 'webm'}, thumbnail: { format: 'jpg', datastream: 'thumbnail' } }, processor: :video
26
26
  when 'image/png', 'image/jpg'
27
- obj.transform_datastream :content, { :medium => "300x300>", :thumb => "100x100>", :access => {format: 'jpg', datastream: 'access'} }
27
+ obj.transform_datastream :content, { medium: "300x300>", thumb: "100x100>", access: { format: 'jpg', datastream: 'access'} }
28
28
  when 'application/vnd.ms-powerpoint'
29
- obj.transform_datastream :content, { :preservation=> {:format => 'pptx'}, :access => { :format=>'pdf' } }, processor: 'document'
29
+ obj.transform_datastream :content, { preservation: { format: 'pptx'}, access: { format: 'pdf' }, thumbnail: { format: 'jpg' } }, processor: 'document'
30
30
  when 'text/rtf'
31
- obj.transform_datastream :content, { :preservation=> {:format => 'odf' }, :access => { :format=>'pdf' } }, processor: 'document'
31
+ obj.transform_datastream :content, { preservation: { format: 'odf' }, access: { format: 'pdf' }, thumbnail: { format: 'jpg' } }, processor: 'document'
32
32
  when 'application/msword'
33
- obj.transform_datastream :content, { :access => { :format=>'pdf' }, :preservation=> {:format => 'docx' } }, processor: 'document'
33
+ obj.transform_datastream :content, { access: { format: 'pdf' }, preservation: { format: 'docx' }, thumbnail: { format: 'jpg' } }, processor: 'document'
34
34
  when 'application/vnd.ms-excel'
35
- obj.transform_datastream :content, { :access => { :format=>'pdf' }, :preservation=> {:format => 'xslx' } }, processor: 'document'
35
+ obj.transform_datastream :content, { access: { format: 'pdf' }, preservation: { format: 'xslx' }, thumbnail: { format: 'jpg' } }, processor: 'document'
36
36
  when 'image/tiff'
37
- obj.transform_datastream :content, {
37
+ obj.transform_datastream :content, {
38
38
  resized: { recipe: :default, resize: "600x600>", datastream: 'resized' },
39
39
  config_lookup: { recipe: :default, datastream: 'config_lookup' },
40
40
  string_recipe: { recipe: '-quiet', datastream: 'string_recipe' },
41
41
  diy: { }
42
42
  }, processor: 'jpeg2k_image'
43
-
44
43
  end
45
44
 
46
45
  end
47
-
46
+
48
47
  makes_derivatives :generate_special_derivatives
49
-
48
+
50
49
  def generate_special_derivatives
51
50
  if label == "special" && mime_type == 'image/png'
52
- transform_datastream :content, { :medium => {size: "200x300>", datastream: 'special_ds'} }
51
+ transform_datastream :content, { medium: { size: "200x300>", datastream: 'special_ds' } }
53
52
  end
54
53
  end
55
-
56
54
  end
57
55
  end
58
56
 
59
57
  after(:all) do
60
- GenericFile.all.each(&:destroy)
58
+ GenericFile.destroy_all
61
59
  Object.send(:remove_const, :GenericFile);
62
60
  Object.send(:remove_const, :ContentDatastream);
63
61
  end
64
-
62
+
65
63
  describe "with an attached image" do
66
64
  let(:attachment) { File.open(File.expand_path('../../fixtures/world.png', __FILE__))}
67
- let(:file) { GenericFile.new(mime_type: 'image/png').tap { |t| t.content.content = attachment; t.save } }
65
+ let(:file) do
66
+ GenericFile.new(mime_type: 'image/png').tap do |f|
67
+ f.content.content = attachment
68
+ f.save
69
+ end
70
+ end
68
71
 
69
72
  it "should transcode" do
70
73
  file.datastreams.key?('content_medium').should be_false
71
74
  file.create_derivatives
72
75
  file.datastreams['content_medium'].should have_content
73
76
  file.datastreams['content_medium'].mimeType.should == 'image/png'
74
- file.datastreams['content_thumb'].should have_content
77
+ file.datastreams['content_thumb'].should have_content
75
78
  file.datastreams['content_thumb'].mimeType.should == 'image/png'
76
- file.datastreams['access'].should have_content
79
+ file.datastreams['access'].should have_content
77
80
  file.datastreams['access'].mimeType.should == 'image/jpeg'
78
- file.datastreams.key?('content_text').should be_false
81
+ file.datastreams.key?('content_text').should be_false
79
82
  end
80
83
  end
81
84
 
@@ -86,7 +89,7 @@ describe "Transcoder" do
86
89
  it "should transcode" do
87
90
  file.datastreams.key?('content_thumb').should be_false
88
91
  file.create_derivatives
89
- file.datastreams['content_thumb'].should have_content
92
+ file.datastreams['content_thumb'].should have_content
90
93
  file.datastreams['content_thumb'].mimeType.should == 'image/png'
91
94
  end
92
95
  end
@@ -99,7 +102,7 @@ describe "Transcoder" do
99
102
  file.create_derivatives
100
103
  file.datastreams['content_mp3'].should have_content
101
104
  file.datastreams['content_mp3'].mimeType.should == 'audio/mpeg'
102
- file.datastreams['content_ogg'].should have_content
105
+ file.datastreams['content_ogg'].should have_content
103
106
  file.datastreams['content_ogg'].mimeType.should == 'audio/ogg'
104
107
  end
105
108
  end
@@ -124,13 +127,13 @@ describe "Transcoder" do
124
127
  file.create_derivatives
125
128
  file.datastreams['content_mp4'].should have_content
126
129
  file.datastreams['content_mp4'].mimeType.should == 'video/mp4'
127
- file.datastreams['content_webm'].should have_content
130
+ file.datastreams['content_webm'].should have_content
128
131
  file.datastreams['content_webm'].mimeType.should == 'video/webm'
129
132
  file.datastreams['thumbnail'].should have_content
130
133
  file.datastreams['thumbnail'].mimeType.should == 'image/jpeg'
131
134
  end
132
135
  end
133
-
136
+
134
137
  describe "using callback methods" do
135
138
  let(:attachment) { File.open(File.expand_path('../../fixtures/world.png', __FILE__))}
136
139
  let(:file) { GenericFile.new(mime_type: 'image/png', label: "special").tap { |t| t.content.content = attachment; t.save } }
@@ -138,23 +141,24 @@ describe "Transcoder" do
138
141
  it "should transcode" do
139
142
  file.datastreams.key?('special_ds').should be_false
140
143
  file.create_derivatives
141
- file.datastreams['special_ds'].should have_content
144
+ file.datastreams['special_ds'].should have_content
142
145
  file.datastreams['special_ds'].mimeType.should == 'image/png'
143
- file.datastreams['special_ds'].should have_content
146
+ file.datastreams['special_ds'].should have_content
144
147
  end
145
148
  end
146
149
 
147
-
148
150
  describe "with an attached Powerpoint", unless: ENV['TRAVIS'] == 'true' do
149
151
  let(:attachment) { File.open(File.expand_path('../../fixtures/FlashPix.ppt', __FILE__))}
150
152
  let(:file) { GenericFile.new(mime_type: 'application/vnd.ms-powerpoint').tap { |t| t.content.content = attachment; t.save } }
151
153
 
152
154
  it "should transcode" do
153
155
  file.create_derivatives
154
- file.datastreams['content_access'].should have_content
155
- file.datastreams['content_access'].mimeType.should == 'application/pdf'
156
- file.datastreams['content_preservation'].should have_content
157
- file.datastreams['content_preservation'].mimeType.should == 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
156
+ expect(file.datastreams['content_thumbnail']).to have_content
157
+ expect(file.datastreams['content_thumbnail'].mimeType).to eq('image/jpeg')
158
+ expect(file.datastreams['content_access']).to have_content
159
+ expect(file.datastreams['content_access'].mimeType).to eq('application/pdf')
160
+ expect(file.datastreams['content_preservation']).to have_content
161
+ expect(file.datastreams['content_preservation'].mimeType).to eq('application/vnd.openxmlformats-officedocument.presentationml.presentation')
158
162
  end
159
163
  end
160
164
 
@@ -164,10 +168,12 @@ describe "Transcoder" do
164
168
 
165
169
  it "should transcode" do
166
170
  file.create_derivatives
167
- file.datastreams['content_access'].should have_content
168
- file.datastreams['content_access'].mimeType.should == 'application/pdf'
169
- file.datastreams['content_preservation'].should have_content
170
- file.datastreams['content_preservation'].mimeType.should == 'application/vnd.oasis.opendocument.text'
171
+ expect(file.datastreams['content_thumbnail']).to have_content
172
+ expect(file.datastreams['content_thumbnail'].mimeType).to eq('image/jpeg')
173
+ expect(file.datastreams['content_access']).to have_content
174
+ expect(file.datastreams['content_access'].mimeType).to eq('application/pdf')
175
+ expect(file.datastreams['content_preservation']).to have_content
176
+ expect(file.datastreams['content_preservation'].mimeType).to eq('application/vnd.oasis.opendocument.text')
171
177
  end
172
178
  end
173
179
 
@@ -177,10 +183,12 @@ describe "Transcoder" do
177
183
 
178
184
  it "should transcode" do
179
185
  file.create_derivatives
180
- file.datastreams['content_access'].should have_content
181
- file.datastreams['content_access'].mimeType.should == 'application/pdf'
182
- file.datastreams['content_preservation'].should have_content
183
- file.datastreams['content_preservation'].mimeType.should == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
186
+ expect(file.datastreams['content_thumbnail']).to have_content
187
+ expect(file.datastreams['content_thumbnail'].mimeType).to eq('image/jpeg')
188
+ expect(file.datastreams['content_access']).to have_content
189
+ expect(file.datastreams['content_access'].mimeType).to eq('application/pdf')
190
+ expect(file.datastreams['content_preservation']).to have_content
191
+ expect(file.datastreams['content_preservation'].mimeType).to eq('application/vnd.openxmlformats-officedocument.wordprocessingml.document')
184
192
  end
185
193
  end
186
194
 
@@ -190,16 +198,16 @@ describe "Transcoder" do
190
198
 
191
199
  it "should transcode" do
192
200
  file.create_derivatives
193
- puts file.datastreams.inspect
194
- file.datastreams['content_access'].should have_content
195
- file.datastreams['content_access'].mimeType.should == 'application/pdf'
196
- file.datastreams['content_preservation'].should have_content
197
- file.datastreams['content_preservation'].mimeType.should == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
201
+ expect(file.datastreams['content_thumbnail']).to have_content
202
+ expect(file.datastreams['content_thumbnail'].mimeType).to eq('image/jpeg')
203
+ expect(file.datastreams['content_access']).to have_content
204
+ expect(file.datastreams['content_access'].mimeType).to eq('application/pdf')
205
+ expect(file.datastreams['content_preservation']).to have_content
206
+ expect(file.datastreams['content_preservation'].mimeType).to eq('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
198
207
  end
199
208
  end
200
209
 
201
210
  describe "with an attached tiff", unless: ENV['TRAVIS'] == 'true' do
202
-
203
211
  let(:attachment) { File.open(File.expand_path('../../fixtures/test.tif', __FILE__))}
204
212
  let(:file) { GenericFile.new(mime_type: 'image/tiff').tap { |t| t.content.content = attachment; t.save } }
205
213
  it "should transcode" do
@@ -214,5 +222,4 @@ describe "Transcoder" do
214
222
  file.datastreams['string_recipe'].mimeType.should == 'image/jp2'
215
223
  end
216
224
  end
217
-
218
225
  end
metadata CHANGED
@@ -1,131 +1,131 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-derivatives
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-09 00:00:00.000000000 Z
11
+ date: 2014-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jettywrapper
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: active-fedora
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: hydra-file_characterization
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mini_magick
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: activesupport
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: 3.2.13
118
- - - "<"
118
+ - - <
119
119
  - !ruby/object:Gem::Version
120
120
  version: '5.0'
121
121
  type: :runtime
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: 3.2.13
128
- - - "<"
128
+ - - <
129
129
  - !ruby/object:Gem::Version
130
130
  version: '5.0'
131
131
  description: Derivative generation plugin for hydra
@@ -135,9 +135,9 @@ executables: []
135
135
  extensions: []
136
136
  extra_rdoc_files: []
137
137
  files:
138
- - ".gitignore"
139
- - ".rspec"
140
- - ".travis.yml"
138
+ - .gitignore
139
+ - .rspec
140
+ - .travis.yml
141
141
  - CONTRIBUTING.md
142
142
  - Gemfile
143
143
  - History.md
@@ -170,9 +170,12 @@ files:
170
170
  - spec/fixtures/piano_note.wav
171
171
  - spec/fixtures/sample.rtf
172
172
  - spec/fixtures/test.doc
173
+ - spec/fixtures/test.docx
173
174
  - spec/fixtures/test.pdf
175
+ - spec/fixtures/test.pptx
174
176
  - spec/fixtures/test.tif
175
177
  - spec/fixtures/test.xls
178
+ - spec/fixtures/test.xlsx
176
179
  - spec/fixtures/world.png
177
180
  - spec/lib/hydra/derivatives/extract_metadata_spec.rb
178
181
  - spec/spec_helper.rb
@@ -192,12 +195,12 @@ require_paths:
192
195
  - lib
193
196
  required_ruby_version: !ruby/object:Gem::Requirement
194
197
  requirements:
195
- - - ">="
198
+ - - '>='
196
199
  - !ruby/object:Gem::Version
197
200
  version: '0'
198
201
  required_rubygems_version: !ruby/object:Gem::Requirement
199
202
  requirements:
200
- - - ">="
203
+ - - '>='
201
204
  - !ruby/object:Gem::Version
202
205
  version: '0'
203
206
  requirements: []
@@ -214,9 +217,12 @@ test_files:
214
217
  - spec/fixtures/piano_note.wav
215
218
  - spec/fixtures/sample.rtf
216
219
  - spec/fixtures/test.doc
220
+ - spec/fixtures/test.docx
217
221
  - spec/fixtures/test.pdf
222
+ - spec/fixtures/test.pptx
218
223
  - spec/fixtures/test.tif
219
224
  - spec/fixtures/test.xls
225
+ - spec/fixtures/test.xlsx
220
226
  - spec/fixtures/world.png
221
227
  - spec/lib/hydra/derivatives/extract_metadata_spec.rb
222
228
  - spec/spec_helper.rb