Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #229 from opscode/sersut/rubygems-cust-fix
Browse files Browse the repository at this point in the history
Preserve the old style rubygems customization for non-windows platforms.
  • Loading branch information
Serdar Sutay committed Sep 4, 2014
1 parent 5f2c671 commit 9fbe00f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config/software/rubygems-customization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
sitelibdir_cmd.gsub!('/', '\\') if platform == "windows"

block do
source_customization_file = File.join(project.files_path, "rubygems_customization", "operating_system.rb")
source_customization_file = if platform == 'windows'
File.join(project.files_path, "rubygems_customization", "windows", "operating_system.rb")
else
File.join(project.files_path, "rubygems_customization", "default", "operating_system.rb")
end
embedded_ruby_site_dir = ""
Bundler.with_clean_env do
embedded_ruby_site_dir = %x{#{sitelibdir_cmd}}.strip
Expand All @@ -64,4 +68,3 @@
FileUtils.cp source_customization_file, destination
end
end

22 changes: 22 additions & 0 deletions files/rubygems_customization/default/operating_system.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Rubygems Customization ##
# Customize rubygems install behavior and locations to keep user gems isolated
# from the stuff we bundle with omnibus and any other ruby installations on the
# system.

# Always install and update new gems in "user install mode"
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS["install"] = "--user"
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS["update"] = "--user"

module Gem

##
# Override user_dir to live inside of ~/.chefdk

def self.user_dir
parts = [Gem.user_home, '.chefdk', 'gem', ruby_engine]
parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
File.join parts
end

end

0 comments on commit 9fbe00f

Please sign in to comment.