jkrall / analytical

Gem for managing multiple analytics services in your rails app.
MIT License
380 stars 92 forks source link

Added configuration support for dev, test and production environments #17

Closed dblock closed 13 years ago

dblock commented 13 years ago

We started using Analytical and found its configuration quite odd. It requires us to stub rails environment to test and doesn't support other environments such as development or staging. Then, it feels that the configuration should be saying what analytics to use - it feels redundant to specify that in code and in the config file. This is a change that breaks some compatibility with the previous versions, although I tried to preserve as much of it as possible. It does align the gem with how others do configuration. I think it's worth it.

jkrall commented 13 years ago

This is great stuff. I totally agree re: configuration... this is something I've been wanting to do for a while, and just haven't had time to take on.

Since this is sortof a breaking change, I'm thinking of rolling this release into a 1.0 version, and maybe putting some sort of deprecation notice into the next 0.9 release. Not exactly sure how to handle it, but I agree that this is where we should take things.

Might take me a few days to review and merge this in, FYI. Thanks for the pull request!

On Wed, Jun 29, 2011 at 7:24 PM, dblock < reply@reply.github.com>wrote:

We started using Analytical and found its configuration quite odd. It requires us to stub rails environment to test and doesn't support other environments such as development or staging. Then, it feels that the configuration should be saying what analytics to use - it feels redundant to specify that in code and in the config file. This is a change that breaks some compatibility with the previous versions, although I tried to preserve as much of it as possible. It does align the gem with how others do configuration. I think it's worth it.

  • Upgraded to Rails 3.0.9, RSpec 2.x. The tools upgrade is harmless but looks a bit closer to a real rails application and removes the need for a stub that replaces the location of the config file, ie. less hackery.
  • Configuration file allows for environments. You can still keep the old style configuration file for all environments, but now you can do the following.

    test: google: key: google_12345 clicky: key: clicky_12345 kiss_metrics: key: kiss_metrics_12345 chartbeat: key: chartbeat_12345 domain: your.domain.com

    production: google: key: UA_1234

    development:

  • The list of analytics is now either the list configured or the list explicitly specified (as before).
  • Made disable_if optional, so now it's not trying to disable itself per environment, but still allows you to disable analytics on a controller function.
  • Removed development_modules since now we have the stuff above.

Reply to this email directly or view it on GitHub: https://github.com/jkrall/analytical/pull/17

dblock commented 13 years ago

Added a fix from @gib, thanks!

dblock commented 13 years ago

Merged latest changes.