-
Notifications
You must be signed in to change notification settings - Fork 180
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
install path of gem executables; bad gem home warning #60
Conversation
.gitignore
Outdated
!lib/bin/rdoc | ||
!lib/bin/ri | ||
# Bin directory | ||
bin/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just *
should be enough
@@ -85,7 +85,7 @@ module RbConfig | |||
|
|||
if ruby_home | |||
libdir = "#{ruby_home}/lib" | |||
bindir = "#{libdir}/bin" | |||
bindir = "#{ruby_home}/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current bindir is causing me issues when testing gems, so I hope this line change goes in soon.
README.md
Outdated
@@ -84,9 +84,11 @@ which can be used to get it working. | |||
The best way to get started with TruffleRuby is via the GraalVM, which includes | |||
compatible versions of everything you need as well as TruffleRuby. | |||
|
|||
http://www.oracle.com/technetwork/oracle-labs/program-languages/ | |||
<http://www.oracle.com/technetwork/oracle-labs/program-languages/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the <
>
? It seems to make link without as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, I've confused the syntax with some other markup.
README.md
Outdated
|
||
Inside the GraalVM is a `bin/ruby` command that runs TruffleRuby. | ||
See [`doc/user/using-graalvm`](https://github.com/graalvm/truffleruby/tree/master/doc/user/using-graalvm.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See [Using GraalVM](doc/user/using-graalvm.md)
doc/user/installing-gems.md
Outdated
unset GEM_HOME GEM_PATH GEM_ROOT | ||
``` | ||
> **Note:** Ensure you have ruby managers configured properly, see | ||
[`doc/user/ruby-managers`](https://github.com/graalvm/truffleruby/blob/master/doc/user/ruby-managers.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a note, it's a critical step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the user is following the steps, he has visited the page already and configured it, therefore it was kept as note only. I don't mind either way, changing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users should not need to navigate too much to do one thing. It's also always best to be able to point to a single page and have clear prerequisites.
|
||
ruby -rbundler-workarounds -S gem install bundler -v 1.13.7 | ||
ruby -r bundler-workarounds -S gem install bundler -v 1.13.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the one argument -rlibrary
, it's more convenient to navigate between words at the command line and I believe is the most comment usage over -r library
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only simple to write, for reading I find it terrible, the word is joined with the option and there is no space for eyes to find the start of the value. I'll keep spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's not how users write it, so that's confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an assumption though, I for example write space even on command line. Since this is a documentation, the more readable option with space separation is a better option then a shortcut.
doc/user/installing-gems.md
Outdated
|
||
`bundle exec` does not need the `bundler-workarounds` loaded. | ||
|
||
ruby -S bundle exec bin/rails server | ||
|
||
Next step: [Playing Optcarrot](https://github.com/graalvm/truffleruby/blob/master/doc/user/optcarrot.md), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related to Installing Gems
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next step is not meant to imply relation but rather what to read next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These docs should be each about one thing, not reading pages ;)
doc/user/optcarrot.md
Outdated
@@ -0,0 +1,13 @@ | |||
# Playing optcarrot | |||
|
|||
Clone optcarrot repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clone +the+
doc/user/optcarrot.md
Outdated
git clone https://github.com/mame/optcarrot.git | ||
cd optcarrot | ||
|
||
You will need mplayer to be installed, then you can play Lan Master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mplayer
doc/user/optcarrot.md
Outdated
You will need mplayer to be installed, then you can play Lan Master | ||
with following command. | ||
|
||
path/to/graalvm-0.20/bin/ruby bin/optcarrot --video mplayer --input term examples/Lan_Master.nes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test it? I never tried with the upstream mame/optcarrot
.
There might be issues for input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, tested but I forgot I am on a branch, I'll have a look
doc/user/ruby-managers.md
Outdated
sure that the manager does not set environment variables `GEM_HOME`, `GEM_PATH`, | ||
and `GEM_ROOT`. The variables are picked up by truffleruby (as any other Ruby | ||
implementation would do) causing truffleruby to pickup wrong gem-home directory | ||
instead of it's own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+the+ wrong
its own
|
||
If you are using a Ruby manager like `rvm`, `rbnev`, or `chruby` make | ||
sure that the manager does not set environment variables `GEM_HOME`, `GEM_PATH`, | ||
and `GEM_ROOT`. The variables are picked up by truffleruby (as any other Ruby |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By RubyGems actually but it might easier to simplify as you did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, every ruby has rubygems by default ...
doc/user/ruby-managers.md
Outdated
It will be easier when TruffleRuby can be added to ruby managers, we are working | ||
on it. | ||
|
||
Next step: [Installing gems](https://github.com/graalvm/truffleruby/blob/master/doc/user/isntalling-gems.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All links can be relative, GitHub handles it nicely and it means it works on branches (test it with the markdown preview in the PR).
BTW, typo in the link here.
@@ -16,6 +16,27 @@ | |||
require 'rubygems' | |||
rescue LoadError | |||
else | |||
unless Gem.dir.include?(Truffle::Boot.ruby_home) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should we check the whole Gem.path
.
Otherwise RubyGems might still load gems from another Ruby.
bad_gem_home ||= Gem.dir.include?('rvm/gems') && !Gem.dir.include?('rvm/gems/truffleruby') | ||
|
||
# chruby stores gem in ~/.gem/<ruby>/<version> | ||
bad_gem_home ||= Gem.dir.include?('.gem') && !Gem.dir.include?('.gems/truffleruby') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing the logic here, how about:
our_gem_home = Gem.default_dir
bad_gem_home = dir != our_gem_home && !dir.include?('/truffleruby/')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be, but I wanted to be more precise. I would like the warning not to live for long anyway so we can revisit if it is not removed soon-ish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check is not precise though:
I think we should we check the whole
Gem.path
.
Otherwise RubyGems might still load gems from another Ruby.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. I think my check is more precise and simpler, so please use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition you are suggesting will catch any GEM_HOME change, the old one catches only different GEM_HOME pointing to a gem-home of another ruby in a ruby manager. That is the missing preciseness in the new condition I am referring too. Gem path can be anything, it cannot be easily checked that it's unintentional change and that the path belongs to other ruby. Anyway we need to only detect the common case of misconfigured a ruby manager. We ignore other changes. This will be deleted when truffleruby can be added to ruby managers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking Gem.path will show you the warning is always there,
as $HOME/.gem/ruby/2.3.0
is always added by RubyGems, unless GEM_PATH is set
And that's an actual problem as it looks through system Ruby gems if there is a system ruby of version 2.3.x or some other Ruby used that default gem home to install gem (for instance chruby would use that for MRI 2.3.x).
(For instance, bad extensions, conflicting gem versions, etc)
But probably it is less problematic or likely than a bad value for GEM_HOME, so let's merge for now.
The right fix for this default system Ruby path is changing RUBY_ENGINE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agreed, I am already working on the RUBY_ENGINE fix. Looks promising it should not take too long.
doc/user/compatibility.md
Outdated
@@ -112,7 +112,7 @@ provide the same interface as JRuby does for this functionality. | |||
|
|||
Calling Ruby code from Java is supported by the `PolyglotEngine` API of Truffle. | |||
|
|||
http://lafo.ssw.uni-linz.ac.at/javadoc/truffle/latest/com/oracle/truffle/api/vm/PolyglotEngine.html | |||
<http://lafo.ssw.uni-linz.ac.at/javadoc/truffle/latest/com/oracle/truffle/api/vm/PolyglotEngine.html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra <
doc/user/installing-gems.md
Outdated
@@ -1,37 +1,29 @@ | |||
# Installing gems | |||
|
|||
As mentioned in the | |||
[`README`](https://github.com/graalvm/truffleruby/tree/truffle-head/README.md) | |||
As mentioned in the [README](README.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
broken link, should be ../../README.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah thanks
bad_gem_home ||= Gem.dir.include?('rvm/gems') && !Gem.dir.include?('rvm/gems/truffleruby') | ||
|
||
# chruby stores gem in ~/.gem/<ruby>/<version> | ||
bad_gem_home ||= Gem.dir.include?('.gem') && !Gem.dir.include?('.gems/truffleruby') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check is not precise though:
I think we should we check the whole
Gem.path
.
Otherwise RubyGems might still load gems from another Ruby.
* dedicated ruby managers page * links to next step * rails compatibility section * add optcarrot example
…to master * commit 'b238d6939a555f31049278a70183e3edc70f2db0': Attempt to find the original file to require if a patch is loaded for a gem that hasn't been registered with the patching system.
Run minitest in CI Merge-Requested-By: chrisseaton Merge-Queue-Digest: 1dbe6365c5da7312dffc2ac8a1de063689089547368b3ef929c10b6a5cbb6926
connect #59