summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rakefile2
-rw-r--r--gem-version-patch.rb7
-rwxr-xr-xrelease.sh7
-rw-r--r--tasks/version.rb3
4 files changed, 6 insertions, 13 deletions
diff --git a/Rakefile b/Rakefile
index 0443554a..405c9b17 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative 'gem-version-patch'
-
$default_tasks = [] # rubocop:disable Style/GlobalVars
Dir.glob('tasks/*.rake').each {|file| load file }
task default: $default_tasks unless $default_tasks.empty? # rubocop:disable Style/GlobalVars
diff --git a/gem-version-patch.rb b/gem-version-patch.rb
deleted file mode 100644
index 83aead2b..00000000
--- a/gem-version-patch.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# Overrides Gem::Version.new to restore the hyphen in the version number
-Gem::Version.prepend (Module.new do
- def initialize _version
- super
- @version = @version.sub '.pre.', '-'
- end
-end)
diff --git a/release.sh b/release.sh
index a7535f2b..3e5fea15 100755
--- a/release.sh
+++ b/release.sh
@@ -13,11 +13,12 @@ fi
RELEASE_GIT_NAME=$(curl -s https://api.github.com/users/$RELEASE_USER | jq -r .name)
RELEASE_GIT_EMAIL=$RELEASE_USER@users.noreply.github.com
GEMSPEC=$(ls -1 *.gemspec | head -1)
-RELEASE_NAME=$(ruby -e "print (Gem::Specification.load '$GEMSPEC').name")
+RELEASE_GEM_NAME=$(ruby -e "print (Gem::Specification.load '$GEMSPEC').name")
# RELEASE_VERSION must be an exact version number; if not set, defaults to next patch release
if [ -z "$RELEASE_VERSION" ]; then
export RELEASE_VERSION=$(ruby -e "print (Gem::Specification.load '$GEMSPEC').version.then { _1.prerelease? ? _1.release.to_s : (_1.segments.tap {|s| s[-1] += 1 }.join ?.) }")
fi
+export RELEASE_GEM_VERSION=${RELEASE_VERSION/-/.}
# configure git to push changes
git config --local user.name "$RELEASE_GIT_NAME"
@@ -35,9 +36,9 @@ chmod 600 $HOME/.gem/credentials
git commit -a -m "release $RELEASE_VERSION"
git tag -m "version $RELEASE_VERSION" v$RELEASE_VERSION
mkdir -p pkg
- RUBYOPT='-r ./gem-version-patch.rb' gem build $GEMSPEC -o pkg/$RELEASE_NAME-$RELEASE_VERSION.gem
+ gem build $GEMSPEC -o pkg/$RELEASE_GEM_NAME-$RELEASE_GEM_VERSION.gem
git push origin $(git describe --tags --exact-match)
- gem push pkg/$RELEASE_NAME-$RELEASE_VERSION.gem
+ gem push pkg/$RELEASE_GEM_NAME-$RELEASE_GEM_VERSION.gem
ruby tasks/release-notes.rb
gh release create v$RELEASE_VERSION -t v$RELEASE_VERSION -F pkg/release-notes.md -d
ruby tasks/postversion.rb
diff --git a/tasks/version.rb b/tasks/version.rb
index bc56987e..3f7cb801 100644
--- a/tasks/version.rb
+++ b/tasks/version.rb
@@ -3,6 +3,7 @@
require 'time'
release_version = ENV['RELEASE_VERSION']
+release_gem_version = ENV['RELEASE_GEM_VERSION']
prerelease = (release_version.count '[a-z]') > 0 ? %(-#{(release_version.split '.', 3)[-1]}) : nil
release_date = Time.now.strftime '%Y-%m-%d'
release_user = ENV['RELEASE_USER']
@@ -13,7 +14,7 @@ changelog_file = 'CHANGELOG.adoc'
antora_file = 'docs/antora.yml'
version_contents = (File.readlines version_file, mode: 'r:UTF-8').map do |l|
- (l.include? 'VERSION') ? (l.sub %r/'[^']+'/, %('#{release_version}')) : l
+ (l.include? 'VERSION') ? (l.sub %r/'[^']+'/, %('#{release_gem_version}')) : l
end
readme_contents = File.readlines readme_file, mode: 'r:UTF-8'