dropbox / nsot

Network Source of Truth is an open source IPAM and network inventory database
https://nsot.readthedocs.io
Other
399 stars 66 forks source link

Fixes #197: bump.sh for OS X #211

Closed coxley closed 8 years ago

coxley commented 8 years ago
  -i[SUFFIX], --in-place[=SUFFIX]
                 edit files in place (makes backup if SUFFIX supplied)

sed that is distributed with OS X, SUFFIX is not optional. Setting it to empty string should fix

(#197)

jathanism commented 8 years ago

@coxley Nope.

bump.sh changes:

diff --git a/bump.sh b/bump.sh
index 97357c7..0cb5024 100755
--- a/bump.sh
+++ b/bump.sh
@@ -22,7 +22,7 @@ function proceed() {
 }

 function replace() {
-    sed -i "s/'${CURVER}'/'${VERSION}'/" nsot/version.py && \
+    sed -i '' "s/'${CURVER}'/'${VERSION}'/" nsot/version.py && \
         echo "Updated nsot/version.py"

     sed "s/{{ NSOT_VERSION }}/${VERSION}/" docker/Dockerfile.sub > \

Linux:

$ ./bump.sh -v 2.0
Replace 1.0 with 2.0? [Y/n] y
sed: can't read s/'1.0'/'2.0'/: No such file or directory
Updated docker/Dockerfile

$ git status -s
 M bump.sh
 M docker/Dockerfile

macOS:

$ ./bump.sh -v 2.0
Replace __version__ = '1.0.1' with 2.0? [Y/n] y
Updated nsot/version.py
Updated docker/Dockerfile

$ git status -s
 M bump.sh
 M docker/Dockerfile

So it introduces a new error w/ Linux, and it doesn't do anything on macOS. WAT. Might have to just branch on platform?

coxley commented 8 years ago

@jathanism Oh whoops, there shouldn't be a space between the switch and empty quotes. Fixing...

coxley commented 8 years ago

Showing it at least works on linux again

$ cat nsot/version.py
__version__ = '1.0.1'

$ ./bump.sh -v 1.0.2
Replace 1.0.1 with 1.0.2? [Y/n] y
Updated nsot/version.py
Updated docker/Dockerfile

$ cat nsot/version.py
__version__ = '1.0.2'

$ cat docker/Dockerfile | grep 1.0.
RUN pip install nsot==1.0.2
jathanism commented 8 years ago

@coxley:

LEL on macOS:

$ ./bump.sh -v 2.0
Replace __version__ = '1.0.1' with 2.0? [Y/n] y
sed: 1: "nsot/version.py": extra characters at the end of n command
Updated docker/Dockerfile