deckrb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/README.md +63 -0
  2. data/bin/deck +59 -0
  3. data/deck/GPL-license.txt +278 -0
  4. data/deck/MIT-license.txt +21 -0
  5. data/deck/README.md +57 -0
  6. data/deck/core/deck.core.css +404 -0
  7. data/deck/core/deck.core.html +39 -0
  8. data/deck/core/deck.core.js +498 -0
  9. data/deck/core/deck.core.scss +447 -0
  10. data/deck/extensions/goto/deck.goto.css +41 -0
  11. data/deck/extensions/goto/deck.goto.html +7 -0
  12. data/deck/extensions/goto/deck.goto.js +134 -0
  13. data/deck/extensions/goto/deck.goto.scss +46 -0
  14. data/deck/extensions/hash/deck.hash.css +13 -0
  15. data/deck/extensions/hash/deck.hash.html +2 -0
  16. data/deck/extensions/hash/deck.hash.js +129 -0
  17. data/deck/extensions/hash/deck.hash.scss +15 -0
  18. data/deck/extensions/menu/deck.menu.css +47 -0
  19. data/deck/extensions/menu/deck.menu.js +187 -0
  20. data/deck/extensions/menu/deck.menu.scss +58 -0
  21. data/deck/extensions/navigation/deck.navigation.css +43 -0
  22. data/deck/extensions/navigation/deck.navigation.html +3 -0
  23. data/deck/extensions/navigation/deck.navigation.js +91 -0
  24. data/deck/extensions/navigation/deck.navigation.scss +56 -0
  25. data/deck/extensions/scale/deck.scale.css +16 -0
  26. data/deck/extensions/scale/deck.scale.js +155 -0
  27. data/deck/extensions/scale/deck.scale.scss +17 -0
  28. data/deck/extensions/status/deck.status.css +18 -0
  29. data/deck/extensions/status/deck.status.html +6 -0
  30. data/deck/extensions/status/deck.status.js +95 -0
  31. data/deck/extensions/status/deck.status.scss +22 -0
  32. data/deck/extensions/theme-picker/deck.theme-picker.css +55 -0
  33. data/deck/extensions/theme-picker/deck.theme-picker.js +13 -0
  34. data/deck/introduction/index.html +221 -0
  35. data/deck/introduction/index.rb +101 -0
  36. data/deck/jquery-1.7.min.js +4 -0
  37. data/deck/modernizr.custom.js +4 -0
  38. data/deck/test/fixtures/complex.html +24 -0
  39. data/deck/test/fixtures/empty.html +19 -0
  40. data/deck/test/fixtures/iframe_simple.html +10 -0
  41. data/deck/test/fixtures/iframes.html +32 -0
  42. data/deck/test/fixtures/nesteds.html +36 -0
  43. data/deck/test/fixtures/standard.html +42 -0
  44. data/deck/test/index.html +39 -0
  45. data/deck/test/lib/jasmine-html.js +190 -0
  46. data/deck/test/lib/jasmine-jquery.js +288 -0
  47. data/deck/test/lib/jasmine.css +166 -0
  48. data/deck/test/lib/jasmine.js +2477 -0
  49. data/deck/test/settings.js +3 -0
  50. data/deck/test/spec.core.js +434 -0
  51. data/deck/test/spec.goto.js +119 -0
  52. data/deck/test/spec.hash.js +81 -0
  53. data/deck/test/spec.menu.js +66 -0
  54. data/deck/test/spec.navigation.js +51 -0
  55. data/deck/test/spec.scale.js +57 -0
  56. data/deck/test/spec.status.js +58 -0
  57. data/deck/themes/style/neon.css +114 -0
  58. data/deck/themes/style/neon.scss +139 -0
  59. data/deck/themes/style/swiss.css +75 -0
  60. data/deck/themes/style/swiss.scss +91 -0
  61. data/deck/themes/style/web-2.0.css +205 -0
  62. data/deck/themes/style/web-2.0.scss +236 -0
  63. data/deck/themes/transition/fade.css +44 -0
  64. data/deck/themes/transition/fade.scss +70 -0
  65. data/deck/themes/transition/horizontal-slide.css +79 -0
  66. data/deck/themes/transition/horizontal-slide.scss +94 -0
  67. data/deck/themes/transition/vertical-slide.css +97 -0
  68. data/deck/themes/transition/vertical-slide.scss +116 -0
  69. data/lib/deck.rb +7 -0
  70. data/lib/deck/app.rb +16 -0
  71. data/lib/deck/deck.rb +166 -0
  72. data/lib/deck/rack_static_patch.rb +13 -0
  73. data/lib/deck/slide.rb +120 -0
  74. data/lib/deck/version.rb +3 -0
  75. data/spec/deck_spec.rb +98 -0
  76. data/spec/javascripts/support/jasmine_config.rb +23 -0
  77. data/spec/javascripts/support/jasmine_runner.rb +32 -0
  78. data/spec/slide_spec.rb +285 -0
  79. data/spec/spec_helper.rb +7 -0
  80. metadata +172 -0
@@ -0,0 +1,32 @@
1
+ $:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
2
+
3
+ require 'rubygems'
4
+ require 'jasmine'
5
+ jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
6
+ require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
7
+ if Jasmine::Dependencies.rspec2?
8
+ require 'rspec'
9
+ else
10
+ require 'spec'
11
+ end
12
+
13
+ jasmine_config = Jasmine::Config.new
14
+ spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
15
+
16
+ should_stop = false
17
+
18
+ if Jasmine::Dependencies.rspec2?
19
+ RSpec.configuration.after(:suite) do
20
+ spec_builder.stop if should_stop
21
+ end
22
+ else
23
+ Spec::Runner.configure do |config|
24
+ config.after(:suite) do
25
+ spec_builder.stop if should_stop
26
+ end
27
+ end
28
+ end
29
+
30
+ spec_builder.start
31
+ should_stop = true
32
+ spec_builder.declare_suites
@@ -0,0 +1,285 @@
1
+ # based on work by Alex and others in Showoff
2
+
3
+ require File.expand_path "../spec_helper", __FILE__
4
+ require "deck/slide"
5
+
6
+ module Deck
7
+ describe Slide do
8
+
9
+ describe "classes" do
10
+ it "by default" do
11
+ assert {Slide.new.classes == ["slide"]}
12
+ end
13
+
14
+ it "when passed a string" do
15
+ assert {Slide.new(:classes => "foo bar").classes == ["slide", "foo", "bar"]}
16
+ end
17
+
18
+ it "when passed an array" do
19
+ assert {Slide.new(:classes => ["foo", "bar"]).classes == ["slide", "foo", "bar"]}
20
+ end
21
+ end
22
+
23
+ describe "splits Markdown into slides" do
24
+ it "from an empty string" do
25
+ slides = Slide.split ""
26
+ assert { slides.empty? }
27
+ end
28
+
29
+ it "from a simple chunk of Markdown" do
30
+ slides = Slide.split <<-MARKDOWN
31
+ # One
32
+ * uno
33
+ MARKDOWN
34
+ assert { slides.size == 1 }
35
+ assert { slides.first.classes == ["slide"] }
36
+ assert { slides.first.markdown_text == "# One\n* uno\n" }
37
+ end
38
+
39
+ it "from a simple chunk of Markdown with slide markers" do
40
+ slides = Slide.split <<-MARKDOWN
41
+ !SLIDE cool
42
+ # One
43
+ * uno
44
+
45
+ !SLIDE neat
46
+ # Two
47
+ * dos
48
+ MARKDOWN
49
+ assert { slides.size == 2 }
50
+ slide = slides.first
51
+ assert { slide.classes == ["slide", "cool"] }
52
+ assert { slides.first.markdown_text == "# One\n* uno\n\n" }
53
+ slide = slides[1]
54
+ assert { slide.classes == ["slide", "neat"] }
55
+ assert { slide.markdown_text == "# Two\n* dos\n" }
56
+ end
57
+
58
+ it "from a simple chunk of Markdown with comment-style slide markers" do
59
+ slides = Slide.split <<-MARKDOWN
60
+ <!SLIDE cool>
61
+ # One
62
+ * uno
63
+
64
+ <!SLIDE neat>
65
+ # Two
66
+ * dos
67
+ MARKDOWN
68
+ assert { slides.size == 2 }
69
+ slide = slides.first
70
+ assert { slide.classes == ["slide", "cool"] }
71
+ assert { slides.first.markdown_text == "# One\n* uno\n\n" }
72
+ slide = slides[1]
73
+ assert { slide.classes == ["slide", "neat"] }
74
+ assert { slide.markdown_text == "# Two\n* dos\n" }
75
+ end
76
+
77
+
78
+ it "omits empty slides" do
79
+ slides = Slide.split <<-MARKDOWN
80
+ !SLIDE
81
+ # One
82
+ * uno
83
+
84
+ !SLIDE
85
+
86
+ !SLIDE
87
+ # Two
88
+ * dos
89
+ MARKDOWN
90
+ assert { slides.size == 2 }
91
+ end
92
+
93
+ describe "every H1 defines a new slide" do
94
+ it "if there are no !SLIDE markers at all" do
95
+ slides = Slide.split <<-MARKDOWN
96
+ # One
97
+ * uno
98
+
99
+ # Two
100
+ * dos
101
+ MARKDOWN
102
+ assert { slides.size == 2 }
103
+ slide = slides.first
104
+ assert { slide.classes == ["slide"] }
105
+ assert { slides.first.markdown_text == "# One\n* uno\n\n" }
106
+ slide = slides[1]
107
+ assert { slide.classes == ["slide"] }
108
+ assert { slide.markdown_text == "# Two\n* dos\n" }
109
+ end
110
+
111
+ it "with underline-style H1s" do
112
+ pending "parsing underline-style H1s"
113
+ slides = Slide.split <<-MARKDOWN
114
+ One
115
+ ===
116
+ * uno
117
+
118
+ Two
119
+ ===
120
+ * dos
121
+ MARKDOWN
122
+ assert { slides.size == 2 }
123
+
124
+ slide = slides.first
125
+ assert { slide.classes == ["slide"] }
126
+ assert { slides.first.markdown_text == "One\n===\n* uno\n\n" }
127
+
128
+ slide = slides[1]
129
+ assert { slide.classes == ["slide"] }
130
+ assert { slide.markdown_text == "Two\n===\n* dos\n" }
131
+ end
132
+
133
+
134
+ it "with mixed SLIDE directives" do
135
+ varied = <<-MARKDOWN
136
+ <!SLIDE>
137
+ # One
138
+ * uno
139
+
140
+ # Two
141
+ * dos
142
+
143
+ # Three
144
+ * tres
145
+
146
+ !SLIDE
147
+ # Four
148
+ * quatro
149
+ MARKDOWN
150
+
151
+ slides = Slide.split varied
152
+ assert { slides.size == 4 }
153
+
154
+ slide = slides[0]
155
+ assert { slide.classes == ["slide"] }
156
+ assert { slides.first.markdown_text == "# One\n* uno\n\n" }
157
+
158
+ slide = slides[1]
159
+ assert { slide.classes == ["slide"] }
160
+ assert { slide.markdown_text == "# Two\n* dos\n\n" }
161
+
162
+ slide = slides[2]
163
+ assert { slide.classes == ["slide"] }
164
+ assert { slide.markdown_text == "# Three\n* tres\n\n" }
165
+
166
+ slide = slides[3]
167
+ assert { slide.classes == ["slide"] }
168
+ assert { slide.markdown_text == "# Four\n* quatro\n" }
169
+
170
+ end
171
+ end
172
+ end
173
+
174
+ def slide_from markdown_text
175
+ Slide.split(markdown_text).first
176
+ end
177
+
178
+ describe "sets the slide's id" do
179
+ it "based on the first header" do
180
+ assert { slide_from("# foo").slide_id == "foo" }
181
+ end
182
+
183
+ it "lowercases and sanitizes" do
184
+ assert { slide_from("# Foo's #1!").slide_id == "foos_1" }
185
+ end
186
+
187
+ it "from a parameter if one is passed" do
188
+ slide = Slide.new(:markdown_text => "# foo", :slide_id => "bar")
189
+ assert { slide.slide_id == "bar" }
190
+ end
191
+ end
192
+
193
+ describe "renders deck.js-compatible HTML" do
194
+ it "with only a header, leaving a solo H1 as an H1" do
195
+ html = slide_from(<<-MARKDOWN).to_pretty
196
+ # foo
197
+ MARKDOWN
198
+ expected_html = <<-HTML
199
+ <section class="slide" id="foo">
200
+ <h1>foo</h1>
201
+ </section>
202
+ HTML
203
+ assert { html == expected_html }
204
+ end
205
+
206
+ it "with a header and bullets (converting a non-solo H1 into an H2 for deck.js style compatibility)" do
207
+ html = slide_from(<<-MARKDOWN).to_pretty
208
+ # foo
209
+ * bar
210
+ * baz
211
+ MARKDOWN
212
+ expected_html = <<-HTML
213
+ <section class="slide" id="foo">
214
+ <h2>foo</h2>
215
+
216
+ <ul>
217
+ <li>bar</li>
218
+ <li>baz</li>
219
+ </ul>
220
+ </section>
221
+ HTML
222
+ assert { html == expected_html }
223
+ end
224
+
225
+ it "with only a underline-style header, leaving a solo H1 as an H1" do
226
+ pending "parsing underline-style H1s"
227
+ html = slide_from(<<-MARKDOWN).to_pretty
228
+ foo
229
+ ===
230
+ MARKDOWN
231
+ expected_html = <<-HTML
232
+ <section class="slide" id="foo">
233
+ <h1>foo</h1>
234
+ </section>
235
+ HTML
236
+ assert { html == expected_html }
237
+ end
238
+
239
+ it "converts a non-solo underline-style H1 into an H2 for deck.js style compatibility)" do
240
+ pending "parsing underline-style H1s"
241
+ html = slide_from(<<-MARKDOWN).to_pretty
242
+ foo
243
+ ===
244
+ * bar
245
+ * baz
246
+ MARKDOWN
247
+ expected_html = <<-HTML
248
+ <section class="slide" id="foo">
249
+ <h2>foo</h2>
250
+
251
+ <ul>
252
+ <li>bar</li>
253
+ <li>baz</li>
254
+ </ul>
255
+ </section>
256
+ HTML
257
+ assert { html == expected_html }
258
+ end
259
+
260
+
261
+ end
262
+
263
+ describe "slide classes" do
264
+ it "are added to the section element" do
265
+ html = slide_from(<<-MARKDOWN).to_pretty
266
+ <!SLIDE fancy pants>
267
+ # foo
268
+ * bar
269
+ * baz
270
+ MARKDOWN
271
+ expected_html = <<-HTML
272
+ <section class="slide fancy pants" id="foo">
273
+ <h2>foo</h2>
274
+
275
+ <ul>
276
+ <li>bar</li>
277
+ <li>baz</li>
278
+ </ul>
279
+ </section>
280
+ HTML
281
+ assert { html == expected_html }
282
+ end
283
+ end
284
+ end
285
+ end
@@ -0,0 +1,7 @@
1
+ here = File.expand_path File.dirname(__FILE__)
2
+ top = File.expand_path "#{here}/.."
3
+ $: << "#{top}/lib"
4
+
5
+ require "rspec"
6
+ require "wrong/adapters/rspec"
7
+ require "nokogiri"
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deckrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alex Chaffee
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: erector
16
+ requirement: &70280051769480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.0.pre1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70280051769480
25
+ - !ruby/object:Gem::Dependency
26
+ name: redcarpet
27
+ requirement: &70280051768340 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70280051768340
36
+ - !ruby/object:Gem::Dependency
37
+ name: rack
38
+ requirement: &70280051758200 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70280051758200
47
+ description: deck.js (http://imakewebthings.github.com/deck.js) is a JavaScript library
48
+ for building slide presentations using HTML 5. deck.rb (http://github.com/alexch/deck.rb)
49
+ builds on top of deck.js, adding some features and letting you focus on your slides,
50
+ not the HTML infrastructure.
51
+ email: alex@stinky.com
52
+ executables:
53
+ - deck
54
+ extensions: []
55
+ extra_rdoc_files:
56
+ - README.md
57
+ files:
58
+ - lib/deck/app.rb
59
+ - lib/deck/deck.rb
60
+ - lib/deck/rack_static_patch.rb
61
+ - lib/deck/slide.rb
62
+ - lib/deck/version.rb
63
+ - lib/deck.rb
64
+ - deck/core/deck.core.css
65
+ - deck/core/deck.core.html
66
+ - deck/core/deck.core.js
67
+ - deck/core/deck.core.scss
68
+ - deck/extensions/goto/deck.goto.css
69
+ - deck/extensions/goto/deck.goto.html
70
+ - deck/extensions/goto/deck.goto.js
71
+ - deck/extensions/goto/deck.goto.scss
72
+ - deck/extensions/hash/deck.hash.css
73
+ - deck/extensions/hash/deck.hash.html
74
+ - deck/extensions/hash/deck.hash.js
75
+ - deck/extensions/hash/deck.hash.scss
76
+ - deck/extensions/menu/deck.menu.css
77
+ - deck/extensions/menu/deck.menu.js
78
+ - deck/extensions/menu/deck.menu.scss
79
+ - deck/extensions/navigation/deck.navigation.css
80
+ - deck/extensions/navigation/deck.navigation.html
81
+ - deck/extensions/navigation/deck.navigation.js
82
+ - deck/extensions/navigation/deck.navigation.scss
83
+ - deck/extensions/scale/deck.scale.css
84
+ - deck/extensions/scale/deck.scale.js
85
+ - deck/extensions/scale/deck.scale.scss
86
+ - deck/extensions/status/deck.status.css
87
+ - deck/extensions/status/deck.status.html
88
+ - deck/extensions/status/deck.status.js
89
+ - deck/extensions/status/deck.status.scss
90
+ - deck/extensions/theme-picker/deck.theme-picker.css
91
+ - deck/extensions/theme-picker/deck.theme-picker.js
92
+ - deck/GPL-license.txt
93
+ - deck/introduction/index.html
94
+ - deck/introduction/index.rb
95
+ - deck/jquery-1.7.min.js
96
+ - deck/MIT-license.txt
97
+ - deck/modernizr.custom.js
98
+ - deck/README.md
99
+ - deck/test/fixtures/complex.html
100
+ - deck/test/fixtures/empty.html
101
+ - deck/test/fixtures/iframe_simple.html
102
+ - deck/test/fixtures/iframes.html
103
+ - deck/test/fixtures/nesteds.html
104
+ - deck/test/fixtures/standard.html
105
+ - deck/test/index.html
106
+ - deck/test/lib/jasmine-html.js
107
+ - deck/test/lib/jasmine-jquery.js
108
+ - deck/test/lib/jasmine.css
109
+ - deck/test/lib/jasmine.js
110
+ - deck/test/settings.js
111
+ - deck/test/spec.core.js
112
+ - deck/test/spec.goto.js
113
+ - deck/test/spec.hash.js
114
+ - deck/test/spec.menu.js
115
+ - deck/test/spec.navigation.js
116
+ - deck/test/spec.scale.js
117
+ - deck/test/spec.status.js
118
+ - deck/themes/style/neon.css
119
+ - deck/themes/style/neon.scss
120
+ - deck/themes/style/swiss.css
121
+ - deck/themes/style/swiss.scss
122
+ - deck/themes/style/web-2.0.css
123
+ - deck/themes/style/web-2.0.scss
124
+ - deck/themes/transition/fade.css
125
+ - deck/themes/transition/fade.scss
126
+ - deck/themes/transition/horizontal-slide.css
127
+ - deck/themes/transition/horizontal-slide.scss
128
+ - deck/themes/transition/vertical-slide.css
129
+ - deck/themes/transition/vertical-slide.scss
130
+ - README.md
131
+ - spec/deck_spec.rb
132
+ - spec/javascripts/support/jasmine_config.rb
133
+ - spec/javascripts/support/jasmine_runner.rb
134
+ - spec/slide_spec.rb
135
+ - spec/spec_helper.rb
136
+ - bin/deck
137
+ homepage: http://github.com/alexch/deck
138
+ licenses: []
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
150
+ - 0
151
+ hash: 3963670590188889992
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ segments:
159
+ - 0
160
+ hash: 3963670590188889992
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 1.8.10
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: Make HTML slide shows; wraps deck.js
167
+ test_files:
168
+ - spec/deck_spec.rb
169
+ - spec/javascripts/support/jasmine_config.rb
170
+ - spec/javascripts/support/jasmine_runner.rb
171
+ - spec/slide_spec.rb
172
+ - spec/spec_helper.rb