pushapp 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/pushapp/commands.rb +1 -1
- data/lib/pushapp/tasks/base.rb +1 -0
- data/lib/pushapp/tasks/unicorn_signal.rb +33 -0
- data/lib/pushapp/version.rb +1 -1
- data/templates/config.rb.erb +8 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a1d8ee02e33cd268cbc2b1303b646db560e2e98
|
4
|
+
data.tar.gz: ad828cb4093f25c0239ec0c3c9cf7d950ccc5c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46c4f58b16145cbedaf7462b6a99916723602e02db55eecbc41165563a151a5ff4efbb1f93eac8cac82c65643dda8e6be46ab44e31c313a17f467b6e7d053a78
|
7
|
+
data.tar.gz: d07572f75d42a15d68859f7996d5a5382841fcc03bd8faea73c0f0b4330dda06fca06b911f7bb54ec94f23720ad223f00e09eb20064f42d075329152ac157591
|
data/lib/pushapp/commands.rb
CHANGED
@@ -60,7 +60,7 @@ module Pushapp
|
|
60
60
|
event = @options[:event]
|
61
61
|
local = @options[:local]
|
62
62
|
if local
|
63
|
-
logger.info "
|
63
|
+
logger.info "STARTING TASKS ON EVENT #{event}"
|
64
64
|
remotes.each do |r|
|
65
65
|
r.tasks_on(event).each do |t|
|
66
66
|
logger.info "run: #{t.inspect}"
|
data/lib/pushapp/tasks/base.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'pushapp/tasks/base'
|
2
|
+
|
3
|
+
module Pushapp
|
4
|
+
module Tasks
|
5
|
+
class UnicornSignal < Base
|
6
|
+
def run
|
7
|
+
pid = unicorn_pid
|
8
|
+
if pid
|
9
|
+
logger.info "sending #{unicorn_signal} to pid at #{unicorn_pid_file}"
|
10
|
+
system "#{sudo} kill -#{unicorn_signal} #{unicorn_pid}"
|
11
|
+
else
|
12
|
+
logger.warn "can't find unicorn pid at '#{unicorn_pid_file}'"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
register_as :unicorn_signal
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def unicorn_pid
|
21
|
+
File.exists?(unicorn_pid_file) ? File.read(unicorn_pid_file).to_i : nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def unicorn_pid_file
|
25
|
+
options[:unicorn_pid_file] || "tmp/pids/unicorn.pid"
|
26
|
+
end
|
27
|
+
|
28
|
+
def unicorn_signal
|
29
|
+
"#{options[:unicorn_signal] || :usr2}".upcase
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/pushapp/version.rb
CHANGED
data/templates/config.rb.erb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'pushapp/tasks/upstart'
|
3
3
|
require 'pushapp/tasks/nginx_export'
|
4
4
|
require 'pushapp/tasks/foreman_export'
|
5
|
+
require 'pushapp/tasks/unicorn_restart'
|
5
6
|
|
6
7
|
# Sample remote definition:
|
7
8
|
#
|
@@ -20,18 +21,20 @@ require 'pushapp/tasks/foreman_export'
|
|
20
21
|
# worker: true
|
21
22
|
# end
|
22
23
|
|
23
|
-
remote 'production', 'app@server3:/home/app/app',
|
24
|
+
remote 'production', 'app@server3:/home/app/app',
|
25
|
+
upstart_jobs: ['worker']
|
26
|
+
env: {RAILS_ENV: 'production'}
|
24
27
|
|
25
28
|
on :setup do
|
26
29
|
task :nginx_export
|
27
30
|
rake('db:create db:migrate db:seed')
|
28
|
-
rake('precompile
|
31
|
+
rake('assets:precompile', env: {RAILS_GROUP: :assets})
|
29
32
|
task(:foreman_export)
|
30
|
-
task(:upstart_restart)
|
31
33
|
end
|
32
34
|
|
33
35
|
on :push do
|
34
36
|
rake('db:migrate')
|
35
|
-
rake('precompile
|
36
|
-
task(:upstart_restart)
|
37
|
+
rake('assets:precompile', env: {RAILS_GROUP: :assets})
|
38
|
+
task(:upstart_restart) # restarting options[:upstart_jobs]
|
39
|
+
task(:unicorn_restart) # sending USR2 signal to unicorn
|
37
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Korolev
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/pushapp/tasks/nginx_export.rb
|
96
96
|
- lib/pushapp/tasks/rake.rb
|
97
97
|
- lib/pushapp/tasks/script.rb
|
98
|
+
- lib/pushapp/tasks/unicorn_signal.rb
|
98
99
|
- lib/pushapp/tasks/upstart.rb
|
99
100
|
- lib/pushapp/version.rb
|
100
101
|
- pushapp.gemspec
|