jhove-service 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +5 -5
  3. data/lib/jhove_service.rb +13 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1422e93ce5a6f16d9582ee9aa74e818415717f8
4
- data.tar.gz: d484c7740c2adf9b716abe1f5fa297fec1148665
3
+ metadata.gz: aa0685c415e5e2008e19e4a1e349e614e5d716b9
4
+ data.tar.gz: e8bdfc822598531f9cb5784a11e9f99ebc1c5b37
5
5
  SHA512:
6
- metadata.gz: d97605cf406b47cf9bca37fa1828b9c7fe03c6e30f124206ed2d96076d547dfc8b892fc6a384ef0f6678d0218313c89c998d2f457ef42861c113faa66fc1ade1
7
- data.tar.gz: bf4ce1ef96d65ad07194e3f064b79e1f73d055d41ecce31d831b99ee2188a706dae81858b21e90e0902c3dcb7c30e860c263d7da83efcb398356dc5d3d60efe2
6
+ metadata.gz: 24f290d188efd7cc70cd68be08702640cc7d3edb94dfc679092439424960cab50ad720faada26f85b31e205f66f8ed2b0a0e90e22986b112e6eada1bdb0740e3
7
+ data.tar.gz: 5f86847ce28c2265df555f13b2c92efb4b3a3eafbddadd4a067df0ad066c3a2af58286fe891a45839d1d45ff74214cf1c9e241300d99995d8391e596a16d5dfe
@@ -10,10 +10,8 @@ This will give you:
10
10
  JhoveService
11
11
 
12
12
  == Build and release procedure
13
- Modify the version number in jhove-service.gemspec, then push your commits to AFS. DO NOT TAG!
14
- Run: 'rake dlss_release' to tag, build, and publish the gem
15
- See the Rakefile and the LyberCore::DlssRelease task in lyberteam-devel/lib/dlss/rake/dlss_release.rb
16
- for more details
13
+ Modify the version number in jhove-service.gemspec, then push your commits to github. DO NOT TAG!
14
+ Run: 'rake release' to tag, build, and publish the gem
17
15
 
18
16
  == Releases
19
17
  - <b>0.1.0</b> First release
@@ -25,7 +23,9 @@ for more details
25
23
  - <b>1.0.1</b> Updated to use new sul-gems server and new lyberteam-gems-devel utility
26
24
  - <b>1.0.2</b> Fixed negative indentation problem for empty elements( e.g. <elem/>)
27
25
  - <b>1.0.3</b> Upgraded bin/jhoveApp.jar to copy from Jhove 1.9 release
26
+ - <b>1.1.0</b> Upgraded bin/*.jar apps to 1.14.6
27
+ - <b>1.1.1</b> Ensure only relative paths are shown in xml output
28
28
 
29
29
  == Copyright
30
30
 
31
- Copyright (c) 2013 Stanford University Library. See LICENSE for details.
31
+ Copyright (c) 2017 Stanford University Library. See LICENSE for details.
@@ -2,6 +2,7 @@ require 'nokogiri'
2
2
  require 'pathname'
3
3
  require 'jhove_technical_metadata'
4
4
  require 'stringio'
5
+ require 'uri'
5
6
 
6
7
  class JhoveService
7
8
 
@@ -37,6 +38,7 @@ require 'stringio'
37
38
  raise "Content #{content_dir} not found" unless File.directory? content_dir
38
39
  if fileset_file.nil? # a simple directory gets called directly
39
40
  exec_command(get_jhove_command(content_dir))
41
+ jhove_output_xml_ng = File.open(jhove_output) { |f| Nokogiri::XML(f) }
40
42
  else # a filelist gets run one by one, jhove cannot do this out of the box, so we need to run jhove file by file and then assemble the results ourselves into a single XML
41
43
  raise "File list #{fileset_file} not found" unless File.exists? fileset_file
42
44
  files = File.new(fileset_file).readlines
@@ -51,10 +53,11 @@ require 'stringio'
51
53
  combined_xml_output += jhove_output_xml_ng.css("//repInfo").to_xml # build up an XML string with all output
52
54
  output_file.delete
53
55
  end
54
- jhove_output_xml_ng.root.children.each {|n| n.remove} # use of the files we built up above, strip all the children to ge the root jhove node
56
+ jhove_output_xml_ng.root.children.each {|n| n.remove} # use all of the files we built up above, strip all the children to get the root jhove node
55
57
  jhove_output_xml_ng.root << combined_xml_output # now add the combined xml for all files
56
- File.write(jhove_output, jhove_output_xml_ng.to_xml)
57
58
  end
59
+ remove_path_from_file_nodes(jhove_output_xml_ng,content_dir)
60
+ File.write(jhove_output, jhove_output_xml_ng.to_xml)
58
61
  jhove_output.to_s
59
62
  end
60
63
 
@@ -77,6 +80,14 @@ require 'stringio'
77
80
  jhove_cmd
78
81
  end
79
82
 
83
+ # @param jhove_output_xml_ng [ng_xml_obj] the nokogiri xml output from jhove
84
+ # @param path [String] the shared path that will be removed from each file name to ensure the file nodes are relative
85
+ def remove_path_from_file_nodes(jhove_output_xml_ng,path)
86
+ jhove_output_xml_ng.xpath('//jhove:repInfo', 'jhove' => 'http://hul.harvard.edu/ois/xml/ns/jhove').each do |filename_node|
87
+ filename_node.attributes['uri'].value = URI.decode(filename_node.attributes['uri'].value.gsub("#{path}",'').sub(/^\//,'')) # decode and remove path and any leading /
88
+ end
89
+ end
90
+
80
91
  # @param [Pathname,String] jhove_pathname The full path of the file containing JHOVE output to be transformed to technical metadata
81
92
  # @return [String] Convert jhove output it to technicalMetadata, returning the output file path
82
93
  def create_technical_metadata(jhove_pathname=jhove_output)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jhove-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Anderson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-22 00:00:00.000000000 Z
12
+ date: 2017-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri