prawn_calendar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,85 @@
1
+ require 'prawn_calendar'
2
+
3
+ OUTDIR=File.dirname(__FILE__)+"/output"
4
+
5
+ describe PrawnCalendar::WeeklyCalendar do
6
+
7
+ it "connects to a pdf document" do
8
+ @pdf = Prawn::Document.new
9
+ end
10
+
11
+ it "creates a calendar" do
12
+ @pdf = Prawn::Document.new
13
+ calendar = PrawnCalendar::WeeklyCalendar.new(@pdf) do |c|
14
+ c.c_date_start="2013-04-30"
15
+ end
16
+
17
+ #calendar2 = PrawnCalendar::WeeklyCalendar.new(@pdf)
18
+
19
+ calendar.mk_calendar([20,700], width:500, height:250) do
20
+ cal_entry("2013-04-30T06:30:00", "2013-04-30T07:30:00", "oben")
21
+ cal_entry("2013-04-30T15:30:00", "2013-04-30T18:30:00", "normal", recurring: true)
22
+ cal_entry("2013-05-01T06:30:00", "2013-05-01T18:30:00", "oben ")
23
+ cal_entry("2013-05-02T06:30:00", "2013-05-02T23:30:00", "oben und unten")
24
+ cal_entry("2013-05-03T15:30:00", "2013-05-03T23:30:00", "unten")
25
+ cal_entry("2013-05-04T23:30:00", "2013-05-04T23:59:00", "ganz unten")
26
+ cal_entry("2013-05-05T15:30:00", "2013-05-07T22:30:00", "c2 5.5 7as ist ein test, der laufen mussss öalskd jfölaksdj fssss")
27
+ cal_entry("2013-05-06T08:00:00", "2013-05-04T19:00:00", "c3 6.5 7as ist ein test, der laufen musdddddds")
28
+ end
29
+
30
+ #calendar2.c_date_start= "2013-04-30"
31
+
32
+ calendar.mk_calendar([20,300], width:500, height:250) do
33
+ cal_entry("2013-04-29T15:30:00", "2013-04-30T18:30:00", "c1 29.4. das ist ein test, der laufen muss")
34
+ cal_entry("2013-04-30T15:30:00", "2013-04-30T18:30:00", "c1 30.4. das ist ein test, der laufen muss")
35
+ cal_entry("2013-05-01T15:30:00", "2013-04-30T18:30:00", "c1 01.5. das ist ein test, der laufen muss")
36
+ cal_entry("2013-05-02T15:30:00", "2013-04-30T18:30:00", "c1 02.5. das ist ein test, der laufen muss")
37
+ cal_entry("2013-05-03T15:30:00", "2013-04-30T18:30:00", "c1 03.3. das ist ein test, der laufen muss")
38
+ cal_entry("2013-05-04T15:30:00", "2013-04-30T18:30:00", "c1 04.5. das ist ein test, der laufen muss")
39
+ cal_entry("2013-05-05T15:30:00", "2013-05-07T18:30:00", "c2 5.5 7as ist ein test, der laufen mussss öalskd jfölaksdj fssss")
40
+ cal_entry("2013-05-06T08:00:00", "2013-05-04T19:00:00", "c3 6.5 7as ist ein test, der laufen musdddddds")
41
+ end
42
+
43
+ @pdf.start_new_page
44
+
45
+ calendar2 = PrawnCalendar::WeeklyCalendar.new(@pdf) do |c|
46
+ c.c_date_start= "2013-04-30"
47
+ c.mk_calendar([20,700], width:500, height:250) do
48
+ cal_entry("2013-04-30T15:30:00", "2013-05-01T18:30:00", "c7 das ist ein test, der laufen muss")
49
+ cal_entry("2013-05-05T15:30:00", "2013-05-07T18:30:00", "c8 7as ist ein test, der laufen mussss öalskd jfölaksdj fssss")
50
+ cal_entry("2013-05-04T08:50:00", "2013-05-04T19:00:00", "c9 7as ist ein test, der laufen musdddddds")
51
+ end
52
+ end
53
+
54
+ calendar2 = PrawnCalendar::WeeklyCalendar.new(@pdf) do |c|
55
+ c.c_date_start= "2013-04-30"
56
+ c.mk_calendar([20,300], width:500, height:250) do
57
+ cal_entry("2013-04-30T15:30:00", "2013-05-01T18:30:00", "ca das ist ein test, der laufen muss")
58
+ cal_entry("2013-05-05T15:30:00", "2013-05-07T18:30:00", "cb 7as ist ein test, der laufen mussss öalskd jfölaksdj fssss")
59
+ cal_entry("2013-05-05T18:30:00", "2013-05-07T19:30:00", "cb 7as ist ein test, der laufen mussss öalskd jfölaksdj fssss")
60
+ cal_entry("2013-05-04T08:00:00+01:00", "2013-05-07T19:00:00", "cc 7as ist ein test, der laufen musdddddds")
61
+ end
62
+ end
63
+
64
+ @pdf.render_file("#{OUTDIR}/testcalendar.pdf")
65
+
66
+ end
67
+
68
+ it "implicit creates a calendar" do
69
+ Prawn::Document.generate("#{OUTDIR}/implicit.pdf") do
70
+ calendar=PrawnCalendar::WeeklyCalendar.new(self)
71
+ calendar.mk_calendar([20,700], width:500,height:250) do
72
+ cal_entry("2013-05-04T08:00:00+01:00", "2013-05-07T19:00:00", "cc 7as ist ein test, der laufen musdddddds")
73
+
74
+ end
75
+ end
76
+ end
77
+
78
+ it "explicit creates a calendar" do
79
+ Prawn::Document.generate("#{OUTDIR}/explicit.pdf") do |pdf|
80
+ calendar=PrawnCalendar::WeeklyCalendar.new(pdf)
81
+ calendar.mk_calendar([20,700], width:500,height:250) do
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,303 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <title>RSpec results</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+ <meta http-equiv="Expires" content="-1" />
10
+ <meta http-equiv="Pragma" content="no-cache" />
11
+ <style type="text/css">
12
+ body {
13
+ margin: 0;
14
+ padding: 0;
15
+ background: #fff;
16
+ font-size: 80%;
17
+ }
18
+ </style>
19
+ <script type="text/javascript">
20
+ // <![CDATA[
21
+
22
+ function addClass(element_id, classname) {
23
+ document.getElementById(element_id).className += (" " + classname);
24
+ }
25
+
26
+ function removeClass(element_id, classname) {
27
+ var elem = document.getElementById(element_id);
28
+ var classlist = elem.className.replace(classname,'');
29
+ elem.className = classlist;
30
+ }
31
+
32
+ function moveProgressBar(percentDone) {
33
+ document.getElementById("rspec-header").style.width = percentDone +"%";
34
+ }
35
+
36
+ function makeRed(element_id) {
37
+ removeClass(element_id, 'passed');
38
+ removeClass(element_id, 'not_implemented');
39
+ addClass(element_id,'failed');
40
+ }
41
+
42
+ function makeYellow(element_id) {
43
+ var elem = document.getElementById(element_id);
44
+ if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
45
+ if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
46
+ removeClass(element_id, 'passed');
47
+ addClass(element_id,'not_implemented');
48
+ }
49
+ }
50
+ }
51
+
52
+ function apply_filters() {
53
+ var passed_filter = document.getElementById('passed_checkbox').checked;
54
+ var failed_filter = document.getElementById('failed_checkbox').checked;
55
+ var pending_filter = document.getElementById('pending_checkbox').checked;
56
+
57
+ assign_display_style("example passed", passed_filter);
58
+ assign_display_style("example failed", failed_filter);
59
+ assign_display_style("example not_implemented", pending_filter);
60
+
61
+ assign_display_style_for_group("example_group passed", passed_filter);
62
+ assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
63
+ assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
64
+ }
65
+
66
+ function get_display_style(display_flag) {
67
+ var style_mode = 'none';
68
+ if (display_flag == true) {
69
+ style_mode = 'block';
70
+ }
71
+ return style_mode;
72
+ }
73
+
74
+ function assign_display_style(classname, display_flag) {
75
+ var style_mode = get_display_style(display_flag);
76
+ var elems = document.getElementsByClassName(classname)
77
+ for (var i=0; i<elems.length;i++) {
78
+ elems[i].style.display = style_mode;
79
+ }
80
+ }
81
+
82
+ function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
83
+ var display_style_mode = get_display_style(display_flag);
84
+ var subgroup_style_mode = get_display_style(subgroup_flag);
85
+ var elems = document.getElementsByClassName(classname)
86
+ for (var i=0; i<elems.length;i++) {
87
+ var style_mode = display_style_mode;
88
+ if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
89
+ elems[i].style.display = subgroup_style_mode;
90
+ } else {
91
+ elems[i].style.display = display_style_mode;
92
+ }
93
+ }
94
+ }
95
+
96
+ // ]]>
97
+ </script>
98
+ <style type="text/css">
99
+ #rspec-header {
100
+ background: #65C400; color: #fff; height: 4em;
101
+ }
102
+
103
+ .rspec-report h1 {
104
+ margin: 0px 10px 0px 10px;
105
+ padding: 10px;
106
+ font-family: "Lucida Grande", Helvetica, sans-serif;
107
+ font-size: 1.8em;
108
+ position: absolute;
109
+ }
110
+
111
+ #label {
112
+ float:left;
113
+ }
114
+
115
+ #display-filters {
116
+ float:left;
117
+ padding: 28px 0 0 40%;
118
+ font-family: "Lucida Grande", Helvetica, sans-serif;
119
+ }
120
+
121
+ #summary {
122
+ float:right;
123
+ padding: 5px 10px;
124
+ font-family: "Lucida Grande", Helvetica, sans-serif;
125
+ text-align: right;
126
+ }
127
+
128
+ #summary p {
129
+ margin: 0 0 0 2px;
130
+ }
131
+
132
+ #summary #totals {
133
+ font-size: 1.2em;
134
+ }
135
+
136
+ .example_group {
137
+ margin: 0 10px 5px;
138
+ background: #fff;
139
+ }
140
+
141
+ dl {
142
+ margin: 0; padding: 0 0 5px;
143
+ font: normal 11px "Lucida Grande", Helvetica, sans-serif;
144
+ }
145
+
146
+ dt {
147
+ padding: 3px;
148
+ background: #65C400;
149
+ color: #fff;
150
+ font-weight: bold;
151
+ }
152
+
153
+ dd {
154
+ margin: 5px 0 5px 5px;
155
+ padding: 3px 3px 3px 18px;
156
+ }
157
+
158
+ dd .duration {
159
+ padding-left: 5px;
160
+ text-align: right;
161
+ right: 0px;
162
+ float:right;
163
+ }
164
+
165
+ dd.example.passed {
166
+ border-left: 5px solid #65C400;
167
+ border-bottom: 1px solid #65C400;
168
+ background: #DBFFB4; color: #3D7700;
169
+ }
170
+
171
+ dd.example.not_implemented {
172
+ border-left: 5px solid #FAF834;
173
+ border-bottom: 1px solid #FAF834;
174
+ background: #FCFB98; color: #131313;
175
+ }
176
+
177
+ dd.example.pending_fixed {
178
+ border-left: 5px solid #0000C2;
179
+ border-bottom: 1px solid #0000C2;
180
+ color: #0000C2; background: #D3FBFF;
181
+ }
182
+
183
+ dd.example.failed {
184
+ border-left: 5px solid #C20000;
185
+ border-bottom: 1px solid #C20000;
186
+ color: #C20000; background: #FFFBD3;
187
+ }
188
+
189
+
190
+ dt.not_implemented {
191
+ color: #000000; background: #FAF834;
192
+ }
193
+
194
+ dt.pending_fixed {
195
+ color: #FFFFFF; background: #C40D0D;
196
+ }
197
+
198
+ dt.failed {
199
+ color: #FFFFFF; background: #C40D0D;
200
+ }
201
+
202
+
203
+ #rspec-header.not_implemented {
204
+ color: #000000; background: #FAF834;
205
+ }
206
+
207
+ #rspec-header.pending_fixed {
208
+ color: #FFFFFF; background: #C40D0D;
209
+ }
210
+
211
+ #rspec-header.failed {
212
+ color: #FFFFFF; background: #C40D0D;
213
+ }
214
+
215
+
216
+ .backtrace {
217
+ color: #000;
218
+ font-size: 12px;
219
+ }
220
+
221
+ a {
222
+ color: #BE5C00;
223
+ }
224
+
225
+ /* Ruby code, style similar to vibrant ink */
226
+ .ruby {
227
+ font-size: 12px;
228
+ font-family: monospace;
229
+ color: white;
230
+ background-color: black;
231
+ padding: 0.1em 0 0.2em 0;
232
+ }
233
+
234
+ .ruby .keyword { color: #FF6600; }
235
+ .ruby .constant { color: #339999; }
236
+ .ruby .attribute { color: white; }
237
+ .ruby .global { color: white; }
238
+ .ruby .module { color: white; }
239
+ .ruby .class { color: white; }
240
+ .ruby .string { color: #66FF00; }
241
+ .ruby .ident { color: white; }
242
+ .ruby .method { color: #FFCC00; }
243
+ .ruby .number { color: white; }
244
+ .ruby .char { color: white; }
245
+ .ruby .comment { color: #9933CC; }
246
+ .ruby .symbol { color: white; }
247
+ .ruby .regex { color: #44B4CC; }
248
+ .ruby .punct { color: white; }
249
+ .ruby .escape { color: white; }
250
+ .ruby .interp { color: white; }
251
+ .ruby .expr { color: white; }
252
+
253
+ .ruby .offending { background-color: gray; }
254
+ .ruby .linenum {
255
+ width: 75px;
256
+ padding: 0.1em 1em 0.2em 0;
257
+ color: #000000;
258
+ background-color: #FFFBD3;
259
+ }
260
+
261
+ </style>
262
+ </head>
263
+ <body>
264
+ <div class="rspec-report">
265
+
266
+ <div id="rspec-header">
267
+ <div id="label">
268
+ <h1>RSpec Code Examples</h1>
269
+ </div>
270
+
271
+ <div id="display-filters">
272
+ <input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
273
+ <input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
274
+ <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
275
+ </div>
276
+
277
+ <div id="summary">
278
+ <p id="totals">&nbsp;</p>
279
+ <p id="duration">&nbsp;</p>
280
+ </div>
281
+ </div>
282
+
283
+
284
+ <div class="results">
285
+ <div id="div_group_1" class="example_group passed">
286
+ <dl style="margin-left: 0px;">
287
+ <dt id="example_group_1" class="passed">PrawnCalendar::WeeklyCalendar</dt>
288
+ <script type="text/javascript">moveProgressBar('25.0');</script>
289
+ <dd class="example passed"><span class="passed_spec_name">connects to a pdf document</span><span class='duration'>0.00026s</span></dd>
290
+ <script type="text/javascript">moveProgressBar('50.0');</script>
291
+ <dd class="example passed"><span class="passed_spec_name">creates a calendar</span><span class='duration'>0.30364s</span></dd>
292
+ <script type="text/javascript">moveProgressBar('75.0');</script>
293
+ <dd class="example passed"><span class="passed_spec_name">implicit creates a calendar</span><span class='duration'>0.04820s</span></dd>
294
+ <script type="text/javascript">moveProgressBar('100.0');</script>
295
+ <dd class="example passed"><span class="passed_spec_name">explicit creates a calendar</span><span class='duration'>0.06581s</span></dd>
296
+ </dl>
297
+ </div>
298
+ <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.41880 seconds</strong>";</script>
299
+ <script type="text/javascript">document.getElementById('totals').innerHTML = "4 examples, 0 failures";</script>
300
+ </div>
301
+ </div>
302
+ </body>
303
+ </html>
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prawn_calendar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bernhard Weichel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: prawn
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.3'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: yard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: redcarpet
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: This gem provides a function to generate calendars and calendar entries.
127
+ email:
128
+ - github.com@nospam.weichel21.de
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - .gitignore
134
+ - Gemfile
135
+ - LICENSE.txt
136
+ - README.md
137
+ - Rakefile
138
+ - lib/prawn_calendar.rb
139
+ - lib/prawn_calendar/version.rb
140
+ - prawn_calendar.gemspec
141
+ - spec/output/testcalendar.pdf
142
+ - spec/weekly_calender_spec.rb
143
+ - testresults/test_results.html
144
+ homepage: https://github.com/bwl21/prawn_calendar
145
+ licenses:
146
+ - MIT
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ segments:
158
+ - 0
159
+ hash: -3949576610573311762
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ segments:
167
+ - 0
168
+ hash: -3949576610573311762
169
+ requirements: []
170
+ rubyforge_project:
171
+ rubygems_version: 1.8.25
172
+ signing_key:
173
+ specification_version: 3
174
+ summary: generate calendars with prawn
175
+ test_files:
176
+ - spec/output/testcalendar.pdf
177
+ - spec/weekly_calender_spec.rb
178
+ has_rdoc: