shining 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,8 @@
1
+ = 1.3.3 (26/05/2010)
2
+
3
+ * A bit more sensible reaction when running into a config file that's not valid JSON.
4
+ * Fixed negative top CSS property for stage on very long slides.
5
+
1
6
  = 1.3.2 (19/05/2010)
2
7
 
3
8
  * Always including config.ru.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -44,7 +44,13 @@ module FileMethods
44
44
  end
45
45
 
46
46
  def json file
47
- JSON.parse read_file(file)
47
+ begin
48
+ JSON.parse read_file(file)
49
+ rescue Errno::ENOENT
50
+ raise Shining::NoSuchFile, "File #{file} doesn't exist"
51
+ rescue
52
+ raise Shining::CantParseJSONFile, "File #{file} doesn't appear to be valid JSON"
53
+ end
48
54
  end
49
55
 
50
56
  def expand path
data/lib/shining.js CHANGED
@@ -322,7 +322,9 @@
322
322
  }
323
323
 
324
324
  function centerStage() {
325
- $('#stage').css({ top: ($(window).height() - $('#stage').outerHeight()) / 2 });
325
+ var top = ($(window).height() - $('#stage').outerHeight()) / 2;
326
+ if (top < 0) top = 0;
327
+ $('#stage').css({ top: top });
326
328
  }
327
329
 
328
330
  Shining.init();
data/lib/shining.rb CHANGED
@@ -6,6 +6,7 @@ require 'ext/filemethods'
6
6
  require 'shining/preso'
7
7
  require 'shining/player'
8
8
  require 'shining/heroku'
9
+ require 'shining/errors'
9
10
 
10
11
  module Shining
11
12
  class << self
@@ -0,0 +1,4 @@
1
+ module Shining
2
+ class CantParseJSONFile < RuntimeError; end
3
+ class NoSuchFile < RuntimeError; end
4
+ end
data/lib/shining/preso.rb CHANGED
@@ -18,15 +18,11 @@ class Preso
18
18
  copy_templates
19
19
  vendorize!
20
20
  end
21
- @config = json(@path/'config.json')
21
+ @config = json(@path/'config.json')
22
22
  end
23
23
 
24
24
  def self.open dir
25
- begin
26
- new dir, false
27
- rescue
28
- raise "#{dir} is not a Shining presentation!"
29
- end
25
+ new dir, false
30
26
  end
31
27
 
32
28
  def config refresh = false
data/shining.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shining}
8
- s.version = "1.3.2"
8
+ s.version = "1.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julio Cesar Ody"]
12
- s.date = %q{2010-05-19}
12
+ s.date = %q{2010-05-26}
13
13
  s.default_executable = %q{shine}
14
14
  s.description = %q{HTML + CSS + Javascript = awesome presos}
15
15
  s.email = %q{julio.ody@gmail.com}
@@ -44,6 +44,7 @@ Gem::Specification.new do |s|
44
44
  "lib/shCore.js",
45
45
  "lib/shining.js",
46
46
  "lib/shining.rb",
47
+ "lib/shining/errors.rb",
47
48
  "lib/shining/heroku.rb",
48
49
  "lib/shining/player.rb",
49
50
  "lib/shining/preso.rb",
@@ -24,6 +24,20 @@ describe Shining::FileMethods do
24
24
  dir?(TMP/'temp'/'adir').should be_true
25
25
  end
26
26
 
27
+ context '#json' do
28
+ it 'parses JSON' do
29
+ File.open(TMP/'foo.json', 'w') { |file| file << "[1, 2, 3]" }
30
+ json(TMP/'foo.json').should be_a Array
31
+ end
32
+ it "raises Shining::NoSuchFile if the file doesn't exist" do
33
+ lambda do json(TMP/'aaabbbbbbcccc') end.should raise_error Shining::NoSuchFile
34
+ end
35
+ it "raises Shining::CantParseJSONFile if the file isn't valid JSON" do
36
+ File.open(TMP/'foo.json', 'w') { |file| file << "oaskdo ksdp kdpo asdk apos" }
37
+ lambda do json(TMP/'foo.json') end.should raise_error Shining::CantParseJSONFile
38
+ end
39
+ end
40
+
27
41
  context '#move and #copy' do
28
42
  before do
29
43
  FileUtils.mkdir TMP/'temp'/'dir1'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 3
8
- - 2
9
- version: 1.3.2
8
+ - 3
9
+ version: 1.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Julio Cesar Ody
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-19 00:00:00 +10:00
17
+ date: 2010-05-26 00:00:00 +10:00
18
18
  default_executable: shine
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -163,6 +163,7 @@ files:
163
163
  - lib/shCore.js
164
164
  - lib/shining.js
165
165
  - lib/shining.rb
166
+ - lib/shining/errors.rb
166
167
  - lib/shining/heroku.rb
167
168
  - lib/shining/player.rb
168
169
  - lib/shining/preso.rb