There are some other options available to pass to rubyencoder command line encoder:
-v
|
Display version number
|
-h
|
Display full options list
|
--license
|
Display license information
|
--license--release
|
Release the current license which allows reinstalling to another machine or the same one. You get 3 free license resets for every license.
|
--credits
|
Display names of RubyEncoder developers
|
-w
|
Wait for key press before exit. Allows you to check encoding log in terminal before exit.
|
-q
|
Display settings and request confirmation. The encoder will display all encoding parameters and wait for a key press before any real encoding takes place. You may check all parameters and cancel if anything is not correct.
|
--verbose <n>
|
Controls the encoder output. 0-quiet, 1-print only errors to the log, 2-print standard log. 2 is default
|
-r{n}
|
Recurse subdirectories. The encoder will process all subdirectories recursively when searching files using specified file masks.
{n} is an optional directory trimming level, see below. IT IS IMPORTANT TO ENCLOSE FILE MASKS IN DOUBLE QUOTES. Otherwise, if file masks are not be enclosed in double quotes command line shell will expand file masks and recursion will not work as expected.
|
-b <ext>
|
Set file extension for backup files (bak is default). You may change an extension used for backup copies with this option.
Example: -b old
|
-b-
|
Disable backup of source files (BE CAREFUL!)
|
-x "mask" | @list
|
You may specify what files or directories shall NOT be encoded. You may specify either a strict name, relative path with a directory name or a mask (with ? and/or *).
Example:
>rubyencoder -r -x "doc/*" -x "config.rb" "*.rb"
This will encode all *.rb files in the current directory and all directories recursively but all files in the "doc" directory and all files (and dirs if any!) named "config.rb" will not be encoded.
You may enumerate all the files you want to exclude from encoding using a 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 (masks are supported, use '*' and '?' for it). You should use an @ sign before the filelist name in the command line. Usage: -x @filelistname
When specifying a relative path don't use ../ or ./ directory specifiers.
|
-f "mask" | @list
|
You may specify what files will be encoded by filenames, file masks or a file list. All other files which have been added for processing or found by expanding file masks will be copied into the output directory "as-is" without encoding. If you don't specify the -f option then all specified files will be encoded by default.
Example 1:
>rubyencoder -r -f "*.rb" -o "output_dir" "*"
All (with recursion) *.rb files from the current directory will be copied and encoded into the output_dir. All other files from the current directory will be copied into output_dir as-is (unencoded).
You may specify multiple filenames or file masks with using of multiple -f options:
Example 2:
>rubyencoder -r -f "*.rb" -f "includes/*.rb" -f @myrubyfiles -o "output_dir" "*"
If you don't specify the output directory but use -f option then only files specified with -f option will be encoded. All other files will remain unchanged.
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 filelist name in the command line. Usage: -f @filelistname
When specifying a relative path don't use ../ or ./ directory specifiers.
|
-c "mask" | @list
|
You may also use the -c (--copy) filter option in additon to -f (--file) and -x (--exclude). The -c (--copy) option may be used to specify what files will be copsied as-is without encoding to the target folder. This option makes sense only if you specify the target folder with -o (--output) option. If -c is used without -o, then it works as -x and skips the specified files. The option may take * and ? wildcards or a @filelist.
|
-o <output_dir>
|
You can specify an output directory for all encoded scripts. Source files will be unchanged if you specify an output directory different from your source scripts dir. The default backup option will be off when an output directory is specified. If you want to re-enable it, even when the output directory is specified, then use the -b <ext> option after the output directory option.
The full directory path to the source scripts will be recreated under the output directory if the full path to the source files was specified.
Example 1: Encode all *.rb scripts in the current dir with recursion and put encoded files into /home/myproject/encoded.
> rubyencoder -r -o /home/myproject/encoded *.rb
Example 2: Encode all scripts specified in the filelist and put encoded files into /home/myproject/encoded. Additionally backup source scripts in source directory with .bak extension.
> rubyencoder -o /home/myproject/encoded -b bak @filelist
|
Always quote file masks. Otherwise the command line shell will replace your mask with the real file and dir names and the result may be unexpected. You should always quote file masks that specify files to encode, copy or exclude in command line options (e.g. "*.rb").
Recursing subdirectories
You may use wildcards in source directory names, e.g. /path/to/dir??/*.rb This also works in @filelist and you may use it with -f, -c, -x. If the @filelist is specified as source, recursion is automatically turned on, but it's still possible to change the directory trimming level with -r{n} if necessary.
Optional directory trimming
Optional directory trimming level may be specified with -r{n} The default is 0 and means no trimming, this matches the mode used in previous versions of RubyEncoder. If n is specified, the encoder will remove n folder names from the beginning of file paths when encoding or copying the files to the target folder. This is similar to -p option of patch utility on Unix.
E.g. if you have the following directory structure in /source
/source/file0.rb
/source/dir1/file1.rb
/source/dir2/file21.rb
/source/dir2/file22.rb
and encoding to the /target with the following command
rgencoder -o /target -r /source
encoding with default -r or -r0 mode will create the following structure in the /target folder, i.e. the encoder recreates the full source path in the target
/target/source/file0.rb
/target/source/dir1/file1.rb
/target/source/dir2/file21.rb
/target/source/dir2/file22.rb
Now you may use -r{n} if you don't need to recreate a full source path structure in the target
rgencoder -o /target -r1 /source
and get the following file structure in the target
/target/file0.rb
/target/dir1/file1.rb
/target/dir2/file21.rb
/target/dir2/file22.rb
Now if you wonder why the default -r or -r0 option may be useful, consider the following example
/project1/file0.rb
/project1/dir1/file1.rb
/project1/dir2/file21.rb
/project1/dir2/file22.rb
/project2/file3.rb
/project2/dir4/file41.rb
/project2/dir4/file42.rb
/project2/dir5/file5.rb
Encoding with the following command in default mode works well
rgencoder -o /target -r /project1 /project2
/target/project1/file0.rb
/target/project1/dir1/file1.rb
/target/project1/dir2/file21.rb
/target/project1/dir2/file22.rb
/target/project2/file3.rb
/target/project2/dir4/file41.rb
/target/project2/dir4/file42.rb
/target/project2/dir5/file5.rb
While encoding with trimming will create a mess of files from both projects which is obviously not what one would expect
rgencoder -o /target -r1 /project1 /project2
/target/file0.rb
/target/dir1/file1.rb
/target/dir2/file21.rb
/target/dir2/file22.rb
/target/file3.rb
/target/dir4/file41.rb
/target/dir4/file42.rb
/target/dir5/file5.rb
So, you may use -r{n} when necessary, but the default mode with n=0 is still useful, safe and always produce an expected result.
|