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

Issue 109 - remove load path #113

Merged
merged 11 commits into from
Mar 24, 2016
Merged

Issue 109 - remove load path #113

merged 11 commits into from
Mar 24, 2016

Conversation

LuckDragon82
Copy link
Contributor

Problem

Some rails configurations were experiencing problems properly loading files as referenced issue 109

Solution

Remove loadpath from gemspec. Switched to using require_relative in files.

@aoberoi
Copy link
Contributor

aoberoi commented Mar 17, 2016

@LuckDragon82 i think i might have solved the blocking issue (#114), please pull from latest master 😄

@aoberoi
Copy link
Contributor

aoberoi commented Mar 17, 2016

sweet, looks like we are unblocked and getting real errors that actually relate to loading:

[!] There was an error parsing Gemfile: There was a LoadError while loading opentok.gemspec:
cannot infer basepath from
/home/travis/build/opentok/Opentok-Ruby-SDK/opentok.gemspec:2:in `require_relative'
Does it try to require a relative path? That's been removed in Ruby 1.9.. Bundler cannot continue.

@LuckDragon82
Copy link
Contributor Author

so close 1.9.3 Does not seem to like require_relative. Any thoughts why this would only fail in 1.9.3?

@LuckDragon82
Copy link
Contributor Author

Bundler in 1.9.3 didn't like require_relative. I have no idea why. using require with path expansion worked for that one file.

@aoberoi
Copy link
Contributor

aoberoi commented Mar 18, 2016

@LuckDragon82 awesome! Let's go one step further to see if this will fix #109. Can you build the gem locally, and in the Rails project where you are having the issue, set your Gemfike to reference your locally built gem for the opentok dependency, and let's see if this fixes the issue! For reference, which version of Ruby is that project running in?

@LuckDragon82
Copy link
Contributor Author

We are using ruby 2.2.3 I'll see if I can get it to work using the local gem.

@LuckDragon82
Copy link
Contributor Author

before I was copying and pasting and that worked. Now I set the path in my gemfile, and that works as well! Rails console still works. Everything seems pretty good!

@LuckDragon82
Copy link
Contributor Author

Any news on if this will make it in? It would be helpful for a project I am working on.

@aoberoi
Copy link
Contributor

aoberoi commented Mar 24, 2016

@LuckDragon82 sorry for the delay, just got a chance to look into this again.

this might be a dumb question at this point since you've basically proved that your current approach works, but i figured i'd ask because we have a chance to get it right and follow best practice now.

did you try just using require(path) such that path is relative to the lib directory? this is mentioned as option 4 under "Conventions and Recommendations" in this article, its also the first way this article recommends accomplishing it. the only thing i'm not clear on is which versions of ruby thats expected to work on.

@LuckDragon82
Copy link
Contributor Author

I feel like I tried that and it didn't work, maybe that was back when travis had that bug. Anyhow it works, and it looks a lot better too!

@LuckDragon82
Copy link
Contributor Author

Scratch that its not working. I forgot to restart my server.

@LuckDragon82
Copy link
Contributor Author

LoadError: cannot load such file -- ./lib/opentok/opentok
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/opentok-2.3.3/lib/opentok.rb:1:in `<top (required)>'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
/Users/luckdragon/.rbenv/versions/2.2.3/gemsets/vt-online-platform-global/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
/Users/luckdragon/Development/vt-online-platform/config/application.rb:7:in `<top (required)>'
/Users/luckdragon/Development/vt-online-platform/Rakefile:4:in `<top (required)>'

@aoberoi
Copy link
Contributor

aoberoi commented Mar 24, 2016

i have a slightly different solution in mind. can you take a look at https://github.com/opentok/Opentok-Ruby-SDK/tree/issue-109, where i added one more commit on top of your changes, and if you try and it works in your Rails app, then can update your PR with that change? let me know if that makes sense, or if you have any questions.

@LuckDragon82
Copy link
Contributor Author

Guess I still have a lot to learn about load paths. That did the trick. Moving hash extensions was the ticket I guess. I wonder why it won't load it if its not in there... Thank you.

@aoberoi
Copy link
Contributor

aoberoi commented Mar 24, 2016

haha to be honest, i'm no expert. i benefitted from seeing what you tried first, for sure. i'm glad we both learned something though!

@aoberoi aoberoi merged commit efa4c06 into opentok:master Mar 24, 2016
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.

2 participants