pact-foundation / pact-js-core

Core binaries for pact-js, a Contract Testing Framework. NOTE: If you are looking to do Pact contract testing in node, you almost certainly want pact-js, not pact-node.
https://docs.pact.io
MIT License
150 stars 79 forks source link

Pact-node's ruby bindings don't work if the project name has spaces #247

Closed christopher-francisco closed 2 years ago

christopher-francisco commented 6 years ago

Software versions

Expected behaviour

It shouldn't matter whether the directory name has or hasn't spaces on its name.

Actual behaviour

When creating the mock server, it somehow split the project path where spaces exist: /var/lib/jenkins/workspace/My Cool App/, and attempts to run Cool as a command. It then, of course, fails saying

/node_modules/@pact-foundation/pact-node/standalone/darwin-1.43.1/lib/ruby/bin/ruby: line 14: Cool: command not found

Steps to reproduce

  1. Change the name of your app to something with spaces (if possible with 3 words), like: my-cool-app to My Cool App.
  2. Run the PactJS tests.
mefellows commented 6 years ago

Thanks @chris-fa, I'll take a look.

cc: @mboudreau @bethesque . Did we do something recently with fixing spaces on Windows, and could this have had an impact?

christopher-francisco commented 6 years ago

@mefellows Btw, this is not happening on Windows, it's on a Jenkins server running in some linux distro (prolly Centos but I don't have confirmation yet, the owner hasn't replied with that info).

I was also able to reproduce it on my MacOS

bethesque commented 6 years ago

I swear we'd fixed all the space issues! They're like whack-a-mole. I'll have a look. I think I'm going to add contraindications for using Pact in the FAQ - 1. you're on windows or 2. your project name has spaces :P

bethesque commented 6 years ago

I get further if I replace

echo GEM_HOME="$ROOT/lib/ruby/gems/2.2.0"
echo GEM_PATH="$ROOT/lib/ruby/gems/2.2.0"

with

echo GEM_HOME=$(printf %q "$ROOT/lib/ruby/gems/2.2.0")
echo GEM_PATH=$(printf %q "$ROOT/lib/ruby/gems/2.2.0")

in ruby_environment, but then it errors further down.

mefellows commented 2 years ago

Closing as latest version removes Ruby core.