playframework-capistrano 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/playframework/capistrano/version.rb +1 -1
- data/lib/playframework/capistrano.rb +38 -46
- metadata +2 -2
@@ -13,71 +13,63 @@ module Capistrano
|
|
13
13
|
_cset(:application, 'my_application')
|
14
14
|
_cset(:deploy_to, "/var/lib/#{application}")
|
15
15
|
|
16
|
-
_cset(:log_dir, '/var/log')
|
17
|
-
|
18
16
|
_cset(:prod_conf, 'prod.conf')
|
19
|
-
_cset(:project_home, '.')
|
20
17
|
|
18
|
+
# https://github.com/capistrano/capistrano/wiki/2.x-DSL-Action-Invocation-Run
|
19
|
+
default_run_options[:shell] = '/bin/bash --login'
|
20
|
+
|
21
|
+
# Hooks
|
22
|
+
after "deploy", "playframework:setup", "playframework:package"
|
21
23
|
|
22
24
|
namespace :playframework do
|
23
25
|
task :setup do
|
24
|
-
|
25
|
-
put "#!/bin/bash\
|
26
|
-
put "#!/bin/bash\
|
26
|
+
put "#!/bin/bash\nnohup bash -c \"cd #{current_path} && target/start $* &>> #{current_path}/log/#{application}.log 2>&1\" &> /dev/null &", "#{current_path}/start.sh", :mode => '755', :via => :scp
|
27
|
+
put "#!/bin/bash\npid=`cat RUNNING_PID 2> /dev/null`\nif [ \"$pid\" == \"\" ]; then echo '#{application} is not running'; exit 0; fi\necho 'Stopping #{application}...'\nkill -SIGTERM $pid", "#{current_path}/stop.sh", :mode => '755', :via => :scp
|
28
|
+
put "#!/bin/bash\nexport", "#{current_path}/envvars.sh", :mode => '755', :via => :scp
|
29
|
+
end
|
30
|
+
|
31
|
+
task :envvars do
|
32
|
+
run [
|
33
|
+
"cd #{current_path}",
|
34
|
+
"./envvars.sh"
|
35
|
+
].join(" && ")
|
27
36
|
end
|
28
37
|
|
29
|
-
task :
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
38
|
+
task :tests do
|
39
|
+
run [
|
40
|
+
"cd #{current_path}",
|
41
|
+
"play test"
|
42
|
+
].join(" && ")
|
34
43
|
end
|
35
44
|
|
36
|
-
task :
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
45
|
+
task :package do
|
46
|
+
run [
|
47
|
+
"cd #{current_path}",
|
48
|
+
"play clean compile stage"
|
49
|
+
].join(" && ")
|
41
50
|
end
|
42
51
|
|
43
52
|
task :stop do
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
target.host unless system cmd
|
49
|
-
end.compact
|
50
|
-
raise "Stopping #{application} failed on #{failed_targets.join(',')}" if failed_targets.any?
|
53
|
+
run [
|
54
|
+
"cd #{current_path}",
|
55
|
+
"./stop.sh"
|
56
|
+
].join(" && ")
|
51
57
|
end
|
52
58
|
|
53
59
|
task :start_prod do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end.compact
|
59
|
-
raise "Starting #{application} failed on #{failed_targets.join(',')}" if failed_targets.any?
|
60
|
+
run [
|
61
|
+
"cd #{current_path}",
|
62
|
+
"./start.sh -Dconfig.resource=#{prod_conf}"
|
63
|
+
].join(" && ")
|
60
64
|
end
|
61
65
|
|
62
66
|
task :start_dev do
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end.compact
|
68
|
-
raise "Starting #{application} failed on #{failed_targets.join(',')}" if failed_targets.any?
|
67
|
+
run [
|
68
|
+
"cd #{current_path}",
|
69
|
+
"./start.sh"
|
70
|
+
].join(" && ")
|
69
71
|
end
|
70
|
-
|
71
|
-
task :package do
|
72
|
-
system "cd #{project_home} && play clean compile test stage"
|
73
|
-
raise "Error in package task" if not $?.success?
|
74
|
-
end
|
75
|
-
|
76
|
-
task :copy_app_files do
|
77
|
-
run "rm -fr #{deploy_to}/target"
|
78
|
-
upload "#{project_home}/target", deploy_to, :via => :scp, :recursive => true
|
79
|
-
end
|
80
|
-
end # end namespace playframework
|
72
|
+
end
|
81
73
|
|
82
74
|
end if Capistrano.const_defined? :Configuration and Capistrano::Configuration.methods.map(&:to_sym).include? :instance
|
83
75
|
end # end module Capistrano
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playframework-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|