Nokogiri vs SU2018


#1

I am struggling with ruby 2.8 which is incorporated in the latest release of SU2018.
I tried several xlsx readers
roo
rubyXL
creek
simple_xlsx_reader
Neither of them works. (They can not be installed)
The common root problem is that all of them are using nokogiri gem.
Nokogiri is preinstalled gem by SU.
Unfortunately nokogiri works only with ruby version 2.7.
Anybody has a guess what can be done?


#2

In SU2019 the Ruby API was upgraded to Ruby 2.5.1

https://help.sketchup.com/en/release-notes-0


#3
# v2018
RUBY_VERSION
2.2.4
#v 2019
RUBY_VERSION
2.5.1

why do you think this?

john


#4

Thank you. Yes you are right
The title of the topic is wrong. It should be nokogiri vs SU2018

Please see the error messages during installation roo
(very similar error messages can be seen for all the other xlsx reader installations)

Gem::install(“roo”)
Error: #<Gem::InstallError: nokogiri requires Ruby version < 2.7.dev, >= 2.3.>
C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/installer.rb:560:in ensure_required_ruby_version_met' C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/installer.rb:782:inpre_install_checks’
C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/installer.rb:231:in install' C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/request_set.rb:166:inblock in install’
C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/request_set.rb:150:in each' C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/request_set.rb:150:ininstall’
C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/dependency_installer.rb:394:in install' C:/Program Files/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems.rb:558:ininstall’

:in `' SketchUp:1:in `eval'

#5

SU v18 only ships with Ruby 2.2.4, which is less than 2.3…

when gem tries to load it as a dependancy for roo, it fails…

it is not preinstalled in SU…

on SU v19, which has a usable version of Ruby, you will get an error as nokogiri needs to be compiled…

Error: #<Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

I did use ‘xml-simple-1.1.5’ for something in v18, but I can’t even remember what…

there are many threads on the problems with gems in the embedded ruby interpreter…

john


#6

Use:

Gem.install 'nokogiri','1.9.1'

#7

An alternative may be the REXML library that is supplied in the standard library, and is coded in pure Ruby. No need to compile anything or use gems or have your customers install gems.

http://ruby-doc.org/stdlib-2.2.4/libdoc/rexml/rdoc/index.html

http://www.germane-software.com/software/rexml/

http://www.germane-software.com/software/rexml/docs/tutorial.html

  • Note that when they show you can include the REXML module, that you ONLY do so into YOUR namespace or plugin modules, NOT into SketchUp’s main Ruby Objectspace.

#8

Thank you for yor suggestion.
Please note

  1. I used roo for almost one year under SU2018 without any problem on my old PC.
  2. It seems that the a good solution could be if I upgrade to SU2019.
    This the hottest topic nowdays. I am as much confused about this as most of the average SU users.
    (I just renewed, 4 days before the announcment of the new licensing structure, my traditional supscription. )
    I have the very same problem as Michael
    Updating Licence for 2019

#9

Thank you for suggestion.
At least rubyXL can installed after installing nokigiri in this way.


#10

Thank you for your suggestion.
I browsed REXML library description. It seems clear to me.
However for my present problem it is not the solution.
I do not want to reinvent the wheel. i.e. to write a complete package for parsing xlsx files.

Anyway I duly noted your suggestion. Sometimes XML files are to be parsed.
Presently I have a LAZARUS program which makes the parsing of very special xml files and export them to xlsx format