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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec093abcd08ae7c1e975dada7e31f4ae65d7cd4a
4
- data.tar.gz: 43063018adc350712f6aa9d78380aaa8f74b3879
3
+ metadata.gz: 9e3cbed1bee5624619927bbe32091313af25db41
4
+ data.tar.gz: c20f27961d6d782399a59c41b8584a9ecc8f79fd
5
5
  SHA512:
6
- metadata.gz: 6ec9a4bfe3b2c116b1d53b12087d127a3581e7559ce354aacef5e9e2b11c1693a169d956fd08f72309399788a9223f8e23339379948cedf30b1d4b8a553d4c6f
7
- data.tar.gz: 42de37b4dfaa0bdf35a180aa11111009547f72f62efaadb41c8df547bffcd865b55e61e09d57616fe2a258ea6fcd401d0b3de2993275705a91772916736d078b
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
- include Spawncamp
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
- include Spawncamp
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
 
@@ -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
@@ -0,0 +1,14 @@
1
+ require 'sys/proctable'
2
+
3
+ module Spawncamp
4
+ module Stats
5
+ def get_running_processes
6
+ Sys::ProcTable.ps.select{ |pe| pe.ppid == $$ }
7
+ end
8
+
9
+ def get_current_process
10
+ pid = Process.pid
11
+ puts pid
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Spawncamp
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "sdoc"
24
+ spec.add_dependency "sys-proctable"
24
25
  end
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.1
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-20 00:00:00.000000000 Z
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
- - ".gitignore"
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: []