configatron leaks syck into other projects
sanders opened this issue · comments
When using cover_me on a rails 3.2, mongoid 3.0.10 project on ruby 1.9.3 we ran into random spec failures.
We eventually traced the failures back to configatron forcing the use of syck for ruby 1.9.3 with the following in store.rb:
class Configatron
class Store
if RUBY_VERSION.match(/^1\.9\.[^1]/)
require 'syck'
::YAML::ENGINE.yamler = 'syck' unless RUBY_PLATFORM == 'java'
end
If configatron needs to use syck as its yamler, it should do so only within the context of configatron and not leak that choice into other projects.
+1
+1 here too. This causes YAML serialization to break in all my code whenever configatron is loaded (because syck is required, even when on JRuby). Here's an IRB session to demonstrate:
jruby-1.6.8 :001 > require 'yaml'
=> true
jruby-1.6.8 :002 > puts ['a', 'b', 'c'].to_yaml
---
- a
- b
- c
...
=> nil
jruby-1.6.8 :003 > require 'configatron'
=> true
jruby-1.6.8 :004 > puts ['a', 'b', 'c'].to_yaml
--- !ruby/object:Array
taguri: ! '!ruby/object:Array'
to_yaml_style: 1
...
=> nil
The output is identical if I replace require 'configatron'
with require 'syck'
, so that's clearly the cause of YAML breakage.
+1
Is this still an issue on master? Looks like there's an open PR relating to Syck that you might want to check out as well: #42
Sorry for the slow follow-up here (I'm now going back and answering our unresolved issues). We no longer do any YAMLing within Configatron itself, so this should be resolved now.