dandy 0.9.0 → 0.9.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: fa54fc46b2be97cb013b2d22afad52bbf4e84f72
4
- data.tar.gz: 3bb80acca3196d720b3279a5d002d2c5af0ee706
3
+ metadata.gz: c2fd9c19d371ae8e4a1a1f1bc226cc1129378b4a
4
+ data.tar.gz: b80c233a419271a93c8f7fd4e012c0bfc73b48ef
5
5
  SHA512:
6
- metadata.gz: 28b1940d80ed6f1326e5d378f4498ddd54d28bcb150abdeaa33b1b1399516a05407c2d53e16c405856211dc1a827b1f6d92219fadf7077e89405e0bd069d7647
7
- data.tar.gz: 3f343cd6c228a69d0b6d2710a0519e0236d251c85a569ca16a1122f5cd1e35ddda8d7d5bfb142e3d267b9fc03c76c9fbbe5483130c6b137f304040db753040cc
6
+ metadata.gz: cbae69a185816a195b1f9c62aa3586ebea47ee9135d5c4abef5626dd40c914610fa68d301e8c56805aad7572712365e5c01420900cee1d9793d173fc22f8e660
7
+ data.tar.gz: 13b588f96bbc72e5f6a6457a57bfd1fa54baa2d1a45ff88b507b11fb1b2f0cc1ff614d06244db27c36df9d16f01e1039ad1542233383ba2e8232540c07742ece
@@ -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
- result = run_command(command)
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
- result = run_command(command)
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?
@@ -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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Dandy
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
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.0
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-26 00:00:00.000000000 Z
11
+ date: 2018-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hypo