My gem uses a local copy of Tidy HTML Validator. It's available in lib/tidy/tidy
. My tests run perfectly locally, but on Travis CI, I'm getting the error that Tidy can't be found.
Errno::ENOENT:
No such file or directory - tidy
The code looks like this:
stdin, stdout, stderr = Open3.popen3('tidy -quiet')
Is there a restriction or something that prevents executing a local executable? I also call a local copy of the Jigsaw CSS Validator which is a Java jar
file and is executed like this:
`java -jar css-validator.jar --output=soap12 file:#{uri}`
This works perfectly on Travis CI. Could there be a problem with Open3
?
Here's the link to the GitHub repo: https://github.com/jmuheim/headhunter Here's the link to the failing Travis CI build: https://travis-ci.org/jmuheim/headhunter
Update
I have rewritten the code that executes the external java
executable to also use Open3
, and it's working. So the problem has to do with tidy
.
For further debugging I have renamed tidy
into tidy2
(to make sure that really the wanted executable is called), and I added a manual File.exist? 'tidy'
before calling it, so this would raise an error if it couldn't be found.
Dir.chdir(VALIDATOR_DIR) do
raise "Could not find tidy in #{Dir.pwd}" unless File.exists? EXECUTABLE
# Docs for Tidy: http://tidy.sourceforge.net/docs/quickref.html
stdin, stdout, stderr = Open3.popen3("#{EXECUTABLE} -quiet")
# ...
end
The file is definitely found, but executing it still results in this error.
1) Headhunter::HtmlValidator#validate returns a local response when calling the validator succeeds
Failure/Error: subject.validate('invalid.html', read_file('html_validator/invalid.html'))
Errno::ENOENT:
No such file or directory - tidy2
# ./lib/headhunter/html_validator.rb:20:in `block in validate'
# ./lib/headhunter/html_validator.rb:16:in `chdir'
# ./lib/headhunter/html_validator.rb:16:in `validate'
# ./spec/lib/headhunter/html_validator_spec.rb:9:in `block (4 levels) in <top (required)>'
# ./spec/lib/headhunter/html_validator_spec.rb:8:in `block (3 levels) in <top (required)>'
So the only thing I can guess now is that be there is a permissions problem? Is there a way to set permissions to local executables with Travis CI?
I also tried putting tidy
into bin
like somebody suggested in the comments, but this didn't seem to change a thing, too.