kramdown-plantuml 1.0.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/codecov.yml +2 -0
- data/.github/dependabot.yml +23 -0
- data/.github/mergify.yml +22 -0
- data/.github/scripts/amend.sh +176 -0
- data/.github/scripts/build-gem.sh +6 -0
- data/.github/scripts/inspect-gem.sh +72 -0
- data/.github/scripts/publish-gem.sh +121 -0
- data/.github/scripts/test-gem.sh +170 -0
- data/.github/scripts/variables.sh +72 -0
- data/.github/workflows/amend.yml +19 -0
- data/.github/workflows/no-java.yml +3 -6
- data/.github/workflows/no-plantuml.yml +6 -9
- data/.github/workflows/ruby.yml +139 -86
- data/.github/workflows/shell.yml +11 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +18 -0
- data/CODE_OF_CONDUCT.md +11 -9
- data/Gemfile +4 -8
- data/GitVersion.yml +5 -0
- data/LICENSE +201 -21
- data/README.md +143 -35
- data/Rakefile +33 -3
- data/bin/{plantuml.1.2020.5.jar → net/sourceforge/plantuml/plantuml/1.2021.8/plantuml-1.2021.8.jar} +0 -0
- data/kramdown-plantuml.gemspec +32 -17
- data/lib/kramdown-plantuml.rb +4 -6
- data/lib/kramdown-plantuml/bool_env.rb +24 -0
- data/lib/kramdown-plantuml/console_logger.rb +56 -0
- data/lib/kramdown-plantuml/converter.rb +39 -21
- data/lib/kramdown-plantuml/executor.rb +48 -0
- data/lib/kramdown-plantuml/hash.rb +14 -0
- data/lib/kramdown-plantuml/logger.rb +77 -0
- data/lib/kramdown-plantuml/plantuml_error.rb +33 -0
- data/lib/kramdown-plantuml/plantuml_result.rb +50 -0
- data/lib/kramdown-plantuml/themer.rb +64 -0
- data/lib/kramdown-plantuml/version.rb +3 -2
- data/lib/kramdown_html.rb +21 -9
- data/lib/which.rb +3 -0
- data/pom.xml +16 -0
- metadata +131 -12
- data/bin/console +0 -14
- data/bin/setup +0 -8
@@ -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
|
@@ -8,18 +8,15 @@ on:
|
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
test:
|
11
|
-
name: No Java
|
12
11
|
runs-on: ubuntu-latest
|
13
12
|
container:
|
14
|
-
image: ruby:2.7.
|
13
|
+
image: ruby:2.7.2
|
15
14
|
|
16
15
|
steps:
|
17
16
|
- uses: actions/checkout@v2
|
18
17
|
|
19
18
|
- name: Bundle install
|
20
|
-
run:
|
21
|
-
find .
|
22
|
-
bundle install --jobs 4 --retry 3
|
19
|
+
run: bundle install --jobs 4 --retry 3
|
23
20
|
|
24
|
-
- name:
|
21
|
+
- name: RSpec
|
25
22
|
run: bundle exec rspec --tag no_java
|
@@ -8,19 +8,16 @@ on:
|
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
test:
|
11
|
-
name: No PlantUML
|
12
11
|
runs-on: ubuntu-latest
|
13
|
-
container:
|
14
|
-
image: ruby:2.7.0-alpine3.11
|
15
12
|
|
16
13
|
steps:
|
17
14
|
- uses: actions/checkout@v2
|
18
15
|
|
19
|
-
- name:
|
20
|
-
|
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
21
|
|
22
|
-
- name:
|
23
|
-
run: rm bin/plantuml.1.2020.5.jar
|
24
|
-
|
25
|
-
- name: Test with Rake
|
22
|
+
- name: RSpec
|
26
23
|
run: bundle exec rspec --tag no_plantuml
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,123 +1,176 @@
|
|
1
1
|
name: Ruby Gem
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- '*'
|
7
|
-
tags:
|
8
|
-
- '*'
|
9
|
-
pull_request:
|
3
|
+
on: [push, pull_request, pull_request_target]
|
10
4
|
|
11
5
|
jobs:
|
12
|
-
|
13
|
-
name: Build, Test and Publish Ruby Gem
|
6
|
+
version:
|
14
7
|
runs-on: ubuntu-latest
|
15
8
|
|
9
|
+
outputs:
|
10
|
+
version: ${{ steps.variables.outputs.version }}
|
11
|
+
|
16
12
|
steps:
|
17
13
|
- uses: actions/checkout@v2
|
18
14
|
with:
|
19
15
|
fetch-depth: 0
|
20
16
|
|
21
|
-
- name:
|
22
|
-
|
23
|
-
git fetch --prune --tags
|
24
|
-
echo "REF: ${{ github.ref }}"
|
25
|
-
|
26
|
-
- name: Install GitVersion
|
27
|
-
uses: gittools/actions/gitversion/setup@v0.9.2
|
28
|
-
if: startsWith(github.ref, 'refs/tags/') != true # Only use GitVersion for unstable builds
|
17
|
+
- name: Setup GitVersion
|
18
|
+
uses: gittools/actions/gitversion/setup@v0.9.10
|
29
19
|
with:
|
30
|
-
versionSpec: '5.
|
20
|
+
versionSpec: '5.x.x'
|
31
21
|
|
32
22
|
- name: Execute GitVersion
|
33
23
|
id: gitversion
|
34
|
-
|
35
|
-
|
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
|
36
38
|
|
37
|
-
- name:
|
38
|
-
|
39
|
-
uses: actions/github-script@0.9.0
|
39
|
+
- name: Setup Java
|
40
|
+
uses: actions/setup-java@v2
|
40
41
|
with:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if (ref.startsWith(tagPrefix)) {
|
48
|
-
// If a tag ref is being built, just return the tag verbatim
|
49
|
-
return ref.substring(tagPrefix.length);
|
50
|
-
}
|
51
|
-
|
52
|
-
const escapedBranchName = '${{ steps.gitversion.outputs.escapedBranchName }}';
|
53
|
-
const commitsSinceVersionSource = '${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}';
|
54
|
-
const preReleaseLabel = escapedBranchName + '.' + commitsSinceVersionSource;
|
55
|
-
const majorMinorPatch = '${{ steps.gitversion.outputs.majorMinorPatch }}';
|
56
|
-
return majorMinorPatch + preReleaseLabel;
|
57
|
-
})();
|
58
|
-
|
59
|
-
core.debug('Gem version: ' + gemVersion);
|
60
|
-
core.setOutput('version', gemVersion);
|
61
|
-
|
62
|
-
- name: Set up Ruby 2.6
|
63
|
-
uses: actions/setup-ruby@v1
|
42
|
+
distribution: adopt
|
43
|
+
java-version: 14
|
44
|
+
|
45
|
+
- name: Cache Maven dependencies
|
46
|
+
uses: actions/cache@v2.1.6
|
64
47
|
with:
|
65
|
-
|
48
|
+
path: ~/.m2/repository
|
49
|
+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
50
|
+
restore-keys: ${{ runner.os }}-maven-
|
66
51
|
|
67
|
-
- name:
|
68
|
-
|
52
|
+
- name: Version stamp
|
53
|
+
run: mvn versions:set -DnewVersion=${{ needs.version.outputs.version }}
|
69
54
|
|
70
|
-
- name:
|
71
|
-
|
55
|
+
- name: Maven install
|
56
|
+
run: mvn install
|
57
|
+
|
58
|
+
- name: Upload plantuml.jar artifact
|
59
|
+
uses: actions/upload-artifact@v2
|
72
60
|
with:
|
73
|
-
|
74
|
-
|
75
|
-
|
61
|
+
name: plantuml.jar
|
62
|
+
path: ~/.m2/repository/**/plantuml*.jar
|
63
|
+
|
64
|
+
gem:
|
65
|
+
needs: [version, plantuml]
|
66
|
+
runs-on: ubuntu-latest
|
76
67
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
82
93
|
|
83
94
|
- name: Test with Rake
|
84
|
-
env:
|
85
|
-
GEM_VERSION: ${{ steps.gemversion.outputs.version }}
|
86
95
|
run: bundle exec rake
|
87
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
|
+
|
88
105
|
- name: Build gem
|
89
106
|
id: gem
|
90
|
-
|
91
|
-
GEM_VERSION: ${{ steps.gemversion.outputs.version }}
|
92
|
-
run: |
|
93
|
-
GEM_BUILD_NAME=$(gem build kramdown-plantuml.gemspec | awk '/File/ {print $2}')
|
94
|
-
echo "Gem filename: '${GEM_BUILD_NAME}'"
|
95
|
-
echo "::set-output name=name::${GEM_BUILD_NAME}"
|
107
|
+
run: .github/scripts/build-gem.sh
|
96
108
|
|
97
|
-
- name: Upload
|
109
|
+
- name: Upload gem
|
98
110
|
uses: actions/upload-artifact@v2-preview
|
99
111
|
with:
|
100
112
|
name: ${{ steps.gem.outputs.name }}
|
101
113
|
path: ${{ steps.gem.outputs.name }}
|
102
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
|
+
|
103
150
|
- name: Publish to GPR
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
run:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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 }}
|
113
174
|
|
114
175
|
- name: Publish to RubyGems
|
115
|
-
|
116
|
-
env:
|
117
|
-
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
118
|
-
run: |
|
119
|
-
mkdir -p $HOME/.gem
|
120
|
-
touch $HOME/.gem/credentials
|
121
|
-
chmod 0600 $HOME/.gem/credentials
|
122
|
-
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
|
123
|
-
gem push ${{ steps.gem.outputs.name }}
|
176
|
+
run: .github/scripts/publish-gem.sh --gem ${{ needs.gem.outputs.name }} --token ${{ secrets.RUBYGEMS_API_KEY }} --verbose
|
data/.gitignore
CHANGED
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'
|