thinreports 0.9.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +39 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +59 -2
  5. data/Dockerfile +12 -0
  6. data/Gemfile +7 -4
  7. data/README.md +44 -22
  8. data/Rakefile +14 -31
  9. data/lib/thinreports.rb +16 -15
  10. data/lib/thinreports/config.rb +2 -24
  11. data/lib/thinreports/core/errors.rb +6 -17
  12. data/lib/thinreports/core/format/base.rb +62 -61
  13. data/lib/thinreports/core/shape.rb +10 -12
  14. data/lib/thinreports/core/shape/base.rb +3 -12
  15. data/lib/thinreports/core/shape/base/interface.rb +34 -32
  16. data/lib/thinreports/core/shape/base/internal.rb +45 -43
  17. data/lib/thinreports/core/shape/basic.rb +12 -12
  18. data/lib/thinreports/core/shape/basic/block_format.rb +8 -6
  19. data/lib/thinreports/core/shape/basic/block_interface.rb +24 -22
  20. data/lib/thinreports/core/shape/basic/block_internal.rb +28 -26
  21. data/lib/thinreports/core/shape/basic/format.rb +11 -9
  22. data/lib/thinreports/core/shape/basic/interface.rb +79 -77
  23. data/lib/thinreports/core/shape/basic/internal.rb +17 -14
  24. data/lib/thinreports/core/shape/image_block.rb +9 -9
  25. data/lib/thinreports/core/shape/image_block/format.rb +7 -5
  26. data/lib/thinreports/core/shape/image_block/interface.rb +15 -13
  27. data/lib/thinreports/core/shape/image_block/internal.rb +10 -8
  28. data/lib/thinreports/core/shape/list.rb +13 -13
  29. data/lib/thinreports/core/shape/list/format.rb +83 -77
  30. data/lib/thinreports/core/shape/list/manager.rb +179 -176
  31. data/lib/thinreports/core/shape/list/page.rb +91 -93
  32. data/lib/thinreports/core/shape/list/page_state.rb +42 -40
  33. data/lib/thinreports/core/shape/list/section_format.rb +28 -26
  34. data/lib/thinreports/core/shape/list/section_interface.rb +42 -40
  35. data/lib/thinreports/core/shape/list/section_internal.rb +21 -19
  36. data/lib/thinreports/core/shape/manager.rb +4 -13
  37. data/lib/thinreports/core/shape/manager/format.rb +21 -19
  38. data/lib/thinreports/core/shape/manager/internal.rb +87 -84
  39. data/lib/thinreports/core/shape/manager/target.rb +93 -95
  40. data/lib/thinreports/core/shape/page_number.rb +9 -9
  41. data/lib/thinreports/core/shape/page_number/format.rb +20 -18
  42. data/lib/thinreports/core/shape/page_number/interface.rb +20 -18
  43. data/lib/thinreports/core/shape/page_number/internal.rb +46 -44
  44. data/lib/thinreports/core/shape/style.rb +5 -14
  45. data/lib/thinreports/core/shape/style/base.rb +121 -120
  46. data/lib/thinreports/core/shape/style/basic.rb +12 -10
  47. data/lib/thinreports/core/shape/style/graphic.rb +35 -33
  48. data/lib/thinreports/core/shape/style/text.rb +113 -107
  49. data/lib/thinreports/core/shape/text.rb +9 -9
  50. data/lib/thinreports/core/shape/text/format.rb +10 -9
  51. data/lib/thinreports/core/shape/text/interface.rb +13 -11
  52. data/lib/thinreports/core/shape/text/internal.rb +14 -12
  53. data/lib/thinreports/core/shape/text_block.rb +10 -10
  54. data/lib/thinreports/core/shape/text_block/format.rb +35 -33
  55. data/lib/thinreports/core/shape/text_block/formatter.rb +26 -24
  56. data/lib/thinreports/core/shape/text_block/formatter/basic.rb +25 -25
  57. data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +15 -12
  58. data/lib/thinreports/core/shape/text_block/formatter/number.rb +52 -34
  59. data/lib/thinreports/core/shape/text_block/formatter/padding.rb +17 -14
  60. data/lib/thinreports/core/shape/text_block/interface.rb +25 -23
  61. data/lib/thinreports/core/shape/text_block/internal.rb +66 -68
  62. data/lib/thinreports/core/utils.rb +7 -3
  63. data/lib/thinreports/generator/pdf.rb +24 -25
  64. data/lib/thinreports/generator/pdf/document.rb +109 -110
  65. data/lib/thinreports/generator/pdf/document/draw_shape.rb +57 -51
  66. data/lib/thinreports/generator/pdf/document/draw_template_items.rb +50 -47
  67. data/lib/thinreports/generator/pdf/document/font.rb +67 -58
  68. data/lib/thinreports/generator/pdf/document/graphics.rb +32 -33
  69. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +121 -121
  70. data/lib/thinreports/generator/pdf/document/graphics/basic.rb +112 -114
  71. data/lib/thinreports/generator/pdf/document/graphics/image.rb +58 -150
  72. data/lib/thinreports/generator/pdf/document/graphics/text.rb +149 -137
  73. data/lib/thinreports/generator/pdf/document/page.rb +60 -64
  74. data/lib/thinreports/generator/pdf/document/parse_color.rb +37 -37
  75. data/lib/thinreports/generator/pdf/drawer/base.rb +41 -41
  76. data/lib/thinreports/generator/pdf/drawer/list.rb +56 -54
  77. data/lib/thinreports/generator/pdf/drawer/list_section.rb +42 -40
  78. data/lib/thinreports/generator/pdf/drawer/page.rb +101 -96
  79. data/lib/thinreports/generator/pdf/prawn_ext.rb +4 -30
  80. data/lib/thinreports/generator/pdf/prawn_ext/calc_image_dimensions.rb +32 -0
  81. data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +35 -0
  82. data/lib/thinreports/layout.rb +5 -7
  83. data/lib/thinreports/layout/base.rb +5 -9
  84. data/lib/thinreports/layout/format.rb +17 -13
  85. data/lib/thinreports/layout/legacy_schema.rb +17 -13
  86. data/lib/thinreports/layout/version.rb +22 -25
  87. data/lib/thinreports/report.rb +4 -6
  88. data/lib/thinreports/report/base.rb +24 -51
  89. data/lib/thinreports/report/internal.rb +13 -15
  90. data/lib/thinreports/report/page.rb +5 -11
  91. data/lib/thinreports/version.rb +2 -2
  92. data/thinreports.gemspec +10 -19
  93. metadata +13 -288
  94. data/.travis.yml +0 -19
  95. data/examples/character_spacing/character_spacing.rb +0 -8
  96. data/examples/character_spacing/character_spacing.tlf +0 -293
  97. data/examples/dynamic_image/dynamic_image.rb +0 -31
  98. data/examples/dynamic_image/dynamic_image.tlf +0 -661
  99. data/examples/dynamic_image/img200x100.png +0 -0
  100. data/examples/dynamic_image/img50x50.png +0 -0
  101. data/examples/dynamic_style/dynamic_style.rb +0 -150
  102. data/examples/dynamic_style/dynamic_style.tlf +0 -1835
  103. data/examples/dynamic_style/dynamic_style_in_list.tlf +0 -344
  104. data/examples/dynamic_style/image.png +0 -0
  105. data/examples/eudc/eudc.rb +0 -20
  106. data/examples/eudc/eudc.tlf +0 -180
  107. data/examples/eudc/eudc.ttf +0 -0
  108. data/examples/helper.rb +0 -50
  109. data/examples/hidden_shapes/hidden_shapes.rb +0 -9
  110. data/examples/hidden_shapes/hidden_shapes.tlf +0 -449
  111. data/examples/list_events/list_events.rb +0 -32
  112. data/examples/list_events/list_events.tlf +0 -361
  113. data/examples/list_manual_generation/list_manual_generation.rb +0 -22
  114. data/examples/list_manual_generation/list_manual_generation.tlf +0 -132
  115. data/examples/list_page_number/list_page_number.rb +0 -17
  116. data/examples/list_page_number/list_page_number.tlf +0 -254
  117. data/examples/page_number/page_number.rb +0 -33
  118. data/examples/page_number/page_number.tlf +0 -215
  119. data/examples/palleted_png/palleted_png.png +0 -0
  120. data/examples/palleted_png/palleted_png.rb +0 -11
  121. data/examples/palleted_png/palleted_png.tlf +0 -47
  122. data/examples/password_setting/password_setting.rb +0 -10
  123. data/examples/password_setting/password_setting.tlf +0 -45
  124. data/examples/report_callbacks/report_callbacks.rb +0 -14
  125. data/examples/report_callbacks/report_callbacks.tlf +0 -147
  126. data/examples/single_line_tblock/single_line_tblock.rb +0 -13
  127. data/examples/single_line_tblock/single_line_tblock.tlf +0 -170
  128. data/examples/tblock_overflow/tblock_overflow.rb +0 -20
  129. data/examples/tblock_overflow/tblock_overflow.tlf +0 -538
  130. data/examples/tblock_styles/font_size.tlf +0 -383
  131. data/examples/tblock_styles/tblock_styles.rb +0 -43
  132. data/examples/tblock_styles/tblock_styles.tlf +0 -889
  133. data/examples/text_align/text_align.rb +0 -8
  134. data/examples/text_align/text_align.tlf +0 -241
  135. data/examples/typeB_page_size/B4_ISO.tlf +0 -45
  136. data/examples/typeB_page_size/B4_JIS.tlf +0 -45
  137. data/examples/typeB_page_size/typeB_page_size.rb +0 -17
  138. data/examples/word_wrap/word_wrap.rb +0 -26
  139. data/examples/word_wrap/word_wrap.tlf +0 -297
  140. data/lib/thinreports/generator.rb +0 -29
  141. data/lib/thinreports/generator/base.rb +0 -40
  142. data/lib/thinreports/generator/configuration.rb +0 -31
  143. data/lib/thinreports/report/events.rb +0 -32
  144. data/test/data/font.ttf +0 -0
  145. data/test/data/image_normal.jpg +0 -0
  146. data/test/data/image_normal.png +0 -0
  147. data/test/data/image_normal_jpg_noext +0 -0
  148. data/test/data/image_normal_png_noext +0 -0
  149. data/test/data/image_pallete_based.png +0 -0
  150. data/test/data/legacy_layout/all-items.tlf +0 -1
  151. data/test/schema_helper.rb +0 -121
  152. data/test/test_helper.rb +0 -42
  153. data/test/tmp/.gitkeep +0 -0
  154. data/test/unit/core/format/test_base.rb +0 -152
  155. data/test/unit/core/shape/base/test_internal.rb +0 -87
  156. data/test/unit/core/shape/basic/test_block_format.rb +0 -23
  157. data/test/unit/core/shape/basic/test_block_interface.rb +0 -29
  158. data/test/unit/core/shape/basic/test_block_internal.rb +0 -55
  159. data/test/unit/core/shape/basic/test_format.rb +0 -37
  160. data/test/unit/core/shape/basic/test_interface.rb +0 -108
  161. data/test/unit/core/shape/basic/test_internal.rb +0 -55
  162. data/test/unit/core/shape/image_block/test_interface.rb +0 -24
  163. data/test/unit/core/shape/image_block/test_internal.rb +0 -31
  164. data/test/unit/core/shape/list/test_format.rb +0 -111
  165. data/test/unit/core/shape/list/test_manager.rb +0 -67
  166. data/test/unit/core/shape/list/test_page.rb +0 -82
  167. data/test/unit/core/shape/list/test_page_state.rb +0 -31
  168. data/test/unit/core/shape/list/test_section_format.rb +0 -36
  169. data/test/unit/core/shape/list/test_section_interface.rb +0 -75
  170. data/test/unit/core/shape/list/test_section_internal.rb +0 -50
  171. data/test/unit/core/shape/manager/test_format.rb +0 -38
  172. data/test/unit/core/shape/manager/test_internal.rb +0 -132
  173. data/test/unit/core/shape/manager/test_target.rb +0 -140
  174. data/test/unit/core/shape/page_number/test_format.rb +0 -55
  175. data/test/unit/core/shape/page_number/test_interface.rb +0 -33
  176. data/test/unit/core/shape/page_number/test_internal.rb +0 -81
  177. data/test/unit/core/shape/styles/test_base.rb +0 -191
  178. data/test/unit/core/shape/styles/test_basic.rb +0 -24
  179. data/test/unit/core/shape/styles/test_graphic.rb +0 -50
  180. data/test/unit/core/shape/styles/test_text.rb +0 -97
  181. data/test/unit/core/shape/text/test_format.rb +0 -44
  182. data/test/unit/core/shape/text/test_internal.rb +0 -20
  183. data/test/unit/core/shape/text_block/formatter/test_basic.rb +0 -24
  184. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +0 -49
  185. data/test/unit/core/shape/text_block/formatter/test_number.rb +0 -76
  186. data/test/unit/core/shape/text_block/formatter/test_padding.rb +0 -77
  187. data/test/unit/core/shape/text_block/test_format.rb +0 -169
  188. data/test/unit/core/shape/text_block/test_formatter.rb +0 -28
  189. data/test/unit/core/shape/text_block/test_interface.rb +0 -63
  190. data/test/unit/core/shape/text_block/test_internal.rb +0 -128
  191. data/test/unit/core/test_shape.rb +0 -52
  192. data/test/unit/core/test_utils.rb +0 -68
  193. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +0 -135
  194. data/test/unit/generator/pdf/document/graphics/test_basic.rb +0 -45
  195. data/test/unit/generator/pdf/document/graphics/test_image.rb +0 -150
  196. data/test/unit/generator/pdf/document/graphics/test_text.rb +0 -171
  197. data/test/unit/generator/pdf/document/test_font.rb +0 -84
  198. data/test/unit/generator/pdf/document/test_graphics.rb +0 -42
  199. data/test/unit/generator/pdf/document/test_page.rb +0 -122
  200. data/test/unit/generator/pdf/document/test_parse_color.rb +0 -30
  201. data/test/unit/generator/pdf/test_document.rb +0 -20
  202. data/test/unit/generator/test_base.rb +0 -40
  203. data/test/unit/generator/test_configuration.rb +0 -21
  204. data/test/unit/generator/test_pdf.rb +0 -24
  205. data/test/unit/layout/test_base.rb +0 -41
  206. data/test/unit/layout/test_format.rb +0 -100
  207. data/test/unit/layout/test_legacy_schema.rb +0 -574
  208. data/test/unit/layout/test_version.rb +0 -95
  209. data/test/unit/report/test_base.rb +0 -262
  210. data/test/unit/report/test_internal.rb +0 -206
  211. data/test/unit/test_config.rb +0 -51
  212. data/test/unit/test_layout.rb +0 -12
  213. data/test/unit/test_report.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c93b3357d3d5cf6c1b61a01e9426482712d918da
4
- data.tar.gz: d6947e5e59242e15735d7bb3022dda152ed03d5d
2
+ SHA256:
3
+ metadata.gz: b53f36fac9af329499239b3db9313911fba89c82dd28cf81ac2e9942bcdce13a
4
+ data.tar.gz: 38ce4e9d25a709240a1242948a33d96372e3cb6981b07e3121c88967279a3eed
5
5
  SHA512:
6
- metadata.gz: c05756da8074b034b0747ee7d469086c11348ec9366e2311874230961aa36d82c105453ad0d9079eb6ca0c63b3a05ded8135d8bfb3b17fa41aff330f7c2e2804
7
- data.tar.gz: 10805e8930c437ecc4c2c48fb370c93a450d155af49d783405e0ec2289e1f263b3bd8a29111e6675eac8bf67d426df237ecc5f4831e02dbe477e1696bafac73e
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
@@ -4,3 +4,4 @@ Gemfile.lock
4
4
  .bundle
5
5
  .yardoc
6
6
  doc
7
+ !/test/features/*/expect.pdf
@@ -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
- png_data = open('http://example.com/image.png')
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
@@ -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
- source 'http://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- group :example do
6
- gem 'pdf-inspector'
7
- end
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 [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
+ # Thinreports Generator
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/thinreports.svg)](http://badge.fury.io/rb/thinreports)
4
- [![](http://img.shields.io/travis/thinreports/thinreports-generator.svg?style=flat)](http://travis-ci.org/thinreports/thinreports-generator)
5
- [![](http://img.shields.io/codeclimate/github/thinreports/thinreports-generator.svg?style=flat)](https://codeclimate.com/github/thinreports/thinreports-generator)
6
- [![](http://img.shields.io/gemnasium/thinreports/thinreports-generator.svg?style=flat)](https://gemnasium.com/thinreports/thinreports-generator)
4
+ [![Test](https://github.com/thinreports/thinreports-generator/workflows/Test/badge.svg)](https://github.com/thinreports/thinreports-generator/actions)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/054b400031608957ec4a/maintainability)](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
- * [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](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 1.9.3, 2.0, 2.1, 2.2, 2.3
26
- * JRuby 1.7.0+ (1.9 mode)
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 [examples/report_callbacks](https://github.com/thinreports/thinreports-generator/tree/master/examples/report_callbacks).
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 [examples/list_events](https://github.com/thinreports/thinreports-generator/tree/master/examples/list_events).
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 [examples/page_number](https://github.com/thinreports/thinreports-generator/blob/master/examples/page_number) and [examples/list_page_number](https://github.com/thinreports/thinreports-generator/blob/master/examples/list_page_number).
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 [examples/eudc](https://github.com/thinreports/thinreports-generator/blob/master/examples/eudc).
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
- ### Report bug, post your suggestion
263
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thinreports/thinreports-generator.
267
264
 
268
- If you find bugs or improvements for the Editor, please report it [here](https://github.com/thinreports/thinreports-generator/issues/new).
265
+ ## Development
269
266
 
270
- ### Sending a Pull Request
267
+ ### How to run feature tests
271
268
 
272
- 1. Fork it
273
- 2. Clone your forked repository
274
- 3. Create your feature branch: `git checkout -b my-new-feature`
275
- 4. Fix your feature
276
- 5. Commit your changes: `git commit -am 'Fixed some bugs or features'`
277
- 6. Push to the branch: `git push origin my-new-feature`
278
- 7. Create new Pull Request
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
- # coding: utf-8
2
-
1
+ require 'bundler/gem_tasks'
3
2
  require 'rake/testtask'
4
- require 'yard'
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/unit/**/test_*.rb']
10
+ t.test_files = Dir['test/units/**/test_*.rb']
9
11
  end
10
12
 
11
- namespace :examples do
12
- desc 'Run all examples'
13
- task all: :_init do
14
- require_relative 'examples/helper'
15
- Dir['examples/*/*.rb'].each {|f| require_relative f }
16
- end
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 all examples'
34
- task examples: :'examples:all'
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 )
@@ -1,19 +1,20 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
2
4
 
3
5
  module Thinreports
4
- ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
6
+ def self.root
7
+ @root ||= Pathname.new(__FILE__).join('..', '..')
8
+ end
5
9
  end
6
10
 
7
- require 'thinreports/version'
8
- require 'thinreports/config'
9
- require 'thinreports/core/utils'
10
- require 'thinreports/core/errors'
11
- require 'thinreports/core/format/base'
12
- require 'thinreports/core/shape'
13
- require 'thinreports/core/utils'
14
- require 'thinreports/report'
15
- require 'thinreports/layout'
16
- require 'thinreports/generator'
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'
@@ -1,10 +1,10 @@
1
- # coding: utf-8
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(self.config, &block)
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
- # coding: utf-8
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