git-release 0.0.1

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.
@@ -0,0 +1,10 @@
1
+ #!/bin/bash -e
2
+
3
+ #Manifest to ensure correct loading of all files in order.
4
+ # Use to handle sourcing all required files.
5
+ # Loading example: . "${BASH_SOURCE[0]%/*}/../support/support-functions.sh"
6
+
7
+ . "${BASH_SOURCE[0]%/*}/language-bash.sh"
8
+ . "${BASH_SOURCE[0]%/*}/git-functions.sh"
9
+ . "${BASH_SOURCE[0]%/*}/git-release-functions.sh"
10
+ . "${BASH_SOURCE[0]%/*}/changelog-functions.sh"
@@ -0,0 +1,7 @@
1
+ #!/bin/bash -e
2
+
3
+ DIR=$(dirname $0)
4
+
5
+ time $DIR/../support/roundup $DIR/../{integration,unit}/*
6
+
7
+
@@ -0,0 +1,359 @@
1
+ #!/bin/bash -e
2
+
3
+ . ./test/test_helper.sh
4
+ . ./support/support-functions.sh
5
+
6
+ rup() { ./bin/git-release-deployed $@; }
7
+ sandbox_rup() { /bin/bash ../bin/git-release-deployed $@; }
8
+
9
+ usage_head="++ /bin/bash ../bin/git-release-deployed
10
+ Required parameter: Please enter the deploy tag released.
11
+
12
+ usage : git-release-deployed $(arg_for $ARG_DEPLOYED_TAG '<deployed_tag>') [$(arg_for $ARG_RELEASE_PREFIX '<prefix>')] [$(arg_for $ARG_START '<start>')] [$(arg_for $ARG_FINISH '<finish>')]"
13
+
14
+ describe "git-release-deployed - integration"
15
+
16
+ after() {
17
+ if [[ $MAINTAIN_SANDBOX != true ]]; then
18
+ remove_sandbox
19
+ fi;
20
+ }
21
+
22
+ ### Failure Cases
23
+
24
+ it_will_fail_with_no_deployed_tag() {
25
+ generate_git_repo
26
+
27
+ should_fail $(sandbox_rup)
28
+ }
29
+
30
+ it_will_display_help_text_on_fail() {
31
+ generate_git_repo
32
+
33
+ local output=$(sandbox_rup 2>&1 | head -n 4 2>&1)
34
+ test "$output" = "$usage_head"
35
+ }
36
+
37
+ it_will_display_error_when_no_git_directory_exists() {
38
+ enter_sandbox
39
+
40
+ local output=$(sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'AnyDeployTag') 2>&1 | head -n 2 2>&1)
41
+ local missing_git="Error - Not a git repository please run from the base of your git repo."
42
+
43
+ test $(search_substring "$output" "$missing_git") = 'found'
44
+ }
45
+
46
+ it_will_error_if_git_is_in_a_dirty_state() {
47
+ local tag_name='MyReleases/v1.0.3'
48
+ local tags=("${tag_name}")
49
+ generate_sandbox_tags tags[@]
50
+
51
+ should_succeed $(sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "$tag_name"))
52
+
53
+ touch 'FileToMakeGitDirty'
54
+
55
+ should_fail $(sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "$tag_name"))
56
+
57
+ rm 'FileToMakeGitDirty'
58
+
59
+ should_succeed $(sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "$tag_name"))
60
+ }
61
+
62
+ it_will_forcibly_replace_existing_deploy_tags() {
63
+ local tag_name="MyReleases/v1.0.3"
64
+ local tags=("${tag_name}")
65
+ generate_sandbox_tags tags[@]
66
+
67
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "$tag_name")
68
+
69
+ file_should_exist "CHANGELOG"
70
+ file_should_not_exist "CHANGELOG2"
71
+
72
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "$tag_name") $(arg_for $ARG_CHANGELOG 'CHANGELOG2')
73
+
74
+ file_should_not_exist "CHANGELOG"
75
+ file_should_exist "CHANGELOG2"
76
+
77
+ #Explicitly checkout the deploy tag in current state
78
+ git checkout -f -B "deployed/MyReleases/v1.0.3"
79
+
80
+ file_should_not_exist "CHANGELOG"
81
+ file_should_exist "CHANGELOG2"
82
+ }
83
+
84
+ it_will_error_if_deploy_tag_cannot_be_found(){
85
+ local tag_name='found/v1.0.3'
86
+ local tags=("${tag_name}")
87
+ generate_sandbox_tags tags[@]
88
+
89
+ should_succeed $(sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "$tag_name"))
90
+ should_fail $(sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'cannotFindThisTag'))
91
+ }
92
+
93
+ # ### Success cases
94
+
95
+ it_will_genereate_a_new_deploy_tag_for_each_release() {
96
+ local tags=( "release/production/v3.1.9" )
97
+ generate_sandbox_tags tags[@]
98
+
99
+ should_succeed $(check_tag_exists "release/production/v3.1.9")
100
+ should_fail $(check_tag_exists "deployed/release/production/v3.1.9")
101
+
102
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "release/production/v3.1.9")
103
+
104
+ should_succeed $(check_tag_exists "deployed/release/production/v3.1.9")
105
+ }
106
+
107
+ it_will_genereate_a_new_deploy_tag_for_each_release_overwriting_any_existing() {
108
+ local tags=( "release/production/v3.1.9" )
109
+ generate_sandbox_tags tags[@]
110
+
111
+ should_succeed $(check_tag_exists "release/production/v3.1.9")
112
+ should_fail $(check_tag_exists "deployed/release/production/v3.1.9")
113
+
114
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/production/v3.1.9')
115
+
116
+ should_succeed $(check_tag_exists "deployed/release/production/v3.1.9")
117
+ file_should_exist 'CHANGELOG'
118
+ file_should_not_exist 'DifferentFile'
119
+
120
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/production/v3.1.9') $(arg_for $ARG_CHANGELOG 'DifferentFile')
121
+
122
+ should_succeed $(check_tag_exists "deployed/release/production/v3.1.9")
123
+ file_should_not_exist 'CHANGELOG'
124
+ file_should_exist 'DifferentFile'
125
+ }
126
+
127
+ it_will_genereate_a_new_deploy_tag_for_next_release_with_defaults() {
128
+ #From last deployed tag
129
+ #With anything else in HEAD
130
+ #Overwrite any existing tag
131
+
132
+ local tags=(
133
+ 'release/v1.0.5'
134
+ 'deployed/release/v1.0.5'
135
+ 'release/v1.0.6'
136
+ )
137
+ local commit_messages=(
138
+ '[Any Old] Message for 1.0.5'
139
+ 'The last deployed release'
140
+ 'latest commit message to 1.0.6'
141
+ )
142
+
143
+ generate_sandbox_tags tags[@] commit_messages[@]
144
+
145
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.6')
146
+
147
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
148
+ || Release: 1.0.6
149
+ || Released on $(get_current_release_date)
150
+ $(changelog_divider)
151
+ latest commit message to 1.0.6
152
+ The last deployed release
153
+ $(changelog_divider)
154
+ $(changelog_footer)"
155
+
156
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.6') $(arg_for $ARG_CHANGELOG 'DiffChangeLog')
157
+ file_should_not_exist 'CHANGELOG'
158
+
159
+ test "$(cat DiffChangeLog)" = "$(changelog_divider)
160
+ || Release: 1.0.6
161
+ || Released on $(get_current_release_date)
162
+ $(changelog_divider)
163
+ latest commit message to 1.0.6
164
+ The last deployed release
165
+ $(changelog_divider)
166
+ $(changelog_footer)"
167
+ }
168
+
169
+ it_will_generate_a_deploy_changelog_for_a_set_starting_point() {
170
+ local tags=(
171
+ 'release/v1.0.4'
172
+ 'release/v1.0.5'
173
+ 'release/v1.0.6'
174
+ )
175
+ local commit_messages=(
176
+ 'commit message for 1.0.4'
177
+ '[Any Old] Message for 1.0.5'
178
+ 'latest commit message to 1.0.6'
179
+ )
180
+
181
+ generate_sandbox_tags tags[@] commit_messages[@]
182
+
183
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.6')
184
+
185
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
186
+ || Release: 1.0.6
187
+ || Released on $(get_current_release_date)
188
+ $(changelog_divider)
189
+ latest commit message to 1.0.6
190
+ [Any Old] Message for 1.0.5
191
+ commit message for 1.0.4
192
+ Initial Commit
193
+ $(changelog_divider)
194
+ $(changelog_footer)"
195
+
196
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.6') $(arg_for $ARG_START 'release/v1.0.5')
197
+
198
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
199
+ || Release: 1.0.6
200
+ || Released on $(get_current_release_date)
201
+ $(changelog_divider)
202
+ latest commit message to 1.0.6
203
+ [Any Old] Message for 1.0.5
204
+ $(changelog_divider)
205
+ $(changelog_footer)"
206
+ }
207
+
208
+ it_will_generate_a_deploy_changelog_for_a_set_range_with_start_and_end() {
209
+ local tags=(
210
+ 'release/v1.0.4'
211
+ 'release/v1.0.5'
212
+ 'release/v1.0.6'
213
+ )
214
+ local commit_messages=(
215
+ 'commit message for 1.0.4'
216
+ '[Any Old] Message for 1.0.5'
217
+ 'latest commit message to 1.0.6'
218
+ )
219
+
220
+ generate_sandbox_tags tags[@] commit_messages[@]
221
+
222
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.6') $(arg_for $ARG_START 'release/v1.0.4') $(arg_for $ARG_FINISH 'release/v1.0.5')
223
+
224
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
225
+ || Release: 1.0.6
226
+ || Released on $(get_current_release_date)
227
+ $(changelog_divider)
228
+ [Any Old] Message for 1.0.5
229
+ commit message for 1.0.4
230
+ $(changelog_divider)
231
+ $(changelog_footer)"
232
+ }
233
+
234
+ it_will_generate_a_deploy_changelog_with_optional_names() {
235
+ local tags=(
236
+ 'release/v1.0.5'
237
+ 'release/v1.0.6'
238
+ )
239
+ local commit_messages=(
240
+ '[Any Old] Message for 1.0.5'
241
+ 'latest commit message to 1.0.6'
242
+ )
243
+
244
+ generate_sandbox_tags tags[@] commit_messages[@]
245
+
246
+ file_should_not_exist "CHANGELOG"
247
+
248
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.6')
249
+
250
+ file_should_exist "CHANGELOG"
251
+
252
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG "release/v1.0.6") $(arg_for $ARG_CHANGELOG "NewChangeLog")
253
+
254
+ file_should_not_exist 'CHANGELOG'
255
+ file_should_exist "NewChangeLog"
256
+ }
257
+
258
+ it_will_generate_a_deploy_changelog_file_scoped_to_pull_requests() {
259
+ local tags=(
260
+ 'tag_with_pulls/1'
261
+ 'tag_with_pulls/2'
262
+ 'tag_without_pulls/1'
263
+ 'tag_with_pulls/3'
264
+ 'tag_with_pulls/4'
265
+ 'releases/v0.0.1'
266
+ )
267
+ local commit_messages=(
268
+ "Merge pull request #705 from Ferocia/bug/limit-payment-description-length
269
+
270
+ [BUG] Pay anyone from the accounts screen"
271
+ "Merge pull request #722 from Ferocia/feature/running-balance-field (Anthony Langhorne, 18 hours ago)
272
+
273
+ [Features] This is a pull request merging a feature across multiple
274
+ lines and continuing"
275
+ " A commit,that isn't a pull request"
276
+ "Merge pull request #714 from Ferocia/fix-customer-login
277
+
278
+ Fixing the customer login but no tag displayed."
279
+ "Merge pull request #685 from Ferocia/bug/modal-new-payee
280
+
281
+ [Security] Commit fixing the modal with security flaw"
282
+ )
283
+
284
+ generate_sandbox_tags tags[@] commit_messages[@]
285
+
286
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'releases/v0.0.1') $(arg_for $ARG_PULL_REQUESTS)
287
+
288
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
289
+ || Release: 0.0.1
290
+ || Released on $(get_current_release_date)
291
+ $(changelog_divider)
292
+ Features:
293
+ This is a pull request merging a feature across multiple
294
+ lines and continuing
295
+
296
+ Security:
297
+ Commit fixing the modal with security flaw
298
+
299
+ Bugs:
300
+ Pay anyone from the accounts screen
301
+
302
+ Fixing the customer login but no tag displayed.
303
+ $(changelog_divider)
304
+ $(changelog_footer)"
305
+ }
306
+
307
+ it_will_append_to_a_deploy_changelog_optionally(){
308
+ local tags=(
309
+ 'release/v1.0.4'
310
+ 'release/v1.0.5'
311
+ 'release/v1.0.6'
312
+ )
313
+ local commit_messages=(
314
+ 'commit message for 1.0.4'
315
+ '[Any Old] Message for 1.0.5'
316
+ 'latest commit message to 1.0.6'
317
+ )
318
+
319
+ generate_sandbox_tags tags[@] commit_messages[@]
320
+
321
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.4')
322
+
323
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
324
+ || Release: 1.0.4
325
+ || Released on $(get_current_release_date)
326
+ $(changelog_divider)
327
+ commit message for 1.0.4
328
+ Initial Commit
329
+ $(changelog_divider)
330
+ $(changelog_footer)"
331
+
332
+ #Add current changelog to tag
333
+ git checkout release/v1.0.5
334
+ git merge deployed/release/v1.0.4
335
+ git tag -f release/v1.0.5
336
+ git checkout master
337
+
338
+ sandbox_rup $(arg_for $ARG_DEPLOYED_TAG 'release/v1.0.5') $(arg_for $ARG_APPEND)
339
+
340
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
341
+ || Release: 1.0.5
342
+ || Released on $(get_current_release_date)
343
+ $(changelog_divider)
344
+ Merge tag 'deployed/release/v1.0.4' into HEAD
345
+ [Any Old] Message for 1.0.5
346
+ Release deployed : release/v1.0.4
347
+ $(changelog_divider)
348
+ $(changelog_divider)
349
+ || Release: 1.0.4
350
+ || Released on $(get_current_release_date)
351
+ $(changelog_divider)
352
+ commit message for 1.0.4
353
+ Initial Commit
354
+ $(changelog_divider)
355
+ $(changelog_footer)"
356
+ }
357
+
358
+ #TODO
359
+ # it_will_optionally_force_push_of_tag()
@@ -0,0 +1,409 @@
1
+ #!/bin/bash -e
2
+
3
+ . ./test/test_helper.sh
4
+ . ./support/support-functions.sh
5
+
6
+ rup() { ./bin/git-release $@; }
7
+ sandbox_rup() { /bin/bash ../bin/git-release $@; }
8
+
9
+ usage_head="++ /bin/bash ../bin/git-release
10
+ incorrect versioning type: ''
11
+ Please set to one of 'major', 'minor' or 'patch'
12
+
13
+ usage : git-release $(arg_for $ARG_VERSION '<version>') [$(arg_for $ARG_RELEASE_PREFIX '<prefix>')] [$(arg_for $ARG_START '<start>')] [$(arg_for $ARG_FINISH '<finish>')]"
14
+
15
+ describe "git-release - integration"
16
+
17
+ after() {
18
+ if [[ $MAINTAIN_SANDBOX != true ]]; then
19
+ remove_sandbox
20
+ fi;
21
+ }
22
+
23
+ ### Failure Cases
24
+
25
+ it_will_fail_with_no_versioning_type() {
26
+ ! rup
27
+ }
28
+
29
+ it_will_display_help_text_on_fail() {
30
+ generate_git_repo
31
+
32
+ local output=$(sandbox_rup 2>&1 | head -n 5 2>&1)
33
+ test "$output" = "$usage_head"
34
+ }
35
+
36
+ it_will_display_error_when_no_git_directory_exists() {
37
+ enter_sandbox
38
+
39
+ local output=$(sandbox_rup $(arg_for $ARG_VERSION 'patch') 2>&1 | head -n 2 2>&1)
40
+ local missing_git="Error - Not a git repository please run from the base of your git repo."
41
+
42
+ test $(search_substring "$output" "$missing_git") = 'found'
43
+ }
44
+
45
+ it_will_error_if_git_is_in_a_dirty_state() {
46
+ generate_git_repo
47
+
48
+ should_succeed $(sandbox_rup $(arg_for $ARG_VERSION 'minor'))
49
+
50
+ touch 'FileToMakeGitDirty'
51
+
52
+ should_fail $(sandbox_rup $(arg_for $ARG_VERSION 'minor'))
53
+
54
+ rm 'FileToMakeGitDirty'
55
+
56
+ should_succeed $(sandbox_rup $(arg_for $ARG_VERSION 'minor'))
57
+ }
58
+
59
+ ### Success cases
60
+
61
+ it_will_genereate_a_new_tag_for_next_release() {
62
+ local tags=(
63
+ "release/v1.0.5"
64
+ "release/production/v3.1.9"
65
+ )
66
+ generate_sandbox_tags tags[@]
67
+
68
+ should_succeed $(check_tag_exists "release/production/v3.1.9")
69
+ should_fail $(check_tag_exists "release/production/v3.1.10")
70
+
71
+ sandbox_rup $(arg_for $ARG_VERSION 'patch') $(arg_for $ARG_RELEASE_PREFIX 'release/production/v')
72
+
73
+ should_succeed $(check_tag_exists "release/production/v3.1.10")
74
+ }
75
+
76
+ it_will_genereate_a_new_tag_for_next_release_with_defaults() {
77
+ local tags=(
78
+ "release/v1.0.5"
79
+ "random_tag_2"
80
+ "release/v1.0.6"
81
+ )
82
+ generate_sandbox_tags tags[@]
83
+
84
+ should_succeed $(check_tag_exists "release/v1.0.6")
85
+ should_fail $(check_tag_exists "release/v1.1.6")
86
+
87
+ sandbox_rup $(arg_for $ARG_VERSION 'minor')
88
+
89
+ should_succeed $(check_tag_exists "release/v1.1.6")
90
+ }
91
+
92
+ it_will_genereate_a_new_tag_for_next_release_when_none_exist() {
93
+ generate_git_repo
94
+
95
+ should_fail $(check_tag_exists "my-release/yay-1.0.0")
96
+ should_fail $(check_tag_exists "my-release/yay-1.1.0")
97
+
98
+ sandbox_rup $(arg_for $ARG_VERSION 'major') $(arg_for $ARG_RELEASE_PREFIX 'my-release/yay-')
99
+
100
+ should_succeed $(check_tag_exists "my-release/yay-1.0.0")
101
+ should_fail $(check_tag_exists "my-release/yay-1.1.0")
102
+
103
+ sandbox_rup $(arg_for $ARG_VERSION 'minor') $(arg_for $ARG_RELEASE_PREFIX 'my-release/yay-')
104
+
105
+ should_succeed $(check_tag_exists "my-release/yay-1.0.0")
106
+ should_succeed $(check_tag_exists "my-release/yay-1.1.0")
107
+ }
108
+
109
+ it_will_generate_files_by_default_from_last_tag_to_head() {
110
+ local tags=(
111
+ 'random_tag_1'
112
+ 'release/v1.0.5'
113
+ 'random_tag_2'
114
+ 'release/v1.0.6'
115
+ )
116
+ local commit_messages=(
117
+ 'Message For Random Tag 1'
118
+ '[Any Old] Message for 1.0.5'
119
+ 'Lots of changes in this commit for random tag 2'
120
+ 'latest commit message to 1.0.6'
121
+ )
122
+
123
+ generate_sandbox_tags tags[@] commit_messages[@]
124
+
125
+ sandbox_rup $(arg_for $ARG_VERSION 'major') $(arg_for $ARG_RELEASE_PREFIX 'release/v')
126
+
127
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
128
+ || Release: 2.0.6
129
+ || Released on $(get_current_release_date)
130
+ $(changelog_divider)
131
+ latest commit message to 1.0.6
132
+ $(changelog_divider)
133
+ $(changelog_footer)"
134
+
135
+ test "$(cat VERSION)" = "2.0.6"
136
+ }
137
+
138
+ it_will_generate_a_changelog_for_a_set_starting_point() {
139
+ local tags=(
140
+ 'random_commit_1'
141
+ 'release/v1.0.5'
142
+ 'random_commit_2'
143
+ 'release/v1.0.6'
144
+ )
145
+ local commit_messages=(
146
+ 'Message For Random Commit 1'
147
+ '[Any Old] Message for 1.0.5'
148
+ 'Lots of changes in this commit for random commit 2'
149
+ 'latest commit message to 1.0.6'
150
+ )
151
+
152
+ generate_sandbox_tags tags[@] commit_messages[@]
153
+
154
+ sandbox_rup $(arg_for $ARG_VERSION 'patch') $(arg_for $ARG_RELEASE_PREFIX 'release/v') $(arg_for $ARG_START 'release/v1.0.5')
155
+
156
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
157
+ || Release: 1.0.7
158
+ || Released on $(get_current_release_date)
159
+ $(changelog_divider)
160
+ latest commit message to 1.0.6
161
+ Lots of changes in this commit for random commit 2
162
+ [Any Old] Message for 1.0.5
163
+ $(changelog_divider)
164
+ $(changelog_footer)"
165
+
166
+ test "$(cat VERSION)" = "1.0.7"
167
+ }
168
+
169
+ it_will_generate_a_changelog_for_a_set_range_with_start_and_end() {
170
+ local tags=(
171
+ 'release/v1.0.4'
172
+ 'random_commit_1'
173
+ 'release/v1.0.5'
174
+ 'random_commit_2'
175
+ 'release/v1.0.6'
176
+ )
177
+ local commit_messages=(
178
+ 'Commit for last released start point 1.0.4'
179
+ 'Message For Random Commit 1'
180
+ '[Any Old] Message for 1.0.5'
181
+ 'Lots of changes in this commit for random commit 2'
182
+ 'latest commit message to 1.0.6'
183
+ )
184
+
185
+ generate_sandbox_tags tags[@] commit_messages[@]
186
+
187
+ sandbox_rup $(arg_for $ARG_VERSION 'minor') $(arg_for $ARG_RELEASE_PREFIX 'release/v') $(arg_for $ARG_START 'release/v1.0.5') $(arg_for $ARG_FINISH 'release/v1.0.6')
188
+
189
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
190
+ || Release: 1.1.6
191
+ || Released on $(get_current_release_date)
192
+ $(changelog_divider)
193
+ latest commit message to 1.0.6
194
+ Lots of changes in this commit for random commit 2
195
+ [Any Old] Message for 1.0.5
196
+ $(changelog_divider)
197
+ $(changelog_footer)"
198
+
199
+ test "$(cat VERSION)" = "1.1.6"
200
+ }
201
+
202
+
203
+ it_will_generate_files_with_optional_names() {
204
+ local tags=(
205
+ 'release/v1.0.5'
206
+ 'release/v1.0.6'
207
+ )
208
+ local commit_messages=(
209
+ '[Any Old] Message for 1.0.5'
210
+ 'latest commit message to 1.0.6'
211
+ )
212
+
213
+ generate_sandbox_tags tags[@] commit_messages[@]
214
+
215
+ sandbox_rup $(arg_for $ARG_VERSION 'major') $(arg_for $ARG_CHANGELOG 'MYCHANGELOG') $(arg_for $ARG_VERSION_FILE 'VERSION_NUMBER')
216
+
217
+ file_should_not_exist "CHANGELOG"
218
+ file_should_not_exist "VERSION"
219
+ file_should_exist "MYCHANGELOG"
220
+ file_should_exist "VERSION_NUMBER"
221
+
222
+ test "$(cat MYCHANGELOG)" = "$(changelog_divider)
223
+ || Release: 2.0.6
224
+ || Released on $(get_current_release_date)
225
+ $(changelog_divider)
226
+ latest commit message to 1.0.6
227
+ $(changelog_divider)
228
+ $(changelog_footer)"
229
+
230
+ test "$(cat VERSION_NUMBER)" = "2.0.6"
231
+ }
232
+
233
+
234
+ it_will_generate_a_changelog_file_scoped_to_pull_requests() {
235
+ local tags=(
236
+ 'tag_with_pulls/1.0.0'
237
+ 'tag_witout_pull'
238
+ 'tag_with_pulls/2.0.0'
239
+ 'another_tag_without'
240
+ 'tag_with_pulls/3.0.0'
241
+ 'tag_with_pulls/4.0.0'
242
+ )
243
+ local commit_messages=(
244
+ "Merge pull request #705 from Ferocia/bug/limit-payment-description-length
245
+
246
+ [BUG] Pay anyone from the accounts screen"
247
+ " This commit is not a pull request and should be ignored"
248
+ "Merge pull request #722 from Ferocia/feature/running-balance-field (Anthony Langhorne, 18 hours ago)
249
+
250
+ [Features] This is a pull request merging a feature across multiple
251
+ lines and continuing"
252
+ " Yet another commit,that isn't a pull request"
253
+ "Merge pull request #714 from Ferocia/fix-customer-login
254
+
255
+ Fixing the customer login but no tag displayed."
256
+ "Merge pull request #685 from Ferocia/bug/modal-new-payee
257
+
258
+ [Security] Commit fixing the modal with security flaw"
259
+ )
260
+
261
+ generate_sandbox_tags tags[@] commit_messages[@]
262
+
263
+ sandbox_rup $(arg_for $ARG_VERSION 'minor') $(arg_for $ARG_PULL_REQUESTS)
264
+
265
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
266
+ || Release: 0.1.0
267
+ || Released on $(get_current_release_date)
268
+ $(changelog_divider)
269
+ Features:
270
+ This is a pull request merging a feature across multiple
271
+ lines and continuing
272
+
273
+ Security:
274
+ Commit fixing the modal with security flaw
275
+
276
+ Bugs:
277
+ Pay anyone from the accounts screen
278
+
279
+ Fixing the customer login but no tag displayed.
280
+ $(changelog_divider)
281
+ $(changelog_footer)"
282
+
283
+ test "$(cat VERSION)" = "0.1.0"
284
+ }
285
+
286
+ it_will_overwrite_a_changelog_file_by_default() {
287
+ local tags=(
288
+ 'release/v1.0.4'
289
+ 'release/v1.0.5'
290
+ 'release/v1.0.6'
291
+ )
292
+ local commit_messages=(
293
+ 'Commit for last released start point 1.0.4'
294
+ '[Any Old] Message for 1.0.5'
295
+ 'latest commit message to 1.0.6'
296
+ )
297
+
298
+ generate_sandbox_tags tags[@] commit_messages[@]
299
+
300
+ sandbox_rup $(arg_for $ARG_VERSION 'minor') $(arg_for $ARG_START 'release/v1.0.4') $(arg_for $ARG_FINISH 'release/v1.0.5')
301
+
302
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
303
+ || Release: 1.1.6
304
+ || Released on $(get_current_release_date)
305
+ $(changelog_divider)
306
+ [Any Old] Message for 1.0.5
307
+ Commit for last released start point 1.0.4
308
+ $(changelog_divider)
309
+ $(changelog_footer)"
310
+
311
+ test "$(cat VERSION)" = "1.1.6"
312
+
313
+ sandbox_rup $(arg_for $ARG_VERSION 'major') $(arg_for $ARG_START 'release/v1.0.5') $(arg_for $ARG_FINISH 'release/v1.0.6')
314
+
315
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
316
+ || Release: 2.1.6
317
+ || Released on $(get_current_release_date)
318
+ $(changelog_divider)
319
+ latest commit message to 1.0.6
320
+ [Any Old] Message for 1.0.5
321
+ $(changelog_divider)
322
+ $(changelog_footer)"
323
+
324
+ test "$(cat VERSION)" = "2.1.6"
325
+ }
326
+
327
+ it_will_append_to_a_changelog_optionally(){
328
+ local tags=(
329
+ 'release/v1.0.4'
330
+ 'release/v1.0.5'
331
+ )
332
+ local commit_messages=(
333
+ 'Commit for last released start point 1.0.4'
334
+ '[Any Old] Message for 1.0.5'
335
+ )
336
+
337
+ generate_sandbox_tags tags[@] commit_messages[@]
338
+
339
+ sandbox_rup $(arg_for $ARG_VERSION 'minor') $(arg_for $ARG_APPEND)
340
+
341
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
342
+ || Release: 1.1.5
343
+ || Released on $(get_current_release_date)
344
+ $(changelog_divider)
345
+ [Any Old] Message for 1.0.5
346
+ $(changelog_divider)
347
+ $(changelog_footer)"
348
+
349
+ test "$(cat VERSION)" = "1.1.5"
350
+
351
+ sandbox_rup $(arg_for $ARG_VERSION 'major') $(arg_for $ARG_APPEND)
352
+
353
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
354
+ || Release: 2.1.5
355
+ || Released on $(get_current_release_date)
356
+ $(changelog_divider)
357
+ Release : release/v1.1.5
358
+ $(changelog_divider)
359
+ $(changelog_divider)
360
+ || Release: 1.1.5
361
+ || Released on $(get_current_release_date)
362
+ $(changelog_divider)
363
+ [Any Old] Message for 1.0.5
364
+ $(changelog_divider)
365
+ $(changelog_footer)"
366
+
367
+ test "$(cat VERSION)" = "2.1.5"
368
+ }
369
+
370
+
371
+ it_will_generate_in_an_opinionated_fashion(){
372
+ #using defaults other than append
373
+ generate_git_repo
374
+
375
+ sandbox_rup $(arg_for $ARG_VERSION 'minor') $(arg_for $ARG_APPEND)
376
+
377
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
378
+ || Release: 0.1.0
379
+ || Released on $(get_current_release_date)
380
+ $(changelog_divider)
381
+ Initial Commit
382
+ $(changelog_divider)
383
+ $(changelog_footer)"
384
+
385
+ test "$(cat VERSION)" = "0.1.0"
386
+
387
+ sandbox_rup $(arg_for $ARG_VERSION 'major') $(arg_for $ARG_APPEND)
388
+
389
+ test "$(cat CHANGELOG)" = "$(changelog_divider)
390
+ || Release: 1.1.0
391
+ || Released on $(get_current_release_date)
392
+ $(changelog_divider)
393
+ Release : release/v0.1.0
394
+ $(changelog_divider)
395
+ $(changelog_divider)
396
+ || Release: 0.1.0
397
+ || Released on $(get_current_release_date)
398
+ $(changelog_divider)
399
+ Initial Commit
400
+ $(changelog_divider)
401
+ $(changelog_footer)"
402
+
403
+ test "$(cat VERSION)" = "1.1.0"
404
+ }
405
+
406
+ #TODO
407
+ # it_will_optionally_force_push_of_tag()
408
+
409
+