Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands from works when namespaced #208

Closed
wants to merge 2 commits into from

Conversation

davetron5000
Copy link
Owner

A test for #201 and a more general fix. Not sure if this is what I want to do

@@ -30,12 +30,13 @@ module App
# # loads *.rb files from the user's home dir - great and an extension/plugin mechanism
# commands_from File.join(ENV["HOME"],".my_app","plugins")
def commands_from(path)
b = GLI::App.send(:binding)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Unfortunately, require at any level of scope puts the code in global scope, meaning that if a GLI app wraps itself in a namespace, everything loaded via commands_from doesn't work.

The solution here is to grab the binding from GLI::App (where all the DSL commands are defined) and then eval the external commands. Yikes, I know.

@davetron5000
Copy link
Owner Author

old

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

Successfully merging this pull request may close these issues.

None yet

2 participants