Adds validation for Tumblr class definition

Dean Putney 10 anos atrás
pai
commit
5489f80cb6
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      app/models/agents/tumblr_publish_agent.rb

+ 6 - 0
app/models/agents/tumblr_publish_agent.rb

@@ -7,6 +7,8 @@ module Agents
7 7
     cannot_be_scheduled!
8 8
 
9 9
     description <<-MD
10
+      #{'## Include `tumblr_client` and `omniauth-tumblr` in your Gemfile to use this Agent!' if dependencies_missing?}
11
+
10 12
       The TumblrPublishAgent publishes Tumblr posts from the events it receives.
11 13
 
12 14
       To be able to use this Agent you need to authenticate with Tumblr in the [Services](/services) section first.
@@ -55,6 +57,10 @@ module Agents
55 57
       Set `expected_update_period_in_days` to the maximum amount of time that you'd expect to pass between Events being created by this Agent.
56 58
     MD
57 59
 
60
+    def gem_dependency_check
61
+      defined?(Tumblr)
62
+    end
63
+
58 64
     def validate_options
59 65
       errors.add(:base, "expected_update_period_in_days is required") unless options['expected_update_period_in_days'].present?
60 66
     end