mr_bump 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/mr_bump +60 -33
- data/lib/mr_bump.rb +35 -13
- data/spec/mr_bump_spec.rb +200 -1
- data/spec/mr_bump_spec.rb.orig +626 -0
- data/spec/spec_helper.rb +2 -1
- data/spec/version_spec.rb +115 -0
- metadata +7 -53
- data/spec/coverage/assets/0.10.0/application.css +0 -799
- data/spec/coverage/assets/0.10.0/application.js +0 -1707
- data/spec/coverage/assets/0.10.0/colorbox/border.png +0 -0
- data/spec/coverage/assets/0.10.0/colorbox/controls.png +0 -0
- data/spec/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
- data/spec/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
- data/spec/coverage/assets/0.10.0/favicon_green.png +0 -0
- data/spec/coverage/assets/0.10.0/favicon_red.png +0 -0
- data/spec/coverage/assets/0.10.0/favicon_yellow.png +0 -0
- data/spec/coverage/assets/0.10.0/loading.gif +0 -0
- data/spec/coverage/assets/0.10.0/magnify.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/coverage/index.html +0 -72
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjc5ZWMwMzgzODBkNWFmOTJjYmM3MDdkZTA4N2YyOWNjMjYwMjQ3OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDQwYmQzMDQ5NmQ0ODcxNTlhNGM0OGJmZjFhNGVjMThjMTlmNTYxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmRkYTUxZjBiOWU4OThhYzM0Njg0M2YyZjA4ZjJhM2FkOTRiNzY4ZDRjMTNm
|
10
|
+
ODhjYjNjNDBkNGI5YzE5NzU0Njc4ODM1ZmNmYTNhNGI4YzcyZjc0ZGUzNjdl
|
11
|
+
MTMxMThhZTY3MzIyNmJmMzkzOTYxZGFlNjQ1MGQ5MDYyODc2YjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzYwYzUyZWUzYTFlZmJkNWY4MTIxOThhMjg2OWNmNzc4NzI2OGFhODEzODFh
|
14
|
+
MWE0NDMzYTFjNWYzMmUxYWEzMDQ4MzliYTNjOGNkNzE1NDVjMjZmODNmZGE4
|
15
|
+
MmJjZjk5YWNjMWMxODJlNzk1ZDliZTE3MGRkZDYwZDRiY2Y1M2U=
|
data/bin/mr_bump
CHANGED
@@ -60,15 +60,16 @@ end
|
|
60
60
|
|
61
61
|
release = MrBump.on_release_branch?
|
62
62
|
master = MrBump.on_master_branch?
|
63
|
+
develop = MrBump.on_develop_branch?
|
63
64
|
|
64
65
|
changelog = "#{`git rev-parse --show-toplevel`.strip}/CHANGELOG.md"
|
65
66
|
|
66
|
-
unless release || master
|
67
|
+
unless release || master || develop
|
67
68
|
puts 'Need to be on either release or master branch'
|
68
69
|
exit 1
|
69
70
|
end
|
70
71
|
|
71
|
-
unless master || MrBump.current_branch.to_s == MrBump.uat_branch
|
72
|
+
unless master || develop || MrBump.current_branch.to_s == MrBump.uat_branch
|
72
73
|
puts "On release branch '#{MrBump.current_branch}'. " \
|
73
74
|
"Expected release branch '#{MrBump.uat_branch}'"
|
74
75
|
exit 1
|
@@ -82,22 +83,24 @@ unless MrBump.config_file['github_api_token']
|
|
82
83
|
exit 1
|
83
84
|
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
86
|
+
unless develop
|
87
|
+
puts 'Have you already closed your PR?'
|
88
|
+
|
89
|
+
github_client = MrBump::GitApi.new(MrBump.config_file['github_api_token'])
|
90
|
+
menu '[Y]es / [N]o' do |choice|
|
91
|
+
if choice == 'N'
|
92
|
+
puts 'Here are the 10 most recent PRs in your repo:'
|
93
|
+
puts github_client.sorted_prs(MrBump.git_config.path)
|
94
|
+
loop do
|
95
|
+
print 'Enter the PR number to merge : '
|
96
|
+
pr_id = gets.chomp
|
97
|
+
if options[:dryrun]
|
98
|
+
puts "dryrun: Would merge ##{pr_id}"
|
99
|
+
else
|
100
|
+
github_client.merge_pr(MrBump.git_config.path, pr_id)
|
101
|
+
end
|
102
|
+
break
|
99
103
|
end
|
100
|
-
break
|
101
104
|
end
|
102
105
|
end
|
103
106
|
end
|
@@ -129,21 +132,40 @@ unless File.file?(changelog)
|
|
129
132
|
exit 1
|
130
133
|
end
|
131
134
|
|
132
|
-
if
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
if MrBump.release_stale?
|
136
|
+
if release
|
137
|
+
puts 'Error: Master branch contains commits from the release branch.'
|
138
|
+
puts 'This means the release branch has been merged, and a new release branch needs to be made.'
|
139
|
+
puts 'Unable to continue on old release branch.'
|
140
|
+
exit 1
|
141
|
+
elsif master
|
142
|
+
puts 'WARNING: Master branch contains commits from the release branch.'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
last_release = MrBump.last_release
|
147
|
+
unless last_release
|
148
|
+
if master
|
138
149
|
puts "Couldn't detect the version of the master branch. " \
|
139
150
|
'At least one tagged version with version less than the current release version ' \
|
140
151
|
"(#{MrBump.current_uat_major}) needs to exist"
|
141
|
-
|
152
|
+
else
|
153
|
+
puts "Couldn't detect the version of this branch. "
|
142
154
|
end
|
143
|
-
|
155
|
+
exit 1
|
144
156
|
end
|
145
157
|
|
146
|
-
new_release =
|
158
|
+
new_release = MrBump.next_release
|
159
|
+
if develop
|
160
|
+
new_branch = MrBump.release_branch_for_version(new_release)
|
161
|
+
print "You are about to cut a release branch. If you are sure you want to do this type: \n" \
|
162
|
+
" #{new_branch}\n" \
|
163
|
+
'Here: '
|
164
|
+
user_inp = STDIN.readline
|
165
|
+
exit 1 unless user_inp.strip == new_branch
|
166
|
+
end
|
167
|
+
|
168
|
+
changes = MrBump.change_log_items_for_range(last_release, MrBump.current_branch).map(&:to_md)
|
147
169
|
changes = changes.join("\n")
|
148
170
|
md_changes = "# #{new_release}\n#{changes}\n\n"
|
149
171
|
|
@@ -179,17 +201,22 @@ end
|
|
179
201
|
|
180
202
|
if run("git commit -m 'Bump version to #{new_release}' -- #{changelog}") &&
|
181
203
|
run("git tag #{new_release}") &&
|
182
|
-
run('git push && git push --tags')
|
204
|
+
run('git push && git push --tags') &&
|
205
|
+
(!develop || run("git checkout -b #{new_branch} && git push origin #{new_branch}"))
|
183
206
|
MrBump.slack_notifier(new_release, changes) unless options[:dryrun]
|
184
207
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
208
|
+
branch_type = master ? 'master' : 'release'
|
209
|
+
post_bump = MrBump.config_file.fetch('post_bump', {})
|
210
|
+
bump_cmds = [
|
211
|
+
develop ? post_bump['develop'] : nil,
|
212
|
+
post_bump[branch_type]
|
213
|
+
].compact
|
214
|
+
|
215
|
+
unless bump_cmds.empty?
|
189
216
|
puts 'Would you like to execute the following post bump commands?'
|
190
|
-
puts " #{
|
217
|
+
bump_cmds.each.each { |cmd| puts " #{cmd}" }
|
191
218
|
menu '[Y]es execute / [N]o Im done' do |choice|
|
192
|
-
run(
|
219
|
+
bump_cmds.each { |cmd| run(cmd) } if choice == 'Y'
|
193
220
|
end
|
194
221
|
end
|
195
222
|
else
|
data/lib/mr_bump.rb
CHANGED
@@ -11,8 +11,7 @@ require 'mr_bump/change'
|
|
11
11
|
# Add helper functions to the MrBump namespace
|
12
12
|
module MrBump
|
13
13
|
def self.current_branch
|
14
|
-
@current_branch ||= `git rev-parse --abbrev-ref HEAD
|
15
|
-
@current_branch.strip
|
14
|
+
@current_branch ||= `git rev-parse --abbrev-ref HEAD`.strip.freeze
|
16
15
|
end
|
17
16
|
|
18
17
|
def self.release_branch_regex
|
@@ -21,6 +20,12 @@ module MrBump
|
|
21
20
|
"#{prefix}(\\d+\\.\\d+)(\\.\\d+)?#{suffix}"
|
22
21
|
end
|
23
22
|
|
23
|
+
def self.release_branch_for_version(ver)
|
24
|
+
prefix = config_file['release_prefix']
|
25
|
+
suffix = config_file['release_suffix']
|
26
|
+
"#{prefix}#{ver.major}.#{ver.minor}.0#{suffix}"
|
27
|
+
end
|
28
|
+
|
24
29
|
def self.on_release_branch?
|
25
30
|
regex = Regexp.new("^#{release_branch_regex}$")
|
26
31
|
!MrBump.current_branch[regex].nil?
|
@@ -30,6 +35,33 @@ module MrBump
|
|
30
35
|
!MrBump.current_branch[/^master$/].nil?
|
31
36
|
end
|
32
37
|
|
38
|
+
def self.on_develop_branch?
|
39
|
+
!MrBump.current_branch[/^develop$/].nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.release_stale?
|
43
|
+
!`git branch master --contains #{MrBump.current_uat_major}`.strip.empty?
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.last_release
|
47
|
+
if on_release_branch? || (on_master_branch? && release_stale?)
|
48
|
+
MrBump.current_uat
|
49
|
+
elsif on_master_branch?
|
50
|
+
MrBump.current_master
|
51
|
+
elsif on_develop_branch?
|
52
|
+
MrBump.current_uat_major
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.next_release
|
57
|
+
return nil unless last_release
|
58
|
+
if on_release_branch? || on_master_branch?
|
59
|
+
last_release.bump_patch
|
60
|
+
elsif on_develop_branch?
|
61
|
+
last_release.bump_minor
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
33
65
|
def self.latest_release_from_list(branches)
|
34
66
|
regex = Regexp.new("^origin/#{release_branch_regex}$")
|
35
67
|
branches.map do |branch|
|
@@ -44,8 +76,7 @@ module MrBump
|
|
44
76
|
end
|
45
77
|
|
46
78
|
def self.uat_branch
|
47
|
-
|
48
|
-
"#{config['release_prefix']}#{current_uat_major}#{config['release_suffix']}"
|
79
|
+
release_branch_for_version(current_uat_major)
|
49
80
|
end
|
50
81
|
|
51
82
|
def self.all_tags
|
@@ -79,15 +110,6 @@ module MrBump
|
|
79
110
|
log.each_line.map(&:strip).select { |str| !(str.nil? || str == '' || str[0] == '#') }
|
80
111
|
end
|
81
112
|
|
82
|
-
def self.ignored_merges_regex
|
83
|
-
@ignored_merges_regex ||= begin
|
84
|
-
ignored_branch = '(release|master|develop)'
|
85
|
-
regex_pr = "^Merge pull request #\\d+ from Intellection/#{ignored_branch}"
|
86
|
-
regex_manual = "^Merge branch '?#{ignored_branch}"
|
87
|
-
Regexp.new("#{regex_pr}|#{regex_manual}")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
113
|
def self.change_log_items_for_range(rev, head)
|
92
114
|
ignored_branch = Regexp.new("^(#{release_branch_regex}|master|develop)$")
|
93
115
|
make_change = lambda do |title, comment = []|
|
data/spec/mr_bump_spec.rb
CHANGED
@@ -317,6 +317,58 @@ describe MrBump do
|
|
317
317
|
expect(MrBump.on_master_branch?).to eq(false)
|
318
318
|
end
|
319
319
|
end
|
320
|
+
|
321
|
+
context 'when on a branch called develop' do
|
322
|
+
let(:current_branch) { 'develop' }
|
323
|
+
|
324
|
+
it 'returns false' do
|
325
|
+
expect(MrBump.on_master_branch?).to eq(false)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
describe '#on_develop_branch?' do
|
331
|
+
before(:each) { allow(MrBump).to receive(:current_branch).and_return(current_branch) }
|
332
|
+
|
333
|
+
context 'when on a branch called develop' do
|
334
|
+
let(:current_branch) { 'develop' }
|
335
|
+
|
336
|
+
it 'returns true' do
|
337
|
+
expect(MrBump.on_develop_branch?).to eq(true)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
context 'when on a branch called develop$' do
|
342
|
+
let(:current_branch) { 'develop$' }
|
343
|
+
|
344
|
+
it 'returns false' do
|
345
|
+
expect(MrBump.on_develop_branch?).to eq(false)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
context 'when on a branch called ^develop' do
|
350
|
+
let(:current_branch) { '^develop' }
|
351
|
+
|
352
|
+
it 'returns false' do
|
353
|
+
expect(MrBump.on_develop_branch?).to eq(false)
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
context 'when on a branch called release' do
|
358
|
+
let(:current_branch) { 'release' }
|
359
|
+
|
360
|
+
it 'returns false' do
|
361
|
+
expect(MrBump.on_develop_branch?).to eq(false)
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
context 'when on a branch called master' do
|
366
|
+
let(:current_branch) { 'master' }
|
367
|
+
|
368
|
+
it 'returns false' do
|
369
|
+
expect(MrBump.on_develop_branch?).to eq(false)
|
370
|
+
end
|
371
|
+
end
|
320
372
|
end
|
321
373
|
|
322
374
|
describe '#on_release_branch?' do
|
@@ -361,6 +413,14 @@ describe MrBump do
|
|
361
413
|
expect(MrBump.on_release_branch?).to eq(true)
|
362
414
|
end
|
363
415
|
end
|
416
|
+
|
417
|
+
context 'when on a branch called develop' do
|
418
|
+
let(:current_branch) { 'develop' }
|
419
|
+
|
420
|
+
it 'returns false' do
|
421
|
+
expect(MrBump.on_master_branch?).to eq(false)
|
422
|
+
end
|
423
|
+
end
|
364
424
|
end
|
365
425
|
|
366
426
|
context 'with altered config' do
|
@@ -430,7 +490,7 @@ describe MrBump do
|
|
430
490
|
end
|
431
491
|
end
|
432
492
|
|
433
|
-
describe '#' do
|
493
|
+
describe '#change_log_items_for_range' do
|
434
494
|
let(:log) do
|
435
495
|
[
|
436
496
|
'Merge pull request #4 from mr_bump/hotfix/DEV-1261',
|
@@ -461,4 +521,143 @@ describe MrBump do
|
|
461
521
|
end
|
462
522
|
end
|
463
523
|
end
|
524
|
+
|
525
|
+
describe '#last_release' do
|
526
|
+
before do
|
527
|
+
allow(MrBump).to receive(:current_uat).and_return(MrBump::Version.new('0.1.3'))
|
528
|
+
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new('0.1.0'))
|
529
|
+
allow(MrBump).to receive(:current_master).and_return(MrBump::Version.new('0.0.1'))
|
530
|
+
end
|
531
|
+
|
532
|
+
context 'when on master branch' do
|
533
|
+
before do
|
534
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(true)
|
535
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
536
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
537
|
+
allow(MrBump).to receive(:release_stale?).and_return(false)
|
538
|
+
end
|
539
|
+
|
540
|
+
it 'returns the master version' do
|
541
|
+
expect(MrBump.last_release).to eq(MrBump::Version.new('0.0.1'))
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
context 'when on master with stale release branch' do
|
546
|
+
before do
|
547
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(true)
|
548
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
549
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
550
|
+
allow(MrBump).to receive(:release_stale?).and_return(true)
|
551
|
+
end
|
552
|
+
|
553
|
+
it 'returns the master version' do
|
554
|
+
expect(MrBump.last_release).to eq(MrBump::Version.new('0.1.3'))
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
context 'when on release branch' do
|
559
|
+
before do
|
560
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
561
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(true)
|
562
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
563
|
+
allow(MrBump).to receive(:release_stale?).and_return(false)
|
564
|
+
end
|
565
|
+
|
566
|
+
it 'returns the release version' do
|
567
|
+
expect(MrBump.last_release).to eq(MrBump::Version.new('0.1.3'))
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
|
572
|
+
context 'when on develop branch' do
|
573
|
+
before do
|
574
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
575
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
576
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(true)
|
577
|
+
allow(MrBump).to receive(:release_stale?).and_return(false)
|
578
|
+
end
|
579
|
+
|
580
|
+
it 'returns the last release version' do
|
581
|
+
expect(MrBump.last_release).to eq(MrBump::Version.new('0.1.0'))
|
582
|
+
end
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
describe '#next_release' do
|
587
|
+
before do
|
588
|
+
allow(MrBump).to receive(:current_uat).and_return(MrBump::Version.new('0.1.3'))
|
589
|
+
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new('0.1.0'))
|
590
|
+
allow(MrBump).to receive(:current_master).and_return(MrBump::Version.new('0.0.1'))
|
591
|
+
end
|
592
|
+
|
593
|
+
context 'when on master branch' do
|
594
|
+
before do
|
595
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(true)
|
596
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
597
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
598
|
+
allow(MrBump).to receive(:release_stale?).and_return(false)
|
599
|
+
end
|
600
|
+
|
601
|
+
it 'returns the master version + a patch' do
|
602
|
+
expect(MrBump.next_release).to eq(MrBump::Version.new('0.0.2'))
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
context 'when on master with stale release branch' do
|
607
|
+
before do
|
608
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(true)
|
609
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
610
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
611
|
+
allow(MrBump).to receive(:release_stale?).and_return(true)
|
612
|
+
end
|
613
|
+
|
614
|
+
it 'returns the release version' do
|
615
|
+
expect(MrBump.next_release).to eq(MrBump::Version.new('0.1.4'))
|
616
|
+
end
|
617
|
+
end
|
618
|
+
|
619
|
+
context 'when on release branch' do
|
620
|
+
before do
|
621
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
622
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(true)
|
623
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
624
|
+
allow(MrBump).to receive(:release_stale?).and_return(false)
|
625
|
+
end
|
626
|
+
|
627
|
+
it 'returns the release version' do
|
628
|
+
expect(MrBump.next_release).to eq(MrBump::Version.new('0.1.4'))
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
context 'when on develop branch' do
|
633
|
+
before do
|
634
|
+
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
635
|
+
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
636
|
+
allow(MrBump).to receive(:on_develop_branch?).and_return(true)
|
637
|
+
allow(MrBump).to receive(:release_stale?).and_return(false)
|
638
|
+
end
|
639
|
+
|
640
|
+
it 'returns the release version plus a minor' do
|
641
|
+
expect(MrBump.next_release).to eq(MrBump::Version.new('0.2.0'))
|
642
|
+
end
|
643
|
+
end
|
644
|
+
end
|
645
|
+
|
646
|
+
describe '#file_prepend' do
|
647
|
+
it 'prepends to files' do
|
648
|
+
file = 'filename.md'
|
649
|
+
before = 'String before'
|
650
|
+
prepend_str = 'Sting to prepend. '
|
651
|
+
after = prepend_str + before
|
652
|
+
|
653
|
+
read_buffer = StringIO.new before
|
654
|
+
write_buffer = StringIO.new
|
655
|
+
|
656
|
+
allow(File).to receive(:open).with(file, 'r').and_yield(read_buffer)
|
657
|
+
allow(File).to receive(:open).with(file, 'w').and_yield(write_buffer)
|
658
|
+
|
659
|
+
MrBump.file_prepend(file, prepend_str)
|
660
|
+
expect(write_buffer.string).to eq(after)
|
661
|
+
end
|
662
|
+
end
|
464
663
|
end
|