mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-10 13:26:04 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5a06b52c7 | ||
|
|
51d149771f | ||
|
|
eb61d9dbd0 | ||
|
|
7fc9e0ef22 | ||
|
|
03d7843f69 | ||
|
|
ac17654314 | ||
|
|
fb0881a609 | ||
|
|
f9b3d1699d | ||
|
|
b3ac750c04 |
+7
-2
@@ -1,7 +1,12 @@
|
||||
language: c
|
||||
os: [linux, osx]
|
||||
osx_image: mavericks
|
||||
env:
|
||||
global:
|
||||
- SRC_REPO=$TRAVIS_BUILD_DIR
|
||||
- GVM_NO_GIT_BAK=1
|
||||
- GVM_NO_UPDATE_PROFILE=1
|
||||
before_install:
|
||||
- "binscripts/gvm-installer $TRAVIS_COMMIT $TRAVIS_BUILD_DIR/tmp"
|
||||
- binscripts/gvm-installer $TRAVIS_COMMIT $TRAVIS_BUILD_DIR/tmp
|
||||
install: gem install tf -v '>=0.4.1'
|
||||
script: source $TRAVIS_BUILD_DIR/tmp/gvm/scripts/gvm; tf --text tests/*.sh
|
||||
script: source $TRAVIS_BUILD_DIR/tmp/gvm/scripts/gvm; rake default scenario
|
||||
|
||||
@@ -25,6 +25,8 @@ To install:
|
||||
|
||||
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
|
||||
Or if you are using zsh just change `bash` with `zsh`
|
||||
|
||||
Installing Go
|
||||
=============
|
||||
gvm install go1
|
||||
|
||||
@@ -28,6 +28,8 @@ To install:
|
||||
|
||||
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
|
||||
Or if you are using zsh just change `bash` with `zsh`
|
||||
|
||||
Installing Go
|
||||
=============
|
||||
gvm install go1
|
||||
|
||||
@@ -1,27 +1,41 @@
|
||||
require 'tmpdir'
|
||||
|
||||
def root_path
|
||||
File.expand_path('../.', __FILE__)
|
||||
end
|
||||
|
||||
def commit
|
||||
@commit ||= (
|
||||
ENV['TRAVIS_COMMIT'] || `git rev-parse --abbrev-ref HEAD`.chomp
|
||||
)
|
||||
end
|
||||
|
||||
task :default do
|
||||
root_path = File.expand_path "../.", __FILE__
|
||||
Dir.mktmpdir("gvm-test") do |tmpdir|
|
||||
puts `binscripts/gvm-installer binary_default #{tmpdir}`
|
||||
pid = fork do
|
||||
exec("bash -c 'source #{tmpdir}/gvm/scripts/gvm; tf --text #{tmpdir}/gvm/tests/*.sh'")
|
||||
end
|
||||
Process.waitpid(pid)
|
||||
Dir.mktmpdir('gvm-test') do |tmpdir|
|
||||
system(<<-EOSH) || fail
|
||||
bash -c '
|
||||
set -e
|
||||
#{root_path}/binscripts/gvm-installer #{commit} #{tmpdir}
|
||||
source #{tmpdir}/gvm/scripts/gvm
|
||||
tf --text #{tmpdir}/gvm/tests/*.sh
|
||||
'
|
||||
EOSH
|
||||
end
|
||||
end
|
||||
|
||||
task :scenario do
|
||||
root_path = File.expand_path "../.", __FILE__
|
||||
Dir["#{root_path}/tests/scenario/*_comment_test.sh"].each do |test|
|
||||
name = File.basename(test)
|
||||
puts "Running scenario #{name}..."
|
||||
Dir.mktmpdir("gvm-test") do |tmpdir|
|
||||
install = `binscripts/gvm-installer binary_default #{tmpdir}`
|
||||
pid = fork do
|
||||
exec("bash -c 'source #{tmpdir}/gvm/scripts/gvm; tf --text #{tmpdir}/gvm/tests/scenario/#{name}'")
|
||||
end
|
||||
Process.waitpid(pid)
|
||||
Dir.mktmpdir('gvm-test') do |tmpdir|
|
||||
system(<<-EOSH) || fail
|
||||
bash -c '
|
||||
set -e
|
||||
#{root_path}/binscripts/gvm-installer #{commit} #{tmpdir}
|
||||
source #{tmpdir}/gvm/scripts/gvm
|
||||
tf --text #{tmpdir}/gvm/tests/scenario/#{name}
|
||||
'
|
||||
EOSH
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+12
-10
@@ -19,7 +19,7 @@ update_profile() {
|
||||
|
||||
check_existing_go() {
|
||||
|
||||
if [ "$GOROOT" == "" ]; then
|
||||
if [ "$GOROOT" = "" ]; then
|
||||
if which go > /dev/null; then
|
||||
GOROOT=$(go env | grep GOROOT | cut -d"=" -f2)
|
||||
else
|
||||
@@ -60,7 +60,7 @@ SRC_REPO=${SRC_REPO:-https://github.com/moovweb/gvm.git}
|
||||
|
||||
# Is gvm-installer being called from the origin repo?
|
||||
# If so, skip the clone and source locally!
|
||||
# This prevents, the CI to break on non-merge commits
|
||||
# This prevents CI from breaking on non-merge commits.
|
||||
|
||||
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
|
||||
@@ -87,20 +87,22 @@ cd "$GVM_DEST/$GVM_NAME" && git checkout --quiet "$BRANCH" 2> /dev/null || displ
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
mv "$GVM_DEST/$GVM_NAME/.git" "$GVM_DEST/$GVM_NAME/git.bak"
|
||||
[ -z "$GVM_NO_GIT_BAK" ] && mv "$GVM_DEST/$GVM_NAME/.git" "$GVM_DEST/$GVM_NAME/git.bak"
|
||||
|
||||
source_line="[[ -s \"${GVM_DEST}/$GVM_NAME/scripts/gvm\" ]] && source \"${GVM_DEST}/$GVM_NAME/scripts/gvm\""
|
||||
source_file="${GVM_DEST}/$GVM_NAME/scripts/gvm"
|
||||
|
||||
if [ -n "$ZSH_NAME" ]; then
|
||||
update_profile "$HOME/.zshrc"
|
||||
elif [ "$(uname)" == "Linux" ]; then
|
||||
update_profile "$HOME/.bashrc" || update_profile "$HOME/.bash_profile"
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
update_profile "$HOME/.profile" || update_profile "$HOME/.bash_profile"
|
||||
if [ -z "$GVM_NO_UPDATE_PROFILE" ] ; then
|
||||
if [ -n "$ZSH_NAME" ]; then
|
||||
update_profile "$HOME/.zshrc"
|
||||
elif [ "$(uname)" == "Linux" ]; then
|
||||
update_profile "$HOME/.bashrc" || update_profile "$HOME/.bash_profile"
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
update_profile "$HOME/.profile" || update_profile "$HOME/.bash_profile"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
if [ -z "$GVM_NO_UPDATE_PROFILE" ] && [ "$?" != "0" ]; then
|
||||
echo "Unable to locate profile settings file(Something like $HOME/.bashrc or $HOME/.bash_profile)"
|
||||
echo
|
||||
echo " You will have to manually add the following line:"
|
||||
|
||||
+15
-15
@@ -39,9 +39,9 @@ read_command_line() {
|
||||
-B|--binary)
|
||||
INSTALL_SOURCE="binary"
|
||||
;;
|
||||
--prefer-binary)
|
||||
INSTALL_SOURCE="prefer-binary"
|
||||
;;
|
||||
--prefer-binary)
|
||||
INSTALL_SOURCE="prefer-binary"
|
||||
;;
|
||||
-h|--help)
|
||||
show_usage
|
||||
exit 0
|
||||
@@ -164,13 +164,13 @@ download_binary() {
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
GVM_OS="linux"
|
||||
GVM_OS="linux"
|
||||
fi
|
||||
|
||||
if [ "$(uname -m)" == "x86_64" ]; then
|
||||
GVM_ARCH="amd64"
|
||||
GVM_ARCH="amd64"
|
||||
else
|
||||
GVM_ARCH="386"
|
||||
GVM_ARCH="386"
|
||||
fi
|
||||
|
||||
GO_BINARY_FILE=${VERSION}.${GVM_OS}-${GVM_ARCH}${GVM_OS_VERSION}.tar.gz
|
||||
@@ -181,17 +181,17 @@ download_binary() {
|
||||
curl -s -f -L $GO_BINARY_URL > ${GO_BINARY_PATH}
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to download binary go from http://golang.org. Trying https://go.googlecode.com"
|
||||
GO_BINARY_URL="https://go.googlecode.com/files/go${GO_BINARY_FILE}"
|
||||
display_error "Failed to download binary go from http://golang.org. Trying https://storage.googleapis.com"
|
||||
GO_BINARY_URL="https://storage.googleapis.com/golang/${GO_BINARY_FILE}"
|
||||
|
||||
curl -s -f -L $GO_BINARY_URL > ${GO_BINARY_PATH}
|
||||
curl -s -f -L $GO_BINARY_URL > ${GO_BINARY_PATH}
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to download binary go"
|
||||
rm -rf $GO_INSTALL_ROOT
|
||||
rm -f $GO_BINARY_PATH
|
||||
exit 1
|
||||
fi
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to download binary go"
|
||||
rm -rf $GO_INSTALL_ROOT
|
||||
rm -f $GO_BINARY_PATH
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user