emmy 0.1.2 → 0.2

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: 84a1412b90058a8a3043c5659fbb3f78b6530a71
4
- data.tar.gz: c2925633a083353fd23ca923f14655e48c2026cc
3
+ metadata.gz: 8f0b27bd609b9a32c86753482d429f794f2def6c
4
+ data.tar.gz: fe81ea248ae1509e57dc60656777996399bba204
5
5
  SHA512:
6
- metadata.gz: c5109ef3e2451249875f9de8fc8d7a990df43a5e4bf6a40c412ecef5a9d20a5b4ee0701040a7e2439ca13120a6c3e119c4b270529bac24728a426d39d12320b7
7
- data.tar.gz: 1a61d6f352656c2d20a6eed1a90ee116f3bcac5ef3ef5ff0f7bfc57aec25ab455dd54584e2089998458b617613c5e662342c3526b2c5621e095ab2b71adbbe11
6
+ metadata.gz: a5c65b2895ffa420c0136c6dcd3c1d8a9c60114f3ba4aa53abc31b889f79194d36611b619bc1bb08f6f72633ee0681144555072d090330930d8bc76aef52ad6b
7
+ data.tar.gz: 4666334739939f164c0018bff0c161c4fff6dbf524fba3c75caab216d9382e66f86ecd532753725d2a3c6cc26b8abaf854ae9ec2b8c65103f601e6dbab780872
data/README.md CHANGED
@@ -1,43 +0,0 @@
1
- # Emmy
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'emmy'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install emmy
18
-
19
- ## Modules
20
-
21
- * emmy - required all emmy gems and have emmy bash command
22
- * emmy-machine - systax sugar for EventMachine
23
- * emmy-http - thin runner and cover for EmHttpRequest
24
- * emmy-log - Logging system for emmy
25
-
26
- ## Namespaces
27
-
28
- * EmmyMachine
29
- * EmmyHttp
30
- * EmmyLog
31
- * Emmy
32
-
33
- ## Usage
34
-
35
-
36
-
37
- ## Contributing
38
-
39
- 1. Fork it ( https://github.com/chelovekov/emmy/fork )
40
- 2. Create your feature branch (`git checkout -b my-new-feature`)
41
- 3. Commit your changes (`git commit -am 'Add some feature'`)
42
- 4. Push to the branch (`git push origin my-new-feature`)
43
- 5. Create a new Pull Request
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emmy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
- - che
7
+ - inre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-15 00:00:00.000000000 Z
11
+ date: 2015-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: event_object
14
+ name: emmy-engine
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: 0.1.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: '0.9'
26
+ version: 0.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: emmy-machine
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: emmy-http
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -82,33 +96,12 @@ dependencies:
82
96
  version: '0'
83
97
  description:
84
98
  email:
85
- - chelovekov@gmail.com
99
+ - inre.storm@gmail.com
86
100
  executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
- - ".gitignore"
91
- - Gemfile
92
- - LICENSE.txt
93
104
  - README.md
94
- - Rakefile
95
- - emmy-machine/.gitignore
96
- - emmy-machine/Gemfile
97
- - emmy-machine/LICENSE.txt
98
- - emmy-machine/README.md
99
- - emmy-machine/Rakefile
100
- - emmy-machine/emmy_machine.gemspec
101
- - emmy-machine/lib/emmy_machine.rb
102
- - emmy-machine/lib/emmy_machine/class_methods.rb
103
- - emmy-machine/lib/emmy_machine/connection.rb
104
- - emmy-machine/lib/emmy_machine/version.rb
105
- - emmy-machine/spec/emmy_machine_spec.rb
106
- - emmy-machine/spec/spec_helper.rb
107
- - emmy.gemspec
108
- - lib/emmy.rb
109
- - lib/emmy/version.rb
110
- - spec/emmy_spec.rb
111
- - spec/spec_helper.rb
112
105
  homepage: ''
113
106
  licenses:
114
107
  - MIT
@@ -129,10 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
122
  version: '0'
130
123
  requirements: []
131
124
  rubyforge_project:
132
- rubygems_version: 2.4.1
125
+ rubygems_version: 2.4.3
133
126
  signing_key:
134
127
  specification_version: 4
135
128
  summary: Emmy - EventMachine-based framework
136
- test_files:
137
- - spec/emmy_spec.rb
138
- - spec/spec_helper.rb
129
+ test_files: []
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in emmy.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 che
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/emmy-machine/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in emmy_machine.gemspec
4
- gemspec
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Che
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,3 +0,0 @@
1
- # EmmyMachine
2
-
3
- Don't use directly use emmy gem instead
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'emmy_machine/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "emmy-machine"
8
- spec.version = EmmyMachine::VERSION
9
- spec.authors = ["Che"]
10
- spec.email = ["chelovekov@gmail.com"]
11
- spec.summary = %q{Fibered methods for Emmy}
12
- #spec.description = %q{TODO: Write a longer description. Optional.}
13
- spec.homepage = ""
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency "eventmachine", "~> 1.0.3"
22
- spec.add_dependency "fibre", "~> 0.9.0"
23
-
24
- spec.add_development_dependency "bundler", "~> 1.6"
25
- spec.add_development_dependency "rspec", "~> 3"
26
- spec.add_development_dependency "rake"
27
- end
@@ -1,10 +0,0 @@
1
- require "fibre"
2
- require "eventmachine"
3
-
4
- require "emmy_machine/version"
5
- require "emmy_machine/connection"
6
- require "emmy_machine/class_methods"
7
-
8
- module EmmyMachine
9
- extend ClassMethods
10
- end
@@ -1,104 +0,0 @@
1
- module EmmyMachine
2
- module ClassMethods
3
- def run(&b)
4
- EventMachine.reactor_running? ? b.call : EventMachine.run(&b)
5
- end
6
-
7
- def loop
8
- EventMachine.run
9
- end
10
-
11
- def running?
12
- EventMachine.reactor_running?
13
- end
14
-
15
- def stop
16
- EventMachine.stop
17
- end
18
-
19
- def run_block &b
20
- EventMachine.run_block do
21
- fiber_block &b
22
- end
23
- end
24
-
25
- def fiber_block &b
26
- Fibre.pool.checkout &b
27
- end
28
-
29
- # Periodic timer
30
- def timer(interval=1, &b)
31
- EventMachine::PeriodicTimer.new(interval) do
32
- fiber_block &b
33
- end
34
- end
35
-
36
- #
37
- # One run timer
38
- #
39
- # timeout 5 do
40
- # puts "This message shows after 5 seconds"
41
- # end
42
- #
43
- def timeout(interval=1, &b)
44
- EventMachine::Timer.new(interval) do
45
- fiber_block &b
46
- end
47
- end
48
-
49
- #
50
- # Connect to server
51
- #
52
- # emmy.connect("tcp://localhost:5555")
53
- # emmy.connect("ipc://mypoint")
54
- # emmy.connect("tcp://localhost:5555", handler, *args)
55
- # emmy.connect(*emmy.http.get(url))
56
- def connect(url, *a, &b)
57
- url = URI(url.to_s)
58
- b = a.last if b.nil? && a.size > 0 && a.last.is_a?(Proc)
59
- handler = a.empty? ? Connection : a.first
60
-
61
- case url.scheme
62
- when "tcp" then
63
- EventMachine.connect(url.host, url.port, handler, *a, &b)
64
- when "ipc" then
65
- EventMachine.connect_unix_domain(url[6..-1], handler, *a, &b)
66
- else
67
- raise ArgumentError, "unsupported url scheme"
68
- end
69
- end
70
-
71
- #
72
- # Start server
73
- #
74
- # emmy.bind("tcp://localhost:5555", ServerConnection)
75
- # emmy.bind("ipc://mypoint", ServerConnection)
76
- # emmy.bind(* emmy.server.thin("tcp://localhost:4780", app))
77
- def bind(url, *a, &b)
78
- url = URI(url.to_s)
79
- b = a.last if b.nil? && a.size > 0 && a.last.is_a?(Proc)
80
- handler = a.empty? ? Connection : a.first
81
-
82
- case url.scheme
83
- when "tcp" then
84
- EventMachine.start_server(url.host, url.port, handler, *a, &b)
85
- when "ipc" then
86
- EventMachine.start_unix_domain_server(url[6..-1], handler, *a, &b)
87
- else
88
- raise ArgumentError, "unsupported url scheme"
89
- end
90
- end
91
-
92
- def next_tick
93
- fiber = Fiber.current
94
- EventMachine.next_tick { fiber.resume }
95
- Fiber.yield
96
- end
97
-
98
- def sleep(time)
99
- fiber = Fiber.current
100
- timeout(time) { fiber.resume }
101
- Fiber.yield
102
- end
103
- end
104
- end
@@ -1,18 +0,0 @@
1
- module EmmyMachine
2
- module Connection
3
- using EventObject
4
-
5
- def self.included(base)
6
- base.events :connect, :data, :close, :error
7
- base.class_eval do
8
- alias_method :connection_completed, :connect!
9
- alias_method :receive_data, :data!
10
- end
11
- end
12
-
13
- def unbind(reason=nil)
14
- close!(reason)
15
- error!(reason) if error?
16
- end
17
- end
18
- end
@@ -1,3 +0,0 @@
1
- module EmmyMachine
2
- VERSION = "0.1.1"
3
- end
@@ -1,44 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe EmmyMachine do
4
- using EventObject
5
-
6
- it "test run_block" do
7
- expect { |block|
8
- EmmyMachine.run_block &block
9
- }.to yield_control
10
- end
11
-
12
- it "test connect" do
13
- expect { |block|
14
- EventMachine.run do
15
- http = EmmyMachine.connect("tcp://github.com:80")
16
- http.on :connect do
17
- http.send_data "GET / HTTP/1.1\r\n" \
18
- "Host: ru.wikipedia.org\r\n" \
19
- "User-Agent: Ruby\r\n" \
20
- "Accept: text/html\r\n" \
21
- "Connection: close\r\n\r\n"
22
- end
23
-
24
- http.on :data, &block
25
- http.on :close do
26
- EventMachine.stop
27
- end
28
- end
29
- }.to yield_control.at_least(1)
30
- end
31
-
32
- context "Reactor required" do
33
- around do |example|
34
- EventMachine.run do
35
- example.run
36
- EventMachine.stop
37
- end
38
- end
39
-
40
- it "test running?" do
41
- expect(EmmyMachine.running?).to be true
42
- end
43
- end
44
- end
@@ -1,8 +0,0 @@
1
- require 'bundler/setup'
2
- Bundler.setup
3
-
4
- require File.expand_path("./lib/emmy_machine")
5
-
6
- RSpec.configure do |config|
7
- config.color = true
8
- end
data/emmy.gemspec DELETED
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'emmy/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "emmy"
8
- spec.version = Emmy::VERSION
9
- spec.authors = ["che"]
10
- spec.email = ["chelovekov@gmail.com"]
11
- spec.summary = %q{Emmy - EventMachine-based framework}
12
- #spec.description = %q{TODO: Write a longer description. Optional.}
13
- spec.homepage = ""
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency "event_object", "~> 0.9"
22
- spec.add_dependency "emmy-machine", "~> 0.1"
23
-
24
- spec.add_development_dependency "bundler", "~> 1.6"
25
- spec.add_development_dependency "rspec", "~> 3"
26
- spec.add_development_dependency "rake"
27
- end
data/lib/emmy.rb DELETED
@@ -1,6 +0,0 @@
1
- require "emmy/version"
2
- require "emmy_machine"
3
-
4
- module Emmy
5
- extend EmmyMachine::ClassMethods
6
- end
data/lib/emmy/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Emmy
2
- VERSION = "0.1.2"
3
- end
data/spec/emmy_spec.rb DELETED
@@ -1,11 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Emmy do
4
- using EventObject
5
-
6
- it "test run_block" do
7
- expect { |block|
8
- Emmy.run_block &block
9
- }.to yield_control
10
- end
11
- end
data/spec/spec_helper.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'bundler/setup'
2
- Bundler.setup
3
-
4
- require File.expand_path("./lib/emmy")
5
-
6
- RSpec.configure do |config|
7
- config.color = true
8
- end