DEV Community

Liam Barry
Liam Barry

Posted on

Automating PowerRuby installation

I've been working with a client who has been using an older version of PowerRuby and has recently wanted to upgrade to PR CE2 (Community Edition 2.0).

For those that don't know what PowerRuby is, it's Ruby and Ruby on Rails built for the IBM i operating system. They compile Ruby and some gems specifically for use on IBM i.

The first guide on the org explains that you need to download the save files and run the RSTLICPGM (restore licensed program) command manually - ew! In 2018, we got yum on IBM i to install packages like the Ruby runtime (Node.js, python, etc) automatically with the yum command. PowerRuby has not adopted this method which is very sad.

Of course, for this to work you will need make and curl which is available from the default IBM yum repository:

yum install curl.ppc64 make-gnu.ppc64

I wanted an easy way to get PowerRuby running on IBM i, so I went ahead and created a makefile to run all the commands required to install the PR licensed program from the web. This process will create the save files, download the contents and restore the programs with RSTLICPGM:

BIN_LIB=PR_TEST

all: download install

download:
    system "CRTLIB LIB($(BIN_LIB))"
    system "CRTSAVF FILE($(BIN_LIB)/PRUBY_BASE)"
    system "CRTSAVF FILE($(BIN_LIB)/PRUBY_0001)"
    system "CRTSAVF FILE($(BIN_LIB)/PRUBY_0006)"
    curl -L -k -o /QSYS.LIB/$(BIN_LIB).LIB/PRUBY_BASE.FILE https://github.com/PowerRuby/DE_train_01/releases/download/V2R0M0/pruby_base.savf
    curl -L -k -o /QSYS.LIB/$(BIN_LIB).LIB/PRUBY_0001.FILE https://github.com/PowerRuby/DE_train_01/releases/download/V2R0M0/pruby_0001.savf
    curl -L -k -o /QSYS.LIB/$(BIN_LIB).LIB/PRUBY_0006.FILE https://github.com/PowerRuby/DE_train_01/releases/download/V2R0M0/pruby_0006.savf

install:
    system "RSTLICPGM LICPGM(1PRUBY1) DEV(*SAVF) LNG(2924) SAVF($(BIN_LIB)/PRUBY_BASE)"
    system "RSTLICPGM LICPGM(1PRUBY1) DEV(*SAVF) LNG(2924) OPTION(1) SAVF($(BIN_LIB)/PRUBY_0001)"
    system "RSTLICPGM LICPGM(1PRUBY1) DEV(*SAVF) LNG(2924) OPTION(6) SAVF($(BIN_LIB)/PRUBY_0006)"

Then to install PowerRuby CE2 all the developer has to do is run make!

Optional extras

PowerRuby also provides a version the GCC compiler (8.2) which is what they use to compile PR CE2 and some of the gems provided. It's also needed if you want to compile 'native' gems.

gcc:
    -system "CRTSAVF FILE($(BIN_LIB)/PRUBY_0002)"
    curl -L -k -o /QSYS.LIB/$(BIN_LIB).LIB/PRUBY_0002.FILE https://github.com/PowerRuby/DE_train_02/releases/download/V2R0M0/pruby_0002.savf
    system "RSTLICPGM LICPGM(1PRUBY1) DEV(*SAVF) LNG(2924) OPTION(2) SAVF($(BIN_LIB)/PRUBY_0002)"

Top comments (0)