Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
svenfuchs committed Dec 29, 2012
1 parent 0ba5a81 commit 7805b0d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion lib/travis/build.rb
Expand Up @@ -7,7 +7,7 @@ module Build
autoload :Shell, 'travis/build/shell'

HOME_DIR = '~'
BUILD_DIR = '~/builds'
BUILD_DIR = '~/build'

LOGS = {
build: '~/build.log',
Expand Down
12 changes: 6 additions & 6 deletions lib/travis/build/data.rb
Expand Up @@ -76,13 +76,13 @@ def travis_env
{
TRAVIS_PULL_REQUEST: pull_request?,
TRAVIS_SECURE_ENV_VARS: secure_env_vars?,
TRAVIS_BUILD_ID: source[:id],
TRAVIS_BUILD_NUMBER: source[:number],
TRAVIS_BUILD_ID: build[:id],
TRAVIS_BUILD_NUMBER: build[:number],
TRAVIS_JOB_ID: job[:id],
TRAVIS_JOB_NUMBER: job[:number],
TRAVIS_BRANCH: job[:branch],
TRAVIS_COMMIT_RANGE: job[:commit_range],
TRAVIS_COMMIT: job[:commit]
TRAVIS_COMMIT: job[:commit],
TRAVIS_COMMIT_RANGE: job[:commit_range]
}
end

Expand All @@ -100,8 +100,8 @@ def job
config[:job] || {}
end

def source
config[:source] || {}
def build
config[:source] || config[:build] || {} # TODO standarize the payload on :build
end

def repository
Expand Down
8 changes: 1 addition & 7 deletions lib/travis/build/script/git.rb
Expand Up @@ -5,7 +5,6 @@ module Git
def checkout
clone
rm_key
chdir
fetch_ref if data.ref
git_checkout
submodules
Expand All @@ -16,18 +15,13 @@ def checkout

def clone
set 'GIT_ASKPASS', 'echo', :echo => false # this makes git interactive auth fail
raw "rm -rf #{data.slug}"
cmd "git clone --depth=100 --quiet #{data.source_url} #{data.slug}", assert: true, timeout: :git_clone
cmd "git clone --depth=100 --quiet #{data.source_url} .", assert: true, timeout: :git_clone
end

def rm_key
raw 'rm -f ~/.ssh/source_rsa'
end

def chdir
cd data.slug
end

def fetch_ref
cmd "git fetch origin +#{data.ref}: ", assert: true, timeout: :git_fetch_ref
end
Expand Down
3 changes: 2 additions & 1 deletion lib/travis/build/script/templates/header.sh
Expand Up @@ -27,8 +27,9 @@ travis_timeout() {
wait $pid
}

rm -rf <%= BUILD_DIR %>
mkdir -p <%= BUILD_DIR %>
cd <%= BUILD_DIR %>
cd <%= BUILD_DIR %>

<%= LOGS.map { |name, path| "touch #{path}; > #{path}" }.join("\n") %>

30 changes: 14 additions & 16 deletions play/build.sh
Expand Up @@ -27,8 +27,9 @@ travis_timeout() {
wait $pid
}

mkdir -p ~/builds
cd ~/builds
rm -rf ~/build
mkdir -p ~/build
cd ~/build

touch ~/build.log; > ~/build.log
touch ~/state.log; > ~/state.log
Expand Down Expand Up @@ -63,30 +64,27 @@ echo \#\!/usr/bin/env\ ruby'
chmod +x ~/travis_stream


~/travis_stream ~/build.log http://localhost:3000/logs/1 &
~/travis_stream ~/build.log http://localhost:3000/jobs/1/logs &
travis_start 'export'
TRAVIS_PULL_REQUEST=false
TRAVIS_SECURE_ENV_VARS=false
TRAVIS_BUILD_ID=1
TRAVIS_BUILD_NUMBER=
TRAVIS_JOB_ID=
TRAVIS_JOB_NUMBER=
TRAVIS_BRANCH=
TRAVIS_COMMIT_RANGE=
TRAVIS_BUILD_NUMBER=1
TRAVIS_JOB_ID=1
TRAVIS_JOB_NUMBER=1.1
TRAVIS_BRANCH=master
TRAVIS_COMMIT=a214c21
TRAVIS_RUBY_VERSION=default
TRAVIS_COMMIT_RANGE=abcdefg..a214c21
TRAVIS_RUBY_VERSION=1.9.3
travis_end 'export'

travis_start 'checkout'
GIT_ASKPASS=echo
rm -rf travis-ci/travis-support
echo \$\ git\ clone\ --depth\=100\ --quiet\ http://github.com/travis-ci/travis-support.git\ travis-ci/travis-support >> ~/build.log 2>&1
((git clone --depth=100 --quiet http://github.com/travis-ci/travis-support.git travis-ci/travis-support) >> ~/build.log 2>&1) &
echo \$\ git\ clone\ --depth\=100\ --quiet\ http://github.com/travis-ci/travis-support.git\ . >> ~/build.log 2>&1
((git clone --depth=100 --quiet http://github.com/travis-ci/travis-support.git .) >> ~/build.log 2>&1) &
travis_timeout 300
travis_assert
rm -f ~/.ssh/source_rsa
echo \$\ cd\ travis-ci/travis-support >> ~/build.log 2>&1
cd travis-ci/travis-support
echo \$\ git\ checkout\ -qf\ a214c21 >> ~/build.log 2>&1
(git checkout -qf a214c21) >> ~/build.log 2>&1
travis_assert
Expand All @@ -102,8 +100,8 @@ fi
travis_end 'checkout'
travis_start 'setup'
echo \$\ rvm\ use\ default >> ~/build.log 2>&1
(rvm use default) >> ~/build.log 2>&1
echo \$\ rvm\ use\ 1.9.3 >> ~/build.log 2>&1
(rvm use 1.9.3) >> ~/build.log 2>&1
travis_assert
if [[ -f Gemfile ]]; then
BUNDLE_GEMFILE=$pwd/Gemfile
Expand Down
33 changes: 20 additions & 13 deletions play/compile.rb
Expand Up @@ -5,27 +5,34 @@

config = {
urls: {
logs: 'http://localhost:3000/logs/1',
# state: 'http://requestb.in/12g6u3e1'
logs: 'http://localhost:3000/jobs/1/logs',
# state: 'http://localhost:3000/jobs/1/state', # not sure about this ...
},
repository: {
source_url: 'http://github.com/travis-ci/travis-support.git',
slug: 'travis-ci/travis-support'
source_url: 'http://github.com/travis-ci/travis-support.git'
},
source: {
id: 1
id: 1,
number: 1
},
job: {
id: 1,
number: '1.1',
branch: 'master',
commit: 'a214c21',
commit_range: 'abcdefg..a214c21',
pull_request: false
},
rvm: '1.9.3',
# language: 'c',
# services: ['redis'],
# after_success: 'yo dawg',
# after_failure: 'yo kaputt',
# after_script: 'travis-artifacts upload shit'
# jdk: 'jdk-foo'
# script: 'bundle exec rspec'
config: {
rvm: '1.9.3',
# language: 'c',
# services: ['redis'],
# after_success: 'yo dawg',
# after_failure: 'yo kaputt',
# after_script: 'travis-artifacts upload shit'
# jdk: 'jdk-foo'
# script: 'bundle exec rspec'
}
}

script = Travis::Build.script(config)
Expand Down

0 comments on commit 7805b0d

Please sign in to comment.