tp 0.7.0pre2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Readme.md +3 -0
- data/lib/screen.rb +3 -18
- data/lib/tp/renderer.rb +1 -1
- data/lib/tp/slide.rb +3 -1
- data/lib/tp/slide/paragraph.rb +1 -5
- data/lib/tp/version.rb +1 -1
- data/slides.md +3 -0
- data/spec/lib/screen_spec.rb +0 -31
- data/spec/lib/string_spec.rb +0 -8
- data/spec/lib/tp/renderer_spec.rb +1 -1
- data/spec/lib/tp/slide/paragraph_spec.rb +0 -9
- data/spec/lib/tp/slide_spec.rb +8 -0
- data/spec/spec_helper.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed793c40721ed87cad0fbff8368009598296fc4f
|
4
|
+
data.tar.gz: 6bf5ad7637f5433d61d9f4daf476e37665385d7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ef9a9b36badf129ba59597d38026bc4a45d1b0ef85b2986670f63812d9bf3c4d14311bf0bd5260b183b4bb7180b46d377cc0b0e1fc334defd346ba39c73acbb
|
7
|
+
data.tar.gz: 8c27564718c1cf4607d118eb3fdba73e1a896b441b6d9c0e9f00fe89773eb220b3eff879bcdbf0f405acdbf82dfbe2db3761ac971072d590464ba2559dea0f4b
|
data/Readme.md
CHANGED
data/lib/screen.rb
CHANGED
@@ -1,25 +1,12 @@
|
|
1
1
|
module Screen
|
2
2
|
extend self
|
3
3
|
|
4
|
-
X_GUTTER = 2
|
5
|
-
Y_GUTTER = 1
|
6
|
-
GUTTER_CHAR = "\u2591"
|
7
|
-
SUGGEST_CHAR = "\u2588"
|
8
|
-
|
9
|
-
def add_gutter(text)
|
10
|
-
text = text.lines.map { |line|
|
11
|
-
line == "\n" ? line : " " * X_GUTTER + line
|
12
|
-
}.join
|
13
|
-
text = "\n" * Y_GUTTER + text
|
14
|
-
text
|
15
|
-
end
|
16
|
-
|
17
4
|
def clear!
|
18
5
|
print "\e[2J\e[f"
|
19
6
|
end
|
20
7
|
|
21
8
|
def hide_cursor
|
22
|
-
print "\e[#{height};#{width
|
9
|
+
print "\e[#{height};#{width}H"
|
23
10
|
end
|
24
11
|
|
25
12
|
def height
|
@@ -31,15 +18,13 @@ module Screen
|
|
31
18
|
end
|
32
19
|
|
33
20
|
def suggest(x, y)
|
34
|
-
Y_GUTTER.times { print GUTTER_CHAR * (x + X_GUTTER * 2) + "\n" }
|
35
21
|
y.times do |n|
|
36
22
|
print "\n" if n.nonzero?
|
37
|
-
print
|
23
|
+
print "\u2588" * x
|
38
24
|
end
|
39
|
-
Y_GUTTER.times { print "\n" + GUTTER_CHAR * (x + X_GUTTER * 2) }
|
40
25
|
end
|
41
26
|
|
42
27
|
def width
|
43
|
-
`tput cols`.to_i
|
28
|
+
`tput cols`.to_i
|
44
29
|
end
|
45
30
|
end
|
data/lib/tp/renderer.rb
CHANGED
data/lib/tp/slide.rb
CHANGED
data/lib/tp/slide/paragraph.rb
CHANGED
data/lib/tp/version.rb
CHANGED
data/slides.md
CHANGED
data/spec/lib/screen_spec.rb
CHANGED
@@ -3,27 +3,6 @@ require 'screen'
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Screen do
|
6
|
-
describe ".add_gutter" do
|
7
|
-
subject(:add_gutter) { klass.add_gutter(text) }
|
8
|
-
|
9
|
-
let(:text) { " Header " }
|
10
|
-
|
11
|
-
before do
|
12
|
-
klass.stub width: 10
|
13
|
-
end
|
14
|
-
|
15
|
-
it "adds a gutter on the top and left" do
|
16
|
-
expect(add_gutter).to eq("\n Header ")
|
17
|
-
end
|
18
|
-
|
19
|
-
context "with a paragraph slide" do
|
20
|
-
let(:text) { " Header \n\nAbc" }
|
21
|
-
it "indents the text and leaves a space on the right" do
|
22
|
-
expect(add_gutter).to eq("\n Header \n\n Abc")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
6
|
describe ".clear!" do
|
28
7
|
subject(:clear!) { klass.clear! }
|
29
8
|
|
@@ -39,8 +18,6 @@ describe Screen do
|
|
39
18
|
describe ".height" do
|
40
19
|
subject(:height) { klass.height }
|
41
20
|
|
42
|
-
before { klass.unstub :height }
|
43
|
-
|
44
21
|
it "returns the height" do
|
45
22
|
height.should be_nonzero
|
46
23
|
end
|
@@ -74,17 +51,9 @@ describe Screen do
|
|
74
51
|
end
|
75
52
|
end
|
76
53
|
|
77
|
-
describe ".suggest" do
|
78
|
-
it "prints the slide size with gutter" do
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
54
|
describe ".width" do
|
84
55
|
subject(:width) { klass.width }
|
85
56
|
|
86
|
-
before { klass.unstub :width }
|
87
|
-
|
88
57
|
it "returns the width" do
|
89
58
|
width.should be_nonzero
|
90
59
|
end
|
data/spec/lib/string_spec.rb
CHANGED
@@ -6,13 +6,5 @@ describe String do
|
|
6
6
|
|
7
7
|
it { string.wrap(1).should == "One\ntwo\nthree\nfour\nfive" }
|
8
8
|
it { string.wrap(10).should == "One two\nthree four\nfive" }
|
9
|
-
|
10
|
-
context "with multiple lines" do
|
11
|
-
let(:string) { "One two\nthree four\nfive" }
|
12
|
-
|
13
|
-
it { string.wrap(1).should == "One\ntwo\nthree\nfour\nfive" }
|
14
|
-
it { string.wrap(10).should == "One two\nthree four\nfive" }
|
15
|
-
it { string.wrap(100).should == string }
|
16
|
-
end
|
17
9
|
end
|
18
10
|
end
|
@@ -13,15 +13,6 @@ describe TP::Slide::Paragraph do
|
|
13
13
|
its(:width) { should == 15 }
|
14
14
|
its(:height) { should == 3 }
|
15
15
|
|
16
|
-
context "when text is wrapped" do
|
17
|
-
before do
|
18
|
-
Screen.stub width: 10
|
19
|
-
end
|
20
|
-
|
21
|
-
its(:width) { should == 10 }
|
22
|
-
its(:height) { should == 4 }
|
23
|
-
end
|
24
|
-
|
25
16
|
describe "#render_terminal" do
|
26
17
|
subject(:lines) { slide.render_terminal.lines.to_a }
|
27
18
|
|
data/spec/lib/tp/slide_spec.rb
CHANGED
@@ -17,4 +17,12 @@ describe TP::Slide do
|
|
17
17
|
|
18
18
|
its(:content) { should eq("") }
|
19
19
|
end
|
20
|
+
|
21
|
+
context "with presenter notes" do
|
22
|
+
let(:markdown) { "# Header\n\nContent\n\n> Secrets" }
|
23
|
+
|
24
|
+
it "does not include presenter notes in the content" do
|
25
|
+
expect(slide.content).to_not include("Secrets")
|
26
|
+
end
|
27
|
+
end
|
20
28
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderay
|
@@ -205,9 +205,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: 1.9.3
|
206
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
|
-
- - '
|
208
|
+
- - '>='
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
210
|
+
version: '0'
|
211
211
|
requirements: []
|
212
212
|
rubyforge_project:
|
213
213
|
rubygems_version: 2.0.14
|