release-please 15.0.0 → 15.1.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [15.1.0](https://github.com/googleapis/release-please/compare/v15.0.0...v15.1.0) (2023-01-05)
8
+
9
+
10
+ ### Features
11
+
12
+ * **ruby:** Add Gemfile.Lock updater ([#1790](https://github.com/googleapis/release-please/issues/1790)) ([9baf736](https://github.com/googleapis/release-please/commit/9baf736aa424bf3dcf0f05009e5cf8c9ef05fd69))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **java-yoshi:** Throw MissingRequiredFile error if no versions.txt found ([#1794](https://github.com/googleapis/release-please/issues/1794)) ([542d412](https://github.com/googleapis/release-please/commit/542d412307ea8d6350908aeb7efaf9db9e3d03f9))
18
+
7
19
  ## [15.0.0](https://github.com/googleapis/release-please/compare/v14.17.5...v15.0.0) (2022-12-12)
8
20
 
9
21
 
@@ -57,7 +57,7 @@ class JavaYoshi extends java_1.Java {
57
57
  this.versionsContent = await this.github.getFileContentsOnBranch(this.addPath('versions.txt'), this.targetBranch);
58
58
  }
59
59
  catch (err) {
60
- if (err instanceof errors_1.GitHubAPIError) {
60
+ if (err instanceof errors_1.FileNotFoundError) {
61
61
  throw new errors_1.MissingRequiredFileError(this.addPath('versions.txt'), JavaYoshi.name, `${this.repository.owner}/${this.repository.repo}`);
62
62
  }
63
63
  throw err;
@@ -19,6 +19,7 @@ const indent_commit_1 = require("../util/indent-commit");
19
19
  const changelog_1 = require("../updaters/changelog");
20
20
  // Ruby
21
21
  const version_rb_1 = require("../updaters/ruby/version-rb");
22
+ const gemfile_lock_1 = require("../updaters/ruby/gemfile-lock");
22
23
  const base_1 = require("./base");
23
24
  class Ruby extends base_1.BaseStrategy {
24
25
  constructor(options) {
@@ -48,6 +49,14 @@ class Ruby extends base_1.BaseStrategy {
48
49
  version,
49
50
  }),
50
51
  });
52
+ updates.push({
53
+ path: this.addPath('Gemfile.lock'),
54
+ createIfMissing: false,
55
+ updater: new gemfile_lock_1.GemfileLock({
56
+ version,
57
+ gemName: this.component || '',
58
+ }),
59
+ });
51
60
  return updates;
52
61
  }
53
62
  async postProcessCommits(commits) {
@@ -0,0 +1,17 @@
1
+ import { Version } from '../../version';
2
+ export declare const RUBY_VERSION_REGEX: RegExp;
3
+ /**
4
+ * Stringify a version to a ruby compatible version string
5
+ *
6
+ * @param version The version to stringify
7
+ * @param useDotPrePreleaseSeperator Use a `.` seperator for prereleases rather then `-`
8
+ * @returns a ruby compatible version string
9
+ */
10
+ export declare function stringifyRubyVersion(version: Version, useDotPrePreleaseSeperator?: boolean): string;
11
+ /**
12
+ * This function mimics Gem::Version parsing of version semver strings
13
+ *
14
+ * @param versionString The version string to resolve
15
+ * @returns A Gem::Version compatible version string
16
+ */
17
+ export declare function resolveRubyGemfileLockVersion(versionString: string): string;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.resolveRubyGemfileLockVersion = exports.stringifyRubyVersion = exports.RUBY_VERSION_REGEX = void 0;
17
+ // Ruby gem semver strings using `.` seperator for prereleases rather then `-`
18
+ // See https://guides.rubygems.org/patterns/
19
+ exports.RUBY_VERSION_REGEX = /((\d+).(\d)+.(\d+)(.\w+.*)?)/g;
20
+ /**
21
+ * Stringify a version to a ruby compatible version string
22
+ *
23
+ * @param version The version to stringify
24
+ * @param useDotPrePreleaseSeperator Use a `.` seperator for prereleases rather then `-`
25
+ * @returns a ruby compatible version string
26
+ */
27
+ function stringifyRubyVersion(version, useDotPrePreleaseSeperator = false) {
28
+ if (!useDotPrePreleaseSeperator) {
29
+ return version.toString();
30
+ }
31
+ return `${version.major}.${version.minor}.${version.patch}${version.preRelease ? `.${version.preRelease}` : ''}`;
32
+ }
33
+ exports.stringifyRubyVersion = stringifyRubyVersion;
34
+ /**
35
+ * This function mimics Gem::Version parsing of version semver strings
36
+ *
37
+ * @param versionString The version string to resolve
38
+ * @returns A Gem::Version compatible version string
39
+ */
40
+ function resolveRubyGemfileLockVersion(versionString) {
41
+ // Replace `-` with `.pre.` as per ruby gem parsing
42
+ // See https://github.com/rubygems/rubygems/blob/master/lib/rubygems/version.rb#L229
43
+ return versionString.replace(/-/g, '.pre.');
44
+ }
45
+ exports.resolveRubyGemfileLockVersion = resolveRubyGemfileLockVersion;
46
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1,24 @@
1
+ import { DefaultUpdater, UpdateOptions } from '../default';
2
+ export interface GemfileLockOptions extends UpdateOptions {
3
+ gemName: string;
4
+ }
5
+ /**
6
+ * Builds a regex matching a gem version in a Gemfile.lock file.
7
+ * @example
8
+ * rails (7.0.1)
9
+ * rails (7.0.1.alpha1)
10
+ */
11
+ export declare function buildGemfileLockVersionRegex(gemName: string): RegExp;
12
+ /**
13
+ * Updates a Gemfile.lock files which is expected to have a local path version string.
14
+ */
15
+ export declare class GemfileLock extends DefaultUpdater {
16
+ gemName: string;
17
+ constructor(options: GemfileLockOptions);
18
+ /**
19
+ * Given initial file contents, return updated contents.
20
+ * @param {string} content The initial content
21
+ * @returns {string} The updated content
22
+ */
23
+ updateContent(content: string): string;
24
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.GemfileLock = exports.buildGemfileLockVersionRegex = void 0;
17
+ const default_1 = require("../default");
18
+ const common_1 = require("./common");
19
+ /**
20
+ * Builds a regex matching a gem version in a Gemfile.lock file.
21
+ * @example
22
+ * rails (7.0.1)
23
+ * rails (7.0.1.alpha1)
24
+ */
25
+ function buildGemfileLockVersionRegex(gemName) {
26
+ return new RegExp(`s*${gemName} \\(${common_1.RUBY_VERSION_REGEX.source}\\)`);
27
+ }
28
+ exports.buildGemfileLockVersionRegex = buildGemfileLockVersionRegex;
29
+ /**
30
+ * Updates a Gemfile.lock files which is expected to have a local path version string.
31
+ */
32
+ class GemfileLock extends default_1.DefaultUpdater {
33
+ constructor(options) {
34
+ super(options);
35
+ this.gemName = options.gemName;
36
+ }
37
+ /**
38
+ * Given initial file contents, return updated contents.
39
+ * @param {string} content The initial content
40
+ * @returns {string} The updated content
41
+ */
42
+ updateContent(content) {
43
+ // Bundler will convert 1.0.0-alpha1 to 1.0.0.pre.alpha1, so we need to
44
+ // do the same here.
45
+ const versionString = (0, common_1.resolveRubyGemfileLockVersion)(this.version.toString());
46
+ return content.replace(buildGemfileLockVersionRegex(this.gemName), `${this.gemName} (${versionString})`);
47
+ }
48
+ }
49
+ exports.GemfileLock = GemfileLock;
50
+ //# sourceMappingURL=gemfile-lock.js.map
@@ -15,6 +15,8 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.VersionRB = void 0;
17
17
  const default_1 = require("../default");
18
+ const common_1 = require("./common");
19
+ const RUBY_VERSION_RB_REGEX = new RegExp(`(["'])(${common_1.RUBY_VERSION_REGEX.source})(["'])`);
18
20
  /**
19
21
  * Updates a versions.rb file which is expected to have a version string.
20
22
  */
@@ -25,7 +27,7 @@ class VersionRB extends default_1.DefaultUpdater {
25
27
  * @returns {string} The updated content
26
28
  */
27
29
  updateContent(content) {
28
- return content.replace(/(["'])[0-9]+\.[0-9]+\.[0-9]+(-\w+)?["']/, `$1${this.version}$1`);
30
+ return content.replace(RUBY_VERSION_RB_REGEX, `$1${(0, common_1.stringifyRubyVersion)(this.version)}$1`);
29
31
  }
30
32
  }
31
33
  exports.VersionRB = VersionRB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "15.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",
@@ -63,7 +63,7 @@
63
63
  "gts": "^3.1.0",
64
64
  "mocha": "^9.2.2",
65
65
  "nock": "^13.0.0",
66
- "sinon": "15.0.0",
66
+ "sinon": "15.0.1",
67
67
  "snap-shot-it": "^7.0.0"
68
68
  },
69
69
  "dependencies": {