deckrb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +55 -20
- data/bin/deck +5 -10
- data/lib/deck.rb +1 -1
- data/lib/deck/noko.rb +15 -0
- data/lib/deck/rack_app.rb +61 -0
- data/lib/deck/slide.rb +50 -28
- data/lib/deck/{deck.rb → slide_deck.rb} +42 -41
- data/lib/deck/version.rb +1 -1
- data/spec/rack_app_spec.rb +177 -0
- data/spec/slide_deck_spec.rb +46 -0
- data/spec/slide_spec.rb +24 -21
- data/spec/spec_helper.rb +5 -0
- metadata +51 -81
- data/deck/GPL-license.txt +0 -278
- data/deck/MIT-license.txt +0 -21
- data/deck/README.md +0 -57
- data/deck/core/deck.core.css +0 -404
- data/deck/core/deck.core.html +0 -39
- data/deck/core/deck.core.js +0 -498
- data/deck/core/deck.core.scss +0 -447
- data/deck/extensions/goto/deck.goto.css +0 -41
- data/deck/extensions/goto/deck.goto.html +0 -7
- data/deck/extensions/goto/deck.goto.js +0 -134
- data/deck/extensions/goto/deck.goto.scss +0 -46
- data/deck/extensions/hash/deck.hash.css +0 -13
- data/deck/extensions/hash/deck.hash.html +0 -2
- data/deck/extensions/hash/deck.hash.js +0 -129
- data/deck/extensions/hash/deck.hash.scss +0 -15
- data/deck/extensions/menu/deck.menu.css +0 -47
- data/deck/extensions/menu/deck.menu.js +0 -187
- data/deck/extensions/menu/deck.menu.scss +0 -58
- data/deck/extensions/navigation/deck.navigation.css +0 -43
- data/deck/extensions/navigation/deck.navigation.html +0 -3
- data/deck/extensions/navigation/deck.navigation.js +0 -91
- data/deck/extensions/navigation/deck.navigation.scss +0 -56
- data/deck/extensions/scale/deck.scale.css +0 -16
- data/deck/extensions/scale/deck.scale.js +0 -155
- data/deck/extensions/scale/deck.scale.scss +0 -17
- data/deck/extensions/status/deck.status.css +0 -18
- data/deck/extensions/status/deck.status.html +0 -6
- data/deck/extensions/status/deck.status.js +0 -95
- data/deck/extensions/status/deck.status.scss +0 -22
- data/deck/extensions/theme-picker/deck.theme-picker.css +0 -55
- data/deck/extensions/theme-picker/deck.theme-picker.js +0 -13
- data/deck/introduction/index.html +0 -221
- data/deck/introduction/index.rb +0 -101
- data/deck/jquery-1.7.min.js +0 -4
- data/deck/modernizr.custom.js +0 -4
- data/deck/test/fixtures/complex.html +0 -24
- data/deck/test/fixtures/empty.html +0 -19
- data/deck/test/fixtures/iframe_simple.html +0 -10
- data/deck/test/fixtures/iframes.html +0 -32
- data/deck/test/fixtures/nesteds.html +0 -36
- data/deck/test/fixtures/standard.html +0 -42
- data/deck/test/index.html +0 -39
- data/deck/test/lib/jasmine-html.js +0 -190
- data/deck/test/lib/jasmine-jquery.js +0 -288
- data/deck/test/lib/jasmine.css +0 -166
- data/deck/test/lib/jasmine.js +0 -2477
- data/deck/test/settings.js +0 -3
- data/deck/test/spec.core.js +0 -434
- data/deck/test/spec.goto.js +0 -119
- data/deck/test/spec.hash.js +0 -81
- data/deck/test/spec.menu.js +0 -66
- data/deck/test/spec.navigation.js +0 -51
- data/deck/test/spec.scale.js +0 -57
- data/deck/test/spec.status.js +0 -58
- data/deck/themes/style/neon.css +0 -114
- data/deck/themes/style/neon.scss +0 -139
- data/deck/themes/style/swiss.css +0 -75
- data/deck/themes/style/swiss.scss +0 -91
- data/deck/themes/style/web-2.0.css +0 -205
- data/deck/themes/style/web-2.0.scss +0 -236
- data/deck/themes/transition/fade.css +0 -44
- data/deck/themes/transition/fade.scss +0 -70
- data/deck/themes/transition/horizontal-slide.css +0 -79
- data/deck/themes/transition/horizontal-slide.scss +0 -94
- data/deck/themes/transition/vertical-slide.css +0 -97
- data/deck/themes/transition/vertical-slide.scss +0 -116
- data/lib/deck/app.rb +0 -16
- data/spec/deck_spec.rb +0 -98
data/lib/deck/app.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Deck
|
2
|
-
class App
|
3
|
-
def initialize root, files
|
4
|
-
@root, @files = root, files
|
5
|
-
end
|
6
|
-
|
7
|
-
def call env
|
8
|
-
slides = []
|
9
|
-
@files.each do |file|
|
10
|
-
slides += Slide.from_file "#{@root}/#{file}"
|
11
|
-
end
|
12
|
-
deck = Deck.new :slides => slides
|
13
|
-
[200, {}, deck.to_pretty]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/spec/deck_spec.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
here = File.expand_path File.dirname(__FILE__)
|
2
|
-
require "#{here}/spec_helper"
|
3
|
-
|
4
|
-
require "deck/deck"
|
5
|
-
|
6
|
-
module Deck
|
7
|
-
describe Deck do
|
8
|
-
def temp_dir options = {:remove => true}
|
9
|
-
@temp_dir ||= begin
|
10
|
-
require 'tmpdir'
|
11
|
-
require 'fileutils'
|
12
|
-
called_from = File.basename caller.first.split(':').first, ".rb"
|
13
|
-
path = File.join(Dir::tmpdir, "#{called_from}_#{Time.now.to_i}_#{rand(1000)}")
|
14
|
-
Dir.mkdir(path)
|
15
|
-
at_exit {FileUtils.rm_rf(path) if File.exists?(path)} if options[:remove]
|
16
|
-
path
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_html nokogiri_node
|
21
|
-
nokogiri_node.serialize(:save_with => 0).chomp
|
22
|
-
end
|
23
|
-
|
24
|
-
def as_html_page snippet
|
25
|
-
snippet =~ /<html/ ? snippet : "<html>#{snippet}</html>"
|
26
|
-
end
|
27
|
-
|
28
|
-
def deck_widget options = {}
|
29
|
-
@deck_widget ||= Deck.new options
|
30
|
-
end
|
31
|
-
|
32
|
-
def doc
|
33
|
-
@doc ||= begin
|
34
|
-
@html = deck_widget.to_html
|
35
|
-
Nokogiri.parse(as_html_page(@html))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def write name, contents = "contents of #{name}"
|
40
|
-
path = "#{temp_dir}/#{name}"
|
41
|
-
File.open(path, "w") do |f|
|
42
|
-
f.write contents
|
43
|
-
end
|
44
|
-
File.new path
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "#write" do
|
48
|
-
before do
|
49
|
-
@hello = write "hello.txt"
|
50
|
-
@goodbye = write "goodbye.txt", "farewell"
|
51
|
-
end
|
52
|
-
|
53
|
-
it "uses temp_dir" do
|
54
|
-
File.dirname(@hello).should == temp_dir
|
55
|
-
File.dirname(@goodbye).should == temp_dir
|
56
|
-
end
|
57
|
-
|
58
|
-
it "writes a default value" do
|
59
|
-
File.read(@hello).should == "contents of hello.txt"
|
60
|
-
end
|
61
|
-
|
62
|
-
it "writes a given value" do
|
63
|
-
# since write returns a File instance, we can call read on it
|
64
|
-
@goodbye.read.should == "farewell"
|
65
|
-
end
|
66
|
-
|
67
|
-
it "writes a file" do
|
68
|
-
file = write("hello.md", "# hello")
|
69
|
-
assert { File.read(file) == "# hello" }
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
it "renders a basic deck.js HTML page" do
|
76
|
-
assert { doc }
|
77
|
-
assert { @html.include? '<link href="deck/core/deck.core.css" rel="stylesheet" />' }
|
78
|
-
end
|
79
|
-
|
80
|
-
it "contains a single dummy slide" do
|
81
|
-
assert { doc.css('section.slide').size == 1 }
|
82
|
-
end
|
83
|
-
|
84
|
-
it "renders a markdown file with one slide" do
|
85
|
-
file = write("hello.md", "# hello")
|
86
|
-
|
87
|
-
deck_widget :slides => Slide.split(File.read file)
|
88
|
-
assert { doc.css('section.slide').size == 1 }
|
89
|
-
slide = doc.css('section.slide').first
|
90
|
-
assert { slide["id"] == "hello" }
|
91
|
-
assert { to_html(slide) == "<section class=\"slide\" id=\"hello\">" +
|
92
|
-
"<h1>hello</h1>\n" +
|
93
|
-
"</section>"
|
94
|
-
}
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
end
|