joekhoobyar-capistrano-extensions 0.0.5 → 0.0.7

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/Rakefile CHANGED
@@ -16,6 +16,7 @@ begin
16
16
  s.email = "joe@ankhcraft.com"
17
17
 
18
18
  s.add_dependency 'capistrano'
19
+ s.add_dependency 'archive-tar-minitar'
19
20
  end
20
21
  rescue LoadError
21
22
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 5
2
+ :patch: 7
3
3
  :major: 0
4
4
  :minor: 0
@@ -1,7 +1,7 @@
1
1
  module CapistranoExtensions
2
2
  module Files
3
3
 
4
- COMMANDS = [ %w(mkdir mkdir_p rmdir cp cp_r rm rm_r rm_rf
4
+ COMMANDS = [ %w(mkdir mkdir_p rmdir cp cp_r rm rm_f rm_r rm_rf
5
5
  chmod chmod_R chown chown_R touch),
6
6
  %w(ln ln_s ln_sf mv install) ]
7
7
 
@@ -4,10 +4,6 @@ module CapistranoExtensions
4
4
  module Files
5
5
  module Remote
6
6
 
7
- COMMANDS = [ %w(mkdir mkdir_p rmdir cp cp_r rm rm_r rm_rf
8
- chmod chmod_R chown chown_R touch),
9
- %w(ln ln_s ln_sf mv install) ]
10
-
11
7
  COMMANDS.each_with_index do |l,n|
12
8
  l.each do |m|
13
9
  k, f = m.split('_')
@@ -21,6 +17,14 @@ module CapistranoExtensions
21
17
  end
22
18
  end
23
19
 
20
+ FILE_TESTS.each do |m,t|
21
+ class_eval <<-EODEF
22
+ def #{m}(a, options={})
23
+ _t "test #{t}", a
24
+ end
25
+ EODEF
26
+ end
27
+
24
28
  def tail_f(file, n=10)
25
29
  cmd = "tail -n #{n} -f #{_q file}"
26
30
  _via == :system ? local_run(cmd) : stream(cmd, :via => _via)
@@ -49,14 +53,6 @@ module CapistranoExtensions
49
53
  capture('pwd', :via => _via)
50
54
  end
51
55
 
52
- FILE_TESTS.each do |m,t|
53
- class_eval <<-EODEF
54
- def #{m}(a, options={})
55
- _t "test #{t}", a
56
- end
57
- EODEF
58
- end
59
-
60
56
  private
61
57
 
62
58
  def _t(cmd, args=nil, min=nil)
@@ -4,11 +4,12 @@ module CapistranoExtensions
4
4
 
5
5
  DEFAULT_ACTIONS = [:start, :stop]
6
6
 
7
- STATUS_REGEX = /STATE +: +([0-9])+ +([^ ]+)/
8
-
9
7
  # Check for the existance of a generic Windows NT service.
10
- def windows?(id)
11
- `sc query "#{id}"` !~ / FAILED /
8
+ def windows?(id, verbose=false)
9
+ logger.trace "executing locally: sc query \"#{id}\"" if logger and verbose
10
+ $1.to_i if `sc query "#{id}"` =~ /STATE +: +([0-9])+ +([^ ]+)/
11
+ ensure
12
+ logger.trace " service status => #{$2} (#{$1})" if logger and verbose
12
13
  end
13
14
 
14
15
  # Defines a recipe to control a generic Windows NT service.
@@ -30,13 +31,8 @@ module CapistranoExtensions
30
31
  [:default, :status].each do |k|
31
32
  desc "#{svc_desc}: #{SVC_ACTION_CAPTIONS[:status]}" if svc_desc
32
33
  task k, options do
33
- output = `sc query "#{id}"`
34
- if output =~ STATUS_REGEX
35
- logger.trace "Service status: #{svc_name}: #{$2} (#{$1})" if logger
36
- else
37
- logger.error output if logger
34
+ service.windows? id, true or
38
35
  abort "Failed to get service status for #{svc_name}"
39
- end
40
36
  end
41
37
  end
42
38
 
@@ -44,14 +40,16 @@ module CapistranoExtensions
44
40
  svc_action = svc_action.intern if String === svc_action
45
41
  desc "#{svc_desc}: #{SVC_ACTION_CAPTIONS[svc_action]}" if svc_desc
46
42
  task svc_action, options do
47
- system "net #{svc_action} \"#{id}\""
43
+ local_run "net #{svc_action} \"#{id}\""
48
44
  end
49
45
  end
50
46
 
51
47
  desc "#{svc_desc}: #{SVC_ACTION_CAPTIONS[:restart]}" if svc_desc
52
48
  task :restart, options do
53
- `sc query "#{id}"` =~ STATUS_REGEX
54
- $1 == '4' or stop
49
+ case service.windows?(id)
50
+ when 4, 2; stop
51
+ when NilClass; abort "Failed to get service status for #{svc_name}"
52
+ end
55
53
  start
56
54
  end
57
55
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joekhoobyar-capistrano-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Khoobyar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-27 00:00:00 -07:00
12
+ date: 2009-04-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: archive-tar-minitar
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
25
35
  description: Various capistrano extensions
26
36
  email: joe@ankhcraft.com
27
37
  executables: []