easy-deployment 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Easy
2
2
  module Deployment
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -4,6 +4,10 @@
4
4
  Capistrano::Configuration.instance(:must_exist).load do
5
5
  set :niet_process_count, 2
6
6
 
7
+ def remote_file_exists?(full_path)
8
+ 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
9
+ end
10
+
7
11
  namespace :niet do
8
12
  desc "Setup Niet"
9
13
  task :setup, roles: :job do
@@ -12,14 +16,22 @@ Capistrano::Configuration.instance(:must_exist).load do
12
16
 
13
17
  desc "Starts the niet process monitor and its jobs"
14
18
  task :start, roles: :job do
15
- niet_process_count.times do |i|
16
- run "niet -p #{shared_path}/niet/jobs_worker_#{i}.pid -c #{current_path} bundle exec rake jobs:work RAILS_ENV=#{stage}"
19
+ if remote_file_exists?("#{shared_path}/niet")
20
+ niet_process_count.times do |i|
21
+ run "niet -p #{shared_path}/niet/jobs_worker_#{i}.pid -c #{current_path} bundle exec rake jobs:work RAILS_ENV=#{stage}"
22
+ end
23
+ else
24
+ raise StandardError, "shared niet directory doesn't exist! Please run `cap #{stage} niet:setup` first"
17
25
  end
18
26
  end
19
27
 
20
28
  desc "Restarts the processes running under niet"
21
29
  task :restart, roles: :job do
22
- run "for job in #{shared_path}/niet/* ; do kill -TERM `cat $job`; done"
30
+ if remote_file_exists?("#{shared_path}/niet")
31
+ run "for job in #{shared_path}/niet/* ; do kill -TERM `cat $job`; done"
32
+ else
33
+ raise StandardError, "shared niet directory doesn't exist! Please run `cap #{stage} niet:setup` first"
34
+ end
23
35
  end
24
36
 
25
37
  desc "Stops the processes running under niet and the niet process monitor"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-deployment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-11-19 00:00:00.000000000 Z
15
+ date: 2012-12-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -161,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  segments:
163
163
  - 0
164
- hash: -1607441338251001617
164
+ hash: -3765097199818063261
165
165
  required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  none: false
167
167
  requirements:
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  segments:
172
172
  - 0
173
- hash: -1607441338251001617
173
+ hash: -3765097199818063261
174
174
  requirements: []
175
175
  rubyforge_project:
176
176
  rubygems_version: 1.8.24