semantic-release-rubygem
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "semantic-release-rubygem", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A semantic-release plugin for publishing Ruby gems", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -58,3 +58,3 @@ const path = require('path'); | ||
module TestGem | ||
VERSION = '1.0.0-alpha.1' | ||
VERSION = '1.0.0.alpha.1' | ||
end | ||
@@ -61,0 +61,0 @@ `); |
@@ -51,3 +51,3 @@ const path = require('path'); | ||
it('finds the version file', async () => { | ||
it('verifies the version file', async () => { | ||
const { versionFile } = await verifyConditions( | ||
@@ -61,2 +61,14 @@ {}, | ||
describe('when the existing version file contains a prerelease version', () => { | ||
it('verifies the version file', async () => { | ||
const cwd = path.resolve(__dirname, './fixtures/prerelease'); | ||
const { versionFile } = await verifyConditions( | ||
{}, | ||
{ cwd, env: defaultEnv }, | ||
{ credentialsFile }, | ||
); | ||
expect(versionFile).toEqual('lib/test-gem/version.rb'); | ||
}); | ||
}); | ||
describe('when there is no version file', () => { | ||
@@ -63,0 +75,0 @@ it('throws an error', async () => { |
@@ -9,3 +9,8 @@ const { readFile, writeFile } = require('fs').promises; | ||
const versionContents = await readFile(fullVersionPath, 'utf8'); | ||
const newContents = versionContents.replace(VERSION_REGEX, `$1${nextVersion}$2`); | ||
const newContents = versionContents.replace( | ||
VERSION_REGEX, | ||
// Rubygems replaces all `-` with `.pre.`, which causes odd version differences between tags/releases | ||
// and the published gem version. Replacing `-` with `.` is a smaller difference. | ||
`$1${nextVersion.replace('-', '.')}$2`, | ||
); | ||
logger.log('Writing version %s to `%s`', nextVersion, versionFile); | ||
@@ -12,0 +17,0 @@ await writeFile(fullVersionPath, newContents, 'utf8'); |
22603
371