Skip to content

Commit

Permalink
Further updates to releasing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Feb 7, 2024
1 parent 8781cab commit 85c0315
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
57 changes: 43 additions & 14 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,42 @@ To release a new version of Prism, perform the following steps:
* Add a new section for the new version at the top of the file.
* Fill in the relevant changes — it may be easiest to click the link for the `Unreleased` heading to find the commits.
* Update the links at the bottom of the file.
* Update the version in the following files:
* `prism.gemspec` in the `Gem::Specification#version=` method call
* `ext/prism/extension.h` in the `EXPECTED_PRISM_VERSION` macro
* `include/prism/version.h` in the version macros
* `javascript/package.json` in the `version` field
* `rust/ruby-prism-sys/tests/utils_tests.rs` in the `version_test` function
* `templates/java/org/prism/Loader.java.erb` in the `load` function
* `templates/javascript/src/deserialize.js.erb` in the version constants
* `templates/lib/prism/serialize.rb.erb` in the version constants
* Run `bundle install` to update the `Gemfile.lock` file.
* Update the version numbers in the various files that reference them:

```sh
export PRISM_MAJOR="x"
export PRISM_MINOR="y"
export PRISM_PATCH="z"
export PRISM_VERSION="$PRISM_MAJOR.$PRISM_MINOR.$PRISM_PATCH"
ruby -pi -e 'gsub(/spec\.version = ".+?"/, %Q{spec.version = "#{ENV["PRISM_VERSION"]}"})' prism.gemspec
ruby -pi -e 'gsub(/EXPECTED_PRISM_VERSION ".+?"/, %Q{EXPECTED_PRISM_VERSION "#{ENV["PRISM_VERSION"]}"})' ext/prism/extension.h
ruby -pi -e 'gsub(/PRISM_VERSION_MAJOR \d+/, %Q{PRISM_VERSION_MAJOR #{ENV["PRISM_MAJOR"]}})' include/prism/version.h
ruby -pi -e 'gsub(/PRISM_VERSION_MINOR \d+/, %Q{PRISM_VERSION_MINOR #{ENV["PRISM_MINOR"]}})' include/prism/version.h
ruby -pi -e 'gsub(/PRISM_VERSION_PATCH \d+/, %Q{PRISM_VERSION_PATCH #{ENV["PRISM_PATCH"]}})' include/prism/version.h
ruby -pi -e 'gsub(/PRISM_VERSION ".+?"/, %Q{PRISM_VERSION "#{ENV["PRISM_VERSION"]}"})' include/prism/version.h
ruby -pi -e 'gsub(/"version": ".+?"/, %Q{"version": "#{ENV["PRISM_VERSION"]}"})' javascript/package.json
ruby -pi -e 'gsub(/lossy\(\), ".+?"/, %Q{lossy(), "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism-sys/tests/utils_tests.rs
ruby -pi -e 'gsub(/\d+, "prism major"/, %Q{#{ENV["PRISM_MAJOR"]}, "prism major"})' templates/java/org/prism/Loader.java.erb
ruby -pi -e 'gsub(/\d+, "prism minor"/, %Q{#{ENV["PRISM_MINOR"]}, "prism minor"})' templates/java/org/prism/Loader.java.erb
ruby -pi -e 'gsub(/\d+, "prism patch"/, %Q{#{ENV["PRISM_PATCH"]}, "prism patch"})' templates/java/org/prism/Loader.java.erb
ruby -pi -e 'gsub(/MAJOR_VERSION = \d+/, %Q{MAJOR_VERSION = #{ENV["PRISM_MAJOR"]}})' templates/javascript/src/deserialize.js.erb
ruby -pi -e 'gsub(/MINOR_VERSION = \d+/, %Q{MINOR_VERSION = #{ENV["PRISM_MINOR"]}})' templates/javascript/src/deserialize.js.erb
ruby -pi -e 'gsub(/PATCH_VERSION = \d+/, %Q{PATCH_VERSION = #{ENV["PRISM_PATCH"]}})' templates/javascript/src/deserialize.js.erb
ruby -pi -e 'gsub(/MAJOR_VERSION = \d+/, %Q{MAJOR_VERSION = #{ENV["PRISM_MAJOR"]}})' templates/lib/prism/serialize.rb.erb
ruby -pi -e 'gsub(/MINOR_VERSION = \d+/, %Q{MINOR_VERSION = #{ENV["PRISM_MINOR"]}})' templates/lib/prism/serialize.rb.erb
ruby -pi -e 'gsub(/PATCH_VERSION = \d+/, %Q{PATCH_VERSION = #{ENV["PRISM_PATCH"]}})' templates/lib/prism/serialize.rb.erb
ruby -pi -e 'gsub(/version = ".+?"/, %Q{version = "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism-sys/Cargo.toml
ruby -pi -e 'gsub(/version = ".+?"/, %Q{version = "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism/Cargo.toml
```

* Update the `Gemfile.lock` file:

```sh
chruby ruby-3.4.0-dev
bundle install
```

* Run `bundle install` with the various other gemfiles:
* Update the version-specific lockfiles:

```sh
chruby ruby-2.7.8 && BUNDLE_GEMFILE=gemfiles/2.7/Gemfile bundle install
Expand All @@ -34,11 +54,20 @@ chruby ruby-3.3.0 && BUNDLE_GEMFILE=gemfiles/3.3/Gemfile bundle install
chruby ruby-3.4.0-dev && BUNDLE_GEMFILE=gemfiles/3.4/Gemfile bundle install
chruby jruby-9.4.5.0 && BUNDLE_GEMFILE=gemfiles/jruby/Gemfile bundle install
chruby truffleruby-23.1.2 && BUNDLE_GEMFILE=gemfiles/truffleruby/Gemfile bundle install
chruby ruby-3.4.0-dev
```

* Update `rust/ruby-prism-sys/Cargo.toml` to match the new version and run `cargo build`
* Update `rust/ruby-prism/Cargo.toml` to match the new version and run `cargo build`
* Commit all of the updated files.
* Update the cargo lockfiles:

```sh
bundle exec rake cargo:build
```

* Commit all of the updated files:

```sh
git commit -am "Bump to v$PRISM_VERSION"
```

## Publishing

Expand Down
6 changes: 3 additions & 3 deletions templates/java/org/prism/Loader.java.erb
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public class Loader {
expect((byte) 'S', "incorrect prism header");
expect((byte) 'M', "incorrect prism header");

expect((byte) 0, "prism version does not match");
expect((byte) 22, "prism version does not match");
expect((byte) 0, "prism version does not match");
expect((byte) 0, "prism major version does not match");
expect((byte) 22, "prism minor version does not match");
expect((byte) 0, "prism patch version does not match");

expect((byte) 1, "Loader.java requires no location fields in the serialized output");

Expand Down

0 comments on commit 85c0315

Please sign in to comment.