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

How do you load gems? #62

Open
NigelThorne opened this issue May 21, 2017 · 2 comments
Open

How do you load gems? #62

NigelThorne opened this issue May 21, 2017 · 2 comments

Comments

@NigelThorne
Copy link
Contributor

NigelThorne commented May 21, 2017

I want a plugin to use 'parslet'.

I have something like this...

class AutoBuildPlugin
  include Purugin::Plugin, Purugin::Colors
  description 'AutoBuild', 0.1
  gem "parslet"


  def on_enable
    require 'parslet'
    #...
  end
end

I get the following error on the server...

[16:41:38 INFO]: [AutoBuild] version 0.1 DISABLED
[16:41:38 INFO]: unable to load gem: parslet
[16:41:38 ERROR]: Error occurred (in the plugin loader) while enabling AutoBuild v0.1 (Is it up to date?)
org.jruby.exceptions.RaiseException: (LoadError) Could not find 'parslet' (>= 0) among 5 total gem(s)
Checked in 'GEM_PATH=/root/.gem/jruby/1.9:file:/ssd/var/stipedata/servers/nigel%20mct%201/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/META-INF/jruby.home/lib/
ruby/gems/shared:plugins/PuruginPlugin/gems', execute `gem env` for more information
at RUBY.to_specs(/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb
:315) ~[?:?]
at RUBY.to_spec(/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:
324) ~[?:?]
at RUBY.gem(/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_ge
m.rb:64) ~[?:?]
at RUBY.process_gems(file:/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/purugin/plugin.rb:204) ~[?:?]
at org.jruby.RubyHash.each(org/jruby/RubyHash.java:1341) ~[purugin-0.8.0-bukkit-1.7.9-R0.2.jar:?]
at RUBY.process_gems(file:/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/purugin/plugin.rb:196) ~[?:?]
at RUBY.onEnable(file:/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/purugin/plugin.rb:139) ~[?:?]
at AutoBuildPlugin_582808228.onEnable(AutoBuildPlugin_582808228.gen:13) ~[?:?]
at RUBY.enable_plugin(file:/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/purugin/change_listener.rb:55) ~[?:?]
at RUBY.restart_plugin(file:/ssd/var/stipedata/servers/nigel mct 1/stipe_user_9665513/plugins/purugin-0.8.0-bukkit-1.7.9-R0.2.jar!/purugin/change_listener.rb:65) ~[?:?]

The failed load reports having plugins/PuruginPlugin/gems in the GEM_HOME path.
I tried uploading the parslet gem to that folder... creating:

/plugins/PuruginPlugin/gems/parslet-1.8.0

This didn't help.

I tried adding ENV["GEM_HOME"] = "./gems" to the plugin before the require... no effect.

@NigelThorne NigelThorne changed the title How doy ou load gems? How do you load gems? May 21, 2017
@NigelThorne
Copy link
Contributor Author

Some success...

gem install -i PuruginPlugin/gems parslet

downloads the gem and puts it in the correct folder

Upload this to my server... and all is good.
(well I had to adjust the gem to work on jruby... but other than that....)

@NigelThorne
Copy link
Contributor Author

I see there is code to automatically install the gem if it's missing... but this isn't working. I think it's to do with 'gem' not being in the path on the hosted server I am using. So the call to system ("gem install ..." is failing.

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

No branches or pull requests

1 participant