Skip to content

Commit

Permalink
fixed optional dependency loading
Browse files Browse the repository at this point in the history
  • Loading branch information
pboling committed Nov 6, 2014
1 parent 074f016 commit d3cfc5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rack/insight/config.rb
@@ -1,5 +1,9 @@
require 'logger' # Require the standard Ruby Logger
require 'redis' rescue nil
begin
require 'redis'
rescue LoadError
warn "Could not load redis ruby gem. Some features are disabled."
end

module Rack::Insight
class Config
Expand Down

2 comments on commit d3cfc5a

@garethrees
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to do this?

Every time I run a rails command I get this message, which is unnecessary.

Its also making a few of our specs fail:

Failure/Error: r.out.should == ""
       expected: ""
            got: "Could not load redis ruby gem. Some features are disabled.\n" (using ==)
       Diff:
       @@ -1 +1,2 @@
       +Could not load redis ruby gem. Some features are disabled.

@pboling
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there is a much better way. For now just removing the warn should be fine.

Please sign in to comment.