bump_gem_version 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e6e6bd836142436daedc45258add017129faf0ea4a98fde70dc4e70f2c74b2e
4
- data.tar.gz: 3ce8df40df36875b534fb3a10342faa537f6d3ecf7c801ec4661d961bb8e1621
3
+ metadata.gz: 4cd19c397da6310e2469d6e7fd5cab35e0654e29bf879c6fcb41b6d192db4882
4
+ data.tar.gz: 20fe21b1e32cb4592d1740268450b05526648e784475da8f5a21b39499c4b551
5
5
  SHA512:
6
- metadata.gz: 7f6f40920043f44e0a8cda4b077928b7c825c6c6d7bef3938982e20a71708b75ea86c0b5f65f5f6b70449d08eef5d934f87d730e04dba140f19f46837a05cac6
7
- data.tar.gz: dd4f17cbaa4ad8acdd9386b283c96218938dc7530d11f205f5a89af1162f8da644398947df4e5aa19273c624d18725de22b1c2ea298c9da5e5ea6fe8d31f69d2
6
+ metadata.gz: 6a43f03a98c67a1e84e576ded78d85e1c12812889d691547b0a59889d36f9c7b30d314d885149491652f0b64e874bd96e78d99fe3f5d53529c7cb4d969680f28
7
+ data.tar.gz: c117e01b1a48a62bc4e6020b58553ef495a0f3db2a0c193cc23d0d5ad52f95bd8671415f914cc89ba1512f3bf53994dfe83841af31e0cdfc769e99ed97497750
data/CHANGELOG.md CHANGED
@@ -1,12 +1,17 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.3] - 2023-02-23
4
+
5
+ - Changed: Bump version logic on `Gemfile.lock` file.
6
+ - Removed: `git` actions from `bump_gem_version` script.
7
+
3
8
  ## [0.1.2] - 2023-02-23
4
9
 
5
10
  - Added: `labels` method to bump version according to the first bump type label found from the given list of labels.
6
11
 
7
12
  ## [0.1.1] - 2023-02-21
8
13
 
9
- - Changed: Ruby version to `3.1.3`
14
+ - Changed: Ruby version to `3.1.3`.
10
15
 
11
16
  ## [0.1.0] - 2023-02-21
12
17
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bump_gem_version (0.1.2)
4
+ bump_gem_version (0.1.3)
5
5
  thor (~> 1.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -20,9 +20,18 @@ gem install bump_gem_version
20
20
 
21
21
  ```sh
22
22
  bump_gem_version current # 0.1.0
23
+
23
24
  bump_gem_version patch # 0.1.0 -> 0.1.1
25
+
24
26
  bump_gem_version minor # 0.1.0 -> 0.2.0
27
+
25
28
  bump_gem_version major # 0.1.0 -> 1.0.0
29
+
30
+ # To use with labels
31
+ bump_gem_version labels bug,patch # 0.1.0 -> 0.1.1
32
+ bump_gem_version labels feature,minor,patch # 0.1.0 -> 0.2.0
33
+ bump_gem_version labels breaking,major # 0.1.0 -> 1.0.0
34
+ bump_gem_version labels ${{ join(github.event.pull_request.labels.*.name, ',') }} # For GitHub PR labels
26
35
  ```
27
36
 
28
37
  ## Development
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BumpGemVersion
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -33,10 +33,8 @@ module BumpGemVersion
33
33
  def bump_gem_version(bump_type)
34
34
  file = current_version[1]
35
35
  new_version = updated_version(bump_type)
36
-
37
36
  replace_version_in_file(file, new_version)
38
- system("bundle install && git add Gemfile.lock #{file}")
39
- system("git commit -m 'Bump version to #{new_version}' --no-verify")
37
+ replace_version_in_gemfile_lock_file("Gemfile.lock", new_version)
40
38
  end
41
39
 
42
40
  def updated_version(bump_type)
@@ -91,5 +89,17 @@ module BumpGemVersion
91
89
  content.gsub!(VERSION_REGEX, version)
92
90
  File.write(file, content)
93
91
  end
92
+
93
+ def replace_version_in_gemfile_lock_file(file, version)
94
+ gem_name = current_gem_name
95
+ content = File.read(file)
96
+ content.gsub!(/#{gem_name} \((#{VERSION_REGEX})\)/, "#{gem_name} (#{version})")
97
+ File.write(file, content)
98
+ end
99
+
100
+ def current_gem_name
101
+ gemspec = Dir.glob("*.gemspec").first
102
+ File.read(gemspec)[/spec\.name\s+=\s+['"](.+)['"]/i, 1]
103
+ end
94
104
  end
95
105
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bump_gem_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thejus Paul