Skip to content

Commit c4e8883

Browse files
committedDec 20, 2015
First steps to packaging with Bash.
1 parent c5d711c commit c4e8883

File tree

4 files changed

+60
-19
lines changed

4 files changed

+60
-19
lines changed
 

‎scripts/configuration.sh

+4
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ function rbx_write_revision_file {
5353
rbx_get_revision > "$(rbx_revision_file)"
5454
fi
5555
}
56+
57+
function rbx_release_name {
58+
echo "rubinius-$(rbx_revision_version).tar.bz2"
59+
}

‎scripts/deploy.sh

+25-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ source "scripts/configuration.sh"
44
source "scripts/aws.sh"
55
source "scripts/io.sh"
66

7+
function rbx_release_bucket {
8+
echo "rubinius-releases-rubinius-com"
9+
}
10+
11+
function rbx_binary_bucket {
12+
echo "rubinius-binaries-rubinius-com"
13+
}
14+
715
function rbx_url_prefix {
816
local bucket=$1
917
echo "https://${bucket}.s3-us-west-2.amazonaws.com"
@@ -17,7 +25,7 @@ function rbx_upload_files {
1725
src=$3
1826
path=${4:-}
1927
url=$(rbx_url_prefix "$bucket")
20-
file_exts=("" ".md5" ".sha1" ".sha512")
28+
file_exts=("" ".sha512")
2129
index="index.txt"
2230

2331
rbx_s3_download "$url" "$index"
@@ -46,24 +54,29 @@ function rbx_upload_files {
4654
}
4755

4856
# Build and upload the release tarball to S3.
49-
if [[ $TRAVIS_OS_NAME == osx && $CC == gcc && $RVM == "rbx-2" ]]; then
50-
echo "Deploying release tarball $(rbx_revision_version)..."
57+
if [[ $TRAVIS_OS_NAME == osx ]]; then
58+
echo "Deploying release tarball $(rbx_release_name)..."
5159

52-
./scripts/release || fail "unable to build release tarball"
60+
"$(rbx_script_path)/release.sh" || fail "unable to build release tarball"
5361

54-
bucket="rubinius-releases-rubinius-com"
55-
release_name="$(rbx_release_name)"
62+
rbx_upload_files "$(rbx_release_bucket)" "$(rbx_release_name)" "$(rbx_release_name)"
63+
fi
64+
65+
# Build and upload a Homebrew binary to S3.
66+
if [[ $TRAVIS_OS_NAME == osx ]]; then
67+
echo "Deploying Homebrew binary $(rbx_release_name)..."
5668

57-
rbx_upload_files "$bucket" "$release_name" "$release_name"
69+
"$(rbx_script_path)/package.sh" homebrew || fail "unable to build Homebrew binary"
70+
71+
rbx_upload_files "$(rbx_binary_bucket)" "$(rbx_release_name)" \
72+
"$(rbx_release_name)" "/homebrew/"
5873
fi
5974

6075
# Build and upload a binary to S3.
6176
if [[ $RVM == "rbx-2" ]]; then
6277
echo "Deploying Travis binary $(rbx_revision_version) for ${TRAVIS_OS_NAME}..."
6378

64-
rake package:binary || fail "unable to build binary"
65-
66-
bucket="rubinius-binaries-rubinius-com"
79+
"$(rbx_scripts)/package.sh" binary || fail "unable to build binary"
6780

6881
declare -a paths os_releases versions
6982

@@ -93,7 +106,8 @@ if [[ $RVM == "rbx-2" ]]; then
93106

94107
for path in "${paths[@]}"; do
95108
for version in "${versions[@]}"; do
96-
rbx_upload_files "$bucket" "rubinius$version.tar.bz2" "$(rbx_release_name)" "$path"
109+
rbx_upload_files "$(rbx_binary_bucket)" "rubinius$version.tar.bz2" \
110+
"$(rbx_release_name)" "$path"
97111
done
98112
done
99113
fi

‎scripts/package.sh

100644100755
+30-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/bash
2+
13
function rbx_digest_file {
24
local name digest
35

@@ -8,7 +10,7 @@ function rbx_digest_file {
810
}
911

1012
function rbx_package_tar {
11-
local archive files prefix
13+
local archive files
1214

1315
archive="$(rbx_release_name)"
1416
rm -rf "$archive"
@@ -20,3 +22,30 @@ function rbx_package_tar {
2022

2123
rbx_digest_file "$archive" "sha512"
2224
}
25+
26+
function rbx_package_binary {
27+
rake package:binary
28+
}
29+
30+
function rbx_package_homebrew {
31+
echo "Packaging for Homebrew..."
32+
rake package:homebrew
33+
}
34+
35+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
36+
case "$1" in
37+
"tar")
38+
rbx_package_tar
39+
;;
40+
"binary")
41+
rbx_package_binary
42+
;;
43+
"homebrew")
44+
rbx_package_homebrew
45+
;;
46+
*)
47+
echo "Usage: ${0##*/} package_type"
48+
exit 1
49+
;;
50+
esac
51+
fi

‎scripts/release.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#!/bin/bash
22

33
source "scripts/configuration.sh"
4-
source "scripts/package.sh"
5-
6-
function rbx_release_name {
7-
echo "rubinius-$(rbx_revision_version).tar.bz2"
8-
}
94

105
rbx_write_revision_file
11-
rbx_package_tar
126

13-
exit 1
7+
"$(rbx_script_path)/package.sh" tar

0 commit comments

Comments
 (0)
Please sign in to comment.