aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/settings.rb
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-04-18 08:28:57 +0900
committerHomu <homu@barosl.com>2016-04-18 08:28:57 +0900
commitba23e13a8c4420c91d2d866e3bcaed18cbb03d1b (patch)
tree1bd3ad8877e0b3e4250c674045f2a2320eef37ea /lib/bundler/settings.rb
parent0446fa9860f36a3ee75fa12599e03fabc613a894 (diff)
parent72c1825ad246e610b49cabdf69e56726f4f79ca2 (diff)
downloadbundler-ba23e13a8c4420c91d2d866e3bcaed18cbb03d1b.tar.gz
Auto merge of #4416 - bundler:seg-settings-custom-serializer, r=segiddins
[Settings] Use a custom serializer instead of relying upon the YAML module ¯\\\_(ツ)\_/¯ seems like a good idea \c @RochesterinNYC @indirect
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r--lib/bundler/settings.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 8e439180..de0644ad 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -201,14 +201,21 @@ module Bundler
hash.delete(key) if value.nil?
SharedHelpers.filesystem_access(file) do |p|
FileUtils.mkdir_p(p.dirname)
- require "bundler/psyched_yaml"
- File.open(p, "w") {|f| f.puts YAML.dump(hash) }
+ p.open("w") {|f| f.write(serialize_hash(hash)) }
end
end
value
end
+ def serialize_hash(hash)
+ yaml = String.new("---\n")
+ hash.each do |key, value|
+ yaml << key << ": " << value.to_s.gsub(/\s+/, " ").inspect << "\n"
+ end
+ yaml
+ end
+
def global_config_file
if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
Pathname.new(ENV["BUNDLE_CONFIG"])