forked from seattlerb/vlad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vladdemo.sh
executable file
·97 lines (70 loc) · 1.9 KB
/
vladdemo.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
#!/bin/bash
N=$1; shift
killall mongrel svnserve 2> /dev/null
rm -rf ~/demo
mkdir ~/demo
cd ~/demo
pause() {
echo -n "waiting... hit return... "
read
echo
}
echo "Starting demo from scratch"
echo " This step creates a subversion repository and imports a new rails app"
echo " It modifies the Rakefile to load Vlad and creates config/deploy.rb"
echo
pause
svnadmin create svnrepo
echo "anon-access = write" >> svnrepo/conf/svnserve.conf
svnserve -d --foreground -r svnrepo --listen-host localhost &
echo "cd ~/demo
rm -rf website_*
svnserve -d --foreground -r svnrepo --listen-host localhost &
cd mydemoapp
ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -t vlad:setup vlad:update
kill %1" > go.sh
chmod u+x go.sh
rails mydemoapp
cd mydemoapp
echo "require 'rubygems'
require 'vlad'
Vlad.load" >> Rakefile
echo "set :repository, 'svn://localhost/blah'
set :domain, 'localhost'
set :web_command, 'sudo apachectl'" > config/deploy.rb
# TODO: add a knob
if [ -n "$N" ]; then
echo "set(:deploy_to, :per_thread) {
File.expand_path(\"~/demo/website_#{target_host}\")
}
%w(current_path current_release latest_release
previous_release releases_path release_path
scm_path shared_path).each do |name|
Rake::RemoteTask.per_thread[name] = true
end
(1..$N).each do |n|
host 'localhost%02d' % n, :web, :app
end" >> config/deploy.rb
else
echo "set :deploy_to, File.expand_path('~/demo/website')" >> config/deploy.rb
fi
svn import -m Added . svn://localhost/blah
echo
echo "Here is your config:"
cat config/deploy.rb
echo
echo "Here are the tasks available:"
echo
ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -T vlad
echo
echo "The next step deploys and fires up the application"
echo
pause
ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -t vlad:setup vlad:update vlad:start
open http://localhost:8000/
echo
echo "done! check it out"
echo
pause
ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake vlad:stop
kill %1