Usage

Top  Previous  Next

Run the rubyencoder executable without parameters to get a list of all available options.

 

single file:

rubyencoder [options] file.rb

multiple files:

rubyencoder [options] file1.rb file2.rb file3.rb

file mask:

rubyencoder [options] *.rb

file list:

rubyencoder [options] @filelist

 

You may run the RubyEncoder 3 encoder to encode either one or multiple files. You may enumerate all files you want to encode or use a file mask or file list to specify multiple files. A file list is a text file with either full or relative file paths of all the files to encode, separated by a new line. You should use an @ sign before the filelist name in the command line. A file list passed to the RubyEncoder encoder for batch processing from the command line may contain file masks. Standard ? and * symbols are available.

 

The encoded file will replace the original file. The original file will be backed up with a .bak extension by default (until you turn off the backup facility with a -b- option).

 

If -o option is used to specify output directory the original file will not be backed up. Instead of it, the original file will be copied to the output directory and encoded there. We recommend that you always encode to the output folder specified with -o.

 

--ruby <version x.y>

 

RubyEncoder CLI encoder encodes scripts for Ruby 1.9.x and 2.x by default. Use --ruby option to specify versions of Ruby you need to encode scripts for. Available values for --ruby option are 1.8, 1.9 (encoding for 1.9.0/1.9.1), 1.9.2 (encoding for 1.9.2/1.9.3), 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0 etc.To encode a script to run under Ruby 1.8.x, 1.9.x and/or 2.x use the --ruby option mutliple times and specify all versions of Ruby you need to run protected files under.

 

Your code must be compatible with ALL specified versions of Ruby. Otherwise you will get an error message when encoding incompatible files and such files will remain unencoded.

 

Example:

> rubyencoder file1.rb

> rubyencoder --ruby 2.4.0 --ruby 2.5.0 file2.rb file3.rb file4.rb

 

Optionally your may use "+" and "-" suffix for the --ruby option. "+" means to encode for the specified version of Ruby and for all the newer versions which are supported by the current version of RubyEncoder. "-" means to encode  for all the supported versions of Ruby except the specified one and all the lower versions, which is useful if you always need to encode by default for new versions but do not need support for old versions starting from some one. E.g.
 
--ruby 2.4.0+                encodes for Ruby 2.4 and all the newer versions (up to 2.5 for this version of RubyEncoder)
--ruby 2.0.0+                encodes for Ruby 2.0 to 2.5 and newer (up to 2.5 for this version of RubyEncoder)
--ruby 2.3.0-                encodes for Ruby 2.4 and newer, i.e. excludes Ruby 2.3 and older

 

 

You may enumerate all the files you want to encode in a file list. A file list is a text file with either full or relative file paths of all the files to encode, separated by a new line (masks are supported, use '*' and '?' for it). You should use an @ sign before the file list name in the command line.

Usage: >rubyencoder @filelist

When specifying a relative path don't start it with ../ or ./ directory specifiers.

 

It's possible to use shorter syntax for directory encoding. All specified directories will be recognized and the "*" file mask will be added:

>rubyencoder -r source_dir

 

which will work as if a file mask was specified:

>rubyencoder -r "source_dir/*"

 

A log will be printed to the terminal during the encoding process. A status message will be displayed for each encoded file. You may get one of the following status messages:

 

ok

The file was encoded without problem.

file not found cannot be read

The specified file could not be found. Check the specified file path.

Ruby syntax or other compiler error

The original file has syntax or other errors and thus cannot be encoded. Check your file, test it with the Ruby interpreter. This error usually appear when encoding for multiple versions of Ruby and if your file is not compatible with all the target versions of Ruby. Make sure your ruby script is compatible with all versions of Ruby you are encoding for.

could not backup source file, skipped

The encoder could not make a backup copy of your original file (when no output directory was specified). RubyEncoder skips the file in that case to keep your original version. Check you have enough free space available and permissions to write to your original files directory.

cannot not write file

The encoder could not write the encoded file. Check you have enough free space available and permissions to write to original files directory or to the output directory if you have specified it with the -o option.

file is already processed by RubyEncoder

The encoder will not encode files which are already encoded with RubyEncoder. Check your original files directory.

empty file, skipped

The encoder will not encode empty files. If you need to have empty files for any reasons you may copy them manually.

not regular file, skipped

The encoder could not encode a file because it is not a regular file. It may be a socket or a unix device for example.

do not encode, skipped

The file was marked as 'do not encode' and therefore was skipped.

copied

The file was copied without encoding. It is possible when -f option is used to specify files to encode and -o option is used to specify output directory. All other files than specified in -f option will be copied as-is without encoding. It is useful for encoding an entire project directory when it also may contain non-Ruby files.

internal encoder error,

unknown error

This is an internal problem with the encoder. Check you have enough free memory space to run the encoder and some free space on the disk. If it is not a memory problem then let us know about this error. Send an email to support@rubyencoder.com with a detailed description of the error and the command line used for running the encoder. We will investigate the problem. We may also need some additional information from you.