Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Requires configuration even when not in use? #33

Open
jordansissel opened this issue Nov 15, 2015 · 4 comments
Open

Requires configuration even when not in use? #33

jordansissel opened this issue Nov 15, 2015 · 4 comments

Comments

@jordansissel
Copy link

% lita
[2015-11-15 20:28:13 UTC] FATAL: Configuration attribute "jid" is required for "hipchat"
adapter.

My Gemfile.lock specifies lita-hipchat, but my lita_config.rb does not. For debugging, I use the shell adapter.

% cat lita_config.rb
Lita.configure do |config|
  config.robot.name = "Fancy Pants"
  config.robot.locale = :en
  config.robot.log_level = :info
  config.robot.adapter = :shell
end

The above config seems to insist that it be given Hipchat credentials. I think this is new behavior since this config used to not require hipchat credentials. I'm open to writing the fix but wanted to file it first in case anyone had any thoughts on it.

As a workaround, I delete lita-hipchat from my Gemfile/gemspec and rerun bundle install to switch back to the Shell adapter during development.

@jimmycuadra
Copy link
Collaborator

The reason this happens is that requireing the adapter runs the code that adds its configuration object to the mix. There isn't a mechanism right now for the concept of "don't load this plugin's configuration because I'm not using it in the current environment." I agree that this is annoying and would be interested in any ideas you have about how it could be improved.

@jordansissel
Copy link
Author

I don't think I'm requiring the adapter in my own code. I'll dig into this when I can and see what can be done to improve things for me.

@jimmycuadra
Copy link
Collaborator

I missed an obvious point in my last comment: Lita calls Bundler.require when it starts (to make "just add the plugin to your Gemfile to install it" approach work) which is why the config object for a plugin gets added even if you're not using it in a given environment. You can use Bundler groups to only activate the adapter you want in the given environment. I think that should get you the behavior you want here.

@jordansissel
Copy link
Author

Ahh that helps clarify things. I will try using bundler groups. Thanks!

On Friday, January 8, 2016, Jimmy Cuadra [email protected] wrote:

I missed an obvious point in my last comment: Lita calls Bundler.require
when it starts (to make "just add the plugin to your Gemfile to install it"
approach work) which is why the config object for a plugin gets added even
if you're not using it in a given environment. You can use Bundler groups
to only activate the adapter you want in the given environment. I think
that should get you the behavior you want here.


Reply to this email directly or view it on GitHub
#33 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants