jackal 0.3.10 → 0.3.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b2dc6038e53678793359a6a8df8c8a44be1142c
4
- data.tar.gz: bfa8505b16fea3b018b7f7b2b87b19d421516f6b
3
+ metadata.gz: 02001e5b2ff6b59d1031f8121657bcb1e7ed5ee7
4
+ data.tar.gz: 0392d96103ada117ed0d36efb82aa8bb4c1033c2
5
5
  SHA512:
6
- metadata.gz: 017e4b75a458bfc4a2da1bf64656c15fb5c0926ef374fa09964df856e0c27c1d51c8cb263d62816ee51403664d7739c1a38c5af2dd5ee90695e39dd0dc2357c3
7
- data.tar.gz: fea17a6e85acca71f78889467bf7d19fa6c0b07634ec272175bac04218af9397f14e767db0166da8cab0ddbd00117d420389451bfcc37f71a4180fd29c14d99e
6
+ metadata.gz: 6eeb8f2de5be35b540209a3a366ffbf7c3668b5df73dd123509549ca7be26ee8b9a3577a80b65499cd23d81a25ea679b5ecd54cfd28e9e8b9757ff692be0afc7
7
+ data.tar.gz: 23cf4aa6b4966daa6b4329e5d88c03aeaa2ec16b25da321da68a579bb4fb59905784b10316c8f7f908dd5431fef7ba47599d21f82b3b6723c430e19d3faf2bf4
@@ -1,3 +1,8 @@
1
+ # v0.3.12
2
+ * Set default verbosity to :info
3
+ * Support changing spec runner
4
+ * Add options scrubbing on startup
5
+
1
6
  # v0.3.10
2
7
  * Add `:array` to allowed values for configuration type in service registration
3
8
 
@@ -5,25 +5,50 @@ module Jackal
5
5
  class Loader
6
6
  class << self
7
7
 
8
- # Run the jackal
8
+ # Configure the application
9
9
  #
10
10
  # @param opts [Hash]
11
- def run!(opts)
12
-
11
+ # @return [TrueClass]
12
+ def configure!(opts)
13
+ default_verbosity = nil
13
14
  if(ENV['JACKAL_TESTING_MODE'])
14
15
  if(!opts[:config])
15
16
  Carnivore.configure!(:verify)
16
17
  else
17
18
  Carnivore.configure!(opts[:config], :force)
18
19
  end
20
+ default_verbosity = :fatal
19
21
  else
20
22
  Carnivore.configure!(opts[:config])
21
23
  Carnivore::Config.immutable!
24
+ default_verbosity = :info
22
25
  end
23
26
 
24
- Celluloid.logger.level = Celluloid.logger.class.const_get(
25
- (opts[:verbosity] || Carnivore::Config[:verbosity] || :debug).to_s.upcase
26
- )
27
+ default_verbosity = :debug if ENV['DEBUG']
28
+ const = opts.fetch(:verbosity,
29
+ Carnivore::Config.fetch(:verbosity, default_verbosity)
30
+ ).to_s.upcase
31
+
32
+ Celluloid.logger.level = Celluloid.logger.class.const_get(const)
33
+ true
34
+ end
35
+
36
+ # Scrub and type opts
37
+ #
38
+ # @param opts [Slop,Hash]
39
+ # @return [Smash]
40
+ def process_opts(opts)
41
+ opts = opts.to_hash.to_smash
42
+ opts.delete_if{|k,v| v.nil?}
43
+ opts
44
+ end
45
+
46
+ # Run the jackal
47
+ #
48
+ # @param opts [Hash]
49
+ def run!(opts)
50
+ opts = process_opts(opts)
51
+ configure!(opts)
27
52
 
28
53
  Carnivore::Config.fetch(:jackal, :require, []).each do |path|
29
54
  require path
@@ -8,6 +8,9 @@ module Jackal
8
8
 
9
9
  class << self
10
10
 
11
+ # @return [Class] class used to run subsystem
12
+ attr_accessor :system_runner
13
+
11
14
  # Valid directories for test payloads
12
15
  #
13
16
  # @param args [String] list of directories to append
@@ -29,3 +32,5 @@ module Jackal
29
32
  end
30
33
  end
31
34
  end
35
+
36
+ Jackal::Utils::Spec.system_runner = Jackal::Loader
@@ -62,7 +62,7 @@ def run_setup(config)
62
62
 
63
63
  Thread.abort_on_exception = true
64
64
  runner = Thread.new do
65
- Jackal::Loader.run!(:config => path)
65
+ Jackal::Utils::Spec.system_runner.run!(:config => path)
66
66
  end
67
67
  source_wait(:setup)
68
68
  runner
@@ -98,7 +98,22 @@ end
98
98
  # @param wait_time [Numeric] max time to wait for message result (default 1)
99
99
  # @return [Smash] payload result
100
100
  def transmit_and_wait(actor, payload, wait_time = 1)
101
+ actor.callbacks.each do |c_name|
102
+ callback = actor.callback_supervisor[actor.callback_name(c_name)]
103
+ if(callback.respond_to?(:test_payload=))
104
+ callback.test_payload = Smash.new
105
+ end
106
+ end
101
107
  actor.transmit(payload)
102
108
  source_wait(wait_time) { !MessageStore.messages.empty? }
109
+ actor.callbacks.each do |c_name|
110
+ callback = actor.callback_supervisor[actor.callback_name(c_name)]
111
+ if(callback.respond_to?(:test_payload=))
112
+ unless(MessageStore.messages.empty?)
113
+ MessageStore.messages.first.deep_merge!(callback.test_payload)
114
+ end
115
+ callback.test_payload = nil
116
+ end
117
+ end
103
118
  MessageStore.messages.pop
104
119
  end
@@ -1,4 +1,4 @@
1
1
  module Jackal
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.3.10')
3
+ VERSION = Gem::Version.new('0.3.12')
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts