waylon-core 0.2.0 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +37 -26
- data/Rakefile +4 -0
- data/lib/waylon/cache.rb +43 -0
- data/lib/waylon/core.rb +1 -0
- data/lib/waylon/rspec/test_server.rb +3 -2
- data/lib/waylon/rspec.rb +2 -2
- data/lib/waylon/storage.rb +14 -11
- data/lib/waylon/version.rb +1 -1
- data/waylon-core.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b2586a3ba29a3b2da02d66f880a826b445d2658ea6f83fa3e8a0a9935d0898
|
4
|
+
data.tar.gz: b1d602e2f41f06c37752c31eb2d9a0a983f699f3bcd7c73372305719c6a68874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d40939e62fa6c4a58c7bf31ec716fdde3d0d878e36aa6331dcfdabd73b67b02b441973243a3baefd9c96ad01681a1ab382146d26ffa4de83db3ea41355a060f
|
7
|
+
data.tar.gz: 581ba5ccbececbb637a09efab4bd202c3e8112edca8999e57e5fe3bda3b1cb40097f92c73d5e959c76c454039f9d7581fd13955580d5d72d0b3ba773b3991ca0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
waylon-core (0.2.
|
4
|
+
waylon-core (0.2.3)
|
5
5
|
addressable (~> 2.8)
|
6
6
|
faraday (~> 1.8)
|
7
7
|
i18n (~> 1.8)
|
@@ -14,13 +14,15 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
addressable (2.8.
|
18
|
-
public_suffix (>= 2.0.2, <
|
17
|
+
addressable (2.8.1)
|
18
|
+
public_suffix (>= 2.0.2, < 6.0)
|
19
19
|
ast (2.4.2)
|
20
|
+
coderay (1.1.3)
|
20
21
|
concurrent-ruby (1.1.10)
|
22
|
+
connection_pool (2.2.5)
|
21
23
|
diff-lcs (1.5.0)
|
22
24
|
docile (1.4.0)
|
23
|
-
faraday (1.10.
|
25
|
+
faraday (1.10.2)
|
24
26
|
faraday-em_http (~> 1.0)
|
25
27
|
faraday-em_synchrony (~> 1.0)
|
26
28
|
faraday-excon (~> 1.1)
|
@@ -44,34 +46,41 @@ GEM
|
|
44
46
|
faraday-rack (1.0.0)
|
45
47
|
faraday-retry (1.0.3)
|
46
48
|
ffi (1.15.5)
|
47
|
-
i18n (1.
|
49
|
+
i18n (1.12.0)
|
48
50
|
concurrent-ruby (~> 1.0)
|
49
51
|
json (2.6.2)
|
52
|
+
method_source (1.0.0)
|
50
53
|
moneta (1.5.1)
|
51
54
|
mono_logger (1.1.1)
|
52
55
|
multi_json (1.15.0)
|
53
56
|
multipart-post (2.2.3)
|
54
|
-
mustermann (
|
57
|
+
mustermann (2.0.2)
|
55
58
|
ruby2_keywords (~> 0.0.1)
|
56
59
|
nio4r (2.5.8)
|
57
60
|
parallel (1.22.1)
|
58
|
-
parser (3.1.2.
|
61
|
+
parser (3.1.2.1)
|
59
62
|
ast (~> 2.4.1)
|
60
|
-
|
61
|
-
|
63
|
+
pry (0.14.1)
|
64
|
+
coderay (~> 1.1)
|
65
|
+
method_source (~> 1.0)
|
66
|
+
public_suffix (5.0.0)
|
67
|
+
puma (5.6.5)
|
62
68
|
nio4r (~> 2.0)
|
63
|
-
rack (2.2.
|
64
|
-
rack-protection (2.2.
|
69
|
+
rack (2.2.4)
|
70
|
+
rack-protection (2.2.2)
|
65
71
|
rack
|
66
72
|
rainbow (3.1.1)
|
67
73
|
rake (13.0.6)
|
68
74
|
rbnacl (7.1.1)
|
69
75
|
ffi
|
70
|
-
redis (
|
71
|
-
|
72
|
-
|
76
|
+
redis (5.0.1)
|
77
|
+
redis-client (~> 0.7)
|
78
|
+
redis-client (0.7.1)
|
79
|
+
connection_pool
|
80
|
+
redis-namespace (1.9.0)
|
81
|
+
redis (>= 4)
|
73
82
|
regexp_parser (2.5.0)
|
74
|
-
resque (2.
|
83
|
+
resque (2.3.0)
|
75
84
|
mono_logger (~> 1.0)
|
76
85
|
multi_json (~> 1.0)
|
77
86
|
redis-namespace (~> 1.6)
|
@@ -90,21 +99,22 @@ GEM
|
|
90
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
91
100
|
rspec-support (~> 3.11.0)
|
92
101
|
rspec-support (3.11.0)
|
93
|
-
rubocop (1.
|
102
|
+
rubocop (1.35.1)
|
103
|
+
json (~> 2.3)
|
94
104
|
parallel (~> 1.10)
|
95
|
-
parser (>= 3.1.
|
105
|
+
parser (>= 3.1.2.1)
|
96
106
|
rainbow (>= 2.2.2, < 4.0)
|
97
107
|
regexp_parser (>= 1.8, < 3.0)
|
98
108
|
rexml (>= 3.2.5, < 4.0)
|
99
|
-
rubocop-ast (>= 1.
|
109
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
100
110
|
ruby-progressbar (~> 1.7)
|
101
111
|
unicode-display_width (>= 1.4.0, < 3.0)
|
102
|
-
rubocop-ast (1.
|
112
|
+
rubocop-ast (1.21.0)
|
103
113
|
parser (>= 3.1.1.0)
|
104
114
|
rubocop-rake (0.6.0)
|
105
115
|
rubocop (~> 1.0)
|
106
|
-
rubocop-rspec (2.
|
107
|
-
rubocop (~> 1.
|
116
|
+
rubocop-rspec (2.12.1)
|
117
|
+
rubocop (~> 1.31)
|
108
118
|
ruby-progressbar (1.11.0)
|
109
119
|
ruby2_keywords (0.0.5)
|
110
120
|
simplecov (0.21.2)
|
@@ -113,13 +123,13 @@ GEM
|
|
113
123
|
simplecov_json_formatter (~> 0.1)
|
114
124
|
simplecov-html (0.12.3)
|
115
125
|
simplecov_json_formatter (0.1.4)
|
116
|
-
sinatra (2.2.
|
117
|
-
mustermann (~>
|
126
|
+
sinatra (2.2.2)
|
127
|
+
mustermann (~> 2.0)
|
118
128
|
rack (~> 2.2)
|
119
|
-
rack-protection (= 2.2.
|
129
|
+
rack-protection (= 2.2.2)
|
120
130
|
tilt (~> 2.0)
|
121
|
-
tilt (2.0.
|
122
|
-
unicode-display_width (2.
|
131
|
+
tilt (2.0.11)
|
132
|
+
unicode-display_width (2.2.0)
|
123
133
|
webrick (1.7.0)
|
124
134
|
yard (0.9.28)
|
125
135
|
webrick (~> 1.7.0)
|
@@ -130,6 +140,7 @@ PLATFORMS
|
|
130
140
|
|
131
141
|
DEPENDENCIES
|
132
142
|
bundler (~> 2.3)
|
143
|
+
pry (~> 0.14)
|
133
144
|
rake (~> 13.0)
|
134
145
|
rspec (~> 3.10)
|
135
146
|
rubocop (~> 1.23)
|
data/Rakefile
CHANGED
@@ -19,5 +19,9 @@ end
|
|
19
19
|
task default: %i[spec rubocop yard]
|
20
20
|
|
21
21
|
task :demo do
|
22
|
+
require "pry"
|
23
|
+
Waylon::Logger.logger = ::Logger.new("/dev/null")
|
24
|
+
Waylon::Cache.storage = Moneta.new(:Cookie)
|
25
|
+
Waylon::Storage.storage = Moneta.new(:Cookie)
|
22
26
|
require "waylon/rspec/test_server"
|
23
27
|
end
|
data/lib/waylon/cache.rb
ADDED
@@ -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
@@ -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.storage = Moneta.new(:Cookie)
|
24
23
|
Waylon::Logger.log("Found Global Admins: #{config.admins}")
|
25
24
|
|
26
25
|
Waylon::RSpec::TestUser.find_or_create(
|
@@ -101,6 +100,8 @@ def handle_input(body, from: this_user, privately: true)
|
|
101
100
|
elsif ["su", "su -", "su admin", "su - admin"].include?(body)
|
102
101
|
puts 'Admin enabled! Use "exit" to go back to a normal user.'
|
103
102
|
@admin_enabled = true
|
103
|
+
elsif @admin_enabled && %w[irb pry].include?(body)
|
104
|
+
pry
|
104
105
|
else
|
105
106
|
message_count = Waylon::RSpec::TestSense.sent_messages.size
|
106
107
|
|
data/lib/waylon/rspec.rb
CHANGED
data/lib/waylon/storage.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
17
|
+
storage.clear
|
23
18
|
end
|
24
19
|
|
25
20
|
def self.delete(key)
|
26
|
-
|
21
|
+
storage.delete(key)
|
27
22
|
end
|
28
23
|
|
29
24
|
def self.key?(name)
|
30
|
-
|
25
|
+
storage.key?(name)
|
31
26
|
end
|
32
27
|
|
33
28
|
def self.load(key)
|
34
29
|
this_cipher = cipher
|
35
|
-
raw =
|
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
|
-
|
50
|
+
storage.store(key, encoded)
|
48
51
|
end
|
49
52
|
end
|
50
53
|
end
|
data/lib/waylon/version.rb
CHANGED
data/waylon-core.gemspec
CHANGED
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_dependency "resque", "~> 2.2"
|
38
38
|
|
39
39
|
spec.add_development_dependency "bundler", "~> 2.3"
|
40
|
+
spec.add_development_dependency "pry", "~> 0.14"
|
40
41
|
spec.add_development_dependency "rake", "~> 13.0"
|
41
42
|
spec.add_development_dependency "rspec", "~> 3.10"
|
42
43
|
spec.add_development_dependency "rubocop", "~> 1.23"
|
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.
|
4
|
+
version: 0.2.3
|
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-
|
11
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.3'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.14'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.14'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rake
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,6 +275,7 @@ files:
|
|
261
275
|
- bin/console
|
262
276
|
- bin/setup
|
263
277
|
- lib/waylon/base_component.rb
|
278
|
+
- lib/waylon/cache.rb
|
264
279
|
- lib/waylon/condition.rb
|
265
280
|
- lib/waylon/conditions/black_hole.rb
|
266
281
|
- lib/waylon/conditions/default.rb
|