acfs 0.48.0 → 0.48.1

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: 0a815614c14477b727317758c4deb950750c1609
4
- data.tar.gz: d1413e76db34215713693cf20b88e6d2e751efe3
3
+ metadata.gz: 9c4bc9142d3a83a09440042357b748849c822016
4
+ data.tar.gz: 9e21e07911af3cedbedb3d33ada6588e38095ce2
5
5
  SHA512:
6
- metadata.gz: 775cf10dd61a350c67faab9704685f251f0e7416cc2c9055b6373be1f6a7419c130e914ad2897b2f79aa5781eec02e8bc7054cbe91078ff8773a57965297604e
7
- data.tar.gz: 3d6f4f31d2573375cad139c75a7f24131037b0211cc28bb6143709a391f4ab542357bb7c51fa4984788e739797fdf9c68e22fc58b1d61669173c0d85b0402ce8
6
+ metadata.gz: fcae3ab559b7f106f2b2c3dfa8e6bb41ebaba3ba9ec0278fd81280c9946b5cf67003cd33c68144a9d9d94a264bed4174dd4796eef3b02a31cb3f7a5423467bc7
7
+ data.tar.gz: 4c1358d8aec1e99f7f4d19075862ec76f75e1b38f92cf18eeea2a5a5e98815fa86646f1177e3554feeb4df29d17dd539b803c53d2afee2270ba7d55ea0f7e68e
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+
5
+ * Switch to first non-development major as it's long time used in production.
6
+ * Fix NewRelic RPM inference with middleware stack inherited from `ActionDispatch::MiddlewareStack`.
7
+
3
8
  ## 0.48.0
4
9
 
5
10
  * Remove #attribute_types broke since f7e4109 (Sep 2013, v0.23)
@@ -1,28 +1,57 @@
1
- require 'action_dispatch/middleware/stack'
2
-
3
1
  module Acfs
4
2
  class Service
5
3
  module Middleware
6
- class Stack < ActionDispatch::MiddlewareStack
4
+ class Stack
5
+ include Enumerable
6
+
7
7
  MUTEX = Mutex.new
8
8
  IDENTITY = -> (i) { i }
9
9
 
10
+ attr_reader :middlewares
11
+
12
+ def initialize
13
+ @middlewares = []
14
+ end
15
+
16
+ def call(request)
17
+ build! unless @app
18
+
19
+ @app.call request
20
+ end
21
+
10
22
  def build!
23
+ return if @app
24
+
11
25
  MUTEX.synchronize do
12
- return if @stack
26
+ return if @app
13
27
 
14
- @stack = build
28
+ @app = build
15
29
  end
16
30
  end
17
31
 
18
32
  def build(app = IDENTITY)
19
- super
33
+ middlewares.reverse.inject(app) do |next_middleware, current_middleware|
34
+ klass, args, block = current_middleware
35
+ args ||= []
36
+
37
+ if klass.is_a?(Class)
38
+ klass.new(next_middleware, *args, &block)
39
+ elsif klass.respond_to?(:call)
40
+ lambda do |env|
41
+ next_middleware.call(klass.call(env, *args))
42
+ end
43
+ else
44
+ fail "Invalid middleware, doesn't respond to `call`: #{klass.inspect}"
45
+ end
46
+ end
20
47
  end
21
48
 
22
- def call(request)
23
- build! unless @stack
49
+ def insert(index, klass, *args, &block)
50
+ middlewares.insert(index, [klass, args, block])
51
+ end
24
52
 
25
- @stack.call request
53
+ def each
54
+ middlewares.each { |x| yield x.first }
26
55
  end
27
56
 
28
57
  def clear
@@ -2,7 +2,7 @@ module Acfs
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 48
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STAGE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.0
4
+ version: 0.48.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-01 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.6.4
231
+ rubygems_version: 2.5.1
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: An abstract API base client for service oriented application.
@@ -271,4 +271,3 @@ test_files:
271
271
  - spec/support/response.rb
272
272
  - spec/support/service.rb
273
273
  - spec/support/shared/find_callbacks.rb
274
- has_rdoc: