gjman 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.document +5 -0
  2. data/.gitignore +23 -0
  3. data/HISTORY.txt +8 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +65 -0
  6. data/Rakefile +83 -0
  7. data/VERSION +1 -0
  8. data/gjman.gemspec +116 -0
  9. data/lib/ext/multivalent/Multivalent20060102.jar +0 -0
  10. data/lib/ext/pdfc/CCLib.jar +0 -0
  11. data/lib/ext/pdfc/CREDIT +2 -0
  12. data/lib/ext/pdfc/PDFC.bat +1 -0
  13. data/lib/ext/pdfc/PDFC.jar +0 -0
  14. data/lib/ext/pdfc/PDFC.sh +3 -0
  15. data/lib/ext/pdfc/PDFParser.jar +0 -0
  16. data/lib/ext/pdfc/config.xml +24 -0
  17. data/lib/ext/pdfc/license/LICENSE.log4j +48 -0
  18. data/lib/ext/pdfc/license/lgpl-3.0.txt +165 -0
  19. data/lib/ext/pdfc/license/overview.txt +9 -0
  20. data/lib/ext/pdfc/log4j-1.2.15.jar +0 -0
  21. data/lib/ext/pdfc/readme.txt +89 -0
  22. data/lib/gjman.rb +29 -0
  23. data/lib/gjman/file_system.rb +46 -0
  24. data/lib/gjman/java_hacks/ForbidSystemExit$1.class +0 -0
  25. data/lib/gjman/java_hacks/ForbidSystemExit$Exception.class +0 -0
  26. data/lib/gjman/java_hacks/ForbidSystemExit.class +0 -0
  27. data/lib/gjman/java_hacks/ForbidSystemExit.java +23 -0
  28. data/lib/gjman/jruby.rb +34 -0
  29. data/lib/gjman/pdf.rb +30 -0
  30. data/lib/gjman/pdf/base.rb +31 -0
  31. data/lib/gjman/pdf/compressor.rb +50 -0
  32. data/lib/gjman/pdf/matcher.rb +28 -0
  33. data/lib/gjman/pdf/merger.rb +25 -0
  34. data/lib/gjman/pdf/utils.rb +2 -0
  35. data/lib/gjman/pdf/utils/multivalent.rb +58 -0
  36. data/lib/gjman/pdf/utils/pdfc.rb +52 -0
  37. data/lib/gjman/rjb.rb +32 -0
  38. data/spec/generic/file_system_spec.rb +100 -0
  39. data/spec/generic/spec_helper.rb +2 -0
  40. data/spec/pdf/compressor_spec.rb +114 -0
  41. data/spec/pdf/data/compressed.pdf +0 -0
  42. data/spec/pdf/data/merged_pages.pdf +0 -0
  43. data/spec/pdf/data/page1.pdf +0 -0
  44. data/spec/pdf/data/page2.pdf +0 -0
  45. data/spec/pdf/data/page3.pdf +0 -0
  46. data/spec/pdf/data/picture_x1.pdf +0 -0
  47. data/spec/pdf/data/picture_x2.pdf +0 -0
  48. data/spec/pdf/data/picture_x3_diff_pos.pdf +0 -0
  49. data/spec/pdf/data/picture_x4_diff_size.pdf +0 -0
  50. data/spec/pdf/data/picture_y1.pdf +0 -0
  51. data/spec/pdf/data/text_x1.pdf +0 -0
  52. data/spec/pdf/data/text_x2.pdf +0 -0
  53. data/spec/pdf/data/text_y1.pdf +0 -0
  54. data/spec/pdf/data/text_y2_diff_pos.pdf +0 -0
  55. data/spec/pdf/data/text_y3_diff_size.pdf +0 -0
  56. data/spec/pdf/data/text_y4_diff_font.pdf +0 -0
  57. data/spec/pdf/data/text_y5_diff_style.pdf +0 -0
  58. data/spec/pdf/data/text_y6_diff_color.pdf +0 -0
  59. data/spec/pdf/data/text_y7_diff_bg.pdf +0 -0
  60. data/spec/pdf/data/uncompressed.pdf +0 -0
  61. data/spec/pdf/matcher_spec.rb +65 -0
  62. data/spec/pdf/merger_spec.rb +27 -0
  63. data/spec/pdf/spec_helper.rb +13 -0
  64. data/spec/spec_helper.rb +42 -0
  65. metadata +150 -0
@@ -0,0 +1,42 @@
1
+ require 'rubygems'
2
+ require 'bacon'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ # require 'gjman'
7
+
8
+ Bacon.summary_on_exit
9
+
10
+ def trash_tmp_files
11
+ ($trashable_tmp_files || []).select {|f| f.path }.map(&:unlink)
12
+ $trashable_tmp_files = nil
13
+ end
14
+
15
+ def tmp_file(file_name)
16
+ (($trashable_tmp_files ||= []) << Tempfile.new(file_name))[-1]
17
+ end
18
+
19
+ def equal_in_size_as(expected_file)
20
+ lambda do |subject_file|
21
+ subject_file_size = File.size(subject_file).to_f
22
+ expected_file_size = File.size(expected_file).to_f
23
+ ((subject_file_size - expected_file_size).abs / subject_file_size) < 0.0001
24
+ end
25
+ end
26
+
27
+ def smaller_in_size_than(expected_file)
28
+ lambda do |subject_file|
29
+ subject_file_size = File.size(subject_file)
30
+ expected_file_size = File.size(expected_file)
31
+ (subject_file_size - expected_file_size) < 0
32
+ end
33
+ end
34
+
35
+ def bigger_in_size_than(expected_file)
36
+ lambda do |subject_file|
37
+ subject_file_size = File.size(subject_file)
38
+ expected_file_size = File.size(expected_file)
39
+ (subject_file_size - expected_file_size) > 0
40
+ end
41
+ end
42
+
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gjman
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - NgTzeYang
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-31 00:00:00 +08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: bacon
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: "\n Gjman is my neighbourhood friendly handyman with some useful tools.\n Tools available will remain diverse, and are added as and when i need them.\n "
36
+ email: ngty77@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - HISTORY.txt
48
+ - LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - VERSION
52
+ - gjman.gemspec
53
+ - lib/ext/multivalent/Multivalent20060102.jar
54
+ - lib/ext/pdfc/CCLib.jar
55
+ - lib/ext/pdfc/CREDIT
56
+ - lib/ext/pdfc/PDFC.bat
57
+ - lib/ext/pdfc/PDFC.jar
58
+ - lib/ext/pdfc/PDFC.sh
59
+ - lib/ext/pdfc/PDFParser.jar
60
+ - lib/ext/pdfc/config.xml
61
+ - lib/ext/pdfc/license/LICENSE.log4j
62
+ - lib/ext/pdfc/license/lgpl-3.0.txt
63
+ - lib/ext/pdfc/license/overview.txt
64
+ - lib/ext/pdfc/log4j-1.2.15.jar
65
+ - lib/ext/pdfc/readme.txt
66
+ - lib/gjman.rb
67
+ - lib/gjman/file_system.rb
68
+ - lib/gjman/java_hacks/ForbidSystemExit$1.class
69
+ - lib/gjman/java_hacks/ForbidSystemExit$Exception.class
70
+ - lib/gjman/java_hacks/ForbidSystemExit.class
71
+ - lib/gjman/java_hacks/ForbidSystemExit.java
72
+ - lib/gjman/jruby.rb
73
+ - lib/gjman/pdf.rb
74
+ - lib/gjman/pdf/base.rb
75
+ - lib/gjman/pdf/compressor.rb
76
+ - lib/gjman/pdf/matcher.rb
77
+ - lib/gjman/pdf/merger.rb
78
+ - lib/gjman/pdf/utils.rb
79
+ - lib/gjman/pdf/utils/multivalent.rb
80
+ - lib/gjman/pdf/utils/pdfc.rb
81
+ - lib/gjman/rjb.rb
82
+ - spec/generic/file_system_spec.rb
83
+ - spec/generic/spec_helper.rb
84
+ - spec/pdf/compressor_spec.rb
85
+ - spec/pdf/data/compressed.pdf
86
+ - spec/pdf/data/merged_pages.pdf
87
+ - spec/pdf/data/page1.pdf
88
+ - spec/pdf/data/page2.pdf
89
+ - spec/pdf/data/page3.pdf
90
+ - spec/pdf/data/picture_x1.pdf
91
+ - spec/pdf/data/picture_x2.pdf
92
+ - spec/pdf/data/picture_x3_diff_pos.pdf
93
+ - spec/pdf/data/picture_x4_diff_size.pdf
94
+ - spec/pdf/data/picture_y1.pdf
95
+ - spec/pdf/data/text_x1.pdf
96
+ - spec/pdf/data/text_x2.pdf
97
+ - spec/pdf/data/text_y1.pdf
98
+ - spec/pdf/data/text_y2_diff_pos.pdf
99
+ - spec/pdf/data/text_y3_diff_size.pdf
100
+ - spec/pdf/data/text_y4_diff_font.pdf
101
+ - spec/pdf/data/text_y5_diff_style.pdf
102
+ - spec/pdf/data/text_y6_diff_color.pdf
103
+ - spec/pdf/data/text_y7_diff_bg.pdf
104
+ - spec/pdf/data/uncompressed.pdf
105
+ - spec/pdf/matcher_spec.rb
106
+ - spec/pdf/merger_spec.rb
107
+ - spec/pdf/spec_helper.rb
108
+ - spec/spec_helper.rb
109
+ has_rdoc: true
110
+ homepage: http://github.com/ngty/gjman
111
+ licenses: []
112
+
113
+ post_install_message:
114
+ rdoc_options:
115
+ - --charset=UTF-8
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ requirements: []
137
+
138
+ rubyforge_project:
139
+ rubygems_version: 1.3.7
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: Gjman is a handyman with some useful tools
143
+ test_files:
144
+ - spec/pdf/compressor_spec.rb
145
+ - spec/pdf/matcher_spec.rb
146
+ - spec/pdf/merger_spec.rb
147
+ - spec/pdf/spec_helper.rb
148
+ - spec/generic/file_system_spec.rb
149
+ - spec/generic/spec_helper.rb
150
+ - spec/spec_helper.rb