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

Does 'path' option check always .gemspec ? #7661

Open
fuminori-ido-m opened this issue May 15, 2024 · 0 comments
Open

Does 'path' option check always .gemspec ? #7661

fuminori-ido-m opened this issue May 15, 2024 · 0 comments
Labels

Comments

@fuminori-ido-m
Copy link

Describe the problem as clearly as you can

When I specify 'path' option in Gemfile as follows:

gem 'hello', path: '../hello-gem'

Then, the ../hello-gem/hello.gemspec is always invoked on bundle exec ....

When the hello-gem's hello.gemspec contains the followings (normally generated by bundle gem):

  spec.files = Dir.chdir(File.expand_path(__dir__)) do
    `git ls-files -z`.split ...
    ...

while it is NOT under git-manaed because it is just copy of the sources (without .git/*).

This situation causes the following 'fatal' git error:

$ bundle exec rake -T
fatal: not a git repository (or any of the parent directories): .git
...

The interesting thing is that another gem without 'path' option doesn't generate such a git error. It could be because the gemspec file is not invoked (since cached?) even though the gemspec contains the same git ls-file -z.

Did you try upgrading rubygems & bundler?

no

Post steps to reproduce the problem

  1. create 'hello' gem
$ mkdir work; cd work
$ bundle gem hello
$ cd hello
$ git init
$ vi hello.gemspec     # modify 'TODO' to avoid gem error
$ git add .
$ git commit
  1. create 'hello' sources just for testing
$ git archive -o /tmp/hello.tgz --prefix hello-gem/ HEAD
  1. install 'hello' gem
$ cd ..      # goto ~/work
$ tar zxvf /tmp/hello.tgz
  1. create test app and refer 'hello' gem via path option
$ mkdir app; cd app
$ bundle init
$ vi Gemfile

modify as follows

...
gem 'rake'
gem 'hello', path: '../hello-gem'
...

create Rakefile

$ vi Rakefile 

as follows

desc 'say hello'
task :hello do
  puts 'HELLO'
end
  1. run 'bundle rake -T'
$ bundle install
$ bundle exec rake -T
fatal: not a git repository (or any of the parent directories): .git
rake hello  # say hello

Which command did you run?

bundle

What were you expecting to happen?

doesn't generate git fatal error. Is there any other solution than 'path' option to install 'hello' gem without git repository?
user-install option is the solution?(it cached and doesn't invoke hello.gemspec?)

What actually happened?

hello.gemspec is invoked on every 'bundle exec' execution and it generates git error:

fatal: not a git repository (or any of the parent directories): .git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant