-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh.sample
executable file
·128 lines (104 loc) · 3.99 KB
/
build.sh.sample
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#/bin/bash
# expects:
# $PROJECT_URL to be the root URL project will be published to
# $PROJECT_DIR to point at filesystem directory published at $PROJECT_URL (no trailing slash)
# correct gems set up for sproutcore-abbot
echo "Building RaphaelViews for release to $PROJECT_URL/"
# get the commit #
export COMMIT_HASH=`git log -1 --format=%H`
rm -rf build_folder
rm -rf tmp
# clean out *tracked* files that might have been modified.
# Leaves, e.g., abbot/ and frameworks/sproutcore/ alone if present.
git checkout -f
# setup raphael-git. Include the --recursive in case we end up adding submodules that have their own submodules
# (a la Smartgraphs including RaphaelViews which in turn includes RaphaelJS)
git submodule update --init --recursive
# make sure we're using the latest abbot
if [ ! -d abbot ] ; then
git clone git://github.com/sproutit/sproutcore-abbot.git abbot ;
else
cd abbot
git checkout -f master
git pull
cd .. ;
fi
# make sure we're using the correct sproutcore framework ... Since we're distributing a framework to be used
# with a users' own Sproutcore install, we (probably) don't want to include sproutcore as a git submodule
if ! git submodule | grep 'frameworks/sproutcore' ; then
if [ ! -d frameworks/sproutcore ] ; then
git clone git://github.com/sproutit/sproutcore frameworks/sproutcore ;
fi
cd frameworks/sproutcore
git checkout -f master
git pull
git checkout `cat ../../sproutcore.commit`
cd ../.. ;
fi
echo
echo "********************************************"
echo
echo " Building tests"
echo
echo "********************************************"
echo
cat >>Buildfile <<END
# (leave this line blank in case Buildfile lacks trailing whitespace/newline)
config :all,
:url_prefix => '/raphael_views/test/$COMMIT_HASH/'
END
# add testswarm's inject.js to the debug folder of raphael_views, so it's included in all raphael_views tests
mkdir -p frameworks/raphael_views/debug
curl http://github.com/concord-consortium/testswarm/raw/cc/js/inject.js -o frameworks/raphael_views/debug/HUDSON-inject.js
# build the project in debug mode, to get tests
abbot/bin/sc-build -c --mode=debug --buildroot="build_folder"
# leave the repo happy for the next pull
git checkout -f frameworks/raphael_views/debug
# copy tests over to release site
cp -r build_folder/raphael_views/test/$COMMIT_HASH $PROJECT_DIR/test/
# point capybara-testrunner at tests...
echo "this is where capybara-testrunner would go."
echo
echo "********************************************"
echo
echo " Building demo apps for distribution"
echo
echo "********************************************"
echo
# cleanup the repo, including the Buildfile
git checkout -f
# build a release of the demos
cat >>Buildfile <<END
# (leave this line blank in case Buildfile lacks trailing whitespace/newline)
config :all,
:url_prefix => '/raphael_views/demos/$COMMIT_HASH/'
END
abbot/bin/sc-build -c --buildroot="build_folder"
cp -r build_folder/raphael_views/demos/$COMMIT_HASH $PROJECT_DIR/demos/
# for each demo app, publish the commit as 'latest'
for appname in `ls apps` ; do
export SC_BUILD_NUMBER=`abbot/bin/sc-build-number $appname`
export APP_PATH=demos/$COMMIT_HASH/$appname/en/$SC_BUILD_NUMBER/index.html
if [ -e $PROJECT_DIR/$APP_PATH ] ; then
mkdir -p $PROJECT_DIR/demos/$appname/latest/
ln -sf $PROJECT_DIR/$APP_PATH $PROJECT_DIR/demos/$appname/latest/index.html
fi ;
done
# build the docs...
echo
echo "********************************************"
echo
echo " Building documentation"
echo
echo "********************************************"
echo
# copy in a modified stylesheet for the jsdoc
git clone git://gist.github.com/470205.git gist-470205
cp gist-470205/default.css abbot/doc_templates/sproutcore/static/default.css
rm -rf gist-470205
# build the docs ... note sc-docs is hardwired to put docs in tmp/docs/<target_name>
abbot/bin/sc-docs raphael_views `ls apps`
cp -r tmp/docs/raphael_views/* $PROJECT_DIR/docs
for appname in `ls apps` ; do
cp -r tmp/docs/$appname $PROJECT_DIR/docs/
done