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.
- data/.gitignore +1 -0
- data/HISTORY.txt +10 -0
- data/README.rdoc +7 -63
- data/Rakefile +27 -2
- data/VERSION +1 -1
- data/clamsy.gemspec +77 -8
- data/examples/create_many.rb +15 -0
- data/examples/create_one.rb +15 -0
- data/examples/data/context.rb +41 -0
- data/examples/data/contexts.rb +2 -0
- data/examples/data/school_logo.jpg +0 -0
- data/examples/data/staff_signature.gif +0 -0
- data/examples/data/student_offer_letter.odt +0 -0
- data/lib/clamsy.rb +7 -2
- data/lib/clamsy.yml +32 -6
- data/lib/clamsy/base_printer.rb +10 -1
- data/lib/clamsy/configuration.rb +57 -10
- data/lib/clamsy/cups_pdf_printer.rb +3 -5
- data/lib/clamsy/file_system_support.rb +3 -3
- data/lib/clamsy/jod_converter_printer.rb +60 -0
- data/lib/clamsy/template_open_doc.rb +7 -1
- data/lib/jodconverter/CREDIT +1 -0
- data/lib/jodconverter/LICENSE.txt +504 -0
- data/lib/jodconverter/README.txt +58 -0
- data/lib/jodconverter/commons-cli-1.2.jar +0 -0
- data/lib/jodconverter/commons-io-1.4.jar +0 -0
- data/lib/jodconverter/jodconverter-2.2.2.jar +0 -0
- data/lib/jodconverter/jodconverter-cli-2.2.2.jar +0 -0
- data/lib/jodconverter/juh-3.0.1.jar +0 -0
- data/lib/jodconverter/jurt-3.0.1.jar +0 -0
- data/lib/jodconverter/ridl-3.0.1.jar +0 -0
- data/lib/jodconverter/slf4j-api-1.5.6.jar +0 -0
- data/lib/jodconverter/slf4j-jdk14-1.5.6.jar +0 -0
- data/lib/jodconverter/unoil-3.0.1.jar +0 -0
- data/lib/jodconverter/xstream-1.3.1.jar +0 -0
- data/spec/clamsy/configuration_spec.rb +323 -163
- data/spec/clamsy/cups_pdf_printer_spec.rb +1 -1
- data/spec/clamsy/invalid_printer_spec.rb +0 -4
- data/spec/clamsy/jod_converter_printer_spec.rb +58 -0
- data/spec/fake_ooffice_server.rb +18 -0
- data/spec/integration/cups_pdf_printer_spec.rb +4 -59
- data/spec/integration/has_integration_support_shared_spec.rb +85 -0
- data/spec/integration/jod_converter_printer_spec.rb +12 -0
- data/spec/pdfc/CCLib.jar +0 -0
- data/spec/pdfc/CREDIT +2 -0
- data/spec/pdfc/PDFC.bat +1 -0
- data/spec/pdfc/PDFC.jar +0 -0
- data/spec/pdfc/PDFC.sh +3 -0
- data/spec/pdfc/PDFParser.jar +0 -0
- data/spec/pdfc/config.xml +24 -0
- data/spec/pdfc/license/LICENSE.log4j +48 -0
- data/spec/pdfc/license/lgpl-3.0.txt +165 -0
- data/spec/pdfc/license/overview.txt +9 -0
- data/spec/pdfc/log4j-1.2.15.jar +0 -0
- data/spec/pdfc/readme.txt +89 -0
- data/spec/spec_helper.rb +28 -11
- metadata +87 -8
- data/spec/integration/has_stardand_integration_support_shared_spec.rb +0 -27
data/.gitignore
CHANGED
data/HISTORY.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 0.0.5 (May 19, 2010)
|
2
|
+
|
3
|
+
* fixed inconsistent ghostscript failure [#ngty]
|
4
|
+
* added examples demostrating clamsy in action [#ngty]
|
5
|
+
* fixed subtle bugs in multi-printer support in configuration & major cleaning up of configuration spec [#ngty]
|
6
|
+
* enhanced bundled configuration support such that it is platform specific (currently only linux & mac are
|
7
|
+
supported though) [#ngty]
|
8
|
+
* added new printer 'jod_converter', which is now the default printer (since it has higher chance of working
|
9
|
+
out of the box, as compared to the more-tedious-to-setup 'cups_pdf' printer) [#ngty]
|
10
|
+
|
1
11
|
=== 0.0.4 (May 04, 2010)
|
2
12
|
|
3
13
|
* fixed bug in multiple pictures replacement [#ngty]
|
data/README.rdoc
CHANGED
@@ -2,15 +2,6 @@
|
|
2
2
|
|
3
3
|
Ruby wrapper for generating a single pdf for multiple contexts from an odt template.
|
4
4
|
|
5
|
-
clamsy = clumsy + shellish
|
6
|
-
| |
|
7
|
-
| |-- under the hood, we are making system calls to ooffice &
|
8
|
-
| cups server needs to be running
|
9
|
-
|
|
10
|
-
|-- setup isn't straight forward, need to install a couple of packages
|
11
|
-
(how bad it is depends on ur platform) & even manual setting up of
|
12
|
-
cups-pdf printer is needed
|
13
|
-
|
14
5
|
== 1. Basics
|
15
6
|
|
16
7
|
A template odt is just an ordinary odt (http://en.wikipedia.org/wiki/OpenDocument).
|
@@ -182,68 +173,21 @@ code does the appropriate replacing of images:
|
|
182
173
|
|
183
174
|
== 3. Configuration
|
184
175
|
|
185
|
-
|
186
|
-
|
187
|
-
printer: cups_pdf
|
188
|
-
cups_pdf:
|
189
|
-
cups_output_dir: /var/spool/cups-pdf/${USER}
|
190
|
-
cups_output_file:
|
191
|
-
ooffice_cmd: ooffice -norestore -nofirststartwizard -nologo -headless -pt Cups-PDF
|
192
|
-
|
193
|
-
NOTES:
|
194
|
-
* ${...} gets replaced by the corresponding ENV variable, eg. ${USER} gets replaced
|
195
|
-
by ENV['USER']
|
196
|
-
* printer ... describes which printer to use (currently, we ONLY have 'cups_pdf')
|
197
|
-
* cups_output_dir ... the directory where cups-pdf places the intermediate working pdf,
|
198
|
-
in linux box, it is specifed by the 'Out' variable in /etc/cups/cups-pdf.conf
|
199
|
-
* cups_output_file ... specifies the exact intermediate working pdf, when this is
|
200
|
-
specified, cups_output_dir is ignored
|
201
|
-
* ooffice_cmd ... the openoffice command & arguments to use
|
202
|
-
|
203
|
-
=== 3.2. Clamsy\.configure {|config| ... }
|
204
|
-
|
205
|
-
Clamsy.configure do |config|
|
206
|
-
config.printer = 'another_printer'
|
207
|
-
config.config_file = '/path/to/alternative/clamsy.yml'
|
208
|
-
config.cups_output_dir = '/another/output/dir'
|
209
|
-
config.cups_output_file = lambda { Dir.glob('/yet/another/output/dir/*.pdf').sort.last }
|
210
|
-
end
|
211
|
-
|
212
|
-
NOTES:
|
213
|
-
* config_file ... alternative user-defined config file, when specified, ~/.clamsy.yml will
|
214
|
-
be ignored (whatever is supported in this config file is exactly the same as 3.1)
|
215
|
-
* cups_output_file ... unlike what we have in the yaml config file, this can be either a
|
216
|
-
proc or a string
|
217
|
-
|
218
|
-
=== 3.3. Clamsy\.process(...) {|config| ... }
|
219
|
-
|
220
|
-
Clamsy.process(contexts, template_odt, final_pdf) do |config|
|
221
|
-
# the rest is the same as 3.2
|
222
|
-
end
|
176
|
+
(see http://wiki.github.com/ngty/clamsy/configuration)
|
223
177
|
|
224
178
|
== 4. Pre-requisites
|
225
179
|
|
226
|
-
|
227
|
-
|
228
|
-
* Installing packages:
|
229
|
-
$ sudo pacman -S ghostscript cups cups-pdf go-openoffice
|
230
|
-
|
231
|
-
* Setting up the cups-pdf virtual printer by following instructions @
|
232
|
-
http://wiki.archlinux.org/index.php/CUPS#Configuring_CUPS-PDF_virtual_printer
|
233
|
-
|
234
|
-
* Making sure cups is running:
|
235
|
-
$ sudo /etc/rc.d/cups start
|
236
|
-
|
237
|
-
=== 4.2. Ubuntu (to-be-updated)
|
238
|
-
|
239
|
-
=== 4.3. Mac (to-be-updated)
|
180
|
+
* Make sure openoffice, java & ghostscript are installed
|
240
181
|
|
241
182
|
== TODO
|
242
183
|
|
184
|
+
* address security risk of user running destructive commands within embedded ruby in odt
|
185
|
+
template
|
186
|
+
* support for other platforms (eg. windows & jruby)
|
187
|
+
* turn off non-santized ruby expression by default (since the generated doc easily breaks
|
188
|
+
when underlying xml is invalid)
|
243
189
|
* automate cups-pdf printer setup
|
244
190
|
|
245
|
-
* more printers support (currently, we ONLY have Clamsy::CupsPdfPrinter)
|
246
|
-
|
247
191
|
== Note on Patches/Pull Requests
|
248
192
|
|
249
193
|
* Fork the project.
|
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "clamsy"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{}
|
8
|
+
gem.summary = %Q{Clamsy makes PDF generation simple}
|
9
|
+
gem.description = %Q{Ruby wrapper for generating a single pdf for multiple contexts from an odt template.}
|
10
10
|
gem.email = "ngty77@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/ngty/clamsy"
|
12
12
|
gem.authors = ["NgTzeYang"]
|
@@ -14,7 +14,32 @@ begin
|
|
14
14
|
gem.add_dependency "rghost", "= 0.8.7.2"
|
15
15
|
gem.add_dependency "nokogiri", "= 1.4.1"
|
16
16
|
gem.add_development_dependency "bacon", ">= 1.1.0"
|
17
|
+
gem.add_development_dependency "eventmachine", ">= 0.12.10"
|
17
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
|
+
|
20
|
+
gem.post_install_message = <<-POST_INSTALL_MESSAGE
|
21
|
+
|
22
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23
|
+
|
24
|
+
:: CLAMSY ::
|
25
|
+
|
26
|
+
Thank you for installing clamsy-0.0.5.
|
27
|
+
|
28
|
+
Starting from this release, the default printer has been changed from 'cups_pdf' to
|
29
|
+
'jod_convertor'. If java is in your PATH, and openoffice is installed the standard way,
|
30
|
+
most probably, no additional action is required after this gem installation.
|
31
|
+
|
32
|
+
We are in the process of constructing the clamsy wiki @ http://wiki.github.com/ngty/clamsy, pls
|
33
|
+
take a look there for solution(s) to your problem(s).
|
34
|
+
|
35
|
+
Alternatively, you may wish to post ur problem @ http://github.com/ngty/clamsy/issues.
|
36
|
+
|
37
|
+
Have a nice day !!
|
38
|
+
|
39
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40
|
+
|
41
|
+
POST_INSTALL_MESSAGE
|
42
|
+
|
18
43
|
end
|
19
44
|
Jeweler::GemcutterTasks.new
|
20
45
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/clamsy.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{clamsy}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["NgTzeYang"]
|
12
|
-
s.date = %q{2010-05-
|
13
|
-
s.description = %q{}
|
12
|
+
s.date = %q{2010-05-19}
|
13
|
+
s.description = %q{Ruby wrapper for generating a single pdf for multiple contexts from an odt template.}
|
14
14
|
s.email = %q{ngty77@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
@@ -26,14 +26,37 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION",
|
27
27
|
"clamsy.gemspec",
|
28
28
|
"clamsy.png",
|
29
|
+
"examples/create_many.rb",
|
30
|
+
"examples/create_one.rb",
|
31
|
+
"examples/data/context.rb",
|
32
|
+
"examples/data/contexts.rb",
|
33
|
+
"examples/data/school_logo.jpg",
|
34
|
+
"examples/data/staff_signature.gif",
|
35
|
+
"examples/data/student_offer_letter.odt",
|
36
|
+
"examples/tmp/dummy",
|
29
37
|
"lib/clamsy.rb",
|
30
38
|
"lib/clamsy.yml",
|
31
39
|
"lib/clamsy/base_printer.rb",
|
32
40
|
"lib/clamsy/configuration.rb",
|
33
41
|
"lib/clamsy/cups_pdf_printer.rb",
|
34
42
|
"lib/clamsy/file_system_support.rb",
|
43
|
+
"lib/clamsy/jod_converter_printer.rb",
|
35
44
|
"lib/clamsy/template_open_doc.rb",
|
36
45
|
"lib/clamsy/tenjin.rb",
|
46
|
+
"lib/jodconverter/CREDIT",
|
47
|
+
"lib/jodconverter/LICENSE.txt",
|
48
|
+
"lib/jodconverter/README.txt",
|
49
|
+
"lib/jodconverter/commons-cli-1.2.jar",
|
50
|
+
"lib/jodconverter/commons-io-1.4.jar",
|
51
|
+
"lib/jodconverter/jodconverter-2.2.2.jar",
|
52
|
+
"lib/jodconverter/jodconverter-cli-2.2.2.jar",
|
53
|
+
"lib/jodconverter/juh-3.0.1.jar",
|
54
|
+
"lib/jodconverter/jurt-3.0.1.jar",
|
55
|
+
"lib/jodconverter/ridl-3.0.1.jar",
|
56
|
+
"lib/jodconverter/slf4j-api-1.5.6.jar",
|
57
|
+
"lib/jodconverter/slf4j-jdk14-1.5.6.jar",
|
58
|
+
"lib/jodconverter/unoil-3.0.1.jar",
|
59
|
+
"lib/jodconverter/xstream-1.3.1.jar",
|
37
60
|
"spec/clamsy/base_printer_spec.rb",
|
38
61
|
"spec/clamsy/configuration_spec.rb",
|
39
62
|
"spec/clamsy/cups_pdf_printer_spec.rb",
|
@@ -53,7 +76,9 @@ Gem::Specification.new do |s|
|
|
53
76
|
"spec/clamsy/data/plain_text_before.odt",
|
54
77
|
"spec/clamsy/file_system_support_spec.rb",
|
55
78
|
"spec/clamsy/invalid_printer_spec.rb",
|
79
|
+
"spec/clamsy/jod_converter_printer_spec.rb",
|
56
80
|
"spec/clamsy/template_open_doc_spec.rb",
|
81
|
+
"spec/fake_ooffice_server.rb",
|
57
82
|
"spec/integration/cups_pdf_printer_spec.rb",
|
58
83
|
"spec/integration/data/embedded_ruby_example.odt",
|
59
84
|
"spec/integration/data/embedded_ruby_example.pdf",
|
@@ -67,24 +92,65 @@ Gem::Specification.new do |s|
|
|
67
92
|
"spec/integration/data/plain_text_example.odt",
|
68
93
|
"spec/integration/data/plain_text_example.pdf",
|
69
94
|
"spec/integration/data/sunny_clamsy.png",
|
70
|
-
"spec/integration/
|
95
|
+
"spec/integration/has_integration_support_shared_spec.rb",
|
96
|
+
"spec/integration/jod_converter_printer_spec.rb",
|
97
|
+
"spec/pdfc/CCLib.jar",
|
98
|
+
"spec/pdfc/CREDIT",
|
99
|
+
"spec/pdfc/PDFC.bat",
|
100
|
+
"spec/pdfc/PDFC.jar",
|
101
|
+
"spec/pdfc/PDFC.sh",
|
102
|
+
"spec/pdfc/PDFParser.jar",
|
103
|
+
"spec/pdfc/config.xml",
|
104
|
+
"spec/pdfc/license/LICENSE.log4j",
|
105
|
+
"spec/pdfc/license/lgpl-3.0.txt",
|
106
|
+
"spec/pdfc/license/overview.txt",
|
107
|
+
"spec/pdfc/log4j-1.2.15.jar",
|
108
|
+
"spec/pdfc/readme.txt",
|
71
109
|
"spec/spec_helper.rb"
|
72
110
|
]
|
73
111
|
s.homepage = %q{http://github.com/ngty/clamsy}
|
112
|
+
s.post_install_message = %q{
|
113
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
114
|
+
|
115
|
+
:: CLAMSY ::
|
116
|
+
|
117
|
+
Thank you for installing clamsy-0.0.5.
|
118
|
+
|
119
|
+
Starting from this release, the default printer has been changed from 'cups_pdf' to
|
120
|
+
'jod_convertor'. If java is in your PATH, and openoffice is installed the standard way,
|
121
|
+
most probably, no additional action is required after this gem installation.
|
122
|
+
|
123
|
+
We are in the process of constructing the clamsy wiki @ http://wiki.github.com/ngty/clamsy, pls
|
124
|
+
take a look there for solution(s) to your problem(s).
|
125
|
+
|
126
|
+
Alternatively, you may wish to post ur problem @ http://github.com/ngty/clamsy/issues.
|
127
|
+
|
128
|
+
Have a nice day !!
|
129
|
+
|
130
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
131
|
+
|
132
|
+
}
|
74
133
|
s.rdoc_options = ["--charset=UTF-8"]
|
75
134
|
s.require_paths = ["lib"]
|
76
135
|
s.rubygems_version = %q{1.3.6}
|
77
|
-
s.summary = %q{
|
136
|
+
s.summary = %q{Clamsy makes PDF generation simple}
|
78
137
|
s.test_files = [
|
79
|
-
"spec/
|
80
|
-
"spec/integration/
|
138
|
+
"spec/fake_ooffice_server.rb",
|
139
|
+
"spec/integration/jod_converter_printer_spec.rb",
|
140
|
+
"spec/integration/cups_pdf_printer_spec.rb",
|
141
|
+
"spec/integration/has_integration_support_shared_spec.rb",
|
81
142
|
"spec/clamsy/file_system_support_spec.rb",
|
82
143
|
"spec/clamsy/base_printer_spec.rb",
|
144
|
+
"spec/clamsy/jod_converter_printer_spec.rb",
|
83
145
|
"spec/clamsy/cups_pdf_printer_spec.rb",
|
84
146
|
"spec/clamsy/invalid_printer_spec.rb",
|
85
147
|
"spec/clamsy/configuration_spec.rb",
|
86
148
|
"spec/clamsy/template_open_doc_spec.rb",
|
87
|
-
"spec/spec_helper.rb"
|
149
|
+
"spec/spec_helper.rb",
|
150
|
+
"examples/create_many.rb",
|
151
|
+
"examples/data/contexts.rb",
|
152
|
+
"examples/data/context.rb",
|
153
|
+
"examples/create_one.rb"
|
88
154
|
]
|
89
155
|
|
90
156
|
if s.respond_to? :specification_version then
|
@@ -96,17 +162,20 @@ Gem::Specification.new do |s|
|
|
96
162
|
s.add_runtime_dependency(%q<rghost>, ["= 0.8.7.2"])
|
97
163
|
s.add_runtime_dependency(%q<nokogiri>, ["= 1.4.1"])
|
98
164
|
s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
|
165
|
+
s.add_development_dependency(%q<eventmachine>, [">= 0.12.10"])
|
99
166
|
else
|
100
167
|
s.add_dependency(%q<rubyzip>, ["= 0.9.4"])
|
101
168
|
s.add_dependency(%q<rghost>, ["= 0.8.7.2"])
|
102
169
|
s.add_dependency(%q<nokogiri>, ["= 1.4.1"])
|
103
170
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
171
|
+
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
104
172
|
end
|
105
173
|
else
|
106
174
|
s.add_dependency(%q<rubyzip>, ["= 0.9.4"])
|
107
175
|
s.add_dependency(%q<rghost>, ["= 0.8.7.2"])
|
108
176
|
s.add_dependency(%q<nokogiri>, ["= 1.4.1"])
|
109
177
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
178
|
+
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
110
179
|
end
|
111
180
|
end
|
112
181
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$current_dir_file = lambda {|f| File.join(File.expand_path(File.dirname(__FILE__)), f) }
|
5
|
+
$data_file = lambda {|f| $current_dir_file["data/#{f}"] }
|
6
|
+
$tmp_file = lambda {|f| $current_dir_file["tmp/#{f}"] }
|
7
|
+
require $data_file['contexts.rb']
|
8
|
+
require 'clamsy'
|
9
|
+
|
10
|
+
template_doc_path = $data_file['student_offer_letter.odt']
|
11
|
+
final_pdf_path = $tmp_file['student_offer_letters.pdf']
|
12
|
+
|
13
|
+
print "Generating #{final_pdf_path} ... "
|
14
|
+
Clamsy.process($contexts, template_doc_path, final_pdf_path)
|
15
|
+
puts "done"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$current_dir_file = lambda {|f| File.join(File.expand_path(File.dirname(__FILE__)), f) }
|
5
|
+
$data_file = lambda {|f| $current_dir_file["data/#{f}"] }
|
6
|
+
$tmp_file = lambda {|f| $current_dir_file["tmp/#{f}"] }
|
7
|
+
require $data_file['context.rb']
|
8
|
+
require 'clamsy'
|
9
|
+
|
10
|
+
template_doc_path = $data_file['student_offer_letter.odt']
|
11
|
+
final_pdf_path = $tmp_file['student_offer_letter.pdf']
|
12
|
+
|
13
|
+
print "Generating #{final_pdf_path} ... "
|
14
|
+
Clamsy.process($context, template_doc_path, final_pdf_path)
|
15
|
+
puts "done"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
subject_klass = Struct.new('Subject', :name, :code, :weekly_hours)
|
2
|
+
|
3
|
+
subjects = [
|
4
|
+
subject_klass.new('English', 'S001', 10),
|
5
|
+
subject_klass.new('Maths', 'S002', 10),
|
6
|
+
subject_klass.new('Physics', 'S003', 5),
|
7
|
+
subject_klass.new('Chemistry', 'S004', 5),
|
8
|
+
subject_klass.new('Chinese', 'S005', 10),
|
9
|
+
]
|
10
|
+
|
11
|
+
$context = {
|
12
|
+
:_pictures => {
|
13
|
+
:staff_signature => $data_file['staff_signature.gif'],
|
14
|
+
:school_logo => $data_file['school_logo.jpg'],
|
15
|
+
},
|
16
|
+
:subjects => subjects,
|
17
|
+
:admin_staff_email => "admin@demo.com",
|
18
|
+
:student_address_line_3 => "Jupiter 04771-0130",
|
19
|
+
:school_website => "www.wizardcollege.edu",
|
20
|
+
:student_nric => "S667755161",
|
21
|
+
:course_start_date => "Jan 1, 2010",
|
22
|
+
:serial_number => "00000026",
|
23
|
+
:student_full_name => "Kok Yeow Loh",
|
24
|
+
:school_name => "Wizard College",
|
25
|
+
:course_name => "2 Yr 'O' Level",
|
26
|
+
:school_address_line_1 => "2985 Jalan Timum",
|
27
|
+
:total_weekly_hours => subjects.inject(0) {|sum, s| sum + s.weekly_hours },
|
28
|
+
:student_first_name => "Kok Yeow",
|
29
|
+
:school_telephone => "+65 6511 6833",
|
30
|
+
:date_of_offer => "May 5, 2010",
|
31
|
+
:course_intake => "Jan Intake",
|
32
|
+
:school_address_line_2 => "XYZ Learning Centre",
|
33
|
+
:examination_authority => "UNDEFINED(examination_authority)",
|
34
|
+
:student_address_line_1 => "Blk 151",
|
35
|
+
:school_fax => "+65 6511 6844",
|
36
|
+
:admin_staff_name => "Tan Tze Wei",
|
37
|
+
:school_address_line_3 => "Jupiter 159457",
|
38
|
+
:course_duration => "24 months",
|
39
|
+
:student_address_line_2 => "5921 Albert Village",
|
40
|
+
:school_email => "info@wizardcollege.edu.sg",
|
41
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
data/lib/clamsy.rb
CHANGED
@@ -6,6 +6,8 @@ require 'clamsy/configuration'
|
|
6
6
|
|
7
7
|
module Clamsy
|
8
8
|
|
9
|
+
ROOT = File.expand_path(File.dirname(__FILE__))
|
10
|
+
|
9
11
|
class << self
|
10
12
|
|
11
13
|
include FileSystemSupport
|
@@ -32,8 +34,11 @@ module Clamsy
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def config
|
35
|
-
@config ||=
|
36
|
-
|
37
|
+
@config ||= Configuration.new(bundled_config_file, true)
|
38
|
+
end
|
39
|
+
|
40
|
+
def bundled_config_file
|
41
|
+
File.join(Clamsy::ROOT, 'clamsy.yml')
|
37
42
|
end
|
38
43
|
|
39
44
|
def printer
|
data/lib/clamsy.yml
CHANGED
@@ -1,8 +1,34 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
######################################################################################
|
2
|
+
# [ Linux ] #
|
3
|
+
######################################################################################
|
4
|
+
linux:
|
5
|
+
printer: jod_converter
|
6
|
+
config_file: ~/.clamsy.yml
|
7
|
+
ooffice_bin: ooffice
|
8
|
+
java_bin: java
|
3
9
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
10
|
+
jod_converter:
|
11
|
+
ooffice_server_args: -headless -nofirststartwizard -accept="socket,host=localhost,port=8100;urp;StarOffice.Service"
|
12
|
+
|
13
|
+
cups_pdf:
|
14
|
+
cups_output_dir: /var/spool/cups-pdf/${USER}
|
15
|
+
cups_output_file:
|
16
|
+
ooffice_print_args: -norestore -nofirststartwizard -nologo -headless -pt Cups-PDF
|
17
|
+
|
18
|
+
######################################################################################
|
19
|
+
# [ Mac ] #
|
20
|
+
######################################################################################
|
21
|
+
darwin:
|
22
|
+
printer: jod_converter
|
23
|
+
config_file: ~/.clamsy.yml
|
24
|
+
ooffice_bin: /Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin
|
25
|
+
java_bin: java
|
26
|
+
|
27
|
+
jod_converter:
|
28
|
+
ooffice_server_args: -headless -nofirststartwizard -accept="socket,host=localhost,port=8100;urp;StarOffice.Service" &
|
29
|
+
|
30
|
+
cups_pdf:
|
31
|
+
cups_output_dir: /opt/local/var/spool/cups-pdf/${USER}
|
32
|
+
cups_output_file:
|
33
|
+
ooffice_print_args: -norestore -nofirststartwizard -nologo -headless -pt Cups-PDF
|
8
34
|
|