mn2sts 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: eb0d1524d99a720243a340283e5c54f913b82d3ff8df99d4b238329238200418
4
- data.tar.gz: 5c15a71eafdec19ea68a1195f67bbc9be2ae7b0ec6568fea14330cd361dad3ee
3
+ metadata.gz: fda5bec5cc90aeea99c4d5169fca93291add45bebd703abc8d94473f72ca3335
4
+ data.tar.gz: bc69ab1b9b6f265f6d0288b282137bde9aae0f0ca437503a680bba3f7e32f376
5
5
  SHA512:
6
- metadata.gz: 330ef10b8821be2b73596abf51a6c11e0223512e16553d02685d54c9cb90857007f745d43f222998b2780cf54001176b48248cfa69a4da2885c7ec0cab35cfaf
7
- data.tar.gz: 2eb03eb09504e8d9a3cf6f2aa017ed6cc54f96d900d139cb4cc1b57c4748359bfa9cc0a7196cdfe12782eba126b9dd33aa16b451aa49e99dafbc42073f37add8
6
+ metadata.gz: baf1fc414a34895a7b255b0469b3bd1135485e5f865bf6bb5c5db275065e54345ef3418f92caaa04e0cb53de9aa450ac6ac7116b7644577a9752ebe764e570df
7
+ data.tar.gz: 633c5a4a135faa648463ebbcecb1c2b754b9700a8d546f0c13dcfb0693e136658ee4b4e750eb3a302fa5eabc911275362a10dd26952eb9dcd7f3f1e74cbd021e
@@ -30,7 +30,7 @@ Or include it in your gemspec.
30
30
  [source,ruby]
31
31
  ----
32
32
  require 'mn2sts'
33
- Mn2sts.convert(sample_xml_path, output_pdf_path, sample_xsl_path)
33
+ Mn2sts.convert(sample_xml_path, output_pdf_path)
34
34
  ----
35
35
 
36
36
  == Updating the gem
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
  require_relative 'lib/mn2sts/version'
4
+ require 'open-uri'
4
5
 
5
6
  RSpec::Core::RakeTask.new(:spec)
6
7
 
7
- task :default => :spec
8
+ task :default => ['bin/mn2sts.jar', 'spec/fixtures/rice-en.cd.mn.xml', :spec]
8
9
 
9
10
  require 'open-uri'
10
11
 
@@ -15,3 +16,15 @@ file 'bin/mn2sts.jar' do |file|
15
16
  file.write open(url).read
16
17
  end
17
18
  end
19
+
20
+ file 'spec/fixtures/rice-en.cd.mn.xml' do |file|
21
+ uri = "https://raw.githubusercontent.com/metanorma/mn-samples-iso/gh-pages/documents/international-standard/rice-en.cd.xml"
22
+
23
+ File.open(file.name, "w") do |saved_file|
24
+ # the following "open" is provided by open-uri
25
+ open(uri, "r") do |read_file|
26
+ saved_file.write(read_file.read)
27
+ end
28
+ end
29
+
30
+ end
Binary file
@@ -16,18 +16,20 @@ module Mn2sts
16
16
  message.strip
17
17
  end
18
18
 
19
- def self.convert(url_path, output_path, xsl_stylesheet)
20
- return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
19
+ def self.convert(xml_path_in, xml_path_out)
20
+ return if xml_path_in.nil? || xml_path_out.nil?
21
21
 
22
22
  puts MN2STS_JAR_PATH
23
- cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', MN2STS_JAR_PATH, '--xml-file',
24
- url_path, '--xsl-file', xsl_stylesheet, '--pdf-file',
25
- output_path].join(' ')
23
+ cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', MN2STS_JAR_PATH,
24
+ '--xml-file-in', xml_path_in,
25
+ '--xml-file-out', xml_path_out
26
+ ].join(' ')
26
27
 
27
28
  puts cmd
28
29
  _, error_str, status = Open3.capture3(cmd)
29
30
 
30
31
  unless status.success?
32
+ warn error_str
31
33
  raise error_str
32
34
  end
33
35
  end
@@ -1,4 +1,4 @@
1
1
  module Mn2sts
2
- MN2STS_JAR_VERSION = '1.1'
2
+ MN2STS_JAR_VERSION = '1.2'
3
3
  VERSION = "#{MN2STS_JAR_VERSION}.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mn2sts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  mn2sts converts Metanorma XML into NISO STS XML.
@@ -56,7 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.0.3
59
+ rubyforge_project:
60
+ rubygems_version: 2.7.6
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: mn2sts converts Metanorma XML into NISO STS XML.