Skip to content

Commit 393298c

Browse files
committed
fix: misc fixes
1 parent e693b67 commit 393298c

File tree

16 files changed

+416
-309
lines changed

16 files changed

+416
-309
lines changed

.rubocop.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@ AllCops:
22
NewCops: enable
33
ActiveSupportExtensionsEnabled: true
44

5-
Layout/LineLength:
6-
Max: 80
5+
Layout/ArgumentAlignment:
6+
EnforcedStyle: with_fixed_indentation
77

88
Layout/EndAlignment:
99
EnforcedStyleAlignWith: variable
1010

11+
Layout/FirstArgumentIndentation:
12+
EnforcedStyle: consistent
13+
14+
Layout/FirstArrayElementIndentation:
15+
EnforcedStyle: consistent
16+
17+
Layout/LineLength:
18+
Max: 80
19+
1120
Layout/MultilineMethodCallIndentation:
1221
EnforcedStyle: indented
1322

Gemfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ gem 'rake'
1010
# Base
1111
gem 'discordrb', github: 'shardlab/discordrb', branch: 'main'
1212
# dirty hack to fix bundix problems
13-
gem 'discordrb-webhooks',
14-
github: 'anna328p/discordrb',
15-
branch: 'main'
13+
gem 'discordrb-webhooks', github: 'anna328p/discordrb', branch: 'main'
1614

1715
gem 'rbnacl'
1816

@@ -90,4 +88,4 @@ group :development do
9088
end
9189

9290
# Colors
93-
gem 'numo-narray'
91+
gem 'matrix'

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ GEM
137137
loofah (2.22.0)
138138
crass (~> 1.0.2)
139139
nokogiri (>= 1.12.0)
140+
matrix (0.4.2)
140141
mediawiki_api (0.8.1)
141142
faraday (~> 1)
142143
faraday-cookie_jar
@@ -154,7 +155,6 @@ GEM
154155
nokogiri (1.15.5)
155156
mini_portile2 (~> 2.8.2)
156157
racc (~> 1.4)
157-
numo-narray (0.9.2.1)
158158
open_uri_redirections (0.2.1)
159159
opus-ruby (1.0.1)
160160
ffi
@@ -183,7 +183,7 @@ GEM
183183
ffi (~> 1.0)
184184
rbnacl (7.1.1)
185185
ffi
186-
rbs (3.3.2)
186+
rbs (3.4.0)
187187
abbrev
188188
regexp_parser (2.8.3)
189189
reline (0.4.1)
@@ -250,7 +250,7 @@ GEM
250250
thor (~> 1.0)
251251
tilt (~> 2.0)
252252
yard (~> 0.9, >= 0.9.24)
253-
sorbet-runtime (0.5.11156)
253+
sorbet-runtime (0.5.11164)
254254
sqlite3 (1.6.9)
255255
mini_portile2 (~> 2.8.0)
256256
steep (1.6.0)
@@ -286,8 +286,8 @@ GEM
286286
tty-cursor (~> 0.7)
287287
tty-screen (~> 0.8)
288288
unicode-display_width (>= 1.6, < 3.0)
289-
tty-screen (0.8.1)
290-
typeprof (0.21.8)
289+
tty-screen (0.8.2)
290+
typeprof (0.21.9)
291291
rbs (>= 1.8.1)
292292
typhoeus (1.4.1)
293293
ethon (>= 0.9.0)
@@ -319,10 +319,10 @@ DEPENDENCIES
319319
jsi
320320
kramdown
321321
kramdown-parser-gfm
322+
matrix
322323
mediawiki_api
323324
narray
324325
nokogiri
325-
numo-narray
326326
open_uri_redirections
327327
paint
328328
parser

bin/console

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require_relative '../lib/qbot'
5+
6+
QBot.init_log
7+
QBot.parse_options(ARGV)
8+
QBot.init_config
9+
QBot::Database.init_db
10+
11+
binding.irb

flake.nix

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ rec {
2929
in
3030
genAttrs systems.flakeExposed;
3131

32-
qbotPkgArgs = pkgs: rec {
32+
mkQBotArgs = pkgs: rec {
3333
ruby = pkgs.ruby_3_2;
34-
bundler = pkgs.bundler.override { inherit ruby; };
35-
bundix = pkgs.bundix.override { inherit bundler; };
3634

3735
# TODO: remove once nixpkgs#272969 is merged
3836
rustc = rust-overlay.packages.${pkgs.system}.rust;
@@ -47,7 +45,14 @@ rec {
4745
config.allowUnfree = true;
4846
};
4947

50-
qbot = pkgs.callPackage ./. (qbotPkgArgs pkgs);
48+
qbotArgs = mkQBotArgs pkgs;
49+
50+
inherit (qbotArgs) ruby;
51+
52+
bundler = pkgs.bundler.override { inherit ruby; };
53+
bundix = pkgs.bundix.override { inherit bundler; };
54+
55+
qbot = pkgs.callPackage ./. qbotArgs;
5156
};
5257

5358
# withCommon : (Dict Any -> Dict Any) -> Dict (Dict Any)
@@ -56,14 +61,14 @@ rec {
5661
in {
5762
overlays = rec {
5863
qbot = final: prev: {
59-
qbot = final.callPackage ./. (qbotPkgArgs final);
64+
qbot = final.callPackage ./. (mkQBotArgs final);
6065
};
6166

6267
default = qbot;
6368
};
6469

6570
nixosModules = rec {
66-
qbot = import ./module.nix { inherit nixConfig; };
71+
qbot = import nix/module.nix { inherit nixConfig; };
6772
default = qbot;
6873
};
6974

@@ -83,14 +88,12 @@ rec {
8388
});
8489

8590
apps = withCommon (env: let
86-
inherit (env) pkgs;
87-
88-
pkgArgs = qbotPkgArgs pkgs;
91+
inherit (env) pkgs bundler bundix;
8992

9093
update-deps = pkgs.writeShellApplication {
9194
name = "update-deps";
9295

93-
runtimeInputs = [ pkgArgs.bundler pkgArgs.bundix ];
96+
runtimeInputs = [ bundler bundix ];
9497

9598
text = ''
9699
rm -f Gemfile.lock

gemset.nix

Lines changed: 18 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/qbot.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
require_relative 'qbot/db_config'
1919
require_relative 'qbot/db'
2020
require_relative 'qbot/jobs'
21-
require_relative 'qbot/index_models'
2221
require_relative 'qbot/i18n'
2322
require_relative 'qbot/helpers'
2423
require_relative 'qbot/colorlib'

lib/qbot/aur.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
url = "https://aur.archlinux.org/packages-meta-ext-v1.json.gz"
2+

lib/qbot/db/concerns/configurable/option_types.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ def initialize(format: nil)
119119
end
120120

121121
def format_value(value)
122-
return t('types.empty') unless value
123-
124122
if @format
125123
Kernel.format(FORMATS[@format], value)
126124
else

modules/colors.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,12 @@ def self.create_color_roles(server, lightness, radius, count, &)
295295
rescue ActiveRecord::RecordNotFound
296296
embed t('colors.extra-roles.del.not-found', role.mention)
297297
end
298+
end
299+
# rubocop: enable Metrics/ModuleLength
300+
301+
## Event container for the Colors module
302+
module ColorsEvents
303+
extend Discordrb::EventContainer
298304

299305
# Color roles on join
300306

@@ -341,4 +347,7 @@ def give_random_color(server, user)
341347
nil
342348
end
343349
end
344-
# rubocop: enable Metrics/ModuleLength
350+
351+
module Colors
352+
include! ColorsEvents
353+
end

0 commit comments

Comments
 (0)