waylon-core 0.1.4 → 0.1.8
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/Gemfile.lock +13 -9
- data/bin/console +6 -1
- data/lib/waylon/base_component.rb +2 -2
- data/lib/waylon/core.rb +2 -0
- data/lib/waylon/rspec/test_server.rb +1 -1
- data/lib/waylon/rspec.rb +1 -1
- data/lib/waylon/storage.rb +41 -0
- data/lib/waylon/version.rb +1 -1
- data/scripts/release.sh +2 -0
- data/scripts/test.sh +2 -0
- data/waylon-core.gemspec +1 -0
- metadata +17 -3
- data/lib/waylon.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d396f88fe34083537cabbe245d1063ecd1b8c0d15e5391c80eb0a9f4902aa39
|
|
4
|
+
data.tar.gz: bc7d2a6b5da80e36508032d3bcfaa59f91395d016e0fb69e65a24c56366f26e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 229980e2a8c719c57baa00a26d137a10c6677fe1081adfc3aa73f4bfd13c83ee74c1f8b10933ba43688a9d40fa8e0c71c264cbbe7dec40ec202192ade05e4b1c
|
|
7
|
+
data.tar.gz: 82814e648a191b886619f8e15bf6b934b8c1cbc6112d77f39a1bbcf96f0b5def15267260609a45b46c3c8252a98d569e454c07f754c4baa39b1ee0aba8923c92
|
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
waylon-core (0.1.
|
|
4
|
+
waylon-core (0.1.8)
|
|
5
5
|
addressable (~> 2.8)
|
|
6
6
|
faraday (~> 1.8)
|
|
7
7
|
i18n (~> 1.8)
|
|
8
8
|
json (~> 2.6)
|
|
9
9
|
moneta (~> 1.4)
|
|
10
10
|
puma (~> 5.5)
|
|
11
|
+
rbnacl (~> 7.1)
|
|
11
12
|
resque (~> 2.2)
|
|
12
13
|
|
|
13
14
|
GEM
|
|
@@ -35,20 +36,21 @@ GEM
|
|
|
35
36
|
faraday-em_synchrony (1.0.0)
|
|
36
37
|
faraday-excon (1.1.0)
|
|
37
38
|
faraday-httpclient (1.0.1)
|
|
38
|
-
faraday-multipart (1.0.
|
|
39
|
-
multipart-post (
|
|
39
|
+
faraday-multipart (1.0.4)
|
|
40
|
+
multipart-post (~> 2)
|
|
40
41
|
faraday-net_http (1.0.1)
|
|
41
42
|
faraday-net_http_persistent (1.2.0)
|
|
42
43
|
faraday-patron (1.0.0)
|
|
43
44
|
faraday-rack (1.0.0)
|
|
44
45
|
faraday-retry (1.0.3)
|
|
46
|
+
ffi (1.15.5)
|
|
45
47
|
i18n (1.10.0)
|
|
46
48
|
concurrent-ruby (~> 1.0)
|
|
47
49
|
json (2.6.2)
|
|
48
50
|
moneta (1.5.1)
|
|
49
51
|
mono_logger (1.1.1)
|
|
50
52
|
multi_json (1.15.0)
|
|
51
|
-
multipart-post (2.
|
|
53
|
+
multipart-post (2.2.0)
|
|
52
54
|
mustermann (1.1.1)
|
|
53
55
|
ruby2_keywords (~> 0.0.1)
|
|
54
56
|
nio4r (2.5.8)
|
|
@@ -58,15 +60,17 @@ GEM
|
|
|
58
60
|
public_suffix (4.0.7)
|
|
59
61
|
puma (5.6.4)
|
|
60
62
|
nio4r (~> 2.0)
|
|
61
|
-
rack (2.2.3)
|
|
63
|
+
rack (2.2.3.1)
|
|
62
64
|
rack-protection (2.2.0)
|
|
63
65
|
rack
|
|
64
66
|
rainbow (3.1.1)
|
|
65
67
|
rake (13.0.6)
|
|
68
|
+
rbnacl (7.1.1)
|
|
69
|
+
ffi
|
|
66
70
|
redis (4.6.0)
|
|
67
71
|
redis-namespace (1.8.2)
|
|
68
72
|
redis (>= 3.0.4)
|
|
69
|
-
regexp_parser (2.
|
|
73
|
+
regexp_parser (2.5.0)
|
|
70
74
|
resque (2.2.1)
|
|
71
75
|
mono_logger (~> 1.0)
|
|
72
76
|
multi_json (~> 1.0)
|
|
@@ -86,13 +90,13 @@ GEM
|
|
|
86
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
87
91
|
rspec-support (~> 3.11.0)
|
|
88
92
|
rspec-support (3.11.0)
|
|
89
|
-
rubocop (1.
|
|
93
|
+
rubocop (1.30.1)
|
|
90
94
|
parallel (~> 1.10)
|
|
91
95
|
parser (>= 3.1.0.0)
|
|
92
96
|
rainbow (>= 2.2.2, < 4.0)
|
|
93
97
|
regexp_parser (>= 1.8, < 3.0)
|
|
94
98
|
rexml (>= 3.2.5, < 4.0)
|
|
95
|
-
rubocop-ast (>= 1.
|
|
99
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
|
96
100
|
ruby-progressbar (~> 1.7)
|
|
97
101
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
98
102
|
rubocop-ast (1.18.0)
|
|
@@ -117,7 +121,7 @@ GEM
|
|
|
117
121
|
tilt (2.0.10)
|
|
118
122
|
unicode-display_width (2.1.0)
|
|
119
123
|
webrick (1.7.0)
|
|
120
|
-
yard (0.9.
|
|
124
|
+
yard (0.9.28)
|
|
121
125
|
webrick (~> 1.7.0)
|
|
122
126
|
|
|
123
127
|
PLATFORMS
|
data/bin/console
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require "bundler/setup"
|
|
5
|
-
require "waylon"
|
|
5
|
+
require "waylon/core"
|
|
6
|
+
require "waylon/skills/default"
|
|
7
|
+
require "waylon/skills/diagnostics"
|
|
8
|
+
require "waylon/skills/fun"
|
|
9
|
+
require "waylon/skills/groups"
|
|
10
|
+
require "waylon/skills/help"
|
|
6
11
|
|
|
7
12
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
13
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -46,7 +46,7 @@ module Waylon
|
|
|
46
46
|
@namespace || name.to_s.split("::").last.downcase
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
# Creates namespaced configuration keys for
|
|
49
|
+
# Creates namespaced configuration keys for BaseComponent subclasses
|
|
50
50
|
# @param (see Config#add_schema)
|
|
51
51
|
def config(key, default: nil, required: false, type: String)
|
|
52
52
|
conf = Config.instance
|
|
@@ -127,7 +127,7 @@ module Waylon
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
# A wrapper for accessing the persistent storage
|
|
130
|
-
# @return [Waylon::Storage] The Storage wrapper
|
|
130
|
+
# @return [Waylon::Storage] The Storage wrapper module
|
|
131
131
|
def storage
|
|
132
132
|
Waylon::Storage
|
|
133
133
|
end
|
data/lib/waylon/core.rb
CHANGED
|
@@ -21,6 +21,7 @@ require "faraday"
|
|
|
21
21
|
require "i18n"
|
|
22
22
|
require "json"
|
|
23
23
|
require "moneta"
|
|
24
|
+
require "rbnacl"
|
|
24
25
|
require "resque"
|
|
25
26
|
require "sinatra"
|
|
26
27
|
|
|
@@ -32,6 +33,7 @@ require "waylon/exceptions/not_implemented_error"
|
|
|
32
33
|
require "waylon/exceptions/validation_error"
|
|
33
34
|
require "waylon/group"
|
|
34
35
|
require "waylon/logger"
|
|
36
|
+
require "waylon/storage"
|
|
35
37
|
require "waylon/base_component"
|
|
36
38
|
require "waylon/condition"
|
|
37
39
|
require "waylon/message"
|
|
@@ -20,7 +20,7 @@ config = Waylon::Config.instance
|
|
|
20
20
|
config.load_env
|
|
21
21
|
|
|
22
22
|
Waylon::Cache = Moneta.new(:Cookie)
|
|
23
|
-
Waylon::Storage
|
|
23
|
+
p Waylon::Storage
|
|
24
24
|
Waylon::Logger.log("Found Global Admins: #{config.admins}")
|
|
25
25
|
|
|
26
26
|
Waylon::RSpec::TestUser.find_or_create(
|
data/lib/waylon/rspec.rb
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Waylon
|
|
4
|
+
# Used for working with the Moneta store
|
|
5
|
+
module Storage
|
|
6
|
+
Store = Moneta.new(
|
|
7
|
+
:Redis,
|
|
8
|
+
url: "redis://#{ENV.fetch("REDIS", "localhost:6379")}/1"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
def self.cipher
|
|
12
|
+
key_bytes = RbNaCl::Hash.sha256(ENV.fetch("ENCRYPTION_KEY", "thisisVeryUnsafe4U"))[0..31]
|
|
13
|
+
RbNaCl::SimpleBox.from_secret_key(key_bytes)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.clear
|
|
17
|
+
Store.clear
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.key?(name)
|
|
21
|
+
Store.key?(name)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.load(key)
|
|
25
|
+
this_cipher = cipher
|
|
26
|
+
raw = Store.load(key)
|
|
27
|
+
return nil unless raw
|
|
28
|
+
|
|
29
|
+
decoded = Base64.decode64(raw)
|
|
30
|
+
plain = this_cipher.decrypt(decoded)
|
|
31
|
+
JSON.parse(plain)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.store(key, value)
|
|
35
|
+
this_cipher = cipher
|
|
36
|
+
encrypted = this_cipher.encrypt(value.to_json)
|
|
37
|
+
encoded = Base64.encode64(encrypted)
|
|
38
|
+
Store.store(key, encoded)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/waylon/version.rb
CHANGED
data/scripts/release.sh
CHANGED
data/scripts/test.sh
CHANGED
data/waylon-core.gemspec
CHANGED
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_dependency "json", "~> 2.6"
|
|
34
34
|
spec.add_dependency "moneta", "~> 1.4"
|
|
35
35
|
spec.add_dependency "puma", "~> 5.5"
|
|
36
|
+
spec.add_dependency "rbnacl", "~> 7.1"
|
|
36
37
|
spec.add_dependency "resque", "~> 2.2"
|
|
37
38
|
|
|
38
39
|
spec.add_development_dependency "bundler", "~> 2.3"
|
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.1.
|
|
4
|
+
version: 0.1.8
|
|
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-
|
|
11
|
+
date: 2022-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -94,6 +94,20 @@ dependencies:
|
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '5.5'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rbnacl
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '7.1'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '7.1'
|
|
97
111
|
- !ruby/object:Gem::Dependency
|
|
98
112
|
name: resque
|
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -246,7 +260,6 @@ files:
|
|
|
246
260
|
- Rakefile
|
|
247
261
|
- bin/console
|
|
248
262
|
- bin/setup
|
|
249
|
-
- lib/waylon.rb
|
|
250
263
|
- lib/waylon/base_component.rb
|
|
251
264
|
- lib/waylon/condition.rb
|
|
252
265
|
- lib/waylon/conditions/black_hole.rb
|
|
@@ -284,6 +297,7 @@ files:
|
|
|
284
297
|
- lib/waylon/skills/fun.rb
|
|
285
298
|
- lib/waylon/skills/groups.rb
|
|
286
299
|
- lib/waylon/skills/help.rb
|
|
300
|
+
- lib/waylon/storage.rb
|
|
287
301
|
- lib/waylon/user.rb
|
|
288
302
|
- lib/waylon/version.rb
|
|
289
303
|
- lib/waylon/webhook.rb
|