Ruby Gems usage within Sketchup 2017 make


#1

I have installed Gems in Sketchup but cant use stringio because there is a need for an update

See:

require ‘stringio’
false
But is is loaded in my

and the following:

Gem.install “stringio”
Error: #<Gem::InstallError: stringio requires RubyGems version >= 2.6. Try ‘gem update --system’ to update RubyGems itself.>

Looking into my folder:
C:\Users\gva\AppData\Roaming\SketchUp\SketchUp 2017\SketchUp\Gems64

it tells me the gems are installed but i cant use them not even in an administrative startup

The suggested alternative for installing: ruby library 2.7.8 for Sketchup fails

Also tried to change the:
C:\Program Files\SketchUp\SketchUp 2017\Tools\RubyStdLib\platform_specific\rbconfig.rb eb set the platoform params from 2.2.4 to 2.7.8

But doesn’t work

Please help!!!


#2
  1. I think it was said in other threads on gems that basically all current versions of Ruby used in SketchUp 2018 and earlier are beyond end of maintenance (according the to Ruby Core world) and so are not being supported by RubyGems.
    (This means more and more gems will no longer be installable in older SketchUp versions, ie versions using non-RubyGems supported Ruby.)

  2. SketchUp uses a modified build of RubyGems, and the “rbconfig.rb” file is not entirely correct (has invalid values in it for the SketchUp environment.)

  3. Shoehorning a newer Ruby version is not likely to work as it will invalidate SketchUp itself and any extension that has been tested and released to run under the Ruby version distributed with SketchUp.


Suggest you start another thread on the specific needs you have regarding strings. Perhaps there is a work around ?


#3

it part of the standard library, which is why it returns false, i.e. not loaded, because it 's already loaded…

 $".grep(/string/)
# => ".../2.2/lib/ruby/2.2.0/rubygems/util/stringio.rb" as first item...

it also works if I test it…

is it not the same on a Windows PC?

john


#4

The path is different but similar, and yes it is already loaded.

What he said is that he needs an update that was added in a newer Ruby version, … but not WHY.


#5
  1. Yes, StringIO is available as a gem, but it is an ‘extension gem’, so it requires build tools (compilers, additional libraries, etc, often called DevKit) to compile it. Build tools are not shipped with SketchUp.

  2. RbConfig (rbconfig.rb) - “platform params from 2.2.4 to 2.7.8” - in this instance ‘2.2.4’ is referring to a Ruby version, ‘2.7.8’ is referring to a RubyGems version.

  3. RbConfig (rbconfig.rb) - I would strongly suggest not changing rbconfig.rb without saving a backup, especially if you don’t know what each setting is used for.

  4. Use Object.const_defined?(:StringIO) to see if StringIO is already loaded.

The current implementation of Ruby in SketchUp does allow a knowledgeable user to install just about anything, but it may not be trivial. Hence, unless these changes/installs are restricted to a small set of users (like a group of co-workers), they can’t be used in a publicly facing SketchUp extension/plug-in…


#6

Aside from the issue of whether that is the Ruby vs the Gem version, that change is not legitimate because it doesn’t change the actual Ruby version that is built into SketchUp it just lies about what it is!


#7

Thats what i wanted to hear about the stringIO thank you guys!!!