I have the problem that I want to require
a ruby file.
File overview:
ExcelConversion.rb
main.rb
/classes/excelReader.rb
/classes/elementIdentifier.rb
the main.rb
has the header:
require classes/excelReader
require classes/elementIdentifier
the excelReader.rb
has the header:
require 'rubyXL
the elementIdentifier.rb
has the header:
require 'inifile
The problem is that if I execute the main.rb
file, everything works fine. But, as soon as I write require main
within the ExcelConversion
file I get the error:
Error Loading File ExcelConversion.rb
Error: #<LoadError: cannot load such file -- rubyXL>
C:/Program Files (x86)/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in 'require'
C:/Program Files (x86)/SketchUp/SketchUp 2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in 'require'
C:/shortenedPath/ExcelConversion/classes/ExcelReader.rb:1:in '<top (required)>'
C:/shortenedPath/ExcelConversion/main.rb:1:in 'require_relative'
C:/shortenedPath/ExcelConversion/main.rb:1:in '<top (required)>'
C:/shortenedPath/ExcelConversion.rb:4:in 'require_relative'
C:/shortenedPath/ExcelConversion.rb:4:in '<top (required)>'
I don't understand how that is even possible to throw an error, since the main.rb
runs without problems.
Edit: Solution
I managed to find the solution. SketchUp needs to install the gems separately. This can be achieved through the Ruby Console and the command:
Gem.install "nameOfTheGem"
Then SketchUp stores a copy of the gem within it's own path and one can
require
it as usual.