rock_books 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c30673728b99315fc841b99b96081751f91459663c736758b7340a317407cc56
4
- data.tar.gz: 751adad9c6038a85a696deb4076bbc93bbfb8a8650d53159aca691b281388d9f
3
+ metadata.gz: d37feeb3b20b730f06340d5e026dca81b564dc7cd6cb174a2d8bd0ffcbcb6441
4
+ data.tar.gz: 41a1e166136c536fde00512d8e624ce49c894766cd5f18ed673f8f67fdaf8908
5
5
  SHA512:
6
- metadata.gz: 84ff76b2001eed18b4f4ec69f9949720a4dbca892f41a4fa6b96ddda9e19dde5660b34c514568f5410a117df8afddf84c33bf23ba31256efc2bceccbdb06bd01
7
- data.tar.gz: 2214c3b52b24bf4b9b822059c4f41c67d7d3fc3a6fc666b8a073be79a794c769d1403d8f164085e382e1714320d71cbacd0673f591b26dd958e43f7b4cb1ab50
6
+ metadata.gz: 41e4511367107b2be92ff53eb28c42635884413c3fa91c010eee41a53da6ac94b3b9a8f7eccf3522610eee287008944d318f3250dcdc349544491dcb13dd515c
7
+ data.tar.gz: 45239916850fd6102b50c8ca719a2d336b0704a116c0c4f2af5014c5a061c8b6a6147f95811a88fe13f51e23f345baeb3eda16b0e789b9682596945b92ddabb4
@@ -1,3 +1,11 @@
1
+ ### v0.7.1
2
+
3
+ * Refactor report helpers.
4
+ * Improve/reduce text output during reporting.
5
+ * Add title to HTML reports.
6
+ * Minor fixes.
7
+
8
+
1
9
  ### v0.7.0
2
10
 
3
11
  * Dependencies on external commands in Linux and Mac OS for generating PDF and HTML files has been eliminated,
@@ -4,7 +4,7 @@ require 'ostruct'
4
4
 
5
5
  require_relative '../../rock_books'
6
6
  require_relative '../version'
7
- require_relative '../reports/helpers/reporter'
7
+ require_relative '../reports/helpers/text_report_helper'
8
8
  require_relative '../helpers/book_set_loader'
9
9
 
10
10
  module RockBooks
@@ -4,7 +4,6 @@ require 'os'
4
4
  require_relative 'chart_of_accounts'
5
5
  require_relative 'journal'
6
6
  require_relative '../filters/journal_entry_filters' # for shell mode
7
- require_relative '../helpers/html_helper'
8
7
  require_relative '../helpers/parse_helper'
9
8
  require_relative '../reports/book_set_reporter'
10
9
 
@@ -7,7 +7,7 @@ require_relative '../types/acct_amount'
7
7
  require_relative '../types/journal_entry_context'
8
8
  require_relative 'journal_entry'
9
9
  require_relative 'journal_entry_builder'
10
- require_relative '../reports/helpers/reporter'
10
+ require_relative '../reports/helpers/text_report_helper'
11
11
 
12
12
  module RockBooks
13
13
 
@@ -1,5 +1,5 @@
1
1
  require_relative 'helpers/erb_helper'
2
- require_relative 'helpers/reporter'
2
+ require_relative 'helpers/text_report_helper'
3
3
 
4
4
  module RockBooks
5
5
 
@@ -8,7 +8,7 @@ module RockBooks
8
8
  # in order to calculate the correct balances, so we ignore the global $filter.
9
9
  class BalanceSheet
10
10
 
11
- include Reporter
11
+ include TextReportHelper
12
12
  include ErbHelper
13
13
 
14
14
  attr_accessor :context, :data
@@ -11,7 +11,8 @@ require_relative 'journal_report'
11
11
  require_relative 'multidoc_txn_by_account_report'
12
12
  require_relative 'tx_one_account'
13
13
  require_relative 'helpers/erb_helper'
14
- require_relative 'helpers/reporter'
14
+ require_relative 'helpers/text_report_helper'
15
+ require_relative 'helpers/html_report_helper'
15
16
 
16
17
  require 'prawn'
17
18
 
@@ -109,16 +110,6 @@ class BookSetReporter
109
110
  end
110
111
 
111
112
 
112
- private def run_command(command)
113
- puts "\n----\nRunning command: #{command}"
114
- stdout, stderr, status = Open3.capture3(command)
115
- puts "Exit code was #{status.exitstatus}."
116
- puts "\nStdout was:\n\n#{stdout}" unless stdout.size == 0
117
- puts "\nStderr was:\n\n#{stderr}" unless stderr.size == 0
118
- puts
119
- end
120
-
121
-
122
113
  private def create_directories
123
114
  %w(txt pdf html).each do |format|
124
115
  dir = File.join(output_dir, format, SINGLE_ACCT_SUBDIR)
@@ -153,7 +144,6 @@ class BookSetReporter
153
144
  unicode_nonbreaking_space = "\u00A0"
154
145
  text(text.gsub(' ', unicode_nonbreaking_space))
155
146
  end
156
- puts "Finished generating #{pdf_filespec} with prawn."
157
147
  end
158
148
 
159
149
 
@@ -168,9 +158,9 @@ class BookSetReporter
168
158
  create_pdf_report = -> { prawn_create_document(pdf_filespec, text_report) }
169
159
 
170
160
  create_html_report = -> do
171
- data = { report_body: text_report }
161
+ data = { report_body: text_report, title: "#{short_name} Report -- RockBooks" }
172
162
  html_raw_report = ErbHelper.render_hashes("html/report_page.html.erb", data, {})
173
- html_report = HtmlHelper.convert_receipts_to_hyperlinks(html_raw_report, html_filespec)
163
+ html_report = HtmlReportHelper.convert_receipts_to_hyperlinks(html_raw_report, html_filespec)
174
164
  File.write(html_filespec, html_report)
175
165
  end
176
166
 
@@ -178,8 +168,7 @@ class BookSetReporter
178
168
  create_pdf_report.()
179
169
  create_html_report.()
180
170
 
181
-
182
- puts "Created reports in txt, html, and pdf for #{"%-20s" % short_name} at #{File.dirname(txt_filespec)}.\n\n\n"
171
+ puts "Created text, PDF, and HTML reports for #{short_name}."
183
172
  end
184
173
 
185
174
 
@@ -1,7 +1,7 @@
1
1
  module RockBooks
2
2
  class MultidocTxnByAccountData
3
3
 
4
- include Reporter
4
+ include TextReportHelper
5
5
 
6
6
  attr_reader :context, :account_code
7
7
 
@@ -1,7 +1,7 @@
1
1
  module RockBooks
2
2
  class TxOneAccountData
3
3
 
4
- include Reporter
4
+ include TextReportHelper
5
5
 
6
6
  attr_reader :context, :account_code, :account, :entries, :account_total, :totals
7
7
 
@@ -8,19 +8,14 @@ module ErbHelper
8
8
 
9
9
 
10
10
  def self.render_binding(erb_relative_filespec, template_binding)
11
- print "Rendering template #{erb_relative_filespec}..."
12
11
  result = erb_template(erb_relative_filespec).result(template_binding)
13
- puts 'done.'
14
12
  result
15
13
  end
16
14
 
17
15
  # Takes 2 hashes, one with data, and the other with presentation functions/lambdas, and passes their union to ERB
18
16
  # for rendering.
19
17
  def self.render_hashes(erb_relative_filespec, data_hash, presentation_hash)
20
- print "Rendering template #{erb_relative_filespec}..."
21
18
  combined_hash = (data_hash || {}).merge(presentation_hash || {})
22
- result = erb_template(erb_relative_filespec).result_with_hash(combined_hash)
23
- puts 'done.'
24
- result
19
+ erb_template(erb_relative_filespec).result_with_hash(combined_hash)
25
20
  end
26
21
  end
@@ -1,5 +1,5 @@
1
1
  module RockBooks
2
- module HtmlHelper
2
+ module HtmlReportHelper
3
3
 
4
4
  def self.convert_receipts_to_hyperlinks(original_html_string, html_filespec)
5
5
  html_lines = original_html_string.split("\n")
@@ -2,7 +2,7 @@ require_relative '../../documents/journal_entry'
2
2
  require_relative 'erb_helper'
3
3
 
4
4
  module RockBooks
5
- module Reporter
5
+ module TextReportHelper
6
6
 
7
7
  SHORT_NAME_MAX_LENGTH = 16
8
8
 
@@ -1,12 +1,12 @@
1
1
  require_relative 'helpers/erb_helper'
2
- require_relative 'helpers/reporter'
2
+ require_relative 'helpers/text_report_helper'
3
3
 
4
4
  module RockBooks
5
5
 
6
6
 
7
7
  class IncomeStatement
8
8
 
9
- include Reporter
9
+ include TextReportHelper
10
10
  include ErbHelper
11
11
 
12
12
  attr_reader :data, :context
@@ -1,12 +1,12 @@
1
1
  require_relative 'data/journal_data'
2
2
  require_relative 'helpers/erb_helper'
3
- require_relative 'helpers/reporter'
3
+ require_relative 'helpers/text_report_helper'
4
4
 
5
5
  module RockBooks
6
6
 
7
7
  class JournalReport
8
8
 
9
- include Reporter
9
+ include TextReportHelper
10
10
  include ErbHelper
11
11
 
12
12
  attr_accessor :context, :report_data
@@ -1,6 +1,6 @@
1
1
  require_relative '../documents/chart_of_accounts'
2
2
  require_relative 'helpers/erb_helper'
3
- require_relative 'helpers/reporter'
3
+ require_relative 'helpers/text_report_helper'
4
4
  require_relative 'report_context'
5
5
  require_relative 'data/multidoc_txn_by_account_data'
6
6
 
@@ -8,7 +8,7 @@ module RockBooks
8
8
 
9
9
  class MultidocTransactionByAccountReport
10
10
 
11
- include Reporter
11
+ include TextReportHelper
12
12
  include ErbHelper
13
13
 
14
14
  attr_reader :context, :data
@@ -1,14 +1,14 @@
1
1
  require_relative 'data/multidoc_txn_report_data'
2
2
  require_relative '../documents/journal'
3
3
  require_relative 'helpers/erb_helper'
4
- require_relative 'helpers/reporter'
4
+ require_relative 'helpers/text_report_helper'
5
5
  require_relative 'report_context'
6
6
 
7
7
  module RockBooks
8
8
 
9
9
  class MultidocTransactionReport
10
10
 
11
- include Reporter
11
+ include TextReportHelper
12
12
  include ErbHelper
13
13
 
14
14
  attr_reader :context, :data
@@ -4,7 +4,7 @@ require_relative 'report_context'
4
4
  module RockBooks
5
5
  class ReceiptsReport
6
6
 
7
- include Reporter
7
+ include TextReportHelper
8
8
 
9
9
  attr_reader :context, :data
10
10
 
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title></title>
4
+ <title><%= title %></title>
5
5
  <meta name="generator" content="RockBooks Accounting"/>
6
6
  </head>
7
7
  <body>
@@ -2,14 +2,14 @@ require_relative 'data/tx_one_account_data'
2
2
  require_relative '../documents/chart_of_accounts'
3
3
  require_relative '../documents/journal'
4
4
  require_relative 'helpers/erb_helper'
5
- require_relative 'helpers/reporter'
5
+ require_relative 'helpers/text_report_helper'
6
6
  require_relative 'report_context'
7
7
 
8
8
  module RockBooks
9
9
 
10
10
  class TxOneAccount
11
11
 
12
- include Reporter
12
+ include TextReportHelper
13
13
  include ErbHelper
14
14
 
15
15
  attr_reader :context, :account_code, :data
@@ -1,3 +1,3 @@
1
1
  module RockBooks
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_books
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bennett
@@ -145,7 +145,6 @@ files:
145
145
  - lib/rock_books/filters/acct_amount_filters.rb
146
146
  - lib/rock_books/filters/journal_entry_filters.rb
147
147
  - lib/rock_books/helpers/book_set_loader.rb
148
- - lib/rock_books/helpers/html_helper.rb
149
148
  - lib/rock_books/helpers/parse_helper.rb
150
149
  - lib/rock_books/reports/balance_sheet.rb
151
150
  - lib/rock_books/reports/book_set_reporter.rb
@@ -157,7 +156,8 @@ files:
157
156
  - lib/rock_books/reports/data/receipts_report_data.rb
158
157
  - lib/rock_books/reports/data/tx_one_account_data.rb
159
158
  - lib/rock_books/reports/helpers/erb_helper.rb
160
- - lib/rock_books/reports/helpers/reporter.rb
159
+ - lib/rock_books/reports/helpers/html_report_helper.rb
160
+ - lib/rock_books/reports/helpers/text_report_helper.rb
161
161
  - lib/rock_books/reports/income_statement.rb
162
162
  - lib/rock_books/reports/journal_report.rb
163
163
  - lib/rock_books/reports/multidoc_txn_by_account_report.rb