bumpversion 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bumpversion/parser.rb +10 -4
- data/lib/bumpversion/version.rb +1 -1
- data/spec/bumpversion_spec.rb +31 -0
- data/spec/files/VERSION_EXTRA +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d433c8e639a47667e907efe9e0e8e759ddb493e2
|
4
|
+
data.tar.gz: e2b3645a109c84892abc25bb132585a4a7a62a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd4a90be5ceca0ec2fdb8544f3a2a610bc24fc4c91f5e99db57566fffe1cbcf481962c781a4eb690d824abf6f1fa5d8cf8b6fb02852601f4aff92529bb206852
|
7
|
+
data.tar.gz: 02e5ddc014f105bbd3378ffb817d763dbd31321f7d4d5aac5df9f289bdbdcaa548c101a1c22b78dbda57a86ceb5e54a705917d9b11edbca503b46b72f0331225
|
data/lib/bumpversion/parser.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'trollop'
|
2
|
+
require 'bumpversion/version'
|
2
3
|
|
3
4
|
module Bumpversion
|
4
5
|
class Parser
|
@@ -8,14 +9,19 @@ module Bumpversion
|
|
8
9
|
end
|
9
10
|
|
10
11
|
def mount_banner
|
12
|
+
version_number = VERSION
|
11
13
|
Trollop::Parser.new do
|
14
|
+
version "Bumpversion #{version_number} ☺"
|
15
|
+
usage "bumpversion [options] --part [major|minor|patch]
|
16
|
+
where [options] are:"
|
17
|
+
|
12
18
|
banner <<-EOS
|
13
|
-
|
19
|
+
#{version}
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
where [options] are:
|
21
|
+
Usage:
|
22
|
+
#{usage}
|
18
23
|
EOS
|
24
|
+
|
19
25
|
opt :help, 'Show this help!'
|
20
26
|
opt :part, 'The part of the version to increase, [major, minor, patch]', default: 'minor'
|
21
27
|
opt :file, 'The file that will be modified can be multi-files separated by comma.
|
data/lib/bumpversion/version.rb
CHANGED
data/spec/bumpversion_spec.rb
CHANGED
@@ -11,6 +11,16 @@ describe Bumpversion::Bumpversion do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
context 'mount banner' do
|
15
|
+
let(:parser){ Bumpversion::Parser.new({}, {}) }
|
16
|
+
let(:capture_stdout){ StringIO.new }
|
17
|
+
let(:mount_banner){ parser.mount_banner }
|
18
|
+
let!(:educate){ mount_banner.educate(capture_stdout) }
|
19
|
+
subject{ capture_stdout.string }
|
20
|
+
it{ is_expected.to include "Bumpversion" }
|
21
|
+
it{ is_expected.to include Bumpversion::VERSION }
|
22
|
+
end
|
23
|
+
|
14
24
|
describe 'wihout file' do
|
15
25
|
context 'with current and new version' do
|
16
26
|
let(:arguments) { ['--new-version=1.1.0', '--current-version=1.0.0'] }
|
@@ -70,10 +80,12 @@ describe Bumpversion::Bumpversion do
|
|
70
80
|
before do
|
71
81
|
File.write('./spec/files/bumpversion.cfg', "[bumpversion]\ncurrent-version=2.1.1\n")
|
72
82
|
File.write('./spec/files/VERSION', "version=2.1.1\n")
|
83
|
+
File.write('./spec/files/VERSION_EXTRA', "version=2.1.1\n")
|
73
84
|
end
|
74
85
|
after(:all) do
|
75
86
|
File.write('./spec/files/bumpversion.cfg', '')
|
76
87
|
File.write('./spec/files/VERSION', '')
|
88
|
+
File.write('./spec/files/VERSION_EXTRA', '')
|
77
89
|
end
|
78
90
|
context 'patch' do
|
79
91
|
let(:arguments) { ['--config-file=./spec/files/bumpversion.cfg', '--file=./spec/files/VERSION', '--part=patch'] }
|
@@ -129,5 +141,24 @@ describe Bumpversion::Bumpversion do
|
|
129
141
|
expect(File.read('./spec/files/VERSION')).to include("version=3.0.0")
|
130
142
|
end
|
131
143
|
end
|
144
|
+
context 'major with extra file' do
|
145
|
+
let(:arguments) { ['--config-file=./spec/files/bumpversion.cfg', '--file=./spec/files/VERSION,./spec/files/VERSION_EXTRA', '--part=major'] }
|
146
|
+
let(:bump_instance) { Bumpversion::Bumpversion.new arguments }
|
147
|
+
let!(:bump_run) { bump_instance.run }
|
148
|
+
subject { bump_instance.instance_variable_get(:@options) }
|
149
|
+
|
150
|
+
it { expect(bump_instance).to be_a Bumpversion::Bumpversion }
|
151
|
+
it { is_expected.to be_a Hash }
|
152
|
+
it { is_expected.to include :help }
|
153
|
+
it { is_expected.to include :part }
|
154
|
+
it { is_expected.to include :file }
|
155
|
+
it { is_expected.to include current_version: '2.1.1' }
|
156
|
+
it { is_expected.to include new_version: '3.0.0' }
|
157
|
+
it "do bump file" do
|
158
|
+
expect(File.read('./spec/files/bumpversion.cfg')).to include("current-version=3.0.0")
|
159
|
+
expect(File.read('./spec/files/VERSION')).to include("version=3.0.0")
|
160
|
+
expect(File.read('./spec/files/VERSION_EXTRA')).to include("version=3.0.0")
|
161
|
+
end
|
162
|
+
end
|
132
163
|
end
|
133
164
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumpversion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dlani Mendes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/bumpversion/writer.rb
|
152
152
|
- spec/bumpversion_spec.rb
|
153
153
|
- spec/files/VERSION
|
154
|
+
- spec/files/VERSION_EXTRA
|
154
155
|
- spec/files/bumpversion.cfg
|
155
156
|
- spec/spec_helper.rb
|
156
157
|
homepage: https://github.com/dlanileonardo/bumpversion
|
@@ -180,5 +181,6 @@ summary: Auto Bump Version to any project
|
|
180
181
|
test_files:
|
181
182
|
- spec/bumpversion_spec.rb
|
182
183
|
- spec/files/VERSION
|
184
|
+
- spec/files/VERSION_EXTRA
|
183
185
|
- spec/files/bumpversion.cfg
|
184
186
|
- spec/spec_helper.rb
|