foobara 0.0.101 → 0.0.102
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/CHANGELOG.md +4 -0
- data/projects/builtin_types/src/attributes/transformers/remove_unexpected_attributes.rb +4 -1
- data/projects/foobara/lib/foobara/all.rb +0 -1
- data/projects/model/src/model.rb +4 -2
- data/projects/persistence/src/entity_base.rb +4 -2
- data/projects/type_declarations/src/type_declarations.rb +5 -3
- metadata +15 -4
- data/projects/thread_parent/lib/foobara/thread_parent.rb +0 -1
- data/projects/thread_parent/src/thread_parent.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c472d0a6d4c5d306bf6510632edc586079912f8d389eee47ce7857889cab92e4
|
4
|
+
data.tar.gz: b4b42fe4f0952cf5322350de3677e7012856bd1ced93c8f72765519c1aab2c14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 310bdd43d7858b4f548d62bce8acc58d66f139a2e48b315781ef29623118ddd647258e81e75170a673af050652959b310a87d98c49a3433f76841372453ba564
|
7
|
+
data.tar.gz: e722a9828ea78374fb63107d44a1bb79b5ff2e0c06699671eb033a1492f5b5279ce047543a256ca953f6560734a4936bed4af5aeab59fa9b02c514b16676f893
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "inheritable_thread_vars"
|
2
|
+
|
1
3
|
module Foobara
|
2
4
|
module BuiltinTypes
|
3
5
|
module Attributes
|
@@ -10,7 +12,8 @@ module Foobara
|
|
10
12
|
end
|
11
13
|
|
12
14
|
def applicable?(hash)
|
13
|
-
Thread.
|
15
|
+
Thread.inheritable_thread_local_var_get(:foobara_ignore_unexpected_attributes) &&
|
16
|
+
unexpected_attributes(hash).any?
|
14
17
|
end
|
15
18
|
|
16
19
|
def transform(hash)
|
data/projects/model/src/model.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "inheritable_thread_vars"
|
2
|
+
|
1
3
|
module Foobara
|
2
4
|
# TODO: either make this an abstract base class of ValueModel and Entity or rename it to ValueModel
|
3
5
|
# and have Entity inherit from it...
|
@@ -180,7 +182,7 @@ module Foobara
|
|
180
182
|
end
|
181
183
|
|
182
184
|
if options[:ignore_unexpected_attributes]
|
183
|
-
Thread.
|
185
|
+
Thread.with_inheritable_thread_local_var(:foobara_ignore_unexpected_attributes, true) do
|
184
186
|
initialize(attributes, options.except(:ignore_unexpected_attributes))
|
185
187
|
return
|
186
188
|
end
|
@@ -195,7 +197,7 @@ module Foobara
|
|
195
197
|
# :nocov:
|
196
198
|
end
|
197
199
|
else
|
198
|
-
if Thread.
|
200
|
+
if Thread.inheritable_thread_local_var_get(:foobara_ignore_unexpected_attributes)
|
199
201
|
outcome = attributes_type.process_value(attributes)
|
200
202
|
|
201
203
|
if outcome.success?
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "inheritable_thread_vars"
|
2
|
+
|
1
3
|
module Foobara
|
2
4
|
module Persistence
|
3
5
|
class EntityBase
|
@@ -43,11 +45,11 @@ module Foobara
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def current_transaction
|
46
|
-
Thread.
|
48
|
+
Thread.inheritable_thread_local_var_get(transaction_key)
|
47
49
|
end
|
48
50
|
|
49
51
|
def set_current_transaction(transaction)
|
50
|
-
Thread.
|
52
|
+
Thread.inheritable_thread_local_var_set(transaction_key, transaction)
|
51
53
|
end
|
52
54
|
|
53
55
|
VALID_MODES = [:use_existing, :open_nested, :open_new, nil].freeze
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "inheritable_thread_vars"
|
2
|
+
|
1
3
|
module Foobara
|
2
4
|
require_project_file("type_declarations", "type_builder")
|
3
5
|
require_project_file("type_declarations", "error_extension")
|
@@ -91,7 +93,7 @@ module Foobara
|
|
91
93
|
end
|
92
94
|
|
93
95
|
def foobara_manifest_context
|
94
|
-
Thread.
|
96
|
+
Thread.inheritable_thread_local_var_get("foobara_manifest_context")
|
95
97
|
end
|
96
98
|
|
97
99
|
allowed_context_keys = %i[detached to_include mode remove_sensitive]
|
@@ -117,10 +119,10 @@ module Foobara
|
|
117
119
|
old_context = foobara_manifest_context
|
118
120
|
begin
|
119
121
|
new_context = (old_context || {}).merge(context)
|
120
|
-
Thread.
|
122
|
+
Thread.inheritable_thread_local_var_set("foobara_manifest_context", new_context)
|
121
123
|
yield
|
122
124
|
ensure
|
123
|
-
Thread.
|
125
|
+
Thread.inheritable_thread_local_var_set("foobara_manifest_context", old_context)
|
124
126
|
end
|
125
127
|
end
|
126
128
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.102
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -51,6 +51,20 @@ dependencies:
|
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.0.11
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: inheritable-thread-vars
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.0.1
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.0.1
|
54
68
|
description: A command-centric and discoverable software framework with a focus on
|
55
69
|
domain concepts and abstracting away integration code
|
56
70
|
email:
|
@@ -364,8 +378,6 @@ files:
|
|
364
378
|
- projects/state_machine/src/sugar.rb
|
365
379
|
- projects/state_machine/src/transition_log.rb
|
366
380
|
- projects/state_machine/src/validations.rb
|
367
|
-
- projects/thread_parent/lib/foobara/thread_parent.rb
|
368
|
-
- projects/thread_parent/src/thread_parent.rb
|
369
381
|
- projects/type_declarations/lib/foobara/type_declarations.rb
|
370
382
|
- projects/type_declarations/src/attributes.rb
|
371
383
|
- projects/type_declarations/src/attributes_transformers/only.rb
|
@@ -471,7 +483,6 @@ require_paths:
|
|
471
483
|
- "./projects/namespace/lib"
|
472
484
|
- "./projects/persistence/lib"
|
473
485
|
- "./projects/state_machine/lib"
|
474
|
-
- "./projects/thread_parent/lib"
|
475
486
|
- "./projects/type_declarations/lib"
|
476
487
|
- "./projects/types/lib"
|
477
488
|
- "./projects/value/lib"
|
@@ -1 +0,0 @@
|
|
1
|
-
module Foobara::ThreadParent; end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Foobara
|
2
|
-
module ThreadParent
|
3
|
-
module ThreadClassExtensions
|
4
|
-
def new(...)
|
5
|
-
super.tap { |thread| thread.instance_variable_set("@foobara_parent", Thread.current) }
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class Thread
|
12
|
-
class << self
|
13
|
-
prepend(Foobara::ThreadParent::ThreadClassExtensions)
|
14
|
-
|
15
|
-
def foobara_var_get(...)
|
16
|
-
Thread.current.foobara_var_get(...)
|
17
|
-
end
|
18
|
-
|
19
|
-
def foobara_var_set(...)
|
20
|
-
Thread.current.foobara_var_set(...)
|
21
|
-
end
|
22
|
-
|
23
|
-
def foobara_with_var(...)
|
24
|
-
Thread.current.foobara_with_var(...)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
attr_reader :foobara_parent
|
29
|
-
|
30
|
-
# NOTE: because there's not a way to unset a thread variable, storing nil is used as deletion.
|
31
|
-
# this means that a thread local variable with nil can't have any semantic meaning and should be
|
32
|
-
# treated the same as if #thread_variable? had returned false.
|
33
|
-
def foobara_var_get(...)
|
34
|
-
value = thread_variable_get(...)
|
35
|
-
|
36
|
-
value.nil? ? foobara_parent&.foobara_var_get(...) : value
|
37
|
-
end
|
38
|
-
|
39
|
-
def foobara_var_set(...)
|
40
|
-
thread_variable_set(...)
|
41
|
-
end
|
42
|
-
|
43
|
-
def foobara_with_var(key, value, &block)
|
44
|
-
old_value = foobara_var_get(key)
|
45
|
-
|
46
|
-
begin
|
47
|
-
foobara_var_set(key, value)
|
48
|
-
block.call
|
49
|
-
ensure
|
50
|
-
foobara_var_set(key, old_value)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|