Skip to content

Commit 7a38634

Browse files
committed
This allows to read from a file descriptor instad of a file
* Rewrites some of the tests to use the functionality
1 parent f77a9ef commit 7a38634

5 files changed

Lines changed: 19 additions & 13 deletions

bin/gpm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ case "${1:-"install"}" in
7777
;;
7878
"install")
7979
deps_file="${2:-"Godeps"}"
80-
[[ -f "$deps_file" ]] || (echo ">> $deps_file file does not exist." && exit 1)
80+
[[ -r "$deps_file" ]] || (echo ">> $deps_file file does not exist." && exit 1)
8181
(which go > /dev/null) ||
8282
( echo ">> Go is currently not installed or in your PATH" && exit 1)
8383
set_dependencies $deps_file

test/can_use_an_alternative_godeps_file_test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
. assert.sh
22

33
GPM=../bin/gpm
4+
5+
# Standard gpm usage
6+
rm -rf $GOPATH/src/github.com/pote/gpm-testing-package
7+
echo "github.com/pote/gpm-testing-package v6.1" > Godeps
8+
assert_raises $GPM
9+
assert "go run go_code.go" "v6.1"
10+
11+
rm Godeps
12+
413
# Setting up v5.0 of package
514
rm -rf $GOPATH/src/github.com/pote/gpm-testing-package
615
echo "github.com/pote/gpm-testing-package v6.1" > Godeps.prod

test/commented_lines_are_ignored_test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
GPM=../bin/gpm
44

55
# Setting up v5.0 of package
6-
cat > Godeps <<EOF
6+
deps=$(cat <<EOF
77
# A comment here...
88
github.com/nu7hatch/gotrail v0.0.2
99
github.com/pote/gpm-testing-package v6.1 # a comment there!
1010
1111
# github.com/pote/gpm-testing-package v6.2
1212
EOF
13+
)
1314

14-
$GPM
15+
$GPM install <(echo "$deps")
1516
assert "go run go_code.go" "v6.1"
1617

17-
rm Godeps
1818
assert_end examples

test/installs_correct_versions_test.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
GPM=../bin/gpm
44
# Setting up v5.0 of package
5-
echo "github.com/pote/gpm-testing-package v6.1" > Godeps
6-
assert_raises "$GPM"
5+
assert_raises "$GPM install <(echo 'github.com/pote/gpm-testing-package v6.1')"
76
assert "go run go_code.go" "v6.1"
87

98
# Setting up v5.1 of package
10-
echo "github.com/pote/gpm-testing-package v6.2" > Godeps
11-
assert_raises "$GPM"
9+
assert_raises "$GPM install <(echo 'github.com/pote/gpm-testing-package v6.2')"
1210
assert "go run go_code.go" "v6.2"
13-
rm Godeps
1411

1512
assert_end examples

test/support_for_major_vcs_test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
. assert.sh
22
GPM=../bin/gpm
33

4-
echo "
4+
deps=$(cat <<EOF
55
# Bazaar Repos
66
launchpad.net/gocheck r2013.03.03
77
@@ -10,10 +10,10 @@ code.google.com/p/go.example/hello/... ae081cd1d6cc
1010
1111
# Git Repos
1212
github.com/nu7hatch/gotrail v0.0.2
13-
" > Godeps
13+
EOF
14+
)
1415

15-
$GPM
16+
$GPM install <(echo "$deps")
1617
assert "echo "$?"" "0"
17-
rm Godeps
1818

1919
assert_end examples

0 commit comments

Comments
 (0)