FeResPost Web Site                     FeResPost Online User Manual

IV.0.1 Accessing the ruby extension

Typically, one imports the FeResPost Classes and Modules with the two following statements:

     require "FeResPost"  
     include FeResPost

Note however that it works only if the different environment variables have been initialized correctly. Typically, in our Windows examples, this is done through the batch files (on Windows computers) or bash files (on UNIX and LINUX computers) that are used to launch the example scripts, and the following variables are generally initialized:

    set LIB=  
    set INCLUDE=  
    set RUBYPATH=C:/NEWPROGS/RUBY/ruby-3.0.0-1-x64/bin  
    set REDISTRPATH=C:/Users/ferespost/Documents/SRC/OUTPUTS/REDISTR  
    set RUBYLIB=C:/Users/ferespost/Documents/SRC/OUTPUTS/RUBY/RUBY_30  
    set PATH=%RUBYPATH%;%REDISTRPATH%;C:/Windows/System32

On Windows machines, the examples are defined in such a way that the environment is defined in file “RUBY/ENV/env.bat” included in the script used to launch ruby program. In the example above, not that the “PATH” environment variable refers to tree directories:

For example, the example “EX03/makeGravForces.rb” is launched in “RUBY/EX06” directory with command:

    makeGravForces.bat

in which “exec” refers to the “exec.bat” file with following content:

    setlocal  
    call "../ENV/env.bat"  
    ruby -I. makeGravForces.rb  
    endlocal

Of course the different paths you will initialize in “ENV/env.bat” will have to be adapted to you peculiar installation, and to the version of Ruby you are using.

On unix, the BASH file looks as follows:

    #!/bin/bash  
    source ../ENV/env.bash  
    ruby --version  
    ruby -I. -I$RUBYLIB makeGravForces.rb

in which“../ENV/env.bash” content looks like:

    RUBYLIB=/home/progs/Documents/FERESPOST/SRC/OUTPUTS/RUBY/RUBY_25  
    PATH=/home/PGR/RUBY/I64//RUBY_251/bin