Code Monkey home page Code Monkey logo

Comments (7)

monfresh avatar monfresh commented on July 18, 2024 1

Right, I'm used to chruby, and I have minor versions in my ~/.gem/ruby folder. But asdf behaves differently. Out of curiosity, I switched to asdf (which my Ruby on Mac product makes super easy; shameless plug), and I was not able to reproduce your issue. Here's what I did:

rom config set manager asdf
rom install ruby 3.2.1
cd ~/projects
mkdir rails-test
cd rails-test
rails new .

This used 3.2.3 by default, so then I updated the ~/.ruby-version and Gemfile to point to Ruby 3.2.1, and then:

bundle install
bundle add rspec-core

command -v rspec
/Users/moncefb/.asdf/shims/rspec

bundle exec rspec
No examples found.

Finished in 0.00025 seconds (files took 0.20698 seconds to load)
0 examples, 0 failures

bundle info rspec-core | grep Path
Path: /Users/moncefb/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/rspec-core-3.12.2

So, it sounds like something in your dev setup is putting the gem path ~/.gem/ruby before the asdf path.
When I run gem env, I get this order:

- GEM PATHS:
     - /Users/moncefb/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0
     - /Users/moncefb/.gem/ruby/3.2.0

and the installation directory also points to asdf:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.5.5
  - RUBY VERSION: 3.2.1 (2023-02-08 patchlevel 31) [arm64-darwin23]
  - INSTALLATION DIRECTORY: /Users/moncefb/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0

Here's what I would try:

• Check your .zshrc, .zprofile, .zlogin for anything that might affect your PATH
• Update to the latest bundler and Rubygems
• Backup and remove (or temporarily rename) your ~/.bundle/config

from asdf-ruby.

monfresh avatar monfresh commented on July 18, 2024

This seems to be the issue:

% bundle info rspec-core | grep Path
Path: /Users/jed/.gem/ruby/3.2.0/gems/rspec-core-3.12.2

It looks like you have rspec-core installed in 3.2.0, but not in 3.2.1. Are you sure your project's .ruby-version and Gemfile are specifying 3.2.1? Perhaps you haven't yet run bundle install while using Ruby 3.2.1?

from asdf-ruby.

jedschneider avatar jedschneider commented on July 18, 2024

Thank you for the quick reply.

I thought similar at first, but it was brought to my attention that this expected behavior because 3.2 is the ABI version for 3.2.1? That seems logical to me, but I don't know how to verify that easily. Some other supporting evidence:

I generated a binstub with bundler bundle binstub rspec and then rspec was able to be run with the binstub.

I only have one ruby installed

bundle install ran cleanly and should have installed that gem to that directory but my .gem dir contains no minor versions:

% ls /Users/jed/.gem/ruby/
2.6.0	3.2.0	3.3.0

.tool_versions

terraform 1.3.7
python 3.10.11
ruby 3.2.1

head of Gemfile

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "~> 3.2.1"

Gemfile.lock exerts.

PLATFORMS
  arm64-darwin-21
  ruby
  x86_64-linux

RUBY VERSION
   ruby 3.2.1p31

BUNDLED WITH
   2.4.21

No legacy .ruby_version file in the project or in the parent file hierarchy, at least up to $HOME.

from asdf-ruby.

jedschneider avatar jedschneider commented on July 18, 2024

One other item of note, this did seem to start after a brew update/upgrade and an associated ruby plugin update sadly I did not track the changes too closely but it was probably related to updating the ruby versions available so I could get the 3.3.0 releases and to ensure my statically linked libs were up to date to build the new ruby version.

from asdf-ruby.

jedschneider avatar jedschneider commented on July 18, 2024

Looking at #378 I'm wondering if this is an issue because rspec-core does not use the bin directory for executables.

EDIT: there is a bindir setting for rspec-core, so still searching for the way in which asdf should dynamically switch to gem executables per ruby version.

from asdf-ruby.

monfresh avatar monfresh commented on July 18, 2024

I should have specified that it's probably the GEM_PATH and/or GEM_HOME env vars that are possibly being set somewhere. You can check with env | grep GEM. Also, are you perhaps specifying --user-install in your ~/.gemrc?

from asdf-ruby.

gsmetal avatar gsmetal commented on July 18, 2024

I've run into the similar issue: binaries from gems installed from git repo in Gemfile do not work. Looks like an old issue #194, but I did not understand the solution from there.

from asdf-ruby.

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.