bumpversion 0.5.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/lib/bumpversion/bump_string.rb +15 -11
- data/lib/bumpversion/parser.rb +5 -5
- data/lib/bumpversion/version.rb +1 -1
- data/spec/bumpversion_spec.rb +13 -0
- metadata +9 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ee7c37fdf3f69afb4a7b1cf258fc4e19792df1c8cc0d6854d203c951188a33c
|
4
|
+
data.tar.gz: c148c731dec29928cb268cd737c558ad82fc8fa36bfe4b252e189e931fc41c32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa9c7b28bf7c2cbe6487246e68720b7f052ad30296f8b9e9d9bf88056597eaa4638d8fdcbb4a1d20c57b788f7bebd0d8dfdd0f96446ae913c459021637c8e121
|
7
|
+
data.tar.gz: e8254cd6fcb8a3b6711dff7f7d5cd85cb931aeed894d73a0c1463a30d0ea7e32831186d579fcff833f10a655ca7bbe37e07887e9a615428b9005639de59c56c3
|
data/README.md
CHANGED
@@ -8,18 +8,14 @@ Simple command to Bump version your project in shell.
|
|
8
8
|
|
9
9
|
# Screencast
|
10
10
|
|
11
|
-
[![asciicast](
|
11
|
+
[![asciicast](docs/demo.svg)]()
|
12
12
|
|
13
13
|
# Code Status
|
14
14
|
|
15
15
|
Service | Status
|
16
16
|
--------|----------
|
17
|
-
Issues Ready to Work|[![Waffle.io](https://img.shields.io/waffle/label/dlanileonardo/bumpversion/in%20progress.svg?maxAge=2592000&style=flat-square)](https://waffle.io/dlanileonardo/bumpversion)
|
18
17
|
Gems Version|[![Gem](https://img.shields.io/gem/v/bumpversion.svg?maxAge=2592000&style=flat-square)](http://badge.fury.io/rb/bumpversion)
|
19
|
-
|
20
|
-
Coverage|[![Code Climate](https://img.shields.io/codeclimate/coverage/github/dlanileonardo/bumpversion.svg?maxAge=2592000&style=flat-square)](https://codeclimate.com/github/dlanileonardo/bumpversion/coverage)
|
21
|
-
Build Status|[![Travis](https://img.shields.io/travis/dlanileonardo/bumpversion.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/dlanileonardo/bumpversion)
|
22
|
-
Dependencies|[![Gemnasium](https://img.shields.io/gemnasium/dlanileonardo/bumpversion.svg?maxAge=2592000&style=flat-square)]()
|
18
|
+
Build Status|[![CI](https://github.com/dlanileonardo/bumpversion/workflows/CI/badge.svg)](https://github.com/dlanileonardo/bumpversion/actions?query=workflow%3ACI)
|
23
19
|
|
24
20
|
## Installation
|
25
21
|
|
@@ -5,7 +5,7 @@ module Bumpversion
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def dictionary
|
8
|
-
|
8
|
+
%w[major minor patch build].map { |k| k.to_sym }
|
9
9
|
end
|
10
10
|
|
11
11
|
def key_part
|
@@ -13,22 +13,23 @@ module Bumpversion
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def pattern
|
16
|
-
/(
|
16
|
+
/(?<major>\d+).(?<minor>\d+).(?<patch>\d+).?(?<build>\d+)?/
|
17
|
+
end
|
18
|
+
|
19
|
+
def pattern_replace
|
20
|
+
/(?<major>\d+)(?<a>.)(?<minor>\d+)(?<b>.)(?<patch>\d+)(?<c>.)?(?<build>\d+)?/
|
17
21
|
end
|
18
22
|
|
19
23
|
def matched
|
20
|
-
match
|
21
|
-
matched = {}
|
22
|
-
dictionary.each { |part, number| matched[part] = match[number].to_i }
|
23
|
-
matched
|
24
|
+
@match ||= pattern.match(@options[:current_version])
|
24
25
|
end
|
25
26
|
|
26
27
|
def update_version(matched_version)
|
27
28
|
bumped = false
|
28
29
|
matched_version.each do | part, number |
|
29
|
-
matched_version[part] = 0 if bumped
|
30
|
+
matched_version[part] = 0 if bumped && part.to_sym != :build
|
30
31
|
|
31
|
-
if part == key_part
|
32
|
+
if part.to_sym == key_part || part.to_sym == :build
|
32
33
|
matched_version[part] += 1
|
33
34
|
bumped = true
|
34
35
|
end
|
@@ -39,9 +40,12 @@ module Bumpversion
|
|
39
40
|
|
40
41
|
def bump
|
41
42
|
unless @options[:new_version]
|
42
|
-
|
43
|
-
|
44
|
-
@options[:
|
43
|
+
actual_version = matched.named_captures.reject { |k,v| v.nil? }.map { |k, v| [k.to_sym, v.to_i] }.to_h
|
44
|
+
matched_version = update_version(actual_version)
|
45
|
+
new_version = pattern_replace.match(@options[:current_version]).named_captures.map do |k, v|
|
46
|
+
dictionary.include?(k.to_sym) ? "#{matched_version[k.to_sym]}" : v || ""
|
47
|
+
end.join("")
|
48
|
+
@options[:new_version] = new_version
|
45
49
|
end
|
46
50
|
@options
|
47
51
|
end
|
data/lib/bumpversion/parser.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'optimist'
|
2
2
|
require 'bumpversion/version'
|
3
3
|
|
4
4
|
module Bumpversion
|
@@ -10,7 +10,7 @@ module Bumpversion
|
|
10
10
|
|
11
11
|
def mount_banner
|
12
12
|
version_number = VERSION
|
13
|
-
|
13
|
+
Optimist::Parser.new do
|
14
14
|
version "Bumpversion #{version_number} ☺"
|
15
15
|
usage "bumpversion [options] --part [major|minor|patch]
|
16
16
|
where [options] are:"
|
@@ -48,12 +48,12 @@ Usage:
|
|
48
48
|
|
49
49
|
def parse
|
50
50
|
banner = mount_banner
|
51
|
-
@options =
|
52
|
-
fail
|
51
|
+
@options = Optimist.with_standard_exception_handling banner do
|
52
|
+
fail Optimist::HelpNeeded if @args.empty?
|
53
53
|
banner.parse @args
|
54
54
|
end
|
55
55
|
|
56
|
-
|
56
|
+
Optimist.die if @options[:help]
|
57
57
|
|
58
58
|
@options
|
59
59
|
end
|
data/lib/bumpversion/version.rb
CHANGED
data/spec/bumpversion_spec.rb
CHANGED
@@ -74,6 +74,19 @@ describe Bumpversion::Bumpversion do
|
|
74
74
|
it { is_expected.to include current_version: '1.1.1' }
|
75
75
|
it { is_expected.to include new_version: '1.1.2' }
|
76
76
|
end
|
77
|
+
context 'major with build' do
|
78
|
+
let(:arguments) { ['--current-version=1.0.1+10', '--part=major'] }
|
79
|
+
let(:bump_instance) { Bumpversion::Bumpversion.new arguments }
|
80
|
+
subject { bump_instance.instance_variable_get(:@options) }
|
81
|
+
|
82
|
+
it { expect(bump_instance).to be_a Bumpversion::Bumpversion }
|
83
|
+
it { is_expected.to be_a Hash }
|
84
|
+
it { is_expected.to include :help }
|
85
|
+
it { is_expected.to include :part }
|
86
|
+
it { is_expected.to include :file }
|
87
|
+
it { is_expected.to include current_version: '1.0.1+10' }
|
88
|
+
it { is_expected.to include new_version: '2.0.0+11' }
|
89
|
+
end
|
77
90
|
end
|
78
91
|
|
79
92
|
describe 'with file' do
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumpversion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dlani Mendes
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: optimist
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: parseconfig
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,62 +72,6 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 1.2.9
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: bundler
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '1.10'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '1.10'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: rake
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '10.0'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '10.0'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: rspec
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 3.0.0
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 3.0.0
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: rspec-core
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 3.0.0
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 3.0.0
|
131
75
|
description: Bump version by params or config file with Hooks! :).
|
132
76
|
email:
|
133
77
|
- dlanileonardo@gmail.com
|
@@ -158,7 +102,7 @@ homepage: https://github.com/dlanileonardo/bumpversion
|
|
158
102
|
licenses:
|
159
103
|
- MIT
|
160
104
|
metadata: {}
|
161
|
-
post_install_message:
|
105
|
+
post_install_message:
|
162
106
|
rdoc_options: []
|
163
107
|
require_paths:
|
164
108
|
- lib
|
@@ -173,9 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
117
|
- !ruby/object:Gem::Version
|
174
118
|
version: '0'
|
175
119
|
requirements: []
|
176
|
-
|
177
|
-
|
178
|
-
signing_key:
|
120
|
+
rubygems_version: 3.1.2
|
121
|
+
signing_key:
|
179
122
|
specification_version: 4
|
180
123
|
summary: Auto Bump Version to any project
|
181
124
|
test_files:
|