bump_gem_version 0.1.2 → 0.1.4

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: 603350e913c2f96e977ab8322189623061ebae839f475f5d93714cb1f60954ab
4
+ data.tar.gz: d2e9d69fc1a178415ece01586ad5191bc25ad3dbd0a95561b338a62f4c339d45
5
5
  SHA512:
6
- metadata.gz: 7f6f40920043f44e0a8cda4b077928b7c825c6c6d7bef3938982e20a71708b75ea86c0b5f65f5f6b70449d08eef5d934f87d730e04dba140f19f46837a05cac6
7
- data.tar.gz: dd4f17cbaa4ad8acdd9386b283c96218938dc7530d11f205f5a89af1162f8da644398947df4e5aa19273c624d18725de22b1c2ea298c9da5e5ea6fe8d31f69d2
6
+ metadata.gz: 42f4669eef2fb1fddffb56828504d47cdd859de40d828b8390875e7c5c17c71d936dc899c9ae7a12fe362f479e4037377655cc355befc85bdac4f915e946def1
7
+ data.tar.gz: 8fcf11e16d5a80046ed81522c050c5350a71e3bbf7aab3883c04ba776c7838d7281cd1a1a5b7ca0f42ed4ab54afa70b89db9ffee42b6165361a15e8f9a59ea30
data/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.4] - 2023-03-05
4
+
5
+ - Added: `exact` method to bump version to the given version.
6
+
7
+ ## [0.1.3] - 2023-02-23
8
+
9
+ - Changed: Bump version logic on `Gemfile.lock` file.
10
+ - Removed: `git` actions from `bump_gem_version` script.
11
+
3
12
  ## [0.1.2] - 2023-02-23
4
13
 
5
14
  - Added: `labels` method to bump version according to the first bump type label found from the given list of labels.
6
15
 
7
16
  ## [0.1.1] - 2023-02-21
8
17
 
9
- - Changed: Ruby version to `3.1.3`
18
+ - Changed: Ruby version to `3.1.3`.
10
19
 
11
20
  ## [0.1.0] - 2023-02-21
12
21
 
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.4)
5
5
  thor (~> 1.2)
6
6
 
7
7
  GEM
@@ -39,6 +39,7 @@ GEM
39
39
 
40
40
  PLATFORMS
41
41
  arm64-darwin-21
42
+ x86_64-linux
42
43
 
43
44
  DEPENDENCIES
44
45
  bump_gem_version!
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # BumpGemVersion
2
2
 
3
+ ![Gem Version](https://badge.fury.io/rb/bump_gem_version.svg)
4
+ ![Gem](https://img.shields.io/gem/dt/bump_gem_version?color=#6DBE42)
5
+
6
+
3
7
  BumpGemVersion is a gem that will simplify the way you build gems.
4
8
 
5
9
  ## Installation
@@ -20,9 +24,20 @@ gem install bump_gem_version
20
24
 
21
25
  ```sh
22
26
  bump_gem_version current # 0.1.0
27
+
23
28
  bump_gem_version patch # 0.1.0 -> 0.1.1
29
+
24
30
  bump_gem_version minor # 0.1.0 -> 0.2.0
31
+
25
32
  bump_gem_version major # 0.1.0 -> 1.0.0
33
+
34
+ # To use with labels
35
+ bump_gem_version labels bug,patch # 0.1.0 -> 0.1.1
36
+ bump_gem_version labels feature,minor,patch # 0.1.0 -> 0.2.0
37
+ bump_gem_version labels breaking,major # 0.1.0 -> 1.0.0
38
+ bump_gem_version labels ${{ join(github.event.pull_request.labels.*.name, ',') }} # For GitHub PR labels
39
+
40
+ bump_gem_version exact 1.2.3 # 0.1.0 -> 1.2.3
26
41
  ```
27
42
 
28
43
  ## 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.4"
5
5
  end
@@ -28,15 +28,22 @@ module BumpGemVersion
28
28
  bump_type ? bump_gem_version(bump_type) : puts("Error: Unable to find a valid bump label.")
29
29
  end
30
30
 
31
+ desc "exact", "Bump the version of your gem to the given version"
32
+ def exact(version) = bump_exact_version(version)
33
+
31
34
  private
32
35
 
36
+ def bump_exact_version(version)
37
+ file = current_version[1]
38
+ replace_version_in_file(file, version)
39
+ replace_version_in_gemfile_lock_file("Gemfile.lock", version)
40
+ end
41
+
33
42
  def bump_gem_version(bump_type)
34
43
  file = current_version[1]
35
44
  new_version = updated_version(bump_type)
36
-
37
45
  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")
46
+ replace_version_in_gemfile_lock_file("Gemfile.lock", new_version)
40
47
  end
41
48
 
42
49
  def updated_version(bump_type)
@@ -91,5 +98,17 @@ module BumpGemVersion
91
98
  content.gsub!(VERSION_REGEX, version)
92
99
  File.write(file, content)
93
100
  end
101
+
102
+ def replace_version_in_gemfile_lock_file(file, version)
103
+ gem_name = current_gem_name
104
+ content = File.read(file)
105
+ content.gsub!(/#{gem_name} \((#{VERSION_REGEX})\)/, "#{gem_name} (#{version})")
106
+ File.write(file, content)
107
+ end
108
+
109
+ def current_gem_name
110
+ gemspec = Dir.glob("*.gemspec").first
111
+ File.read(gemspec)[/spec\.name\s+=\s+['"](.+)['"]/i, 1]
112
+ end
94
113
  end
95
114
  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.2
4
+ version: 0.1.4
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-23 00:00:00.000000000 Z
11
+ date: 2023-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor