Project

rube

0.0
No commit activity in last 3 years
No release in over 3 years
Rube -- Slightly smarter erb front-end Rube allows you to apply erb to templates, interspersed with other ruby code, either as inline source or as ruby files (e.g. requires). Rube can be invoked from the command line as a command in the form: rube [options] task ...
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.8.0
>= 1.4.1
 Project Readme

rube¶ ↑

DESCRIPTION:¶ ↑

Rube -- Slightly smarter erb front-end

Rube allows you to apply erb to templates, interspersed with other ruby code, either as inline source or 	
as ruby files (e.g. requires). Rube can be invoked from the command line as a command in the form:

  rube [options] task ...

FEATURES/PROBLEMS:¶ ↑

  • Can be invoked from command line or via the Ruby API from within a Ruby script

  • Can process inline ruby code, ruby libraries, and erb templates

  • Information is persistent across tasks: e.g. subsequent templates can refer to results of previous tasks

SYNOPSIS:¶ ↑

Rube can be invoked from the command line as a command in the form:

  rube [options] task ...

or as part of a ruby script, as in:

  require 'rube'
  rube = Rube.new
  rube.add_task(:require, 'active_record')
  rube.add_task(:template, 'foo')
  rube.generate

In either case, tasks may be erb templates, ruby files, or inline ruby code. Each of the tasks is 
performed in the order specified and variables, constants etc. are preserved across tasks (including 
local variables) so that subsequent tasks can refer to the the results of earlier tasks. This makes it 
simpler to use erb templates against arbitrary data. For instance:

  rube -r active_support -r yaml -e "document=YAML.load(IO.read('document.yml))" --trim 2 --stdin convert_to_textile.erb

would process the template on stdin followed by the template in convert_to_textile.erb, having already 
loaded the active_support and yaml libraries, and having loaded the YAML file document.yml and parsed it 
into a Ruby variable named document, where the information could easily be referred to in the template. 
This all would be done at erb trim level 2.

See rdoc or source for more information, or type the command:

  rube --help

REQUIREMENTS:¶ ↑

  • None

INSTALL:¶ ↑

  • sudo gem install rube

LICENSE:¶ ↑

(The MIT License)

Copyright © 2009 Richard LeBer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.