Forum: Ruby Ruport 0.2.9: Taggable DataSets, FasterCSV integration, and

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
gregory.t.brown (Guest)
on 2005-11-29 05:53
(Received via mailing list)
Hello again,

Seeing as it's been more than 3 days since the last Ruport release, I
felt the need to really supe this one up.  With a brand new set of
examples, a 666 line walkthrough, 16 entries on the changelog and a
huge chunk of the TODO list blasted away, I think it's suped up enough
for now.

So... on with one of those release announcements we all love so much....

Skip to the bottom for download information and documentation / examples
/ etc

=== What is Ruport?

Ruport is both a report generation / formatting framework and library.
 It aims to be highly customizable and easily extended to make the
generation of professional grade reports from various datasources a
quick, clean, and painless process.  It is currently alpha software
but is already quite useful for various reporting needs, from CSV and
HTML output of SQL queries to YAML dumping and restoration of DataSets
to building custom reports.

=== Release Notes

This will actually be the last stride towards a major release for at
least a month, so please get those bug reports, feature requests, and
other sorts of ideas out in the open.   0.3.0 may be the LAST alpha
release of Ruport, ( Ruby Reports 0.5.0 Beta is slated to come out
around the new year ), so be sure to throw your wacky ideas in while
Ruport is still young.

[ MY SPECIFIC BEG FOR HELP IS FOR SOMEONE TO WRITE A TUTORIAL! ]

=== Short Example

this one liner would output the table foo as html to STDOUT using
Ruport's framework

  @report = query("SELECT * FROM foo").to_html

=== Long Example

This code is from the example package and shows off a number of
Ruport's key features such as tagging and whatnot

[ code ]
# This is an example of how you can predefine tag conditions
tags = {
  :new_england => lambda { |data|
     data.select { |r| %w[ CT NH RI VT MA ME ].include?(r["state"]) } },
  :ghosts => lambda { |data|
     data.select { |r| %w[ Inky Blinky Clyde ].include?(r["name"]) } }
}

# This is doing the actual query and the logic of pruning based on tag
query("SELECT * FROM address_book") do |data|
  data.apply_tags(tags)
  ghosts_in_ne = data.select { |row|
    row.tags.include?(:new_england) and
    row.tags.include?(:ghosts) }.map { |r| r["name"] }

  # anything that gets stuffed in @report will automatically be
outputted and
  # emailed by default.
  @report = "We found these ghosts in New England:
#{ghosts_in_ne.join(', ')}"
  @report << "\n\nThis is the data we used:\n#{data}"
end

# This will automatically become the title of emailed reports.
@report_name = "Ghosts in New England"

# Yep... there it is.   The mailing system.  Complex... isn't it?
@mailer.recipients = %w[ removed_email_address@domain.invalid 
removed_email_address@domain.invalid ]

# But if you wanted something other than the contents of @report...
# just override @mailer.body with your contents.

[/code]

=== What's new in this Release:

A ton!   You can now make use of DataSet tagging (as shown above), set
labels for DSNs and use multiple DSNs in a single report, generate
HTML or CSV or Plaintext output with headers and footers, use
FasterCSV so that your CSVs generate quicker, take advantage of the -t
flag to run the tests during install time, read through the 666 line
walkthrough in the example package and more!

See the Changelog for details:
http://rubyforge.org/frs/shownotes.php?group_id=85...

=== Requirements

Ruport relies on Ruby DBI for all of it's  DBMS interaction.   It is
possible to use the Ruport formatting library without installing DBI,
but it is not recommended.

Also, because Ruport needs to deal with very large datasets
efficiently, it uses James Edward G. II's FasterCSV for it's CSV
operations.   This is a gem, so it can easily be installed with the
--include-dependencies flag

=== Get it

on *nix:

   sudo gem install ruport -t

windows:

  gem install ruport -t

=== More Resources

Example Package: (Highly Recommended!)

http://rubyforge.org/frs/?group_id=856&release_id=3656

Source:

http://rubyforge.org/frs/?group_id=856&release_id=3657

Documentation:
http://ruport.rubyforge.org/docs/

CVS info (Current module: dev-ruport)
http://rubyforge.org/scm/?group_id=856

News:
http://stonecode.org/blog


=== Thanks!
This topic is locked and can not be replied to.