kramdown-plantuml 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df85b61ecd8a5b15d5288e03f95f70064926f71f144d245dfe693ea36e190d7b
4
- data.tar.gz: 88de76e1cf968e5365b1af85bc0266b3de41ff58c131583771b7d63b61f93544
3
+ metadata.gz: 71464ee363c4a9b9859ffd72421d6840d1f26018a0fdc20eaae4fa4f17011f26
4
+ data.tar.gz: f4cde15688ebcc236bfd2e3f5458c8d62722b8ff4fdac2767682f32643839013
5
5
  SHA512:
6
- metadata.gz: 3f13d2f50b9cfeb43e221654345a2d882eb1c310611f1f7f4f2ebac94214d17aa7d95e1b6bd8133419fdf722a72f1bf87249ac91bc239650f32a371520a42845
7
- data.tar.gz: 4b3d5fd4af58e295265e7af2577d0ee9993b98258f95f6919ae1f648e5e8a7e5b31b648b94736c027ac338ee59b545717cc72d78d0f5da77669abd311215668e
6
+ metadata.gz: ed9a469ba9ec78c8d498fab3cb412220466d76344aadceea56d89634f8f2b25523bc10566a023ecdd7e3a8fa7373a0c49d2677e5ceb6058206e913ffd5cb3a7b
7
+ data.tar.gz: 5d969b52c7cf030910cc6ffe6d0c85c7492487c421de35a40e9f6ca965bf35420761ca4be1540eba53eecb339154a94e212815525bd18529d96e3236b9949efb
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -o errexit # Abort if any command fails
3
+
4
+ gem_build_name=$(gem build kramdown-plantuml.gemspec | awk '/File/ {print $2}')
5
+ echo "Gem filename: '${gem_build_name}'"
6
+ echo "::set-output name=name::${gem_build_name}"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -o errexit # Abort if any command fails
3
+
4
+ gem install bundler
5
+ bundle config path vendor/bundle
6
+ bundle install --jobs 4 --retry 3
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+ set -e # Abort if any command fails
3
+ me=$(basename "$0")
4
+
5
+ help_message="\
6
+ Usage:
7
+ $me --gem <gem> [--verbose]
8
+ $me --help
9
+ Arguments:
10
+ -g, --gem <gem> The path to the Gem file to inspect.
11
+ -h, --help Displays this help screen.
12
+ -v, --verbose Increase verbosity. Useful for debugging."
13
+
14
+ parse_args() {
15
+ while : ; do
16
+ if [[ $1 = "-h" || $1 = "--help" ]]; then
17
+ echo "$help_message"
18
+ return 0
19
+ elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
20
+ verbose=true
21
+ shift
22
+ elif [[ $1 = "-g" || $1 = "--gem" ]]; then
23
+ gem=$2
24
+ shift 2
25
+ else
26
+ break
27
+ fi
28
+ done
29
+
30
+ if [[ -z "$gem" ]]; then
31
+ echo "Missing required argument: --gem <gem>."
32
+ echo "$help_message"
33
+ return 1
34
+ fi
35
+ }
36
+
37
+ # Echo expanded commands as they are executed (for debugging)
38
+ enable_expanded_output() {
39
+ if [ $verbose ]; then
40
+ echo "Verbose mode enabled."
41
+ set -o xtrace
42
+ set +o verbose
43
+ fi
44
+ }
45
+
46
+ inspect_gem() {
47
+ gem unpack "$gem"
48
+ gem_dir="${gem%.*}"
49
+
50
+ if [ $verbose ]; then
51
+ echo "Files in '$gem_dir':"
52
+ find "$gem_dir"
53
+ fi
54
+
55
+ if [[ ! -d "$gem_dir/bin" ]]; then
56
+ echo "ERROR! 'bin' folder missing from '$gem'."
57
+ return 1
58
+ fi
59
+
60
+ if ! (find "$gem_dir" -iname "plantuml*.jar" | grep -q .); then
61
+ echo "ERROR! 'plantuml.jar' missing from '$gem'."
62
+ return 1
63
+ fi
64
+ }
65
+
66
+ main() {
67
+ parse_args "$@"
68
+ enable_expanded_output
69
+ inspect_gem
70
+ }
71
+
72
+ main "$@"
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env bash
2
+ set -e # Abort if any command fails
3
+
4
+ me=$(basename "$0")
5
+
6
+ help_message="\
7
+ Usage:
8
+ $me --gem <gem-path> --token <token> [--owner <owner>] [--verbose]
9
+ $me --help
10
+ Arguments:
11
+ -g, --gem <gem-path> The path of the Gem to publish.
12
+ -t, --token <token> The access token to use for publishing the gem to
13
+ the specified registry.
14
+ -o, --owner <owner> The owner to use when publishing to the GitHub
15
+ Package Registry. If empty, will publish to
16
+ RubyGems.org.
17
+ -h, --help Displays this help screen.
18
+ -v, --verbose Increase verbosity. Useful for debugging."
19
+
20
+ parse_args() {
21
+ while : ; do
22
+ if [[ $1 = "-h" || $1 = "--help" ]]; then
23
+ echo "$help_message"
24
+ return 0
25
+ elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
26
+ verbose=true
27
+ shift
28
+ elif [[ $1 = "-g" || $1 = "--gem" ]]; then
29
+ gem=$2
30
+ shift 2
31
+ elif [[ $1 = "-t" || $1 = "--token" ]]; then
32
+ token=$2
33
+ shift 2
34
+ elif [[ $1 = "-o" || $1 = "--owner" ]]; then
35
+ owner=$2
36
+ shift 2
37
+ else
38
+ break
39
+ fi
40
+ done
41
+
42
+ if [[ -z "$gem" ]]; then
43
+ echo "Missing required argument: --gem <gem>."
44
+ echo "$help_message"
45
+ return 1
46
+ fi
47
+
48
+ if [[ -z "$token" ]]; then
49
+ echo "Missing required argument: --token <token>."
50
+ echo "$help_message"
51
+ return 1
52
+ fi
53
+ }
54
+
55
+ # Echo expanded commands as they are executed (for debugging)
56
+ enable_expanded_output() {
57
+ if [ $verbose ]; then
58
+ set -o xtrace
59
+ set +o verbose
60
+ fi
61
+ }
62
+
63
+ publish_gem() {
64
+ gem_home="$HOME/.gem"
65
+ credentials_file="$gem_home/credentials"
66
+
67
+ if [[ -n "$owner" ]]; then
68
+ auth_header="github: Bearer"
69
+ host="https://rubygems.pkg.github.com/$owner"
70
+ else
71
+ auth_header="rubygems_api_key:"
72
+ fi
73
+
74
+ mkdir -p "$gem_home"
75
+ touch "$credentials_file"
76
+ chmod 0600 "$credentials_file"
77
+ printf -- "---\n:%s %s\n" "$auth_header" "$token" > "$credentials_file"
78
+
79
+ if [[ -n "$host" ]]; then
80
+ if ! result=$(gem push --KEY github --host "$host" "$gem"); then
81
+ echo "ERROR: gem push failed."
82
+
83
+ if [[ $result == *"has already been pushed"* ]]; then
84
+ echo "ERROR: $gem has already been pushed."
85
+ # Silently ignore 'already been pushed' Gem errors.
86
+ return 0
87
+ else
88
+ echo "$result"
89
+ return 1
90
+ fi
91
+ fi
92
+ else
93
+ gem push "$gem"
94
+ fi
95
+ }
96
+
97
+ main() {
98
+ parse_args "$@"
99
+ enable_expanded_output
100
+ publish_gem
101
+ }
102
+
103
+ main "$@"
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env bash
2
+ set -o errexit # Abort if any command fails
3
+ me=$(basename "$0")
4
+
5
+ help_message="\
6
+ Usage:
7
+ $me --workdir <workdir> [--gemdir <gemdir> | --version <version> --token <token>] [--verbose]
8
+ $me --help
9
+ Arguments:
10
+ -w, --workdir <workdir> The path to the working directory.
11
+ -g, --gemdir <gemdir> The path to directory of the Gem file to test.
12
+ -v, --version <version> The version of the Gem to test.
13
+ -t, --token <token> The GitHub token to use for retrieving the gem
14
+ from the GitHub Package Registry.
15
+ -h, --help Displays this help screen.
16
+ -v, --verbose Increase verbosity. Useful for debugging."
17
+
18
+ parse_args() {
19
+ while : ; do
20
+ if [[ $1 = "-h" || $1 = "--help" ]]; then
21
+ echo "$help_message"
22
+ return 0
23
+ elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
24
+ verbose=true
25
+ shift
26
+ elif [[ $1 = "-g" || $1 = "--gemdir" ]]; then
27
+ gemdir=$2
28
+ shift 2
29
+ elif [[ $1 = "-v" || $1 = "--version" ]]; then
30
+ version=$2
31
+ shift 2
32
+ elif [[ $1 = "-t" || $1 = "--token" ]]; then
33
+ token=$2
34
+ shift 2
35
+ elif [[ $1 = "-w" || $1 = "--workdir" ]]; then
36
+ workdir=$2
37
+ shift 2
38
+ else
39
+ break
40
+ fi
41
+ done
42
+
43
+ if [[ -z "$workdir" ]]; then
44
+ echo "Missing required argument: --workdir <workdir>."
45
+ echo "$help_message"
46
+ return 1
47
+ fi
48
+
49
+ if [[ (-z "$gemdir" && -z "$token") || (-n "$gemdir" && -n "$token") ]]; then
50
+ echo "Missing or invalid required arguments: --gemdir <gem-path> or --token <token>."
51
+ echo "Either [--gemdir] or [--token] needs to be provided, but not both."
52
+ echo "$help_message"
53
+ return 1
54
+ fi
55
+
56
+ if [[ (-n "$version" && -z "$token") || (-z "$version" && -n "$token") ]]; then
57
+ echo "Missing or invalid required arguments: --version <gem-path> and --token <token>."
58
+ echo "When either argument is present, both must be."
59
+ echo "$help_message"
60
+ return 1
61
+ fi
62
+ }
63
+
64
+ # Echo expanded commands as they are executed (for debugging)
65
+ enable_expanded_output() {
66
+ if [ $verbose ]; then
67
+ set -o xtrace
68
+ set +o verbose
69
+ fi
70
+ }
71
+
72
+ test_gem() {
73
+ cd "$workdir"
74
+
75
+ gem install bundler
76
+
77
+ if [[ -n "$token" ]]; then
78
+ # A non-empty $token means we should install the Gem from GPR
79
+ repository="https://rubygems.pkg.github.com/swedbankpay"
80
+ bundle config "$repository" "SwedbankPay:$token"
81
+ printf "source '%s' do\n\tgem 'kramdown-plantuml', '%s'\nend" "$repository" "$version" >> Gemfile
82
+ else
83
+ echo "gem 'kramdown-plantuml', path: '$gemdir'" >> Gemfile
84
+ fi
85
+
86
+ if [[ $verbose ]]; then
87
+ cat Gemfile
88
+ fi
89
+
90
+ bundle install
91
+ bundle exec jekyll build
92
+
93
+ file="$workdir/_site/index.html"
94
+
95
+ file_contains "$file" "class=\"plantuml\""
96
+ file_contains "$file" "<svg"
97
+ file_contains "$file" "<ellipse"
98
+ file_contains "$file" "<polygon"
99
+ file_contains "$file" "<path"
100
+ }
101
+
102
+ file_contains() {
103
+ file=$1
104
+ contents=$2
105
+
106
+ if [[ -z "$file" ]]; then
107
+ echo "file_contains missing required argument <file>."
108
+ return 1
109
+ fi
110
+
111
+ if [[ -z "$contents" ]]; then
112
+ echo "file_contains missing required argument <contents>."
113
+ return 1
114
+ fi
115
+
116
+ if [[ ! -f "$file" ]]; then
117
+ echo "file_contains <file> not found: '$file'."
118
+ return 1
119
+ fi
120
+
121
+ if grep --quiet --fixed-strings "$contents" "$file"; then
122
+ echo "Success! '$contents' found in '$file'."
123
+ else
124
+ echo "Failed! '$contents' not found in '$file'."
125
+
126
+ if [[ $verbose ]]; then
127
+ cat "$file"
128
+ fi
129
+
130
+ return 1
131
+ fi
132
+ }
133
+
134
+ main() {
135
+ parse_args "$@"
136
+ enable_expanded_output
137
+ test_gem
138
+ }
139
+
140
+ main "$@"
@@ -0,0 +1,70 @@
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 a dot.
47
+ version="${version/+/.}"
48
+
49
+ if [[ "$ref" == refs/tags/* ]]; then
50
+ # Override GitVersion's version on tags, just to be sure.
51
+ version="${ref#refs/tags/}"
52
+ fi
53
+
54
+ # Convert the version number to all-lowercase because GPR only supports lowercase version numbers.
55
+ version=$(echo "$version" | tr '[:upper:]' '[:lower:]')
56
+
57
+ echo "Ref: $ref"
58
+ echo "Sha: $sha"
59
+ echo "Version: $version"
60
+ echo "::set-output name=ref::$ref"
61
+ echo "::set-output name=sha::$sha"
62
+ echo "::set-output name=version::$version"
63
+ }
64
+
65
+ main() {
66
+ initialize "$@"
67
+ generate_variables
68
+ }
69
+
70
+ main "$@"
@@ -11,15 +11,13 @@ jobs:
11
11
  name: No Java
12
12
  runs-on: ubuntu-latest
13
13
  container:
14
- image: ruby:2.7.0-alpine3.11
14
+ image: ruby:2.7.2
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v2
18
18
 
19
19
  - name: Bundle install
20
- run: |
21
- find .
22
- bundle install --jobs 4 --retry 3
20
+ run: bundle install --jobs 4 --retry 3
23
21
 
24
22
  - name: Test with Rake
25
23
  run: bundle exec rspec --tag no_java
@@ -10,17 +10,17 @@ jobs:
10
10
  test:
11
11
  name: No PlantUML
12
12
  runs-on: ubuntu-latest
13
- container:
14
- image: ruby:2.7.0-alpine3.11
15
13
 
16
14
  steps:
17
15
  - uses: actions/checkout@v2
18
16
 
17
+ - name: Set up Ruby 2.7
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.7.x
21
+
19
22
  - name: Bundle install
20
23
  run: bundle install --jobs 4 --retry 3
21
24
 
22
- - name: Remove plantuml.1.2020.5.jar
23
- run: rm bin/plantuml.1.2020.5.jar
24
-
25
25
  - name: Test with Rake
26
26
  run: bundle exec rspec --tag no_plantuml