waylon-core 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: 404fb7180c3c7b52c2bb3637fd3fb86d28cd5b4b1f1791e8b2fe0f94d7788ea9
4
- data.tar.gz: 6b1da741b15a5092cddf65e81623a348454289ecb496eef1dfee081e79bb5f0e
3
+ metadata.gz: 4b2b3afe461da0b2a61930ff43324ffc820bb596e88de8f36daed751a8ec68fa
4
+ data.tar.gz: 2901833fc47c1ab6f8778137de3b3c917cdaf464d09138caac82ec74e45edbe6
5
5
  SHA512:
6
- metadata.gz: f4852c99d93a726be2e21ec1a1cdf9fdf758508b09fed717ea1642b2f92c9c9adfe84e8fb922107f751859d2e3a331521d32f492911ffb6f5d82935a0ceef032
7
- data.tar.gz: 03747526f39170835b3ab67ffc294a3e3c914968001b40e24eb5ddcd74fb2746c28ca7bb95288ab67523cf25018fe9709aa16956a54ab507839b1fe05a252771
6
+ metadata.gz: 61e60d22426e107eba2b3b07ff3481c6be533cb658d6b8cff402af18c947b9d9e8cd933b1bb137922410741445f83331418552ce3d3e79e290b1f75588bb41d8
7
+ data.tar.gz: b98cc02351ac0092fbc138c139c8ef1a3c87a5067b4f4890a0937d6c24af60088c4db4b570158a0cd0f79089493443f29aea8fa37c1d3a5d0e64100702e43706
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waylon-core (0.2.0)
4
+ waylon-core (0.2.1)
5
5
  addressable (~> 2.8)
6
6
  faraday (~> 1.8)
7
7
  i18n (~> 1.8)
@@ -14,13 +14,14 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- addressable (2.8.0)
18
- public_suffix (>= 2.0.2, < 5.0)
17
+ addressable (2.8.1)
18
+ public_suffix (>= 2.0.2, < 6.0)
19
19
  ast (2.4.2)
20
20
  concurrent-ruby (1.1.10)
21
+ connection_pool (2.2.5)
21
22
  diff-lcs (1.5.0)
22
23
  docile (1.4.0)
23
- faraday (1.10.0)
24
+ faraday (1.10.2)
24
25
  faraday-em_http (~> 1.0)
25
26
  faraday-em_synchrony (~> 1.0)
26
27
  faraday-excon (~> 1.1)
@@ -44,34 +45,37 @@ GEM
44
45
  faraday-rack (1.0.0)
45
46
  faraday-retry (1.0.3)
46
47
  ffi (1.15.5)
47
- i18n (1.10.0)
48
+ i18n (1.12.0)
48
49
  concurrent-ruby (~> 1.0)
49
50
  json (2.6.2)
50
51
  moneta (1.5.1)
51
52
  mono_logger (1.1.1)
52
53
  multi_json (1.15.0)
53
54
  multipart-post (2.2.3)
54
- mustermann (1.1.1)
55
+ mustermann (2.0.2)
55
56
  ruby2_keywords (~> 0.0.1)
56
57
  nio4r (2.5.8)
57
58
  parallel (1.22.1)
58
- parser (3.1.2.0)
59
+ parser (3.1.2.1)
59
60
  ast (~> 2.4.1)
60
- public_suffix (4.0.7)
61
- puma (5.6.4)
61
+ public_suffix (5.0.0)
62
+ puma (5.6.5)
62
63
  nio4r (~> 2.0)
63
- rack (2.2.3.1)
64
- rack-protection (2.2.0)
64
+ rack (2.2.4)
65
+ rack-protection (2.2.2)
65
66
  rack
66
67
  rainbow (3.1.1)
67
68
  rake (13.0.6)
68
69
  rbnacl (7.1.1)
69
70
  ffi
70
- redis (4.6.0)
71
- redis-namespace (1.8.2)
72
- redis (>= 3.0.4)
71
+ redis (5.0.1)
72
+ redis-client (~> 0.7)
73
+ redis-client (0.7.1)
74
+ connection_pool
75
+ redis-namespace (1.9.0)
76
+ redis (>= 4)
73
77
  regexp_parser (2.5.0)
74
- resque (2.2.1)
78
+ resque (2.3.0)
75
79
  mono_logger (~> 1.0)
76
80
  multi_json (~> 1.0)
77
81
  redis-namespace (~> 1.6)
@@ -90,21 +94,22 @@ GEM
90
94
  diff-lcs (>= 1.2.0, < 2.0)
91
95
  rspec-support (~> 3.11.0)
92
96
  rspec-support (3.11.0)
93
- rubocop (1.30.1)
97
+ rubocop (1.35.1)
98
+ json (~> 2.3)
94
99
  parallel (~> 1.10)
95
- parser (>= 3.1.0.0)
100
+ parser (>= 3.1.2.1)
96
101
  rainbow (>= 2.2.2, < 4.0)
97
102
  regexp_parser (>= 1.8, < 3.0)
98
103
  rexml (>= 3.2.5, < 4.0)
99
- rubocop-ast (>= 1.18.0, < 2.0)
104
+ rubocop-ast (>= 1.20.1, < 2.0)
100
105
  ruby-progressbar (~> 1.7)
101
106
  unicode-display_width (>= 1.4.0, < 3.0)
102
- rubocop-ast (1.18.0)
107
+ rubocop-ast (1.21.0)
103
108
  parser (>= 3.1.1.0)
104
109
  rubocop-rake (0.6.0)
105
110
  rubocop (~> 1.0)
106
- rubocop-rspec (2.11.1)
107
- rubocop (~> 1.19)
111
+ rubocop-rspec (2.12.1)
112
+ rubocop (~> 1.31)
108
113
  ruby-progressbar (1.11.0)
109
114
  ruby2_keywords (0.0.5)
110
115
  simplecov (0.21.2)
@@ -113,13 +118,13 @@ GEM
113
118
  simplecov_json_formatter (~> 0.1)
114
119
  simplecov-html (0.12.3)
115
120
  simplecov_json_formatter (0.1.4)
116
- sinatra (2.2.0)
117
- mustermann (~> 1.0)
121
+ sinatra (2.2.2)
122
+ mustermann (~> 2.0)
118
123
  rack (~> 2.2)
119
- rack-protection (= 2.2.0)
124
+ rack-protection (= 2.2.2)
120
125
  tilt (~> 2.0)
121
- tilt (2.0.10)
122
- unicode-display_width (2.1.0)
126
+ tilt (2.0.11)
127
+ unicode-display_width (2.2.0)
123
128
  webrick (1.7.0)
124
129
  yard (0.9.28)
125
130
  webrick (~> 1.7.0)
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Waylon
4
+ # Used for working with the Moneta store for caching
5
+ module Cache
6
+ DefaultStorage = Moneta.new(
7
+ :Redis,
8
+ url: "redis://#{ENV.fetch("REDIS", "localhost:6379")}/1"
9
+ )
10
+
11
+ def self.clear
12
+ storage.clear
13
+ end
14
+
15
+ def self.delete(key)
16
+ storage.delete(key)
17
+ end
18
+
19
+ def self.key?(name)
20
+ storage.key?(name)
21
+ end
22
+
23
+ def self.load(key, expires: nil)
24
+ expires ? storage.load(key, expires: expires) : storage.load(key)
25
+ end
26
+
27
+ def self.store(key, value, expires: nil)
28
+ if expires
29
+ storage.store(key, value, expires: expires)
30
+ else
31
+ storage.store(key, value)
32
+ end
33
+ end
34
+
35
+ def self.storage
36
+ @storage ||= DefaultStorage
37
+ end
38
+
39
+ def self.storage=(storage)
40
+ @storage = storage
41
+ end
42
+ end
43
+ end
data/lib/waylon/core.rb CHANGED
@@ -27,6 +27,7 @@ require "sinatra"
27
27
 
28
28
  # Internal requirements
29
29
  require "waylon/version"
30
+ require "waylon/cache"
30
31
  require "waylon/config"
31
32
  require "waylon/generic_exception"
32
33
  require "waylon/exceptions/not_implemented_error"
@@ -19,8 +19,7 @@ require "waylon/rspec/test_worker"
19
19
  config = Waylon::Config.instance
20
20
  config.load_env
21
21
 
22
- Waylon::Cache = Moneta.new(:Cookie)
23
- p Waylon::Storage
22
+ Waylon::Cache.store = Moneta.new(:Cookie)
24
23
  Waylon::Logger.log("Found Global Admins: #{config.admins}")
25
24
 
26
25
  Waylon::RSpec::TestUser.find_or_create(
data/lib/waylon/rspec.rb CHANGED
@@ -46,5 +46,5 @@ module Waylon
46
46
  end
47
47
  end
48
48
 
49
- Waylon::Cache = Moneta.new(:Cookie)
50
- Waylon::Storage::Store = Moneta.new(:Cookie)
49
+ Waylon::Cache.storage = Moneta.new(:Cookie)
50
+ Waylon::Storage.storage = Moneta.new(:Cookie)
@@ -1,14 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Waylon::Cache = Moneta.new(
4
- :Redis,
5
- url: "redis://#{ENV.fetch("REDIS", "localhost:6379")}/1"
6
- )
7
-
8
3
  module Waylon
9
4
  # Used for working with the Moneta store
10
5
  module Storage
11
- Store = Moneta.new(
6
+ DefaultStorage = Moneta.new(
12
7
  :Redis,
13
8
  url: "redis://#{ENV.fetch("REDIS", "localhost:6379")}/2"
14
9
  )
@@ -19,20 +14,20 @@ module Waylon
19
14
  end
20
15
 
21
16
  def self.clear
22
- Store.clear
17
+ storage.clear
23
18
  end
24
19
 
25
20
  def self.delete(key)
26
- Store.delete(key)
21
+ storage.delete(key)
27
22
  end
28
23
 
29
24
  def self.key?(name)
30
- Store.key?(name)
25
+ storage.key?(name)
31
26
  end
32
27
 
33
28
  def self.load(key)
34
29
  this_cipher = cipher
35
- raw = Store.load(key)
30
+ raw = storage.load(key)
36
31
  return nil unless raw
37
32
 
38
33
  decoded = Base64.decode64(raw)
@@ -40,11 +35,19 @@ module Waylon
40
35
  JSON.parse(plain)
41
36
  end
42
37
 
38
+ def self.storage
39
+ @storage ||= DefaultStorage
40
+ end
41
+
42
+ def self.storage=(storage)
43
+ @storage = storage
44
+ end
45
+
43
46
  def self.store(key, value)
44
47
  this_cipher = cipher
45
48
  encrypted = this_cipher.encrypt(value.to_json)
46
49
  encoded = Base64.encode64(encrypted)
47
- Store.store(key, encoded)
50
+ storage.store(key, encoded)
48
51
  end
49
52
  end
50
53
  end
@@ -6,7 +6,7 @@ module Waylon
6
6
  VERSION = [
7
7
  0, # Major
8
8
  2, # Minor
9
- 0 # Patch
9
+ 1 # Patch
10
10
  ].join(".")
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waylon-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-19 00:00:00.000000000 Z
11
+ date: 2022-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -261,6 +261,7 @@ files:
261
261
  - bin/console
262
262
  - bin/setup
263
263
  - lib/waylon/base_component.rb
264
+ - lib/waylon/cache.rb
264
265
  - lib/waylon/condition.rb
265
266
  - lib/waylon/conditions/black_hole.rb
266
267
  - lib/waylon/conditions/default.rb