mnconvert 1.10.0 → 1.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release-manual.yml +33 -0
- data/.github/workflows/release-tag.yml +22 -27
- data/.gitignore +0 -3
- data/Rakefile +25 -14
- data/bin/mnconvert.jar +0 -0
- data/lib/mnconvert/version.rb +2 -2
- data/lib/mnconvert.rb +27 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '084c072c4bb280db751ffb05fb0e593c2191f0c5a7b9dafbe69880510488b268'
|
4
|
+
data.tar.gz: 9dc55ba0711e6ad14e7013cf0f5784bb123a1b21c991ee8d6a282f2b8316f1cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b63f18666b9306e3a1c386f62ed1d280127d3da56a8eccdea223189be604f07cde13321b2e880efb92bd3ad2483b2155cef7a3928e4e3d17911589b5d9359ac
|
7
|
+
data.tar.gz: 0fd0ce62bc2517f095348c428ee5ea6a7cd7fe335c23478183bb73d82f30a5ffac91d9e4031d8e501db6c00c49e8a5834704a300278e43480f005a95b6d51bd4
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: release-manual
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
next_version:
|
7
|
+
description: |
|
8
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
9
|
+
required: true
|
10
|
+
default: 'skip'
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
release:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
with:
|
18
|
+
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
19
|
+
|
20
|
+
- run: |
|
21
|
+
git config --global user.name "metanorma-ci"
|
22
|
+
git config --global user.email "metanorma-ci@users.noreply.github.com"
|
23
|
+
|
24
|
+
- uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: '2.6'
|
27
|
+
bundler-cache: true
|
28
|
+
|
29
|
+
- run: gem install gem-release
|
30
|
+
|
31
|
+
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip'
|
32
|
+
run: gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
33
|
+
|
@@ -7,43 +7,38 @@ on:
|
|
7
7
|
jobs:
|
8
8
|
tag_repo:
|
9
9
|
runs-on: ubuntu-18.04
|
10
|
-
if: startsWith(github.event.client_payload.ref, 'refs/tags/v')
|
10
|
+
if: false # 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
35
|
rake bin/mnconvert.jar
|
41
|
-
|
42
|
-
|
43
|
-
|
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.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
mnconvert converts Metanorma XML into NISO STS XML.
|
@@ -21,6 +21,7 @@ extensions: []
|
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
23
|
- ".github/workflows/rake.yml"
|
24
|
+
- ".github/workflows/release-manual.yml"
|
24
25
|
- ".github/workflows/release-tag.yml"
|
25
26
|
- ".github/workflows/release.yml"
|
26
27
|
- ".gitignore"
|