首页 > 解决方案 > Debug / Execute Discourse plugin from command line

问题描述

I'm programming a new plugin in discourse and need to output some information to know if I'm in the right way.

There is some way (With rake or something) to manually run the plugin and see what happen?

Sidekiq don't show any output...

Thanks!

Edit 1 The plugin force some users to watch categories... And run each 1 hour. I can see it in Sidekiq.

module ::WatchCategory

  def self.watch_category!
    //The logic, foreach, etc...
  end
end

after_initialize do
  module ::WatchCategory
    class WatchCategoryJob < ::Jobs::Scheduled
      every 1.hours

      def execute(args)
        WatchCategory.watch_category!
      end
    end
  end
end

标签: ruby-on-railsrubypluginsdiscourse

解决方案


我从未使用过 discourse,但它看起来像一个 rails 应用程序,因此您应该能够通过 rails c 启动 rails 控制台。然后您应该能够运行您的代码,例如“WatchCategory.watch_category!”


推荐阅读