Giter VIP home page Giter VIP logo

ruport's Introduction

Build Status Coverage Status

What Ruport Is

Ruby Reports (Ruport) is an extensible reporting system.

It aims to be as lightweight as possible while still providing core support for data aggregation and manipulation as well as multi-format rendering of reports.

Ruport provides tools for using a number of data sources, including CSV files, ActiveRecord models, and raw SQL connections via RubyDBI (through ruport-util).

Data manipulation is easy as there are standard structures that support record, table, and grouping operations. These all can be extended to implement custom behavior as needed.

For common tasks, Ruport provides formatters for CSV, HTML, PDF, and text- based reports. However, the real power lies in building custom report controllers and formatters. The base formatting libraries provide a number of helper functions that will let you build complex reports while maintaining a DRY and consistent interface.

To get a quick feel for what you can accomplish with Ruport, take a look at a few simple examples provided on our web site:

https://ruport.github.io/examples.html

Since Ruport's core support is intentionally minimalistic, you may be looking for some higher level support for specific needs such as graphing, invoices, report mailing support, etc. For this, you may wish to take a look at the ruport-util package, which contains some generally useful tools and libraries to extend Ruport's capabilities.

Installation

To install ruport via rubygems:

$ sudo gem install ruport

Check to see if it installed properly:

$ ruby -e "require 'ruport'; puts Ruport::VERSION"

If you get an error, please let us know on our mailing list.

Dependencies

Formatting

Ruport relies on PDF::Writer for its formatting support. If you want to make use of textile helpers, you'll also need RedCloth.

Database interaction

If you wish to use Ruport to report against a Rails project, you'll need ActiveRecord and the acts_as_reportable gem.

If you want to use Ruport::Query for raw SQL support, you'll need to install ruport-util, RubyDBI and whatever database drivers you might need.

Resources

Our developers have published a free-content book about all things Ruport, including complete coverage of acts_as_reportable and some of ruport-util's features. This book serves as the definitive guide to Ruport, so all users should become acquainted with it:

https://ruport.github.io

If you are looking to dig a little deeper, there are a couple more resources that may be helpful to you.

Hacking

If you'd like to contribute code to Ruport, fork the repository and open a PR!

We are very responsive to contributors, and review every patch we receive fairly quickly. Most contributors who successfully get a patch or two applied are given write access to the repositories and invited to join Ruport's development team. Since we view every user as potential contributor, this approach works well for us.

So if you want to help out with Ruport, we'll happy accept your efforts!

ruport's People

Contributors

64kramsystem avatar agios avatar batter avatar bradediger avatar darrenboyd avatar dverrier avatar gstark avatar hayesr avatar jhadvig avatar jrafanie avatar kbrock avatar map7 avatar maximkulkin avatar odaeus avatar practicingruby avatar sergiokas avatar taichi-ishitani avatar wpiekutowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruport's Issues

Compatibility with Ruby 1.9.2

Hi,

Thanks for a great gem.

I've read in another post that you're working on a 1.9.2 compatible version, which would be absolutely fantastic to have.

Are you still working on it, and if so, when do you then expect to release it?

Cheers,
Thomas

Gem package on Rubygems is corrupted

Hi all,

It looks like the Gemfile on Rubygems for v.1.7.0 is corrupted.

When I go to my gemdir, there are no code files in the Ruport directory,

 ~/.rvm/gems/ruby-2.3.4/gems  ls ruport-1.7.0
AUTHORS     COPYING     HACKING     LICENSE     README.rdoc Rakefile

Rails3 - BundlerIssues

Hi,
read your only open comment about moving the Table() method from Kernel to Ruport.. so i tried to add

gem 'ruport', :git=>"...", :branch=>"master"

in order to get the latest version including the changes... but when i try to "bundle install" i get the following error message:

Fetching source index for http://rubygems.org/
Could not find gem 'ruport (>= 0, runtime)' in git://github.com/ruport/ruport.git (at master).
Source does not contain any versions of 'ruport (>= 0, runtime)'

Do you have any idea about what i am missing?

Thx in advance!

Kind regards,
Ingo

Clean the unused variables in the Ruport codebase

There are several unused variables:

lib/ruport.rb:63: warning: assigned but unused variable - bufx
lib/ruport.rb:63: warning: assigned but unused variable - bufy
lib/ruport.rb:63: warning: assigned but unused variable - curx
lib/ruport.rb:63: warning: assigned but unused variable - cury
lib/ruport.rb:63: warning: assigned but unused variable - wattr
lib/ruport.rb:64: warning: assigned but unused variable - maxx
lib/ruport.rb:64: warning: assigned but unused variable - maxy
lib/ruport/data/grouping.rb:288: warning: assigned but unused variable - expected
lib/ruport/data/grouping.rb:330: warning: assigned but unused variable - group_name
lib/ruport/data/table.rb:141: warning: shadowing outer local variable - sum
lib/ruport/data/table.rb:78: warning: shadowing outer local variable - values
lib/ruport/formatter/prawn_pdf.rb:18: warning: method redefined; discarding old pdf

This also causes a warning, although it's a different issue:

lib/ruport.rb:80: warning: mismatched indentations at 'end' with 'begin' at 45

ruport.rb:38: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead

For some reason this error started showing up after upgrading to Ruby 2.7.1. This warning is seen with the latest version ruport 1.7.1.

.../lib/ruby/gems/2.7.0/gems/ruport-1.7.1/lib/ruport.rb:38: 
warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead

I have commented out the warning as mentioned in the following post: http://elmaskubilay.blogspot.com/2019/08/warning-win32api-is-deprecated-after.html

However is seems there should be a better way to resolve this.

Thanks!

Replacing Classes with Mixins

During my lastest couse for RMU, I did some refactoring to Ruport to replace the Controller and Formatter Classes into Modules so they can be used as Mixins. I also extracted a lot of subclasses/submodules into their own space. Please check out https://github.com/semmons99/ruport and let me know if you're interested at merging these changes. If you are, I can work on updating the documentation that would be affected by these changes.

NoMethodError (undefined method `Table' for main:Object)

The Ruport gem is failing to find the Table method. Using the example at https://ruport.github.io/examples.html we see the issue. I'm not sure if this is a bug or an issue with my configuration.

$ cat foo.csv
name,login time,machine
Gregory,10:00,bittle
Joe,11:45,soda
Jim,9:00,kitten
Joe,12:15,soda
Gregory,5:00,kitten
Joe,12:45,bittle

$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]

$ gem list ruport

*** LOCAL GEMS ***

ruport (1.7.1)

$ irb
>> require 'ruport'
=> true
>> t = Table("foo.csv")
Traceback (most recent call last):
        4: from /Users/davidhooey/.rvm/rubies/ruby-2.7.1/bin/irb:23:in `<main>'
        3: from /Users/davidhooey/.rvm/rubies/ruby-2.7.1/bin/irb:23:in `load'
        2: from /Users/davidhooey/.rvm/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
        1: from (irb):2
NoMethodError (undefined method `Table' for main:Object)
>>

Thanks!

Dependency on pdf-writer requires out-of-date hoe/rake

From @Nitrodist on #22:

@Odaeus with 1.6.3, ruport has a dependency on pdf-writer, which has a dependency on transaction-simple, which has a dependency on hoe, which has a runtime dependency on rake. @jherdman fixed it by updating hoe manually to a fixed hoe version.

How about a new release of ruport? The stuff in 1.6.3 is a little over 2 years old.

Below is the dependency chain:

vagrant@debian-squeeze64:/vagrant$ bundle exec gem dependency ruport
Gem ruport-1.6.3
  fastercsv (>= 0)
  pdf-writer (= 1.1.8)

Gem ruport-util-0.14.0
  mailfactory (>= 1.2.3)
  rubyzip (>= 0.9.1)
  ruport (>= 1.6.0)

vagrant@debian-squeeze64:/vagrant$ bundle exec gem dependency pdf-writer
Gem pdf-writer-1.1.8
  color (>= 1.4.0)
  transaction-simple (~> 1.3)

vagrant@debian-squeeze64:/vagrant$ bundle exec gem dependency transaction-simple
Gem transaction-simple-1.4.0
  hoe (>= 1.1.7)

vagrant@debian-squeeze64:/vagrant$ bundle exec gem dependency hoe
Gem hoe-2.12.3
  minitest (~> 2.5, development)
  rake (~> 0.8)

Changing data class in feeder.transform creates array

I'll do my best to describe the problem I am having. Check out column ver_id below. It is an array and it should not be.

@data=
 {:pcwgt_oz=>2.82,
  :idx=>1,
  :width=>10.5,
  :ver_id=>["01", 1], 

ver_id is an integer after executing the feeder, and has the value of one.

  vers.each {|idx,ver_id,msg,height,width,thick,pc_wgt,pc_wgt_oz,i,desc,k,l,m,n,qty|
    feeder << {
      :ver_id=>ver_id,

The table load has a feeder transform attached:

@vers = Ruport::Data::Table(
  [:ver_id,:idx,:desc,:height,:width,:thickness,:msg,:pcwgt,:pcwgt_oz,:qty]
) {|feeder|
  feeder.transform {|r|
    r.ver_id = coerce_num(r.ver_id),

And the method coerce_num is as follows:

def coerce_num(val)
  if val.class.to_s == 'Float'
    val.to_i.to_s
  else
    val.to_s
  end
end

After coerce_num has done its thing, it returns a string. After the feeder has completed, what was an integer becomes an array containing the transformed string value and the original integer value. That is what appears to be happening.

If I move the coerce_num call from the transform to the feeder directly, then everything is ok:

    feeder << {
      :ver_id=>coerce_num(ver_id),

@data=
 {:pcwgt_oz=>2.82,
  :idx=>1,
  :width=>10.5,
  :ver_id=>"01",

Thanks for your time,
dvn

Ruport and ActiveAdmin don't seem to work well together

Rails 3.0.10
Active Admin 0.3.4
Ruport 1.6.3

If ActiveAdmin is used in the app, rendering a Ruport::Data::Table with .to_html doesn't show any HTML, it just shows it as a string.

I'm guessing there is a naming conflict somewhere, but I'm having a problem finding it.

Evaluate Prawn 2.2.0 compatibility

Prawn 2.1 is almost two years old, so it would be good to extend the Ruport gemspec compatibility, if possible.

Will be confirmed on 01/Feb/2018.

Don't swallow legitimate NoMethodErrors in formatter initializers

If a formatter’s initialize method throws a NoMethodError, Ruport swallows this error in Ruport::Controller#use_formatter and instead raises an UnknownFormatError. This is misleading, as the formatter may be defined and just broken.

Test-driven fix at http://github.com/bradediger/ruport/commit/fcfd7cfa9f6bebaf0e694216a5b108bfab1292e5.

Executing InvoiceReport example fails in 1.9.2p180

I just installed ruport

gem install ruport ruport-util

Then I copied the invoice_report.rb from the examples (/usr/local/rvm/gems/ruby-1.9.2-p180@pdfkit/gems/ruport-util-0.14.0/example/invoice_report.rb) to my working directory and tried to execute it.

$ ruby invoice_report.rb 
/usr/local/rvm/gems/ruby-1.9.2-p180@pdfkit/gems/ruport-util-0.14.0/lib/ruport/util/graph/amline.rb:105: warning: undefining `object_id' may cause serious problems
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- generator (LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@pdfkit/gems/ruport-util-0.14.0/lib/ruport/util/query.rb:13:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@pdfkit/gems/ruport-util-0.14.0/lib/ruport/util.rb:22:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in `rescue in require'
    from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from invoice_report.rb:2:in `<main>'

I am using Ruby 1.9.2p180 with rvm. Installed gem versions of ruport are:

ruport (1.6.3)
ruport-util (0.14.0)

Any idea?

Ruport prints stty error if stdin is read.

Hi,

I have a program that read its data from stdin and then use report to print its result on stdout using the text formatter. This formatter calls stty size to get the terminal window width if the table width option is not set by the user. stty issues the following error message when the ruby program uses stdin:

stty: standard input: Inappropriate ioctl for device

For instance:

$ stty size
63 80
$ echo "FOO" | stty size
stty: standard input: Inappropriate ioctl for device
$ echo "FOO" | stty -F /dev/tty size
63 80

As you can see, it is possible to work around this problem by explicitly specifying the devise stty should use.

I have started to write a test like this:

require 'ruport'
tbl = Ruport::Data::Table.new(:column_names => [ :lines ])
$stdin.each{|line| tbl << line.strip }
puts tbl.to_text

and calling it like this: ruby -I lib test.rb from ruport root repository but I could not succeed to make it works. I am probably missing something here.

Kernel.Table method collides with global Table-method of Arel in Rails3

Kernel.Table method collides with global Table-method of Arel in Rails3. The global Table-method can in client code be replaced by Ruport::Data::Table.new (which has a different interface) - but methods like Pivot.to_table uses the Kernel.Table method and is broken (because Arels Table method interferes).

Exported CSV Rows Are Wrapped Every 992 Bytes

I am running Ruport under Ruby 1.9.3. There is an issue where long rows are wrapped into chunks (lines) of around 992 byes.

I have not been able to locate where the wrapping is taking place. Has anyone else had this issue? Is there solution to this problem?

Examples doesn't work

Hi
In README.rdoc you write about examples at rubyreports.org/examples.html
that URL is redirected to http://ww1.rubyreports.org/? and there are only Sponsored Listings, without examples.
Please check the site and the provided link.
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.