emmy-http 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/emmy-http.gemspec +10 -9
- data/lib/emmy_http/request.rb +1 -1
- data/lib/emmy_http/server/application.rb +20 -0
- data/lib/emmy_http/server/configuration.rb +26 -0
- data/lib/emmy_http/version.rb +1 -1
- data/lib/emmy_http.rb +13 -10
- data/spec/emmy_http_spec.rb +1 -1
- metadata +31 -17
- data/lib/emmy_http/backend.rb +0 -17
- data/lib/emmy_http/refines.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4ed51d015d1f09cc573e15226ee422d02286e2a
|
4
|
+
data.tar.gz: 827d2841082b0b52b611d2a3d333425079776eae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94497d1586a0bb5155139c9c11b0266c8bb2fdab5b70437f85fed97b7ab030562547b62658bba83962e08659058e6768960119927a1658542c8b1844da19eaca
|
7
|
+
data.tar.gz: 00b712daf5730d032aca544d0449755657a557c0cc446d4832246c7be4191e0fe2bd389495915d5f6f827755bf6892baf6d506f6901547e35c9989aebfc01800
|
data/emmy-http.gemspec
CHANGED
@@ -18,14 +18,15 @@ 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.add_dependency "event_object",
|
22
|
-
spec.add_dependency "emmy-machine",
|
23
|
-
spec.add_dependency "fibre",
|
24
|
-
spec.add_dependency "util_pack",
|
25
|
-
spec.add_dependency "model_pack",
|
26
|
-
spec.add_dependency "addressable",
|
21
|
+
spec.add_dependency "event_object", "~> 0.9"
|
22
|
+
spec.add_dependency "emmy-machine", "~> 0.1"
|
23
|
+
spec.add_dependency "fibre", "~> 0.9"
|
24
|
+
spec.add_dependency "util_pack", "~> 0.1"
|
25
|
+
spec.add_dependency "model_pack", "~> 0.9"
|
26
|
+
spec.add_dependency "addressable", "~> 2.3"
|
27
27
|
|
28
|
-
spec.add_development_dependency "
|
29
|
-
spec.add_development_dependency "
|
30
|
-
spec.add_development_dependency "
|
28
|
+
spec.add_development_dependency "eventmachine", "~> 1.0"
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3"
|
31
32
|
end
|
data/lib/emmy_http/request.rb
CHANGED
@@ -32,7 +32,7 @@ module EmmyHttp
|
|
32
32
|
attribute :redirects, default: 6 # max redirects to follow
|
33
33
|
attribute :raise_error, predicate: true, default: true # raise error or return nil
|
34
34
|
|
35
|
-
object :timeouts, class_name: Timeouts,
|
35
|
+
object :timeouts, class_name: Timeouts, as: Timeouts
|
36
36
|
object :ssl, class_name: SSL
|
37
37
|
object :proxy, class_name: Proxy
|
38
38
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rack"
|
2
|
+
|
3
|
+
module EmmyHttp
|
4
|
+
class Application < ::Rack::Builder
|
5
|
+
attr_accessor :config
|
6
|
+
|
7
|
+
def initialize(app = nil, &block)
|
8
|
+
@config = Emmy::Runner.instance.config
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.app(default_app = nil, &block)
|
13
|
+
self.new(default_app, &block).to_app
|
14
|
+
end
|
15
|
+
|
16
|
+
def configure(&b)
|
17
|
+
instance_eval(&b)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EmmyHttp
|
2
|
+
class Configuration
|
3
|
+
include ModelPack::Document
|
4
|
+
|
5
|
+
# options
|
6
|
+
attribute :environment
|
7
|
+
attribute :backend, default: 'backend'
|
8
|
+
attribute :url,
|
9
|
+
default: -> { Addressable::URI.parse('tcp://0.0.0.0:3003') },
|
10
|
+
writer: ->(v) { v.is_a?(String) ? Addressable::URI.parse(v) : v },
|
11
|
+
serialize: ->(v) { v.to_s }
|
12
|
+
|
13
|
+
# system
|
14
|
+
attribute :user
|
15
|
+
attribute :group
|
16
|
+
attribute :pid
|
17
|
+
attribute :log
|
18
|
+
|
19
|
+
# flags
|
20
|
+
attribute :daemonize, default: false
|
21
|
+
attribute :logging, default: true
|
22
|
+
|
23
|
+
object :ssl, class_name: SSL
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
data/lib/emmy_http/version.rb
CHANGED
data/lib/emmy_http.rb
CHANGED
@@ -15,16 +15,19 @@ module EmmyHttp
|
|
15
15
|
|
16
16
|
HTTP_METHODS = %w(get head delete put post patch options)
|
17
17
|
|
18
|
-
autoload :Adapter,
|
19
|
-
autoload :Timeouts,
|
20
|
-
autoload :Proxy,
|
21
|
-
autoload :SSL,
|
22
|
-
autoload :
|
23
|
-
autoload :
|
24
|
-
autoload :
|
25
|
-
autoload :
|
26
|
-
autoload :
|
27
|
-
autoload :
|
18
|
+
autoload :Adapter, "emmy_http/adapter"
|
19
|
+
autoload :Timeouts, "emmy_http/client/timeouts"
|
20
|
+
autoload :Proxy, "emmy_http/client/proxy"
|
21
|
+
autoload :SSL, "emmy_http/client/ssl"
|
22
|
+
autoload :Configuration, "emmy_http/server/configuration"
|
23
|
+
autoload :Backend, "emmy_http/server/backend"
|
24
|
+
autoload :Application, "emmy_http/server/application"
|
25
|
+
autoload :Request, "emmy_http/request"
|
26
|
+
autoload :Operation, "emmy_http/operation"
|
27
|
+
autoload :Response, "emmy_http/response"
|
28
|
+
autoload :Timeout, "emmy_http/timeout"
|
29
|
+
autoload :Utils, "emmy_http/utils"
|
30
|
+
autoload :Model, "emmy_http/model"
|
28
31
|
|
29
32
|
extend self
|
30
33
|
|
data/spec/emmy_http_spec.rb
CHANGED
@@ -39,7 +39,7 @@ describe EmmyHttp do
|
|
39
39
|
it "do async requests" do
|
40
40
|
req = request(adapter: FakeAdapter, raise_error: false)
|
41
41
|
responses = {
|
42
|
-
a: [req.copy.get('http://google.com')
|
42
|
+
a: [req.copy.get('http://google.com'), req.copy.get('http://google.com')],
|
43
43
|
b: req.copy.get('http://google.com')
|
44
44
|
}.sync!
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: event_object
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.9
|
19
|
+
version: '0.9'
|
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.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: emmy-machine
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1
|
33
|
+
version: '0.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1
|
40
|
+
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: fibre
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.9
|
47
|
+
version: '0.9'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.9
|
54
|
+
version: '0.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: util_pack
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,42 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.9
|
75
|
+
version: '0.9'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.9
|
82
|
+
version: '0.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: addressable
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.3
|
89
|
+
version: '2.3'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: eventmachine
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: '1.0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: bundler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,15 +164,15 @@ files:
|
|
150
164
|
- emmy-http.gemspec
|
151
165
|
- lib/emmy_http.rb
|
152
166
|
- lib/emmy_http/adapter.rb
|
153
|
-
- lib/emmy_http/backend.rb
|
154
167
|
- lib/emmy_http/client/proxy.rb
|
155
168
|
- lib/emmy_http/client/ssl.rb
|
156
169
|
- lib/emmy_http/client/timeouts.rb
|
157
170
|
- lib/emmy_http/model.rb
|
158
171
|
- lib/emmy_http/operation.rb
|
159
|
-
- lib/emmy_http/refines.rb
|
160
172
|
- lib/emmy_http/request.rb
|
161
173
|
- lib/emmy_http/response.rb
|
174
|
+
- lib/emmy_http/server/application.rb
|
175
|
+
- lib/emmy_http/server/configuration.rb
|
162
176
|
- lib/emmy_http/timeout.rb
|
163
177
|
- lib/emmy_http/utils.rb
|
164
178
|
- lib/emmy_http/version.rb
|
@@ -188,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
202
|
version: '0'
|
189
203
|
requirements: []
|
190
204
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.4.
|
205
|
+
rubygems_version: 2.4.6
|
192
206
|
signing_key:
|
193
207
|
specification_version: 4
|
194
208
|
summary: EmmyHttp - EventMachine's HTTP Client
|
data/lib/emmy_http/backend.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module EmmyHttp
|
2
|
-
class Backend
|
3
|
-
SUPPORTED_COMMANDS = %w(start stop restart)
|
4
|
-
|
5
|
-
def supported_commands
|
6
|
-
const_get(:SUPPORTED_COMMANDS)
|
7
|
-
end
|
8
|
-
|
9
|
-
SUPPORTED_COMMANDS.each do |method|
|
10
|
-
define_method method do
|
11
|
-
raise 'method not implemented'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
#<<<
|
16
|
-
end
|
17
|
-
end
|