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
|
# File 'lib/kstrano_play.rb', line 5
def self.load_into(configuration)
configuration.load do
load_paths.push File.expand_path('../', __FILE__)
load 'kstrano'
set :play_version, "2.2.0"
namespace :deploy do
desc "Updates latest release source path"
task :finalize_update, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
run "#{try_sudo} chmod u+rx #{latest_release}/start.sh"
run "#{try_sudo} chmod u+rx #{latest_release}/stop.sh"
kuma::share_childs
play::package
end
end
namespace :play do
desc "Build the app"
task :package do
unless File.directory?("/home/projects/#{application}/play/play-#{play_version}")
try_sudo "bash -ic 'cd /home/projects/#{application}/play &&
wget http://downloads.typesafe.com/play/#{play_version}/play-#{play_version}.zip &&
unzip play-#{play_version}.zip &&
rm play-#{play_version}.zip &&
chmod -R 775 play-#{play_version}'"
end
try_sudo "bash -c 'cd #{latest_release} && /home/projects/#{application}/play/play-#{play_version}/play clean compile stage'"
end
desc "Start the server"
task :start do
try_sudo "bash -ic 'cd #{current_path} && PLAY_ENV=#{env} ./start.sh'"
end
desc "Stop the server"
task :stop do
try_sudo "bash -c 'cd #{current_path} && ./stop.sh'"
end
end
after "deploy", "play:stop", "play:start"
end
end
|