react_on_rails 16.2.0.test.6 → 16.2.0

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.
@@ -4,41 +4,70 @@ require "English"
4
4
  require "bundler"
5
5
  require_relative "task_helpers"
6
6
 
7
- desc "Updates CHANGELOG.md inserting headers for the new version.
7
+ CLAUDE_CODE_TIP = <<~TIP
8
+ ┌─────────────────────────────────────────────────────────────────────────────┐
9
+ │ TIP: This task only adds version headers and links, not changelog entries. │
10
+ │ For full automation, run /update-changelog in Claude Code. │
11
+ │ │
12
+ │ After running this task, manually add entries under the new header: │
13
+ │ #### Fixed / #### Added / #### Changed / etc. │
14
+ └─────────────────────────────────────────────────────────────────────────────┘
15
+ TIP
8
16
 
9
- Argument: Git tag. Defaults to the latest tag."
17
+ # Update the compare links at the bottom of the changelog
18
+ # version: version string without 'v' prefix (e.g., "16.2.0.beta.20")
19
+ # anchor: markdown anchor (e.g., "[16.2.0.beta.20]")
20
+ def update_changelog_links(changelog, version, anchor)
21
+ compare_link_prefix = "https://github.com/shakacode/react_on_rails/compare"
22
+ match_data = %r{#{compare_link_prefix}/(?<prev_version>.*)\.\.\.master}.match(changelog)
23
+ return unless match_data
24
+
25
+ prev_version = match_data[:prev_version]
26
+ new_unreleased_link = "#{compare_link_prefix}/#{version}...master"
27
+ new_version_link = "#{anchor}: #{compare_link_prefix}/#{prev_version}...#{version}"
28
+ changelog.sub!(match_data[0], "#{new_unreleased_link}\n#{new_version_link}")
29
+ end
30
+
31
+ # Insert version header into changelog, returns true if successful
32
+ def insert_version_header(changelog, anchor, tag_date)
33
+ # Try inserting right after ### [Unreleased] first
34
+ return true if changelog.sub!("### [Unreleased]", "### [Unreleased]\n\n### #{anchor} - #{tag_date}")
35
+
36
+ # Fallback: insert after "Changes since the last non-beta release."
37
+ return true if changelog.sub!("Changes since the last non-beta release.", "\\0\n\n### #{anchor} - #{tag_date}")
38
+
39
+ false
40
+ end
41
+
42
+ desc "Updates CHANGELOG.md inserting headers for the new version (headers only, not content).
43
+ Argument: Git tag. Defaults to the latest tag.
44
+ TIP: Use /update-changelog in Claude Code for full automation."
10
45
 
11
46
  task :update_changelog, %i[tag] do |_, args|
12
- tag = args[:tag] || `git describe --tags --abbrev=0`.strip
13
- anchor = "[#{tag}]"
47
+ puts CLAUDE_CODE_TIP
14
48
 
49
+ # Git tags use 'v' prefix (e.g., v16.2.0), but CHANGELOG uses versions without it
50
+ git_tag = args[:tag] || `git describe --tags --abbrev=0`.strip
51
+ changelog_version = git_tag.delete_prefix("v")
52
+ anchor = "[#{changelog_version}]"
15
53
  changelog = File.read("CHANGELOG.md")
16
54
 
17
55
  if changelog.include?(anchor)
18
- puts "Tag #{tag} is already documented in CHANGELOG.md, update manually if needed"
56
+ puts "Tag #{git_tag} is already documented in CHANGELOG.md"
19
57
  next
20
58
  end
21
59
 
22
- tag_date_output = `git show -s --format=%cs #{tag} 2>&1`
23
- if $CHILD_STATUS.success?
24
- tag_date = tag_date_output.split("\n").last.strip
25
- else
26
- abort("Failed to find tag #{tag}")
27
- end
28
-
29
- # after "Changes since the last non-beta release.", insert link header
30
- changelog.sub!("Changes since the last non-beta release.", "\\0\n\n### #{anchor} - #{tag_date}")
60
+ tag_date = `git show -s --format=%cs #{git_tag} 2>&1`.split("\n").last&.strip
61
+ abort("Failed to find tag #{git_tag}") unless $CHILD_STATUS.success? && tag_date
31
62
 
32
- # find the link in "[Unreleased]: ...", update it, and add the link for our new tag after it
33
- compare_link_prefix = "https://github.com/shakacode/react_on_rails/compare"
34
- match_data = %r{#{compare_link_prefix}/(?<prev_tag>.*)\.\.\.master}.match(changelog)
35
- if match_data
36
- prev_tag = match_data[:prev_tag]
37
- new_unreleased_link = "#{compare_link_prefix}/#{tag}...master"
38
- new_tag_link = "#{anchor}: #{compare_link_prefix}/#{prev_tag}...#{tag}"
39
- changelog.sub!(match_data[0], "#{new_unreleased_link}\n#{new_tag_link}")
63
+ unless insert_version_header(changelog, anchor, tag_date)
64
+ abort("Failed to insert version header: could not find '### [Unreleased]' " \
65
+ "or 'Changes since the last non-beta release.' in CHANGELOG.md")
40
66
  end
41
67
 
68
+ update_changelog_links(changelog, changelog_version, anchor)
69
+
42
70
  File.write("CHANGELOG.md", changelog)
43
- puts "Updated CHANGELOG.md with an entry for #{tag}"
71
+ puts "Updated CHANGELOG.md with version header for #{git_tag}"
72
+ puts "NOTE: You still need to write the changelog entries manually."
44
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.2.0.test.6
4
+ version: 16.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-12-07 00:00:00.000000000 Z
11
+ date: 2026-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable