Project

rien

0.01
No commit activity in last 3 years
No release in over 3 years
Encode your Ruby code for distribution
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Rien

Ruby IR Encoding Gem (Experimental)

Build Status

Example

Usage: rien [options]
    -e, --encode [FILE]              Encode specific ruby file
    -p, --pack [DIR]                 Pack ruby directory into encoded files
    -o, --out [FILE/DIR]             Indicate the output of the encoded file(s)
    -u, --use-rienfile               Use Rienfile to configure, override other options
    -s, --silent-mode                Suppress all prompts asking for user input
    -t, --tmpdir [DIR]               Select a temp directory to store intermediate results

Encode Mode

Encode single ruby file

# hello.rb

puts "Hello Rien"
rien -e hello.rb -o encoded.rb

ruby encoded.rb # => Hello Rien

Pack Mode

Compile all .rb files in the directory

rien -p source -o output

Use Rienfile to configure

When using Rienfile to configure, other options from CLI will be ignored

Put a Rienfile in your project directory

# source/Rienfile

Rien.configure do |config|
    # The syntax is the same as glob used in class Dir
    # [Optional] includes all files by default
    config.includes = ["app/**/*", "lib/**/*"]
    # [Optional] excludes nothing by default
    config.excludes = ["**/*.py",
                       "lib/**/templates/**/*",
                       "**/init.rb"]

    # [Optional] set to rien_output by default
    config.output = "compiled"

    # Rien will wait user to input in console when 
    # finding suspicious already compiled file
    # set this to true to turn it off
    # [Optional] set to false by default
    config.silent = false

    # [Optional] use Dir.tmpdir/rien by default
    # aka. /tmp/rien for linux
    config.tmpdir = "tmpdir/rien"

end

and then

rien -p source -u

Files to be excluded

Read file and eval

Real world code from redmine/config/initializers/00-core_plugins.rb

eval(File.read(initializer), binding, initializer)

Compile lib/plugins/**/init.rb may lead to a such error in runtime

init.rb:5:in `<main>': undefined local variable or method `config' for main:Object (NameError)

Use Rinefile to exclude lib/plugins/**/init.rb

Temporary directory

Rien uses a tmpdir to store intermediate results and timestamps to distinguish them.

Check your tmpdir (/tmp/rien for linux by default) to clean unsuccessful build results.