Code Monkey home page Code Monkey logo

Comments (7)

matthewd avatar matthewd commented on May 18, 2024 1

Yeah, activating Gel (the eval) puts Gel's binstubs on your path.

If you don't want to use Gel by default, you may not want that in your shell config.

It could be interesting to make explicit bundle exec switch to Bundler even when Gel's been activated, but I'm not sure how feasible it would be, so for now I'll go with "PRs welcome" on that one 😅

from gel.

matthewd avatar matthewd commented on May 18, 2024

bundle exec rake style

To clarify, have you aliased bundle to gel (not recommended), or are you literally running Bundler here? Do you intend to be?

from gel.

vfonic avatar vfonic commented on May 18, 2024

I did alias bundle to gel 😇, but removed the alias and tried literally running Bundler, but that also failed.

So the above error is when running bundler in zshell. I removed a bundler zsh plugin. The bundler above is "pure" bundler (now 1.17.2 if that matters).

$ which bundler
/Users/viktor/.rvm/gems/ruby-2.6.3/bin/bundler
$ bundler --version
Traceback (most recent call last):
	3: from /Users/viktor/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
	2: from /Users/viktor/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
	1: from /Users/viktor/.rvm/gems/ruby-2.6.3/bin/bundler:23:in `<main>'
/usr/local/Cellar/gel/0.2.0/lib/gel/compatibility/rubygems.rb:150:in `activate_bin_path': Unknown gem "bundler" (RuntimeError)
$ gem install bundler --version 1.17.2
Successfully installed bundler-1.17.2
1 gem installed

$ which bundler
/Users/viktor/.rvm/gems/ruby-2.6.3/bin/bundler
$ bundler --version
Traceback (most recent call last):
	3: from /Users/viktor/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
	2: from /Users/viktor/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
	1: from /Users/viktor/.rvm/gems/ruby-2.6.3/bin/bundler:23:in `<main>'
/usr/local/Cellar/gel/0.2.0/lib/gel/compatibility/rubygems.rb:150:in `activate_bin_path': Unknown gem "bundler" (RuntimeError)


# comment-out `eval "$(gel shell-setup)"` in `.zshrc`

$ which bundler
/Users/viktor/.rvm/gems/ruby-2.6.3/bin/bundler
$ bundler --version
Bundler version 1.17.2
$ gem install bundler --version 1.17.2
Successfully installed bundler-1.17.2
1 gem installed

from gel.

matthewd avatar matthewd commented on May 18, 2024

Okay, it looks like we're touching on a few separate issues here...

The last one is the easiest to fix -- there's a special case for bundle, but not bundler:

if gem_name == "bundler" && bin_name == "bundle"
# Extra-special case: this is the bundler binstub, we need to
# re-exec to hand over.

(Maybe it should only check the gem_name, and treat any executable belonging to Bundler as being special-cased?)


Next up is the fact you're using bundle exec to run a Gel-generated binstub: that will work, but it won't use Bundler. Because Bundler's the default, we assume any explicit use of Gel should take priority, whether that's via gel exec, or the use of a Gel binstub. (If you didn't intend to use Bundler, note that as long as you have Gel binstubs in place, just plain rake style will do what you want -- no need for any exec at all.)


Finally, the exception you're seeing: our Gem::Dependency#requirement is returning an array, when it apparently should be a Gem::Requirement. That probably needs to be fixed here:

Gem::Dependency.new(name, pairs.map { |op, ver| "#{op} #{ver}" }, :runtime)

from gel.

vfonic avatar vfonic commented on May 18, 2024

Next up is the fact you're using bundle exec to run a Gel-generated binstub

Hmmm, maybe I'm unintentionally using Gel-generated binstub. I know I have created binstubs in my rails app before I installed Gel. I then installed and setup Gel as per README:
brew install gel; echo 'eval "$(gel shell-setup)"' >> .zshrc # more-less

...restarted shell session and ran bundle exec rake <whatevs>.

Not sure if this helps:

$ cat bin/bundle
#!/usr/bin/env ruby
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')

from gel.

vfonic avatar vfonic commented on May 18, 2024

I haven't looked at Gel's source code, so I'm speaking from a "blackbox user" perspective. :)

I'd think that the tool would work either:

  1. by being an alias to bundle/bundler, kind of what hub is to git.
  2. or, it would be a tool you'd explicitly use instead of bundler, kind of what yarn is to npm

In the case 1), I'd expect to be able to do alias bundle=gel.
In the case 2), I'd expect that, if I never explicitly call gel <smth>, it would not use the tool.

I assume that's exactly how the tool works if I remove the Gel's shell setup?

Maybe this should be noted in the README?

I'm gonna give it a shot using it explicitly.

Thanks!

from gel.

matthewd avatar matthewd commented on May 18, 2024

I'm not sure how much more strongly we can emphasise that Gel will do things if you tell it to.. the README already says "Then, either activate Gel in your current shell: [..] Or add it to your .bashrc or .zshrc to enable it everywhere: [..]"

In the case 2), I'd expect that, if I never explicitly call gel <smth>, it would not use the tool.

This breaks down because we're providing a replacement for RubyGems too, and consequently we have to supply binstubs. If you run rake (which is notably not e.g. gem exec rake), it has to be loaded by either RubyGems or Gel -- likewise if you do require "nokogiri" inside a plain Ruby script. The shell setup is what makes those happen.

from gel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.