airbnb/synapse

Ubuntu 13.10 ruby 1.9.3 synapse not working

Closed this issue · 3 comments

Any idea how I can fix this? I ran "sudo gem install synapse" prior to the below.

vagrant@packer-virtualbox-iso:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

vagrant@packer-virtualbox-iso:~$ synapse -h
Welcome to synapse

Usage: synapse --config /path/to/synapse/config
-c, --config config path to synapse config
-h, --help Display this screen

vagrant@packer-virtualbox-iso:$ synapse
/var/lib/gems/1.9.1/gems/synapse-0.9.1/bin/synapse:40:in rescue in parseconfig': uninitialized constant Psych::ParseError (NameError) from /var/lib/gems/1.9.1/gems/synapse-0.9.1/bin/synapse:34:inparseconfig'
from /var/lib/gems/1.9.1/gems/synapse-0.9.1/bin/synapse:46:in <top (required)>' from /usr/local/bin/synapse:23:inload'
from /usr/local/bin/synapse:23:in `

'
vagrant@packer-virtualbox-iso:$

you need to pass arguments to the synapse command; run it like this: synapse -c path_to_config_file

That's not the problem. The problem is, as of Ruby 1.9.3, Syck was removed as the default YAML parser, and replaced with Psych (see https://bugs.ruby-lang.org/issues/2340). Psych does not have a class ParseError, which is why you get this error. Nerve has the same exact problem.

https://github.com/airbnb/synapse/blob/master/bin/synapse#L40
https://github.com/airbnb/nerve/blob/master/bin/nerve#L48

So in a nutshell, Synapse and Nerve simply don't work in Ruby 1.9.3 and above due to this bug. I'm working on PRs to make these scripts work across all ruby versions, and will send shortly....

Ah, looking closer, it looks like this was "fixed" in synapse in dea5662 but not fixed in nerve. Although this is now introducing the opposite problem, where this will now only work in Ruby 1.9.3+, and not in 1.9.2 and below. If that's what the library wants to support that's fine, but it should be called out in the README.

Anyways, I will send a PR for nerve which introduces the same change there.