casecumber 1.0.2.1 → 1.2.1.cb2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/.travis.yml +13 -6
- data/Gemfile +2 -0
- data/History.md +139 -0
- data/LICENSE +1 -1
- data/README.md +19 -4
- data/cucumber.gemspec +16 -29
- data/cucumber.yml +3 -3
- data/examples/i18n/README.textile +1 -16
- data/features/.cucumber/stepdefs.json +612 -0
- data/features/backtraces.feature +36 -0
- data/features/doc_strings.feature +73 -0
- data/features/drb_server_integration.feature +63 -0
- data/features/formatter_step_file_colon_line.feature +46 -0
- data/features/json_formatter.feature +137 -137
- data/features/nested_steps.feature +60 -0
- data/features/rerun_formatter.feature +35 -0
- data/features/run_specific_scenarios.feature +47 -0
- data/features/step_definitions/cucumber-features/cucumber_ruby_mappings.rb +32 -3
- data/features/step_definitions/cucumber_steps.rb +15 -0
- data/features/step_definitions/drb_steps.rb +3 -0
- data/features/support/env.rb +4 -0
- data/features/support/feature_factory.rb +50 -0
- data/gem_tasks/cucumber.rake +15 -8
- data/gem_tasks/yard.rake +18 -0
- data/legacy_features/call_steps_from_stepdefs.feature +1 -1
- data/legacy_features/cucumber_cli.feature +0 -7
- data/legacy_features/default_snippets.feature +3 -2
- data/legacy_features/junit_formatter.feature +60 -10
- data/legacy_features/language_help.feature +17 -15
- data/legacy_features/snippets_when_using_star_keyword.feature +3 -2
- data/legacy_features/step_definitions/cucumber_steps.rb +1 -1
- data/legacy_features/support/env.rb +1 -1
- data/legacy_features/wire_protocol.feature +1 -1
- data/lib/cucumber/ast/background.rb +11 -0
- data/lib/cucumber/ast/doc_string.rb +10 -29
- data/lib/cucumber/ast/feature.rb +6 -2
- data/lib/cucumber/ast/feature_element.rb +7 -3
- data/lib/cucumber/ast/multiline_argument.rb +30 -0
- data/lib/cucumber/ast/outline_table.rb +20 -12
- data/lib/cucumber/ast/step.rb +1 -1
- data/lib/cucumber/ast/step_invocation.rb +2 -15
- data/lib/cucumber/ast/table.rb +67 -38
- data/lib/cucumber/ast/tags.rb +7 -7
- data/lib/cucumber/ast/tree_walker.rb +5 -5
- data/lib/cucumber/cli/configuration.rb +4 -0
- data/lib/cucumber/cli/main.rb +1 -0
- data/lib/cucumber/cli/options.rb +29 -10
- data/lib/cucumber/constantize.rb +1 -1
- data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +24 -10
- data/lib/cucumber/formatter/ansicolor.rb +8 -13
- data/lib/cucumber/formatter/console.rb +3 -2
- data/lib/cucumber/formatter/cucumber.css +7 -1
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +6 -2
- data/lib/cucumber/formatter/html.rb +14 -8
- data/lib/cucumber/formatter/interceptor.rb +62 -0
- data/lib/cucumber/formatter/json.rb +0 -12
- data/lib/cucumber/formatter/junit.rb +31 -15
- data/lib/cucumber/formatter/pretty.rb +3 -3
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/rerun.rb +31 -8
- data/lib/cucumber/formatter/usage.rb +1 -1
- data/lib/cucumber/js_support/js_language.rb +1 -1
- data/lib/cucumber/js_support/js_snippets.rb +1 -1
- data/lib/cucumber/language_support/language_methods.rb +0 -4
- data/lib/cucumber/parser/gherkin_builder.rb +13 -14
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/py_support/py_language.rb +3 -7
- data/lib/cucumber/rb_support/rb_dsl.rb +15 -8
- data/lib/cucumber/rb_support/rb_language.rb +3 -17
- data/lib/cucumber/rb_support/rb_step_definition.rb +17 -5
- data/lib/cucumber/rb_support/rb_transform.rb +5 -2
- data/lib/cucumber/rb_support/rb_world.rb +9 -5
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +3 -3
- data/lib/cucumber/runtime/results.rb +2 -2
- data/lib/cucumber/runtime/support_code.rb +14 -19
- data/lib/cucumber/runtime.rb +40 -2
- data/lib/cucumber/step_match.rb +3 -4
- data/lib/cucumber/term/ansicolor.rb +118 -0
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +7 -5
- data/lib/cucumber/wire_support/wire_protocol.rb +0 -1
- data/lib/cucumber.rb +2 -1
- data/spec/cucumber/ast/doc_string_spec.rb +2 -2
- data/spec/cucumber/ast/feature_factory.rb +4 -3
- data/spec/cucumber/ast/scenario_outline_spec.rb +1 -2
- data/spec/cucumber/ast/step_spec.rb +1 -1
- data/spec/cucumber/ast/table_spec.rb +61 -27
- data/spec/cucumber/cli/configuration_spec.rb +12 -6
- data/spec/cucumber/cli/main_spec.rb +2 -2
- data/spec/cucumber/cli/options_spec.rb +9 -3
- data/spec/cucumber/constantize_spec.rb +16 -0
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +4 -3
- data/spec/cucumber/formatter/interceptor_spec.rb +111 -0
- data/spec/cucumber/formatter/junit_spec.rb +36 -20
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_language_spec.rb +5 -5
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +20 -4
- data/spec/cucumber/rb_support/rb_transform_spec.rb +6 -2
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +7 -3
- data/spec/cucumber/runtime/results_spec.rb +81 -0
- data/spec/cucumber/step_match_spec.rb +8 -4
- data/spec/spec_helper.rb +15 -1
- metadata +68 -128
- data/.gitignore +0 -26
- data/.gitmodules +0 -3
- data/.yardopts +0 -0
- data/Gemfile.lock +0 -115
- data/examples/i18n/de/.gitignore +0 -1
- data/examples/i18n/en/.gitignore +0 -1
- data/examples/i18n/eo/.gitignore +0 -1
- data/examples/i18n/fi/.gitignore +0 -1
- data/examples/i18n/hu/.gitignore +0 -1
- data/examples/i18n/id/.gitignore +0 -1
- data/examples/i18n/ja/.gitignore +0 -1
- data/examples/i18n/ko/.gitignore +0 -1
- data/examples/i18n/lt/.gitignore +0 -1
- data/examples/i18n/pl/.gitignore +0 -1
- data/examples/i18n/sk/.gitignore +0 -1
- data/examples/i18n/tr/.gitignore +0 -1
- data/examples/i18n/zh-TW/.gitignore +0 -1
- data/examples/python/lib/.gitignore +0 -1
- data/examples/ruby2python/lib/.gitignore +0 -1
- data/examples/watir/.gitignore +0 -2
- data/fixtures/self_test/.gitignore +0 -1
- data/lib/cucumber/formatter/pdf.rb +0 -244
- data/lib/cucumber/step_argument.rb +0 -9
data/Gemfile.lock
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
casecumber (1.0.2.1)
|
5
|
-
builder (>= 2.1.2)
|
6
|
-
diff-lcs (>= 1.1.2)
|
7
|
-
gherkin (~> 2.4.5)
|
8
|
-
json (>= 1.4.6)
|
9
|
-
term-ansicolor (>= 1.0.5)
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: http://rubygems.org/
|
13
|
-
specs:
|
14
|
-
aruba (0.4.3)
|
15
|
-
bcat (>= 0.6.1)
|
16
|
-
childprocess (>= 0.1.9)
|
17
|
-
cucumber (>= 0.10.7)
|
18
|
-
rdiscount (>= 1.6.8)
|
19
|
-
rspec (>= 2.6.0)
|
20
|
-
bcat (0.6.1)
|
21
|
-
rack (~> 1.0)
|
22
|
-
builder (3.0.0)
|
23
|
-
capybara (1.0.0)
|
24
|
-
mime-types (>= 1.16)
|
25
|
-
nokogiri (>= 1.3.3)
|
26
|
-
rack (>= 1.0.0)
|
27
|
-
rack-test (>= 0.5.4)
|
28
|
-
selenium-webdriver (~> 0.2.0)
|
29
|
-
xpath (~> 0.1.4)
|
30
|
-
childprocess (0.1.9)
|
31
|
-
ffi (~> 1.0.6)
|
32
|
-
cucumber (1.0.2)
|
33
|
-
builder (>= 2.1.2)
|
34
|
-
diff-lcs (>= 1.1.2)
|
35
|
-
gherkin (~> 2.4.5)
|
36
|
-
json (>= 1.4.6)
|
37
|
-
term-ansicolor (>= 1.0.5)
|
38
|
-
diff-lcs (1.1.2)
|
39
|
-
ffi (1.0.9)
|
40
|
-
gherkin (2.4.21)
|
41
|
-
json (>= 1.4.6)
|
42
|
-
innate (2011.04)
|
43
|
-
rack (>= 1.1.0)
|
44
|
-
json (1.7.5)
|
45
|
-
json_pure (1.5.3)
|
46
|
-
mime-types (1.16)
|
47
|
-
nokogiri (1.5.0)
|
48
|
-
prawn (0.8.4)
|
49
|
-
prawn-core (>= 0.8.4, < 0.9)
|
50
|
-
prawn-layout (>= 0.8.4, < 0.9)
|
51
|
-
prawn-security (>= 0.8.4, < 0.9)
|
52
|
-
prawn-core (0.8.4)
|
53
|
-
prawn-layout (0.8.4)
|
54
|
-
prawn-security (0.8.4)
|
55
|
-
rack (1.3.0)
|
56
|
-
rack-test (0.6.0)
|
57
|
-
rack (>= 1.0)
|
58
|
-
rake (0.9.2)
|
59
|
-
ramaze (2011.01.30)
|
60
|
-
innate (>= 2010.03)
|
61
|
-
rdiscount (1.6.8)
|
62
|
-
rspec (2.6.0)
|
63
|
-
rspec-core (~> 2.6.0)
|
64
|
-
rspec-expectations (~> 2.6.0)
|
65
|
-
rspec-mocks (~> 2.6.0)
|
66
|
-
rspec-core (2.6.4)
|
67
|
-
rspec-expectations (2.6.0)
|
68
|
-
diff-lcs (~> 1.1.2)
|
69
|
-
rspec-mocks (2.6.0)
|
70
|
-
rubyzip (0.9.4)
|
71
|
-
selenium-webdriver (0.2.2)
|
72
|
-
childprocess (>= 0.1.9)
|
73
|
-
ffi (>= 1.0.7)
|
74
|
-
json_pure
|
75
|
-
rubyzip
|
76
|
-
simplecov (0.4.2)
|
77
|
-
simplecov-html (~> 0.4.4)
|
78
|
-
simplecov-html (0.4.5)
|
79
|
-
sinatra (1.2.6)
|
80
|
-
rack (~> 1.1)
|
81
|
-
tilt (>= 1.2.2, < 2.0)
|
82
|
-
spork (0.9.0.rc9)
|
83
|
-
syntax (1.0.0)
|
84
|
-
term-ansicolor (1.0.7)
|
85
|
-
tilt (1.3.2)
|
86
|
-
webrat (0.7.3)
|
87
|
-
nokogiri (>= 1.2.0)
|
88
|
-
rack (>= 1.0)
|
89
|
-
rack-test (>= 0.5.3)
|
90
|
-
xpath (0.1.4)
|
91
|
-
nokogiri (~> 1.3)
|
92
|
-
yard (0.7.1)
|
93
|
-
|
94
|
-
PLATFORMS
|
95
|
-
ruby
|
96
|
-
|
97
|
-
DEPENDENCIES
|
98
|
-
aruba (~> 0.4.2)
|
99
|
-
bcat (= 0.6.1)
|
100
|
-
capybara (>= 1.0.0)
|
101
|
-
casecumber!
|
102
|
-
nokogiri (>= 1.4.4)
|
103
|
-
prawn (= 0.8.4)
|
104
|
-
prawn-layout (= 0.8.4)
|
105
|
-
rack-test (>= 0.5.7)
|
106
|
-
rake (>= 0.9.2)
|
107
|
-
ramaze
|
108
|
-
rdiscount (= 1.6.8)
|
109
|
-
rspec (>= 2.6.0)
|
110
|
-
simplecov (>= 0.4.2)
|
111
|
-
sinatra (>= 1.2.6)
|
112
|
-
spork (>= 0.9.0.rc7)
|
113
|
-
syntax (>= 1.0.0)
|
114
|
-
webrat (>= 0.7.3)
|
115
|
-
yard (= 0.7.1)
|
data/examples/i18n/de/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/en/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/eo/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/fi/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/hu/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/id/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/ja/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/ko/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/lt/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/pl/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/sk/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
data/examples/i18n/tr/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
@@ -1 +0,0 @@
|
|
1
|
-
features.html
|
@@ -1 +0,0 @@
|
|
1
|
-
*.pyc
|
@@ -1 +0,0 @@
|
|
1
|
-
*.pyc
|
data/examples/watir/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
tmp
|
@@ -1,244 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/console'
|
2
|
-
require 'cucumber/formatter/io'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'rubygems'
|
7
|
-
require 'prawn/core'
|
8
|
-
require "prawn/layout"
|
9
|
-
rescue LoadError => e
|
10
|
-
e.message << "\nYou need the prawn gem. Please do 'gem install prawn'"
|
11
|
-
raise e
|
12
|
-
end
|
13
|
-
|
14
|
-
module Cucumber
|
15
|
-
module Formatter
|
16
|
-
|
17
|
-
BLACK = '000000'
|
18
|
-
GREY = '999999'
|
19
|
-
|
20
|
-
class Pdf
|
21
|
-
include FileUtils
|
22
|
-
include Console
|
23
|
-
include Io
|
24
|
-
attr_writer :indent
|
25
|
-
|
26
|
-
def initialize(step_mother, path_or_io, options)
|
27
|
-
@step_mother = step_mother
|
28
|
-
@file = ensure_file(path_or_io, "pdf")
|
29
|
-
|
30
|
-
if(options[:dry_run])
|
31
|
-
@status_colors = { :passed => BLACK, :skipped => BLACK, :undefined => BLACK, :failed => BLACK, :putsd => GREY}
|
32
|
-
else
|
33
|
-
@status_colors = { :passed => '055902', :skipped => GREY, :undefined => 'F27405', :failed => '730202', :putsd => GREY}
|
34
|
-
end
|
35
|
-
|
36
|
-
@pdf = Prawn::Document.new
|
37
|
-
@scrap = Prawn::Document.new
|
38
|
-
@doc = @scrap
|
39
|
-
@options = options
|
40
|
-
@exceptions = []
|
41
|
-
@indent = 0
|
42
|
-
@buffer = []
|
43
|
-
load_cover_page_image
|
44
|
-
@pdf.text "\n\n\nCucumber features", :align => :center, :size => 32
|
45
|
-
@pdf.draw_text "Generated: #{Time.now.strftime("%Y-%m-%d %H:%M")}", :size => 10, :at => [0, 24]
|
46
|
-
@pdf.draw_text "$ cucumber #{ARGV.join(" ")}", :size => 10, :at => [0,10]
|
47
|
-
unless options[:dry_run]
|
48
|
-
@pdf.bounding_box [450,100] , :width => 100 do
|
49
|
-
@pdf.text 'Legend', :size => 10
|
50
|
-
@status_colors.each do |k,v|
|
51
|
-
@pdf.fill_color v
|
52
|
-
@pdf.text k.to_s, :size => 10
|
53
|
-
@pdf.fill_color BLACK
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def load_cover_page_image()
|
60
|
-
if (!load_image("features/support/logo.png"))
|
61
|
-
load_image("features/support/logo.jpg")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def load_image(image_path)
|
66
|
-
begin
|
67
|
-
@pdf.image open(image_path, "rb"), :position => :center, :width => 500
|
68
|
-
true
|
69
|
-
rescue Errno::ENOENT
|
70
|
-
false
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def puts(message)
|
75
|
-
@pdf.fill_color(@status_colors[:putsd])
|
76
|
-
@pdf.text message, :size => 10
|
77
|
-
@pdf.fill_color BLACK
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
def after_features(features)
|
82
|
-
@pdf.render_file(@file.path)
|
83
|
-
puts "\ndone"
|
84
|
-
end
|
85
|
-
|
86
|
-
def feature_name(keyword, name)
|
87
|
-
@pdf.start_new_page
|
88
|
-
names = name.split("\n")
|
89
|
-
@pdf.fill_color GREY
|
90
|
-
@pdf.text(keyword, :align => :center)
|
91
|
-
@pdf.fill_color BLACK
|
92
|
-
names.each_with_index do |nameline, i|
|
93
|
-
case i
|
94
|
-
when 0
|
95
|
-
@pdf.text(nameline.strip, :size => 30, :align => :center )
|
96
|
-
@pdf.text("\n")
|
97
|
-
else
|
98
|
-
@pdf.text(nameline.strip, :size => 12)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
@pdf.move_down(30)
|
102
|
-
end
|
103
|
-
|
104
|
-
def after_feature_element(feature_element)
|
105
|
-
flush
|
106
|
-
end
|
107
|
-
|
108
|
-
def after_feature(feature)
|
109
|
-
flush
|
110
|
-
end
|
111
|
-
|
112
|
-
def feature_element_name(keyword, name)
|
113
|
-
names = name.empty? ? [name] : name.split("\n")
|
114
|
-
print "."
|
115
|
-
STDOUT.flush
|
116
|
-
|
117
|
-
keep_with do
|
118
|
-
@doc.move_down(20)
|
119
|
-
@doc.fill_color GREY
|
120
|
-
@doc.text("#{keyword}", :size => 8)
|
121
|
-
@doc.fill_color BLACK
|
122
|
-
@doc.text("#{names[0]}", :size => 16)
|
123
|
-
names[1..-1].each { |s| @doc.text(s, :size => 12) }
|
124
|
-
@doc.text("\n")
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
129
|
-
@hide_this_step = false
|
130
|
-
if exception
|
131
|
-
if @exceptions.include?(exception)
|
132
|
-
@hide_this_step = true
|
133
|
-
return
|
134
|
-
end
|
135
|
-
@exceptions << exception
|
136
|
-
end
|
137
|
-
if status != :failed && @in_background ^ background
|
138
|
-
@hide_this_step = true
|
139
|
-
return
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def step_name(keyword, step_match, status, source_indent, background)
|
144
|
-
return if @hide_this_step
|
145
|
-
line = "#{keyword} #{step_match.format_args("%s")}"
|
146
|
-
colorize(line, status)
|
147
|
-
end
|
148
|
-
|
149
|
-
def before_background(background)
|
150
|
-
@in_background = true
|
151
|
-
end
|
152
|
-
|
153
|
-
def after_background(background)
|
154
|
-
@in_background = nil
|
155
|
-
end
|
156
|
-
|
157
|
-
def before_multiline_arg(table)
|
158
|
-
return if @hide_this_step
|
159
|
-
if(table.kind_of? Cucumber::Ast::Table)
|
160
|
-
keep_with do
|
161
|
-
print_table(table, ['ffffff', 'f0f0f0'])
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
#using row_color hack to highlight each row correctly
|
167
|
-
def before_outline_table(table)
|
168
|
-
return if @hide_this_step
|
169
|
-
row_colors = table.example_rows.map { |r| @status_colors[r.status] unless r.status == :skipped}
|
170
|
-
keep_with do
|
171
|
-
print_table(table, row_colors)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
def before_doc_string(string)
|
176
|
-
return if @hide_this_step
|
177
|
-
s = %{"""\n#{string}\n"""}.indent(10)
|
178
|
-
s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}
|
179
|
-
s.each do |line|
|
180
|
-
keep_with { @doc.text(line, :size => 8) }
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
def tag_name(tag_name)
|
185
|
-
return if @hide_this_step
|
186
|
-
tag = format_string(tag_name, :tag).indent(@indent)
|
187
|
-
# TODO should we render tags at all? skipped for now. difficult to place due to page breaks
|
188
|
-
end
|
189
|
-
|
190
|
-
def background_name(keyword, name, file_colon_line, source_indent)
|
191
|
-
feature_element_name(keyword, name)
|
192
|
-
end
|
193
|
-
|
194
|
-
def examples_name(keyword, name)
|
195
|
-
feature_element_name(keyword, name)
|
196
|
-
end
|
197
|
-
|
198
|
-
def scenario_name(keyword, name, file_colon_line, source_indent)
|
199
|
-
feature_element_name(keyword, name)
|
200
|
-
end
|
201
|
-
|
202
|
-
private
|
203
|
-
|
204
|
-
def colorize(text, status)
|
205
|
-
keep_with do
|
206
|
-
@doc.fill_color(@status_colors[status] || BLACK)
|
207
|
-
@doc.text(text)
|
208
|
-
@doc.fill_color(BLACK)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def keep_with(&block)
|
213
|
-
@buffer << block
|
214
|
-
end
|
215
|
-
|
216
|
-
def render(doc)
|
217
|
-
@doc = doc
|
218
|
-
@buffer.each do |proc|
|
219
|
-
proc.call
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
# This method does a 'test' rendering on a blank page, to see the rendered height of the buffer
|
224
|
-
# if that too high for the space left on the age in the real document, we do a page break.
|
225
|
-
# This obviously doesn't work if a scenario is longer than a whole page (God forbid)
|
226
|
-
def flush
|
227
|
-
@scrap.start_new_page
|
228
|
-
oldy = @scrap.y
|
229
|
-
render @scrap
|
230
|
-
height = (oldy - @scrap.y) + 36 # whops magic number
|
231
|
-
if ((@pdf.y - height) < @pdf.bounds.bottom)
|
232
|
-
@pdf.start_new_page
|
233
|
-
end
|
234
|
-
render @pdf
|
235
|
-
@pdf.move_down(20)
|
236
|
-
@buffer = []
|
237
|
-
end
|
238
|
-
|
239
|
-
def print_table(table, row_colors)
|
240
|
-
@doc.table(table.rows, :headers => table.headers, :position => :center, :row_colors => row_colors)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|