-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow bundler binstubs, instruct instead of Gem::LoadError, closes #2013
- Loading branch information
Showing
5 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Padrino | ||
## | ||
# Replaces the current process with it's binstub. | ||
# | ||
def self.replace_with_binstub(executable) | ||
begin | ||
return if Bundler.definition.missing_specs.empty? | ||
rescue NameError, NoMethodError | ||
end | ||
|
||
project_root = Dir.pwd | ||
until project_root.empty? | ||
break if File.file?(File.join(project_root, 'Gemfile')) | ||
project_root = project_root.rpartition('/').first | ||
end | ||
|
||
if %w(Gemfile .components).all? { |file| File.file?(File.join(project_root, file)) } | ||
binstub = File.join(project_root, 'bin', executable) | ||
if File.file?(binstub) | ||
exec Gem.ruby, binstub, *ARGV | ||
else | ||
puts 'Please run `bundler install --binstubs` from your project root to generate bundle-specific executables' | ||
exit! | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters