prez 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8a3c4b86dda6730ee9740ea901ac7a5e3dbc6a1
4
- data.tar.gz: 739a8d0578e0a1042f0521995a86fe62d725ff5f
3
+ metadata.gz: 13415316b5dd25295ffe13e8beeb11fd298be3fd
4
+ data.tar.gz: 40e50b72d184a9dee9860bcfeb88138325dc760b
5
5
  SHA512:
6
- metadata.gz: c62e954206895f70899306942c6940083064e3bc73181e6528b93f4174382605059b76fa7e90797155120f2fea85474ecff72d802a25938af04221cf35f6cab2
7
- data.tar.gz: 45ad9018218f0584c38d878b7f55aa8e3e243022067d9573582ef66eb6233d4ab5067acf75686f392fabf577c1c6546e2c42daa968da50b308a909ff1b2e0d79
6
+ metadata.gz: 32fcb1f65a52968389fc0641a002079807cd328f278854e5b19da0b4b748119c381a37e9edc67a88873d3c9fba67f661577feee1dad88cdbcf50c1f0f3ca21cb
7
+ data.tar.gz: 26d7be1f411008d9fe81a9a55894d950202b0ddad08f182e3273063dd82d1c4f5056c57874ef6e9ad7d13fda0c8608e69525de26f91f83bd9535cc74c65702e1
data/bin/prez CHANGED
@@ -2,10 +2,10 @@
2
2
  require "rubygems"
3
3
  gem "coffee-script", "~> 2.3"
4
4
  gem "launchy", "~> 2.4"
5
- gem "prez", "= 0.0.6"
5
+ gem "prez", "= 0.1.0"
6
6
  gem "sass", "~> 3.4"
7
7
  gem "therubyracer", "~> 0.12"
8
8
  gem "thor", "~> 0.19"
9
9
  gem "uglifier", "~> 2.7"
10
- require "prez/cli"
10
+ require "prez"
11
11
  Prez::CLI.start
data/lib/prez/assets.rb CHANGED
@@ -1,8 +1,4 @@
1
1
  require "coffee-script"
2
- require "prez/cache"
3
- require "prez/data_uri"
4
- require "prez/error"
5
- require "prez/files"
6
2
  require "prez/sass_extensions"
7
3
  require "sass"
8
4
  require "uglifier"
data/lib/prez/build.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "prez/builder"
2
- require "prez/error"
3
1
  require "thor/actions"
4
2
  require "thor/group"
5
3
 
@@ -7,19 +5,19 @@ module Prez
7
5
  class Build < Thor::Group
8
6
  include Thor::Actions
9
7
  include Prez::Builder
10
- argument :name, type: :string
8
+ argument :name, type: :string, required: false, default: nil
11
9
 
12
10
  def check_file!
13
- if File.exists? name
14
- @filename = name
15
- elsif File.exists? "#{name}.prez"
16
- @filename = "#{name}.prez"
11
+ if File.exists? prez_name
12
+ @filename = prez_name
13
+ elsif File.exists? "#{prez_name}.prez"
14
+ @filename = "#{prez_name}.prez"
17
15
  else
18
- raise Prez::Error.new("Missing prez file '#{name}'")
16
+ raise Prez::Error.new("Missing prez file '#{prez_name}'")
19
17
  end
20
18
 
21
19
  if filename =~ /\.html$/
22
- raise Prez::Error.new("Prez file cannot be an html file: '#{name}'")
20
+ raise Prez::Error.new("Prez file cannot be an html file: '#{prez_name}'")
23
21
  end
24
22
  end
25
23
 
@@ -29,6 +27,22 @@ module Prez
29
27
 
30
28
  private
31
29
 
30
+ def prez_name
31
+ @prez_name = name || only_existing_prez
32
+ end
33
+
34
+ def only_existing_prez
35
+ results = Dir.glob "*.prez"
36
+
37
+ if results.empty?
38
+ raise Prez::Error.new("No .prez files found!")
39
+ elsif results.size > 1
40
+ raise Prez::Error.new("More than one .prez file found!\nPlease specify which one you want to build.")
41
+ end
42
+
43
+ results.first
44
+ end
45
+
32
46
  def base_name
33
47
  filename.sub /\.prez$/, ""
34
48
  end
data/lib/prez/builder.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "erb"
2
- require "prez/helpers"
3
2
 
4
3
  module Prez
5
4
  module Builder
data/lib/prez/cache.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "digest"
2
2
  require "fileutils"
3
- require "prez/version"
4
3
  require "yaml"
5
4
 
6
5
  module Prez
data/lib/prez/cli.rb CHANGED
@@ -1,14 +1,10 @@
1
- require "prez/build"
2
- require "prez/new"
3
- require "prez/start"
4
- require "prez/version"
5
1
  require "thor"
6
2
 
7
3
  module Prez
8
4
  class CLI < Thor
9
- register Prez::Build, "build", "build NAME", "Builds the single html presentation from the prez file"
5
+ register Prez::Build, "build", "build [NAME]", "Builds the single html presentation from the prez file"
10
6
  register Prez::New, "new", "new NAME", "Generates a new presentation"
11
- register Prez::Start, "start", "start NAME", "Launches your browser with the given presentation"
7
+ register Prez::Start, "start", "start [NAME]", "Launches your browser with the given presentation"
12
8
 
13
9
  map "-v" => "version"
14
10
 
data/lib/prez/helpers.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  require "cgi"
2
- require "prez/assets"
3
- require "prez/error"
4
2
 
5
3
  module Prez
6
4
  module Helpers
data/lib/prez/new.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "prez/error"
2
1
  require "thor/actions"
3
2
  require "thor/group"
4
3
 
@@ -1,6 +1,3 @@
1
- require "prez/data_uri"
2
- require "prez/error"
3
- require "prez/files"
4
1
  require "sass"
5
2
 
6
3
  module Sass::Script::Functions
data/lib/prez/start.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  require "launchy"
2
- require "prez/builder"
3
- require "prez/error"
4
2
  require "thor/actions"
5
3
  require "thor/group"
6
4
  require "webrick"
@@ -9,20 +7,20 @@ module Prez
9
7
  class Start < Thor::Group
10
8
  include Thor::Actions
11
9
  include Prez::Builder
12
- argument :name, type: :string
10
+ argument :name, type: :string, required: false, default: nil
13
11
  class_option :server, type: :boolean, desc: "Keep the server up for dynamic refreshes"
14
12
 
15
13
  def check_file!
16
- if File.exists? name
17
- @filename = name
18
- elsif File.exists? "#{name}.prez"
19
- @filename = "#{name}.prez"
14
+ if File.exists? prez_name
15
+ @filename = prez_name
16
+ elsif File.exists? "#{prez_name}.prez"
17
+ @filename = "#{prez_name}.prez"
20
18
  else
21
- raise Prez::Error.new("Missing prez file '#{name}'")
19
+ raise Prez::Error.new("Missing prez file '#{prez_name}'")
22
20
  end
23
21
 
24
22
  if filename =~ /\.html$/
25
- raise Prez::Error.new("Prez file cannot be an html file: '#{name}'")
23
+ raise Prez::Error.new("Prez file cannot be an html file: '#{prez_name}'")
26
24
  end
27
25
  end
28
26
 
@@ -69,6 +67,22 @@ module Prez
69
67
 
70
68
  private
71
69
 
70
+ def prez_name
71
+ @prez_name = name || only_existing_prez
72
+ end
73
+
74
+ def only_existing_prez
75
+ results = Dir.glob "*.prez"
76
+
77
+ if results.empty?
78
+ raise Prez::Error.new("No .prez files found!")
79
+ elsif results.size > 1
80
+ raise Prez::Error.new("More than one .prez file found!\nPlease specify which one you want to start.")
81
+ end
82
+
83
+ results.first
84
+ end
85
+
72
86
  def stop_server
73
87
  say "Shutting down server..."
74
88
  @server.shutdown
data/lib/prez/version.rb CHANGED
@@ -2,7 +2,7 @@ module Prez
2
2
  module Version
3
3
  class << self
4
4
  def to_s
5
- "0.0.6"
5
+ "0.1.0"
6
6
  end
7
7
  end
8
8
  end
data/lib/prez.rb CHANGED
@@ -1 +1,14 @@
1
- require "prez/version"
1
+ module Prez
2
+ autoload :Assets, "prez/assets"
3
+ autoload :Build, "prez/build"
4
+ autoload :Builder, "prez/builder"
5
+ autoload :Cache, "prez/cache"
6
+ autoload :CLI, "prez/cli"
7
+ autoload :DataUri, "prez/data_uri"
8
+ autoload :Error, "prez/error"
9
+ autoload :Files, "prez/files"
10
+ autoload :Helpers, "prez/helpers"
11
+ autoload :New, "prez/new"
12
+ autoload :Start, "prez/start"
13
+ autoload :Version, "prez/version"
14
+ end
@@ -85,27 +85,6 @@
85
85
  </div>
86
86
  </div>
87
87
  </div>
88
-
89
- <div id="in-window-not-implemented-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="not-implemented" aria-hidden="true">
90
- <div class="modal-dialog">
91
- <div class="modal-content">
92
- <div class="modal-header">
93
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
94
- <h4 class="modal-title" id="not-implemented">Not Implemented</h4>
95
- </div>
96
-
97
- <div class="modal-body">
98
- <p>
99
- Sorry, same window presentations are not yet implemented!
100
- </p>
101
- </div>
102
-
103
- <div class="modal-footer">
104
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
105
- </div>
106
- </div>
107
- </div>
108
- </div>
109
88
  </div>
110
89
  </body>
111
90
  </html>
@@ -7,6 +7,7 @@ $.fn.slideDuration = ->
7
7
  class Prez
8
8
  DEFAULT_OPTIONS =
9
9
  useHash: true
10
+ displayTime: true
10
11
  duration: 0
11
12
  slideElementStyle: "hide"
12
13
 
@@ -14,11 +15,20 @@ class Prez
14
15
  @options = $.extend {}, DEFAULT_OPTIONS, options
15
16
  @window = options.window
16
17
  @document = @window.document
17
- @document.write $("#slides-document").text()
18
+
19
+ if options.content
20
+ @document.write options.content
21
+ delete options.content
22
+ else
23
+ @document.write $("#slides-document").text()
24
+
18
25
  @document.close()
19
26
  @options.beforeStart?(@)
20
27
  @start()
21
28
 
29
+ showTime: ->
30
+ @options.displayTime
31
+
22
32
  start: ->
23
33
  changeToHashSlide = =>
24
34
  return false unless @options.useHash
@@ -205,6 +215,7 @@ class Prez
205
215
 
206
216
  timeChange: ->
207
217
  return unless Prez.current
218
+ return unless Prez.current.showTime()
208
219
  $(".prez-total-duration").text Prez.current.remainingPresentationTime()
209
220
  seconds = Prez.current.remainingPresentationSeconds()
210
221
  $(".prez-total-duration").toggleClass("prez-danger-time", seconds <= 60 && seconds >= 0)
@@ -237,40 +248,55 @@ $(document).on "click", "#new-window", (e) ->
237
248
  $(document).on "click", "#launch", (e) ->
238
249
  e.preventDefault()
239
250
  return if Prez.current
240
-
241
- unless $("#new-window").is(".active")
242
- $("#in-window-not-implemented-modal").modal "show"
243
- return
244
-
251
+ useNewWindow = $("#new-window").is(".active")
245
252
  iframe = $("iframe")[0]
246
253
 
247
- iframe = if iframe.contentWindow
248
- iframe.contentWindow
249
- else if iframe.contentDocument.document
250
- iframe.contentDocument.document
254
+ iframe.getFrameWindow = ->
255
+ if @contentWindow
256
+ @contentWindow
257
+ else if @contentDocument.document
258
+ @contentDocument.document
259
+ else
260
+ @contentDocument
261
+
262
+
263
+ if useNewWindow
264
+ iframePrez = new Prez
265
+ window: iframe.getFrameWindow()
266
+ useHash: false
267
+ slideElementStyle: "opacity"
268
+
269
+ Prez.current = new Prez
270
+ duration: Prez.timeToSeconds($("#prez-duration").val())
271
+ window: window.open("", "prez", "width=640,height=480")
272
+ slideChanged: ($slide, slideNumber, elementNumber) ->
273
+ notes = $slide.find(".prez-notes").html() || ""
274
+ $("#slide-notes").html notes
275
+ $(".current-slide-number:not(select)").text $slide.data("slide")
276
+ $("select.current-slide-number").val $slide.data("slide")
277
+ Prez.handlers.timeChange()
278
+ iframePrez.changeSlideTo slideNumber, elementNumber
279
+ beforeStart: (prez) ->
280
+ $("select.current-slide-number").empty()
281
+
282
+ for i in [1..prez.countSlides()]
283
+ $("select.current-slide-number").append """<option value="#{i}">#{i}</option>"""
251
284
  else
252
- iframe.contentDocument
253
-
254
- iframePrez = new Prez
255
- window: iframe
256
- useHash: false
257
- slideElementStyle: "opacity"
258
-
259
- Prez.current = new Prez
260
- duration: Prez.timeToSeconds($("#prez-duration").val())
261
- window: window.open("", "prez", "width=640,height=480")
262
- slideChanged: ($slide, slideNumber, elementNumber) ->
263
- notes = $slide.find(".prez-notes").html() || ""
264
- $("#slide-notes").html notes
265
- $(".current-slide-number:not(select)").text $slide.data("slide")
266
- $("select.current-slide-number").val $slide.data("slide")
267
- Prez.handlers.timeChange()
268
- iframePrez.changeSlideTo slideNumber, elementNumber
269
- beforeStart: (prez) ->
270
- $("select.current-slide-number").empty()
271
-
272
- for i in [1..prez.countSlides()]
273
- $("select.current-slide-number").append """<option value="#{i}">#{i}</option>"""
285
+ $iframe = $(iframe).detach().css
286
+ position: "absolute"
287
+ left: "0px"
288
+ top: "0px"
289
+ width: "100%"
290
+ height: "100%"
291
+ zIndex: 10000
292
+ iframeContent = $("#slides-document").text()
293
+ $("body").empty()
294
+ $iframe.prependTo("body")
295
+
296
+ Prez.current = new Prez
297
+ displayTime: false
298
+ content: iframeContent
299
+ window: iframe.getFrameWindow()
274
300
 
275
301
  $(".total-slides").text Prez.current.countSlides()
276
302
  $("#pre-launch").hide()
@@ -303,6 +329,3 @@ $(window).bind "beforeunload", ->
303
329
 
304
330
  $(document).on "keydown", Prez.handlers.keyDown
305
331
  $.setInterval 50, Prez.handlers.timeChange
306
-
307
- $ ->
308
- $("#in-window-not-implemented-modal").modal show: false
@@ -32,11 +32,19 @@ body {
32
32
  padding: $prez-padding;
33
33
  text-align: center;
34
34
 
35
- &.left-aligned {
35
+ .center-aligned {
36
+ text-align: center;
37
+ }
38
+
39
+ &.left-aligned, .left-aligned {
36
40
  text-align: left;
37
41
  }
38
42
 
39
- &.right-aligned {
43
+ .left-aligned {
44
+ padding-left: 5%;
45
+ }
46
+
47
+ &.right-aligned, .right-aligned {
40
48
  text-align: right;
41
49
  }
42
50
 
@@ -49,10 +57,37 @@ body {
49
57
  }
50
58
  }
51
59
 
52
- .smaller {
60
+ .pre {
61
+ font-family: monospace;
62
+ font-size: 0.9em;
63
+ white-space: pre;
64
+ }
65
+
66
+ .smaller, .smaller.pre {
53
67
  font-size: 0.7em;
54
68
  }
55
69
 
70
+ .biggest {
71
+ font-size: 5.0em;
72
+ }
73
+
74
+
75
+ .red-background {
76
+ background-color: #ffcccc;
77
+ }
78
+
79
+ .green-background {
80
+ background-color: #ccffcc;
81
+ }
82
+
83
+ .blue-background {
84
+ background-color: #ccccff;
85
+ }
86
+
87
+ .emphasize {
88
+ font-weight: bold;
89
+ }
90
+
56
91
  dt {
57
92
  font-weight: bold;
58
93
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Virata-Stone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubyforge_project:
251
- rubygems_version: 2.4.4
251
+ rubygems_version: 2.5.1
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: Create simple single file presentations