procemon 0.4.0 → 0.4.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/lib/procemon.rb CHANGED
@@ -4,17 +4,8 @@ module Procemon
4
4
  require File.join(File.dirname(__FILE__),"procemon","function","require")
5
5
  require_relative_directory File.join("procemon","mpatch")
6
6
  require_relative_directory File.join("procemon","function")
7
+ require 'asynchronous'
7
8
 
8
- # load up helpers
9
- #Dir.glob(\
10
- # File.join(\
11
- # File.dirname(__FILE__),\
12
- # __FILE__.to_s.split(File::Separator).last.split('.')[0],
13
- # '**',"*.{rb,ru}"\
14
- # )\
15
- #).uniq.sort.each do |one_helper_file|
16
- # load one_helper_file
17
- #end
18
9
 
19
10
  def self.init_all
20
11
 
data/procemon.gemspec CHANGED
@@ -20,15 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  ##=======Runtime-ENV================##
23
- #spec.add_runtime_dependency "commander", ['~>4.1.3']
24
- #spec.add_runtime_dependency "activesupport"
25
-
26
- ## Node.JS
27
- #spec.add_runtime_dependency "execjs"
23
+ spec.add_runtime_dependency "asynchronous"#, ['~>4.1.3']
28
24
 
29
25
  ##=======Development-ENV============##
30
- #spec.add_development_dependency "commander",['~>4.1.3']
31
- #spec.add_development_dependency "rake"
32
- #spec.add_development_dependency "bundle"
26
+ spec.add_development_dependency "asynchronous"#,['~>4.1.3']
33
27
 
34
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procemon
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:
@@ -10,7 +10,39 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2014-01-10 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: asynchronous
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: asynchronous
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
14
46
  description: ! 'This is a collection of my Ruby Procs in the adventure of becoming
15
47
  the best! In short this provides extra tools in Application configs, argumens processing,daemonise,eval,
16
48
  getting source of a block,method,process and work with it, or even fuse them into
@@ -40,9 +72,6 @@ files:
40
72
  - lib/procemon/extra/str2duck.rb
41
73
  - lib/procemon/function/application.rb
42
74
  - lib/procemon/function/argv.rb
43
- - lib/procemon/function/async/concurrency.rb
44
- - lib/procemon/function/async/kernel.rb
45
- - lib/procemon/function/async/parallelism.rb
46
75
  - lib/procemon/function/binding/binding.rb
47
76
  - lib/procemon/function/binding/bindless.rb
48
77
  - lib/procemon/function/daemon.rb
@@ -66,7 +95,6 @@ files:
66
95
  - lib/procemon/mpatch/array.rb
67
96
  - lib/procemon/mpatch/boolean.rb
68
97
  - lib/procemon/mpatch/class.rb
69
- - lib/procemon/mpatch/clean.rb
70
98
  - lib/procemon/mpatch/exception.rb
71
99
  - lib/procemon/mpatch/file.rb
72
100
  - lib/procemon/mpatch/hash.rb
@@ -1,54 +0,0 @@
1
- # you can use simple :c also instead of :concurrency
2
- # remember :concurrency is all about GIL case, so
3
- # you can modify the objects in memory
4
- # This is ideal for little operations in simultaneously or
5
- # when you need to update objects in the memory
6
- class Concurrency < CleanClass
7
-
8
- def initialize(callable)
9
- begin
10
- @value= nil
11
- @rescue_state= nil
12
- @thread ||= ::Thread.new { callable.call }
13
- @rescue_state= nil
14
- rescue ThreadError
15
- @rescue_state ||= true
16
- sleep 5
17
- retry
18
- end
19
- end
20
-
21
- def value
22
-
23
- if @value.nil?
24
- until @rescue_state.nil?
25
- sleep 1
26
- end
27
- @value= @thread.value
28
- end
29
-
30
- return @value
31
-
32
- end
33
-
34
- def value=(obj)
35
- @value= obj
36
- end
37
-
38
- def inspect
39
- if @thread.alive?
40
- "#<Async running>"
41
- else
42
- value.inspect
43
- end
44
- end
45
-
46
- def method_missing(method, *args)
47
- value.__send__(method, *args)
48
- end
49
-
50
- def respond_to_missing?(method, include_private = false)
51
- value.respond_to?(method, include_private)
52
- end
53
-
54
- end
@@ -1,18 +0,0 @@
1
- module Kernel
2
- def async(type= :Concurrency ,&block)
3
- type= type.to_s
4
- case type.downcase[0]
5
- when "c"
6
- begin
7
- Concurrency.new(block)
8
- end
9
- when "p"
10
- begin
11
- Parallelism.new(block)
12
- end
13
- else
14
- nil
15
-
16
- end
17
- end
18
- end
@@ -1,89 +0,0 @@
1
- # now let's see the Parallelism
2
- # you can use simple :p also instead of :parallelism
3
- # remember :parallelism is all about real OS thread case, so
4
- # you CANT modify the objects in memory only copy on write modify
5
- # This is ideal for big operations where you need do a big process
6
- # and only get the return value so you can do big works without the fear of the
7
- # Garbage collector slowness or the GIL lock
8
- # when you need to update objects in the memory use :concurrency
9
- class Parallelism < CleanClass
10
-
11
- # Basic
12
- begin
13
-
14
- require 'yaml'
15
- @@pids=[]
16
- def initialize callable
17
-
18
- @value= nil
19
- @rd, @wr = ::IO.pipe
20
- @pid= ::Kernel.fork do
21
-
22
- ::Kernel.trap("TERM") do
23
- exit
24
- end
25
-
26
- @rd.close
27
- @wr.write callable.call.to_yaml
28
- @wr.close
29
-
30
- end
31
-
32
- @@pids.push(@pid)
33
-
34
- end
35
-
36
- end
37
-
38
- # return value
39
- begin
40
-
41
- def value
42
-
43
- if @value.nil?
44
-
45
- @wr.close
46
- return_value= @rd.read
47
- begin
48
- return_value= ::YAML.load(return_value)
49
- rescue ::Exception
50
- end
51
- @rd.close
52
- @@pids.delete(@pid)
53
- @value= return_value
54
-
55
- end
56
-
57
- return @value
58
-
59
- end
60
-
61
-
62
- def value=(obj)
63
- @value= obj
64
- end
65
-
66
- #def method_missing(method,*args)
67
- # value.__send__(method,*args)
68
- #end
69
- #
70
- #def respond_to_missing?(method, include_private = false)
71
- # value.respond_to?(method, include_private)
72
- #end
73
-
74
- end
75
-
76
- # kill Zombies at Kernel Exit
77
- begin
78
- ::Kernel.at_exit {
79
- @@pids.each { |pid|
80
- begin
81
- ::Process.kill(:TERM, pid)
82
- rescue ::Errno::ESRCH, ::Errno::ECHILD
83
- ::STDOUT.puts "`kill': No such process (Errno::ESRCH)"
84
- end
85
- }
86
- }
87
- end
88
-
89
- end
@@ -1,18 +0,0 @@
1
- class CleanClass < BasicObject
2
-
3
- # remove methods from the class!
4
- #def self.purge_methods
5
-
6
- (self.instance_methods-[
7
- :undef_method,
8
- :object_id,
9
- :__send__,
10
- :methods,
11
- :new
12
- ]).each do |method|
13
- undef_method method
14
- end
15
-
16
- #end
17
-
18
- end