-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.sh
170 lines (148 loc) · 6.19 KB
/
scripts.sh
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# version 0.0.7
function create-weblocks-app-repository(){
NAME="$1"
mkdir "$NAME";
cd "$NAME";
git init
git submodule add git://github.com/html/require-quicklisp.git .quicklisp-install
cp .quicklisp-install/.quicklisp-version .
wget http://common-lisp.net/project/asdf/asdf.lisp
git add asdf.lisp
echo "(progn (ql:quickload :weblocks) (funcall (intern \"MAKE-APP\" \"WOP\") '$NAME \".\"))" | sbcl --load ".quicklisp-install/require-quicklisp"
mv $NAME/* .
rm -rf "$NAME"
git add *
function define(){ IFS='\n' read -r -d '' ${1} || true; }
define SERVER << 'END_TEXT'
PROJECT_ROOT=`dirname $0`/../
SWANK_PORT=4005
WEBLOCKS_PORT=5555
echo "Project root: $PROJECT_ROOT"
echo "DELETING old $NAME fasl"
find $PROJECT_ROOT/src -iname *.fasl -delete
sbcl --dynamic-space-size 2048 --userinit $PROJECT_ROOT/$NAME.sbclrc $PROJECT_ROOT $WEBLOCKS_PORT $SWANK_PORT
END_TEXT
mkdir script;
echo "$SERVER" | sed -e s/\$NAME/$NAME/g > script/server;
chmod +x script/server
define SBCLRC << 'END_TEXT'
(load "asdf.lisp")
(load ".quicklisp-install/require-quicklisp.lisp")
(require 'sb-posix)
(require :sb-aclrepl)
(setf sb-impl::*default-external-format* :utf-8)
(push (make-pathname :directory '(:relative "lib")) ql:*local-project-directories*)
(push (make-pathname :directory '(:relative ".")) ql:*local-project-directories*)
(defvar *project-root* (pathname (nth 1 *posix-argv*)))
(defvar *port* (parse-integer (nth 2 *posix-argv*)))
(defvar *swank-port* (parse-integer (nth 3 *posix-argv*)))
(ql:quickload :trivial-features)
(ql:quickload :cffi-grovel)
(ql:quickload :firephp)
(require :bordeaux-threads)
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal)
(setf sb-ext:*posix-argv* (remove "--no-linedit" sb-ext:*posix-argv* :test 'equal))
(when (interactive-stream-p *terminal-io*)
(require :sb-aclrepl)
(ql:quickload :linedit)
(funcall (intern "INSTALL-REPL" :linedit) :wrap-current t)))
(ql:quickload :cl-prevalence)
(ql:quickload :weblocks)
(ql:quickload :swank)
(swank:create-server :dont-close t :port *swank-port*)
(ql:quickload :$NAME)
($NAME:start-$NAME :port *port*)
;; sending "\\033[2J" to clear screen
(format t "~C[2J~%" #\Esc)
(format t "Welcome to weblocks~%")
(format t "Weblocks is running on port ~S, and can be access by browsing http://localhost:~S~%" *port* *port*)
(format t "Swank is running on port ~S~%" *swank-port*)
(format t "Use (quit) to exit REPL")
(in-package $NAME)
(defun quit () (sb-ext:exit))
END_TEXT
echo "$SBCLRC" | sed -e s/\$NAME/$NAME/g > "$NAME.sbclrc";
git add "$NAME.sbclrc"
git add .quicklisp-version
git add script
git rm -f lib/system-index.txt
}
# version 0.1.2
function create-weblocks-bootstrap-app-repository(){
NAME="$1"
mkdir "$NAME";
cd "$NAME";
git init
git submodule add git://github.com/html/require-quicklisp.git .quicklisp-install
cp .quicklisp-install/.quicklisp-version .
mkdir lib
git submodule add git://github.com/nallen05/pretty-function.git lib/pretty-function
git submodule add git://github.com/html/weblocks-twitter-bootstrap-application.git lib/weblocks-twitter-bootstrap-application
git submodule add git://github.com/html/weblocks-stores.git lib/weblocks-stores
git submodule add git://github.com/skypher/weblocks.git lib/weblocks
git submodule add https://github.com/html/weblocks-jquery-js.git lib/weblocks-jquery-js
git submodule add https://github.com/html/weblocks-utils.git lib/weblocks-utils
git submodule add https://github.com/html/cl-tidy.git lib/cl-tidy
wget http://common-lisp.net/project/asdf/asdf.lisp
git add asdf.lisp
echo "(progn (push (make-pathname :directory '(:relative \"lib\")) ql:*local-project-directories*) (ql:quickload :weblocks-twitter-bootstrap-application) (funcall (intern \"MAKE-APPLICATION\" \"WEBLOCKS-TWITTER-BOOTSTRAP-APPLICATION\") '$NAME \".\"))" | sbcl --load ".quicklisp-install/require-quicklisp"
mv $NAME/* .
rm -rf "$NAME"
git add *
function define(){ IFS='\n' read -r -d '' ${1} || true; }
define SERVER << 'END_TEXT'
PROJECT_ROOT=`dirname $0`/../
SWANK_PORT=4005
WEBLOCKS_PORT=5555
echo "Project root: $PROJECT_ROOT"
echo "DELETING old $NAME fasl"
find $PROJECT_ROOT/src -iname *.fasl -delete
sbcl --dynamic-space-size 2048 --userinit $PROJECT_ROOT/$NAME.sbclrc $PROJECT_ROOT $WEBLOCKS_PORT $SWANK_PORT
END_TEXT
mkdir script;
echo "$SERVER" | sed -e s/\$NAME/$NAME/g > script/server;
chmod +x script/server
define SBCLRC << 'END_TEXT'
(load "asdf.lisp")
(load ".quicklisp-install/require-quicklisp.lisp")
(require 'sb-posix)
(require :sb-aclrepl)
(setf sb-impl::*default-external-format* :utf-8)
(push (make-pathname :directory '(:relative "lib")) ql:*local-project-directories*)
(push (make-pathname :directory '(:relative ".")) ql:*local-project-directories*)
(defvar *project-root* (pathname (nth 1 *posix-argv*)))
(defvar *port* (parse-integer (nth 2 *posix-argv*)))
(defvar *swank-port* (parse-integer (nth 3 *posix-argv*)))
(ql:quickload :trivial-features)
(ql:quickload :cffi-grovel)
(ql:quickload :firephp)
(require :bordeaux-threads)
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal)
(setf sb-ext:*posix-argv* (remove "--no-linedit" sb-ext:*posix-argv* :test 'equal))
(when (interactive-stream-p *terminal-io*)
(require :sb-aclrepl)
(ql:quickload :linedit)
(funcall (intern "INSTALL-REPL" :linedit) :wrap-current t)))
(ql:quickload :yaclml)
(ql:quickload :cl-prevalence)
(ql:quickload :weblocks)
(ql:quickload :swank)
(swank:create-server :dont-close t :port *swank-port*)
(ql:quickload :$NAME)
($NAME:start-$NAME :port *port*)
;; sending "\\033[2J" to clear screen
(format t "~C[2J~%" #\Esc)
(format t "Welcome to weblocks~%")
(format t "Weblocks is running on port ~S, and can be access by browsing http://localhost:~S~%" *port* *port*)
(format t "Swank is running on port ~S~%" *swank-port*)
(format t "Use (quit) to exit REPL")
(in-package $NAME)
(defun quit () (sb-ext:exit))
END_TEXT
echo "$SBCLRC" | sed -e s/\$NAME/$NAME/g > "$NAME.sbclrc";
git add "$NAME.sbclrc"
git add .quicklisp-version
git add script
git rm -f lib/system-index.txt
}
source "`dirname $BASH_SOURCE`/install-weblocks-cms.sh"