Browse Source

clarify TwitterConcern gem_dependency_check

Andrew Cantino 10 years ago
parent
commit
3501d0b805
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app/concerns/twitter_concern.rb

+ 3 - 3
app/concerns/twitter_concern.rb

@@ -7,7 +7,7 @@ module TwitterConcern
     validate :validate_twitter_options
     valid_oauth_providers :twitter
 
-    gem_dependency_check { defined?(Twitter) && Devise.omniauth_providers.include?(:twitter) }
+    gem_dependency_check { defined?(Twitter) && Devise.omniauth_providers.include?(:twitter) && ENV['TWITTER_OAUTH_KEY'].present? && ENV['TWITTER_OAUTH_SECRET'].present? }
   end
 
   def validate_twitter_options
@@ -46,9 +46,9 @@ module TwitterConcern
 
   module ClassMethods
     def twitter_dependencies_missing
-      if defined?(Twitter)
+      if ENV['TWITTER_OAUTH_KEY'].blank? || ENV['TWITTER_OAUTH_SECRET'].blank?
         "## Set TWITTER_OAUTH_KEY and TWITTER_OAUTH_SECRET in your environment to use Twitter Agents."
-      else
+      elsif !defined?(Twitter) || !Devise.omniauth_providers.include?(:twitter)
         "## Include the `twitter`, `omniauth-twitter`, and `cantino-twitter-stream` gems in your Gemfile to use Twitter Agents."
       end
     end