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

Read executables from gemspec #26

Merged
merged 3 commits into from
May 18, 2016
Merged

Read executables from gemspec #26

merged 3 commits into from
May 18, 2016

Conversation

lundebrek
Copy link

@lundebrek lundebrek commented May 17, 2016

Addresses issue #20.

Read executable directory and filenames from the gemspec when creating links, because some gems may use a directory other than bin (for example, exe).

Some gemspecs may have dependencies (Bundler 1.12's gemspec uses git), so the installed gemspec is used.

Some gems may use a directory other than bin (for example, exe).
Additionally, some gemspecs may have dependencies (Bundler 1.1's gemspec uses git), so the installed gemspec is used.
ruby_libs = Dir.glob("#{prefix}/gems/*/lib")
Pathname.glob("#{brew_gem_prefix}/bin/*").each do |file|
Pathname.glob("#{brew_gem_prefix}/#{bindir}/*").each do |file|
Copy link

@nicksieger nicksieger May 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. One suggestion as long as we're here. A Gem::Specification also has an executables field that specifies which scripts should be executable. How about instead of globbing the bindir that we do something like

gemspec = Gem::Specification::load(...)
bindir = gemspec.bindir
ruby_libs = Dir.glob("#{prefix}/gems/*/lib")
executables = gemspec.executables.map {|exe| "#{brew_gem_prefix}/#{bindir}/#{exe}" }
executables.each do |file|
  # rest of the code below
end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, with a slightly different implementation.

@lundebrek lundebrek changed the title Read bindir from gemspec Read executables from gemspec May 17, 2016
@nicksieger
Copy link

👍

@panderson74
Copy link

@nicksieger is that 👍 on CR and QA?

@emmahsax emmahsax deleted the bindir-from-gemspec branch July 14, 2020 08:50
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

Successfully merging this pull request may close these issues.

None yet

3 participants