dandy 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dandy/chain.rb +12 -3
- data/lib/dandy/chain_factory.rb +1 -1
- data/lib/dandy/routing/builder.rb +1 -0
- data/lib/dandy/routing/route.rb +2 -1
- data/lib/dandy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2fd9c19d371ae8e4a1a1f1bc226cc1129378b4a
|
4
|
+
data.tar.gz: b80c233a419271a93c8f7fd4e012c0bfc73b48ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbae69a185816a195b1f9c62aa3586ebea47ee9135d5c4abef5626dd40c914610fa68d301e8c56805aad7572712365e5c01420900cee1d9793d173fc22f8e660
|
7
|
+
data.tar.gz: 13b588f96bbc72e5f6a6457a57bfd1fa54baa2d1a45ff88b507b11fb1b2f0cc1ff614d06244db27c36df9d16f01e1039ad1542233383ba2e8232540c07742ece
|
data/lib/dandy/chain.rb
CHANGED
@@ -2,8 +2,9 @@ require 'timeout'
|
|
2
2
|
|
3
3
|
module Dandy
|
4
4
|
class Chain
|
5
|
-
def initialize(container, dandy_config, commands, catch_command = nil)
|
5
|
+
def initialize(container, dandy_config, commands, last_command, catch_command = nil)
|
6
6
|
@commands = commands
|
7
|
+
@last_command = last_command
|
7
8
|
@container = container
|
8
9
|
@catch_command = catch_command
|
9
10
|
@async_timeout = dandy_config[:action][:async_timeout]
|
@@ -40,11 +41,19 @@ module Dandy
|
|
40
41
|
threads.each {|t| t.join}
|
41
42
|
threads = []
|
42
43
|
|
43
|
-
|
44
|
+
if @last_command && (command.name == @last_command.name)
|
45
|
+
result = run_command(command)
|
46
|
+
else
|
47
|
+
run_command(command)
|
48
|
+
end
|
44
49
|
else
|
45
50
|
thread = Thread.new {
|
46
51
|
Timeout::timeout(@async_timeout) {
|
47
|
-
|
52
|
+
if @last_command && (command.name == @last_command.name)
|
53
|
+
result = run_command(command)
|
54
|
+
else
|
55
|
+
run_command(command)
|
56
|
+
end
|
48
57
|
}
|
49
58
|
}
|
50
59
|
threads << thread if command.parallel?
|
data/lib/dandy/chain_factory.rb
CHANGED
@@ -11,7 +11,7 @@ module Dandy
|
|
11
11
|
status = match.route.http_status || default_http_status(match.route.http_verb)
|
12
12
|
register_params(match.params)
|
13
13
|
register_status(status)
|
14
|
-
Chain.new(@container, @dandy_config, match.route.commands, match.route.catch)
|
14
|
+
Chain.new(@container, @dandy_config, match.route.commands, match.route.last_command, match.route.catch)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -26,6 +26,7 @@ module Dandy
|
|
26
26
|
view: action[:view],
|
27
27
|
http_status: action[:http_status],
|
28
28
|
catch: sections.catch.command,
|
29
|
+
last_command: action[:commands].last,
|
29
30
|
commands: restore_callbacks(route, :before) + action[:commands] + restore_callbacks(route, :after)
|
30
31
|
})
|
31
32
|
end
|
data/lib/dandy/routing/route.rb
CHANGED
@@ -2,7 +2,7 @@ module Dandy
|
|
2
2
|
module Routing
|
3
3
|
class Route
|
4
4
|
attr_reader :http_verb, :path, :params, :catch,
|
5
|
-
:commands, :segments, :view, :http_status
|
5
|
+
:commands, :segments, :view, :http_status, :last_command
|
6
6
|
|
7
7
|
def initialize(hash)
|
8
8
|
@http_verb = hash[:http_verb]
|
@@ -11,6 +11,7 @@ module Dandy
|
|
11
11
|
|
12
12
|
@params = hash[:params]
|
13
13
|
@commands = hash[:commands]
|
14
|
+
@last_command = hash[:last_command]
|
14
15
|
@view = hash[:view]
|
15
16
|
@http_status = hash[:http_status]
|
16
17
|
|
data/lib/dandy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dandy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kalinkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hypo
|