spawncamp 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -12
- data/lib/spawncamp.rb +1 -21
- data/lib/spawncamp/base.rb +18 -0
- data/lib/spawncamp/stats.rb +14 -0
- data/lib/spawncamp/version.rb +1 -1
- data/spawncamp.gemspec +1 -0
- metadata +27 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e3cbed1bee5624619927bbe32091313af25db41
|
4
|
+
data.tar.gz: c20f27961d6d782399a59c41b8584a9ecc8f79fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac60eb4762695781bccd87038e5ca0ed578fe940b90a60b4252a3ee3738eb3e63933685a1e73c100abf5fa4e52eff7c0cf13a307ada0d400b13cb52e3271a631
|
7
|
+
data.tar.gz: 80b28a12c1b7a5482712e7648e14c93e52fe219fed384ffa2db31da6d7516b683644ada6290b7a97902b3d55d49c29841324b6f759180642c9ee105c1beebb6e
|
data/README.md
CHANGED
@@ -20,30 +20,49 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
simply include the library and have access `Spawncamp::spawn` and `Spawncamp::spawn_loop`
|
22
22
|
|
23
|
-
### Spawncamp::spawn
|
23
|
+
### Spawncamp::Base::spawn
|
24
24
|
|
25
|
-
```ruby
|
26
|
-
|
25
|
+
```ruby
|
26
|
+
require 'spawncamp'
|
27
27
|
proc = puts 'child_process'
|
28
|
-
spawn(proc)
|
29
|
-
spawn(proc)
|
30
|
-
spawn(proc)
|
31
|
-
spawn(proc)
|
32
|
-
spawn(proc)
|
28
|
+
Spawncamp::spawn(proc)
|
29
|
+
Spawncamp::spawn(proc)
|
30
|
+
Spawncamp::spawn(proc)
|
31
|
+
Spawncamp::spawn(proc)
|
32
|
+
Spawncamp::spawn(proc)
|
33
33
|
```
|
34
34
|
|
35
|
-
### Spawncamp::spawn_loop
|
35
|
+
### Spawncamp::Base::spawn_loop
|
36
36
|
__spawning loops is drastic so beware, this is a non killable process__
|
37
37
|
|
38
|
-
```ruby
|
39
|
-
|
38
|
+
```ruby
|
39
|
+
require 'spawncamp'
|
40
40
|
proc = puts 'constant process i will never die!'
|
41
|
-
spawn_loop(proc)
|
41
|
+
Spawncamp::spawn_loop(proc)
|
42
|
+
```
|
43
|
+
|
44
|
+
### Spawncamp::Stats::get_current_process
|
45
|
+
retreive current process id (pid)
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
require 'spawncamp'
|
49
|
+
|
50
|
+
Spawncamp::Stats::get_current_process
|
51
|
+
```
|
52
|
+
|
53
|
+
### Spawncamp::Stats::get_running_processes
|
54
|
+
retreive list of currently running process id's (pids)
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
require 'spawncamp'
|
58
|
+
|
59
|
+
Spawncamp::Stats::get_running_processes
|
42
60
|
```
|
43
61
|
|
44
62
|
### API
|
45
63
|
generate api docs by running
|
46
64
|
`$ rake docs`
|
65
|
+
hosted docs are avalible [Here](http://sableloki.github.io/spawncamp)
|
47
66
|
|
48
67
|
## Contributing
|
49
68
|
|
data/lib/spawncamp.rb
CHANGED
@@ -1,22 +1,2 @@
|
|
1
1
|
require "spawncamp/version"
|
2
|
-
|
3
|
-
module Spawncamp
|
4
|
-
|
5
|
-
def spawn
|
6
|
-
child_pid = fork do |action|
|
7
|
-
puts "Child Process #{child_pid}"
|
8
|
-
"#{action}"
|
9
|
-
exit
|
10
|
-
end
|
11
|
-
puts "Child Process #{child_pid} has finished"
|
12
|
-
end
|
13
|
-
|
14
|
-
def spawn_loop
|
15
|
-
loop_child = fork do |action|
|
16
|
-
puts "Loop #{loop_child}"
|
17
|
-
"#{action}"
|
18
|
-
end
|
19
|
-
puts "Loop Process Running #{loop_child}"
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
2
|
+
require "spawncamp/base"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Spawncamp
|
2
|
+
def spawn
|
3
|
+
child_pid = fork do |action|
|
4
|
+
puts "Child Process #{child_pid}"
|
5
|
+
exec "ruby #{action}"
|
6
|
+
exit
|
7
|
+
end
|
8
|
+
puts "Child Process #{child_pid} has finished"
|
9
|
+
end
|
10
|
+
|
11
|
+
def spawn_loop
|
12
|
+
loop_child = fork do |action|
|
13
|
+
puts "Loop #{loop_child}"
|
14
|
+
exec "ruby #{action}"
|
15
|
+
end
|
16
|
+
puts "Loop Process Running #{loop_child}"
|
17
|
+
end
|
18
|
+
end
|
data/lib/spawncamp/version.rb
CHANGED
data/spawncamp.gemspec
CHANGED
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spawncamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Burns
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.5'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sys-proctable
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
description: Small library for spawning and managing child processes
|
@@ -59,12 +73,14 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
-
|
76
|
+
- .gitignore
|
63
77
|
- Gemfile
|
64
78
|
- LICENSE.txt
|
65
79
|
- README.md
|
66
80
|
- Rakefile
|
67
81
|
- lib/spawncamp.rb
|
82
|
+
- lib/spawncamp/base.rb
|
83
|
+
- lib/spawncamp/stats.rb
|
68
84
|
- lib/spawncamp/version.rb
|
69
85
|
- spawncamp.gemspec
|
70
86
|
homepage: ''
|
@@ -77,12 +93,12 @@ require_paths:
|
|
77
93
|
- lib
|
78
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
95
|
requirements:
|
80
|
-
- -
|
96
|
+
- - '>='
|
81
97
|
- !ruby/object:Gem::Version
|
82
98
|
version: '0'
|
83
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
100
|
requirements:
|
85
|
-
- -
|
101
|
+
- - '>='
|
86
102
|
- !ruby/object:Gem::Version
|
87
103
|
version: '0'
|
88
104
|
requirements: []
|