Rails' bundle install causing all of our bin directory contents to be overridden
Asked Answered
C

1

6

One of our Rails programmers keeps messing up our bin directory. He'll run bundle install and for some reason the bin directory fills up with scripts for almost all of our gems and the 5 scripts we normally have there (bundle, rails, rake, setup, spring) get overridden. We then try and do something like heroku run console and get a bunch of warning messages about bad bin files. But everything seems to work anyway.

Here's an example rails file that gets overridden:

#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rails' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('railties', 'rails')

any idea what's going on and how to stop this?

Cultigen answered 6/4, 2015 at 20:5 Comment(1)
change the password and forbide this employee to connect to the production machine? :pUrger
F
19

Running bundle --binstubs even once will create a bundler config file in .bundle/config with an entry that tells bundler to install binstubs each time bundler is run. Have the developer edit .bundle/config and/or ~/.bundle/config and remove this line:

BUNDLE_BIN: bin

Bundler also has a built in way to delete that configuration item:

bundle config --delete bin

Once you've done that, you can have Rails update the binstubs:

rake rails:update:bin
Fabaceous answered 6/4, 2015 at 20:53 Comment(1)
FYI, in newer Rails it's rails app:update:binEleonoreeleoptene

© 2022 - 2024 — McMap. All rights reserved.