mn2sts 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: faa2b82e626f0e881dfb528d5d8af44a0595e788805e397e8e407cd3729a4da8
4
+ data.tar.gz: 827af3746c0532afd6ad7e7ff2eafb2113205438c0ebdf8d6ec7f0bc29055849
5
+ SHA512:
6
+ metadata.gz: 33d036cd117a176b9a61e44822bf05780a2237fba5b443366aa7100478e6a345de87ce06b86cdb8f3cfe551732ab977134bcc9b1f1eed577bb6e54fadefa43d6
7
+ data.tar.gz: d86909d3bd656d2f02a1b0491a8f9d16aadfd57a23ad6c1ff128da9aa97c056317290fd38bfa105137f512b63cb714f0d7aa49323d6a28b31201e29d6a984df6
@@ -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/mn2sts ]
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 mn2sts version
20
+ env:
21
+ mn2sts_TAG: ${{ github.event.client_payload.ref }}
22
+ run: |
23
+ echo "::set-env name=mn2sts_VERSION::${mn2sts_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 ${mn2sts_VERSION} --no-commit
37
+ - name: Update mn2sts.jar
38
+ run: |
39
+ rm -f bin/mn2sts.jar
40
+ rake bin/mn2sts.jar
41
+ - name: Run specs
42
+ run: |
43
+ bundle exec rake
44
+ - name: Push commit and tag
45
+ run: |
46
+ git add -u bin/mn2sts.jar lib/mn2sts/version.rb
47
+ git commit -m "Bump version to ${mn2sts_VERSION}"
48
+ git tag v${mn2sts_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 mn2sts.jar
23
+ run: |
24
+ rm -f bin/mn2sts.jar
25
+ rake bin/mn2sts.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
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -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
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mn2sts.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/README.adoc ADDED
@@ -0,0 +1,50 @@
1
+ = mn2sts 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/mn2sts-ruby/workflows/ubuntu/badge.svg["Ubuntu Build Status", link="https://github.com/metanorma/mn2sts-ruby/actions?query=workflow%3Aubuntu"]
5
+ image:https://github.com/metanorma/mn2sts-ruby/workflows/macos/badge.svg["OSX Build Status", link="https://github.com/metanorma/mn2sts-ruby/actions?query=workflow%3Amacos"]
6
+ image:https://github.com/metanorma/mn2sts-ruby/workflows/windows/badge.svg["Windows Build Status", link="https://github.com/metanorma/mn2sts-ruby/actions?query=workflow%3Awindows"]
7
+ image:https://codeclimate.com/github/metanorma/mn2sts-ruby/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/mn2sts-ruby"]
8
+ image:https://img.shields.io/github/issues-pr-raw/metanorma/mn2sts-ruby.svg["Pull Requests", link="https://github.com/metanorma/mn2sts-ruby/pulls"]
9
+ image:https://img.shields.io/github/commits-since/metanorma/mn2sts-ruby/latest.svg["Commits since latest",link="https://github.com/metanorma/mn2sts-ruby/releases"]
10
+
11
+ == Purpose
12
+
13
+ The mn2sts Ruby gem is a wrapper around the Java https://github.com/metanorma/mn2sts[mn2sts]
14
+ which converts Metanorma XML files into native PDFs.
15
+
16
+ This gem is used to provide mn2sts.jar with mirrored version numbers, to allow
17
+ Ruby code to easily refer to the desired mn2sts version as dependencies.
18
+
19
+ == Installation
20
+
21
+ [source,ruby]
22
+ ----
23
+ gem install mn2sts
24
+ ----
25
+
26
+ Or include it in your gemspec.
27
+
28
+ == Usage
29
+
30
+ [source,ruby]
31
+ ----
32
+ require 'mn2sts'
33
+ Mn2sts.convert(sample_xml_path, output_pdf_path, sample_xsl_path)
34
+ ----
35
+
36
+ == Updating the gem
37
+
38
+ Update `lib/mn2sts/version.rb` to the desired version of https://github.com/metanorma/mn2sts[mn2sts].
39
+
40
+ Run `rake` to download the `bin/mn2sts.jar` file:
41
+
42
+ [source,ruby]
43
+ ----
44
+ rm -f bin/mn2sts.jar
45
+ rake bin/mn2sts.jar
46
+ ----
47
+
48
+ Then release the gem with `rake release`.
49
+
50
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require_relative 'lib/mn2sts/version'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
8
+
9
+ require 'open-uri'
10
+
11
+ file 'bin/mn2sts.jar' do |file|
12
+ ver = Mn2sts::MN2STS_JAR_VERSION
13
+ url = "https://github.com/metanorma/mn2sts/releases/download/v#{ver}/mn2sts-#{ver}.jar"
14
+ File.open(file.name, 'wb') do |file|
15
+ file.write open(url).read
16
+ end
17
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mn2sts"
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/mn2sts.jar ADDED
Binary file
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/mn2sts.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'open3'
2
+ require 'mn2sts/version'
3
+
4
+ module Mn2sts
5
+ MN2STS_JAR_PATH = File.join(File.dirname(__FILE__), '../bin/mn2sts.jar')
6
+
7
+ def self.help
8
+ cmd = ['java', '-jar', MN2STS_JAR_PATH].join(' ')
9
+ message, error_str, status = Open3.capture3(cmd)
10
+ message
11
+ end
12
+
13
+ def self.version
14
+ cmd = ['java', '-jar', MN2STS_JAR_PATH, '-v'].join(' ')
15
+ message, error_str, status = Open3.capture3(cmd)
16
+ message.strip
17
+ end
18
+
19
+ def self.convert(url_path, output_path, xsl_stylesheet)
20
+ return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
21
+
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(' ')
26
+
27
+ puts cmd
28
+ _, error_str, status = Open3.capture3(cmd)
29
+
30
+ unless status.success?
31
+ raise error_str
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,4 @@
1
+ module Mn2sts
2
+ MN2STS_JAR_VERSION = '1.0'
3
+ VERSION = "#{MN2STS_JAR_VERSION}.1"
4
+ end
data/mn2sts.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/mn2sts/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "mn2sts"
5
+ spec.version = Mn2sts::VERSION
6
+ spec.authors = ["Ribose Inc."]
7
+ spec.email = ["open.source@ribose.com"]
8
+
9
+ spec.summary = "mn2sts converts Metanorma XML into NISO STS XML."
10
+ spec.description = <<~DESCRIPTION
11
+ mn2sts converts Metanorma XML into NISO STS XML.
12
+ This gem is a wrapper around mn2sts.jar available from
13
+ https://github.com/metanorma/mn2sts, with versions matching the JAR file.
14
+ DESCRIPTION
15
+
16
+ spec.homepage = "https://github.com/metanorma/mn2sts-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: mn2sts
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-05-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ mn2sts converts Metanorma XML into NISO STS XML.
15
+ This gem is a wrapper around mn2sts.jar available from
16
+ https://github.com/metanorma/mn2sts, 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/mn2sts.jar
36
+ - bin/setup
37
+ - lib/mn2sts.rb
38
+ - lib/mn2sts/version.rb
39
+ - mn2sts.gemspec
40
+ homepage: https://github.com/metanorma/mn2sts-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: mn2sts converts Metanorma XML into NISO STS XML.
63
+ test_files: []