pushapp 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f0350ae01e3025935899744b2a50baecffb8d66
4
- data.tar.gz: ceb92cb8030bfac6d17b294ce0ab13e632e933c2
3
+ metadata.gz: 5a1d8ee02e33cd268cbc2b1303b646db560e2e98
4
+ data.tar.gz: ad828cb4093f25c0239ec0c3c9cf7d950ccc5c7b
5
5
  SHA512:
6
- metadata.gz: 704bfbd4c0ec5bd280c7cc6d445d21788eb8aab8251019a5fb678d098b6b07ccb3d8937f3b9b3b57698fe551f3ca6d5c5d80bc876dbf0e7e59cf9efb7eae103e
7
- data.tar.gz: e7871a1228f353ffb85a78f6a7bfda03ba6596c7bda8671183e2d4af65063e286b56efc12fb5fbf1378a70520373af8f2bc541f54f034e033dbbe2822346b7ac
6
+ metadata.gz: 46c4f58b16145cbedaf7462b6a99916723602e02db55eecbc41165563a151a5ff4efbb1f93eac8cac82c65643dda8e6be46ab44e31c313a17f467b6e7d053a78
7
+ data.tar.gz: d07572f75d42a15d68859f7996d5a5382841fcc03bd8faea73c0f0b4330dda06fca06b911f7bb54ec94f23720ad223f00e09eb20064f42d075329152ac157591
@@ -60,7 +60,7 @@ module Pushapp
60
60
  event = @options[:event]
61
61
  local = @options[:local]
62
62
  if local
63
- logger.info "Starting tasks on #{event} event"
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}"
@@ -28,6 +28,7 @@ module Pushapp
28
28
  end
29
29
 
30
30
  def system cmd
31
+ logger.debug cmd
31
32
  Pipe.run cmd
32
33
  end
33
34
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Pushapp
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -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', env: {RAILS_ENV: 'production'}
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:assets', env: {RAILS_GROUP: :assets})
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:assets', env: {RAILS_GROUP: :assets})
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
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