prez 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/prez +3 -1
- data/lib/prez/assets.rb +10 -3
- data/lib/prez/build.rb +7 -18
- data/lib/prez/builder.rb +19 -0
- data/lib/prez/cli.rb +4 -11
- data/lib/prez/error.rb +16 -0
- data/lib/prez/files.rb +30 -10
- data/lib/prez/helpers.rb +37 -0
- data/lib/prez/new.rb +36 -0
- data/lib/prez/sass_extensions.rb +40 -0
- data/lib/prez/start.rb +69 -0
- data/lib/prez/version.rb +1 -1
- data/templates/build.html.tt +87 -0
- data/templates/new.prez.tt +11 -2
- data/vendor/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/vendor/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/vendor/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/vendor/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/vendor/javascripts/bootstrap.js +2306 -0
- data/vendor/javascripts/prez-controller.js.coffee +131 -0
- data/vendor/stylesheets/_bootstrap.scss +50 -0
- data/vendor/stylesheets/bootstrap/_alerts.scss +73 -0
- data/vendor/stylesheets/bootstrap/_badges.scss +67 -0
- data/vendor/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/vendor/stylesheets/bootstrap/_button-groups.scss +243 -0
- data/vendor/stylesheets/bootstrap/_buttons.scss +160 -0
- data/vendor/stylesheets/bootstrap/_carousel.scss +269 -0
- data/vendor/stylesheets/bootstrap/_close.scss +36 -0
- data/vendor/stylesheets/bootstrap/_code.scss +69 -0
- data/vendor/stylesheets/bootstrap/_component-animations.scss +38 -0
- data/vendor/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/vendor/stylesheets/bootstrap/_forms.scss +570 -0
- data/vendor/stylesheets/bootstrap/_glyphicons.scss +301 -0
- data/vendor/stylesheets/bootstrap/_grid.scss +84 -0
- data/vendor/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/vendor/stylesheets/bootstrap/_jumbotron.scss +50 -0
- data/vendor/stylesheets/bootstrap/_labels.scss +66 -0
- data/vendor/stylesheets/bootstrap/_list-group.scss +124 -0
- data/vendor/stylesheets/bootstrap/_media.scss +61 -0
- data/vendor/stylesheets/bootstrap/_mixins.scss +39 -0
- data/vendor/stylesheets/bootstrap/_modals.scss +148 -0
- data/vendor/stylesheets/bootstrap/_navbar.scss +663 -0
- data/vendor/stylesheets/bootstrap/_navs.scss +244 -0
- data/vendor/stylesheets/bootstrap/_normalize.scss +427 -0
- data/vendor/stylesheets/bootstrap/_pager.scss +54 -0
- data/vendor/stylesheets/bootstrap/_pagination.scss +88 -0
- data/vendor/stylesheets/bootstrap/_panels.scss +265 -0
- data/vendor/stylesheets/bootstrap/_popovers.scss +135 -0
- data/vendor/stylesheets/bootstrap/_print.scss +107 -0
- data/vendor/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/vendor/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/vendor/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
- data/vendor/stylesheets/bootstrap/_scaffolding.scss +150 -0
- data/vendor/stylesheets/bootstrap/_tables.scss +234 -0
- data/vendor/stylesheets/bootstrap/_theme.scss +273 -0
- data/vendor/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/vendor/stylesheets/bootstrap/_tooltip.scss +103 -0
- data/vendor/stylesheets/bootstrap/_type.scss +298 -0
- data/vendor/stylesheets/bootstrap/_utilities.scss +56 -0
- data/vendor/stylesheets/bootstrap/_variables.scss +862 -0
- data/vendor/stylesheets/bootstrap/_wells.scss +29 -0
- data/vendor/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/vendor/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/vendor/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/vendor/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
- data/vendor/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/vendor/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/vendor/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/vendor/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/vendor/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/vendor/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/vendor/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/vendor/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/vendor/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/vendor/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/vendor/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/vendor/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/vendor/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/vendor/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/vendor/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/vendor/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/vendor/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/vendor/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/vendor/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/vendor/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/vendor/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/vendor/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/vendor/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/vendor/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/vendor/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/vendor/stylesheets/bootstrap.scss +2 -0
- data/vendor/stylesheets/prez/_variables.scss +3 -0
- data/vendor/stylesheets/prez-controller.scss +37 -0
- data/vendor/stylesheets/{prez.css → prez.scss} +12 -5
- metadata +118 -4
- data/vendor/javascripts/prez.js +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9566ac0764fadc9bfd46520d7a5ab5accd03095
|
4
|
+
data.tar.gz: 2107dba528cc10fcf9caf3c74192f2c8308f2f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27ea96591daee1b5a597453f3c17ee810bb266821244b7a62c156eb9d20c8f6e3f449535189a4772fa1a6c1f149d8dec5bbb30ac1a95f91956cb94af6d921bbc
|
7
|
+
data.tar.gz: cb71ef8a94917acbd27b72418e6b9486b1f981f3d9b6e420581c00afb0bc9a2974252a39166392cbe6a979e9ee75a72745950db2cbb4e1a1b7f0298764cfd32e
|
data/bin/prez
CHANGED
data/lib/prez/assets.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
+
require "coffee-script"
|
1
2
|
require "prez/files"
|
3
|
+
require "prez/sass_extensions"
|
2
4
|
require "sass"
|
3
5
|
require "uglifier"
|
4
6
|
|
5
7
|
module Prez
|
6
8
|
module Assets
|
7
9
|
class Tagged
|
8
|
-
attr_reader :name, :contents
|
10
|
+
attr_reader :name, :contents, :file
|
9
11
|
|
10
12
|
def initialize(name, options = {})
|
11
13
|
@name = name
|
12
14
|
@contents = Prez::Files.contents name, extension
|
15
|
+
@file = Prez::Files.find name, extension
|
13
16
|
@dev = options.fetch :dev, false
|
14
17
|
end
|
15
18
|
|
@@ -29,7 +32,7 @@ module Prez
|
|
29
32
|
if dev?
|
30
33
|
"#{open}\n#{contents}#{close}"
|
31
34
|
else
|
32
|
-
"#{open}#{minified_contents}#{close}"
|
35
|
+
"#{open}#{minified_contents.strip}#{close}"
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
@@ -48,6 +51,7 @@ module Prez
|
|
48
51
|
end
|
49
52
|
|
50
53
|
def minify(contents)
|
54
|
+
contents = CoffeeScript.compile contents if file =~ /\.coffee$/
|
51
55
|
Uglifier.compile contents
|
52
56
|
end
|
53
57
|
end
|
@@ -66,7 +70,10 @@ module Prez
|
|
66
70
|
end
|
67
71
|
|
68
72
|
def minify(contents)
|
69
|
-
Sass::Engine.new(contents,
|
73
|
+
Sass::Engine.new(contents,
|
74
|
+
syntax: :scss,
|
75
|
+
style: :compressed,
|
76
|
+
load_paths: [File.expand_path("..", file)]).render
|
70
77
|
end
|
71
78
|
end
|
72
79
|
|
data/lib/prez/build.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
require "prez/
|
1
|
+
require "prez/builder"
|
2
|
+
require "prez/error"
|
2
3
|
require "thor/actions"
|
3
|
-
require "thor/error"
|
4
4
|
require "thor/group"
|
5
5
|
|
6
6
|
module Prez
|
7
7
|
class Build < Thor::Group
|
8
8
|
include Thor::Actions
|
9
|
+
include Prez::Builder
|
9
10
|
argument :name, type: :string
|
10
11
|
|
11
12
|
def check_file!
|
@@ -14,16 +15,16 @@ module Prez
|
|
14
15
|
elsif File.exists? "#{name}.prez"
|
15
16
|
@filename = "#{name}.prez"
|
16
17
|
else
|
17
|
-
raise
|
18
|
+
raise Prez::Error.new("Missing prez file '#{name}'")
|
18
19
|
end
|
19
20
|
|
20
21
|
if filename =~ /\.html$/
|
21
|
-
raise
|
22
|
+
raise Prez::Error.new("Prez file cannot be an html file: '#{name}'")
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
def generate_html
|
26
|
-
|
27
|
+
create_file html_filename, build_html(filename)
|
27
28
|
end
|
28
29
|
|
29
30
|
private
|
@@ -40,21 +41,9 @@ module Prez
|
|
40
41
|
"#{base_name}.html"
|
41
42
|
end
|
42
43
|
|
43
|
-
def javascript(name)
|
44
|
-
Prez::Assets.javascript name
|
45
|
-
rescue Prez::Files::MissingError
|
46
|
-
raise Thor::Error.new(set_color("Could not find file: '#{name}.js'", :red, :bold))
|
47
|
-
end
|
48
|
-
|
49
|
-
def stylesheet(name)
|
50
|
-
Prez::Assets.stylesheet name
|
51
|
-
rescue Prez::Files::MissingError
|
52
|
-
raise Thor::Error.new(set_color("Could not find file: '#{name}.css'", :red, :bold))
|
53
|
-
end
|
54
|
-
|
55
44
|
class << self
|
56
45
|
def source_root
|
57
|
-
File.
|
46
|
+
File.absolute_path File.expand_path("../../../templates", __FILE__)
|
58
47
|
end
|
59
48
|
end
|
60
49
|
end
|
data/lib/prez/builder.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "erb"
|
2
|
+
require "prez/helpers"
|
3
|
+
|
4
|
+
module Prez
|
5
|
+
module Builder
|
6
|
+
include Prez::Helpers
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def build_html(filename)
|
11
|
+
@_slide_contents = erb_eval filename
|
12
|
+
erb_eval File.expand_path("../../../templates/build.html.tt", __FILE__)
|
13
|
+
end
|
14
|
+
|
15
|
+
def erb_eval(template)
|
16
|
+
ERB.new(File.read(template), nil, "-", "@output_buffer").result(binding)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/prez/cli.rb
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
require "prez/build"
|
2
|
+
require "prez/new"
|
3
|
+
require "prez/start"
|
2
4
|
require "prez/version"
|
3
5
|
require "thor"
|
4
|
-
require "thor/actions"
|
5
6
|
|
6
7
|
module Prez
|
7
8
|
class CLI < Thor
|
8
|
-
include Thor::Actions
|
9
9
|
register Prez::Build, "build", "build NAME", "Builds the single html presentation from the prez file"
|
10
|
+
register Prez::New, "new", "new NAME", "Generates a new presentation"
|
11
|
+
register Prez::Start, "start", "start NAME", "Launches your browser with the given presentation"
|
10
12
|
|
11
13
|
map "-v" => "version"
|
12
14
|
|
13
|
-
desc "new NAME", "Generates a new presentation"
|
14
|
-
def new(name)
|
15
|
-
template "new.prez.tt", "#{name}.prez"
|
16
|
-
end
|
17
|
-
|
18
15
|
desc "version", "Show the prez version"
|
19
16
|
long_desc "
|
20
17
|
This can be optionally used as 'prez -v'"
|
@@ -26,10 +23,6 @@ module Prez
|
|
26
23
|
def exit_on_failure?
|
27
24
|
true
|
28
25
|
end
|
29
|
-
|
30
|
-
def source_root
|
31
|
-
File.absolute_path File.expand_path("../../../templates", __FILE__)
|
32
|
-
end
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|
data/lib/prez/error.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "thor/error"
|
2
|
+
require "thor/shell/color"
|
3
|
+
|
4
|
+
module Prez
|
5
|
+
class Error < Thor::Error
|
6
|
+
def initialize(msg)
|
7
|
+
super colorize(msg)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def colorize(msg)
|
13
|
+
Thor::Shell::Color.new.set_color msg, :red, :bold
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/prez/files.rb
CHANGED
@@ -7,10 +7,12 @@ module Prez
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class Paths
|
10
|
-
attr_reader :
|
10
|
+
attr_reader :extension_alias, :extensions, :paths
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
@
|
12
|
+
def initialize(extension_alias, extensions, dirname, options = {})
|
13
|
+
@extension_alias = extension_alias
|
14
|
+
@extensions = extensions
|
15
|
+
@binary = options.fetch :binary, false
|
14
16
|
|
15
17
|
@paths = [].tap do |paths|
|
16
18
|
paths << File.expand_path(".")
|
@@ -21,26 +23,44 @@ module Prez
|
|
21
23
|
|
22
24
|
def find(name)
|
23
25
|
paths.each do |path|
|
24
|
-
|
26
|
+
extensions.each do |extension|
|
27
|
+
files = [File.join(path, "#{name}.#{extension}")]
|
25
28
|
|
26
|
-
|
27
|
-
|
29
|
+
if name.end_with?(".#{extension}")
|
30
|
+
files << File.join(path, name)
|
31
|
+
end
|
32
|
+
|
33
|
+
files.each do |file|
|
34
|
+
if File.exists?(file)
|
35
|
+
return file
|
36
|
+
end
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
31
|
-
raise Prez::Files::MissingError.new(name,
|
41
|
+
raise Prez::Files::MissingError.new(name, extension_alias)
|
42
|
+
end
|
43
|
+
|
44
|
+
def binary?
|
45
|
+
@binary
|
32
46
|
end
|
33
47
|
end
|
34
48
|
|
35
49
|
class << self
|
36
50
|
SEARCH_PATHS = {
|
37
|
-
"js" => Prez::Files::Paths.new("js", "javascripts"),
|
38
|
-
"css" => Prez::Files::Paths.new("css", "stylesheets")
|
51
|
+
"js" => Prez::Files::Paths.new("js", ["js.coffee", "coffee", "js"], "javascripts"),
|
52
|
+
"css" => Prez::Files::Paths.new("css", ["css.scss", "scss", "css"], "stylesheets"),
|
53
|
+
"font" => Prez::Files::Paths.new("font", ["eot", "svg", "ttf", "woff", "woff2"], "fonts", binary: true)
|
39
54
|
}
|
40
55
|
|
41
56
|
def contents(name, extension)
|
42
57
|
file = find name, extension
|
43
|
-
|
58
|
+
|
59
|
+
if SEARCH_PATHS[extension].binary?
|
60
|
+
File.read file, mode: "rb"
|
61
|
+
else
|
62
|
+
File.read file
|
63
|
+
end
|
44
64
|
end
|
45
65
|
|
46
66
|
def find(name, extension)
|
data/lib/prez/helpers.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "cgi"
|
2
|
+
require "prez/assets"
|
3
|
+
require "prez/error"
|
4
|
+
|
5
|
+
module Prez
|
6
|
+
module Helpers
|
7
|
+
protected
|
8
|
+
|
9
|
+
def html_escape(value)
|
10
|
+
CGI.escape_html value
|
11
|
+
end
|
12
|
+
|
13
|
+
def slide
|
14
|
+
concat %{<div class="prez-slide">}
|
15
|
+
yield
|
16
|
+
concat %{</div>}
|
17
|
+
end
|
18
|
+
|
19
|
+
def notes
|
20
|
+
concat %{<div class="prez-notes">}
|
21
|
+
yield
|
22
|
+
concat %{</div>}
|
23
|
+
end
|
24
|
+
|
25
|
+
def javascript(name)
|
26
|
+
Prez::Assets.javascript name
|
27
|
+
rescue Prez::Files::MissingError
|
28
|
+
raise Prez::Error.new("Could not find file: '#{name}.js'")
|
29
|
+
end
|
30
|
+
|
31
|
+
def stylesheet(name)
|
32
|
+
Prez::Assets.stylesheet name
|
33
|
+
rescue Prez::Files::MissingError
|
34
|
+
raise Prez::Error.new("Could not find file: '#{name}.css'")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/prez/new.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "prez/error"
|
2
|
+
require "thor/actions"
|
3
|
+
require "thor/group"
|
4
|
+
|
5
|
+
module Prez
|
6
|
+
class New < Thor::Group
|
7
|
+
include Thor::Actions
|
8
|
+
argument :name, type: :string
|
9
|
+
|
10
|
+
def check_file!
|
11
|
+
if File.exists? filename
|
12
|
+
raise Prez::Error.new("There is already a presentation file named '#{filename}'")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate_prez
|
17
|
+
template "new.prez.tt", "#{name}.prez"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def filename
|
23
|
+
if name =~ /\.prez$/
|
24
|
+
name
|
25
|
+
else
|
26
|
+
"#{name}.prez"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def source_root
|
32
|
+
File.absolute_path File.expand_path("../../../templates", __FILE__)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "base64"
|
2
|
+
require "prez/error"
|
3
|
+
require "prez/files"
|
4
|
+
require "sass"
|
5
|
+
|
6
|
+
module Sass::Script::Functions
|
7
|
+
def twbs_font_path(path)
|
8
|
+
assert_type path, :String
|
9
|
+
path = path.value.sub /[?#].*/, ""
|
10
|
+
font_data = Base64.encode64 Prez::Files.contents(path, "font")
|
11
|
+
font_data.gsub! "\n", ""
|
12
|
+
extension = path[/\.([^.]*)$/, 1]
|
13
|
+
|
14
|
+
case extension
|
15
|
+
when "eot"
|
16
|
+
font_type = "application/vnd.ms-fontobject"
|
17
|
+
when "svg"
|
18
|
+
font_type = "image/svg+xml"
|
19
|
+
when "ttf"
|
20
|
+
font_type = "font/ttf"
|
21
|
+
when "woff"
|
22
|
+
font_type = "application/font-woff"
|
23
|
+
when "woff2"
|
24
|
+
font_type = "application/font-woff2"
|
25
|
+
else
|
26
|
+
raise Prez::Error.new("Unknown font extension '#{extension}'")
|
27
|
+
end
|
28
|
+
|
29
|
+
Sass::Script::Value::String.new("data:#{font_type};base64,#{font_data}")
|
30
|
+
rescue Prez::Files::MissingError => e
|
31
|
+
raise Prez::Error.new("Could not find font: '#{path}'")
|
32
|
+
end
|
33
|
+
|
34
|
+
def twbs_image_path(path)
|
35
|
+
Sass::Script::Value::String.new("ARGLE BARGLE IMAGE #{path.inspect}")
|
36
|
+
end
|
37
|
+
|
38
|
+
declare :twbs_font_path, [:path]
|
39
|
+
declare :twbs_image_path, [:path]
|
40
|
+
end
|
data/lib/prez/start.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require "launchy"
|
2
|
+
require "prez/builder"
|
3
|
+
require "prez/error"
|
4
|
+
require "thor/actions"
|
5
|
+
require "thor/group"
|
6
|
+
require "webrick"
|
7
|
+
|
8
|
+
module Prez
|
9
|
+
class Start < Thor::Group
|
10
|
+
include Thor::Actions
|
11
|
+
include Prez::Builder
|
12
|
+
argument :name, type: :string
|
13
|
+
|
14
|
+
def check_file!
|
15
|
+
if File.exists? name
|
16
|
+
@filename = name
|
17
|
+
elsif File.exists? "#{name}.prez"
|
18
|
+
@filename = "#{name}.prez"
|
19
|
+
else
|
20
|
+
raise Prez::Error.new("Missing prez file '#{name}'")
|
21
|
+
end
|
22
|
+
|
23
|
+
if filename =~ /\.html$/
|
24
|
+
raise Prez::Error.new("Prez file cannot be an html file: '#{name}'")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def generate_html
|
29
|
+
say "Generating html..."
|
30
|
+
@html = build_html filename
|
31
|
+
end
|
32
|
+
|
33
|
+
def start_server
|
34
|
+
say "Starting server..."
|
35
|
+
server = WEBrick::HTTPServer.new Port: 0, Logger: Prez::Start::NoopLog.new, AccessLog: []
|
36
|
+
port = server.config[:Port]
|
37
|
+
|
38
|
+
server.mount_proc "/" do |request, response|
|
39
|
+
response.body = @html
|
40
|
+
server.stop
|
41
|
+
end
|
42
|
+
|
43
|
+
begin
|
44
|
+
Launchy.open "http://localhost:#{port}/"
|
45
|
+
server.start
|
46
|
+
ensure
|
47
|
+
server.shutdown
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def filename
|
54
|
+
@filename
|
55
|
+
end
|
56
|
+
|
57
|
+
class << self
|
58
|
+
def source_root
|
59
|
+
File.absolute_path File.expand_path("../../../templates", __FILE__)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class NoopLog < WEBrick::BasicLog
|
64
|
+
def initialize
|
65
|
+
@level = INFO
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/prez/version.rb
CHANGED
@@ -0,0 +1,87 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<%= stylesheet "bootstrap" %>
|
8
|
+
<%= stylesheet "prez-controller" %>
|
9
|
+
<%= javascript "jquery" %>
|
10
|
+
<%= javascript "prez-controller" %>
|
11
|
+
<%= javascript "bootstrap" %>
|
12
|
+
</head>
|
13
|
+
|
14
|
+
<body>
|
15
|
+
<div id="container" class="container-fluid">
|
16
|
+
<div id="pre-launch">
|
17
|
+
<div id="filler"></div>
|
18
|
+
|
19
|
+
<div class="row">
|
20
|
+
<div class="col-xs-6 col-md-offset-2 col-md-4 col-lg-offset-3 col-lg-3">
|
21
|
+
<button id="new-window" type="button" class="btn btn-default btn-block btn-lg active" data-toggle="button">
|
22
|
+
<span class="glyphicon glyphicon-new-window"></span>
|
23
|
+
<span id="launch-message">Launch in new window</span>
|
24
|
+
</button>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="col-xs-6 col-md-4 col-lg-3">
|
28
|
+
<button id="launch" class="btn btn-primary btn-block btn-lg">Start Presentation</button>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div id="slides-document" style="display: none;"><%= html_escape @_slide_contents %></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="post-launch">
|
36
|
+
<div class="row">
|
37
|
+
<div class="col-xs-2">
|
38
|
+
<button class="prev-slide btn btn-primary btn-block btn-lg"><span class="glyphicon glyphicon-chevron-left"></span></button>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="col-xs-offset-3 col-xs-2">
|
42
|
+
<button class="end-prez btn btn-danger btn-block btn-lg"><span class="glyphicon glyphicon-remove"></span></button>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div class="col-xs-offset-3 col-xs-2">
|
46
|
+
<button class="next-slide btn btn-primary btn-block btn-lg"><span class="glyphicon glyphicon-chevron-right"></span></button>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<p class="lead text-center">
|
51
|
+
<strong>Current slide: <span class="current-slide-number"></span></strong>
|
52
|
+
</p>
|
53
|
+
|
54
|
+
<iframe id="preview-frame"></iframe>
|
55
|
+
<div id="preview-frame-padding"></div>
|
56
|
+
|
57
|
+
<div class="row">
|
58
|
+
<div class="col-xs-offset-2 col-xs-8">
|
59
|
+
<div id="slide-notes" class="lead">
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<div id="in-window-not-implemented-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="not-implemented" aria-hidden="true">
|
66
|
+
<div class="modal-dialog">
|
67
|
+
<div class="modal-content">
|
68
|
+
<div class="modal-header">
|
69
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
70
|
+
<h4 class="modal-title" id="not-implemented">Not Implemented</h4>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div class="modal-body">
|
74
|
+
<p>
|
75
|
+
Sorry, same window presentations are not yet implemented!
|
76
|
+
</p>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="modal-footer">
|
80
|
+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
</body>
|
87
|
+
</html>
|
data/templates/new.prez.tt
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<%%= javascript "jquery" %>
|
4
|
-
<%%= javascript "prez" %>
|
5
3
|
<%%= stylesheet "prez" %>
|
6
4
|
</head>
|
7
5
|
|
8
6
|
<body>
|
7
|
+
<%% slide do %>
|
8
|
+
<p>
|
9
|
+
Put each slide inside slide blocks.
|
10
|
+
</p>
|
11
|
+
|
12
|
+
<%% notes do %>
|
13
|
+
<p>
|
14
|
+
Nest your slide notes inside the slide.
|
15
|
+
</p>
|
16
|
+
<%% end %>
|
17
|
+
<%% end %>
|
9
18
|
</body>
|
10
19
|
</html>
|
Binary file
|