Class: Proptax::CLI
- Inherits:
-
Thor
- Object
- Thor
- Proptax::CLI
- Defined in:
- lib/proptax/cli.rb
Instance Method Summary collapse
- #auto(dir) ⇒ Object
- #consolidate(dir) ⇒ Object
- #filter(csv) ⇒ Object
-
#reports(dir) ⇒ Object
method_option *consolidate_options.
Instance Method Details
#auto(dir) ⇒ Object
45 46 47 48 49 |
# File 'lib/proptax/cli.rb', line 45 def auto(dir) `proptax consolidate #{dir} > consolidated.csv` Proptax::Generators::Report.start(['consolidated.csv', ]) generate_material("reports") end |
#consolidate(dir) ⇒ Object
23 24 25 |
# File 'lib/proptax/cli.rb', line 23 def consolidate(dir) Proptax::Consolidator.process(dir) end |
#filter(csv) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/proptax/cli.rb', line 60 def filter(csv) data_frame = `Rscript "#{__dir__}"/../R/filter_csv.R "#{csv}"` if [:csv] lines = data_frame.split("\n") # Print header puts lines[0].squeeze(' ').split(' ').to_csv if [:header] # Print data (minus R-inserted integer row name) lines[1..-1].each do |line| puts line.squeeze(' ').split(' ')[1..-1].to_csv end else puts data_frame end end |
#reports(dir) ⇒ Object
method_option *consolidate_options
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/proptax/cli.rb', line 31 def reports(dir) csv_file = 'consolidated.csv' if .consolidate? `proptax consolidate #{dir} > #{csv_file}` else csv_file = "#{dir}/consolidated.csv" end Proptax::Generators::Report.start([csv_file, ]) generate_material("reports") end |