mnconvert 1.13.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -20
- data/.github/workflows/release-tag.yml +22 -27
- data/.github/workflows/release.yml +1 -0
- data/.gitignore +0 -3
- data/Rakefile +25 -14
- data/bin/mnconvert.jar +0 -0
- data/lib/mnconvert/version.rb +1 -1
- data/lib/mnconvert.rb +27 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a81599221a272e090908462b3f615a71611cf53e5c8c5f450866ed2514a7cf3c
|
4
|
+
data.tar.gz: 93cfb1a2d7f8d9e1bc846a4d2e44f38748131e9c3e8ff384cffb30fd35c8b14a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b284d2a94698d0bae078640ce501d6e0337dac4972777ba63f8cc0f18207913da041282b0f60b4a0bc90bb3fff5bba00c0230eb45bf4d2ff5f644d5626b6ef5c
|
7
|
+
data.tar.gz: d8d6d23ddb563d97235d61c8df661d16f9a5281878b7c140d2a43c572e4cabe45a7d2e77168fd62c69c900d0ce18cbfee5222deabe8f23def1d6d64b32b602af
|
data/.github/workflows/rake.yml
CHANGED
@@ -10,23 +10,6 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
rake:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
strategy:
|
17
|
-
fail-fast: false
|
18
|
-
matrix:
|
19
|
-
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
|
-
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
-
experimental: [ false ]
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
with:
|
25
|
-
submodules: true
|
26
|
-
|
27
|
-
- uses: ruby/setup-ruby@v1
|
28
|
-
with:
|
29
|
-
ruby-version: ${{ matrix.ruby }}
|
30
|
-
bundler-cache: true
|
31
|
-
|
32
|
-
- run: bundle exec rake
|
13
|
+
uses: metanorma/metanorma-build-scripts/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -9,41 +9,36 @@ jobs:
|
|
9
9
|
runs-on: ubuntu-18.04
|
10
10
|
if: startsWith(github.event.client_payload.ref, 'refs/tags/v')
|
11
11
|
steps:
|
12
|
-
- uses: actions/checkout@
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
with:
|
14
|
+
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
15
|
+
|
16
|
+
- run: |
|
17
|
+
git config --global user.name "metanorma-ci"
|
16
18
|
git config --global user.email "metanorma-ci@users.noreply.github.com"
|
17
|
-
|
18
|
-
|
19
|
-
- name: Parse mnconvert version
|
19
|
+
|
20
|
+
- run: echo mnconvert_VERSION=${mnconvert_TAG#*/v} >> ${GITHUB_ENV}
|
20
21
|
env:
|
21
22
|
mnconvert_TAG: ${{ github.event.client_payload.ref }}
|
22
|
-
|
23
|
-
|
24
|
-
- name: Use Ruby
|
25
|
-
uses: actions/setup-ruby@v1
|
23
|
+
|
24
|
+
- uses: ruby/setup-ruby@v1
|
26
25
|
with:
|
27
26
|
ruby-version: '2.6'
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
-
|
35
|
-
run: |
|
36
|
-
gem bump --version ${mnconvert_VERSION} --no-commit
|
37
|
-
- name: Update mnconvert.jar
|
38
|
-
run: |
|
27
|
+
bundler-cache: true
|
28
|
+
|
29
|
+
- run: gem install gem-release
|
30
|
+
|
31
|
+
- run: gem bump --version ${mnconvert_VERSION} --no-commit
|
32
|
+
|
33
|
+
- run: |
|
39
34
|
rm -f bin/mnconvert.jar
|
40
|
-
rake bin/mnconvert.jar
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
bundle exec rake bin/mnconvert.jar
|
36
|
+
|
37
|
+
- run: bundle exec rake
|
38
|
+
|
44
39
|
- name: Push commit and tag
|
45
40
|
run: |
|
46
41
|
git add -u bin/mnconvert.jar lib/mnconvert/version.rb
|
47
42
|
git commit -m "Bump version to ${mnconvert_VERSION}"
|
48
43
|
git tag v${mnconvert_VERSION}
|
49
|
-
git push
|
44
|
+
git push origin HEAD:${GITHUB_REF} --tags
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,28 +1,31 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require_relative
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require_relative "lib/mnconvert/version"
|
4
4
|
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
|
7
|
-
task :
|
7
|
+
task default: [
|
8
|
+
"bin/mnconvert.jar",
|
9
|
+
"spec/fixtures/rice-en.cd.mn.xml",
|
10
|
+
"spec/fixtures/rice-en.final.sts.xml",
|
11
|
+
"spec/fixtures/rfc8650.xml",
|
12
|
+
:spec,
|
13
|
+
]
|
8
14
|
|
9
15
|
def uri_open(url)
|
10
16
|
require 'open-uri'
|
11
|
-
|
12
|
-
return open(url)
|
13
|
-
end
|
14
|
-
return URI.open(url)
|
17
|
+
URI.parse(url).open
|
15
18
|
end
|
16
19
|
|
17
|
-
file
|
20
|
+
file "bin/mnconvert.jar" do |file|
|
18
21
|
ver = MnConvert::MNCONVERT_JAR_VERSION
|
19
22
|
url = "https://github.com/metanorma/mnconvert/releases/download/v#{ver}/mnconvert-#{ver}.jar"
|
20
|
-
File.open(file.name,
|
21
|
-
|
23
|
+
File.open(file.name, "wb") do |f|
|
24
|
+
f.write uri_open(url).read
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
|
-
file
|
28
|
+
file "spec/fixtures/rice-en.cd.mn.xml" do |file|
|
26
29
|
uri = "https://raw.githubusercontent.com/metanorma/mn-samples-iso/gh-pages/documents/international-standard/rice-en.cd.xml"
|
27
30
|
|
28
31
|
File.open(file.name, "w") do |saved_file|
|
@@ -30,10 +33,18 @@ file 'spec/fixtures/rice-en.cd.mn.xml' do |file|
|
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
33
|
-
file
|
36
|
+
file "spec/fixtures/rice-en.final.sts.xml" do |file|
|
34
37
|
uri = "https://raw.githubusercontent.com/metanorma/sts2mn/master/src/test/resources/rice-en.final.sts.xml"
|
35
38
|
|
36
39
|
File.open(file.name, "w") do |saved_file|
|
37
40
|
saved_file.write(uri_open(uri).read)
|
38
41
|
end
|
39
|
-
end
|
42
|
+
end
|
43
|
+
|
44
|
+
file "spec/fixtures/rfc8650.xml" do |file|
|
45
|
+
uri = "https://raw.githubusercontent.com/metanorma/mnconvert/main/src/test/resources/rfc/rfc8650.xml"
|
46
|
+
|
47
|
+
File.open(file.name, "w") do |saved_file|
|
48
|
+
saved_file.write(uri_open(uri).read)
|
49
|
+
end
|
50
|
+
end
|
data/bin/mnconvert.jar
CHANGED
Binary file
|
data/lib/mnconvert/version.rb
CHANGED
data/lib/mnconvert.rb
CHANGED
@@ -7,7 +7,9 @@ module MnConvert
|
|
7
7
|
STS = :sts
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
MNCONVERT_JAR_NAME = "mnconvert.jar".freeze
|
11
|
+
MNCONVERT_JAR_PATH = File.join(File.dirname(__FILE__), "..", "bin",
|
12
|
+
MNCONVERT_JAR_NAME)
|
11
13
|
|
12
14
|
def self.jvm_options
|
13
15
|
options = ["-Xss5m", "-Xmx1024m"]
|
@@ -31,12 +33,10 @@ module MnConvert
|
|
31
33
|
message.strip
|
32
34
|
end
|
33
35
|
|
34
|
-
def self.convert(input_file,
|
35
|
-
validate(opts
|
36
|
+
def self.convert(input_file, opts = {})
|
37
|
+
validate(opts)
|
36
38
|
|
37
|
-
cmd = [
|
38
|
-
input_file, "--input-format", input_format,
|
39
|
-
"--output", output_file, *optional_opts(opts)].join(" ")
|
39
|
+
cmd = [*java_cmd, input_file, *optional_opts(opts)].join(" ")
|
40
40
|
|
41
41
|
puts cmd if opts[:debug]
|
42
42
|
output_str, error_str, status = Open3.capture3(cmd)
|
@@ -50,16 +50,31 @@ module MnConvert
|
|
50
50
|
class << self
|
51
51
|
private
|
52
52
|
|
53
|
-
|
53
|
+
OPTIONAL_OPTS = {
|
54
|
+
sts_type: "--type",
|
55
|
+
imagesdir: "--imagesdir",
|
56
|
+
check_type: "--check-type",
|
57
|
+
input_format: "--input-format",
|
58
|
+
output_format: "--output-format",
|
59
|
+
output_file: "--output",
|
60
|
+
xsl_file: "--xsl-file",
|
61
|
+
}.freeze
|
62
|
+
|
63
|
+
def java_cmd
|
64
|
+
["java", *jvm_options, "-jar", MNCONVERT_JAR_PATH]
|
65
|
+
end
|
66
|
+
|
67
|
+
def validate(opts)
|
54
68
|
output_format = opts[:output_format]
|
69
|
+
debug = opts[:debug]
|
55
70
|
|
56
|
-
case input_format
|
71
|
+
case opts[:input_format]
|
57
72
|
when InputFormat::MN
|
58
73
|
validate_mn(opts, output_format)
|
59
74
|
when InputFormat::STS
|
60
75
|
validate_sts(opts, output_format)
|
61
76
|
else
|
62
|
-
|
77
|
+
puts "input format will be decided by #{MNCONVERT_JAR_NAME}" if debug
|
63
78
|
end
|
64
79
|
end
|
65
80
|
|
@@ -84,16 +99,12 @@ module MnConvert
|
|
84
99
|
end
|
85
100
|
|
86
101
|
def optional_opts(opts)
|
87
|
-
result = {
|
88
|
-
|
89
|
-
imagesdir: "--imagesdir",
|
90
|
-
check_type: "--check-type",
|
91
|
-
output_format: "--output-format",
|
92
|
-
xsl_file: "--xsl-file",
|
93
|
-
}.reject { |k, _| opts[k].nil? }.map { |k, v| "#{v} #{opts[k]}" }
|
102
|
+
result = OPTIONAL_OPTS.reject { |k, _| opts[k].nil? }
|
103
|
+
result = result.map { |k, v| "#{v} #{opts[k]}" }
|
94
104
|
|
95
105
|
result << "--debug" if opts[:debug]
|
96
106
|
result << "--split-bibdata" if opts[:split_bibdata]
|
107
|
+
result << "--semantic" if opts[:semantic]
|
97
108
|
|
98
109
|
result
|
99
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mnconvert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.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:
|
11
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
mnconvert converts Metanorma XML into NISO STS XML.
|