bump_gem_version 0.1.1 → 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: 3d7330021c3ef70e48c1efbed31c775b4d1749757c268a89e30b7a865fe8d7f6
4
- data.tar.gz: 28a2e83529e880c1d51194ce9702812ba8460c5246c466ac87e98630d48172b6
3
+ metadata.gz: 4cd19c397da6310e2469d6e7fd5cab35e0654e29bf879c6fcb41b6d192db4882
4
+ data.tar.gz: 20fe21b1e32cb4592d1740268450b05526648e784475da8f5a21b39499c4b551
5
5
  SHA512:
6
- metadata.gz: d0939d7441f84c9fca05b36273e8da9cc121fd2861cd8a60ad95c83f6100991b943fa1f5296a624f13e0952fe3d1004eafb42e6ef0c936d5eba874eeca797e0a
7
- data.tar.gz: 2ade5877cc747f14489563b18b93c656830e1b1436395a1a9e32403d727c6cb7ab814c96de2c7b46d544cd2937f7ab2a7e05c87961d67e2783c757698b231e8c
6
+ metadata.gz: 6a43f03a98c67a1e84e576ded78d85e1c12812889d691547b0a59889d36f9c7b30d314d885149491652f0b64e874bd96e78d99fe3f5d53529c7cb4d969680f28
7
+ data.tar.gz: c117e01b1a48a62bc4e6020b58553ef495a0f3db2a0c193cc23d0d5ad52f95bd8671415f914cc89ba1512f3bf53994dfe83841af31e0cdfc769e99ed97497750
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
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
+
8
+ ## [0.1.2] - 2023-02-23
9
+
10
+ - Added: `labels` method to bump version according to the first bump type label found from the given list of labels.
11
+
12
+ ## [0.1.1] - 2023-02-21
13
+
14
+ - Changed: Ruby version to `3.1.3`.
15
+
3
16
  ## [0.1.0] - 2023-02-21
4
17
 
5
18
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bump_gem_version (0.1.1)
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.1"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -22,15 +22,19 @@ module BumpGemVersion
22
22
  desc "patch", "Bump the patch version of your gem"
23
23
  def patch = bump_gem_version("patch")
24
24
 
25
+ desc "label", "Bump the version of your gem from the given labels"
26
+ def labels(labels)
27
+ bump_type = labels.split(",").find { |label| BUMPS.include?(label) }
28
+ bump_type ? bump_gem_version(bump_type) : puts("Error: Unable to find a valid bump label.")
29
+ end
30
+
25
31
  private
26
32
 
27
33
  def bump_gem_version(bump_type)
28
34
  file = current_version[1]
29
35
  new_version = updated_version(bump_type)
30
-
31
36
  replace_version_in_file(file, new_version)
32
- system("bundle install && git add Gemfile.lock #{file}")
33
- system("git commit -m 'Bump version to #{new_version}' --no-verify")
37
+ replace_version_in_gemfile_lock_file("Gemfile.lock", new_version)
34
38
  end
35
39
 
36
40
  def updated_version(bump_type)
@@ -52,7 +56,7 @@ module BumpGemVersion
52
56
  version_from_version_rb ||
53
57
  version_from_lib_rb
54
58
  )
55
- puts "Unable to find the version." unless version
59
+ puts "Error: Unable to find the version." unless version
56
60
 
57
61
  [version, file]
58
62
  end
@@ -85,5 +89,17 @@ module BumpGemVersion
85
89
  content.gsub!(VERSION_REGEX, version)
86
90
  File.write(file, content)
87
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
88
104
  end
89
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bump_gem_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thejus Paul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-22 00:00:00.000000000 Z
11
+ date: 2023-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor