runnable 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/runnable/command_parser.rb +1 -1
- data/lib/runnable/extended.rb +1 -1
- data/lib/runnable/gnu.rb +1 -1
- data/lib/runnable.rb +26 -6
- data/runnable.gemspec +3 -3
- metadata +65 -68
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -21,7 +21,7 @@
|
|
21
21
|
# It holds that parameters in a hash and the child has
|
22
22
|
# to be the one who return the formatted string according
|
23
23
|
# to the standard used.
|
24
|
-
class
|
24
|
+
class CommandParser
|
25
25
|
# Create a new instance of the parser.
|
26
26
|
def initialize
|
27
27
|
@params = {}
|
data/lib/runnable/extended.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
require 'runnable/command_parser'
|
19
19
|
|
20
20
|
# Parse the parameter hash using the extended standard.
|
21
|
-
class Extended <
|
21
|
+
class Extended < CommandParser
|
22
22
|
|
23
23
|
# Convert a hash in a Extended style string options.
|
24
24
|
# @return [String] Extended-style parsed params in a raw character array.
|
data/lib/runnable/gnu.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
require 'runnable/command_parser'
|
19
19
|
|
20
20
|
# Parse the parameter hash using the GNU standard.
|
21
|
-
class Gnu <
|
21
|
+
class Gnu < CommandParser
|
22
22
|
|
23
23
|
# This method convert a hash in a string ready to
|
24
24
|
# be passed to a command that uses GNU style to parse command line
|
data/lib/runnable.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
require 'runnable/gnu'
|
20
20
|
require 'runnable/extended'
|
21
|
+
require 'fileutils'
|
21
22
|
|
22
23
|
# Convert a executable command in a Ruby-like class
|
23
24
|
# you are able to start, define params and send signals (like kill, or stop)
|
@@ -222,6 +223,10 @@ class Runnable
|
|
222
223
|
@run_thread.join if @run_thread.alive?
|
223
224
|
end
|
224
225
|
|
226
|
+
def running?
|
227
|
+
Dir.exists?( "/proc/#{@pid}")
|
228
|
+
end
|
229
|
+
|
225
230
|
# Calculate the estimated memory usage in Kb.
|
226
231
|
# @return [Number] Estimated mem usage in Kb.
|
227
232
|
def mem
|
@@ -348,21 +353,36 @@ class Runnable
|
|
348
353
|
# @return [nil]
|
349
354
|
def failed( exceptions )
|
350
355
|
end
|
351
|
-
|
352
|
-
protected
|
353
356
|
|
354
357
|
# Send the desired signal to the command.
|
355
358
|
# @param [Symbol] Signal to be send to the command.
|
356
359
|
# @todo raise ESRCH if pid is not in system
|
357
360
|
# or EPERM if pid is not from user.
|
358
|
-
def send_signal( signal )
|
361
|
+
def send_signal( signal )
|
359
362
|
if signal == :stop
|
360
|
-
|
363
|
+
signal = :SIGINT
|
361
364
|
elsif signal == :kill
|
362
|
-
|
365
|
+
signal = :SIGKILL
|
366
|
+
end
|
367
|
+
|
368
|
+
`ps -ef`.each_line do |line|
|
369
|
+
line = line.split
|
370
|
+
pid = line[1]
|
371
|
+
ppid = line[2]
|
372
|
+
|
373
|
+
if ppid.to_i == @pid
|
374
|
+
Process.kill( signal, pid.to_i )
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
begin
|
379
|
+
Process.kill( signal, @pid )
|
380
|
+
rescue Errno::ESRCH
|
381
|
+
# As we kill child processes, main process may have exit already
|
363
382
|
end
|
364
383
|
end
|
365
|
-
|
384
|
+
|
385
|
+
protected
|
366
386
|
# Redirect command I/O to log files.
|
367
387
|
# These files are located in /var/log/runnable.
|
368
388
|
# @param [Hash] Outputs options.
|
data/runnable.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{runnable}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rafael García", "Luis Ciudad", "Pedro Navajas", "Javier Aranda"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-08}
|
13
13
|
s.description = %q{Convert a executable command in a Ruby-like class you are able to start, define params and send signals (like kill, or stop)}
|
14
14
|
s.email = ["rgarcia@nosolosoftware.biz", "lciudad@nosolosoftware.biz", "pnavajas@nosolosoftware.biz", "jaranda@nosolosoftware.biz"]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.homepage = %q{http://github.com/nosolosoftware/runnable}
|
29
29
|
s.licenses = ["GPL-3"]
|
30
30
|
s.require_paths = ["lib"]
|
31
|
-
s.rubygems_version = %q{1.
|
31
|
+
s.rubygems_version = %q{1.6.2}
|
32
32
|
s.summary = %q{A Ruby gem for execute and control system commands}
|
33
33
|
|
34
34
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,99 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: runnable
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
7
|
+
authors:
|
8
|
+
- Rafael García
|
9
9
|
- Luis Ciudad
|
10
10
|
- Pedro Navajas
|
11
11
|
- Javier Aranda
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
|
16
|
-
|
17
|
-
dependencies:
|
18
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
date: 2011-08-08 00:00:00.000000000 +02:00
|
16
|
+
default_executable:
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
19
|
name: rake
|
20
|
-
requirement: &
|
20
|
+
requirement: &20613220 !ruby/object:Gem::Requirement
|
21
21
|
none: false
|
22
|
-
requirements:
|
23
|
-
- -
|
24
|
-
- !ruby/object:Gem::Version
|
22
|
+
requirements:
|
23
|
+
- - ! '>='
|
24
|
+
- !ruby/object:Gem::Version
|
25
25
|
version: 0.8.7
|
26
26
|
type: :development
|
27
27
|
prerelease: false
|
28
|
-
version_requirements: *
|
29
|
-
- !ruby/object:Gem::Dependency
|
28
|
+
version_requirements: *20613220
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
30
|
name: yard
|
31
|
-
requirement: &
|
31
|
+
requirement: &20606980 !ruby/object:Gem::Requirement
|
32
32
|
none: false
|
33
|
-
requirements:
|
34
|
-
- -
|
35
|
-
- !ruby/object:Gem::Version
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
36
|
version: 0.6.8
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
|
-
version_requirements: *
|
40
|
-
- !ruby/object:Gem::Dependency
|
39
|
+
version_requirements: *20606980
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
41
|
name: rspec
|
42
|
-
requirement: &
|
42
|
+
requirement: &20605980 !ruby/object:Gem::Requirement
|
43
43
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
47
|
version: 2.5.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
|
-
version_requirements: *
|
51
|
-
- !ruby/object:Gem::Dependency
|
50
|
+
version_requirements: *20605980
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
52
|
name: cucumber
|
53
|
-
requirement: &
|
53
|
+
requirement: &20604860 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
58
|
version: 0.10.2
|
59
59
|
type: :development
|
60
60
|
prerelease: false
|
61
|
-
version_requirements: *
|
62
|
-
- !ruby/object:Gem::Dependency
|
61
|
+
version_requirements: *20604860
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
63
|
name: jeweler
|
64
|
-
requirement: &
|
64
|
+
requirement: &20603560 !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
69
|
version: 1.6.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
|
-
version_requirements: *
|
73
|
-
- !ruby/object:Gem::Dependency
|
72
|
+
version_requirements: *20603560
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
74
|
name: bluecloth
|
75
|
-
requirement: &
|
75
|
+
requirement: &20602440 !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
80
|
version: 2.1.0
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
|
-
version_requirements: *
|
84
|
-
description: Convert a executable command in a Ruby-like class you are able to start,
|
85
|
-
|
83
|
+
version_requirements: *20602440
|
84
|
+
description: Convert a executable command in a Ruby-like class you are able to start,
|
85
|
+
define params and send signals (like kill, or stop)
|
86
|
+
email:
|
86
87
|
- rgarcia@nosolosoftware.biz
|
87
88
|
- lciudad@nosolosoftware.biz
|
88
89
|
- pnavajas@nosolosoftware.biz
|
89
90
|
- jaranda@nosolosoftware.biz
|
90
91
|
executables: []
|
91
|
-
|
92
92
|
extensions: []
|
93
|
-
|
94
|
-
extra_rdoc_files:
|
93
|
+
extra_rdoc_files:
|
95
94
|
- README.markdown
|
96
|
-
files:
|
95
|
+
files:
|
97
96
|
- COPYING
|
98
97
|
- README.markdown
|
99
98
|
- VERSION
|
@@ -102,35 +101,33 @@ files:
|
|
102
101
|
- lib/runnable/extended.rb
|
103
102
|
- lib/runnable/gnu.rb
|
104
103
|
- runnable.gemspec
|
104
|
+
has_rdoc: true
|
105
105
|
homepage: http://github.com/nosolosoftware/runnable
|
106
|
-
licenses:
|
106
|
+
licenses:
|
107
107
|
- GPL-3
|
108
108
|
post_install_message:
|
109
109
|
rdoc_options: []
|
110
|
-
|
111
|
-
require_paths:
|
110
|
+
require_paths:
|
112
111
|
- lib
|
113
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
113
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
segments:
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
segments:
|
120
119
|
- 0
|
121
|
-
|
122
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
hash: 3781212566389578012
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
122
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version:
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
128
127
|
requirements: []
|
129
|
-
|
130
128
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
129
|
+
rubygems_version: 1.6.2
|
132
130
|
signing_key:
|
133
131
|
specification_version: 3
|
134
132
|
summary: A Ruby gem for execute and control system commands
|
135
133
|
test_files: []
|
136
|
-
|