Try loading gemspec first, fall back to YAML #113

wants to merge 1 commit into from

3 participants


For some reason, warbler was failing catch the YAML load error when packaging with a Ruby gemspec. This flips the order. I'm not sure this is the final solution, but a conversation starter, perhaps.


I'm having what I think is a related error. The symptom is that the gemspec doesn't load, and instead I see "(): mapping values are not allowed here at line 5 column 43".

It seems to be related to me adding lines in the gemspec of the form 'add_runtime_dependency "cassandra" unless RUBY_PLATFORM == "java"', but I'm still narrowing it down. I don't know why adding "if" lines would cause problems, but if I revert several changes of that form then it works, and if I put them back then it fails.

"gem build" thinks it's a valid gemspec.

JRuby Team member

I think there is a problem with this is. Will it will ever reach the rescue if it's a yaml gemspec? See Gem::Specification.load, it traps the error and warns instead.

But I think this is very valuable because most gemspecs will be ruby. Can we get around the rubygems load?

JRuby Team member

I think this may be a catch 22, because no matter how you try to validate the gemspec, for example:


You will end up falling back on the yaml code. So you be back to square one if there is something invalid in your gemspec.

Can you provide an example of when it fails to catch the YAML load error?


I can't any more. That code is long since gone.

JRuby Team member

I'm closing this because I think it's handled better by 4de97e5 in #85

@jkutner jkutner closed this Jul 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment