kramdown-plantuml 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/codecov.yml +2 -0
  3. data/.github/dependabot.yml +23 -0
  4. data/.github/mergify.yml +22 -0
  5. data/.github/scripts/amend.sh +176 -0
  6. data/.github/scripts/build-gem.sh +6 -0
  7. data/.github/scripts/inspect-gem.sh +72 -0
  8. data/.github/scripts/publish-gem.sh +121 -0
  9. data/.github/scripts/test-gem.sh +170 -0
  10. data/.github/scripts/variables.sh +72 -0
  11. data/.github/workflows/amend.yml +19 -0
  12. data/.github/workflows/no-java.yml +22 -0
  13. data/.github/workflows/no-plantuml.yml +23 -0
  14. data/.github/workflows/ruby.yml +176 -0
  15. data/.github/workflows/shell.yml +11 -0
  16. data/.gitignore +19 -0
  17. data/.rspec +1 -0
  18. data/.rubocop.yml +18 -0
  19. data/CODE_OF_CONDUCT.md +131 -0
  20. data/Gemfile +8 -0
  21. data/GitVersion.yml +5 -0
  22. data/LICENSE +201 -0
  23. data/README.md +208 -0
  24. data/Rakefile +40 -0
  25. data/bin/net/sourceforge/plantuml/plantuml/1.2021.8/plantuml-1.2021.8.jar +0 -0
  26. data/kramdown-plantuml.gemspec +48 -0
  27. data/lib/kramdown-plantuml.rb +5 -0
  28. data/lib/kramdown-plantuml/bool_env.rb +24 -0
  29. data/lib/kramdown-plantuml/console_logger.rb +56 -0
  30. data/lib/kramdown-plantuml/converter.rb +42 -0
  31. data/lib/kramdown-plantuml/executor.rb +48 -0
  32. data/lib/kramdown-plantuml/hash.rb +14 -0
  33. data/lib/kramdown-plantuml/logger.rb +68 -0
  34. data/lib/kramdown-plantuml/plantuml_error.rb +33 -0
  35. data/lib/kramdown-plantuml/plantuml_result.rb +49 -0
  36. data/lib/kramdown-plantuml/themer.rb +50 -0
  37. data/lib/kramdown-plantuml/version.rb +7 -0
  38. data/lib/kramdown_html.rb +27 -0
  39. data/lib/which.rb +15 -0
  40. data/pom.xml +16 -0
  41. metadata +148 -10
@@ -0,0 +1,72 @@
1
+ #!/bin/bash
2
+ set -o errexit # Abort if any command fails
3
+ me=$(basename "$0")
4
+
5
+ help_message="\
6
+ Usage: echo $me <version>
7
+ Generates variables based on the provided environment variable GITHUB_CONTEXT
8
+ and <version> argument.
9
+ GITHUB_CONTEXT: An environment variable containing a JSON string of the GitHub
10
+ context object. Typically generated with \${{ toJson(github) }}.
11
+ <version>: The version number corresponding to the current Git commit."
12
+
13
+ initialize() {
14
+ github_context_json="$GITHUB_CONTEXT"
15
+ version="$1"
16
+
17
+ if [[ -z "$github_context_json" ]]; then
18
+ echo "Missing or empty GITHUB_CONTEXT environment variable." >&2
19
+ echo "$help_message"
20
+ exit 1
21
+ fi
22
+
23
+ if [[ -z "$version" ]]; then
24
+ echo "No version specified." >&2
25
+ echo "$help_message"
26
+ exit 1
27
+ fi
28
+
29
+ sha=$(echo "$github_context_json" | jq --raw-output .sha)
30
+ ref=$(echo "$github_context_json" | jq --raw-output .ref)
31
+
32
+ if [[ -z "$sha" ]]; then
33
+ echo "No 'sha' found in the GitHub context." >&2
34
+ echo "$help_message"
35
+ exit 1
36
+ fi
37
+
38
+ if [[ -z "$ref" ]]; then
39
+ echo "No 'ref' found in the GitHub context." >&2
40
+ echo "$help_message"
41
+ exit 1
42
+ fi
43
+ }
44
+
45
+ generate_variables() {
46
+ # Replace '+'' in the version number with '.'.
47
+ version="${version//+/.}"
48
+ # Replace '-' in the version number with '.'.
49
+ version="${version//-/.}"
50
+
51
+ if [[ "$ref" == refs/tags/* ]]; then
52
+ # Override GitVersion's version on tags, just to be sure.
53
+ version="${ref#refs/tags/}"
54
+ fi
55
+
56
+ # Convert the version number to all-lowercase because GPR only supports lowercase version numbers.
57
+ version=$(echo "$version" | tr '[:upper:]' '[:lower:]')
58
+
59
+ echo "Ref: $ref"
60
+ echo "Sha: $sha"
61
+ echo "Version: $version"
62
+ echo "::set-output name=ref::$ref"
63
+ echo "::set-output name=sha::$sha"
64
+ echo "::set-output name=version::$version"
65
+ }
66
+
67
+ main() {
68
+ initialize "$@"
69
+ generate_variables
70
+ }
71
+
72
+ main "$@"
@@ -0,0 +1,19 @@
1
+ name: amend
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+
7
+ jobs:
8
+ amend:
9
+ if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/amend')
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ with:
14
+ persist-credentials: false
15
+ - name: amend
16
+ env:
17
+ GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
18
+ GITHUB_CONTEXT: ${{ toJSON(github) }}
19
+ run: .github/scripts/amend.sh --user payex-dev --verbose
@@ -0,0 +1,22 @@
1
+ name: No Java
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ container:
13
+ image: ruby:2.7.2
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Bundle install
19
+ run: bundle install --jobs 4 --retry 3
20
+
21
+ - name: RSpec
22
+ run: bundle exec rspec --tag no_java
@@ -0,0 +1,23 @@
1
+ name: No PlantUML
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+
16
+ - name: Set up Ruby 2.7
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.7
20
+ bundler-cache: true
21
+
22
+ - name: RSpec
23
+ run: bundle exec rspec --tag no_plantuml
@@ -0,0 +1,176 @@
1
+ name: Ruby Gem
2
+
3
+ on: [push, pull_request, pull_request_target]
4
+
5
+ jobs:
6
+ version:
7
+ runs-on: ubuntu-latest
8
+
9
+ outputs:
10
+ version: ${{ steps.variables.outputs.version }}
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ with:
15
+ fetch-depth: 0
16
+
17
+ - name: Setup GitVersion
18
+ uses: gittools/actions/gitversion/setup@v0.9.10
19
+ with:
20
+ versionSpec: '5.x.x'
21
+
22
+ - name: Execute GitVersion
23
+ id: gitversion
24
+ uses: gittools/actions/gitversion/execute@v0.9.10
25
+
26
+ - name: Create variables
27
+ id: variables
28
+ env:
29
+ GITHUB_CONTEXT: ${{ toJson(github) }}
30
+ run: ./.github/scripts/variables.sh ${{ steps.gitversion.outputs.fullSemVer }}
31
+
32
+ plantuml:
33
+ needs: version
34
+ runs-on: ubuntu-latest
35
+
36
+ steps:
37
+ - uses: actions/checkout@v2
38
+
39
+ - name: Setup Java
40
+ uses: actions/setup-java@v2
41
+ with:
42
+ distribution: adopt
43
+ java-version: 14
44
+
45
+ - name: Cache Maven dependencies
46
+ uses: actions/cache@v2.1.6
47
+ with:
48
+ path: ~/.m2/repository
49
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
50
+ restore-keys: ${{ runner.os }}-maven-
51
+
52
+ - name: Version stamp
53
+ run: mvn versions:set -DnewVersion=${{ needs.version.outputs.version }}
54
+
55
+ - name: Maven install
56
+ run: mvn install
57
+
58
+ - name: Upload plantuml.jar artifact
59
+ uses: actions/upload-artifact@v2
60
+ with:
61
+ name: plantuml.jar
62
+ path: ~/.m2/repository/**/plantuml*.jar
63
+
64
+ gem:
65
+ needs: [version, plantuml]
66
+ runs-on: ubuntu-latest
67
+
68
+ outputs:
69
+ name: ${{ steps.gem.outputs.name }}
70
+
71
+ steps:
72
+ - uses: actions/checkout@v2
73
+
74
+ - uses: actions/download-artifact@v2
75
+ with:
76
+ name: plantuml.jar
77
+ path: bin/
78
+
79
+ - name: Version stamp
80
+ run: sed -i -e 's/0.0.1.dev/${{ needs.version.outputs.version }}/g' ${{ github.workspace }}/lib/kramdown-plantuml/version.rb
81
+
82
+ - name: Setup Ruby 2.7
83
+ uses: ruby/setup-ruby@v1
84
+ with:
85
+ ruby-version: 2.7
86
+ bundler-cache: true
87
+
88
+ - name: Setup Graphviz
89
+ uses: kamiazya/setup-graphviz@v1
90
+
91
+ - name: rubocop
92
+ run: bundle exec rubocop --fail-level warning --display-only-fail-level-offenses
93
+
94
+ - name: Test with Rake
95
+ run: bundle exec rake
96
+
97
+ - name: RSPec (debug)
98
+ env:
99
+ DEBUG: 1
100
+ run: bundle exec rspec --tag debug
101
+
102
+ - name: Codecov upload
103
+ run: bundle exec rake codecov:upload || echo 'Codecov upload failed'
104
+
105
+ - name: Build gem
106
+ id: gem
107
+ run: .github/scripts/build-gem.sh
108
+
109
+ - name: Upload gem
110
+ uses: actions/upload-artifact@v2-preview
111
+ with:
112
+ name: ${{ steps.gem.outputs.name }}
113
+ path: ${{ steps.gem.outputs.name }}
114
+
115
+ - name: Inspect gem
116
+ run: .github/scripts/inspect-gem.sh --gem "${{ github.workspace }}/${{ steps.gem.outputs.name }}" --verbose
117
+
118
+ - name: Test gem
119
+ run: .github/scripts/test-gem.sh --workdir "${{ github.workspace }}/spec/fixture" --gemdir "${{ github.workspace }}" --verbose
120
+
121
+ publish-dev:
122
+ needs: [version, gem]
123
+ runs-on: ubuntu-latest
124
+ if: |
125
+ (github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]') ||
126
+ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]')
127
+
128
+ steps:
129
+ - uses: actions/checkout@v2
130
+ if: ${{ github.event_name != 'pull_request_target' }}
131
+
132
+ - uses: actions/checkout@v2
133
+ if: ${{ github.event_name == 'pull_request_target' }}
134
+ with:
135
+ ref: ${{ github.event.pull_request.head.sha }}
136
+
137
+ - uses: actions/download-artifact@v2
138
+ with:
139
+ name: ${{ needs.gem.outputs.name }}
140
+
141
+ - name: Set up Ruby 2.7
142
+ uses: ruby/setup-ruby@v1
143
+ with:
144
+ ruby-version: 2.7
145
+ bundler-cache: true
146
+
147
+ - name: Setup Graphviz
148
+ uses: kamiazya/setup-graphviz@v1
149
+
150
+ - name: Publish to GPR
151
+ run: .github/scripts/publish-gem.sh --gem ${{ needs.gem.outputs.name }} --token "${{ secrets.GPR_TOKEN }}" --owner SwedbankPay --verbose
152
+
153
+ - name: Test gem
154
+ run: .github/scripts/test-gem.sh --workdir "${{ github.workspace }}/spec/fixture" --version ${{ needs.version.outputs.version }} --token "${{ secrets.GPR_TOKEN }}" --verbose
155
+
156
+ - name: Upload Jekyll site
157
+ uses: actions/upload-artifact@v2-preview
158
+ if: always()
159
+ with:
160
+ name: site
161
+ path: ${{ github.workspace }}/spec/fixture/_site
162
+
163
+ publish-prod:
164
+ needs: [version, gem]
165
+ runs-on: ubuntu-latest
166
+ if: startsWith(github.ref, 'refs/tags/') # Only publish tagged commits
167
+
168
+ steps:
169
+ - uses: actions/checkout@v2
170
+
171
+ - uses: actions/download-artifact@v2
172
+ with:
173
+ name: ${{ needs.gem.outputs.name }}
174
+
175
+ - name: Publish to RubyGems
176
+ run: .github/scripts/publish-gem.sh --gem ${{ needs.gem.outputs.name }} --token ${{ secrets.RUBYGEMS_API_KEY }} --verbose
@@ -0,0 +1,11 @@
1
+ name: Shell
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ shellcheck:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - name: ShellCheck
11
+ uses: bewuethr/shellcheck-action@v2
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
10
+ Gemfile.lock
11
+ /target/
12
+ *.jar
13
+ /bin/
14
+ .jekyll-cache
15
+ _site
16
+ .classpath
17
+ .project
18
+ .settings
19
+ .vscode
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ NewCops: enable
4
+ Exclude:
5
+ - "Rakefile"
6
+ - "_site/**/*.rb"
7
+ - "spec/**/*.rb"
8
+ - "vendor/**/.*"
9
+ - "vendor/**/*"
10
+ Layout:
11
+ LineLength: 100
12
+ IndentationStyle:
13
+ IndentationWidth: 2
14
+ Metrics/MethodLength:
15
+ Max: 20
16
+ Naming/FileName:
17
+ Exclude:
18
+ - 'lib/kramdown-plantuml.rb'
@@ -0,0 +1,131 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [opensource@swedbankpay.com][contact].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at [contributor-covenant.org][concov20].
119
+
120
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
121
+ enforcement ladder][mozilla-cocel].
122
+
123
+ For answers to common questions about this code of conduct, see the [FAQ][faq].
124
+ [Translations are available][translations].
125
+
126
+ [concov20]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
127
+ [contact]: mailto:opensource@swedbankpay.com
128
+ [faq]: https://www.contributor-covenant.org/faq
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [mozilla-cocel]: https://github.com/mozilla/diversity
131
+ [translations]: https://www.contributor-covenant.org/translations