thinreports 0.10.0 → 0.12.0
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 +5 -5
- data/.github/CONTRIBUTING.md +2 -2
- data/.github/workflows/test.yml +51 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +49 -0
- data/Dockerfile +12 -0
- data/Gemfile +2 -1
- data/README.md +46 -21
- data/Rakefile +13 -29
- data/gemfiles/prawn-2.2.gemfile +5 -0
- data/gemfiles/prawn-2.3.gemfile +5 -0
- data/gemfiles/prawn-2.4.gemfile +5 -0
- data/lib/thinreports.rb +5 -0
- data/lib/thinreports/core/shape.rb +4 -3
- data/lib/thinreports/core/shape/base/interface.rb +0 -1
- data/lib/thinreports/core/shape/basic/format.rb +5 -0
- data/lib/thinreports/core/shape/image_block.rb +1 -1
- data/lib/thinreports/core/shape/list.rb +1 -1
- data/lib/thinreports/core/shape/list/manager.rb +1 -4
- data/lib/thinreports/core/shape/list/page.rb +2 -5
- data/lib/thinreports/core/shape/manager/internal.rb +0 -1
- data/lib/thinreports/core/shape/page_number.rb +1 -1
- data/lib/thinreports/core/shape/page_number/internal.rb +0 -1
- data/lib/thinreports/core/shape/stack_view.rb +17 -0
- data/lib/thinreports/core/shape/stack_view/format.rb +27 -0
- data/lib/thinreports/core/shape/stack_view/interface.rb +17 -0
- data/lib/thinreports/core/shape/stack_view/internal.rb +22 -0
- data/lib/thinreports/core/shape/stack_view/row_format.rb +39 -0
- data/lib/thinreports/core/shape/style/basic.rb +4 -1
- data/lib/thinreports/core/shape/text.rb +1 -1
- data/lib/thinreports/core/shape/text_block.rb +1 -1
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +21 -9
- data/lib/thinreports/core/shape/text_block/internal.rb +0 -2
- data/lib/thinreports/core/utils.rb +6 -3
- data/lib/thinreports/generate.rb +11 -0
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +31 -11
- data/lib/thinreports/generator/pdf/document/draw_template_items.rb +1 -2
- data/lib/thinreports/generator/pdf/document/font.rb +16 -10
- data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +0 -1
- data/lib/thinreports/generator/pdf/document/graphics/basic.rb +0 -1
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +19 -1
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +10 -8
- data/lib/thinreports/generator/pdf/document/page.rb +13 -4
- data/lib/thinreports/generator/pdf/drawer/list.rb +0 -1
- data/lib/thinreports/generator/pdf/prawn_ext/calc_image_dimensions.rb +1 -3
- data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +7 -7
- data/lib/thinreports/layout/base.rb +2 -4
- data/lib/thinreports/layout/format.rb +0 -1
- data/lib/thinreports/layout/legacy_schema.rb +2 -6
- data/lib/thinreports/layout/version.rb +1 -1
- data/lib/thinreports/report/internal.rb +4 -4
- data/lib/thinreports/report/page.rb +2 -7
- data/lib/thinreports/section_report/build.rb +32 -0
- data/lib/thinreports/section_report/builder/item_builder.rb +49 -0
- data/lib/thinreports/section_report/builder/report_builder.rb +82 -0
- data/lib/thinreports/section_report/builder/report_data.rb +13 -0
- data/lib/thinreports/section_report/builder/stack_view_builder.rb +55 -0
- data/lib/thinreports/section_report/builder/stack_view_data.rb +11 -0
- data/lib/thinreports/section_report/generate.rb +26 -0
- data/lib/thinreports/section_report/pdf/render.rb +23 -0
- data/lib/thinreports/section_report/pdf/renderer/draw_item.rb +68 -0
- data/lib/thinreports/section_report/pdf/renderer/group_renderer.rb +57 -0
- data/lib/thinreports/section_report/pdf/renderer/headers_renderer.rb +24 -0
- data/lib/thinreports/section_report/pdf/renderer/section_height.rb +100 -0
- data/lib/thinreports/section_report/pdf/renderer/section_renderer.rb +39 -0
- data/lib/thinreports/section_report/pdf/renderer/stack_view_renderer.rb +55 -0
- data/lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb +38 -0
- data/lib/thinreports/section_report/schema/loader.rb +28 -0
- data/lib/thinreports/section_report/schema/parser.rb +52 -0
- data/lib/thinreports/section_report/schema/report.rb +30 -0
- data/lib/thinreports/section_report/schema/section.rb +47 -0
- data/lib/thinreports/version.rb +1 -1
- data/thinreports.gemspec +11 -11
- metadata +48 -164
- data/.rubocop.yml +0 -41
- data/.travis.yml +0 -17
- data/examples/character_spacing/character_spacing.rb +0 -8
- data/examples/character_spacing/character_spacing.tlf +0 -293
- data/examples/dynamic_image/dynamic_image.rb +0 -31
- data/examples/dynamic_image/dynamic_image.tlf +0 -661
- data/examples/dynamic_image/img200x100.png +0 -0
- data/examples/dynamic_image/img50x50.png +0 -0
- data/examples/dynamic_style/dynamic_style.rb +0 -150
- data/examples/dynamic_style/dynamic_style.tlf +0 -1835
- data/examples/dynamic_style/dynamic_style_in_list.tlf +0 -344
- data/examples/dynamic_style/image.png +0 -0
- data/examples/eudc/eudc.rb +0 -20
- data/examples/eudc/eudc.tlf +0 -180
- data/examples/eudc/eudc.ttf +0 -0
- data/examples/helper.rb +0 -50
- data/examples/hidden_shapes/hidden_shapes.rb +0 -9
- data/examples/hidden_shapes/hidden_shapes.tlf +0 -449
- data/examples/list_events/list_events.rb +0 -32
- data/examples/list_events/list_events.tlf +0 -361
- data/examples/list_manual_generation/list_manual_generation.rb +0 -22
- data/examples/list_manual_generation/list_manual_generation.tlf +0 -132
- data/examples/list_page_number/list_page_number.rb +0 -17
- data/examples/list_page_number/list_page_number.tlf +0 -254
- data/examples/page_number/page_number.rb +0 -33
- data/examples/page_number/page_number.tlf +0 -215
- data/examples/palleted_png/palleted_png.png +0 -0
- data/examples/palleted_png/palleted_png.rb +0 -9
- data/examples/palleted_png/palleted_png.tlf +0 -47
- data/examples/password_setting/password_setting.rb +0 -10
- data/examples/password_setting/password_setting.tlf +0 -45
- data/examples/report_callbacks/report_callbacks.rb +0 -14
- data/examples/report_callbacks/report_callbacks.tlf +0 -147
- data/examples/single_line_tblock/single_line_tblock.rb +0 -13
- data/examples/single_line_tblock/single_line_tblock.tlf +0 -170
- data/examples/tblock_overflow/tblock_overflow.rb +0 -20
- data/examples/tblock_overflow/tblock_overflow.tlf +0 -538
- data/examples/tblock_styles/font_size.tlf +0 -383
- data/examples/tblock_styles/tblock_styles.rb +0 -43
- data/examples/tblock_styles/tblock_styles.tlf +0 -889
- data/examples/text_align/text_align.rb +0 -8
- data/examples/text_align/text_align.tlf +0 -241
- data/examples/typeB_page_size/B4_ISO.tlf +0 -45
- data/examples/typeB_page_size/B4_JIS.tlf +0 -45
- data/examples/typeB_page_size/typeB_page_size.rb +0 -17
- data/examples/word_wrap/word_wrap.rb +0 -26
- data/examples/word_wrap/word_wrap.tlf +0 -297
- data/test/data/font.ttf +0 -0
- data/test/data/image_normal.jpg +0 -0
- data/test/data/image_normal.png +0 -0
- data/test/data/image_normal_jpg_noext +0 -0
- data/test/data/image_normal_png_noext +0 -0
- data/test/data/image_pallete_based.png +0 -0
- data/test/data/legacy_layout/all-items.tlf +0 -1
- data/test/schema_helper.rb +0 -122
- data/test/test_helper.rb +0 -48
- data/test/tmp/.gitkeep +0 -0
- data/test/unit/core/format/test_base.rb +0 -152
- data/test/unit/core/shape/base/test_internal.rb +0 -87
- data/test/unit/core/shape/basic/test_block_format.rb +0 -23
- data/test/unit/core/shape/basic/test_block_interface.rb +0 -29
- data/test/unit/core/shape/basic/test_block_internal.rb +0 -55
- data/test/unit/core/shape/basic/test_format.rb +0 -37
- data/test/unit/core/shape/basic/test_interface.rb +0 -108
- data/test/unit/core/shape/basic/test_internal.rb +0 -55
- data/test/unit/core/shape/image_block/test_interface.rb +0 -24
- data/test/unit/core/shape/image_block/test_internal.rb +0 -31
- data/test/unit/core/shape/list/test_format.rb +0 -111
- data/test/unit/core/shape/list/test_manager.rb +0 -67
- data/test/unit/core/shape/list/test_page.rb +0 -82
- data/test/unit/core/shape/list/test_page_state.rb +0 -31
- data/test/unit/core/shape/list/test_section_format.rb +0 -36
- data/test/unit/core/shape/list/test_section_interface.rb +0 -75
- data/test/unit/core/shape/list/test_section_internal.rb +0 -50
- data/test/unit/core/shape/manager/test_format.rb +0 -38
- data/test/unit/core/shape/manager/test_internal.rb +0 -132
- data/test/unit/core/shape/manager/test_target.rb +0 -140
- data/test/unit/core/shape/page_number/test_format.rb +0 -55
- data/test/unit/core/shape/page_number/test_interface.rb +0 -33
- data/test/unit/core/shape/page_number/test_internal.rb +0 -81
- data/test/unit/core/shape/styles/test_base.rb +0 -191
- data/test/unit/core/shape/styles/test_basic.rb +0 -24
- data/test/unit/core/shape/styles/test_graphic.rb +0 -50
- data/test/unit/core/shape/styles/test_text.rb +0 -97
- data/test/unit/core/shape/text/test_format.rb +0 -44
- data/test/unit/core/shape/text/test_internal.rb +0 -20
- data/test/unit/core/shape/text_block/formatter/test_basic.rb +0 -24
- data/test/unit/core/shape/text_block/formatter/test_datetime.rb +0 -49
- data/test/unit/core/shape/text_block/formatter/test_number.rb +0 -76
- data/test/unit/core/shape/text_block/formatter/test_padding.rb +0 -77
- data/test/unit/core/shape/text_block/test_format.rb +0 -169
- data/test/unit/core/shape/text_block/test_formatter.rb +0 -28
- data/test/unit/core/shape/text_block/test_interface.rb +0 -63
- data/test/unit/core/shape/text_block/test_internal.rb +0 -128
- data/test/unit/core/test_shape.rb +0 -52
- data/test/unit/core/test_utils.rb +0 -68
- data/test/unit/generator/pdf/document/graphics/test_attributes.rb +0 -135
- data/test/unit/generator/pdf/document/graphics/test_basic.rb +0 -46
- data/test/unit/generator/pdf/document/graphics/test_image.rb +0 -46
- data/test/unit/generator/pdf/document/graphics/test_text.rb +0 -171
- data/test/unit/generator/pdf/document/test_font.rb +0 -84
- data/test/unit/generator/pdf/document/test_graphics.rb +0 -42
- data/test/unit/generator/pdf/document/test_page.rb +0 -122
- data/test/unit/generator/pdf/document/test_parse_color.rb +0 -30
- data/test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +0 -41
- data/test/unit/generator/pdf/prawn_ext/test_width_of.rb +0 -22
- data/test/unit/generator/pdf/test_document.rb +0 -22
- data/test/unit/generator/test_pdf.rb +0 -26
- data/test/unit/layout/test_base.rb +0 -41
- data/test/unit/layout/test_format.rb +0 -100
- data/test/unit/layout/test_legacy_schema.rb +0 -574
- data/test/unit/layout/test_version.rb +0 -26
- data/test/unit/report/test_base.rb +0 -248
- data/test/unit/report/test_internal.rb +0 -206
- data/test/unit/test_config.rb +0 -36
- data/test/unit/test_layout.rb +0 -12
- data/test/unit/test_report.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 9713f8331c7d6c97d17f0b30ba84124148f48ed40d3fde29f884503146415ed0
|
|
4
|
+
data.tar.gz: 0617cb86495f89090b6f751334aed7fd69c42b79357683992ac65d3ee0dc72e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37bd09438b27f1147c9803b0236bac461c0d5c08844bff920e7a183bd3f09912f157bf66c6ad246ece7a8c8041fd559a18495c56a22550459e15e357b60355c9
|
|
7
|
+
data.tar.gz: 43fd24534374c1c63162cece99c12622c5bdab0fce12c9f8c7b9e82d985ec50fc0b1fa388f1b67658ae3892e6b9d97350fada88ef6c48021c4dedecff128e910
|
data/.github/CONTRIBUTING.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
If you have a support question about how to use thinreports, please [ask on
|
|
1
|
+
We only accept bug reports and pull requests in GitHub.
|
|
2
|
+
If you have a support question about how to use thinreports, please [ask on GitHub Discussions](https://github.com/thinreports/thinreports/discussions).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
name: Test against ruby ${{ matrix.ruby }} and prawn ${{ matrix.prawn }}
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
ruby:
|
|
12
|
+
- 2.5
|
|
13
|
+
- 2.6
|
|
14
|
+
- 2.7
|
|
15
|
+
- 3.0
|
|
16
|
+
- jruby
|
|
17
|
+
prawn:
|
|
18
|
+
- 2.2
|
|
19
|
+
- 2.3
|
|
20
|
+
- 2.4
|
|
21
|
+
exclude:
|
|
22
|
+
- ruby: 3.0
|
|
23
|
+
prawn: 2.2
|
|
24
|
+
- ruby: 3.0
|
|
25
|
+
prawn: 2.3
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v1
|
|
29
|
+
|
|
30
|
+
- name: Set up diff-pdf
|
|
31
|
+
run: |
|
|
32
|
+
sudo apt-get update
|
|
33
|
+
sudo apt-get install make automake g++ libpoppler-glib-dev poppler-utils libwxgtk3.0-dev
|
|
34
|
+
git clone https://github.com/vslavik/diff-pdf.git -b v0.4.1 --depth 1 /tmp/diff-pdf-src
|
|
35
|
+
cd /tmp/diff-pdf-src
|
|
36
|
+
./bootstrap && ./configure && make && sudo make install
|
|
37
|
+
|
|
38
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
|
39
|
+
uses: ruby/setup-ruby@v1
|
|
40
|
+
with:
|
|
41
|
+
ruby-version: ${{ matrix.ruby }}
|
|
42
|
+
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: |
|
|
45
|
+
gem install bundler
|
|
46
|
+
bundle install --gemfile gemfiles/prawn-${{ matrix.prawn }}.gemfile --jobs 4 --retry 3
|
|
47
|
+
|
|
48
|
+
- name: Run tests
|
|
49
|
+
run: |
|
|
50
|
+
bundle exec rake test:units
|
|
51
|
+
bundle exec rake test:features
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
## master (Unreleased)
|
|
2
|
+
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
Breaking Changes:
|
|
6
|
+
|
|
7
|
+
* Drop Ruby 2.4 support #108, #109
|
|
8
|
+
|
|
9
|
+
Enhancements:
|
|
10
|
+
|
|
11
|
+
* Ruby 3.0 support #108, #109
|
|
12
|
+
* Prawn 2.4 support #108, #109
|
|
13
|
+
|
|
14
|
+
## 0.11.0
|
|
15
|
+
|
|
16
|
+
Breaking Changes:
|
|
17
|
+
|
|
18
|
+
* Dropped Ruby 2.1 support
|
|
19
|
+
* Dropped Ruby 2.2 support
|
|
20
|
+
* Dropped Ruby 2.3 support
|
|
21
|
+
* Formatter of a text-block works even with multiple-line (#95)
|
|
22
|
+
|
|
23
|
+
Enhancements:
|
|
24
|
+
|
|
25
|
+
* Ruby 2.7.0 support
|
|
26
|
+
* Support Pathname layout option on `Thinreports::Report` #99 [@meganemura]
|
|
27
|
+
|
|
28
|
+
Bug Fixes:
|
|
29
|
+
|
|
30
|
+
* Fixed: thousands separation is applied to decimal part #95
|
|
31
|
+
|
|
32
|
+
## 0.10.3
|
|
33
|
+
|
|
34
|
+
Bug Fixes:
|
|
35
|
+
|
|
36
|
+
* Fixed: corner-radius of Rect is not applied correctly #93
|
|
37
|
+
|
|
38
|
+
## 0.10.2
|
|
39
|
+
|
|
40
|
+
Bug Fixes:
|
|
41
|
+
|
|
42
|
+
* Fixed: Prawn::Errors::UnknownFont error occured: "is not a known font" #89
|
|
43
|
+
|
|
44
|
+
## 0.10.1
|
|
45
|
+
|
|
46
|
+
Bug Fixes:
|
|
47
|
+
|
|
48
|
+
* Fixed a bug that an error occurred on page break in other list when there is a list with page-break disabled #87 [@meganemura]
|
|
49
|
+
|
|
1
50
|
## 0.10.0
|
|
2
51
|
|
|
3
52
|
* Thinreports requires Prawn 2.2
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
FROM ruby:3.0.0
|
|
2
|
+
|
|
3
|
+
RUN apt-get update -qq && apt-get install -y build-essential xvfb
|
|
4
|
+
|
|
5
|
+
# Install diff-pdf
|
|
6
|
+
WORKDIR /tmp
|
|
7
|
+
RUN apt-get install -y libpoppler-glib-dev poppler-utils libwxgtk3.0-dev && curl -L https://github.com/vslavik/diff-pdf/archive/master.tar.gz -o diff-pdf-master.tar.gz && tar zxf diff-pdf-master.tar.gz && cd diff-pdf-master && ./bootstrap && ./configure && make && make install
|
|
8
|
+
|
|
9
|
+
RUN mkdir /thinreports
|
|
10
|
+
|
|
11
|
+
WORKDIR /thinreports
|
|
12
|
+
VOLUME /thinreports
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# Thinreports Generator
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/thinreports)
|
|
4
|
-
[](https://gemnasium.com/thinreports/thinreports-generator)
|
|
4
|
+
[](https://github.com/thinreports/thinreports-generator/actions)
|
|
5
|
+
[](https://codeclimate.com/github/thinreports/thinreports-generator/maintainability)
|
|
7
6
|
|
|
8
7
|
[Thinreports](http://www.thinreports.org) is an open source report generating tool for Ruby.
|
|
9
8
|
|
|
@@ -15,14 +14,15 @@
|
|
|
15
14
|
* [Installation Guide](http://www.thinreports.org/documentation/getting-started/installation.html)
|
|
16
15
|
* [Quick Start Guide](http://www.thinreports.org/documentation/getting-started/quickstart.html)
|
|
17
16
|
* [Examples](https://github.com/thinreports/thinreports-examples)
|
|
18
|
-
* [Rails5 Example](https://github.com/thinreports/thinreports-rails5-example)
|
|
19
17
|
* [Changelog](https://github.com/thinreports/thinreports-generator/blob/master/CHANGELOG.md)
|
|
20
|
-
* [Discussion Group](https://
|
|
18
|
+
* [Discussion Group (GitHub Discussions)](https://github.com/thinreports/thinreports/discussions)
|
|
19
|
+
* [Discussion Group (Google Groups)](https://groups.google.com/forum/#!forum/thinreports)
|
|
21
20
|
|
|
22
21
|
## Supported versions
|
|
23
22
|
|
|
24
|
-
* Ruby 2.
|
|
25
|
-
*
|
|
23
|
+
* Ruby 2.5, 2.6, 2.7, 3.0
|
|
24
|
+
* Prawn 2.2, 2.3, 2.4
|
|
25
|
+
* JRuby 9.2
|
|
26
26
|
|
|
27
27
|
## Quick Reference
|
|
28
28
|
|
|
@@ -153,7 +153,7 @@ report.on_page_create do |page|
|
|
|
153
153
|
end
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
See also [
|
|
156
|
+
See also [features/report_callbacks](https://github.com/thinreports/thinreports-generator/tree/master/test/features/report_callbacks).
|
|
157
157
|
|
|
158
158
|
### List
|
|
159
159
|
|
|
@@ -202,7 +202,7 @@ report.list do |list|
|
|
|
202
202
|
end
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
See also [
|
|
205
|
+
See also [features/list_events](https://github.com/thinreports/thinreports-generator/tree/master/test/features/list_events).
|
|
206
206
|
|
|
207
207
|
### Page Number
|
|
208
208
|
|
|
@@ -223,7 +223,7 @@ report.start_new_page do |page|
|
|
|
223
223
|
end
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
See also [
|
|
226
|
+
See also [features/page_number](https://github.com/thinreports/thinreports-generator/blob/master/test/features/page_number) and [features/page_number_with_list](https://github.com/thinreports/thinreports-generator/blob/master/test/features/page_number_with_list).
|
|
227
227
|
|
|
228
228
|
### Configuring fallback fonts
|
|
229
229
|
|
|
@@ -235,7 +235,7 @@ end
|
|
|
235
235
|
Thinreports.config.fallback_fonts = ['/path/to/font_a.ttf', '/path/to/font_b.ttf']
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
See also [
|
|
238
|
+
See also [features/eudc](https://github.com/thinreports/thinreports-generator/blob/master/test/features/eudc).
|
|
239
239
|
|
|
240
240
|
## Features
|
|
241
241
|
|
|
@@ -262,19 +262,44 @@ Generator can dynamically:
|
|
|
262
262
|
|
|
263
263
|
## Contributing
|
|
264
264
|
|
|
265
|
-
|
|
265
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/thinreports/thinreports-generator.
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
## Development
|
|
268
268
|
|
|
269
|
-
###
|
|
269
|
+
### How to run feature tests
|
|
270
270
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
```
|
|
272
|
+
$ bundle exec rake test:features
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
In order to run `test:features`, you need to install [diff-pdf](https://github.com/vslavik/diff-pdf) in your environment, or you can run test in the docker container as below.
|
|
276
|
+
|
|
277
|
+
### How to develop in Docker container
|
|
278
|
+
|
|
279
|
+
You can use the Docker container for development. This container contains the libraries required for testing, such as diff-pdf.
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
$ docker build -t thinreports-dev .
|
|
283
|
+
$ docker run -v $PWD:/thinreports:cached -it thinreports-dev bash
|
|
284
|
+
|
|
285
|
+
> /thinreports#
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
You can run test:
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
> /thinreports# bundle install
|
|
292
|
+
> /thinreports# bundle exec rake test:features
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Releasing Generator
|
|
296
|
+
|
|
297
|
+
1. Update the version number in `version.rb`
|
|
298
|
+
2. Update `CHANGELOG.md` and `README.md` (if needed)
|
|
299
|
+
3. Create the Release PR like #105
|
|
300
|
+
4. Merge the PR
|
|
301
|
+
5. Is the master CI green? If not, make it green
|
|
302
|
+
6. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to rubygems.org
|
|
278
303
|
|
|
279
304
|
## License
|
|
280
305
|
|
data/Rakefile
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
1
2
|
require 'rake/testtask'
|
|
2
|
-
require 'rubocop/rake_task'
|
|
3
|
-
require 'yard'
|
|
4
3
|
|
|
5
|
-
task default:
|
|
4
|
+
task default: :test
|
|
6
5
|
|
|
7
6
|
Rake::TestTask.new do |t|
|
|
7
|
+
t.name = 'test:units'
|
|
8
|
+
t.description = 'Run unit tests'
|
|
8
9
|
t.libs << 'test'
|
|
9
|
-
t.test_files = Dir['test/
|
|
10
|
+
t.test_files = Dir['test/units/**/test_*.rb']
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Dir['examples/*/*.rb'].each do |f|
|
|
20
|
-
casename = File.basename(File.dirname(f))
|
|
21
|
-
|
|
22
|
-
desc "Run example: #{casename}"
|
|
23
|
-
task casename.to_sym => :_init do
|
|
24
|
-
require_relative 'examples/helper'
|
|
25
|
-
require_relative "examples/#{casename}/#{casename}"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
desc 'Run all examples'
|
|
31
|
-
task examples: :'examples:all'
|
|
32
|
-
|
|
33
|
-
YARD::Rake::YardocTask.new :doc do |yard|
|
|
34
|
-
yard.files = Dir['lib/**/*.rb']
|
|
35
|
-
yard.options = ['--readme', 'README.md']
|
|
13
|
+
Rake::TestTask.new do |t|
|
|
14
|
+
t.name = 'test:features'
|
|
15
|
+
t.description = 'Run feature tests'
|
|
16
|
+
t.libs << 'test/features'
|
|
17
|
+
t.test_files = Dir['test/features/*/test_*.rb']
|
|
18
|
+
t.warning = false
|
|
36
19
|
end
|
|
37
20
|
|
|
38
|
-
|
|
21
|
+
desc 'Run unit and feature tests'
|
|
22
|
+
task test: %i( test:units test:features )
|
data/lib/thinreports.rb
CHANGED
|
@@ -6,6 +6,10 @@ module Thinreports
|
|
|
6
6
|
def self.root
|
|
7
7
|
@root ||= Pathname.new(__FILE__).join('..', '..')
|
|
8
8
|
end
|
|
9
|
+
|
|
10
|
+
def self.generate(report_params, filename: nil)
|
|
11
|
+
Generate.new.call(report_params, filename: filename)
|
|
12
|
+
end
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
require_relative 'thinreports/version'
|
|
@@ -18,3 +22,4 @@ require_relative 'thinreports/core/utils'
|
|
|
18
22
|
require_relative 'thinreports/report'
|
|
19
23
|
require_relative 'thinreports/layout'
|
|
20
24
|
require_relative 'thinreports/generator/pdf'
|
|
25
|
+
require_relative 'thinreports/generate'
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
module Thinreports
|
|
4
4
|
module Core
|
|
5
5
|
module Shape
|
|
6
|
-
def Interface(parent, format)
|
|
6
|
+
def Interface(parent, format)
|
|
7
7
|
find_by_type(format.type)::Interface.new(parent, format)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def Format(type)
|
|
10
|
+
def Format(type)
|
|
11
11
|
find_by_type(type)::Format
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
module_function :Interface, :Format
|
|
15
15
|
|
|
16
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
17
16
|
def self.find_by_type(type)
|
|
18
17
|
case type
|
|
19
18
|
when TextBlock::TYPE_NAME then TextBlock
|
|
20
19
|
when ImageBlock::TYPE_NAME then ImageBlock
|
|
21
20
|
when List::TYPE_NAME then List
|
|
21
|
+
when StackView::TYPE_NAME then StackView
|
|
22
22
|
when Text::TYPE_NAME then Text
|
|
23
23
|
when PageNumber::TYPE_NAME then PageNumber
|
|
24
24
|
when *Basic::TYPE_NAMES then Basic
|
|
@@ -38,4 +38,5 @@ require_relative 'shape/text'
|
|
|
38
38
|
require_relative 'shape/text_block'
|
|
39
39
|
require_relative 'shape/image_block'
|
|
40
40
|
require_relative 'shape/list'
|
|
41
|
+
require_relative 'shape/stack_view'
|
|
41
42
|
require_relative 'shape/page_number'
|
|
@@ -30,7 +30,6 @@ module Thinreports
|
|
|
30
30
|
# @param [Thinreports::Core::Shape::Basic::Format] format
|
|
31
31
|
# @return [Thinreports::Core::Shape::Basic::Internal]
|
|
32
32
|
# @abstract
|
|
33
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
|
34
33
|
def init_internal(parent, format)
|
|
35
34
|
raise NotImplementedError
|
|
36
35
|
end
|
|
@@ -10,6 +10,11 @@ module Thinreports
|
|
|
10
10
|
config_reader :type, :id
|
|
11
11
|
config_reader :style
|
|
12
12
|
config_checker true, :display
|
|
13
|
+
config_reader follow_stretch: %w[follow-stretch]
|
|
14
|
+
|
|
15
|
+
def affect_bottom_margin?
|
|
16
|
+
attributes.fetch('affect-bottom-margin', true)
|
|
17
|
+
end
|
|
13
18
|
end
|
|
14
19
|
end
|
|
15
20
|
end
|
|
@@ -4,7 +4,6 @@ module Thinreports
|
|
|
4
4
|
module Core
|
|
5
5
|
module Shape
|
|
6
6
|
module List
|
|
7
|
-
# rubocop:disable Metrics/ClassLength
|
|
8
7
|
class Manager
|
|
9
8
|
include Utils
|
|
10
9
|
|
|
@@ -136,9 +135,7 @@ module Thinreports
|
|
|
136
135
|
def overflow_with?(section_name = :detail)
|
|
137
136
|
max_height = page_max_height
|
|
138
137
|
|
|
139
|
-
if section_name == :footer && format.has_page_footer?
|
|
140
|
-
max_height += format.section_height(:page_footer)
|
|
141
|
-
end
|
|
138
|
+
max_height += format.section_height(:page_footer) if section_name == :footer && format.has_page_footer?
|
|
142
139
|
|
|
143
140
|
height = format.section_height(section_name)
|
|
144
141
|
(current_page_state.height + height) > max_height
|