emmy-machine 0.2 → 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 +1 -1
- data/emmy_machine.gemspec +11 -7
- data/lib/emmy_machine/class_methods.rb +16 -8
- data/lib/emmy_machine/deferred.rb +2 -2
- data/lib/emmy_machine/version.rb +1 -1
- data/spec/emmy_machine_spec.rb +10 -10
- metadata +30 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3ad3e71202672a3562713e1c85ad47e4b7739e0
|
4
|
+
data.tar.gz: 9724037ad6dc9153cbaff317d6d70427fed2205a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7738f684fdb57e1d6e66b1a3eaa75c94a680722c0fa21fbde8bb4f2f761de848c24613223b63d619deb77c0a82a6ff2c9015bfbc4b468d186501a6a63a1f8f9f
|
7
|
+
data.tar.gz: 216c025ed2df64ad558de270ea96fdfd6b93e774d51152e52e0bba659048cbb070efb96a54a3f4cb62a00f62104a1e323d9dfdd066e35aa802023fc0ee35c4af
|
data/README.md
CHANGED
data/emmy_machine.gemspec
CHANGED
@@ -6,10 +6,10 @@ require 'emmy_machine/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "emmy-machine"
|
8
8
|
spec.version = EmmyMachine::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Maksim V."]
|
10
10
|
spec.email = ["inre.storm@gmail.com"]
|
11
|
-
spec.summary = %q{EventMachine with
|
12
|
-
|
11
|
+
spec.summary = %q{Cover EventMachine with fiber's sugar}
|
12
|
+
spec.description = spec.summary
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -18,10 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
21
|
+
spec.required_ruby_version = '>= 2.1.0'
|
22
|
+
spec.required_rubygems_version = '>= 2.3.0'
|
23
|
+
|
24
|
+
spec.add_dependency "fibre", "~> 1"
|
25
|
+
spec.add_dependency "event_object", "~> 1"
|
22
26
|
|
23
27
|
spec.add_development_dependency "eventmachine", "~> 1.0"
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.
|
25
|
-
spec.add_development_dependency "rspec", "~> 3
|
26
|
-
spec.add_development_dependency "rake", "~> 10
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3"
|
30
|
+
spec.add_development_dependency "rake", "~> 10"
|
27
31
|
end
|
@@ -16,30 +16,38 @@ module EmmyMachine
|
|
16
16
|
EventMachine.stop
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def run_once &b
|
20
20
|
EventMachine.run do
|
21
|
-
|
21
|
+
async do
|
22
22
|
yield
|
23
23
|
stop
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
Fibre.
|
28
|
+
def init_pool(*a)
|
29
|
+
Fibre.init_pool(*a)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
def pool
|
33
|
+
Fibre.pool
|
34
|
+
end
|
35
|
+
|
36
|
+
def async &b
|
37
|
+
pool.checkout &b
|
38
|
+
end
|
39
|
+
|
40
|
+
# Run the timer periodically
|
33
41
|
def timer(interval=1, &b)
|
34
42
|
EventMachine::PeriodicTimer.new(interval) do
|
35
|
-
|
43
|
+
async &b
|
36
44
|
end
|
37
45
|
end
|
38
46
|
|
39
|
-
#
|
47
|
+
# Run the timer once
|
40
48
|
def timeout(interval=1, &b)
|
41
49
|
EventMachine::Timer.new(interval) do
|
42
|
-
|
50
|
+
async &b
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
data/lib/emmy_machine/version.rb
CHANGED
data/spec/emmy_machine_spec.rb
CHANGED
@@ -3,21 +3,21 @@ require "spec_helper"
|
|
3
3
|
describe EmmyMachine do
|
4
4
|
using EventObject
|
5
5
|
|
6
|
-
it "
|
6
|
+
it "calls run_once" do
|
7
7
|
expect { |block|
|
8
|
-
EmmyMachine.
|
8
|
+
EmmyMachine.run_once &block
|
9
9
|
}.to yield_control
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "calls run_once then an error will be raised" do
|
13
13
|
expect {
|
14
|
-
EmmyMachine.
|
14
|
+
EmmyMachine.run_once do
|
15
15
|
raise "error"
|
16
16
|
end
|
17
17
|
}.to raise_error Fibre::FiberError
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
20
|
+
it "connects to the Github's index page" do
|
21
21
|
expect { |block|
|
22
22
|
EventMachine.run do
|
23
23
|
http = EmmyMachine.connect("tcp://github.com:80")
|
@@ -37,7 +37,7 @@ describe EmmyMachine do
|
|
37
37
|
}.to yield_control.at_least(1)
|
38
38
|
end
|
39
39
|
|
40
|
-
context "
|
40
|
+
context "The reactor is required" do
|
41
41
|
around do |example|
|
42
42
|
EventMachine.run do
|
43
43
|
example.run
|
@@ -45,12 +45,12 @@ describe EmmyMachine do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "is runned" do
|
49
49
|
expect(EmmyMachine.running?).to be true
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
context "
|
53
|
+
context "The reactor and the fibers are required" do
|
54
54
|
around do |example|
|
55
55
|
EventMachine.run do
|
56
56
|
Fibre.pool.checkout do
|
@@ -60,12 +60,12 @@ describe EmmyMachine do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "is deferred" do
|
64
64
|
defer = EmmyMachine::Deferred.new
|
65
65
|
EmmyMachine.timer(0) do
|
66
66
|
defer.success!('OK')
|
67
67
|
end
|
68
|
-
res = defer.
|
68
|
+
res = defer.await
|
69
69
|
|
70
70
|
expect(res).to eq('OK')
|
71
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Maksim V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fibre
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: event_object
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: eventmachine
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,43 +58,43 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
61
|
+
version: '1.12'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
68
|
+
version: '1.12'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3
|
75
|
+
version: '3'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3
|
82
|
+
version: '3'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '10
|
89
|
+
version: '10'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '10
|
83
|
-
description:
|
96
|
+
version: '10'
|
97
|
+
description: Cover EventMachine with fiber's sugar
|
84
98
|
email:
|
85
99
|
- inre.storm@gmail.com
|
86
100
|
executables: []
|
@@ -112,18 +126,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
126
|
requirements:
|
113
127
|
- - ">="
|
114
128
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
129
|
+
version: 2.1.0
|
116
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
131
|
requirements:
|
118
132
|
- - ">="
|
119
133
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
134
|
+
version: 2.3.0
|
121
135
|
requirements: []
|
122
136
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
124
138
|
signing_key:
|
125
139
|
specification_version: 4
|
126
|
-
summary: EventMachine with
|
140
|
+
summary: Cover EventMachine with fiber's sugar
|
127
141
|
test_files:
|
128
142
|
- spec/emmy_machine_spec.rb
|
129
143
|
- spec/spec_helper.rb
|