emmy-http 0.2.9 → 0.2.13

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: 652809c45b5888aff7451e8d74fee093cb0b8907
4
- data.tar.gz: e6b3e3e7dc85dcdcd8767202bbbc1295fe968f63
3
+ metadata.gz: a4803e7dcf926df741a2dfa44e315f6b569b365f
4
+ data.tar.gz: 4ae8bef43475ba105377e9a955592427f06faa71
5
5
  SHA512:
6
- metadata.gz: e764f0ad658bd05787f23c9783a1ed903e5b4690cc1c9bf80006d1b5be55f2fe7b70049aeb37130b27ce44aee6c393a2f30e0704ecc32a9c8d586d04febe7b82
7
- data.tar.gz: 0cbae0b222ace57b6bdbf78a3e77a14c972d9601c3b1dd15c29bab6915bb142c38ae3059c14584ab1f07b390105b7e5e5d51ec25fb96ee2efb63f3108a9973df
6
+ metadata.gz: 9ae785cfdc33b7c38f781ab1212f7dfd32842919b2e7d9a88543104391bf4c7a0eeab2dc31bfb43d6906892140bb02755f29ce420eab01047a977b80387c2366
7
+ data.tar.gz: e3bb4f08126bc588eafb1d1c21175f6ddfecbd5259e6819208b49dba4742dec763ca1bc0207d36d58fed959a4990d2e000ee41092297aea0005a849b8699d9bc
data/emmy-http.gemspec CHANGED
@@ -3,6 +3,12 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'emmy_http/version'
5
5
 
6
+ version = File.read(File.expand_path('../../EMMY_VERSION', __FILE__)).strip
7
+ if version != EmmyHttp::VERSION
8
+ puts "Different version numbers"
9
+ exit
10
+ end
11
+
6
12
  Gem::Specification.new do |spec|
7
13
  spec.name = "emmy-http"
8
14
  spec.version = EmmyHttp::VERSION
@@ -37,7 +37,7 @@ module EmmyHttp
37
37
  object :proxy, class_name: Proxy
38
38
 
39
39
  attribute :adapter,
40
- writer: ->(class_name) { class_name.is_a?(String) ? constantize(class_name) : class_name },
40
+ writer: ->(class_name) { class_name.is_a?(String) ? UtilPack.constantize(class_name) : class_name },
41
41
  serialize: ->(value) { value.to_s }
42
42
 
43
43
  def operation
@@ -84,11 +84,6 @@ module EmmyHttp
84
84
  raise RequestError, message
85
85
  end
86
86
 
87
- def constantize(class_name)
88
- return nil unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ class_name
89
- Object.module_eval("::#{$1}", __FILE__, __LINE__)
90
- end
91
-
92
87
  #<<<
93
88
  end
94
89
  end
@@ -3,9 +3,10 @@ require "rack"
3
3
  module EmmyHttp
4
4
  class Application < ::Rack::Builder
5
5
  attr_accessor :config
6
+ attr_accessor :server
6
7
 
7
8
  def initialize(app = nil, &block)
8
- @config = Emmy::Runner.instance.config.clone
9
+ @config = Emmy::Runner.instance.config.copy
9
10
  super
10
11
  end
11
12
 
@@ -16,5 +17,13 @@ module EmmyHttp
16
17
  def configure(&b)
17
18
  instance_eval(&b)
18
19
  end
20
+
21
+ def server
22
+ @server ||= config.adapter.new(config, self)
23
+ end
24
+
25
+ def to_a
26
+ server.to_a
27
+ end
19
28
  end
20
29
  end
@@ -17,11 +17,16 @@ module EmmyHttp
17
17
  attribute :log
18
18
  attribute :stdout, default: '/dev/null'
19
19
  attribute :stderr, default: '/dev/null'
20
+ attribute :timeout, default: 0
20
21
 
21
- object :ssl, class_name: SSL
22
+ object :ssl, class_name: SSL
22
23
 
23
24
  # cluster options
24
25
  attribute :id
25
26
  attribute :servers
27
+
28
+ attribute :adapter,
29
+ writer: ->(class_name) { class_name.is_a?(String) ? UtilPack.constantize(class_name) : class_name },
30
+ serialize: ->(value) { value.to_s }
26
31
  end
27
32
  end
@@ -1,3 +1,3 @@
1
1
  module EmmyHttp
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.13"
3
3
  end
data/lib/emmy_http.rb CHANGED
@@ -4,11 +4,13 @@ require "model_pack"
4
4
  require "event_object"
5
5
  require "emmy_http/version"
6
6
  require "forwardable"
7
+ require "util_pack"
7
8
 
8
9
  module EmmyHttp
9
10
  class HttpError < StandardError; end
10
11
  class ParserError < HttpError; end
11
12
  class RequestError < HttpError; end
13
+ class ResponseError < HttpError; end
12
14
  class ConnectionError < HttpError; end
13
15
  class TimeoutError < HttpError; end
14
16
  class EncoderError < HttpError; end
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.9
4
+ version: 0.2.13
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-26 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_object