thinreports 0.9.1 → 0.11.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/workflows/test.yml +39 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +59 -2
- data/Dockerfile +12 -0
- data/Gemfile +7 -4
- data/README.md +44 -22
- data/Rakefile +14 -31
- data/lib/thinreports.rb +16 -15
- data/lib/thinreports/config.rb +2 -24
- data/lib/thinreports/core/errors.rb +6 -17
- data/lib/thinreports/core/format/base.rb +62 -61
- data/lib/thinreports/core/shape.rb +10 -12
- data/lib/thinreports/core/shape/base.rb +3 -12
- data/lib/thinreports/core/shape/base/interface.rb +34 -32
- data/lib/thinreports/core/shape/base/internal.rb +45 -43
- data/lib/thinreports/core/shape/basic.rb +12 -12
- data/lib/thinreports/core/shape/basic/block_format.rb +8 -6
- data/lib/thinreports/core/shape/basic/block_interface.rb +24 -22
- data/lib/thinreports/core/shape/basic/block_internal.rb +28 -26
- data/lib/thinreports/core/shape/basic/format.rb +11 -9
- data/lib/thinreports/core/shape/basic/interface.rb +79 -77
- data/lib/thinreports/core/shape/basic/internal.rb +17 -14
- data/lib/thinreports/core/shape/image_block.rb +9 -9
- data/lib/thinreports/core/shape/image_block/format.rb +7 -5
- data/lib/thinreports/core/shape/image_block/interface.rb +15 -13
- data/lib/thinreports/core/shape/image_block/internal.rb +10 -8
- data/lib/thinreports/core/shape/list.rb +13 -13
- data/lib/thinreports/core/shape/list/format.rb +83 -77
- data/lib/thinreports/core/shape/list/manager.rb +179 -176
- data/lib/thinreports/core/shape/list/page.rb +91 -93
- data/lib/thinreports/core/shape/list/page_state.rb +42 -40
- data/lib/thinreports/core/shape/list/section_format.rb +28 -26
- data/lib/thinreports/core/shape/list/section_interface.rb +42 -40
- data/lib/thinreports/core/shape/list/section_internal.rb +21 -19
- data/lib/thinreports/core/shape/manager.rb +4 -13
- data/lib/thinreports/core/shape/manager/format.rb +21 -19
- data/lib/thinreports/core/shape/manager/internal.rb +87 -84
- data/lib/thinreports/core/shape/manager/target.rb +93 -95
- data/lib/thinreports/core/shape/page_number.rb +9 -9
- data/lib/thinreports/core/shape/page_number/format.rb +20 -18
- data/lib/thinreports/core/shape/page_number/interface.rb +20 -18
- data/lib/thinreports/core/shape/page_number/internal.rb +46 -44
- data/lib/thinreports/core/shape/style.rb +5 -14
- data/lib/thinreports/core/shape/style/base.rb +121 -120
- data/lib/thinreports/core/shape/style/basic.rb +12 -10
- data/lib/thinreports/core/shape/style/graphic.rb +35 -33
- data/lib/thinreports/core/shape/style/text.rb +113 -107
- data/lib/thinreports/core/shape/text.rb +9 -9
- data/lib/thinreports/core/shape/text/format.rb +10 -9
- data/lib/thinreports/core/shape/text/interface.rb +13 -11
- data/lib/thinreports/core/shape/text/internal.rb +14 -12
- data/lib/thinreports/core/shape/text_block.rb +10 -10
- data/lib/thinreports/core/shape/text_block/format.rb +35 -33
- data/lib/thinreports/core/shape/text_block/formatter.rb +26 -24
- data/lib/thinreports/core/shape/text_block/formatter/basic.rb +25 -25
- data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +15 -12
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +52 -34
- data/lib/thinreports/core/shape/text_block/formatter/padding.rb +17 -14
- data/lib/thinreports/core/shape/text_block/interface.rb +25 -23
- data/lib/thinreports/core/shape/text_block/internal.rb +66 -68
- data/lib/thinreports/core/utils.rb +7 -3
- data/lib/thinreports/generator/pdf.rb +24 -25
- data/lib/thinreports/generator/pdf/document.rb +109 -110
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +57 -51
- data/lib/thinreports/generator/pdf/document/draw_template_items.rb +50 -47
- data/lib/thinreports/generator/pdf/document/font.rb +67 -58
- data/lib/thinreports/generator/pdf/document/graphics.rb +32 -33
- data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +121 -121
- data/lib/thinreports/generator/pdf/document/graphics/basic.rb +112 -114
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +58 -150
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +149 -137
- data/lib/thinreports/generator/pdf/document/page.rb +60 -64
- data/lib/thinreports/generator/pdf/document/parse_color.rb +37 -37
- data/lib/thinreports/generator/pdf/drawer/base.rb +41 -41
- data/lib/thinreports/generator/pdf/drawer/list.rb +56 -54
- data/lib/thinreports/generator/pdf/drawer/list_section.rb +42 -40
- data/lib/thinreports/generator/pdf/drawer/page.rb +101 -96
- data/lib/thinreports/generator/pdf/prawn_ext.rb +4 -30
- data/lib/thinreports/generator/pdf/prawn_ext/calc_image_dimensions.rb +32 -0
- data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +35 -0
- data/lib/thinreports/layout.rb +5 -7
- data/lib/thinreports/layout/base.rb +5 -9
- data/lib/thinreports/layout/format.rb +17 -13
- data/lib/thinreports/layout/legacy_schema.rb +17 -13
- data/lib/thinreports/layout/version.rb +22 -25
- data/lib/thinreports/report.rb +4 -6
- data/lib/thinreports/report/base.rb +24 -51
- data/lib/thinreports/report/internal.rb +13 -15
- data/lib/thinreports/report/page.rb +5 -11
- data/lib/thinreports/version.rb +2 -2
- data/thinreports.gemspec +10 -19
- metadata +13 -288
- data/.travis.yml +0 -19
- 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 -11
- 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/lib/thinreports/generator.rb +0 -29
- data/lib/thinreports/generator/base.rb +0 -40
- data/lib/thinreports/generator/configuration.rb +0 -31
- data/lib/thinreports/report/events.rb +0 -32
- 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 -121
- data/test/test_helper.rb +0 -42
- 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 -45
- data/test/unit/generator/pdf/document/graphics/test_image.rb +0 -150
- 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/test_document.rb +0 -20
- data/test/unit/generator/test_base.rb +0 -40
- data/test/unit/generator/test_configuration.rb +0 -21
- data/test/unit/generator/test_pdf.rb +0 -24
- 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 -95
- data/test/unit/report/test_base.rb +0 -262
- data/test/unit/report/test_internal.rb +0 -206
- data/test/unit/test_config.rb +0 -51
- 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: b53f36fac9af329499239b3db9313911fba89c82dd28cf81ac2e9942bcdce13a
|
|
4
|
+
data.tar.gz: 38ce4e9d25a709240a1242948a33d96372e3cb6981b07e3121c88967279a3eed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5db1f93781fd6be18f53424eb2853b6701449938f2dc2875f287be74720611361f5dc7b6f657ea9fd96ed83de8056efa92cd4ae7b5b8c0df3d11bb318a81f7d6
|
|
7
|
+
data.tar.gz: 25d1cc37589223ea85f574f7c6cf007a9e5682dff6f59051286c3fe691b5ab9704d9c5e40e8b3b9b49134406af538aa4e688a74d5416aa1082f6bc1330de173a
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
name: Test against ${{ matrix.ruby }}
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
ruby:
|
|
12
|
+
- 2.4
|
|
13
|
+
- 2.5
|
|
14
|
+
- 2.6
|
|
15
|
+
- 2.7
|
|
16
|
+
- jruby
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v1
|
|
20
|
+
|
|
21
|
+
- name: Set up diff-pdf
|
|
22
|
+
run: |
|
|
23
|
+
sudo apt-get update
|
|
24
|
+
sudo apt-get install make automake g++ libpoppler-glib-dev poppler-utils libwxgtk3.0-dev
|
|
25
|
+
git clone https://github.com/vslavik/diff-pdf.git -b v0.4.1 --depth 1 /tmp/diff-pdf-src
|
|
26
|
+
cd /tmp/diff-pdf-src
|
|
27
|
+
./bootstrap && ./configure && make && sudo make install
|
|
28
|
+
|
|
29
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
|
30
|
+
uses: ruby/setup-ruby@v1
|
|
31
|
+
with:
|
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
|
33
|
+
|
|
34
|
+
- name: Build and test with Rake
|
|
35
|
+
run: |
|
|
36
|
+
gem install bundler
|
|
37
|
+
bundle install --jobs 4 --retry 3
|
|
38
|
+
bundle exec rake test:units
|
|
39
|
+
bundle exec rake test:features
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
## master
|
|
2
|
+
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
Breaking Changes:
|
|
6
|
+
|
|
7
|
+
* Dropped Ruby 2.1 support
|
|
8
|
+
* Dropped Ruby 2.2 support
|
|
9
|
+
* Dropped Ruby 2.3 support
|
|
10
|
+
* Formatter of a text-block works even with multiple-line (#95)
|
|
11
|
+
|
|
12
|
+
Enhancements:
|
|
13
|
+
|
|
14
|
+
* Ruby 2.7.0 support
|
|
15
|
+
* Support Pathname layout option on `Thinreports::Report` #99 [@meganemura]
|
|
16
|
+
|
|
17
|
+
Bug Fixes:
|
|
18
|
+
|
|
19
|
+
* Fixed: thousands separation is applied to decimal part #95
|
|
20
|
+
|
|
21
|
+
## 0.10.3
|
|
22
|
+
|
|
23
|
+
Bug Fixes:
|
|
24
|
+
|
|
25
|
+
* Fixed: corner-radius of Rect is not applied correctly #93
|
|
26
|
+
|
|
27
|
+
## 0.10.2
|
|
28
|
+
|
|
29
|
+
Bug Fixes:
|
|
30
|
+
|
|
31
|
+
* Fixed: Prawn::Errors::UnknownFont error occured: "is not a known font" #89
|
|
32
|
+
|
|
33
|
+
## 0.10.1
|
|
34
|
+
|
|
35
|
+
Bug Fixes:
|
|
36
|
+
|
|
37
|
+
* Fixed a bug that an error occurred on page break in other list when there is a list with page-break disabled #87 [@meganemura]
|
|
38
|
+
|
|
39
|
+
## 0.10.0
|
|
40
|
+
|
|
41
|
+
* Thinreports requires Prawn 2.2
|
|
42
|
+
* Dropped Ruby 1.9.3 and 2.0.0 support
|
|
43
|
+
* Fixed a bug line-height of a text line-wrapped is broken #36 [@tkobayashi0330]
|
|
44
|
+
* Remove deprecated top-module `ThinReports`
|
|
45
|
+
* Remove `config.convert_palleted_transparency_png` option
|
|
46
|
+
* Remove `config.generator.default` option
|
|
47
|
+
* Deprecate `:report` and `:generator` argument of `Thinreports::Report.generate`
|
|
48
|
+
|
|
49
|
+
### Remove config.convert_palleted_transparency_png option
|
|
50
|
+
|
|
51
|
+
PNG image with indexed transparency has been supported since Prawn version 2.0. And now, thinreports requires Prawn 2.2+, so the unique support in thinreports is no longer needed.
|
|
52
|
+
|
|
53
|
+
### Remove deprecated top-module ThinReports
|
|
54
|
+
|
|
55
|
+
Please use `Thinreports` instead.
|
|
56
|
+
|
|
1
57
|
## 0.9.1
|
|
2
58
|
|
|
3
59
|
* Fixed bug that line-height of text-block is always set to 0 #68
|
|
@@ -46,8 +102,9 @@ png_image = StringIO.new(png_data)
|
|
|
46
102
|
page.item(:image_block).src(png_image)
|
|
47
103
|
|
|
48
104
|
require 'open-uri'
|
|
49
|
-
|
|
50
|
-
page.item(:image_block).src(image_data)
|
|
105
|
+
open('http://example.com/image.png') do |image_data|
|
|
106
|
+
page.item(:image_block).src(image_data)
|
|
107
|
+
end
|
|
51
108
|
```
|
|
52
109
|
|
|
53
110
|
### Remove old way to define callback of list
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
FROM ruby:2.7.1
|
|
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
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
gemspec
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
gem 'minitest', '>= 5.14.1'
|
|
8
|
+
gem 'mocha', '>= 1.11.2'
|
|
9
|
+
gem 'pdf-inspector', '>= 1.3.0'
|
|
10
|
+
gem 'rake', '>= 13.0.1'
|
data/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
# Thinreports Generator
|
|
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,15 +14,13 @@
|
|
|
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
|
-
* [Rails4 Example](https://github.com/thinreports/thinreports-rails4-example)
|
|
19
17
|
* [Changelog](https://github.com/thinreports/thinreports-generator/blob/master/CHANGELOG.md)
|
|
20
18
|
* [Discussion Group](https://groups.google.com/forum/#!forum/thinreports)
|
|
21
|
-
* [](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
22
19
|
|
|
23
20
|
## Supported versions
|
|
24
21
|
|
|
25
|
-
* Ruby
|
|
26
|
-
* JRuby
|
|
22
|
+
* Ruby 2.4, 2.5, 2.6, 2.7
|
|
23
|
+
* JRuby 9.2
|
|
27
24
|
|
|
28
25
|
## Quick Reference
|
|
29
26
|
|
|
@@ -154,7 +151,7 @@ report.on_page_create do |page|
|
|
|
154
151
|
end
|
|
155
152
|
```
|
|
156
153
|
|
|
157
|
-
See also [
|
|
154
|
+
See also [features/report_callbacks](https://github.com/thinreports/thinreports-generator/tree/master/test/features/report_callbacks).
|
|
158
155
|
|
|
159
156
|
### List
|
|
160
157
|
|
|
@@ -203,7 +200,7 @@ report.list do |list|
|
|
|
203
200
|
end
|
|
204
201
|
```
|
|
205
202
|
|
|
206
|
-
See also [
|
|
203
|
+
See also [features/list_events](https://github.com/thinreports/thinreports-generator/tree/master/test/features/list_events).
|
|
207
204
|
|
|
208
205
|
### Page Number
|
|
209
206
|
|
|
@@ -224,7 +221,7 @@ report.start_new_page do |page|
|
|
|
224
221
|
end
|
|
225
222
|
```
|
|
226
223
|
|
|
227
|
-
See also [
|
|
224
|
+
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).
|
|
228
225
|
|
|
229
226
|
### Configuring fallback fonts
|
|
230
227
|
|
|
@@ -236,7 +233,7 @@ end
|
|
|
236
233
|
Thinreports.config.fallback_fonts = ['/path/to/font_a.ttf', '/path/to/font_b.ttf']
|
|
237
234
|
```
|
|
238
235
|
|
|
239
|
-
See also [
|
|
236
|
+
See also [features/eudc](https://github.com/thinreports/thinreports-generator/blob/master/test/features/eudc).
|
|
240
237
|
|
|
241
238
|
## Features
|
|
242
239
|
|
|
@@ -263,19 +260,44 @@ Generator can dynamically:
|
|
|
263
260
|
|
|
264
261
|
## Contributing
|
|
265
262
|
|
|
266
|
-
|
|
263
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/thinreports/thinreports-generator.
|
|
267
264
|
|
|
268
|
-
|
|
265
|
+
## Development
|
|
269
266
|
|
|
270
|
-
###
|
|
267
|
+
### How to run feature tests
|
|
271
268
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
269
|
+
```
|
|
270
|
+
$ bundle exec rake test:features
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
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.
|
|
274
|
+
|
|
275
|
+
### How to develop in Docker container
|
|
276
|
+
|
|
277
|
+
You can use the Docker container for development. This container contains the libraries required for testing, such as diff-pdf.
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
$ docker build -t thinreports-dev .
|
|
281
|
+
$ docker run -v $PWD:/thinreports:cached -it thinreports-dev bash
|
|
282
|
+
|
|
283
|
+
> /thinreports#
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
You can run test:
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
> /thinreports# bundle install
|
|
290
|
+
> /thinreports# bundle exec rake test:features
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Releasing Generator
|
|
294
|
+
|
|
295
|
+
1. Update the version number in `version.rb`
|
|
296
|
+
2. Update `CHANGELOG.md` and `README.md` (if needed)
|
|
297
|
+
3. Create the Release PR like #105
|
|
298
|
+
4. Merge the PR
|
|
299
|
+
5. Is the master CI green? If not, make it green
|
|
300
|
+
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
|
|
279
301
|
|
|
280
302
|
## License
|
|
281
303
|
|
data/Rakefile
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
3
2
|
require 'rake/testtask'
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
task default: :test
|
|
5
5
|
|
|
6
6
|
Rake::TestTask.new do |t|
|
|
7
|
+
t.name = 'test:units'
|
|
8
|
+
t.description = 'Run unit tests'
|
|
7
9
|
t.libs << 'test'
|
|
8
|
-
t.test_files = Dir['test/
|
|
10
|
+
t.test_files = Dir['test/units/**/test_*.rb']
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Dir['examples/*/*.rb'].each do |f|
|
|
19
|
-
casename = File.basename(File.dirname(f))
|
|
20
|
-
|
|
21
|
-
desc "Run example: #{casename}"
|
|
22
|
-
task casename.to_sym => :_init do
|
|
23
|
-
require_relative 'examples/helper'
|
|
24
|
-
require_relative "examples/#{casename}/#{casename}"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
task :_init do
|
|
29
|
-
$:.push File.expand_path('../lib', __FILE__)
|
|
30
|
-
end
|
|
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
|
|
31
19
|
end
|
|
32
20
|
|
|
33
|
-
desc 'Run
|
|
34
|
-
task
|
|
35
|
-
|
|
36
|
-
YARD::Rake::YardocTask.new :doc do |yard|
|
|
37
|
-
yard.files = Dir['lib/**/*.rb']
|
|
38
|
-
yard.options = ['--readme', 'README.md']
|
|
39
|
-
end
|
|
21
|
+
desc 'Run unit and feature tests'
|
|
22
|
+
task test: %i( test:units test:features )
|
data/lib/thinreports.rb
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'pathname'
|
|
2
4
|
|
|
3
5
|
module Thinreports
|
|
4
|
-
|
|
6
|
+
def self.root
|
|
7
|
+
@root ||= Pathname.new(__FILE__).join('..', '..')
|
|
8
|
+
end
|
|
5
9
|
end
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# Alias for Thinreports
|
|
19
|
-
ThinReports = Thinreports
|
|
11
|
+
require_relative 'thinreports/version'
|
|
12
|
+
require_relative 'thinreports/config'
|
|
13
|
+
require_relative 'thinreports/core/utils'
|
|
14
|
+
require_relative 'thinreports/core/errors'
|
|
15
|
+
require_relative 'thinreports/core/format/base'
|
|
16
|
+
require_relative 'thinreports/core/shape'
|
|
17
|
+
require_relative 'thinreports/core/utils'
|
|
18
|
+
require_relative 'thinreports/report'
|
|
19
|
+
require_relative 'thinreports/layout'
|
|
20
|
+
require_relative 'thinreports/generator/pdf'
|
data/lib/thinreports/config.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Thinreports
|
|
4
4
|
# @yield [config]
|
|
5
5
|
# @yieldparam [Thinreports::Configuration] config
|
|
6
6
|
def self.configure(&block)
|
|
7
|
-
Thinreports.call_block_in(
|
|
7
|
+
Thinreports.call_block_in(config, &block)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
# @return [Thinreports::Configuration]
|
|
@@ -15,7 +15,6 @@ module Thinreports
|
|
|
15
15
|
class Configuration
|
|
16
16
|
def initialize
|
|
17
17
|
@fallback_fonts = []
|
|
18
|
-
@convert_palleted_transparency_png = false
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
# @return [Array<String>]
|
|
@@ -33,26 +32,5 @@ module Thinreports
|
|
|
33
32
|
def fallback_fonts=(font_names)
|
|
34
33
|
@fallback_fonts = font_names.is_a?(Array) ? font_names : [font_names]
|
|
35
34
|
end
|
|
36
|
-
|
|
37
|
-
# @return [Boolean]
|
|
38
|
-
# @see https://github.com/thinreports/thinreports-generator/pull/32
|
|
39
|
-
attr_reader :convert_palleted_transparency_png
|
|
40
|
-
|
|
41
|
-
# @param [Boolean]
|
|
42
|
-
# @example
|
|
43
|
-
# config.convert_palleted_transparency_png = true
|
|
44
|
-
# config.convert_palleted_transparency_png = false # default
|
|
45
|
-
# @see https://github.com/thinreports/thinreports-generator/pull/32
|
|
46
|
-
# @deprecated convert_palleted_transparency_png is deprecated and will be removed in thinreports-generator 1.0 with no replacement
|
|
47
|
-
def convert_palleted_transparency_png=(enable)
|
|
48
|
-
warn '[DEPRECATION] convert_palleted_transparency_png is deprecated' \
|
|
49
|
-
' and will be removed in thinreports-generator 1.0 with no replacement.' if enable
|
|
50
|
-
@convert_palleted_transparency_png = enable
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# @return [Thinreports::Generator::Configuration]
|
|
54
|
-
def generator
|
|
55
|
-
@generator ||= Thinreports::Generator::Configuration.new
|
|
56
|
-
end
|
|
57
35
|
end
|
|
58
36
|
end
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Thinreports
|
|
4
|
-
|
|
5
4
|
module Errors
|
|
6
5
|
class Basic < ::StandardError
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
class UnknownShapeStyleName < Basic
|
|
10
9
|
def initialize(style, availables)
|
|
11
|
-
super("The specified style name, '#{style}', cannot be used. "
|
|
12
|
-
"The available styles are #{availables.map{|s| ":#{s}"}.join(', ')}.")
|
|
10
|
+
super("The specified style name, '#{style}', cannot be used. " \
|
|
11
|
+
"The available styles are #{availables.map { |s| ":#{s}" }.join(', ')}.")
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
14
|
|
|
@@ -40,18 +39,9 @@ module Thinreports
|
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
41
|
|
|
43
|
-
class UnknownEventType < Basic
|
|
44
|
-
end
|
|
45
|
-
|
|
46
42
|
class UnknownLayoutId < Basic
|
|
47
43
|
end
|
|
48
44
|
|
|
49
|
-
class UnknownGeneratorType < Basic
|
|
50
|
-
def initialize(type)
|
|
51
|
-
super("The specified generator type, '#{type}', was not found.")
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
45
|
class UnsupportedColorName < Basic
|
|
56
46
|
end
|
|
57
47
|
|
|
@@ -60,12 +50,11 @@ module Thinreports
|
|
|
60
50
|
|
|
61
51
|
class IncompatibleLayoutFormat < Basic
|
|
62
52
|
def initialize(filename, fileversion, required_rules)
|
|
63
|
-
super("Generator #{Thinreports::VERSION} can not be built this file, "
|
|
64
|
-
"'#{File.basename(filename)}'. "
|
|
65
|
-
"This file is updated in the Editor of version '#{fileversion}', "
|
|
53
|
+
super("Generator #{Thinreports::VERSION} can not be built this file, " \
|
|
54
|
+
"'#{File.basename(filename)}'. " \
|
|
55
|
+
"This file is updated in the Editor of version '#{fileversion}', " \
|
|
66
56
|
"but Generator requires version #{required_rules}.")
|
|
67
57
|
end
|
|
68
58
|
end
|
|
69
59
|
end
|
|
70
|
-
|
|
71
60
|
end
|