tp 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -43,7 +43,7 @@ Short paragraphs are centered
43
43
 
44
44
  # Paragraphs
45
45
 
46
- Sometimes paragraphs are really really long and might wrap a few lines. It does it's best to wrap them logically. Also, they stay left-aligned.
46
+ Sometimes paragraphs are really really long and might wrap a few lines. It does its best to wrap them logically. Also, they stay left-aligned.
47
47
 
48
48
  # Contribute
49
49
 
@@ -11,7 +11,7 @@ module TP
11
11
  Keyboard.wait_for_return
12
12
 
13
13
  loop do
14
- Renderer.new(slide_deck.current_slide).render
14
+ Renderer.new(slide_deck.current_frame).render
15
15
 
16
16
  case Keyboard.read
17
17
  when :right, :down, :space, :return, 'l', 'k', 'd', 's'
@@ -8,18 +8,43 @@ module TP
8
8
  end
9
9
 
10
10
  def [](index)
11
- slides[index]
11
+ frames[index]
12
12
  end
13
13
 
14
14
  def current
15
- slides[cursor]
15
+ frames[cursor]
16
16
  end
17
- alias current_slide current
17
+ alias current_frame current
18
18
 
19
19
  def ended?
20
20
  not current
21
21
  end
22
22
 
23
+ def frames
24
+ return @frames if @frames
25
+
26
+ @frames = []
27
+
28
+ slides.each do |slide|
29
+ if slide.bullets
30
+ buffer = "# #{slide.header}"
31
+
32
+ @frames << Slide.new(buffer)
33
+
34
+ buffer << "\n"
35
+
36
+ slide.bullets.each do |bullet|
37
+ buffer << "\n* #{bullet}"
38
+ @frames << Slide.new(buffer)
39
+ end
40
+ else
41
+ @frames << Slide.new("# #{slide.header}\n\n#{slide.body}")
42
+ end
43
+ end
44
+
45
+ @frames
46
+ end
47
+
23
48
  def next
24
49
  self.cursor += 1
25
50
 
@@ -1,3 +1,3 @@
1
1
  module TP
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/slides.md CHANGED
@@ -38,8 +38,8 @@ Headers can also be blank
38
38
 
39
39
  # Contribute
40
40
 
41
- JustinCampbell/tp
41
+ justincampbell/tp
42
42
 
43
43
  # Thanks!
44
44
 
45
- @JustinCampbell
45
+ @justincampbell
@@ -30,7 +30,7 @@ describe TP::Presenter do
30
30
  describe "#present" do
31
31
  it "works" do
32
32
  Keyboard.should_receive(:wait_for_return).exactly(1).times
33
- Screen.should_receive(:clear!).exactly(5).times
33
+ Screen.should_receive(:clear!).exactly(7).times
34
34
 
35
35
  presenter.present
36
36
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe TP::SlideDeck do
4
+ subject(:slide_deck) { klass.new slides }
5
+
6
+ let(:slides) {
7
+ [
8
+ TP::Slide.new("# First Slide\n\n* Bullet 1\n* Bullet 2"),
9
+ TP::Slide.new("# Second Slide\n\nThis is a paragraph")
10
+ ]
11
+ }
12
+
13
+ it { slide_deck.frames.count.should == 4 }
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-10 00:00:00.000000000 Z
12
+ date: 2013-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard-rspec
@@ -106,6 +106,7 @@ files:
106
106
  - spec/lib/screen_spec.rb
107
107
  - spec/lib/string_spec.rb
108
108
  - spec/lib/tp/presenter_spec.rb
109
+ - spec/lib/tp/slide_deck_spec.rb
109
110
  - spec/lib/tp/slide_spec.rb
110
111
  - spec/lib/tp_spec.rb
111
112
  - spec/spec_helper.rb
@@ -140,6 +141,7 @@ test_files:
140
141
  - spec/lib/screen_spec.rb
141
142
  - spec/lib/string_spec.rb
142
143
  - spec/lib/tp/presenter_spec.rb
144
+ - spec/lib/tp/slide_deck_spec.rb
143
145
  - spec/lib/tp/slide_spec.rb
144
146
  - spec/lib/tp_spec.rb
145
147
  - spec/spec_helper.rb