-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
プラグイン構成要素別に基底モジュールを作成・整理 #154
Conversation
Util::NoticeOnEachChannel#notice_on_each_channel メソッドに相当する機能を、IrcPlugin#send_notice メソッドに統合した。 これで、NOTICE コマンド関連の全てのメソッドは、IrcPlugin#send_notice メソッドだけを呼び出せば良いようになった。
* case を使うときに Object#class メソッドを使わないようにした * param == Klass を、param.kind_of?(Klass) にした
各プラグインのアダプタークラスで ConfigurableAdapter モジュールを MIX-IN する必要がなくなった。
* lib/rgrb/plugin/cre_twitter_citation/generator.rb * lib/rgrb/plugin/random_generator/generator.rb * lib/rgrb/plugin/server_connection_report/mail_generator.rb * lib/rgrb/plugin/trpg/detatoko/generator.rb
テストのために毎回無駄なインスタンス化を行なっている
…struct-plugin-configs アダプターの設定を渡すオブジェクトを Hash から Struct に変更
…namespace-and-path モジュール本体の名前空間・ファイルパスを変更
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全体を確認しました。各問題が解決されたので、大丈夫だと思います。
lib/rgrb/plugin/bcdice/generator.rb
Outdated
super | ||
|
||
@version_and_commit_id = get_version_and_commit_id | ||
logger.warn("BCDice を読み込みました: #{bcdice_version}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
各問題を解決したので大丈夫だと思っていましたが、テストを実行するとここの logger
が nil
になっているためにエラーとなるようです(initialize
前に logger
を設定できないため)。このタイミングでのログ記録はなかなか難しそうです…
aa2bb0a
to
d3f88da
Compare
…module_fix_bcdice_test-init_instance_var BCDice: コンストラクタでBCDiceを用意する
…fix_bcdice_test Bcdice: テストに失敗するようになったのを修正
configurable というよりも plugin_base/* を対象とするテストスクリプトになった
…rename-spec spec ファイルの名前を変更
あとは #155 (comment) の内容で一回PR作ります。それがうまく動いたらこれをマージして、続いて #155 のリトライができそうです。 |
…rename-spec fix #165 : SPEC ファイルの名前の誤った変更を修正
…default_logger ジェネレータに渡すロガー関連の処理の簡略化
基底モジュールには `logger_for_generator` が存在せず、テストでエラーが 発生するため、IrcAdapter、DiscordAdapterといった具体的なモジュールの テストに変える。
…fix_plugin_base_spec plugin_base_spec: IRC、Discordアダプタのテストに変更する
いろいろありましたが、#168 でテストが通ったので、ここでマージします。 |
よろしくお願いします。 |
fix #133, #75
機能的にひと段落したので、このあたりで master にマージしたいと思います。
プラグイン構成要素であるアダプタ(IRC用・Discord用)とジェネレータそれぞれのための、基底クラス的なモジュールを作成しました。
また、既存のプラグインも、今回作成した基底モジュールを使うように変更しました。
作成した基底モジュールは以下の通りです。
同時に、issue #132 を解決しています。
プラグインアダプタに与える設定に、起動時に指定される設定 ID を追加したうえで、設定を一つの構造体にまとめました。