sts2mn 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/macos.yml +39 -0
- data/.github/workflows/release-tag.yml +49 -0
- data/.github/workflows/release.yml +41 -0
- data/.github/workflows/ubuntu.yml +53 -0
- data/.github/workflows/windows.yml +41 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/README.adoc +60 -0
- data/Rakefile +30 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/sts2mn.jar +0 -0
- data/lib/sts2mn.rb +61 -0
- data/lib/sts2mn/version.rb +4 -0
- data/mn2sts.gemspec +33 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7d0c61e1a614f6a902b358555775dba82fb7c3cf4011585bc8793ef4be7a3f70
|
4
|
+
data.tar.gz: 55b6e31498540d084b0e72d1e93c472c8405174937e539e5d5f38de8e402e162
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1c7d5abe6eb7d567bc399a795def6005e504d8c06c9261789ddebc04b073258dc714648313297a03f964270fa230a7bd9f5aff7a470c0fa89dee0b8efb72b49c
|
7
|
+
data.tar.gz: 521a002871ff644394795f60befac6722c082e17e5c654515db885df328a42b050c5d51e816d0f0ff967b955668d805ca2cbe05dbb6a78c8ff8b73d3ffd9011c
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: macos
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/ubuntu.yml
|
11
|
+
- .github/workflows/windows.yml
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test-macos:
|
15
|
+
name: Test on Ruby ${{ matrix.ruby }} macOS
|
16
|
+
runs-on: macos-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@master
|
28
|
+
- name: Use Ruby
|
29
|
+
uses: actions/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
architecture: 'x64'
|
33
|
+
- name: Update gems
|
34
|
+
run: |
|
35
|
+
sudo gem install bundler --force
|
36
|
+
bundle install --jobs 4 --retry 3
|
37
|
+
- name: Run specs
|
38
|
+
run: |
|
39
|
+
bundle exec rake
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: release-tag
|
2
|
+
|
3
|
+
on:
|
4
|
+
repository_dispatch:
|
5
|
+
types: [ metanorma/sts2mn ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
tag_repo:
|
9
|
+
runs-on: ubuntu-18.04
|
10
|
+
if: startsWith(github.event.client_payload.ref, 'refs/tags/v')
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v1
|
13
|
+
- name: Add writable remote
|
14
|
+
run: |
|
15
|
+
git config --global user.name "${GITHUB_ACTOR}"
|
16
|
+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
17
|
+
git remote add github https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
18
|
+
git pull github ${GITHUB_REF} --ff-only
|
19
|
+
- name: Parse sts2mn version
|
20
|
+
env:
|
21
|
+
sts2mn_TAG: ${{ github.event.client_payload.ref }}
|
22
|
+
run: |
|
23
|
+
echo "::set-env name=sts2mn_VERSION::${sts2mn_TAG#*/v}"
|
24
|
+
- name: Use Ruby
|
25
|
+
uses: actions/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: '2.6'
|
28
|
+
architecture: 'x64'
|
29
|
+
- name: Update gems
|
30
|
+
run: |
|
31
|
+
gem install gem-release
|
32
|
+
gem install bundler
|
33
|
+
bundle install --jobs 4 --retry 3
|
34
|
+
- name: Update version
|
35
|
+
run: |
|
36
|
+
gem bump --version ${sts2mn_VERSION} --no-commit
|
37
|
+
- name: Update sts2mn.jar
|
38
|
+
run: |
|
39
|
+
rm -f bin/sts2mn.jar
|
40
|
+
rake bin/sts2mn.jar
|
41
|
+
- name: Run specs
|
42
|
+
run: |
|
43
|
+
bundle exec rake
|
44
|
+
- name: Push commit and tag
|
45
|
+
run: |
|
46
|
+
git add -u bin/sts2mn.jar lib/sts2mn/version.rb
|
47
|
+
git commit -m "Bump version to ${sts2mn_VERSION}"
|
48
|
+
git tag v${sts2mn_VERSION}
|
49
|
+
git push github HEAD:${GITHUB_REF} --tags
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-18.04
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v1
|
13
|
+
- name: Use Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: '2.6'
|
17
|
+
architecture: 'x64'
|
18
|
+
- name: Update gems
|
19
|
+
run: |
|
20
|
+
gem install bundler
|
21
|
+
bundle install --jobs 4 --retry 3
|
22
|
+
- name: Update sts2mn.jar
|
23
|
+
run: |
|
24
|
+
rm -f bin/sts2mn.jar
|
25
|
+
rake bin/sts2mn.jar
|
26
|
+
- name: Run specs
|
27
|
+
run: |
|
28
|
+
bundle exec rake
|
29
|
+
- name: Publish to rubygems.org
|
30
|
+
env:
|
31
|
+
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
32
|
+
run: |
|
33
|
+
gem install gem-release
|
34
|
+
touch ~/.gem/credentials
|
35
|
+
cat > ~/.gem/credentials << EOF
|
36
|
+
---
|
37
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
38
|
+
EOF
|
39
|
+
chmod 0600 ~/.gem/credentials
|
40
|
+
git status
|
41
|
+
gem release
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: ubuntu
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
tags:
|
9
|
+
- '*'
|
10
|
+
pull_request:
|
11
|
+
paths-ignore:
|
12
|
+
- .github/workflows/macos.yml
|
13
|
+
- .github/workflows/windows.yml
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
test-linux:
|
17
|
+
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
continue-on-error: ${{ matrix.experimental }}
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
24
|
+
experimental: [false]
|
25
|
+
include:
|
26
|
+
- ruby: '2.7'
|
27
|
+
experimental: true
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@master
|
30
|
+
- name: Use Ruby
|
31
|
+
uses: actions/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby }}
|
34
|
+
architecture: 'x64'
|
35
|
+
- name: Update gems
|
36
|
+
run: |
|
37
|
+
gem install bundler
|
38
|
+
bundle install --jobs 4 --retry 3
|
39
|
+
- name: Run specs
|
40
|
+
run: |
|
41
|
+
bundle exec rake
|
42
|
+
- name: Trigger dependent repositories
|
43
|
+
if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
|
44
|
+
env:
|
45
|
+
GH_USERNAME: ${{ secrets.PAT_USERNAME }}
|
46
|
+
GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
|
47
|
+
run: |
|
48
|
+
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
49
|
+
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
50
|
+
for repo in $DEPENDENT_REPOS
|
51
|
+
do
|
52
|
+
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
|
53
|
+
done
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: windows
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/ubuntu.yml
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test-windows:
|
15
|
+
name: Test on Ruby ${{ matrix.ruby }} Windows
|
16
|
+
runs-on: windows-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@master
|
28
|
+
- name: Use Ruby
|
29
|
+
uses: actions/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
architecture: 'x64'
|
33
|
+
- name: Update gems
|
34
|
+
shell: pwsh
|
35
|
+
run: |
|
36
|
+
gem install bundler
|
37
|
+
bundle config --local path vendor/bundle
|
38
|
+
bundle install --jobs 4 --retry 3
|
39
|
+
- name: Run specs
|
40
|
+
run: |
|
41
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at ronald.tse@ribose.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/README.adoc
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
= sts2mn Ruby gem
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/metanorma.svg["Gem Version", link="https://rubygems.org/gems/metanorma"]
|
4
|
+
image:https://github.com/metanorma/sts2mn-ruby/workflows/ubuntu/badge.svg["Ubuntu Build Status", link="https://github.com/metanorma/sts2mn-ruby/actions?query=workflow%3Aubuntu"]
|
5
|
+
image:https://github.com/metanorma/sts2mn-ruby/workflows/macos/badge.svg["OSX Build Status", link="https://github.com/metanorma/sts2mn-ruby/actions?query=workflow%3Amacos"]
|
6
|
+
image:https://github.com/metanorma/sts2mn-ruby/workflows/windows/badge.svg["Windows Build Status", link="https://github.com/metanorma/sts2mn-ruby/actions?query=workflow%3Awindows"]
|
7
|
+
image:https://codeclimate.com/github/metanorma/sts2mn-ruby/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/sts2mn-ruby"]
|
8
|
+
image:https://img.shields.io/github/issues-pr-raw/metanorma/sts2mn-ruby.svg["Pull Requests", link="https://github.com/metanorma/sts2mn-ruby/pulls"]
|
9
|
+
image:https://img.shields.io/github/commits-since/metanorma/sts2mn-ruby/latest.svg["Commits since latest",link="https://github.com/metanorma/sts2mn-ruby/releases"]
|
10
|
+
|
11
|
+
== Purpose
|
12
|
+
|
13
|
+
The sts2mn Ruby gem is a wrapper around the Java https://github.com/metanorma/sts2mn[sts2mn]
|
14
|
+
which converts NISO STS and ISOSTS into Metanorma XML and AsciiDoc files.
|
15
|
+
|
16
|
+
This gem is used to provide sts2mn.jar with mirrored version numbers, to allow
|
17
|
+
Ruby code to easily refer to the desired sts2mn version as dependencies.
|
18
|
+
|
19
|
+
== Installation
|
20
|
+
|
21
|
+
[source,ruby]
|
22
|
+
----
|
23
|
+
gem install sts2mn
|
24
|
+
----
|
25
|
+
|
26
|
+
Or include it in your gemspec.
|
27
|
+
|
28
|
+
== Usage
|
29
|
+
|
30
|
+
[source,ruby]
|
31
|
+
----
|
32
|
+
require 'sts2mn'
|
33
|
+
Sts2mn.convert(input: 'test/sts.xml')
|
34
|
+
# => generates 'test/sts.adoc', in Metanorma AsciiDoc
|
35
|
+
|
36
|
+
Sts2mn.convert(input: 'test/sts.xml', output: 'another/path/mn.xml', format: 'xml')
|
37
|
+
# => generates 'another/path/mn.xml' in Metanorma XML
|
38
|
+
|
39
|
+
Sts2mn.convert(input: 'test/sts.xml', output: 'another/path/mn.adoc', format: 'adoc')
|
40
|
+
# => generates 'another/path/mn.adoc' in Metanorma AsciiDoc
|
41
|
+
|
42
|
+
Sts2mn.split_bibdata('test/sts.xml')
|
43
|
+
# => generates 'test/sts.rxl' (Relaton XML) and 'test/mn.adoc' (Metanorma AsciiDoc)
|
44
|
+
----
|
45
|
+
|
46
|
+
== Updating the gem
|
47
|
+
|
48
|
+
Update `lib/sts2mn/version.rb` to the desired version of https://github.com/metanorma/sts2mn[sts2mn].
|
49
|
+
|
50
|
+
Run `rake` to download the `bin/sts2mn.jar` file:
|
51
|
+
|
52
|
+
[source,ruby]
|
53
|
+
----
|
54
|
+
rm -f bin/sts2mn.jar
|
55
|
+
rake bin/sts2mn.jar
|
56
|
+
----
|
57
|
+
|
58
|
+
Then release the gem with `rake release`.
|
59
|
+
|
60
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require_relative 'lib/sts2mn/version'
|
4
|
+
require 'open-uri'
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task :default => ['bin/sts2mn.jar', 'spec/fixtures/rice-en.final.sts.xml', :spec]
|
9
|
+
|
10
|
+
require 'open-uri'
|
11
|
+
|
12
|
+
file 'bin/sts2mn.jar' do |file|
|
13
|
+
ver = Sts2mn::STS2MN_JAR_VERSION
|
14
|
+
url = "https://github.com/metanorma/sts2mn/releases/download/v#{ver}/sts2mn-#{ver}.jar"
|
15
|
+
File.open(file.name, 'wb') do |file|
|
16
|
+
file.write open(url).read
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
file 'spec/fixtures/rice-en.final.sts.xml' do |file|
|
21
|
+
uri = "https://raw.githubusercontent.com/metanorma/sts2mn/master/src/test/resources/rice-en.final.sts.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
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sts2mn"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/sts2mn.jar
ADDED
Binary file
|
data/lib/sts2mn.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'sts2mn/version'
|
3
|
+
|
4
|
+
module Sts2mn
|
5
|
+
STS2MN_JAR_PATH = File.join(File.dirname(__FILE__), '../bin/sts2mn.jar')
|
6
|
+
|
7
|
+
def self.help
|
8
|
+
cmd = ['java', '-jar', STS2MN_JAR_PATH].join(' ')
|
9
|
+
message, error_str, status = Open3.capture3(cmd)
|
10
|
+
message
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.version
|
14
|
+
cmd = ['java', '-jar', STS2MN_JAR_PATH, '-v'].join(' ')
|
15
|
+
message, error_str, status = Open3.capture3(cmd)
|
16
|
+
message.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.split_bibdata(input_path)
|
20
|
+
return if input_path.nil?
|
21
|
+
|
22
|
+
cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', STS2MN_JAR_PATH,
|
23
|
+
'--split-bibdata', input_path].join(' ')
|
24
|
+
# puts cmd
|
25
|
+
_, error_str, status = Open3.capture3(cmd)
|
26
|
+
|
27
|
+
unless status.success?
|
28
|
+
warn error_str
|
29
|
+
raise error_str
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.convert(input:, output: nil, format: nil)
|
34
|
+
return if input.nil?
|
35
|
+
|
36
|
+
cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', STS2MN_JAR_PATH]
|
37
|
+
|
38
|
+
case format.to_s
|
39
|
+
when 'xml', 'adoc'
|
40
|
+
cmd << ['--format', format.to_s]
|
41
|
+
else
|
42
|
+
raise 'Unknown format option provided to Sts2mn.convert'
|
43
|
+
end unless format.nil?
|
44
|
+
|
45
|
+
unless output.nil?
|
46
|
+
cmd << ['--output', output.to_s]
|
47
|
+
end
|
48
|
+
|
49
|
+
cmd << [input.to_s]
|
50
|
+
|
51
|
+
cmd = cmd.join(' ')
|
52
|
+
# puts cmd
|
53
|
+
_, error_str, status = Open3.capture3(cmd)
|
54
|
+
|
55
|
+
unless status.success?
|
56
|
+
warn error_str
|
57
|
+
raise error_str
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/mn2sts.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative 'lib/sts2mn/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "sts2mn"
|
5
|
+
spec.version = Sts2mn::VERSION
|
6
|
+
spec.authors = ["Ribose Inc."]
|
7
|
+
spec.email = ["open.source@ribose.com"]
|
8
|
+
|
9
|
+
spec.summary = "sts2mn converts NISO STS XML into Metanorma XML."
|
10
|
+
spec.description = <<~DESCRIPTION
|
11
|
+
sts2mn converts NISO STS XML into Metanorma XML.
|
12
|
+
This gem is a wrapper around sts2mn.jar available from
|
13
|
+
https://github.com/metanorma/sts2mn, with versions matching the JAR file.
|
14
|
+
DESCRIPTION
|
15
|
+
|
16
|
+
spec.homepage = "https://github.com/metanorma/sts2mn-ruby"
|
17
|
+
spec.license = "BSD-2-Clause"
|
18
|
+
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.files = `git ls-files`.split("\n")
|
22
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
23
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sts2mn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
sts2mn converts NISO STS XML into Metanorma XML.
|
15
|
+
This gem is a wrapper around sts2mn.jar available from
|
16
|
+
https://github.com/metanorma/sts2mn, with versions matching the JAR file.
|
17
|
+
email:
|
18
|
+
- open.source@ribose.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- ".github/workflows/macos.yml"
|
24
|
+
- ".github/workflows/release-tag.yml"
|
25
|
+
- ".github/workflows/release.yml"
|
26
|
+
- ".github/workflows/ubuntu.yml"
|
27
|
+
- ".github/workflows/windows.yml"
|
28
|
+
- ".gitignore"
|
29
|
+
- ".rspec"
|
30
|
+
- CODE_OF_CONDUCT.md
|
31
|
+
- Gemfile
|
32
|
+
- README.adoc
|
33
|
+
- Rakefile
|
34
|
+
- bin/console
|
35
|
+
- bin/setup
|
36
|
+
- bin/sts2mn.jar
|
37
|
+
- lib/sts2mn.rb
|
38
|
+
- lib/sts2mn/version.rb
|
39
|
+
- mn2sts.gemspec
|
40
|
+
homepage: https://github.com/metanorma/sts2mn-ruby
|
41
|
+
licenses:
|
42
|
+
- BSD-2-Clause
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.4.0
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubygems_version: 3.0.3
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: sts2mn converts NISO STS XML into Metanorma XML.
|
63
|
+
test_files: []
|