diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/command_tag/commands.rb | 7 | ||||
-rw-r--r-- | app/lib/command_tag/commands/account_tools.rb (renamed from app/lib/command_tag/command/account_tools.rb) | 2 | ||||
-rw-r--r-- | app/lib/command_tag/commands/footer_tools.rb (renamed from app/lib/command_tag/command/footer_tools.rb) | 2 | ||||
-rw-r--r-- | app/lib/command_tag/commands/hello_world.rb (renamed from app/lib/command_tag/command/hello_world.rb) | 2 | ||||
-rw-r--r-- | app/lib/command_tag/commands/parent_status_tools.rb (renamed from app/lib/command_tag/command/parent_status_tools.rb) | 2 | ||||
-rw-r--r-- | app/lib/command_tag/commands/status_tools.rb (renamed from app/lib/command_tag/command/status_tools.rb) | 2 | ||||
-rw-r--r-- | app/lib/command_tag/commands/text_tools.rb (renamed from app/lib/command_tag/command/text_tools.rb) | 2 | ||||
-rw-r--r-- | app/lib/command_tag/commands/variables.rb (renamed from app/lib/command_tag/command/variables.rb) | 2 |
8 files changed, 10 insertions, 11 deletions
diff --git a/app/lib/command_tag/commands.rb b/app/lib/command_tag/commands.rb index f27486427..068c8bb66 100644 --- a/app/lib/command_tag/commands.rb +++ b/app/lib/command_tag/commands.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true -Dir[File.join(__dir__, 'command', '*.rb')].sort.each { |file| require file } - module CommandTag::Commands def self.included(base) - CommandTag::Command.constants.map(&CommandTag::Command.method(:const_get)).grep(Module) do |mod| - base.include(mod) + Dir[File.join(__dir__, 'commands', '*.rb')].sort.each do |file| + require file + base.include(CommandTag::Commands.const_get(File.basename(file).gsub('.rb', '').split('_').map(&:capitalize).join)) end end end diff --git a/app/lib/command_tag/command/account_tools.rb b/app/lib/command_tag/commands/account_tools.rb index ac38f19a1..d1c652dee 100644 --- a/app/lib/command_tag/command/account_tools.rb +++ b/app/lib/command_tag/commands/account_tools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module CommandTag::Command::AccountTools +module CommandTag::Commands::AccountTools def handle_account_at_start(args) return if args[0].blank? diff --git a/app/lib/command_tag/command/footer_tools.rb b/app/lib/command_tag/commands/footer_tools.rb index 73e2f05bd..b7895d3af 100644 --- a/app/lib/command_tag/command/footer_tools.rb +++ b/app/lib/command_tag/commands/footer_tools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module CommandTag::Command::FooterTools +module CommandTag::Commands::FooterTools def handle_999_footertools_startup @status.footer = var('persist:footer:default')[0] end diff --git a/app/lib/command_tag/command/hello_world.rb b/app/lib/command_tag/commands/hello_world.rb index ab10b495b..cc770ef80 100644 --- a/app/lib/command_tag/command/hello_world.rb +++ b/app/lib/command_tag/commands/hello_world.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module CommandTag::Command::HelloWorld +module CommandTag::Commands::HelloWorld def handle_helloworld_startup @vars['hello_world'] = ['Hello, world!'] end diff --git a/app/lib/command_tag/command/parent_status_tools.rb b/app/lib/command_tag/commands/parent_status_tools.rb index 2fdee2fb8..edaa21b6a 100644 --- a/app/lib/command_tag/command/parent_status_tools.rb +++ b/app/lib/command_tag/commands/parent_status_tools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module CommandTag::Command::ParentStatusTools +module CommandTag::Commands::ParentStatusTools def handle_publish_once_at_end(_) is_blank = status_text_blank? return PublishStatusService.new.call(@status) if @parent.blank? || !is_blank diff --git a/app/lib/command_tag/command/status_tools.rb b/app/lib/command_tag/commands/status_tools.rb index b2ddca422..5b9f52234 100644 --- a/app/lib/command_tag/command/status_tools.rb +++ b/app/lib/command_tag/commands/status_tools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module CommandTag::Command::StatusTools +module CommandTag::Commands::StatusTools def handle_boost_once_at_start(args) return unless @parent.present? && StatusPolicy.new(@account, @parent).reblog? diff --git a/app/lib/command_tag/command/text_tools.rb b/app/lib/command_tag/commands/text_tools.rb index 6b37b66b7..1a0d53480 100644 --- a/app/lib/command_tag/command/text_tools.rb +++ b/app/lib/command_tag/commands/text_tools.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module CommandTag::Command::TextTools +module CommandTag::Commands::TextTools def handle_code_at_start(args) return if args.count < 2 diff --git a/app/lib/command_tag/command/variables.rb b/app/lib/command_tag/commands/variables.rb index 6ba32ea41..36ba0abd3 100644 --- a/app/lib/command_tag/command/variables.rb +++ b/app/lib/command_tag/commands/variables.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module CommandTag::Command::Variables +module CommandTag::Commands::Variables def handle_000_variables_startup @vars.merge!(persistent_vars_from(@account.metadata.fields)) if @account.metadata.present? end |