capistrano-psw 1.0.0.pre3 → 1.0.0.pre4

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: a10cca1d8a1806c683e492e54abc5fb57ba8248f
4
- data.tar.gz: 74f6da6da16df0e2bdecc741fd0b7587660a56bf
3
+ metadata.gz: 18cc9cbde5f8fc0016f6d2848aba4fcefb9c8a8c
4
+ data.tar.gz: 279af90d9d6dec0b321b13416d81495e8cd76a60
5
5
  SHA512:
6
- metadata.gz: 3e198392eb2b804942382e258ccdb2c505701889dfcbf253f15d2f8693644f2ca578f2fe082f7fe38af10bbd7991c6c4e6f17167fa2cdae799d3de771b731216
7
- data.tar.gz: 120e51e2790d3826031e1da4fdf7f5432f394ae2f63340e36d1e816ea151ad625009673501d46c7a95b1bf2148431e94ad2e1b2818d5330ce4971a1e8290ed49
6
+ metadata.gz: 82f12b6366d83184b020411d3dffb6ad1d2708dabcbc0574766b6182cca828f938828cc61538987aa9ba2c045000ae74760e3647d634f886205549d3fed7ff6c
7
+ data.tar.gz: a66c0d46129b6128ee29ffa11cc2d3f9bb5a95db536f0afa32cac9c5ef9aa2a391c4c9ed5e44a53516cb5d4320eb1c9fed72f0d0367ddbfa2d18b406536e7415
data/README.md CHANGED
@@ -10,6 +10,7 @@ it; however the v3 branch is a requirement for using these tasks.
10
10
 
11
11
  Add this line to your application's Gemfile:
12
12
 
13
+ gem 'rake'
13
14
  gem 'capistrano-psw'
14
15
 
15
16
  And then execute:
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Capistrano
12
12
  module Psw
13
- VERSION = "1.0.0.pre3"
13
+ VERSION = "1.0.0.pre4"
14
14
  end
15
15
  end
@@ -37,7 +37,13 @@
37
37
  # Copyright:: 2013 Lexmark International Technology S.A. All rights reserved.
38
38
  # License:: 3-Clause BSD
39
39
 
40
- require 'find'
40
+ require 'find'
41
+
42
+ class String
43
+ def self.blank?(str)
44
+ str.nil? or str.empty?
45
+ end
46
+ end
41
47
 
42
48
  namespace :psw_sidekiq do
43
49
 
@@ -64,6 +70,14 @@ namespace :psw_sidekiq do
64
70
  "#{base_pid_dir}/sidekiq-#{idx}.pid"
65
71
  end
66
72
 
73
+ def get_rbenv_prefix()
74
+ if !String.blank?(fetch(:default_env)) and !String.blank?(fetch(:default_env)[:path]) and !String.blank?(fetch(:rbenv_path)) and !String.blank?(fetch(:rbenv_ruby))
75
+ return "PATH=#{fetch(:default_env)[:path]} RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)}"
76
+ end
77
+
78
+ ''
79
+ end
80
+
67
81
  desc "Start sidekiq server(s)..."
68
82
  task :start do
69
83
  on roles(:all) do |host|
@@ -83,6 +97,7 @@ namespace :psw_sidekiq do
83
97
  info "Creating log file (#{sidekiq_log_file})..."
84
98
  execute :rm, '-rf', "#{sidekiq_log_file}"
85
99
  execute :touch, "", "#{sidekiq_log_file}"
100
+ rbenv_prefix = get_rbenv_prefix()
86
101
 
87
102
  idx = 0
88
103
  for pid_file in pid_file_names do
@@ -94,7 +109,7 @@ namespace :psw_sidekiq do
94
109
  start_command="cd #{current_path} && nohup #{sidekiq_command} -d -e #{rails_env} -i #{idx} -P #{pid_file} -L #{sidekiq_log_file} >> #{sidekiq_log_file} 2>&1"
95
110
  info "Executing command: #{start_command}"
96
111
 
97
- execute :cd, "#{current_path}", "&& sudo nohup #{sidekiq_command} -d -e #{rails_env} -i #{idx} -P #{pid_file} -L #{sidekiq_log_file} >> #{sidekiq_log_file} 2>&1"
112
+ execute "cd #{current_path} && #{rbenv_prefix} nohup #{fetch(:rbenv_path)}/bin/rbenv exec #{sidekiq_command} -d -e #{rails_env} -i #{idx} -P #{pid_file} -L #{sidekiq_log_file} >> #{sidekiq_log_file} 2>&1"
98
113
 
99
114
  idx = idx + 1
100
115
  end
@@ -121,7 +136,9 @@ namespace :psw_sidekiq do
121
136
  begin
122
137
  sudo :kill, "-0", "$(cat #{pid_file})"
123
138
  sidekiq_command="#{fetch(:psw_sidekiq_bundle_cmd)} exec sidekiqctl"
124
- execute :cd, "#{current_path}", "&& sudo #{sidekiq_command} stop #{pid_file} 10"
139
+ rbenv_prefix = get_rbenv_prefix()
140
+
141
+ execute "cd #{current_path} && #{rbenv_prefix} #{fetch(:rbenv_path)}/bin/rbenv exec #{sidekiq_command} stop #{pid_file} 10"
125
142
  rescue
126
143
  info "An error occurred stopping #{pid_file}. Cleaning up remaining artifacts..."
127
144
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-psw
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre3
4
+ version: 1.0.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lexmark International Technology S.A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-11 00:00:00.000000000 Z
11
+ date: 2013-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler