Skip to content

Commit fde04fc

Browse files
committedDec 25, 2015
Update Homebrew recipe when deploying.
[ci skip]
1 parent f470f46 commit fde04fc

File tree

2 files changed

+53
-7
lines changed

2 files changed

+53
-7
lines changed
 

‎scripts/deploy.sh

+49-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ function rbx_deploy_homebrew_binary {
8383

8484
rbx_upload_files "$(rbx_binary_bucket)" "$(rbx_release_name)" \
8585
"$(rbx_release_name)" "/homebrew/"
86+
87+
rbx_deploy_homebrew_release
8688
fi
8789
}
8890

@@ -153,7 +155,7 @@ function rbx_deploy_github_release {
153155
}
154156

155157
function rbx_deploy_website_release {
156-
local os_name releases updates version url response
158+
local os_name releases updates version url response sha
157159

158160
os_name=$1
159161
releases="releases.yml"
@@ -180,6 +182,52 @@ EOF
180182
fi
181183
}
182184

185+
function rbx_deploy_homebrew_release {
186+
local release file url response sha
187+
188+
release=$(rbx_release_name)
189+
file="rubinius.rb"
190+
url="https://api.github.com/repos/rubinius/homebrew-apps/contents/$file"
191+
response=$(curl $url)
192+
193+
cat > "$file" <<EOF
194+
require 'formula'
195+
196+
class Rubinius < Formula
197+
homepage 'http://rubinius.com/'
198+
url 'https://rubinius-binaries-rubinius-com.s3.amazonaws.com/homebrew/$release'
199+
sha1 '$(cat "$release.sha1")'
200+
201+
depends_on 'libyaml'
202+
203+
depends_on :arch => :x86_64
204+
depends_on MinimumMacOSRequirement => :mountain_lion
205+
206+
keg_only "Conflicts with MRI (Matz's Ruby Implementation)."
207+
208+
def install
209+
bin.install Dir["bin/*"]
210+
lib.install Dir["lib/*"]
211+
include.install Dir["include/*"]
212+
man1.install Dir["man/man1/*"]
213+
end
214+
215+
test do
216+
assert_equal 'rbx', \`"#{bin}/rbx" -e "puts RUBY_ENGINE"\`.chomp
217+
end
218+
end
219+
EOF
220+
221+
sha=$(echo "$response" | "$__dir__/json.sh" -b | \
222+
egrep '\["sha"\][[:space:]]\"[^"]+\"' | egrep -o '\"[[:xdigit:]]+\"')
223+
224+
let i=${#sha}
225+
226+
rbx_github_update_file "$file" "${sha:1:$i-2}" "Version $(rbx_revision_version)" "$url"
227+
228+
rm "$file"
229+
}
230+
183231
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
184232
if [[ -z $1 ]]; then
185233
"$0" release github travis homebrew website

‎scripts/github.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ __dir__="$(cd "$(dirname "$0")" && pwd)"
33
# shellcheck source=scripts/digest.sh
44
source "$__dir__/digest.sh"
55

6-
function rbx_github_release_url {
7-
echo "https://api.github.com/repos/rubinius/rubinius/releases"
8-
}
9-
106
function rbx_github_release {
11-
local version date request response upload_url
7+
local version date request response release_url upload_url
128

139
version=$1
1410
date=$2
1511

12+
release_url="https://api.github.com/repos/rubinius/rubinius/releases"
13+
1614
request=$(printf '{
1715
"tag_name": "v%s",
1816
"target_commitish": "master",
@@ -23,7 +21,7 @@ function rbx_github_release {
2321
}' "$version" "$version" "$version" "$date")
2422

2523
response=$(curl --data "$request" \
26-
"$(rbx_github_release_url)?access_token=$GITHUB_OAUTH_TOKEN")
24+
"$release_url?access_token=$GITHUB_OAUTH_TOKEN")
2725

2826
if [ $? -ne 0 ]; then
2927
return

0 commit comments

Comments
 (0)
Please sign in to comment.