This repository has been archived by the owner on May 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
bootstrap
executable file
·91 lines (70 loc) · 2.81 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
cd $(dirname "$0")
source ./lib/common.sh
test -e bootstrap.log && rm -f bootstrap.log
bootstrap_darwin()
{
XULVERSION="1.9.1.18"
ROOT="/Library/Frameworks/XUL.framework"
THIS="$ROOT/Versions/Current"
if [ -d $THIS ]; then
info "XUL.framework version $(basename $(readlink $THIS)) is already installed."
else
URL="http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.1.18/runtimes/xulrunner-1.9.1.18.en-US.mac-pkg.dmg"
DOWNLOAD="$HOME/Downloads/$(basename $URL)"
MOUNTPOINT="/Volumes/XULRunnerFramework"
if [ ! -e $DOWNLOAD ]; then
info "Downloading $(basename $URL)"
curl -L -o $DOWNLOAD $URL >>bootstrap.log 2>&1|| die "Unable to download $(basename $URL)"
fi
info "Installing XUL.framework version $XULVERSION (you may be asked for your password)"
hdiutil attach -mountpoint $MOUNTPOINT $DOWNLOAD >>bootstrap.log 2>&1 ||
die "Unable to mount downloaded DMG $DOWNLOAD"
sudo installer -package $MOUNTPOINT/$(basename $DOWNLOAD -pkg.dmg).pkg -target / >>bootstrap.log 2>&1 ||
die "Unable to install XUL.framework"
hdiutil detach $MOUNTPOINT >>bootstrap.log 2>&1 ||
die "Unable to detach downloaded DMG"
fi
info "Setting up development environment"
BUNDLE="build/$(config App Name).app"
# kill it if it's already there
rm -rf "$BUNDLE"
mkdir -p "$BUNDLE"
$ROOT/xulrunner-bin --install-app application build >>bootstrap.log 2>&1 &&
cp resources/Info.plist "$BUNDLE/Contents" &&
mkdir -p "$BUNDLE/Contents/Frameworks/XUL.framework" &&
/usr/bin/rsync -al $ROOT/ "$BUNDLE/Contents/Frameworks/XUL.framework/" &&
rm -rf "$BUNDLE/Contents/Resources" &&
ln -nfs "../../../application" "$BUNDLE/Contents/Resources" ||
die "Unable to set up OS X development .app bundle"
}
bootstrap_aptitude()
{
XULVERSION="1.9.1"
info "Installing XUL.framework version $XULVERSION (you may be asked for your password)"
sudo aptitude install xulrunner-$XULVERSION || die "Unable to install xulrunner package"
}
if [[ `uname` == "Darwin" ]]; then
bootstrap_darwin
elif which -s aptitude 2>/dev/null; then
bootstrap_aptitude
fi
if ! which -s ruby; then
warn "You don't have Ruby installed."
say "While you don't need it for production, you will need it to use"
say "the development tools provided in this package. Please install it"
say "and run $0 again."
else
if ! which -s bundle; then
info "Installing Bundler..."
if gem env | grep INSTALLATION | awk -F 'INSTALLATION DIRECTORY: ' '{ print $2 }' | xargs test -w; then
# can install without sudo
gem install bundler >>bootstrap.log 2>&1
else
sudo gem install bundler >>bootstrap.log 2>&1
fi
fi
bundle install >>bootstrap.log 2>&1
yay "Done! Run script/server to start the application"
fi
test -e bootstrap.log && rm -f bootstrap.log