Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a7809747c0dd
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 448cc0a0083d
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Feb 27, 2016

  1. Added deploy for Heroku.

    [ci skip]
    brixen committed Feb 27, 2016
    Copy the full SHA
    ea2706f View commit details
  2. Added deploy triggers for releases.

    [ci skip]
    brixen committed Feb 27, 2016
    Copy the full SHA
    448cc0a View commit details
Showing with 136 additions and 82 deletions.
  1. +1 −1 .travis.yml
  2. +4 −0 scripts/configuration.sh
  3. +115 −78 scripts/deploy.sh
  4. +5 −3 scripts/github.sh
  5. +11 −0 scripts/package.sh
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ before_script:
- ./configure
script: rake ci
after_success:
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh all; fi
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh release github website docker triggers; fi
branches:
only:
- master
4 changes: 4 additions & 0 deletions scripts/configuration.sh
Original file line number Diff line number Diff line change
@@ -52,3 +52,7 @@ function rbx_write_revision_file {
function rbx_release_name {
echo "rubinius-$(rbx_revision_version).tar.bz2"
}

function rbx_heroku_release_name {
echo "ruby-2.2.2-rbx-$(rbx_revision_version).tar.bz2"
}
193 changes: 115 additions & 78 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -82,14 +82,91 @@ function rbx_deploy_release_tarball {

# Build and upload a Homebrew binary to S3.
function rbx_deploy_homebrew_binary {
if [[ $1 == osx ]]; then
echo "Deploying Homebrew binary $(rbx_release_name)..."
if [[ $1 != osx ]]; then
return
fi

echo "Deploying Homebrew binary $(rbx_release_name)..."

"$__dir__/package.sh" homebrew || fail "unable to build Homebrew binary"

rbx_upload_files "$(rbx_binary_bucket)" "$(rbx_release_name)" \
"$(rbx_release_name)" "/homebrew/"

echo "Deploying Homebrew release $(rbx_revision_version)..."

local release file url response sha

release=$(rbx_release_name)
file="rubinius.rb"
url="https://api.github.com/repos/rubinius/homebrew-apps/contents/$file"
response=$(curl "$url?access_token=$GITHUB_OAUTH_TOKEN")

cat > "$file" <<EOF
require 'formula'
class Rubinius < Formula
homepage 'http://rubinius.com/'
url 'https://rubinius-binaries-rubinius-com.s3.amazonaws.com/homebrew/$release'
sha1 '$(cat "$release.sha1")'
depends_on 'libyaml'
depends_on :arch => :x86_64
depends_on MinimumMacOSRequirement => :mountain_lion
keg_only "Conflicts with MRI (Matz's Ruby Implementation)."
def install
bin.install Dir["bin/*"]
lib.install Dir["lib/*"]
include.install Dir["include/*"]
man1.install Dir["man/man1/*"]
end
"$__dir__/package.sh" homebrew || fail "unable to build Homebrew binary"
test do
assert_equal 'rbx', \`"#{bin}/rbx" -e "puts RUBY_ENGINE"\`.chomp
end
end
EOF

rbx_upload_files "$(rbx_binary_bucket)" "$(rbx_release_name)" \
"$(rbx_release_name)" "/homebrew/"
sha=$(echo "$response" | "$__dir__/json.sh" -b | \
egrep '\["sha"\][[:space:]]\"[^"]+\"' | egrep -o '\"[[:xdigit:]]+\"')

let i=${#sha}

rbx_github_update_file "$file" "${sha:1:$i-2}" "Version $(rbx_revision_version)" "$url"

rm "$file"
}

# Build and upload a Heroku binary to S3.
function rbx_deploy_heroku_binary {
if [[ $1 != linux ]]; then
return
fi

if [[ $(rbx_dist_version) != "14.04" ]]; then
return
fi

echo "Deploying Heroku binary $(rbx_heroku_release_name)..."

"$__dir__/package.sh" heroku || fail "unable to build Heroku binary"

local -a file_exts=("" ".sha1")
local url bucket name

bucket="$(rbx_binary_bucket)"
url="$(rbx_url_prefix "$bucket")"
name="$(rbx_heroku_release_name)"

for ext in "${file_exts[@]}"; do
if [[ -f $src$ext ]]; then
rbx_s3_upload "$url" "$bucket" "$name$ext" "$name$ext" "/ubuntu/cedar-14/" ||
fail "unable to upload file"
fi
done
}

# Build and upload a binary to S3.
@@ -146,20 +223,17 @@ function rbx_deploy_travis_binary {
done
}

function rbx_deploy_travis_12_04_binary {
if [[ $1 != linux ]]; then
return
fi

local url response sha travis_yml version
function rbx_trigger_deploy {
local branch json_url response sha raw_url travis_yml version

branch=$1
json_url="https://api.github.com/repos/rubinius/rubinius-build/contents/.travis.yml"

response=$(curl "$json_url?access_token=$GITHUB_OAUTH_TOKEN")
response=$(curl "$json_url?ref=$branch&access_token=$GITHUB_OAUTH_TOKEN")
sha=$(echo "$response" | "$__dir__/json.sh" -b | \
egrep '\["sha"\][[:space:]]\"[^"]+\"' | egrep -o '\"[[:xdigit:]]+\"')

raw_url="https://raw.githubusercontent.com/rubinius/rubinius-build/master/.travis.yml"
raw_url="https://raw.githubusercontent.com/rubinius/rubinius-build/$branch/.travis.yml"
response=$(curl "$raw_url?access_token=$GITHUB_OAUTH_TOKEN")

travis_yml=rubinius-build.travis.yml
@@ -169,7 +243,8 @@ function rbx_deploy_travis_12_04_binary {
sed "s/RUBINIUS_VERSION=.*$/RUBINIUS_VERSION=$version/" \
> "$travis_yml"

rbx_github_update_file "$travis_yml" "${sha:1:${#sha}-2}" "Version $version." "$json_url"
rbx_github_update_file "$travis_yml" "${sha:1:${#sha}-2}" \
"Version $version." "$json_url" "$branch"

rm -f "$travis_yml"
}
@@ -222,60 +297,6 @@ EOF
fi
}

function rbx_deploy_homebrew_release {
local os_name=$1

if [[ $os_name != osx ]]; then
return
fi

echo "Deploying Homebrew release $(rbx_revision_version)..."

local release file url response sha

release=$(rbx_release_name)
file="rubinius.rb"
url="https://api.github.com/repos/rubinius/homebrew-apps/contents/$file"
response=$(curl "$url?access_token=$GITHUB_OAUTH_TOKEN")

cat > "$file" <<EOF
require 'formula'
class Rubinius < Formula
homepage 'http://rubinius.com/'
url 'https://rubinius-binaries-rubinius-com.s3.amazonaws.com/homebrew/$release'
sha1 '$(cat "$release.sha1")'
depends_on 'libyaml'
depends_on :arch => :x86_64
depends_on MinimumMacOSRequirement => :mountain_lion
keg_only "Conflicts with MRI (Matz's Ruby Implementation)."
def install
bin.install Dir["bin/*"]
lib.install Dir["lib/*"]
include.install Dir["include/*"]
man1.install Dir["man/man1/*"]
end
test do
assert_equal 'rbx', \`"#{bin}/rbx" -e "puts RUBY_ENGINE"\`.chomp
end
end
EOF

sha=$(echo "$response" | "$__dir__/json.sh" -b | \
egrep '\["sha"\][[:space:]]\"[^"]+\"' | egrep -o '\"[[:xdigit:]]+\"')

let i=${#sha}

rbx_github_update_file "$file" "${sha:1:$i-2}" "Version $(rbx_revision_version)" "$url"

rm "$file"
}

function rbx_deploy_docker_release {
local os_name=$1

@@ -326,7 +347,7 @@ EOF

function rbx_deploy_usage {
cat >&2 <<-EOM
Usage: ${0##*/} [all release github travis docker homebrew-binary homebrew-release website]
Usage: ${0##*/} [release github travis heroku homebrew website docker trigger-heroku trigger-homebrew trigger-travis-osx trigger-travis-12.04 trigger-travis-14.04 triggers]
EOM
exit 1
}
@@ -338,9 +359,6 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then

for cmd in "${@}"; do
case "$cmd" in
"all")
"$0" release github travis travis-12.04 docker homebrew-binary homebrew-release website
;;
"release")
rbx_deploy_release_tarball "$TRAVIS_OS_NAME"
;;
@@ -350,21 +368,40 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
"travis")
rbx_deploy_travis_binary "$TRAVIS_OS_NAME"
;;
"travis-12.04")
rbx_deploy_travis_12_04_binary "$TRAVIS_OS_NAME"
"heroku")
rbx_deploy_heroku_binary "$TRAVIS_OS_NAME"
;;
"homebrew-binary")
"homebrew")
rbx_deploy_homebrew_binary "$TRAVIS_OS_NAME"
;;
"homebrew-release")
rbx_deploy_homebrew_release "$TRAVIS_OS_NAME"
;;
"website")
rbx_deploy_website_release "$TRAVIS_OS_NAME"
;;
"docker")
rbx_deploy_docker_release "$TRAVIS_OS_NAME"
;;
"trigger-heroku")
rbx_trigger_deploy heroku
;;
"trigger-homebrew")
rbx_trigger_deploy homebrew
;;
"trigger-travis-osx")
rbx_trigger_deploy travis-osx
;;
"trigger-travis-12.04")
rbx_trigger_deploy travis-12.04
;;
"trigger-travis-14.04")
rbx_trigger_deploy travis-14.04
;;
"triggers")
rbx_trigger_deploy heroku
rbx_trigger_deploy homebrew
rbx_trigger_deploy travis-osx
rbx_trigger_deploy travis-12.04
rbx_trigger_deploy travis-14.04
;;
"-h"|"--help"|*)
rbx_deploy_usage
;;
8 changes: 5 additions & 3 deletions scripts/github.sh
Original file line number Diff line number Diff line change
@@ -72,19 +72,21 @@ function rbx_github_release_assets {
}

function rbx_github_update_file {
local file sha message url content request
local file sha message url branch content request

file=$1
sha=$2
message=$3
url=$4
branch=${5:-master}
content=$(rbx_base64 "$file")

request=$(printf '{
"message": "%s",
"content": "%s",
"sha": "%s"
}' "$message" "$content" "$sha")
"sha": "%s",
"branch": "%s"
}' "$message" "$content" "$sha" "$branch")

curl -X PUT --data "$request" "$url?access_token=$GITHUB_OAUTH_TOKEN"
}
11 changes: 11 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -33,6 +33,14 @@ function rbx_package_homebrew {
rbx_digest_file "$(rbx_release_name)" "sha1"
}

function rbx_package_heroku {
echo "Packaging for Heroku..."

rake package:heroku

rbx_digest_file "$(rbx_heroku_release_name)" "sha1"
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
case "$1" in
"tar")
@@ -44,6 +52,9 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
"homebrew")
rbx_package_homebrew
;;
"heroku")
rbx_package_heroku
;;
*)
echo "Usage: ${0##*/} package_type"
exit 1