tidy_ffi icon indicating copy to clipboard operation
tidy_ffi copied to clipboard

troubleshooting command to verify libtidy is installed

Open jesperronn opened this issue 7 years ago • 3 comments

Hi, first of all, thanks for maintaining this project

I am looking for a very simple command to verify a system where I want to ensure html tidy is installed before I start doing fancy stuff and cleaning.

For other libraries, usually I would run lib --version.

But the only thing I could find here was this:

TidyFFI::LibTidy.tidyReleaseDate
=> "31 October 2006 - Apple Inc. build 15.18.1"

This works... but I would rather prefer a version call or something. From https://github.com/libc/tidy_ffi/blob/master/lib/tidy_ffi/lib_tidy.rb#L18 I see that there is a tidyRelease as well, but it takes a parameter.

In your opinion, what would be the best ping or troubleshooting command I could use?

jesperronn avatar Dec 18 '17 14:12 jesperronn

This gem is a wrapper of the library. http://api.html-tidy.org/tidy/tidylib_api_5.6.0/group__Basic.html

tidyRelease is to clear memory associated with the document see this

I think you're looking for tidyLibraryVersion. I think it wasn't available in the past, that's why I haven't used it.

I will do more research about the version when it appeared.

libc avatar Dec 19 '17 15:12 libc

Thanks for your response. Is there a way we could enhance this library to expose that version from the underlying library. I tried TidyFFI::LibTidy.tidyLibraryVersion but it gave me an error:

TidyFFI::LibTidy.tidyLibraryVersion
NoMethodError: undefined method `tidyLibraryVersion' for TidyFFI::LibTidy:Class

how exactly could I use tidyLibraryVersion?

jesperronn avatar Mar 21 '18 12:03 jesperronn

Hi, I'm using this snippet from this project to verify tidy is installed on the system:

def tidy
  return @tidy if defined?(@tidy)
  @lib_tidy = TidyFFI::LibTidy
  @tidy = TidyFFI::Tidy
rescue TidyFFI::LibTidyNotInstalled
  @tidy = nil
end

spk avatar Mar 09 '19 13:03 spk