aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2014-11-14 10:49:59 +0100
committerHarald Eilertsen <haraldei@anduin.net>2014-11-14 10:49:59 +0100
commit84dfb2f6a63ad68641c83c72e5fa17671579b296 (patch)
treec642563a67a2c7050484950ef819782f236dd35a
parentc78c80e41609e4aa138b4c34047eccaa92d8196a (diff)
downloadimusician-reports-84dfb2f6a63ad68641c83c72e5fa17671579b296.tar.gz
imusician-reports-84dfb2f6a63ad68641c83c72e5fa17671579b296.tar.bz2
imusician-reports-84dfb2f6a63ad68641c83c72e5fa17671579b296.zip
Automatically load all report classes.
-rw-r--r--parse_report.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/parse_report.rb b/parse_report.rb
index ad000bc..b8a2bcc 100644
--- a/parse_report.rb
+++ b/parse_report.rb
@@ -1,7 +1,4 @@
require 'sale'
-require 'reports/sales_by_date'
-require 'reports/sales_by_country'
-require 'reports/sales_by_shop'
require 'csv'
csv_opts = {
@@ -19,6 +16,14 @@ CSV.foreach(ARGV[0], csv_opts) do |row|
end
end
+def load_reports
+ Dir[File.join('lib', 'reports', '*.rb')].each do |f|
+ require File.expand_path(f, File.dirname(__FILE__))
+ end
+end
+
+load_reports
+
SalesReporter::Reports::SalesByDate.render(sales)
SalesReporter::Reports::SalesByCountry.render(sales)
SalesReporter::Reports::SalesByShop.render(sales)