stealth 0.10.0 → 0.10.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: 05a79205c1c753dc6ab5b49f1c23695cf13b7d5c
4
- data.tar.gz: bff5e9b18f8b6fb5608f23834f65e2526460f440
3
+ metadata.gz: 334f9e3c6cc796dd9c3ed123d9226b764681170a
4
+ data.tar.gz: 637b3749ec73a66dc6f4f09e0d44e74bbb13369f
5
5
  SHA512:
6
- metadata.gz: 8a0997a30591438682bc14fd7c5a61f45935cc0780572bef8a0bd3fc92e2d0beb7d88dd730dd3391088457a953150485b0c6670ade82dc58c869e621af43e1f3
7
- data.tar.gz: 68973f3f68bd5c9c8f0b85405fe45f7f0d55e5b8f3a3aa4467d21fef2c6429ff715d144196ac934b4e1a00b76de90d0d48433b370be17914672723c1a62dcca3
6
+ metadata.gz: 4e12660a2fd12c23f08837c578a1c64423ef4fc29e7682b522152a820567107614e7ee52648a2a9dbe44b3aad4b3308db31f31fcca5303278ec1f0ab89706d0d
7
+ data.tar.gz: 40f9f7c4e9eb231cfd9efe0eb415553f709f85c0ac007b1b7d3b4746046e9220acf0d074c680648ac565e3fc61c36fde0c55536417eaa96bdd04e535c82b463d
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Mauricio Gomes, Black Ops Bureau
1
+ Copyright (c) 2017 Mauricio Gomes, The Black Ops Bureau, Inc
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.0
1
+ 0.10.1
@@ -11,10 +11,17 @@ module Stealth
11
11
 
12
12
  def run_catch_all(reason: nil)
13
13
  error_level = fetch_error_level
14
- Stealth::Logger.l(topic: "catch_all", message: "CatchAll #{catch_all_state(error_level)} triggered for #{error_slug}: #{reason}")
14
+ Stealth::Logger.l(topic: "catch_all", message: "CatchAll #{calculate_catch_all_state(error_level)} triggered for #{error_slug}: #{reason}")
15
15
 
16
- if defined?(CatchAllsController)
17
- step_to flow: 'catch_all', state: catch_all_state(error_level)
16
+ if defined?(CatchAllsController) && defined?(CatchAllFlow)
17
+ catch_all_state = calculate_catch_all_state(error_level)
18
+
19
+ if CatchAllFlow.flow_spec.states.keys.include?(catch_all_state.to_sym)
20
+ step_to flow: 'catch_all', state: catch_all_state
21
+ else
22
+ # Jump to the last catch_all state if we are out of bounds
23
+ step_to flow: 'catch_all', state: CatchAllFlow.flow_spec.states.keys.last.to_s
24
+ end
18
25
  end
19
26
  end
20
27
 
@@ -43,7 +50,7 @@ module Stealth
43
50
  ['error', current_user_id, current_session.flow_string, current_session.state_string].join('-')
44
51
  end
45
52
 
46
- def catch_all_state(error_level)
53
+ def calculate_catch_all_state(error_level)
47
54
  "level#{error_level}"
48
55
  end
49
56
 
@@ -90,7 +90,7 @@ module Stealth
90
90
  run_callbacks :action do
91
91
  begin
92
92
  flow_controller.send(@action_name)
93
- run_catch_all(reason: 'Did not send replies, update session, or step') unless progressed?
93
+ run_catch_all(reason: 'Did not send replies, update session, or step') unless flow_controller.progressed?
94
94
  rescue StandardError => e
95
95
  run_catch_all(reason: e.message)
96
96
  end
@@ -44,7 +44,7 @@ module Stealth
44
44
 
45
45
  new_state = state.to_sym
46
46
  unless states.include?(new_state)
47
- raise(Stealth::Errors::InvalidStateTransition)
47
+ raise(Stealth::Errors::InvalidStateTransition, "Unknown state '#{state}' for #{self.class.to_s}")
48
48
  end
49
49
  @flow_state = new_state
50
50
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stealth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Gomes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-09 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra