bonobot 0.0.9 ā 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/bonobot/overload.rb +1 -0
- data/lib/bonobot/overloads_registry.rb +14 -3
- data/lib/bonobot/status.rb +55 -27
- data/lib/bonobot/version.rb +1 -1
- data/lib/tasks/bonobot_tasks.rake +5 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cb9e5c0eaac02524d810bf6f59774cd16437e09a5c0e588996aa80826d4b371
|
4
|
+
data.tar.gz: dc0b5858278ba66cb75db9839853bfc4a0c25a29667d768761b1ebe46b0b3d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9805b50c084da6db7e6b593e3e86cfe6af985f5d799355163d0239f70c9c67027a42cf4330c7736d11ebf24e38866075b5426531476f145e5178cd23fe93f4bc
|
7
|
+
data.tar.gz: aaf8b17b178404a4d78aa7cec759b6136245ac29b3512e01ef5bcf5663a1cd4c21895746ce3b9b8b4b558bf01ce3ef84248b85683a23dfb6ea8cccc5540c8cac
|
data/README.md
CHANGED
data/lib/bonobot/overload.rb
CHANGED
@@ -4,10 +4,17 @@ module Bonobot
|
|
4
4
|
module OverloadsRegistry
|
5
5
|
def self.all
|
6
6
|
@all ||= LocalFilesRegistry.all.flat_map do |local_file|
|
7
|
-
|
8
|
-
|
7
|
+
next if local_file.nil? || local_file.annotation.nil?
|
8
|
+
|
9
|
+
engines_files = EnginesFilesRegistry.find_by(short_path: local_file.path)
|
10
|
+
if engines_files.empty?
|
11
|
+
Overload.new(local_file, nil)
|
12
|
+
else
|
13
|
+
engines_files.map do |engine_file|
|
14
|
+
Overload.new(local_file, engine_file)
|
15
|
+
end
|
9
16
|
end
|
10
|
-
end
|
17
|
+
end.compact
|
11
18
|
end
|
12
19
|
|
13
20
|
# TODO: Extract to module
|
@@ -22,5 +29,9 @@ module Bonobot
|
|
22
29
|
def self.output
|
23
30
|
all.map(&:as_json)
|
24
31
|
end
|
32
|
+
|
33
|
+
def self.reload
|
34
|
+
@all = nil
|
35
|
+
end
|
25
36
|
end
|
26
37
|
end
|
data/lib/bonobot/status.rb
CHANGED
@@ -4,52 +4,80 @@ require "json"
|
|
4
4
|
|
5
5
|
module Bonobot
|
6
6
|
class Status
|
7
|
-
STATUS = { up_to_date: "š„³", out_of_date: "š±", missing: "š¤¬" }.freeze
|
7
|
+
STATUS = { up_to_date: "š„³", out_of_date: "š±", unused: "š
", missing: "š¤¬" }.freeze
|
8
|
+
STATUS_FILE_PATH = "status.json"
|
8
9
|
|
9
10
|
def self.generate(status = nil)
|
10
|
-
|
11
|
-
|
12
|
-
puts "-----"
|
13
|
-
puts "š Generating status"
|
14
|
-
File.write("status.json", status_json)
|
15
|
-
puts File.expand_path("status.json")
|
16
|
-
puts "-----"
|
17
|
-
|
18
|
-
if status
|
19
|
-
generate_status(status.to_sym, STATUS[status.to_sym])
|
20
|
-
else
|
21
|
-
STATUS.each do |status_type, emoji|
|
22
|
-
generate_status(status_type, emoji)
|
23
|
-
end
|
24
|
-
end
|
11
|
+
new(status).generate
|
12
|
+
end
|
25
13
|
|
26
|
-
|
27
|
-
|
14
|
+
def initialize(status)
|
15
|
+
@status = status
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate
|
19
|
+
generate_status_file
|
20
|
+
puts display_banner
|
21
|
+
return_status_code
|
28
22
|
end
|
29
23
|
|
30
|
-
def
|
24
|
+
def present(entries)
|
31
25
|
entries.map do |entry|
|
32
|
-
|
26
|
+
if entry.engine_file.nil?
|
27
|
+
" - #{entry.path} (unused)"
|
28
|
+
else
|
29
|
+
" - #{entry.engine_file.engine_name}: #{entry.engine_file.short_path} (#{entry.engine_file.fingerprint})"
|
30
|
+
end
|
33
31
|
end.join("\n")
|
34
32
|
end
|
35
33
|
|
36
|
-
def
|
37
|
-
return if OverloadsRegistry.find_by(status: status).empty?
|
38
|
-
|
34
|
+
def generate_status(status, emoji)
|
39
35
|
overload_status = OverloadsRegistry.find_by(status: status)
|
40
36
|
status_to_text = status.to_s.capitalize.gsub("_", " ")
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
if overload_status.empty?
|
39
|
+
["-> #{emoji} #{status_to_text} : All good! \n"]
|
40
|
+
else
|
41
|
+
["-> #{emoji} #{status_to_text} fingerprint (#{overload_status.count}):", present(OverloadsRegistry.find_by(status: status)), ""]
|
42
|
+
end
|
45
43
|
end
|
46
44
|
|
47
|
-
def
|
45
|
+
def status_json
|
48
46
|
JSON.pretty_generate({
|
49
47
|
rails_files: LocalFilesRegistry.output,
|
50
48
|
engines_files: EnginesFilesRegistry.output,
|
51
49
|
overloads: OverloadsRegistry.output
|
52
50
|
})
|
53
51
|
end
|
52
|
+
|
53
|
+
def generate_status_file
|
54
|
+
File.write(STATUS_FILE_PATH, status_json)
|
55
|
+
end
|
56
|
+
|
57
|
+
def display_banner
|
58
|
+
[display_intro + display_status.join("\n") + display_outro].join("\n")
|
59
|
+
end
|
60
|
+
|
61
|
+
def display_intro
|
62
|
+
"-----\nš š š Bonobot š š š\n-----\n\nš Generating status\n#{File.expand_path("status.json")}\n-----\n\n"
|
63
|
+
end
|
64
|
+
|
65
|
+
def display_status
|
66
|
+
if @status
|
67
|
+
generate_status(@status.to_sym, STATUS[@status.to_sym])
|
68
|
+
else
|
69
|
+
STATUS.map do |status_type, emoji|
|
70
|
+
generate_status(status_type, emoji)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def display_outro
|
76
|
+
"\n-----"
|
77
|
+
end
|
78
|
+
|
79
|
+
def return_status_code
|
80
|
+
OverloadsRegistry.find_by(status: :out_of_date).empty? && OverloadsRegistry.find_by(status: :missing).empty?
|
81
|
+
end
|
54
82
|
end
|
55
83
|
end
|
data/lib/bonobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- armandfardeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -176,8 +176,7 @@ files:
|
|
176
176
|
homepage: https://github.com/armandfardeau/bonobo
|
177
177
|
licenses:
|
178
178
|
- MIT
|
179
|
-
metadata:
|
180
|
-
documentation_uri: https://github.com/armandfardeau/bonobo
|
179
|
+
metadata: {}
|
181
180
|
post_install_message:
|
182
181
|
rdoc_options: []
|
183
182
|
require_paths:
|