Comments (9)
+1! For example, this task should install bundler, but it fails.
namespace :install do
desc 'Install/update bundler'
task :bundler do
on roles(:all) do |host|
if test('which bundle')
info "Bundler is already installed on #{host}"
execute :gem, 'update', "'^bundler$'"
else
execute :gem, 'install', 'bundler'
end
end
end
end
Instead of running gem install bundler
, it runs bundle exec gem install bundler
, resulting in:
DEBUG [727a18b6] Command: bundle exec gem install bundler
DEBUG [727a18b6] bash: bundle: command not found
from bundler.
As a workaround, I used sh -c
:
execute "sh -c 'gem update \"^bundler$\"'"
and
execute 'sh -c "gem install bundler"'
from bundler.
Hi, you could also bypass the prefixing behavior by using a single string argument to execute
, like this:
# This bypasses SSHKit's command-prefix behavior
execute "gem install bundler"
Or, if you never want gem
to be prefixed, you can exclude it when setting bundle_bins
:
# This the default
# set :bundle_bins, %w(gem rake rails)
set :bundle_bins, %w(rake rails)
from bundler.
Ran into the same problem!
What is the logic for prefixing gem by bundle exec, when would that apply?
As far as I know there is only one possible rubygems installation per ruby, it isn't decide by bundler or the Gemfile.
Any explanation would be awesome, thanks!
from bundler.
I'm also fuzzy on why someone would ever use bundle exec gem
, but it does have an effect. If you run gem list
you get all gems in your Ruby, vs bundle exec gem list
will show only show gem versions that match your Gemfile.lock.
from bundler.
Ok thanks you're right, it does seem to have an effect.
But is it wise to have it set as the default behavior?
I personally always want to call the "real" gem, especially during setup, so I fixed it with:
set :bundle_bins, %w(rake rails)
# If wished, calling bundle exec gem could be easily done
execute(:bundle, :exec, :gem, ...)
But this could be a frustrating issue for new users who just want to call "gem".
This is maybe just my opinion, great work by the way!
from bundler.
I agree, I don't need bundle exec gem
either, but changing that now could break deploys of users that expect that default behavior. There is an easy workaround, so perhaps better documentation is the solution?
from bundler.
I understand, maybe a hint to this behavior could be put on the readme of capistrano-rails, since many users will read capistrano-rails but not necessarily capistrano-bundler, but once you know the documentation here is pretty good.
Like I said I'm good now, since I know the behavior, but could be frustrating for new users. At first I thought it was rvm1-capistrano3 who was responsible, but finally troubleshooted it here.
Anyway, thanks for your time dude!
from bundler.
It seems like this is more of a documentation issue if anything. If anyone wants to submit a PR for that, go for it!
However, given the age of this ticket, I'm closing. If anyone wants it to stay open, feel free to reopen.
from bundler.
Related Issues (20)
- Gemfile not found HOT 1
- Benefit not clear in Readme file HOT 1
- Specify bundler executable location HOT 5
- bundle install doesn't seem to run HOT 1
- Generating binstubs on deployment seems destined to break when old releases are removed HOT 1
- rails upgrade and failed to deploy HOT 6
- Bundler 2.1 has deprecated --deployment, --path, and --without HOT 36
- verifying the non-interactive server environment -- help me help you HOT 1
- How can I set bundle_without option based on role? HOT 2
- Required ext-ruby-2.2.1 is not installed. HOT 1
- Changelog seems out of date HOT 2
- Change default bundle_jobs to nil to take advantage of Bundler's default behavior HOT 4
- Bundler emits warning about "replacing the local value of without" HOT 1
- bundle install (bundle 1.16.1, AlmaLinux 8), installs to vendor/bundle
- `bundle check` succeeds when it should fail on gem updates HOT 2
- cap production bundler:install does not fetch new bundler version HOT 1
- typo in desc: "subequent" -> "subsequent" HOT 1
- Feature: rate limit for bundle:install task when using lots of servers HOT 1
- `bundle check` always fails (and why do we even need this extra step?) HOT 19
- Explain that .bundle should be added to linked_dirs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bundler.