clamsy 0.0.4 → 0.0.5

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.
Files changed (58) hide show
  1. data/.gitignore +1 -0
  2. data/HISTORY.txt +10 -0
  3. data/README.rdoc +7 -63
  4. data/Rakefile +27 -2
  5. data/VERSION +1 -1
  6. data/clamsy.gemspec +77 -8
  7. data/examples/create_many.rb +15 -0
  8. data/examples/create_one.rb +15 -0
  9. data/examples/data/context.rb +41 -0
  10. data/examples/data/contexts.rb +2 -0
  11. data/examples/data/school_logo.jpg +0 -0
  12. data/examples/data/staff_signature.gif +0 -0
  13. data/examples/data/student_offer_letter.odt +0 -0
  14. data/lib/clamsy.rb +7 -2
  15. data/lib/clamsy.yml +32 -6
  16. data/lib/clamsy/base_printer.rb +10 -1
  17. data/lib/clamsy/configuration.rb +57 -10
  18. data/lib/clamsy/cups_pdf_printer.rb +3 -5
  19. data/lib/clamsy/file_system_support.rb +3 -3
  20. data/lib/clamsy/jod_converter_printer.rb +60 -0
  21. data/lib/clamsy/template_open_doc.rb +7 -1
  22. data/lib/jodconverter/CREDIT +1 -0
  23. data/lib/jodconverter/LICENSE.txt +504 -0
  24. data/lib/jodconverter/README.txt +58 -0
  25. data/lib/jodconverter/commons-cli-1.2.jar +0 -0
  26. data/lib/jodconverter/commons-io-1.4.jar +0 -0
  27. data/lib/jodconverter/jodconverter-2.2.2.jar +0 -0
  28. data/lib/jodconverter/jodconverter-cli-2.2.2.jar +0 -0
  29. data/lib/jodconverter/juh-3.0.1.jar +0 -0
  30. data/lib/jodconverter/jurt-3.0.1.jar +0 -0
  31. data/lib/jodconverter/ridl-3.0.1.jar +0 -0
  32. data/lib/jodconverter/slf4j-api-1.5.6.jar +0 -0
  33. data/lib/jodconverter/slf4j-jdk14-1.5.6.jar +0 -0
  34. data/lib/jodconverter/unoil-3.0.1.jar +0 -0
  35. data/lib/jodconverter/xstream-1.3.1.jar +0 -0
  36. data/spec/clamsy/configuration_spec.rb +323 -163
  37. data/spec/clamsy/cups_pdf_printer_spec.rb +1 -1
  38. data/spec/clamsy/invalid_printer_spec.rb +0 -4
  39. data/spec/clamsy/jod_converter_printer_spec.rb +58 -0
  40. data/spec/fake_ooffice_server.rb +18 -0
  41. data/spec/integration/cups_pdf_printer_spec.rb +4 -59
  42. data/spec/integration/has_integration_support_shared_spec.rb +85 -0
  43. data/spec/integration/jod_converter_printer_spec.rb +12 -0
  44. data/spec/pdfc/CCLib.jar +0 -0
  45. data/spec/pdfc/CREDIT +2 -0
  46. data/spec/pdfc/PDFC.bat +1 -0
  47. data/spec/pdfc/PDFC.jar +0 -0
  48. data/spec/pdfc/PDFC.sh +3 -0
  49. data/spec/pdfc/PDFParser.jar +0 -0
  50. data/spec/pdfc/config.xml +24 -0
  51. data/spec/pdfc/license/LICENSE.log4j +48 -0
  52. data/spec/pdfc/license/lgpl-3.0.txt +165 -0
  53. data/spec/pdfc/license/overview.txt +9 -0
  54. data/spec/pdfc/log4j-1.2.15.jar +0 -0
  55. data/spec/pdfc/readme.txt +89 -0
  56. data/spec/spec_helper.rb +28 -11
  57. metadata +87 -8
  58. data/spec/integration/has_stardand_integration_support_shared_spec.rb +0 -27
@@ -0,0 +1,9 @@
1
+ Here is an overview of the licenses in the various jar files provided with PDFC.
2
+
3
+
4
+ JAR file License Info
5
+ ---------------------------------------------------------------------------------------------
6
+ log4j-1.2.15.jar See license/LICENSE.log4j
7
+ PDFCParser.jar LGPL license - see lgpl-3.0.txt
8
+ PDFC.jar Copyright 2009-2010, i-net software. All rights reserved.
9
+ CCLib.jar Copyright 2009-2010, i-net software. All rights reserved.
@@ -0,0 +1,89 @@
1
+ i-net PDF Comparer v1.01
2
+ -------------------------
3
+ Copyright i-net software GmbH 2009-2010
4
+ All rights reserved
5
+
6
+ 1. Introduction
7
+ ---------------
8
+ The PDF Comparer is a tool specifically for comparing two PDF files (or folders containing PDF files)
9
+ for differences.
10
+ It is useful for comparing the PDF output of a Crystal Reports report with the PDF output of this same
11
+ report as exported by i-net Crystal-Clear, or for comparing the PDF output of two different versions
12
+ of i-net Crystal-Clear for any differences or behavioral changes. The following elements are compared
13
+ and any differences logged:
14
+
15
+ * Text differences (letters or words missing)
16
+ * Line/Arc/Box differences (lines or boxes missing or with different styles)
17
+ * Image differences (images missing)
18
+ * Margin differences (page margins different)
19
+
20
+ These differences each have a configurable tolerance value so that minor differences can be
21
+ ignored if necessary. (See point 3 - Configuration)
22
+
23
+ 2. Parameters
24
+ -------------
25
+ Usage:
26
+ PDFC [-c <config file>] [-[i][o]] [<Folder1> <Folder2> | <File1> <File2>]
27
+
28
+ -c Specify a configuration file (config.xml) for PDFC. If none is specified, the default "config.xml" is taken
29
+ -i Creates diff images in <Folder1>/differences for any differences found (recommended for a graphical comparison)
30
+ -o Creates images for each page of each version (need only be used for debug purposes)
31
+
32
+ Note that if using two folders, the PDF files must have the same names in each folder.
33
+
34
+ Will result in an output on the console for any differences found between the PDFs being compared.
35
+
36
+ Example usage:
37
+
38
+ PDFC -i CRFolder CCFolder
39
+
40
+ This would compare all PDF files in the folder "CRFolder" with the PDF files of the same name in the folder "CCFolder".
41
+
42
+ 3. Configuration
43
+ ----------------
44
+ The following tolerance values can be set in the config.xml file:
45
+
46
+ CHART_DENSITY_THRESHOLD
47
+ (Decimal) density threshold: ((number of shapes)^3 / area size)
48
+ CHART_REMOVAL_MARGIN
49
+ (Decimal) percent of shape height to use as margin for removing PDF elements above and below detected charts
50
+ CREATE_DIFFIMAGES
51
+ True to create png files with the marked difference of the compared pages
52
+ CREATE_ORIGIMAGES
53
+ True to create a png file for each page that is compared
54
+ LOG_LEVEL
55
+ Level for Logging (OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL). The default is set to WARN
56
+ MAX_ERRORS_PER_REPORT
57
+ maximum number of errors that can occur before the comparison is canceled for the current pdf file.
58
+ MAX_WORD_DIFFERENCES
59
+ maximum number of differences that can occur before the comparison is canceled
60
+ MODULES
61
+ comma separated list of modules to be executed for each page
62
+ NORMALIZERS
63
+ comma separated list of normalizers to be executed before and after each page
64
+ TOLERANCE_BOX_ROUND_EDGES
65
+ (Integer) maximum number of pixels that a curve control point may differ in total
66
+ TOLERANCE_IMAGE_DISTANCE
67
+ maximum number of pixels that the position of an image can differ
68
+ TOLERANCE_IMAGE_SIZE
69
+ maximum difference in percent, that the area spanned by an image may differ
70
+ TOLERANCE_LINE_POSITION
71
+ (Decimal) maximum number of pixels that the position of a line or curves can differ per axis
72
+ TOLERANCE_LINE_SIZE
73
+ (Integer) maximum number of pixels that the length of a line can differ in total
74
+ TOLERANCE_LINE_STYLE
75
+ (Boolean) if true, different stroke styles will be an error
76
+ TOLERANCE_LINE_THICKNESS
77
+ (Integer) maximum difference in stroke thickness of two lines or curves
78
+ TOLERANCE_PAGE_LEFTCORNER
79
+ maximum number of pixels that the left or top margin of a page can differ (is the upper left corner of all elements)
80
+ TOLERANCE_PAGE_RATIO
81
+ tolerance for the aspect ratio of the pdf page
82
+ TOLERANCE_PAGE_SIZE
83
+ maximum number of pixels that the width or height of a page can differ
84
+ TOLERANCE_UNDERLINE_LENGTH
85
+ (Decimal) the maximum difference in percent, which the length of underlines may differ
86
+
87
+ 4. Support
88
+
89
+ If you have any questions or problems, please do not hesitate to contact tools@inetsoftware.de for technical support.
@@ -5,19 +5,36 @@ require 'tempfile'
5
5
  require 'digest/md5'
6
6
  require 'yaml'
7
7
 
8
- $LOAD_PATH.unshift(File.dirname(__FILE__))
9
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
+ unless Object.const_defined?(:CLAMSY_LIB_DIR)
9
+ CLAMSY_LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','lib')
10
+ CLAMSY_SPEC_DIR = File.expand_path(File.dirname(__FILE__))
11
+ CLAMSY_BUNDLED_CONFIG = File.join(CLAMSY_LIB_DIR, 'clamsy.yml')
12
+ CLAMSY_PDFC_SCRIPT = File.join(CLAMSY_SPEC_DIR, 'pdfc', 'PDFC.sh')
13
+ end
14
+
15
+ $LOAD_PATH.unshift(CLAMSY_SPEC_DIR)
16
+ $LOAD_PATH.unshift(CLAMSY_LIB_DIR)
10
17
  require 'clamsy'
11
18
 
12
- shared 'has standard files support' do
13
- class << self
14
- def trash_tmp_files
15
- (@trashable_tmp_files || []).select {|f| f.path }.map(&:unlink)
16
- end
17
- def tmp_file(file_name)
18
- ((@trashable_tmp_files ||= []) << Tempfile.new(file_name))[-1]
19
- end
20
- end
19
+ def Module.backup_methods(meths)
20
+ meths.each {|meth| alias_method :"_orig_#{meth}", :"#{meth}" }
21
+ end
22
+
23
+ def Module.recover_methods(meths)
24
+ meths.each {|meth| alias_method :"#{meth}", :"_orig_#{meth}" }
25
+ end
26
+
27
+ def Clamsy.unconfigure
28
+ @config = nil
29
+ end
30
+
31
+ def trash_tmp_files
32
+ ($trashable_tmp_files || []).select {|f| f.path }.map(&:unlink)
33
+ $trashable_tmp_files = nil
34
+ end
35
+
36
+ def tmp_file(file_name)
37
+ (($trashable_tmp_files ||= []) << Tempfile.new(file_name))[-1]
21
38
  end
22
39
 
23
40
  Bacon.summary_on_exit
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - NgTzeYang
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-04 00:00:00 +08:00
17
+ date: 2010-05-19 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -74,7 +74,21 @@ dependencies:
74
74
  version: 1.1.0
75
75
  type: :development
76
76
  version_requirements: *id004
77
- description: ""
77
+ - !ruby/object:Gem::Dependency
78
+ name: eventmachine
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ - 12
87
+ - 10
88
+ version: 0.12.10
89
+ type: :development
90
+ version_requirements: *id005
91
+ description: Ruby wrapper for generating a single pdf for multiple contexts from an odt template.
78
92
  email: ngty77@gmail.com
79
93
  executables: []
80
94
 
@@ -93,14 +107,37 @@ files:
93
107
  - VERSION
94
108
  - clamsy.gemspec
95
109
  - clamsy.png
110
+ - examples/create_many.rb
111
+ - examples/create_one.rb
112
+ - examples/data/context.rb
113
+ - examples/data/contexts.rb
114
+ - examples/data/school_logo.jpg
115
+ - examples/data/staff_signature.gif
116
+ - examples/data/student_offer_letter.odt
117
+ - examples/tmp/dummy
96
118
  - lib/clamsy.rb
97
119
  - lib/clamsy.yml
98
120
  - lib/clamsy/base_printer.rb
99
121
  - lib/clamsy/configuration.rb
100
122
  - lib/clamsy/cups_pdf_printer.rb
101
123
  - lib/clamsy/file_system_support.rb
124
+ - lib/clamsy/jod_converter_printer.rb
102
125
  - lib/clamsy/template_open_doc.rb
103
126
  - lib/clamsy/tenjin.rb
127
+ - lib/jodconverter/CREDIT
128
+ - lib/jodconverter/LICENSE.txt
129
+ - lib/jodconverter/README.txt
130
+ - lib/jodconverter/commons-cli-1.2.jar
131
+ - lib/jodconverter/commons-io-1.4.jar
132
+ - lib/jodconverter/jodconverter-2.2.2.jar
133
+ - lib/jodconverter/jodconverter-cli-2.2.2.jar
134
+ - lib/jodconverter/juh-3.0.1.jar
135
+ - lib/jodconverter/jurt-3.0.1.jar
136
+ - lib/jodconverter/ridl-3.0.1.jar
137
+ - lib/jodconverter/slf4j-api-1.5.6.jar
138
+ - lib/jodconverter/slf4j-jdk14-1.5.6.jar
139
+ - lib/jodconverter/unoil-3.0.1.jar
140
+ - lib/jodconverter/xstream-1.3.1.jar
104
141
  - spec/clamsy/base_printer_spec.rb
105
142
  - spec/clamsy/configuration_spec.rb
106
143
  - spec/clamsy/cups_pdf_printer_spec.rb
@@ -120,7 +157,9 @@ files:
120
157
  - spec/clamsy/data/plain_text_before.odt
121
158
  - spec/clamsy/file_system_support_spec.rb
122
159
  - spec/clamsy/invalid_printer_spec.rb
160
+ - spec/clamsy/jod_converter_printer_spec.rb
123
161
  - spec/clamsy/template_open_doc_spec.rb
162
+ - spec/fake_ooffice_server.rb
124
163
  - spec/integration/cups_pdf_printer_spec.rb
125
164
  - spec/integration/data/embedded_ruby_example.odt
126
165
  - spec/integration/data/embedded_ruby_example.pdf
@@ -134,13 +173,46 @@ files:
134
173
  - spec/integration/data/plain_text_example.odt
135
174
  - spec/integration/data/plain_text_example.pdf
136
175
  - spec/integration/data/sunny_clamsy.png
137
- - spec/integration/has_stardand_integration_support_shared_spec.rb
176
+ - spec/integration/has_integration_support_shared_spec.rb
177
+ - spec/integration/jod_converter_printer_spec.rb
178
+ - spec/pdfc/CCLib.jar
179
+ - spec/pdfc/CREDIT
180
+ - spec/pdfc/PDFC.bat
181
+ - spec/pdfc/PDFC.jar
182
+ - spec/pdfc/PDFC.sh
183
+ - spec/pdfc/PDFParser.jar
184
+ - spec/pdfc/config.xml
185
+ - spec/pdfc/license/LICENSE.log4j
186
+ - spec/pdfc/license/lgpl-3.0.txt
187
+ - spec/pdfc/license/overview.txt
188
+ - spec/pdfc/log4j-1.2.15.jar
189
+ - spec/pdfc/readme.txt
138
190
  - spec/spec_helper.rb
139
191
  has_rdoc: true
140
192
  homepage: http://github.com/ngty/clamsy
141
193
  licenses: []
142
194
 
143
- post_install_message:
195
+ post_install_message: |+
196
+
197
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
198
+
199
+ :: CLAMSY ::
200
+
201
+ Thank you for installing clamsy-0.0.5.
202
+
203
+ Starting from this release, the default printer has been changed from 'cups_pdf' to
204
+ 'jod_convertor'. If java is in your PATH, and openoffice is installed the standard way,
205
+ most probably, no additional action is required after this gem installation.
206
+
207
+ We are in the process of constructing the clamsy wiki @ http://wiki.github.com/ngty/clamsy, pls
208
+ take a look there for solution(s) to your problem(s).
209
+
210
+ Alternatively, you may wish to post ur problem @ http://github.com/ngty/clamsy/issues.
211
+
212
+ Have a nice day !!
213
+
214
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
215
+
144
216
  rdoc_options:
145
217
  - --charset=UTF-8
146
218
  require_paths:
@@ -165,14 +237,21 @@ rubyforge_project:
165
237
  rubygems_version: 1.3.6
166
238
  signing_key:
167
239
  specification_version: 3
168
- summary: A clumsily shellish way to generate a single pdf for multiple contexts from an odt template
240
+ summary: Clamsy makes PDF generation simple
169
241
  test_files:
242
+ - spec/fake_ooffice_server.rb
243
+ - spec/integration/jod_converter_printer_spec.rb
170
244
  - spec/integration/cups_pdf_printer_spec.rb
171
- - spec/integration/has_stardand_integration_support_shared_spec.rb
245
+ - spec/integration/has_integration_support_shared_spec.rb
172
246
  - spec/clamsy/file_system_support_spec.rb
173
247
  - spec/clamsy/base_printer_spec.rb
248
+ - spec/clamsy/jod_converter_printer_spec.rb
174
249
  - spec/clamsy/cups_pdf_printer_spec.rb
175
250
  - spec/clamsy/invalid_printer_spec.rb
176
251
  - spec/clamsy/configuration_spec.rb
177
252
  - spec/clamsy/template_open_doc_spec.rb
178
253
  - spec/spec_helper.rb
254
+ - examples/create_many.rb
255
+ - examples/data/contexts.rb
256
+ - examples/data/context.rb
257
+ - examples/create_one.rb
@@ -1,27 +0,0 @@
1
- shared 'has standard integration support' do
2
- class << self
3
-
4
- INSIGNIFICANT_AND_UNMATCHABLE_PATTERNS = [
5
- /^q\[\-?\d+\.?\d*( \-?\d+\.?\d*){5}\]concat\n$/,
6
- /^\d+\.?\d*( \d+\.?\d*){3} re\n$/
7
- ]
8
-
9
- def data_file(file)
10
- File.join(File.dirname(__FILE__), 'data', file)
11
- end
12
-
13
- def template_doc(name)
14
- data_file("#{name}_example.odt")
15
- end
16
-
17
- def expected_pdf(name)
18
- data_file("#{name}_example.pdf")
19
- end
20
-
21
- def comparable_content(file)
22
- RGhost::Convert.new(file).to(:ps).read.grep(/^[^%][^%]?/).
23
- reject {|line| INSIGNIFICANT_AND_UNMATCHABLE_PATTERNS.any? {|regexp| regexp =~ line } }
24
- end
25
-
26
- end
27
- end