mack-pdf_writer 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems/archive-tar-minitar-0.5.2/bin/minitar +27 -0
- data/lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar/command.rb +814 -0
- data/lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb +979 -0
- data/lib/gems/color-1.4.0/lib/color/cmyk.rb +281 -0
- data/lib/gems/color-1.4.0/lib/color/css.rb +30 -0
- data/lib/gems/color-1.4.0/lib/color/grayscale.rb +214 -0
- data/lib/gems/color-1.4.0/lib/color/hsl.rb +223 -0
- data/lib/gems/color-1.4.0/lib/color/palette/adobecolor.rb +274 -0
- data/lib/gems/color-1.4.0/lib/color/palette/gimp.rb +118 -0
- data/lib/gems/color-1.4.0/lib/color/palette/monocontrast.rb +182 -0
- data/lib/gems/color-1.4.0/lib/color/palette.rb +18 -0
- data/lib/gems/color-1.4.0/lib/color/rgb/metallic.rb +45 -0
- data/lib/gems/color-1.4.0/lib/color/rgb-colors.rb +357 -0
- data/lib/gems/color-1.4.0/lib/color/rgb.rb +455 -0
- data/lib/gems/color-1.4.0/lib/color/yiq.rb +86 -0
- data/lib/gems/color-1.4.0/lib/color.rb +147 -0
- data/lib/gems/pdf-writer-1.1.8/bin/techbook +24 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/charts/stddev.rb +430 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/charts.rb +13 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/math.rb +108 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/quickref.rb +332 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/simpletable.rb +947 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/techbook.rb +901 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/arc4.rb +63 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fontmetrics.rb +203 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-Bold.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-BoldOblique.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-Oblique.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier.afm +342 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-Bold.afm +2827 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-BoldOblique.afm +2827 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-Oblique.afm +3051 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica.afm +3051 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/MustRead.html +19 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Symbol.afm +213 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Bold.afm +2588 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-BoldItalic.afm +2384 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Italic.afm +2667 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Roman.afm +2419 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/ZapfDingbats.afm +225 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics/imageinfo.rb +365 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics.rb +813 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang/en.rb +99 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang.rb +43 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/action.rb +35 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/annotation.rb +42 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/catalog.rb +39 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/contents.rb +65 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/destination.rb +40 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/encryption.rb +53 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/font.rb +72 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontdescriptor.rb +34 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb +40 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/image.rb +304 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/info.rb +51 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outline.rb +30 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb +30 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/page.rb +195 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/pages.rb +115 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/procset.rb +46 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/viewerpreferences.rb +74 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object.rb +23 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/ohash.rb +58 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/oreader.rb +25 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/state.rb +48 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer/strokestyle.rb +138 -0
- data/lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb +2729 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple/group.rb +146 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe/group.rb +36 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe.rb +68 -0
- data/lib/gems/transaction-simple-1.4.0/lib/transaction/simple.rb +486 -0
- data/lib/gems.rb +13 -0
- data/lib/mack-pdf_writer.rb +2 -0
- metadata +111 -16
@@ -0,0 +1,486 @@
|
|
1
|
+
# :title: Transaction::Simple -- Active Object Transaction Support for Ruby
|
2
|
+
# :main: Readme.txt
|
3
|
+
|
4
|
+
#--
|
5
|
+
# Transaction::Simple
|
6
|
+
# Simple object transaction support for Ruby
|
7
|
+
# http://rubyforge.org/projects/trans-simple/
|
8
|
+
# Version 1.4.0
|
9
|
+
#
|
10
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
11
|
+
# distribution for full licensing information.
|
12
|
+
#
|
13
|
+
# Copyright (c) 2003 - 2007 Austin Ziegler
|
14
|
+
#
|
15
|
+
# $Id: simple.rb 50 2007-02-03 20:26:19Z austin $
|
16
|
+
#++
|
17
|
+
|
18
|
+
# The "Transaction" namespace can be used for additional transaction support
|
19
|
+
# objects and modules.
|
20
|
+
module Transaction
|
21
|
+
# A standard exception for transaction errors.
|
22
|
+
class TransactionError < StandardError; end
|
23
|
+
# The TransactionAborted exception is used to indicate when a transaction
|
24
|
+
# has been aborted in the block form.
|
25
|
+
class TransactionAborted < Exception; end
|
26
|
+
# The TransactionCommitted exception is used to indicate when a
|
27
|
+
# transaction has been committed in the block form.
|
28
|
+
class TransactionCommitted < Exception; end
|
29
|
+
|
30
|
+
te = "Transaction Error: %s"
|
31
|
+
|
32
|
+
Messages = { #:nodoc:
|
33
|
+
:bad_debug_object => te % "the transaction debug object must respond to #<<.",
|
34
|
+
:unique_names => te % "named transactions must be unique.",
|
35
|
+
:no_transaction_open => te % "no transaction open.",
|
36
|
+
:cannot_rewind_no_transaction => te % "cannot rewind; there is no current transaction.",
|
37
|
+
:cannot_rewind_named_transaction => te % "cannot rewind to transaction %s because it does not exist.",
|
38
|
+
:cannot_rewind_transaction_before_block => te % "cannot rewind a transaction started before the execution block.",
|
39
|
+
:cannot_abort_no_transaction => te % "cannot abort; there is no current transaction.",
|
40
|
+
:cannot_abort_transaction_before_block => te % "cannot abort a transaction started before the execution block.",
|
41
|
+
:cannot_abort_named_transaction => te % "cannot abort nonexistant transaction %s.",
|
42
|
+
:cannot_commit_no_transaction => te % "cannot commit; there is no current transaction.",
|
43
|
+
:cannot_commit_transaction_before_block => te % "cannot commit a transaction started before the execution block.",
|
44
|
+
:cannot_commit_named_transaction => te % "cannot commit nonexistant transaction %s.",
|
45
|
+
:cannot_start_empty_block_transaction => te % "cannot start a block transaction with no objects.",
|
46
|
+
:cannot_obtain_transaction_lock => te % "cannot obtain transaction lock for #%s.",
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# = Transaction::Simple for Ruby
|
51
|
+
# Simple object transaction support for Ruby
|
52
|
+
module Transaction::Simple
|
53
|
+
TRANSACTION_SIMPLE_VERSION = '1.4.0'
|
54
|
+
|
55
|
+
class << self
|
56
|
+
# Sets the Transaction::Simple debug object. It must respond to #<<.
|
57
|
+
# Debugging will be performed automatically if there's a debug object.
|
58
|
+
def debug_io=(io)
|
59
|
+
if io.nil?
|
60
|
+
@tdi = nil
|
61
|
+
@debugging = false
|
62
|
+
else
|
63
|
+
raise Transaction::TransactionError, Transaction::Messages[:bad_debug_object] unless io.respond_to?(:<<)
|
64
|
+
@tdi = io
|
65
|
+
@debugging = true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns +true+ if we are debugging.
|
70
|
+
def debugging?
|
71
|
+
defined? @debugging and @debugging
|
72
|
+
end
|
73
|
+
|
74
|
+
# Returns the Transaction::Simple debug object. It must respond to #<<.
|
75
|
+
def debug_io
|
76
|
+
@tdi ||= ""
|
77
|
+
@tdi
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# If +name+ is +nil+ (default), then returns +true+ if there is currently
|
82
|
+
# a transaction open. If +name+ is specified, then returns +true+ if there
|
83
|
+
# is currently a transaction known as +name+ open.
|
84
|
+
def transaction_open?(name = nil)
|
85
|
+
defined? @__transaction_checkpoint__ or @__transaction_checkpoint__ = nil
|
86
|
+
if name.nil?
|
87
|
+
Transaction::Simple.debug_io << "Transaction " << "[#{(@__transaction_checkpoint__.nil?) ? 'closed' : 'open'}]\n" if Transaction::Simple.debugging?
|
88
|
+
return (not @__transaction_checkpoint__.nil?)
|
89
|
+
else
|
90
|
+
Transaction::Simple.debug_io << "Transaction(#{name.inspect}) " << "[#{(@__transaction_checkpoint__.nil?) ? 'closed' : 'open'}]\n" if Transaction::Simple.debugging?
|
91
|
+
return ((not @__transaction_checkpoint__.nil?) and @__transaction_names__.include?(name))
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Returns the current name of the transaction. Transactions not explicitly
|
96
|
+
# named are named +nil+.
|
97
|
+
def transaction_name
|
98
|
+
raise Transaction::TransactionError, Transaction::Messages[:no_transaction_open] if @__transaction_checkpoint__.nil?
|
99
|
+
Transaction::Simple.debug_io << "#{'|' * @__transaction_level__} " << "Transaction Name: #{@__transaction_names__[-1].inspect}\n" if Transaction::Simple.debugging?
|
100
|
+
if @__transaction_names__[-1].kind_of?(String)
|
101
|
+
@__transaction_names__[-1].dup
|
102
|
+
else
|
103
|
+
@__transaction_names__[-1]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Starts a transaction. Stores the current object state. If a transaction
|
108
|
+
# name is specified, the transaction will be named. Transaction names must
|
109
|
+
# be unique. Transaction names of +nil+ will be treated as unnamed
|
110
|
+
# transactions.
|
111
|
+
def start_transaction(name = nil)
|
112
|
+
@__transaction_level__ ||= 0
|
113
|
+
@__transaction_names__ ||= []
|
114
|
+
|
115
|
+
name = name.dup.freeze if name.kind_of?(String)
|
116
|
+
|
117
|
+
raise Transaction::TransactionError, Transaction::Messages[:unique_names] if name and @__transaction_names__.include?(name)
|
118
|
+
|
119
|
+
@__transaction_names__ << name
|
120
|
+
@__transaction_level__ += 1
|
121
|
+
|
122
|
+
if Transaction::Simple.debugging?
|
123
|
+
ss = "(#{name.inspect})"
|
124
|
+
ss = "" unless ss
|
125
|
+
|
126
|
+
Transaction::Simple.debug_io << "#{'>' * @__transaction_level__} " << "Start Transaction#{ss}\n"
|
127
|
+
end
|
128
|
+
|
129
|
+
@__transaction_checkpoint__ = Marshal.dump(self)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Rewinds the transaction. If +name+ is specified, then the intervening
|
133
|
+
# transactions will be aborted and the named transaction will be rewound.
|
134
|
+
# Otherwise, only the current transaction is rewound.
|
135
|
+
#
|
136
|
+
# After each level of transaction is rewound, if the callback method
|
137
|
+
# #_post_transaction_rewind is defined, it will be called. It is intended
|
138
|
+
# to allow a complex self-referential graph to fix itself. The simplest
|
139
|
+
# way to explain this is with an example.
|
140
|
+
#
|
141
|
+
# class Child
|
142
|
+
# attr_accessor :parent
|
143
|
+
# end
|
144
|
+
#
|
145
|
+
# class Parent
|
146
|
+
# include Transaction::Simple
|
147
|
+
#
|
148
|
+
# attr_reader :children
|
149
|
+
# def initialize
|
150
|
+
# @children = []
|
151
|
+
# end
|
152
|
+
#
|
153
|
+
# def << child
|
154
|
+
# child.parent = self
|
155
|
+
# @children << child
|
156
|
+
# end
|
157
|
+
#
|
158
|
+
# def valid?
|
159
|
+
# @children.all? { |child| child.parent == self }
|
160
|
+
# end
|
161
|
+
# end
|
162
|
+
#
|
163
|
+
# parent = Parent.new
|
164
|
+
# parent << Child.new
|
165
|
+
# parent.start_transaction
|
166
|
+
# parent << Child.new
|
167
|
+
# parent.abort_transaction
|
168
|
+
# puts parent.valid? # => false
|
169
|
+
#
|
170
|
+
# This problem can be fixed by modifying the Parent class to include the
|
171
|
+
# #_post_transaction_rewind callback.
|
172
|
+
#
|
173
|
+
# class Parent
|
174
|
+
# # Reconnect the restored children to me, instead of to the bogus me
|
175
|
+
# # that was restored to them by Marshal::load.
|
176
|
+
# def _post_transaction_rewind
|
177
|
+
# @children.each { |child| child.parent = self }
|
178
|
+
# end
|
179
|
+
# end
|
180
|
+
#
|
181
|
+
# parent = Parent.new
|
182
|
+
# parent << Child.new
|
183
|
+
# parent.start_transaction
|
184
|
+
# parent << Child.new
|
185
|
+
# parent.abort_transaction
|
186
|
+
# puts parent.valid? # => true
|
187
|
+
def rewind_transaction(name = nil)
|
188
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_rewind_no_transaction] if @__transaction_checkpoint__.nil?
|
189
|
+
|
190
|
+
# Check to see if we are trying to rewind a transaction that is
|
191
|
+
# outside of the current transaction block.
|
192
|
+
defined? @__transaction_block__ or @__transaction_block__ = nil
|
193
|
+
if @__transaction_block__ and name
|
194
|
+
nix = @__transaction_names__.index(name) + 1
|
195
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_rewind_transaction_before_block] if nix < @__transaction_block__
|
196
|
+
end
|
197
|
+
|
198
|
+
if name.nil?
|
199
|
+
checkpoint = @__transaction_checkpoint__
|
200
|
+
__rewind_this_transaction
|
201
|
+
@__transaction_checkpoint__ = checkpoint
|
202
|
+
ss = "" if Transaction::Simple.debugging?
|
203
|
+
else
|
204
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_rewind_named_transaction] % name.inspect unless @__transaction_names__.include?(name)
|
205
|
+
ss = "(#{name})" if Transaction::Simple.debugging?
|
206
|
+
|
207
|
+
while @__transaction_names__[-1] != name
|
208
|
+
@__transaction_checkpoint__ = __rewind_this_transaction
|
209
|
+
Transaction::Simple.debug_io << "#{'|' * @__transaction_level__} " << "Rewind Transaction#{ss}\n" if Transaction::Simple.debugging?
|
210
|
+
@__transaction_level__ -= 1
|
211
|
+
@__transaction_names__.pop
|
212
|
+
end
|
213
|
+
checkpoint = @__transaction_checkpoint__
|
214
|
+
__rewind_this_transaction
|
215
|
+
@__transaction_checkpoint__ = checkpoint
|
216
|
+
end
|
217
|
+
Transaction::Simple.debug_io << "#{'|' * @__transaction_level__} " << "Rewind Transaction#{ss}\n" if Transaction::Simple.debugging?
|
218
|
+
self
|
219
|
+
end
|
220
|
+
|
221
|
+
# Aborts the transaction. Rewinds the object state to what it was before
|
222
|
+
# the transaction was started and closes the transaction. If +name+ is
|
223
|
+
# specified, then the intervening transactions and the named transaction
|
224
|
+
# will be aborted. Otherwise, only the current transaction is aborted.
|
225
|
+
#
|
226
|
+
# See #rewind_transaction for information about dealing with complex
|
227
|
+
# self-referential object graphs.
|
228
|
+
#
|
229
|
+
# If the current or named transaction has been started by a block
|
230
|
+
# (Transaction::Simple.start), then the execution of the block will be
|
231
|
+
# halted with +break+ +self+.
|
232
|
+
def abort_transaction(name = nil)
|
233
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_abort_no_transaction] if @__transaction_checkpoint__.nil?
|
234
|
+
|
235
|
+
# Check to see if we are trying to abort a transaction that is outside
|
236
|
+
# of the current transaction block. Otherwise, raise TransactionAborted
|
237
|
+
# if they are the same.
|
238
|
+
defined? @__transaction_block__ or @__transaction_block__ = nil
|
239
|
+
if @__transaction_block__ and name
|
240
|
+
nix = @__transaction_names__.index(name) + 1
|
241
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_abort_transaction_before_block] if nix < @__transaction_block__
|
242
|
+
|
243
|
+
raise Transaction::TransactionAborted if @__transaction_block__ == nix
|
244
|
+
end
|
245
|
+
|
246
|
+
raise Transaction::TransactionAborted if @__transaction_block__ == @__transaction_level__
|
247
|
+
|
248
|
+
if name.nil?
|
249
|
+
__abort_transaction(name)
|
250
|
+
else
|
251
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_abort_named_transaction] % name.inspect unless @__transaction_names__.include?(name)
|
252
|
+
__abort_transaction(name) while @__transaction_names__.include?(name)
|
253
|
+
end
|
254
|
+
|
255
|
+
self
|
256
|
+
end
|
257
|
+
|
258
|
+
# If +name+ is +nil+ (default), the current transaction level is closed
|
259
|
+
# out and the changes are committed.
|
260
|
+
#
|
261
|
+
# If +name+ is specified and +name+ is in the list of named transactions,
|
262
|
+
# then all transactions are closed and committed until the named
|
263
|
+
# transaction is reached.
|
264
|
+
def commit_transaction(name = nil)
|
265
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_no_transaction] if @__transaction_checkpoint__.nil?
|
266
|
+
@__transaction_block__ ||= nil
|
267
|
+
|
268
|
+
# Check to see if we are trying to commit a transaction that is outside
|
269
|
+
# of the current transaction block. Otherwise, raise
|
270
|
+
# TransactionCommitted if they are the same.
|
271
|
+
if @__transaction_block__ and name
|
272
|
+
nix = @__transaction_names__.index(name) + 1
|
273
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_transaction_before_block] if nix < @__transaction_block__
|
274
|
+
|
275
|
+
raise Transaction::TransactionCommitted if @__transaction_block__ == nix
|
276
|
+
end
|
277
|
+
|
278
|
+
raise Transaction::TransactionCommitted if @__transaction_block__ == @__transaction_level__
|
279
|
+
|
280
|
+
if name.nil?
|
281
|
+
ss = "" if Transaction::Simple.debugging?
|
282
|
+
__commit_transaction
|
283
|
+
Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Commit Transaction#{ss}\n" if Transaction::Simple.debugging?
|
284
|
+
else
|
285
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_named_transaction] % name.inspect unless @__transaction_names__.include?(name)
|
286
|
+
ss = "(#{name})" if Transaction::Simple.debugging?
|
287
|
+
|
288
|
+
while @__transaction_names__[-1] != name
|
289
|
+
Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Commit Transaction#{ss}\n" if Transaction::Simple.debugging?
|
290
|
+
__commit_transaction
|
291
|
+
end
|
292
|
+
Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Commit Transaction#{ss}\n" if Transaction::Simple.debugging?
|
293
|
+
__commit_transaction
|
294
|
+
end
|
295
|
+
|
296
|
+
self
|
297
|
+
end
|
298
|
+
|
299
|
+
# Alternative method for calling the transaction methods. An optional name
|
300
|
+
# can be specified for named transaction support. This method is
|
301
|
+
# deprecated and will be removed in Transaction::Simple 2.0.
|
302
|
+
#
|
303
|
+
# #transaction(:start):: #start_transaction
|
304
|
+
# #transaction(:rewind):: #rewind_transaction
|
305
|
+
# #transaction(:abort):: #abort_transaction
|
306
|
+
# #transaction(:commit):: #commit_transaction
|
307
|
+
# #transaction(:name):: #transaction_name
|
308
|
+
# #transaction:: #transaction_open?
|
309
|
+
def transaction(action = nil, name = nil)
|
310
|
+
_method = case action
|
311
|
+
when :start then :start_transaction
|
312
|
+
when :rewind then :rewind_transaction
|
313
|
+
when :abort then :abort_transaction
|
314
|
+
when :commit then :commit_transaction
|
315
|
+
when :name then :transaction_name
|
316
|
+
when nil then :transaction_open?
|
317
|
+
else nil
|
318
|
+
end
|
319
|
+
|
320
|
+
if method
|
321
|
+
warn "The #transaction method has been deprecated. Use #{method} instead."
|
322
|
+
else
|
323
|
+
warn "The #transaction method has been deprecated."
|
324
|
+
end
|
325
|
+
|
326
|
+
case method
|
327
|
+
when :transaction_name
|
328
|
+
__send__ method
|
329
|
+
when nil
|
330
|
+
nil
|
331
|
+
else
|
332
|
+
__send__ method, name
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
# Allows specific variables to be excluded from transaction support. Must
|
337
|
+
# be done after extending the object but before starting the first
|
338
|
+
# transaction on the object.
|
339
|
+
#
|
340
|
+
# vv.transaction_exclusions << "@io"
|
341
|
+
def transaction_exclusions
|
342
|
+
@transaction_exclusions ||= []
|
343
|
+
end
|
344
|
+
|
345
|
+
class << self
|
346
|
+
def __common_start(name, vars, &block)
|
347
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_start_empty_block_transaction] if vars.empty?
|
348
|
+
|
349
|
+
if block
|
350
|
+
begin
|
351
|
+
vlevel = {}
|
352
|
+
|
353
|
+
vars.each do |vv|
|
354
|
+
vv.extend(Transaction::Simple)
|
355
|
+
vv.start_transaction(name)
|
356
|
+
vlevel[vv.__id__] = vv.instance_variable_get(:@__transaction_level__)
|
357
|
+
vv.instance_variable_set(:@__transaction_block__, vlevel[vv.__id__])
|
358
|
+
end
|
359
|
+
|
360
|
+
yield(*vars)
|
361
|
+
rescue Transaction::TransactionAborted
|
362
|
+
vars.each do |vv|
|
363
|
+
if name.nil? and vv.transaction_open?
|
364
|
+
loop do
|
365
|
+
tlevel = vv.instance_variable_get(:@__transaction_level__) || -1
|
366
|
+
vv.instance_variable_set(:@__transaction_block__, -1)
|
367
|
+
break if tlevel < vlevel[vv.__id__]
|
368
|
+
vv.abort_transaction if vv.transaction_open?
|
369
|
+
end
|
370
|
+
elsif vv.transaction_open?(name)
|
371
|
+
vv.instance_variable_set(:@__transaction_block__, -1)
|
372
|
+
vv.abort_transaction(name)
|
373
|
+
end
|
374
|
+
end
|
375
|
+
rescue Transaction::TransactionCommitted
|
376
|
+
nil
|
377
|
+
ensure
|
378
|
+
vars.each do |vv|
|
379
|
+
if name.nil? and vv.transaction_open?
|
380
|
+
loop do
|
381
|
+
tlevel = vv.instance_variable_get(:@__transaction_level__) || -1
|
382
|
+
break if tlevel < vlevel[vv.__id__]
|
383
|
+
vv.instance_variable_set(:@__transaction_block__, -1)
|
384
|
+
vv.commit_transaction if vv.transaction_open?
|
385
|
+
end
|
386
|
+
elsif vv.transaction_open?(name)
|
387
|
+
vv.instance_variable_set(:@__transaction_block__, -1)
|
388
|
+
vv.commit_transaction(name)
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
else
|
393
|
+
vars.each do |vv|
|
394
|
+
vv.extend(Transaction::Simple)
|
395
|
+
vv.start_transaction(name)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
private :__common_start
|
400
|
+
|
401
|
+
# Start a named transaction in a block. The transaction will auto-commit
|
402
|
+
# when the block finishes.
|
403
|
+
def start_named(name, *vars, &block)
|
404
|
+
__common_start(name, vars, &block)
|
405
|
+
end
|
406
|
+
|
407
|
+
# Start a named transaction in a block. The transaction will auto-commit
|
408
|
+
# when the block finishes.
|
409
|
+
def start(*vars, &block)
|
410
|
+
__common_start(nil, vars, &block)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
def __abort_transaction(name = nil) #:nodoc:
|
415
|
+
@__transaction_checkpoint__ = __rewind_this_transaction
|
416
|
+
|
417
|
+
if Transaction::Simple.debugging?
|
418
|
+
if name.nil?
|
419
|
+
ss = ""
|
420
|
+
else
|
421
|
+
ss = "(#{name.inspect})"
|
422
|
+
end
|
423
|
+
|
424
|
+
Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Abort Transaction#{ss}\n"
|
425
|
+
end
|
426
|
+
|
427
|
+
@__transaction_level__ -= 1
|
428
|
+
@__transaction_names__.pop
|
429
|
+
if @__transaction_level__ < 1
|
430
|
+
@__transaction_level__ = 0
|
431
|
+
@__transaction_names__ = []
|
432
|
+
@__transaction_checkpoint__ = nil
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
SKIP_TRANSACTION_VARS = %w(@__transaction_checkpoint__ @__transaction_level__)
|
437
|
+
|
438
|
+
def __rewind_this_transaction #:nodoc:
|
439
|
+
defined? @__transaction_checkpoint__ or @__transaction_checkpoint__ = nil
|
440
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_rewind_no_transaction] if @__transaction_checkpoint__.nil?
|
441
|
+
rr = Marshal.restore(@__transaction_checkpoint__)
|
442
|
+
|
443
|
+
replace(rr) if respond_to?(:replace)
|
444
|
+
|
445
|
+
iv = rr.instance_variables - SKIP_TRANSACTION_VARS - self.transaction_exclusions
|
446
|
+
iv.each do |vv|
|
447
|
+
next if self.transaction_exclusions.include?(vv)
|
448
|
+
|
449
|
+
instance_variable_set(vv, rr.instance_variable_get(vv))
|
450
|
+
end
|
451
|
+
|
452
|
+
rest = instance_variables - rr.instance_variables - SKIP_TRANSACTION_VARS - self.transaction_exclusions
|
453
|
+
rest.each do |vv|
|
454
|
+
remove_instance_variable(vv)
|
455
|
+
end
|
456
|
+
|
457
|
+
_post_transaction_rewind if respond_to?(:_post_transaction_rewind)
|
458
|
+
|
459
|
+
w, $-w = $-w, false # 20070203 OH is this very UGLY
|
460
|
+
res = rr.instance_variable_get(:@__transaction_checkpoint__)
|
461
|
+
$-w = w # 20070203 OH is this very UGLY
|
462
|
+
res
|
463
|
+
end
|
464
|
+
|
465
|
+
def __commit_transaction #:nodoc:
|
466
|
+
defined? @__transaction_checkpoint__ or @__transaction_checkpoint__ = nil
|
467
|
+
raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_no_transaction] if @__transaction_checkpoint__.nil?
|
468
|
+
old = Marshal.restore(@__transaction_checkpoint__)
|
469
|
+
w, $-w = $-w, false # 20070203 OH is this very UGLY
|
470
|
+
@__transaction_checkpoint__ = old.instance_variable_get(:@__transaction_checkpoint__)
|
471
|
+
$-w = w # 20070203 OH is this very UGLY
|
472
|
+
|
473
|
+
@__transaction_level__ -= 1
|
474
|
+
@__transaction_names__.pop
|
475
|
+
|
476
|
+
if @__transaction_level__ < 1
|
477
|
+
@__transaction_level__ = 0
|
478
|
+
@__transaction_names__ = []
|
479
|
+
@__transaction_checkpoint__ = nil
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
private :__abort_transaction
|
484
|
+
private :__rewind_this_transaction
|
485
|
+
private :__commit_transaction
|
486
|
+
end
|
data/lib/gems.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), 'gems'))
|
2
|
+
Gem.set_paths(path)
|
3
|
+
|
4
|
+
Dir.glob(File.join(path, '*')).each do |p|
|
5
|
+
full_gem_name = File.basename(p)
|
6
|
+
version = full_gem_name.match(/([\d\.?]+)/).to_s
|
7
|
+
gem_name = full_gem_name.gsub("-#{version}", '')
|
8
|
+
$:.unshift(File.join(p, 'lib'))
|
9
|
+
begin
|
10
|
+
gem gem_name, "~> #{version}"
|
11
|
+
rescue Gem::LoadError
|
12
|
+
end
|
13
|
+
end
|
data/lib/mack-pdf_writer.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-pdf_writer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darsono Sutedja
|
@@ -9,19 +9,10 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-30 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: pdf-writer
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - "="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.1.8
|
24
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
25
16
|
description: PDF Rendering Engine for Mack Framework
|
26
17
|
email: darsono.sutedja@gmail.com
|
27
18
|
executables: []
|
@@ -31,14 +22,118 @@ extensions: []
|
|
31
22
|
extra_rdoc_files: []
|
32
23
|
|
33
24
|
files:
|
25
|
+
- lib/gems
|
26
|
+
- lib/gems/archive-tar-minitar-0.5.2
|
27
|
+
- lib/gems/archive-tar-minitar-0.5.2/bin
|
28
|
+
- lib/gems/archive-tar-minitar-0.5.2/bin/minitar
|
29
|
+
- lib/gems/archive-tar-minitar-0.5.2/lib
|
30
|
+
- lib/gems/archive-tar-minitar-0.5.2/lib/archive
|
31
|
+
- lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar
|
32
|
+
- lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar
|
33
|
+
- lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar/command.rb
|
34
|
+
- lib/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb
|
35
|
+
- lib/gems/cache
|
36
|
+
- lib/gems/color-1.4.0
|
37
|
+
- lib/gems/color-1.4.0/lib
|
38
|
+
- lib/gems/color-1.4.0/lib/color
|
39
|
+
- lib/gems/color-1.4.0/lib/color/cmyk.rb
|
40
|
+
- lib/gems/color-1.4.0/lib/color/css.rb
|
41
|
+
- lib/gems/color-1.4.0/lib/color/grayscale.rb
|
42
|
+
- lib/gems/color-1.4.0/lib/color/hsl.rb
|
43
|
+
- lib/gems/color-1.4.0/lib/color/palette
|
44
|
+
- lib/gems/color-1.4.0/lib/color/palette/adobecolor.rb
|
45
|
+
- lib/gems/color-1.4.0/lib/color/palette/gimp.rb
|
46
|
+
- lib/gems/color-1.4.0/lib/color/palette/monocontrast.rb
|
47
|
+
- lib/gems/color-1.4.0/lib/color/palette.rb
|
48
|
+
- lib/gems/color-1.4.0/lib/color/rgb
|
49
|
+
- lib/gems/color-1.4.0/lib/color/rgb/metallic.rb
|
50
|
+
- lib/gems/color-1.4.0/lib/color/rgb-colors.rb
|
51
|
+
- lib/gems/color-1.4.0/lib/color/rgb.rb
|
52
|
+
- lib/gems/color-1.4.0/lib/color/yiq.rb
|
53
|
+
- lib/gems/color-1.4.0/lib/color.rb
|
54
|
+
- lib/gems/doc
|
55
|
+
- lib/gems/gems
|
56
|
+
- lib/gems/pdf-writer-1.1.8
|
57
|
+
- lib/gems/pdf-writer-1.1.8/bin
|
58
|
+
- lib/gems/pdf-writer-1.1.8/bin/techbook
|
59
|
+
- lib/gems/pdf-writer-1.1.8/lib
|
60
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf
|
61
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/charts
|
62
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/charts/stddev.rb
|
63
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/charts.rb
|
64
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/math.rb
|
65
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/quickref.rb
|
66
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/simpletable.rb
|
67
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/techbook.rb
|
68
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer
|
69
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/arc4.rb
|
70
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fontmetrics.rb
|
71
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts
|
72
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-Bold.afm
|
73
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-BoldOblique.afm
|
74
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier-Oblique.afm
|
75
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Courier.afm
|
76
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-Bold.afm
|
77
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-BoldOblique.afm
|
78
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica-Oblique.afm
|
79
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Helvetica.afm
|
80
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/MustRead.html
|
81
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Symbol.afm
|
82
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Bold.afm
|
83
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-BoldItalic.afm
|
84
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Italic.afm
|
85
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/Times-Roman.afm
|
86
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/fonts/ZapfDingbats.afm
|
87
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics
|
88
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics/imageinfo.rb
|
89
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics.rb
|
90
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang
|
91
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang/en.rb
|
92
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/lang.rb
|
93
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object
|
94
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/action.rb
|
95
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/annotation.rb
|
96
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/catalog.rb
|
97
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/contents.rb
|
98
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/destination.rb
|
99
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/encryption.rb
|
100
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/font.rb
|
101
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontdescriptor.rb
|
102
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb
|
103
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/image.rb
|
104
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/info.rb
|
105
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outline.rb
|
106
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb
|
107
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/page.rb
|
108
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/pages.rb
|
109
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/procset.rb
|
110
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/viewerpreferences.rb
|
111
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object.rb
|
112
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/ohash.rb
|
113
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/oreader.rb
|
114
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/state.rb
|
115
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/strokestyle.rb
|
116
|
+
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer.rb
|
117
|
+
- lib/gems/specifications
|
118
|
+
- lib/gems/transaction-simple-1.4.0
|
119
|
+
- lib/gems/transaction-simple-1.4.0/lib
|
120
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction
|
121
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction/simple
|
122
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction/simple/group.rb
|
123
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe
|
124
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe/group.rb
|
125
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction/simple/threadsafe.rb
|
126
|
+
- lib/gems/transaction-simple-1.4.0/lib/transaction/simple.rb
|
127
|
+
- lib/gems.rb
|
128
|
+
- lib/mack-pdf_writer
|
34
129
|
- lib/mack-pdf_writer/pdf_engine.rb
|
35
130
|
- lib/mack-pdf_writer.rb
|
36
131
|
- README
|
37
132
|
has_rdoc: true
|
38
133
|
homepage: http://www.mackframework.com
|
39
134
|
post_install_message:
|
40
|
-
rdoc_options:
|
41
|
-
|
135
|
+
rdoc_options:
|
136
|
+
- --exclude=gems/
|
42
137
|
require_paths:
|
43
138
|
- lib
|
44
139
|
- lib
|
@@ -57,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
152
|
requirements: []
|
58
153
|
|
59
154
|
rubyforge_project: magrathea
|
60
|
-
rubygems_version: 1.
|
155
|
+
rubygems_version: 1.3.1
|
61
156
|
signing_key:
|
62
157
|
specification_version: 2
|
63
158
|
summary: Rendering Engine
|