Page 1 of 1
Posted: 20 Jan 2007, 19:51
arto

==================================================================================
"Re-Volt tools" made by ajalkane september 2006
==================================================================================

*First Release: September 2006
---------------

*Current Release: 0.8.0 <-- January 2007
---------------

*Type: so complete library for managing Re-Volt tracks
------

*Idea: from ajalkane
------

*Description:
-------------
'Re-Volt tools' is a so easy and powerful library for Ruby programming
language. Yes, a lot of times there exist many operations you want to
do to custom tracks, like move them around, remove them, find information
about them, install them... but can be so hard if track managers don't
have ready function. Re-Volt tools library helps you so much in that works.


*What is it not:
----------------
Is not a track manager. Most people are much better off using Track Manager
or RRR Fast Manager. 'Re-Volt tools' is only for super power users when they
need to do customized operations or to automate things. Is not for normal
users or even power users.


*Who is for?
------------
'Re-Volt tools' is only for super power users. What is super power user?
someone with so many skills and special things he wants to do.

Think about it this way:
Track Manager - is for all users
RRR Fast Manager - is for power users
Re-Volt Tools - is for super power users


*Usage
------
To use 'Re-Volt tools' you create a new Ruby program that makes
the operations you want to. You just write the commands to a text
file and then run it. It also comes with some command-line tools
that can be used directly to do many things you want. But the greatest
power and flexibility is if you use the functions directly.
And is so easy! Look at some examples:


*Examples
---------

Listing all installed track names:

Code: Select all

 &nbsp; require 'revolt'

 &nbsp; levels = ReVolt&#58;&#58;Levels.installed
 &nbsp; levels.each_level do &#124;level&#124;
 &nbsp; &nbsp; puts "Level&#58; " + level.name
 &nbsp; end
Installing a track from a web-site:

Code: Select all

 &nbsp; require 'revolt'

 &nbsp; levels = ReVolt&#58;&#58;Levels.installed
 &nbsp; levels.install&#40;'http&#58;//url.for.track/trackname.zip'&#41;
Moving all non-favorite custom tracks to c:/removed:

Note that in this example the c:/removed folder has to exist. The favorite array has the level names of all your

favorite tracks that you want to keep, other custom tracks are removed. If a filename given as a parameter, reads the leves

from there. Since the favorite tracks are as strings and not as symbol, the level id is changed to string before comparison

(favorites.member?(level.id.to_s)

Code: Select all

 &nbsp; require 'revolt'

 &nbsp; favorites = &#91;
 &nbsp; &nbsp; 'alderon',
 &nbsp; &nbsp; 'sakura',
 &nbsp; &nbsp; 're-ville'
 &nbsp; &#93;

 &nbsp; if ARGV&#91;0&#93;
 &nbsp; &nbsp; favorites = open&#40;ARGV&#91;0&#93;&#41;.readlines.map {&#124;l&#124; l.chomp}
 &nbsp; end
 &nbsp; levels &nbsp;= ReVolt&#58;&#58;Levels.installed
 &nbsp; removed = ReVolt&#58;&#58;Levels.at&#40;'c&#58;/removed'&#41;
 &nbsp; removed.create_dir_structure
 &nbsp; levels.each_custom do &#124;level&#124;
 &nbsp; &nbsp; level.move_to&#40;removed&#41; if !favorites.member?&#40;level.id.to_s&#41;
 &nbsp; end

Installing everything that looks like URL

A bit more complex example. Reads input from the user and tries installing everything that looks like an URL first to

a temporary directory. From there copies tracks to installed tracks that do not exist already. This example is useful as it

stands for example to install track URLs that are copy pasted to a chat.

Code: Select all

 &nbsp; require 'revolt'
 &nbsp; levels &nbsp; &nbsp;= ReVolt&#58;&#58;Levels.installed
 &nbsp; tmplevels = ReVolt&#58;&#58;Levels.at&#40;'./tmp'&#41;
 &nbsp; tmplevels.create_dir_structure

 &nbsp; # Read input from console line by line
 &nbsp; STDIN.each_line do &#124;possible_urls&#124;
 &nbsp; &nbsp; tmplevels.install_urls&#40;possible_urls&#41;
 &nbsp; end

 &nbsp; # Copy the levels that have arrived to tmplevels
 &nbsp; # into installed levels
 &nbsp; tmplevels.each do &#124;level&#124;
 &nbsp; &nbsp; # Install only levels that do not exist already
 &nbsp; &nbsp; if levels.member? level
 &nbsp; &nbsp; &nbsp; puts "Skipping installing of " + level.to_s + " because it exists"
 &nbsp; &nbsp; else
 &nbsp; &nbsp; &nbsp; puts "Installing level " + level.to_s
 &nbsp; &nbsp; &nbsp; level.copy_to levels
 &nbsp; &nbsp; end
 &nbsp; end
Creating a zip of all installed custom levels that can be raced in reverse.

Code: Select all

 &nbsp; require 'revolt'

 &nbsp; levels = ReVolt&#58;&#58;Levels.installed

 &nbsp; pack_levels = &#91;&#93;
 &nbsp; levels.each_custom do &#124;level&#124;
 &nbsp; &nbsp; if level.reverse?
 &nbsp; &nbsp; &nbsp; pack_levels << level
 &nbsp; &nbsp; end
 &nbsp; end

 &nbsp; levels.package&#40;'reverse_custom.zip', pack_levels&#41;

*Applications
-------------

'Re-Volt tools' comes with many so powerful applications. See the API page
here: http://revolt.rubyforge.org for more descriptions, but here is a short
guide of what they do. Most of the applications accept three parameters that
are common in all:
-h (or --help) gives a help message
-b (or --base) gives the Re-Volt base directory, if not specified uses the one in registry
-m (or --match) when specifying several levels to operate on, gives the rule set to use for selecting.

1. rv_find_levels.rb
Can be used to find installed tracks. Examples:

rv_find_levels temple
rv_find_levels -m 'custom?,reverse?,farclip>10000'
rv_find_levels -m 'custom?,reverse?,farclip>10000'
rv_find_levels -m 'custom?,reverse?,farclip>10000'
rv_find_levels -m 'custom?' -m 'id=~^y'

First finds all levels whose name contains temple, second finds all
custom tracks that can be raced in reverse and that have FARCLIP over 10000,
third finds all custom tracks or tracks whose folder name starts with letter y

2. rv_install_level_urls.rb
Can be used to install URLs copy pasted from for example RV House chat.
Automatically downloads and installs all (zip) tracks that are not yet
installed.


3, rv_install_levels.rb
This installs all levels that are given as command line arguments. Usually
used for installing track packages that are on local disk, but it accepts also
URLs to tracks that are on web server. Usually rv_install_level_urls.rb is
better for installing tracks on web servers because it displays progress
of the download.

4. rv_info_levels.rb
Outputs information about the levels specified as command line options. For
example, gives information in easy to read format whether the track is a stock
or custom track, or if it can be raced in reverse or if it's a "Full Custom"
track. It takes similar arguments as rv_find_levels.rb, including the -m
option.

5. rv_delete_levels.rb
Accepts similar Can be used for finding levels with varying criteria. The most basic one finds
by the level name, for example:

6. rv_package_levels.rb
Creates (zip) packages of the levels given as argument. Also accepts the -m parameter
so that several levels can be created to zips at once.
Example:
rv_package_levels rvt chill
rv_package_levels -m custom?,reverse?

The first example creates two zips, rvt.zip and chill.zip, each containing the respective
track folders. The second creates a zip packet of each track that is custom and can be
raced in reverse. Each such track is deposited in its own .zip file named by the respective
track's id (folder name).

7. rv_rename_levels.rb
Renames a level and the necessary files. Usually only useful for the newbie tracks that
are named for example USER123:

rv_rename_levels.rb USER123 the_iguana_race

The above command line would rename an installed track with folder name USER123 to
a track with folder name the_iguana_race.

Used to package levels


*Installing
-----------
Installing is so easy.

1) First download and install Ruby One-Click installer from:
http://rubyforge.org/projects/rubyinstaller/

2) Open Command Prompt and run:
gem install rubyzip
gem install revolt

3) Try that it works by giving for example command
rv_find_levels.rb -m stock?
That will list all stock tracks you have installed.


Keep an eye that the latest version gets installed. When you a new version is released,
or you did not get the latest version by the above command, do this:

gem update revolt


*Documentation
--------------
Here is the API documentation and more information:

http://revolt.rubyforge.org


*Credits
--------
to RST for this README template

[/font]