metanorma-plugin-plantuml 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7c85595e30e3155c473b4f44936209c3f95c8ab5cf29d55a2368bad6584c136
4
- data.tar.gz: d7e58a9934d9995c9b36c3b86dc543a7c633d0c31fab5dd543707b7f347207c8
3
+ metadata.gz: 93f98be4977dfd92a2a7b7d33a74d1f27bb9f93eb5a55116da04f64650c0a126
4
+ data.tar.gz: cfd9bf9c6d5f3e781047481784fcd7350a69ff87a86148cf41a60edf1ef16cdf
5
5
  SHA512:
6
- metadata.gz: '05039945787b1a1d65f8a37193db39346f2d42ac820dff54d70724fbb09bdbe2808a9ca20477a78e78b1357f65de337c289a075feabf27c9e3ae92264e671865'
7
- data.tar.gz: 1cff1673fbed5b3e00a6e05d7642cccce29e6d5f5d2cd62500860fddf089a8fc7046a2c49df41b422804b03eb762bd0bb6ac21d67e8763e6d38583f29df4e0ed
6
+ metadata.gz: 3a9cbefb6348ff7aacee1c9a2dae7ce0373bd1e015b2b0de184674f9440740e4f04b3a3cf50e7ebf4814b98c10ef0cf91df160974166e6ea04ddf730f8a79888
7
+ data.tar.gz: fdf26284b53c231dcb4cdafed24c400c18d7c323ad7f4c4506219cfa89395d818072d93c67a8714500ce906b426b583a1b4c2c8579dd6ed5f595c6b52753a1fa
@@ -8,7 +8,7 @@ on:
8
8
  # Allow manual triggering
9
9
 
10
10
  jobs:
11
- check-plantuml-version:
11
+ update-plantuml:
12
12
  runs-on: ubuntu-latest
13
13
 
14
14
  steps:
@@ -23,91 +23,73 @@ jobs:
23
23
  ruby-version: '3.1'
24
24
  bundler-cache: true
25
25
 
26
- - name: Get current PlantUML version
27
- id: current-version
26
+ - name: Check for PlantUML updates
27
+ id: update
28
28
  run: |
29
- CURRENT_VERSION=$(ruby -e "require './lib/metanorma/plugin/plantuml/version'; puts Metanorma::Plugin::Plantuml::PLANTUML_JAR_VERSION")
30
- echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
31
-
32
- - name: Get latest PlantUML release
33
- id: latest-version
34
- run: |
35
- LATEST_VERSION=$(curl -s https://api.github.com/repos/plantuml/plantuml/releases/latest | jq -r .tag_name | sed 's/^v//')
36
- echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
37
-
38
- - name: Compare versions
39
- id: compare
40
- run: |
41
- if [ "${{ steps.current-version.outputs.version }}" != "${{ steps.latest-version.outputs.version }}" ]; then
42
- echo "needs_update=true" >> $GITHUB_OUTPUT
43
- echo "Current version: ${{ steps.current-version.outputs.version }}"
44
- echo "Latest version: ${{ steps.latest-version.outputs.version }}"
29
+ # Run the update task and capture exit code
30
+ if rake update_plantuml; then
31
+ echo "update_made=false" >> $GITHUB_OUTPUT
32
+ echo "No update needed - PlantUML is up to date"
45
33
  else
46
- echo "needs_update=false" >> $GITHUB_OUTPUT
47
- echo "PlantUML version is up to date"
48
- fi
49
-
50
- - name: Update version file
51
- if: steps.compare.outputs.needs_update == 'true'
52
- run: |
53
- NEW_VERSION="${{ steps.latest-version.outputs.version }}"
54
- sed -i "s/PLANTUML_JAR_VERSION = \".*\"/PLANTUML_JAR_VERSION = \"$NEW_VERSION\"/" lib/metanorma/plugin/plantuml/version.rb
34
+ EXIT_CODE=$?
35
+ if [ $EXIT_CODE -eq 1 ]; then
36
+ echo "update_made=true" >> $GITHUB_OUTPUT
37
+ echo "Update completed successfully"
55
38
 
56
- - name: Update gem version
57
- if: steps.compare.outputs.needs_update == 'true'
58
- run: |
59
- # Increment patch version using semantic versioning
60
- CURRENT_GEM_VERSION=$(ruby -e "require './lib/metanorma/plugin/plantuml/version'; puts Metanorma::Plugin::Plantuml::VERSION")
61
- NEW_GEM_VERSION=$(ruby -e "
62
- require 'rubygems'
63
- current_version = Gem::Version.new('$CURRENT_GEM_VERSION')
64
- segments = current_version.segments
65
- segments[2] = (segments[2] || 0) + 1
66
- puts segments.join('.')
67
- ")
68
- sed -i "s/VERSION = \".*\"/VERSION = \"$NEW_GEM_VERSION\"/" lib/metanorma/plugin/plantuml/version.rb
69
- echo "Updated gem version from $CURRENT_GEM_VERSION to $NEW_GEM_VERSION"
39
+ # Get version info for PR
40
+ PLANTUML_VERSION=$(ruby -e "load 'lib/metanorma/plugin/plantuml/version.rb'; puts Metanorma::Plugin::Plantuml::PLANTUML_JAR_VERSION")
41
+ GEM_VERSION=$(ruby -e "load 'lib/metanorma/plugin/plantuml/version.rb'; puts Metanorma::Plugin::Plantuml::VERSION")
70
42
 
71
- - name: Remove old JAR and download new one
72
- if: steps.compare.outputs.needs_update == 'true'
73
- run: |
74
- rm -f data/plantuml.jar
75
- bundle exec rake download_jar
76
-
77
- - name: Verify new JAR works
78
- if: steps.compare.outputs.needs_update == 'true'
79
- run: |
80
- if [ -f "data/plantuml.jar" ]; then
81
- echo "PlantUML JAR downloaded successfully"
82
- java -jar data/plantuml.jar -version || echo "Version check completed"
83
- else
84
- echo "Failed to download PlantUML JAR"
85
- exit 1
43
+ echo "plantuml_version=$PLANTUML_VERSION" >> $GITHUB_OUTPUT
44
+ echo "gem_version=$GEM_VERSION" >> $GITHUB_OUTPUT
45
+ else
46
+ echo "❌ Update failed with exit code $EXIT_CODE"
47
+ exit $EXIT_CODE
48
+ fi
86
49
  fi
50
+ env:
51
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87
52
 
88
53
  - name: Create Pull Request
89
- if: steps.compare.outputs.needs_update == 'true'
54
+ if: steps.update.outputs.update_made == 'true'
90
55
  uses: peter-evans/create-pull-request@v5
91
56
  with:
92
57
  token: ${{ secrets.GITHUB_TOKEN }}
93
58
  commit-message: |
94
- Update PlantUML to version ${{ steps.latest-version.outputs.version }}
59
+ Update PlantUML to version ${{ steps.update.outputs.plantuml_version }}
95
60
 
96
- - Updated PLANTUML_JAR_VERSION to ${{ steps.latest-version.outputs.version }}
97
- - Downloaded new PlantUML JAR file
98
- - Incremented gem version
99
- title: "Update PlantUML to version ${{ steps.latest-version.outputs.version }}"
61
+ - Updated PLANTUML_JAR_VERSION to ${{ steps.update.outputs.plantuml_version }}
62
+ - Downloaded and verified new PlantUML JAR file
63
+ - Incremented gem version to ${{ steps.update.outputs.gem_version }}
64
+
65
+ Generated by automated PlantUML update workflow
66
+ title: "Update PlantUML to version ${{ steps.update.outputs.plantuml_version }}"
100
67
  body: |
101
- This PR updates PlantUML to the latest version ${{ steps.latest-version.outputs.version }}.
68
+ This PR updates PlantUML to the latest version **${{ steps.update.outputs.plantuml_version }}**.
69
+
70
+ ## Changes Made
71
+ - ✅ Updated `PLANTUML_JAR_VERSION` to `${{ steps.update.outputs.plantuml_version }}`
72
+ - ✅ Downloaded and verified new PlantUML JAR file
73
+ - ✅ Incremented gem version to `${{ steps.update.outputs.gem_version }}`
74
+ - ✅ Validated JAR functionality with version check and diagram generation
75
+
76
+ ## Automated Validation
77
+ - [x] Found latest valid PlantUML release (excludes pre-releases and native builds)
78
+ - [x] Confirmed semantic version is newer than current
79
+ - [x] JAR file downloads successfully
80
+ - [x] JAR executes and shows correct version
81
+ - [x] JAR can generate test diagrams
102
82
 
103
- Changes:
104
- - Updated `PLANTUML_JAR_VERSION` in `lib/metanorma/plugin/plantuml/version.rb`
105
- - Downloaded new PlantUML JAR to `data/plantuml.jar`
106
- - Incremented gem version
83
+ ---
84
+ *This update was created automatically by the PlantUML version sync workflow using `rake update_plantuml`.*
107
85
 
108
- This update was created automatically by the PlantUML version sync workflow.
109
- branch: update-plantuml-${{ steps.latest-version.outputs.version }}
86
+ To update PlantUML manually, run:
87
+ ```bash
88
+ rake update_plantuml
89
+ ```
90
+ branch: update-plantuml-${{ steps.update.outputs.plantuml_version }}
110
91
  base: main
111
92
  labels: |
112
93
  enhancement
113
94
  automated
95
+ plantuml-update
@@ -13,3 +13,6 @@ jobs:
13
13
  uses: metanorma/ci/.github/workflows/generic-rake.yml@main
14
14
  secrets:
15
15
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
16
+ with:
17
+ before-setup-ruby: |
18
+ java -version
data/Gemfile CHANGED
@@ -18,6 +18,7 @@ gem "debug"
18
18
  gem "metanorma"
19
19
  gem "metanorma-standoc", github: "metanorma/metanorma-standoc",
20
20
  branch: "main"
21
+ gem "octokit"
21
22
  gem "rake"
22
23
  gem "rspec"
23
24
  gem "rspec-html-matchers"
data/README.adoc CHANGED
@@ -832,6 +832,8 @@ PlantUML versions:
832
832
  | Gem version | PlantUML version | Notes
833
833
 
834
834
  | 1.0.0 | 1.2025.4 | Latest release with updated architecture
835
+ | 1.0.4 | 1.2025.7 | Latest release
836
+
835
837
  |===
836
838
 
837
839
  This approach allows the gem to follow standard semantic versioning practices
@@ -839,54 +841,133 @@ while clearly documenting which PlantUML version is bundled with each release.
839
841
 
840
842
  === Updating PlantUML version
841
843
 
842
- This gem bundles a specific version of PlantUML JAR file. To update to a newer
843
- version:
844
+ ==== General
845
+
846
+ This gem bundles a specific version of PlantUML JAR file.
847
+
848
+ There are two ways to update to a newer version.
849
+
850
+ ==== Automatic update (recommended)
851
+
852
+ The simplest way to update PlantUML is to use the automated update task:
853
+
854
+ [source,console]
855
+ ----
856
+ $ bundle exec rake update_plantuml
857
+ ----
858
+
859
+ This task will:
860
+
861
+ * Search GitHub for the latest valid PlantUML release (excluding pre-releases and native builds)
862
+ * Compare with the current version and skip if already up to date
863
+ * Update version files automatically (both PlantUML and gem versions)
864
+ * Download and verify the new JAR file
865
+ * Test the JAR functionality to ensure it works correctly
866
+
867
+ The task uses exit codes to indicate the result:
868
+
869
+ * Exit code 0: No update needed (already up to date)
870
+ * Exit code 1: Update completed successfully
871
+ * Exit code 2: Update failed due to an error
872
+
873
+ ==== Manual update
874
+
875
+ For manual updates or to specify a particular version:
844
876
 
845
877
  . Check the latest PlantUML release at
846
878
  https://github.com/plantuml/plantuml/releases
847
879
 
848
- . Update the version in `lib/metanorma/plugin/plantuml/version.rb`:
880
+ . Use the manual version update task:
849
881
  +
850
- [source,ruby]
882
+ [source,console]
851
883
  ----
852
- PLANTUML_JAR_VERSION = "1.2025.4" # Update to latest version
853
- VERSION = "1.0.1" # Increment patch version
884
+ $ bundle exec rake update_plantuml_version[1.2025.7]
854
885
  ----
855
886
 
856
- . Clean the old JAR file:
887
+ . Download the new JAR file:
857
888
  +
858
889
  [source,console]
859
890
  ----
860
- $ bundle exec rake clean_jar
891
+ $ bundle exec rake clean_jar download_jar
861
892
  ----
862
893
 
863
- . Download the new JAR file:
894
+ . Test the functionality:
864
895
  +
865
896
  [source,console]
866
897
  ----
867
- $ bundle exec rake download_jar
898
+ $ bundle exec rake test_plantuml
868
899
  ----
869
900
 
870
- . Run tests to ensure everything works:
871
- +
901
+ ==== Version checking
902
+
903
+ You can check the current PlantUML and gem versions:
904
+
872
905
  [source,console]
873
906
  ----
874
- $ bundle exec rake spec
907
+ $ bundle exec rake check_plantuml_version
875
908
  ----
876
909
 
877
- . Update the gem version by incrementing the patch version (e.g., `1.0.0` →
878
- `1.0.1`) for PlantUML updates, or increment minor/major versions for gem feature
879
- updates.
910
+ You can find the latest available PlantUML version:
911
+
912
+ [source,console]
913
+ ----
914
+ $ bundle exec rake find_latest_plantuml
915
+ ----
880
916
 
881
917
  === Available rake tasks
882
918
 
919
+ ==== PlantUML management tasks
920
+
921
+ [source,console]
922
+ ----
923
+ $ bundle exec rake update_plantuml # Update PlantUML to latest version (automatic)
924
+ $ bundle exec rake update_plantuml_version[VERSION] # Update PlantUML to specific version (manual)
925
+ $ bundle exec rake check_plantuml_version # Check current PlantUML and gem versions
926
+ $ bundle exec rake find_latest_plantuml # Find latest valid PlantUML release
927
+ $ bundle exec rake test_plantuml # Test PlantUML JAR functionality
928
+ ----
929
+
930
+ ==== JAR file management tasks
931
+
932
+ [source,console]
933
+ ----
934
+ $ bundle exec rake download_jar # Download PlantUML JAR file
935
+ $ bundle exec rake clean_jar # Remove downloaded JAR file
936
+ ----
937
+
938
+ ==== Development tasks
939
+
883
940
  [source,console]
884
941
  ----
885
- $ bundle exec rake download_jar # Download PlantUML JAR file
886
- $ bundle exec rake clean_jar # Remove downloaded JAR file
887
- $ bundle exec rake spec # Run tests
942
+ $ bundle exec rake spec # Run tests
943
+ $ bundle exec rake # Default task: download JAR + run tests
888
944
  ----
889
945
 
946
+ ==== Task descriptions
947
+
948
+ `update_plantuml`:: Automatically finds the latest valid PlantUML release,
949
+ updates version files, downloads the new JAR, and tests functionality. This is
950
+ the recommended way to update PlantUML.
951
+
952
+ `update_plantuml_version[VERSION]`:: Manually updates the PlantUML version in
953
+ `version.rb` to the specified version and increments the gem version. Use this
954
+ when you need to specify a particular PlantUML version.
955
+
956
+ `check_plantuml_version`:: Displays the current PlantUML JAR version and gem
957
+ version from `version.rb`.
958
+
959
+ `find_latest_plantuml`:: Searches GitHub for the latest valid PlantUML release,
960
+ filtering out pre-releases, native builds, and invalid versions. Shows the
961
+ version and release information.
962
+
963
+ `test_plantuml`:: Tests the downloaded PlantUML JAR by running version checks
964
+ and generating a test diagram to ensure functionality.
965
+
966
+ `download_jar`:: Downloads the PlantUML JAR file based on the version specified
967
+ in `version.rb`. Creates the `data/` directory if it doesn't exist.
968
+
969
+ `clean_jar`:: Removes the downloaded PlantUML JAR file from `data/plantuml.jar`.
970
+
890
971
  == Documentation
891
972
 
892
973
  Please refer to https://www.metanorma.org.
data/Rakefile CHANGED
@@ -14,8 +14,146 @@ def uri_open(url)
14
14
  URI.parse(url).open
15
15
  end
16
16
 
17
+ def github_client
18
+ require "octokit"
19
+ @github_client ||= begin
20
+ token = ENV['GITHUB_TOKEN'] || `gh auth token 2>/dev/null`.strip
21
+ token = nil if token.empty?
22
+ if token
23
+ Octokit::Client.new(access_token: token)
24
+ else
25
+ Octokit::Client.new
26
+ end
27
+ end
28
+ end
29
+
30
+ def find_latest_valid_plantuml_release
31
+ puts "Searching for latest valid PlantUML release..."
32
+
33
+ client = github_client
34
+ releases = client.releases('plantuml/plantuml')
35
+
36
+ # Filter for valid JAR releases
37
+ valid_releases = releases.reject(&:prerelease).select do |release|
38
+ tag_name = release.tag_name
39
+ version = tag_name.sub(/^v/, '')
40
+ # Must match pattern v\d+\.\d{4}\.\d+ and not contain -native or other suffixes
41
+ tag_name.match?(/^v\d+\.\d{4}\.\d+$/) &&
42
+ !tag_name.include?('-native') &&
43
+ !tag_name.include?('-snapshot') &&
44
+ release.assets.any? { |asset| asset.name == "plantuml-#{version}.jar" }
45
+ end
46
+
47
+ if valid_releases.empty?
48
+ raise "No valid PlantUML JAR releases found"
49
+ end
50
+
51
+ latest = valid_releases.first
52
+ version = latest.tag_name.sub(/^v/, '')
53
+
54
+ puts "Found latest valid release: #{latest.tag_name} (#{version})"
55
+ {
56
+ version: version,
57
+ tag_name: latest.tag_name,
58
+ html_url: latest.html_url,
59
+ jar_asset: latest.assets.find { |asset| asset.name == "plantuml-#{version}.jar" }
60
+ }
61
+ rescue Octokit::Error => e
62
+ puts "GitHub API error: #{e.message}"
63
+ raise
64
+ rescue StandardError => e
65
+ puts "Error finding latest release: #{e.message}"
66
+ raise
67
+ end
68
+
69
+ def current_plantuml_version
70
+ Metanorma::Plugin::Plantuml::PLANTUML_JAR_VERSION
71
+ end
72
+
73
+ def current_gem_version
74
+ Metanorma::Plugin::Plantuml::VERSION
75
+ end
76
+
77
+ def update_version_file(new_plantuml_version, new_gem_version)
78
+ version_file = "lib/metanorma/plugin/plantuml/version.rb"
79
+ content = File.read(version_file)
80
+
81
+ # Update PlantUML version (handle .freeze suffix)
82
+ original_content = content.dup
83
+ content.gsub!(/VERSION = ["']([^"']+)["']\.freeze/, %Q(VERSION = "#{new_gem_version}".freeze))
84
+ content.gsub!(/PLANTUML_JAR_VERSION = ["']([^"']+)["']\.freeze/, %Q(PLANTUML_JAR_VERSION = "#{new_plantuml_version}".freeze))
85
+
86
+ if content == original_content
87
+ puts "⚠️ No changes made to version file. Current content:"
88
+ puts content
89
+ raise "Failed to update version file - no substitutions made"
90
+ end
91
+
92
+ File.write(version_file, content)
93
+
94
+ # Verify the file was written correctly
95
+ updated_content = File.read(version_file)
96
+ unless updated_content.include?(%Q("#{new_plantuml_version}")) && updated_content.include?(%Q("#{new_gem_version}"))
97
+ puts "❌ File content after update:"
98
+ puts updated_content
99
+ raise "Version file update verification failed"
100
+ end
101
+
102
+ puts "✅ Updated version file:"
103
+ puts " PlantUML: #{new_plantuml_version}"
104
+ puts " Gem: #{new_gem_version}"
105
+ end
106
+
107
+ def increment_gem_version(current_version)
108
+ require 'rubygems'
109
+ version = Gem::Version.new(current_version)
110
+ segments = version.segments.dup
111
+ segments[2] = (segments[2] || 0) + 1
112
+ segments.join('.')
113
+ end
114
+
115
+ def test_plantuml_jar
116
+ jar_file = "data/plantuml.jar"
117
+
118
+ unless File.exist?(jar_file)
119
+ raise "PlantUML JAR file not found: #{jar_file}"
120
+ end
121
+
122
+ puts "Testing PlantUML JAR functionality..."
123
+
124
+ # Test version command
125
+ version_output = `java -jar #{jar_file} -version 2>&1`
126
+ unless $?.success? && version_output.include?("PlantUML")
127
+ raise "PlantUML version test failed. Output: #{version_output}"
128
+ end
129
+ puts "✅ Version test passed"
130
+
131
+ # Test diagram generation
132
+ test_diagram = "test_diagram_#{Time.now.to_i}.puml"
133
+ test_svg = test_diagram.sub('.puml', '.svg')
134
+
135
+ File.write(test_diagram, <<~PUML)
136
+ @startuml
137
+ Alice -> Bob: Hello
138
+ Bob -> Alice: Hi
139
+ @enduml
140
+ PUML
141
+
142
+ begin
143
+ generation_output = `java -jar #{jar_file} -tsvg #{test_diagram} 2>&1`
144
+ unless $?.success? && File.exist?(test_svg)
145
+ raise "PlantUML diagram generation test failed. Output: #{generation_output}"
146
+ end
147
+ puts "✅ Diagram generation test passed"
148
+ ensure
149
+ FileUtils.rm_f([test_diagram, test_svg])
150
+ end
151
+ end
152
+
17
153
  file "data/plantuml.jar" do |file|
18
- ver = Metanorma::Plugin::Plantuml::PLANTUML_JAR_VERSION
154
+ # Read version directly from file to avoid constant redefinition warnings
155
+ version_content = File.read("lib/metanorma/plugin/plantuml/version.rb")
156
+ ver = version_content.match(/PLANTUML_JAR_VERSION = ["']([^"']+)["']/)[1]
19
157
  url = "https://github.com/plantuml/plantuml/releases/download/v#{ver}/plantuml-#{ver}.jar"
20
158
  puts "Downloading PlantUML JAR... #{url}"
21
159
 
@@ -36,3 +174,100 @@ task :clean_jar do
36
174
  FileUtils.rm_f("data/plantuml.jar")
37
175
  puts "Removed data/plantuml.jar"
38
176
  end
177
+
178
+ desc "Find latest valid PlantUML release"
179
+ task :find_latest_plantuml do
180
+ release_info = find_latest_valid_plantuml_release
181
+ puts "Latest PlantUML version: #{release_info[:version]}"
182
+ puts "Release URL: #{release_info[:html_url]}"
183
+ puts "JAR asset: #{release_info[:jar_asset].name}" if release_info[:jar_asset]
184
+ end
185
+
186
+ desc "Check current PlantUML version"
187
+ task :check_plantuml_version do
188
+ puts "Current PlantUML version: #{current_plantuml_version}"
189
+ puts "Current gem version: #{current_gem_version}"
190
+ end
191
+
192
+ desc "Test PlantUML JAR functionality"
193
+ task :test_plantuml do
194
+ test_plantuml_jar
195
+ end
196
+
197
+ desc "Update PlantUML to latest version"
198
+ task :update_plantuml do
199
+ puts "Checking for PlantUML updates..."
200
+
201
+ current_version = current_plantuml_version
202
+ current_gem = current_gem_version
203
+
204
+ begin
205
+ release_info = find_latest_valid_plantuml_release
206
+ latest_version = release_info[:version]
207
+
208
+ puts "Current version: #{current_version}"
209
+ puts "Latest version: #{latest_version}"
210
+
211
+ if current_version == latest_version
212
+ puts "✅ PlantUML is already up to date"
213
+ exit 0
214
+ end
215
+
216
+ # Check if update is actually newer
217
+ require 'rubygems'
218
+ if Gem::Version.new(latest_version) <= Gem::Version.new(current_version)
219
+ puts "⚠️ Latest version (#{latest_version}) is not newer than current (#{current_version})"
220
+ exit 0
221
+ end
222
+
223
+ puts "🔄 Updating PlantUML from #{current_version} to #{latest_version}"
224
+
225
+ # Update version files
226
+ new_gem_version = increment_gem_version(current_gem)
227
+ update_version_file(latest_version, new_gem_version)
228
+
229
+ # Clean old JAR and download new one
230
+ Rake::Task[:clean_jar].invoke
231
+ Rake::Task[:download_jar].invoke
232
+
233
+ # Test new JAR
234
+ test_plantuml_jar
235
+
236
+ puts "🎉 Successfully updated PlantUML!"
237
+ puts " PlantUML: #{current_version} → #{latest_version}"
238
+ puts " Gem: #{current_gem} → #{new_gem_version}"
239
+ puts " Release: #{release_info[:html_url]}"
240
+
241
+ exit 1 # Exit with code 1 to indicate changes were made
242
+
243
+ rescue StandardError => e
244
+ puts "❌ Failed to update PlantUML: #{e.message}"
245
+ exit 2 # Exit with code 2 to indicate error
246
+ end
247
+ end
248
+
249
+ desc "Update PlantUML version in version.rb (manual)"
250
+ task :update_plantuml_version, [:plantuml_version] do |t, args|
251
+ plantuml_version = args[:plantuml_version]
252
+
253
+ unless plantuml_version
254
+ puts "Usage: rake update_plantuml_version[1.2025.7]"
255
+ exit 1
256
+ end
257
+
258
+ unless plantuml_version.match?(/^\d+\.\d{4}\.\d+$/)
259
+ puts "Invalid version format. Expected: N.YYYY.NNN (e.g., 1.2025.7)"
260
+ exit 1
261
+ end
262
+
263
+ current_gem = current_gem_version
264
+ new_gem_version = increment_gem_version(current_gem)
265
+
266
+ update_version_file(plantuml_version, new_gem_version)
267
+
268
+ puts "Updated versions:"
269
+ puts " PlantUML: #{plantuml_version}"
270
+ puts " Gem: #{new_gem_version}"
271
+ puts ""
272
+ puts "Don't forget to run: rake clean_jar download_jar"
273
+ end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Plantuml
4
- VERSION = "1.0.3".freeze
4
+ VERSION = "1.0.4".freeze
5
5
  PLANTUML_JAR_VERSION = "1.2025.4".freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-plantuml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-09 00:00:00.000000000 Z
11
+ date: 2025-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor