Skip to content

Commit c22550d

Browse files
committed
fix(bumpver): handle source and docs the same: replace all
1 parent 2268836 commit c22550d

2 files changed

Lines changed: 26 additions & 22 deletions

File tree

contrib/bumpver/bump.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io/ioutil"
77
"os"
88
"regexp"
9-
"strings"
109

1110
docopt "github.com/docopt/docopt-go"
1211
)
@@ -58,13 +57,8 @@ Options:
5857
continue
5958
}
6059
}
61-
// replace the first occurrence in source files
62-
count := 1
63-
if strings.HasSuffix(name, ".md") || strings.HasSuffix(name, ".rst") {
64-
// replace all occurrences in docs
65-
count = -1
66-
}
67-
data = bytes.Replace(src, from, []byte(version), count)
60+
// replace all occurrences in source and doc files
61+
data = bytes.Replace(src, from, []byte(version), -1)
6862
f, err := os.Create(name)
6963
if err != nil {
7064
return onError(err)

contrib/bumpver/bump_test.go

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,21 @@ coreos:
238238
peer-election-timeout: 2000
239239
# heartbeat interval should ideally be 1/4 or 1/5 of peer election timeout
240240
peer-heartbeat-interval: 500
241+
units:
242+
- name: install-deisctl.service
243+
command: start
244+
content: |
245+
[Unit]
246+
Description=Install deisctl utility
247+
248+
[Service]
249+
Type=oneshot
250+
ExecStart=/usr/bin/sh -c 'curl -sSL --retry 5 --retry-delay 2 http://deis.io/deisctl/install.sh | sh -s 2.22.0'
241251
write_files:
242252
- path: /etc/deis-release
243253
content: |
244-
DEIS_RELEASE=2.22.0
245-
- path: /etc/profile.d/nse-function.sh
246-
permissions: '0755'
247-
content: |
248-
function nse() {
249-
sudo nsenter --pid --uts --mount --ipc --net --target $(docker inspect --format="{{ .State.Pid }}" $1)
250-
}
254+
DEIS_RELEASE=v2.22.0
255+
- path: /etc/motd
251256
`
252257

253258
var userdataAfter = `
@@ -264,16 +269,21 @@ coreos:
264269
peer-election-timeout: 2000
265270
# heartbeat interval should ideally be 1/4 or 1/5 of peer election timeout
266271
peer-heartbeat-interval: 500
272+
units:
273+
- name: install-deisctl.service
274+
command: start
275+
content: |
276+
[Unit]
277+
Description=Install deisctl utility
278+
279+
[Service]
280+
Type=oneshot
281+
ExecStart=/usr/bin/sh -c 'curl -sSL --retry 5 --retry-delay 2 http://deis.io/deisctl/install.sh | sh -s 2.22.1'
267282
write_files:
268283
- path: /etc/deis-release
269284
content: |
270-
DEIS_RELEASE=2.22.1
271-
- path: /etc/profile.d/nse-function.sh
272-
permissions: '0755'
273-
content: |
274-
function nse() {
275-
sudo nsenter --pid --uts --mount --ipc --net --target $(docker inspect --format="{{ .State.Pid }}" $1)
276-
}
285+
DEIS_RELEASE=v2.22.1
286+
- path: /etc/motd
277287
`
278288

279289
var rst = `

0 commit comments

Comments
 (0)