hydra-file_characterization 0.3.0 → 0.3.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 998550a6f8a8090fa8e735b3d863f8b8da45fa26
|
4
|
+
data.tar.gz: aeedc6fcecc36f7ce17e07dcc4479709971ca30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42f80b2cdde8ff05833dee837dadba37770fd27a91ddefcdd6c1b90563b05c9d737f7bd0274a4dfe7a3ef05b8c0ab057db626ea72cadc3a27d4d8036dabbc217
|
7
|
+
data.tar.gz: e9bc81ce59caf0702fb8d762d4881341635793dadc6ad46e4dae08464bc8f0ea89ec1bb0c6bd1cf3c5ea52aca6f820415a18ca8f97a741d98014733702d3e5fc
|
@@ -42,6 +42,9 @@ module Hydra
|
|
42
42
|
# @example With an open file
|
43
43
|
# fits_xml, ffprobe_xml = Hydra::FileCharacterization.characterize(File.open('foo.mkv'), :fits, :ffprobe)
|
44
44
|
#
|
45
|
+
# @example With an open file and a filename
|
46
|
+
# fits_xml, ffprobe_xml = Hydra::FileCharacterization.characterize(File.open('foo.mkv'), 'my_movie.mkv', :fits, :ffprobe)
|
47
|
+
#
|
45
48
|
# @param [String] content - The contents of the original file
|
46
49
|
# @param [String] filename - The original file's filename; Some
|
47
50
|
# characterization tools take hints from the file names
|
@@ -82,7 +85,7 @@ module Hydra
|
|
82
85
|
# @return [String, File], [String], [Array]
|
83
86
|
def self.extract_arguments(args)
|
84
87
|
content = args.shift
|
85
|
-
filename = if content.is_a?
|
88
|
+
filename = if content.is_a?(File) && !args[0].is_a?(String)
|
86
89
|
File.basename(content.path)
|
87
90
|
else
|
88
91
|
args.shift
|
@@ -61,11 +61,22 @@ module Hydra
|
|
61
61
|
|
62
62
|
describe "for a file on disk" do
|
63
63
|
let(:file) { File.open(fixture_file('brendan_behan.jpeg')) }
|
64
|
-
|
64
|
+
describe "without path specified" do
|
65
|
+
subject { Hydra::FileCharacterization.characterize(file, tool_names) }
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
describe 'for fits' do
|
68
|
+
let(:tool_names) { [:fits] }
|
69
|
+
it { should match(/#{'<identity format="JPEG File Interchange Format" mimetype="image/jpeg"'}/) }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
describe "with path specified" do
|
73
|
+
let(:file) { File.open(fixture_file('brendan_behan.jpeg')) }
|
74
|
+
subject { Hydra::FileCharacterization.characterize(file, 'Brendan.jpg', tool_names) }
|
75
|
+
|
76
|
+
describe 'for fits' do
|
77
|
+
let(:tool_names) { [:fits] }
|
78
|
+
it { should match(/#{'<identity format="JPEG File Interchange Format" mimetype="image/jpeg"'}/) }
|
79
|
+
end
|
69
80
|
end
|
70
81
|
end
|
71
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-file_characterization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Treacy
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-10-
|
14
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.0.
|
133
|
+
rubygems_version: 2.0.3
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: To provide a wrapper for file characterization
|
@@ -148,3 +148,4 @@ test_files:
|
|
148
148
|
- spec/lib/hydra/file_characterization/to_temp_file_spec.rb
|
149
149
|
- spec/lib/hydra/file_characterization_spec.rb
|
150
150
|
- spec/spec_helper.rb
|
151
|
+
has_rdoc:
|