merritt-manifest 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +11 -0
- data/lib/merritt/manifest/data_one.rb +5 -3
- data/lib/merritt/manifest/fields.rb +8 -1
- data/lib/merritt/manifest/module_info.rb +1 -1
- data/merritt-manifest.gemspec +2 -1
- data/merritt-manifest.iml +2 -0
- data/spec/unit/merritt/manifest/data_one_spec.rb +3 -3
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cb3e93897e66af0758ee2ad42e5b9b8c0a6bd2c
|
4
|
+
data.tar.gz: 7a1e0afce2443cc78ad558e1a93882257c7502c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63c2e6d1f168a4f7f046762d72c94b4d7b095ee3ef29d554d245079ddd9fdb6ccc4473fd5adaf174698ddf195e3721c5eea2bbe7130a1a5d956d0b08857c8719
|
7
|
+
data.tar.gz: 44baf91994e97c54ce4e399cb13be54c7a2556b1f2076ca2fb696e23ae84ebbc7f7937ec3b03bf5e3eb54f712e8a145a220680b82e1d8a435aa7c1645080e6e5
|
data/CHANGES.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# 0.1.1 (18 April 2017)
|
2
|
+
|
3
|
+
- `Merritt::Manifest::Fields::Object::MIME_TYPE` now correctly parses strings as
|
4
|
+
`MIME::Type` objects.
|
5
|
+
- **BREAKING CHANGE:** `Merritt::Manifest::DataONE` now uses the standard `file_name`
|
6
|
+
and `mime_type` fields rather than `name` and `type`.
|
7
|
+
|
8
|
+
|
9
|
+
# 0.1.0 (18 April 2017)
|
10
|
+
|
11
|
+
- Initial release.
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'merritt/manifest/fields'
|
2
|
+
|
1
3
|
module Merritt
|
2
4
|
class Manifest
|
3
5
|
# A specialization of {Manifest} for DataONE.
|
@@ -6,7 +8,7 @@ module Merritt
|
|
6
8
|
# Creates a new {Manifest::DataONE}
|
7
9
|
# @param files [Array<Manifest::File>] an array of data files to be converted to entries.
|
8
10
|
# (Note that these not be actual {Manifest::File} objects so long as they respond to
|
9
|
-
# `#
|
11
|
+
# `#file_name` and `#mime_type`)
|
10
12
|
def initialize(files:)
|
11
13
|
super(
|
12
14
|
conformance: 'dataonem_0.1',
|
@@ -38,8 +40,8 @@ module Merritt
|
|
38
40
|
{
|
39
41
|
METADATA_FILE => md_name,
|
40
42
|
METADATA_FORMAT => md_url,
|
41
|
-
DATA_FILE => file.
|
42
|
-
MIME_TYPE => file
|
43
|
+
DATA_FILE => file.file_name,
|
44
|
+
MIME_TYPE => Merritt::Manifest::Fields::Object::MIME_TYPE.value_from(file)
|
43
45
|
}
|
44
46
|
end
|
45
47
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'typesafe_enum'
|
2
|
+
require 'mime-types'
|
2
3
|
require 'uri'
|
3
4
|
|
4
5
|
module Merritt
|
@@ -112,7 +113,13 @@ module Merritt
|
|
112
113
|
end
|
113
114
|
|
114
115
|
# field for `mrt:mimeType`
|
115
|
-
new :MIME_TYPE, 'mrt:mimeType'
|
116
|
+
new :MIME_TYPE, 'mrt:mimeType' do
|
117
|
+
def value_from(obj)
|
118
|
+
value = super(obj)
|
119
|
+
return value if value.nil? || value.is_a?(::MIME::Type)
|
120
|
+
::MIME::Types[value.to_s].first
|
121
|
+
end
|
122
|
+
end
|
116
123
|
end
|
117
124
|
end
|
118
125
|
end
|
data/merritt-manifest.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.authors = ['David Moles']
|
13
13
|
spec.email = ['david.moles@ucop.edu']
|
14
14
|
spec.summary = 'Merritt manifest generation library'
|
15
|
-
spec.description = 'Merritt manifest
|
15
|
+
spec.description = 'A library for creating Merritt text-based manifests (a specialization of the Checkm text-based manifest format).'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
origin = `git config --get remote.origin.url`.chomp
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
+
spec.add_dependency 'mime-types', '~> 3.1'
|
28
29
|
spec.add_dependency 'typesafe_enum', '~> 0.1.7'
|
29
30
|
|
30
31
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
data/merritt-manifest.iml
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.5, ruby-2.2.5-p319) [gem]" level="application" />
|
13
13
|
<orderEntry type="library" scope="PROVIDED" name="hirb (v0.7.3, ruby-2.2.5-p319) [gem]" level="application" />
|
14
14
|
<orderEntry type="library" scope="PROVIDED" name="json (v2.0.4, ruby-2.2.5-p319) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.1, ruby-2.2.5-p319) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, ruby-2.2.5-p319) [gem]" level="application" />
|
15
17
|
<orderEntry type="library" scope="PROVIDED" name="parser (v2.4.0.0, ruby-2.2.5-p319) [gem]" level="application" />
|
16
18
|
<orderEntry type="library" scope="PROVIDED" name="powerpack (v0.1.1, ruby-2.2.5-p319) [gem]" level="application" />
|
17
19
|
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.2.1, ruby-2.2.5-p319) [gem]" level="application" />
|
@@ -21,7 +21,7 @@ module Merritt
|
|
21
21
|
'survey/Q33-37/networking.R' => 'text/plain',
|
22
22
|
'survey/Q38-42/publications.R' => 'text/plain',
|
23
23
|
'survey_data_prep.R' => 'text/plain'
|
24
|
-
}.map { |name, type| OpenStruct.new(
|
24
|
+
}.map { |name, type| OpenStruct.new(file_name: name, mime_type: type) }
|
25
25
|
@manifest = Manifest::DataONE.new(files: files)
|
26
26
|
end
|
27
27
|
|
@@ -75,8 +75,8 @@ module Merritt
|
|
75
75
|
expect(oai_entry['dom:scienceMetadataFormat']).to eq('http://dublincore.org/schemas/xmls/qdc/2008/02/11/qualifieddc.xsd')
|
76
76
|
|
77
77
|
[dcs_entry, oai_entry].each do |entry|
|
78
|
-
expect(entry['dom:scienceDataFile']).to eq(file.
|
79
|
-
expect(entry['mrt:mimeType']).to eq(file.
|
78
|
+
expect(entry['dom:scienceDataFile']).to eq(file.file_name)
|
79
|
+
expect(entry['mrt:mimeType']).to eq(file.mime_type)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merritt-manifest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mime-types
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: typesafe_enum
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +136,8 @@ dependencies:
|
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0.9'
|
125
|
-
description: Merritt
|
139
|
+
description: A library for creating Merritt text-based manifests (a specialization
|
140
|
+
of the Checkm text-based manifest format).
|
126
141
|
email:
|
127
142
|
- david.moles@ucop.edu
|
128
143
|
executables: []
|
@@ -140,6 +155,7 @@ files:
|
|
140
155
|
- ".ruby-version"
|
141
156
|
- ".travis.yml"
|
142
157
|
- ".yardopts"
|
158
|
+
- CHANGES.md
|
143
159
|
- Gemfile
|
144
160
|
- LICENSE.md
|
145
161
|
- README.md
|