Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] Getopt-Declare 1.12 (gem/zip) and GGEnv (gem/zip)

Thread Tools

[ANN] Getopt-Declare 1.12 (gem/zip) and GGEnv (gem/zip)

Posts: n/a
There's a new bug fix release of Getopt-Declare, the port of Perl's
module by the same name.
This is a simple command parser using regexes where the help
documentation *is* the parser.
This version fixes some casting bug with private types and improves the
performance of parsing isolated flags a little.

This is a simple for manipulation of environment variables that deals
with paths, using all of ruby's array functionality.
It should work properly across different platforms.

When loaded, it creates a module called Env.

Within it, it defines methods for [] and []=, so that you can do the

Env.check_directories = false # turn off verification that
# directories exist (default: true)
path = Env['PATH']

path << "C:/newpath" # As path is modified, so
# is ENV['PATH']

path.delete_if { |x| x =~ /maya/ } # remove all paths that have maya

path.unshift ["C:/", "E:/bin"] # add these paths at start

Env['PATH'] = path[0,2] + path[4,6] # concat two slices

path.check_directories # check existance of directories
# for this variable only (unlike
# Env.check_directories = true)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM