wycats / bundler

407 stars 30 forks source link

[FreeBSD] Set RB_USER_INSTALL environment variable #163

Open geoffgarside opened 14 years ago

geoffgarside commented 14 years ago

In the FreeBSD versions of Ruby the system rbconfig.rb has the following lines

CONFIG["INSTALL_DATA"] = ENV['RB_USER_INSTALL'] ? 'install  -m 444' : 'install  -o root -g wheel -m 444'
CONFIG["INSTALL_SCRIPT"] = ENV['RB_USER_INSTALL'] ? 'install  -m 555' : 'install  -o root -g wheel -m 555'
CONFIG["INSTALL_PROGRAM"] = ENV['RB_USER_INSTALL'] ? 'install  -s -m 555' : 'install  -s -o root -g wheel -m 555'

which causes gems with extensions to attempt to chown built files to root:wheel when running gem bundle. It would be better if Bundler could set the RB_USER_INSTALL environment variable to 1 so that built files are not chown'd to root:wheel but are instead left alone w.r.t ownership.

For the time being the following command will enable gem bundles to be installed on FreeBSD

$ env RB_USER_INSTALL="1" gem bundle

I've checked neither Windows, Linux or Mac OS X versions of Ruby use RB_USER_INSTALL. I don't know if NetBSD or OpenBSD are affected.

geoffgarside commented 14 years ago

I've been looking through the bundler source. I think the environment would need to be set in either the Gemfile though I'm not sure about that, or lib/bundler/bundle.rb. If its the latter then I'm guessing it would be in one of

though I'm not sure which, if any are correct.

xxx commented 14 years ago

handling it in the Gemfile works fine for me.

geoffgarside commented 14 years ago

How do you handle it in the Gemfile? Add ENV['RB_USER_INSTALL'] = 1 or something?

xxx commented 14 years ago

Yes, exactly. I just put it in as the first line in the Gemfile and all is well.

xxx commented 14 years ago

oh, make sure it's ENV['RB_USER_INSTALL'] = '1' (i.e. '1' is a string)

geoffgarside commented 14 years ago

brilliant