Changeset 1132
- Timestamp:
- 07/30/07 11:38:33 (1 year ago)
- Files:
-
- ruport-www/ruport.html (modified) (1 diff)
- ruport/trunk/examples/tattle_rubygems_version.rb (modified) (2 diffs)
- ruport/trunk/examples/trac_ticket_status.rb (modified) (1 diff)
- ruport/trunk/lib/ruport/formatter/pdf.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ruport-www/ruport.html
r1129 r1132 33 33 </div> 34 34 <div id="mainContent"> 35 <h2>What is Ruport?</h2>36 35 37 <p>Ruby Reports (Ruport) is an extensible reporting system. It aims to 38 keep things as simple as possible while still providing the core 39 toolset you'll need for most reporting tasks.</p> 36 <h2>Simplify Your Reporting Tasks</h2> 40 37 41 <h2>What can Ruport do for me?</h2> 38 <p> 39 Reports come in all flavours, but the code to generate them usually 40 only comes in one: <i>monotony</i>. From simple data transformations to 41 highly customized printable reports, you are often faced with a 42 dilemma: Use a canned solution at the cost of full control, or begin 43 coding acres of glue code to tie together all the tools you'll need. 44 Of course, there is another option, and that is Ruby Reports. 45 </p> 42 46 43 <p>We provide a solid data model that can be easily hooked up to a number 44 of sources, including CSV files, ActiveRecord models, and raw SQL 45 connections through DBI.</p> 47 <h2>A Unique Approach to Reporting</h2> 46 48 47 <p>We also provide an insanely easy to extend formatting system which 48 provides a consistent interface as well as a set of helper functions 49 for a number of output types (HTML, PDF, CSV, and plain text).</p> 49 <p> 50 There are other reporting solutions out there that claim they have the 51 answer to all your business reporting problems. We're not in the 52 business of competing with those folks. In fact, you'll find that the 53 core of Ruby Reports, <b>ruport</b>, focuses almost entirely on the 54 underplumbing.</p> 50 55 51 <p>On top of that, Ruport offers a bunch of little tools to tie things 52 together and help you be more productively lazy. This includes a high 53 level report interface, as well as a code generator (rope) that will 54 help lay out a project for you and do other cool things like generate 55 boilerplate code and tests when needed. These tools can be found 56 in the ruport-util package.</p> 56 <p> 57 We provide standard data structures to allow you to 58 easily compare data from any number of sources, including CSV files, 59 ActiveRecord backed databases, and even raw SQL queries against legacy 60 databases. We also provide an extremely malleable formatting system 61 that lays the foundations for PDF,CSV,HTML,and Text based reports. To 62 help get you off the ground floor, we're also actively maintaining a 63 utilities package, <b>ruport-util</b>, which provides support for a range of 64 higher level features, such as invoice generation, report mailing, 65 graphing, code generation, and additional output formats. 66 </p> 57 67 58 <p>We're not aiming to be a comprehensive reporting solution: our primary 59 goal is to make reporting applications easier to build in Ruby, not 60 build them for you. That having been said, you can also find things like 61 basic support for graphing and invoices in our ruport-util package. 62 This is likely going to take a little while to build up and stabilize, 63 but it should be a good way to add higher level functionality to your 64 Ruport projects as time goes on.</p> 68 <p> 69 Although you won't find canned reports to do drill downs or data cubes 70 or any other specific task in Ruby Reports, you'll find that we've 71 made the sharpest knives in the drawer available to you. Instead of 72 spending your time building a foundation, you can quickly mix and 73 match our components, and then immediately begin to focus on your actual 74 task. 75 </p> 65 76 66 <h2>Get Ruport</h2>77 <h2>Getting Started</h2> 67 78 68 <p>Ruport and its dependencies:</p> 69 <pre>gem install ruport -y</pre> 79 <p> 80 The ruport and ruport-util packages are distributed as RubyGems so 81 installation is a snap: 82 </p> 70 83 71 <p>The Ruby Reports Utilities package (optional):</p> 72 <pre>gem install ruport-util -y</pre> 84 <pre> 85 gem install ruport -y 86 87 gem install ruport-util -y 88 </pre> 73 89 74 <h2>Need Help?</h2> 75 76 <p>If you're looking for help with Ruport or want to get involved with our 77 community, have a look at some of the 78 <a href="resources.html">Resources</a> we have available.</p> 79 80 <h2>Help Us</h2> 81 82 <p> 83 We always appreciate feedback from our users. You can make change 84 requests and submit bug reports on the 85 <a href="http://code.rubyreports.org">Trac site</a> 86 (use the account ruport / blinky to file tickets). 87 </p> 88 89 <p>We're also looking for a better hosting solution than our current 90 setup. If you have a VPS or dedicated host you could 91 donate to us, contact Gregory <em><gregory.t.brown at gmail.com></em> for 92 details.</p> 93 94 <h2>Enjoy!</h2> 95 96 <p>We hope Ruport is helpful to you. If you run into trouble or just 97 want to say hello, stop by #ruport on Freenode or send a message to our 98 <a href="http://list.rubyreports.org">mailing list</a>.</p> 99 90 <p> 91 To get a feel for how Ruport works, you may want to have a look at 92 some <a href="examples.html">simple examples</a>. 93 </p><p> 94 We are also actively developing <a href="http://ruportbook.com">a free-content book</a>, 95 which covers a range of topics and is updated regularly. Once 96 you've got your feet wet, you'll find the <a href="http://api.rubyreports.org">API documentation</a> 97 and our <a href="resources.html">other resources</a> helpful. 98 </p><p> 99 Please feel free to drop by the <a href="http://list.rubyreports.org">Ruport 100 mailing list</a> with any questions, problems, or suggestions. 101 </p> 100 102 </div> 101 103 <div id="secondaryContent"> 102 <a href='http://www.pledgie.com/campaigns/190'><img alt='Click here to lend your support to: Ruby Reports Documentation Effort and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/190.png?skin_name=chrome' border='0' /></a>103 <p class="badgeLabel">Support the Ruby Reports Documentation Effort</p>104 104 105 105 <h2>News</h2> ruport/trunk/examples/tattle_rubygems_version.rb
r984 r1132 1 1 # A dump of the database for this example can be found in ./data/tattle.dump 2 2 3 3 4 require "active_record" 4 5 require "ruport" 6 5 7 6 8 # Update with your connection parameters … … 32 34 end 33 35 34 sorted_table = rubygems_versions.sort_rows_by { |r| -r.count } 35 g = Grouping(sorted_table, :by => "platform") 36 sorted_table = rubygems_versions.sort_rows_by("count", :order => :descending) 37 sorted_table.reduce { |r| r["platform"] !~ /darwin/i } 38 g = Grouping(sorted_table, :by => "platform", :order => "name") 39 puts g.to_pdf 36 40 37 File.open("platforms_gems.html", "w") do |f|38 f.write g.to_html(:style => :justified)39 endruport/trunk/examples/trac_ticket_status.rb
r1104 r1132 55 55 timeline = "http://stonecode.svnrepository.com/ruport/trac.cgi/timeline" 56 56 57 report = TracSummaryReport.new(:timeline_uri => timeline, :days => 14)57 report = TracSummaryReport.new(:timeline_uri => timeline, :days => 30) 58 58 puts report.as(:text) 59 59 ruport/trunk/lib/ruport/formatter/pdf.rb
r1087 r1132 392 392 include DrawingHelpers 393 393 394 private 394 private 395 395 396 396 def apply_pdf_table_column_opts(table,table_data,format_opts) 397 column_opts = format_opts.delete(:column_options) 398 if column_opts 397 column_opts = format_opts.delete(:column_options) 398 heading_opts = column_opts.delete(:heading) 399 if column_opts 399 400 specific = get_specific_column_options(table_data.column_names, 400 column_opts) 401 columns = table_data.column_names.inject({}) { |s,c| 402 s.merge( c => ::PDF::SimpleTable::Column.new(c) { |col| 403 column_opts.each { |k,v| col.send("#{k}=",v) } 404 # use the specific column names now 401 column_opts) 402 columns = table_data.column_names.inject({}) { |s,c| 403 s.merge( c => ::PDF::SimpleTable::Column.new(c) { |col| 404 col.heading = create_heading(heading_opts) 405 column_opts.each { |k,v| col.send("#{k}=",v) } 406 # use the specific column names now 405 407 specific[c].each { |k,v| col.send("#{k}=",v) } 406 408 }) 407 } 409 } 408 410 table.columns = columns 409 end 410 end 411 end 412 end 411 413 412 414 def get_specific_column_options(column_names,column_opts) 413 column_names.inject({}) do |s,c| 414 s.merge(c => (column_opts.delete(c) || {})) 415 end 416 end 415 column_names.inject({}) do |s,c| 416 opts = column_opts.delete(c) || {} 417 if opts[:heading] 418 opts = opts.merge(:heading => create_heading(opts[:heading])) 419 end 420 s.merge(c => opts) 421 end 422 end 423 424 def create_heading(heading_opts) 425 heading_opts ||= {} 426 ::PDF::SimpleTable::Column::Heading.new {|head| 427 heading_opts.each {|k,v| head.send("#{k}=",v) } 428 } 429 end 417 430 418 431 def grouping_columns
