deckrb 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/README.md +84 -25
  2. data/bin/deck +3 -4
  3. data/lib/deck/rack_app.rb +39 -7
  4. data/lib/deck/slide.rb +9 -2
  5. data/lib/deck/slide_deck.rb +10 -13
  6. data/lib/deck/version.rb +1 -1
  7. data/public/coderay.css +84 -0
  8. data/public/deck.js/GPL-license.txt +278 -0
  9. data/public/deck.js/MIT-license.txt +21 -0
  10. data/public/deck.js/README.md +57 -0
  11. data/public/deck.js/core/deck.core.css +404 -0
  12. data/public/deck.js/core/deck.core.html +39 -0
  13. data/public/deck.js/core/deck.core.js +498 -0
  14. data/public/deck.js/core/deck.core.scss +447 -0
  15. data/public/deck.js/extensions/goto/deck.goto.css +41 -0
  16. data/public/deck.js/extensions/goto/deck.goto.html +7 -0
  17. data/public/deck.js/extensions/goto/deck.goto.js +134 -0
  18. data/public/deck.js/extensions/goto/deck.goto.scss +46 -0
  19. data/public/deck.js/extensions/hash/deck.hash.css +13 -0
  20. data/public/deck.js/extensions/hash/deck.hash.html +2 -0
  21. data/public/deck.js/extensions/hash/deck.hash.js +129 -0
  22. data/public/deck.js/extensions/hash/deck.hash.scss +15 -0
  23. data/public/deck.js/extensions/menu/deck.menu.css +47 -0
  24. data/public/deck.js/extensions/menu/deck.menu.js +187 -0
  25. data/public/deck.js/extensions/menu/deck.menu.scss +58 -0
  26. data/public/deck.js/extensions/navigation/deck.navigation.css +43 -0
  27. data/public/deck.js/extensions/navigation/deck.navigation.html +3 -0
  28. data/public/deck.js/extensions/navigation/deck.navigation.js +91 -0
  29. data/public/deck.js/extensions/navigation/deck.navigation.scss +56 -0
  30. data/public/deck.js/extensions/scale/deck.scale.css +16 -0
  31. data/public/deck.js/extensions/scale/deck.scale.js +156 -0
  32. data/public/deck.js/extensions/scale/deck.scale.scss +17 -0
  33. data/public/deck.js/extensions/status/deck.status.css +18 -0
  34. data/public/deck.js/extensions/status/deck.status.html +6 -0
  35. data/public/deck.js/extensions/status/deck.status.js +95 -0
  36. data/public/deck.js/extensions/status/deck.status.scss +22 -0
  37. data/public/deck.js/extensions/theme-picker/deck.theme-picker.css +55 -0
  38. data/public/deck.js/extensions/theme-picker/deck.theme-picker.js +13 -0
  39. data/public/deck.js/introduction/index.html +221 -0
  40. data/public/deck.js/introduction/index.rb +101 -0
  41. data/public/deck.js/jquery-1.7.min.js +4 -0
  42. data/public/deck.js/modernizr.custom.js +4 -0
  43. data/public/deck.js/test/fixtures/complex.html +24 -0
  44. data/public/deck.js/test/fixtures/empty.html +19 -0
  45. data/public/deck.js/test/fixtures/iframe_simple.html +10 -0
  46. data/public/deck.js/test/fixtures/iframes.html +32 -0
  47. data/public/deck.js/test/fixtures/nesteds.html +36 -0
  48. data/public/deck.js/test/fixtures/standard.html +42 -0
  49. data/public/deck.js/test/index.html +39 -0
  50. data/public/deck.js/test/lib/jasmine-html.js +190 -0
  51. data/public/deck.js/test/lib/jasmine-jquery.js +288 -0
  52. data/public/deck.js/test/lib/jasmine.css +166 -0
  53. data/public/deck.js/test/lib/jasmine.js +2477 -0
  54. data/public/deck.js/test/settings.js +3 -0
  55. data/public/deck.js/test/spec.core.js +434 -0
  56. data/public/deck.js/test/spec.goto.js +119 -0
  57. data/public/deck.js/test/spec.hash.js +81 -0
  58. data/public/deck.js/test/spec.menu.js +66 -0
  59. data/public/deck.js/test/spec.navigation.js +51 -0
  60. data/public/deck.js/test/spec.scale.js +57 -0
  61. data/public/deck.js/test/spec.status.js +58 -0
  62. data/public/deck.js/themes/style/neon.css +114 -0
  63. data/public/deck.js/themes/style/neon.scss +139 -0
  64. data/public/deck.js/themes/style/swiss.css +75 -0
  65. data/public/deck.js/themes/style/swiss.scss +91 -0
  66. data/public/deck.js/themes/style/web-2.0.css +205 -0
  67. data/public/deck.js/themes/style/web-2.0.scss +236 -0
  68. data/public/deck.js/themes/transition/fade.css +44 -0
  69. data/public/deck.js/themes/transition/fade.scss +70 -0
  70. data/public/deck.js/themes/transition/horizontal-slide.css +79 -0
  71. data/public/deck.js/themes/transition/horizontal-slide.scss +94 -0
  72. data/public/deck.js/themes/transition/vertical-slide.css +97 -0
  73. data/public/deck.js/themes/transition/vertical-slide.scss +116 -0
  74. data/public/favicon.ico +0 -0
  75. data/spec/rack_app_spec.rb +101 -33
  76. data/spec/slide_deck_spec.rb +6 -7
  77. data/spec/slide_spec.rb +19 -0
  78. metadata +95 -16
Binary file
@@ -5,8 +5,20 @@ require "deck/rack_app"
5
5
 
6
6
  require "rack/test"
7
7
 
8
- describe Deck::RackApp do
8
+ module Deck
9
+ describe RackApp do
9
10
  include Rack::Test::Methods
11
+ include Files
12
+
13
+ def assert_ok
14
+ unless last_response.ok?
15
+ status, errors = last_response.status, last_response.errors
16
+ assert(last_response.inspect) { errors.empty? && status == 200 }
17
+ end
18
+ end
19
+ def here
20
+ File.expand_path File.dirname(__FILE__)
21
+ end
10
22
 
11
23
  describe "app with middleware" do
12
24
  def app
@@ -38,6 +50,11 @@ describe Deck::RackApp do
38
50
  File.read("#{here}/../public/#{deckjs_core_path}", :encoding => last_response.body.encoding)}
39
51
  end
40
52
 
53
+ it "finds coderay.css" do
54
+ get "/coderay.css"
55
+ assert_ok
56
+ end
57
+
41
58
  end
42
59
 
43
60
  describe "raw app" do
@@ -46,10 +63,8 @@ describe Deck::RackApp do
46
63
  end
47
64
 
48
65
  it "serves a .md file as a deck.js HTML file" do
49
- dir = Files do
50
- file "foo.md"
51
- end
52
- @app = Deck::RackApp.new ["#{dir}/foo.md"]
66
+ foo_path = file "foo.md"
67
+ @app = Deck::RackApp.new [foo_path]
53
68
  get "/"
54
69
  assert_ok
55
70
  assert { last_response.body.include? "contents of foo.md" }
@@ -62,41 +77,30 @@ describe Deck::RackApp do
62
77
  end
63
78
 
64
79
  it "serves up non-markdown files in the top directory" do
65
- dir = Files do
66
- file "foo.md"
67
- file "foo.css"
68
- end
69
- @app = Deck::RackApp.build ["#{dir}/foo.md"]
80
+ file "foo.md"
81
+ file "foo.css"
82
+ @app = Deck::RackApp.build ["#{files.root}/foo.md"]
70
83
  get "/foo.css"
71
84
  assert_ok
72
85
  assert { last_response.body.include? "contents of foo.css" }
73
86
  end
74
87
 
75
- def assert_ok
76
- unless last_response.ok?
77
- status, errors = last_response.status, last_response.errors
78
- assert(last_response.inspect) { errors.empty? && status == 200 }
79
- end
80
- end
81
-
82
88
  describe "serving multiple slide files from multiple subdirs" do
83
89
 
84
90
  before do
85
- @dir = Files do
86
- dir "foo" do
87
- file "foo.md", "# foo"
88
- file "foo.css"
89
- end
90
- dir "bar" do
91
- file "bar.md", "# barista\n\n# barbie\n\n# bartles & james"
92
- file "bar.css"
93
- dir "img" do
94
- file "bar.png"
95
- end
91
+ dir "foo" do
92
+ file "foo.md", "# foo"
93
+ file "foo.css"
94
+ end
95
+ dir "bar" do
96
+ file "bar.md", "# barista\n\n# barbie\n\n# bartles & james"
97
+ file "bar.css"
98
+ dir "img" do
99
+ file "bar.png"
96
100
  end
97
101
  end
98
102
 
99
- @app = Deck::RackApp.build ["#{@dir}/foo/foo.md", "#{@dir}/bar/bar.md"]
103
+ @app = Deck::RackApp.build ["#{files.root}/foo/foo.md", "#{files.root}/bar/bar.md"]
100
104
  end
101
105
 
102
106
  it "stuffs all the source files into a single slide deck served off /" do
@@ -132,10 +136,8 @@ describe Deck::RackApp do
132
136
 
133
137
  describe "highlights code blocks" do
134
138
  def build_app markdown
135
- @dir = Files do
136
- file "foo.md", markdown
137
- end
138
- @app = Deck::RackApp.build ["#{@dir}/foo.md"]
139
+ file "foo.md", markdown
140
+ @app = Deck::RackApp.build ["#{files.root}/foo.md"]
139
141
  end
140
142
 
141
143
  def assert_code_is_highlighted
@@ -173,5 +175,71 @@ describe Deck::RackApp do
173
175
  end
174
176
  end
175
177
 
178
+ describe '#slides' do
179
+ it "builds a bunch of slide objects from the slide_files property" do
180
+ slide_file = file "foo.md", "# hello"
181
+ app = RackApp.new [slide_file]
182
+ assert { app.slides == Slide.from_file(slide_file) }
183
+ end
184
+
185
+ it "reads a showoff.json file" do
186
+ foo_file = file "foo.md", "# hello"
187
+ bar_file = file "bar.md", "# hello"
188
+ showoff_file = file "showoff.json", <<-JSON
189
+ {
190
+ "name": "Ruby For Programmers",
191
+ "description": "an introduction to the Ruby programming language",
192
+ "sections": [
193
+ "foo.md",
194
+ "bar.md"
195
+ ]
196
+ }
197
+ JSON
198
+
199
+ app = RackApp.new [showoff_file]
200
+ assert { app.slides == Slide.from_file(foo_file) + Slide.from_file(bar_file) }
201
+ end
202
+
203
+ it "reads a showoff.json file including literal markdown as a section" do
204
+
205
+ foo_file = file "foo.md", "# hello"
206
+ bar_file = file "bar.md", "# goodbye"
207
+ showoff_file = file "showoff.json", <<-JSON
208
+ {
209
+ "name": "Ruby For Programmers",
210
+ "description": "an introduction to the Ruby programming language",
211
+ "sections": [
212
+ "foo.md",
213
+ "# literal markdown",
214
+ "bar.md"
215
+ ]
216
+ }
217
+ JSON
218
+ app = RackApp.new [showoff_file]
219
+ assert {
220
+ app.slides.size == 3
221
+ }
222
+ assert {
223
+ app.slides[1].markdown_text == "# literal markdown\n"
224
+ }
225
+ assert { app.slides[0].slide_id == "hello" }
226
+ assert { app.slides[1].slide_id == "literal_markdown" }
227
+ assert { app.slides[2].slide_id == "goodbye" }
228
+ # assert {
229
+ # app.slides ==
230
+ # Slide.from_file(foo_file) +
231
+ # [Slide.new(:markdown_text => "# literal markdown")] +
232
+ # Slide.from_file(bar_file)
233
+ # }
234
+ assert {
235
+ app.deck.to_html.include?("<h1>literal markdown</h1>")
236
+ }
237
+ end
238
+
239
+ it "if no slides are specified, it globs all markdown files under ."
240
+
241
+ end
242
+
176
243
  end
244
+ end
177
245
  end
@@ -6,6 +6,8 @@ require "deck/slide_deck"
6
6
  module Deck
7
7
  describe SlideDeck do
8
8
 
9
+ include Files
10
+
9
11
  def doc
10
12
  @doc ||= begin
11
13
  @html = deck_widget.to_html
@@ -27,14 +29,11 @@ module Deck
27
29
  end
28
30
 
29
31
  it "renders a markdown file with one slide" do
30
- file = nil
31
- dir = Files do
32
- file = file("hello.md", "# hello")
33
- end
34
-
32
+ file = file("hello.md", "# hello")
35
33
  deck_widget :slides => Slide.split(File.read file)
36
- assert { doc.css('section.slide').size == 1 }
37
- slide = doc.css('section.slide').first
34
+ slides = doc.css('section.slide')
35
+ assert { slides.size == 1 }
36
+ slide = slides.first
38
37
  assert { slide["id"] == "hello" }
39
38
  assert { noko_html(slide) == "<section class=\"slide\" id=\"hello\">" +
40
39
  "<h1>hello</h1>\n" +
data/spec/slide_spec.rb CHANGED
@@ -284,5 +284,24 @@ foo
284
284
  assert { html == expected_html }
285
285
  end
286
286
  end
287
+
288
+ describe "==" do
289
+ it "a slide is equal to itself" do
290
+ s = slide_from("# hello")
291
+ assert { s == s }
292
+ end
293
+
294
+ it "a slide is equal to a clone of itself" do
295
+ s1 = slide_from("# hello")
296
+ s2 = slide_from("# hello")
297
+ assert { s1 == s2 }
298
+ end
299
+
300
+ it "a slide is not equal to a different slide" do
301
+ s1 = slide_from("# hello")
302
+ s2 = slide_from("# goodbye")
303
+ deny { s1 == s2 }
304
+ end
305
+ end
287
306
  end
288
307
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deckrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-18 00:00:00.000000000Z
12
+ date: 2012-01-26 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erector
16
- requirement: &70283473244720 !ruby/object:Gem::Requirement
16
+ requirement: &70245840655320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.0.pre1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70283473244720
24
+ version_requirements: *70245840655320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redcarpet
27
- requirement: &70283473244220 !ruby/object:Gem::Requirement
27
+ requirement: &70245840654820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70283473244220
35
+ version_requirements: *70245840654820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70283473243820 !ruby/object:Gem::Requirement
38
+ requirement: &70245831700820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70283473243820
46
+ version_requirements: *70245831700820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &70283473243360 !ruby/object:Gem::Requirement
49
+ requirement: &70245831700360 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70283473243360
57
+ version_requirements: *70245831700360
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: coderay
60
- requirement: &70283473242860 !ruby/object:Gem::Requirement
60
+ requirement: &70245831699940 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70283473242860
68
+ version_requirements: *70245831699940
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: &70245831699520 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *70245831699520
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: rack-codehighlighter
71
- requirement: &70283473242380 !ruby/object:Gem::Requirement
82
+ requirement: &70245831699100 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,7 +87,7 @@ dependencies:
76
87
  version: '0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *70283473242380
90
+ version_requirements: *70245831699100
80
91
  description: deck.js (http://imakewebthings.github.com/deck.js) is a JavaScript library
81
92
  for building slide presentations using HTML 5. deck.rb (http://github.com/alexch/deck.rb)
82
93
  builds on top of deck.js, adding some features and letting you focus on your slides,
@@ -95,6 +106,74 @@ files:
95
106
  - lib/deck/slide_deck.rb
96
107
  - lib/deck/version.rb
97
108
  - lib/deck.rb
109
+ - public/coderay.css
110
+ - public/deck.js/core/deck.core.css
111
+ - public/deck.js/core/deck.core.html
112
+ - public/deck.js/core/deck.core.js
113
+ - public/deck.js/core/deck.core.scss
114
+ - public/deck.js/extensions/goto/deck.goto.css
115
+ - public/deck.js/extensions/goto/deck.goto.html
116
+ - public/deck.js/extensions/goto/deck.goto.js
117
+ - public/deck.js/extensions/goto/deck.goto.scss
118
+ - public/deck.js/extensions/hash/deck.hash.css
119
+ - public/deck.js/extensions/hash/deck.hash.html
120
+ - public/deck.js/extensions/hash/deck.hash.js
121
+ - public/deck.js/extensions/hash/deck.hash.scss
122
+ - public/deck.js/extensions/menu/deck.menu.css
123
+ - public/deck.js/extensions/menu/deck.menu.js
124
+ - public/deck.js/extensions/menu/deck.menu.scss
125
+ - public/deck.js/extensions/navigation/deck.navigation.css
126
+ - public/deck.js/extensions/navigation/deck.navigation.html
127
+ - public/deck.js/extensions/navigation/deck.navigation.js
128
+ - public/deck.js/extensions/navigation/deck.navigation.scss
129
+ - public/deck.js/extensions/scale/deck.scale.css
130
+ - public/deck.js/extensions/scale/deck.scale.js
131
+ - public/deck.js/extensions/scale/deck.scale.scss
132
+ - public/deck.js/extensions/status/deck.status.css
133
+ - public/deck.js/extensions/status/deck.status.html
134
+ - public/deck.js/extensions/status/deck.status.js
135
+ - public/deck.js/extensions/status/deck.status.scss
136
+ - public/deck.js/extensions/theme-picker/deck.theme-picker.css
137
+ - public/deck.js/extensions/theme-picker/deck.theme-picker.js
138
+ - public/deck.js/GPL-license.txt
139
+ - public/deck.js/introduction/index.html
140
+ - public/deck.js/introduction/index.rb
141
+ - public/deck.js/jquery-1.7.min.js
142
+ - public/deck.js/MIT-license.txt
143
+ - public/deck.js/modernizr.custom.js
144
+ - public/deck.js/README.md
145
+ - public/deck.js/test/fixtures/complex.html
146
+ - public/deck.js/test/fixtures/empty.html
147
+ - public/deck.js/test/fixtures/iframe_simple.html
148
+ - public/deck.js/test/fixtures/iframes.html
149
+ - public/deck.js/test/fixtures/nesteds.html
150
+ - public/deck.js/test/fixtures/standard.html
151
+ - public/deck.js/test/index.html
152
+ - public/deck.js/test/lib/jasmine-html.js
153
+ - public/deck.js/test/lib/jasmine-jquery.js
154
+ - public/deck.js/test/lib/jasmine.css
155
+ - public/deck.js/test/lib/jasmine.js
156
+ - public/deck.js/test/settings.js
157
+ - public/deck.js/test/spec.core.js
158
+ - public/deck.js/test/spec.goto.js
159
+ - public/deck.js/test/spec.hash.js
160
+ - public/deck.js/test/spec.menu.js
161
+ - public/deck.js/test/spec.navigation.js
162
+ - public/deck.js/test/spec.scale.js
163
+ - public/deck.js/test/spec.status.js
164
+ - public/deck.js/themes/style/neon.css
165
+ - public/deck.js/themes/style/neon.scss
166
+ - public/deck.js/themes/style/swiss.css
167
+ - public/deck.js/themes/style/swiss.scss
168
+ - public/deck.js/themes/style/web-2.0.css
169
+ - public/deck.js/themes/style/web-2.0.scss
170
+ - public/deck.js/themes/transition/fade.css
171
+ - public/deck.js/themes/transition/fade.scss
172
+ - public/deck.js/themes/transition/horizontal-slide.css
173
+ - public/deck.js/themes/transition/horizontal-slide.scss
174
+ - public/deck.js/themes/transition/vertical-slide.css
175
+ - public/deck.js/themes/transition/vertical-slide.scss
176
+ - public/favicon.ico
98
177
  - README.md
99
178
  - spec/javascripts/support/jasmine_config.rb
100
179
  - spec/javascripts/support/jasmine_runner.rb
@@ -117,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
196
  version: '0'
118
197
  segments:
119
198
  - 0
120
- hash: -1729834170497065106
199
+ hash: -3033484796585204259
121
200
  required_rubygems_version: !ruby/object:Gem::Requirement
122
201
  none: false
123
202
  requirements:
@@ -126,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
205
  version: '0'
127
206
  segments:
128
207
  - 0
129
- hash: -1729834170497065106
208
+ hash: -3033484796585204259
130
209
  requirements: []
131
210
  rubyforge_project:
132
211
  rubygems_version: 1.8.6