git_presenter 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +9 -2
- data/VERSION +1 -1
- data/bin/git-presenter +7 -1
- data/git_presenter.gemspec +4 -3
- data/lib/git_presenter.rb +8 -0
- data/lib/git_presenter/controller.rb +6 -2
- data/lib/git_presenter/presentation.rb +9 -3
- data/lib/git_presenter/shell.rb +5 -0
- data/spec/integration/moving_through_presentation_spec.rb +9 -0
- data/spec/lib/git_presenter/presentation_spec.rb +14 -2
- data/spec/support/git_helpers.rb +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3a5108af02483b24a244e6fe0c5809b56ce2aa0
|
4
|
+
data.tar.gz: 1d1c4eab9e7368b19d91ba088cdd3d2ae75e834d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41df6ca731e1c83fabc4c4c7f6aa9cda9c85e3f5559e358733818d641a7467c5c30fb741c97609513d7898d06642e555596744b46ebd07cb405095df2dc2549f
|
7
|
+
data.tar.gz: 19017243d18c056bc53fdbb72054749504196b3ff12976d74ff70631f849c15006ffba5c8baf8550e5a84286fb45bab075046438985f110749020fe90c3eab06
|
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# git-presenter
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://drone.io/github.com/pythonandchips/git-presenter/status.png)](https://drone.io/github.com/pythonandchips/git-presenter/latest)
|
4
4
|
|
5
5
|
When presenting code live on stage you have a few choices:
|
6
6
|
|
@@ -36,6 +36,14 @@ gem install git_presenter
|
|
36
36
|
* list/l : list slides in presentation
|
37
37
|
* help/h: display this message
|
38
38
|
|
39
|
+
###Command mode
|
40
|
+
|
41
|
+
The default for git presenter is interactive mode however if you want to use git presenter from a text editor you can use command mode.
|
42
|
+
|
43
|
+
To start a presentation in command mode use "git-presenter start -c"
|
44
|
+
|
45
|
+
Once started you run "git-presenter {{command}}" e.g. to move to the next slide run "git-presenter next"
|
46
|
+
|
39
47
|
## Other resources
|
40
48
|
There are couple of videos showing git presenter and how to us it
|
41
49
|
* (video 1)[https://vimeo.com/38949496]
|
@@ -82,4 +90,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
82
90
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
83
91
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
84
92
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
85
|
-
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/bin/git-presenter
CHANGED
@@ -4,5 +4,11 @@ require_relative "../lib/git_presenter"
|
|
4
4
|
|
5
5
|
YAML::ENGINE.yamler = 'psych'
|
6
6
|
|
7
|
-
|
7
|
+
if ARGV[1] == "-c"
|
8
|
+
interactive = false
|
9
|
+
else
|
10
|
+
interactive = true
|
11
|
+
end
|
12
|
+
|
13
|
+
presenter = GitPresenter.new(Dir.pwd, interactive)
|
8
14
|
presenter.execute(ARGV[0])
|
data/git_presenter.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: git_presenter 1.
|
5
|
+
# stub: git_presenter 1.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "git_presenter"
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.2.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Colin Gemmell"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-07-09"
|
15
15
|
s.description = "Code presentation tool using git"
|
16
16
|
s.email = "pythonandchips@gmail.com"
|
17
17
|
s.executables = ["git-presenter"]
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/git_presenter.rb",
|
34
34
|
"lib/git_presenter/controller.rb",
|
35
35
|
"lib/git_presenter/presentation.rb",
|
36
|
+
"lib/git_presenter/shell.rb",
|
36
37
|
"lib/git_presenter/slide.rb",
|
37
38
|
"spec/bugs/max_10_commits_being_parsed_spec.rb",
|
38
39
|
"spec/integration/initialize_presentation_spec.rb",
|
data/lib/git_presenter.rb
CHANGED
@@ -7,6 +7,7 @@ class GitPresenter
|
|
7
7
|
require_relative 'git_presenter/presentation'
|
8
8
|
require_relative 'git_presenter/controller'
|
9
9
|
require_relative 'git_presenter/slide'
|
10
|
+
require_relative 'git_presenter/shell'
|
10
11
|
|
11
12
|
def initialize(current_dir, interactive=true)
|
12
13
|
@controller = Controller.new(current_dir)
|
@@ -24,11 +25,18 @@ class GitPresenter
|
|
24
25
|
elsif command == 'update'
|
25
26
|
@controller.update_presentation
|
26
27
|
else
|
28
|
+
if @presentation.nil?
|
29
|
+
@presentation = @controller.load_presentation
|
30
|
+
end
|
27
31
|
puts @presentation.execute(command)
|
28
32
|
end
|
29
33
|
@presentation
|
30
34
|
end
|
31
35
|
|
36
|
+
def current_slide
|
37
|
+
@presentation.current_slide
|
38
|
+
end
|
39
|
+
|
32
40
|
private
|
33
41
|
|
34
42
|
def enter_run_loop
|
@@ -14,9 +14,13 @@ class GitPresenter::Controller
|
|
14
14
|
puts "run 'git-presenter start' to begin the presentation"
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def load_presentation
|
18
18
|
yaml = YAML.parse(File.open(@presentation_dir + "/.presentation", "r")).to_ruby
|
19
|
-
|
19
|
+
GitPresenter::Presentation.new(yaml)
|
20
|
+
end
|
21
|
+
|
22
|
+
def start_presentation
|
23
|
+
presenter = load_presentation
|
20
24
|
puts presenter.start
|
21
25
|
presenter
|
22
26
|
end
|
@@ -1,10 +1,16 @@
|
|
1
1
|
class GitPresenter::Presentation
|
2
2
|
attr_reader :slides, :current_slide
|
3
3
|
|
4
|
-
def initialize(presentation)
|
4
|
+
def initialize(presentation, shell=GitPresenter::Shell.new)
|
5
5
|
@branch = presentation["branch"]
|
6
6
|
@slides = presentation["slides"].map{|slide| GitPresenter::Slide.new(slide["slide"])}
|
7
|
-
@
|
7
|
+
@shell = shell
|
8
|
+
@current_slide = find_current_slide
|
9
|
+
end
|
10
|
+
|
11
|
+
def find_current_slide
|
12
|
+
sha = @shell.run("git rev-parse HEAD").strip
|
13
|
+
@slides.detect{|s| s.commit == sha}
|
8
14
|
end
|
9
15
|
|
10
16
|
def command_for(command)
|
@@ -45,7 +51,7 @@ class GitPresenter::Presentation
|
|
45
51
|
end
|
46
52
|
|
47
53
|
def position
|
48
|
-
slides.index(@current_slide)
|
54
|
+
@slides.index(@current_slide)
|
49
55
|
end
|
50
56
|
|
51
57
|
def total_slides
|
@@ -184,4 +184,13 @@ EOH
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
188
|
+
context "when running in command mode" do
|
189
|
+
it "should set the current slide to commit" do
|
190
|
+
@helper.start_presentation([], 1) do |commits, presenter|
|
191
|
+
presenter.execute("list")
|
192
|
+
presenter.current_slide.commit.should eql commits[1].sha
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
187
196
|
end
|
@@ -1,5 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
+
class FakeShell
|
4
|
+
attr_reader :ran_commands
|
5
|
+
def initialize()
|
6
|
+
@ran_commands = []
|
7
|
+
end
|
8
|
+
def run(command)
|
9
|
+
@ran_commands << command
|
10
|
+
end
|
11
|
+
end
|
3
12
|
describe GitPresenter::Presentation do
|
4
13
|
let(:presentation){ {"slides" => [
|
5
14
|
{"slide" => {"commit" => "0"}},
|
@@ -8,9 +17,11 @@ describe GitPresenter::Presentation do
|
|
8
17
|
"branch" => "test"
|
9
18
|
}
|
10
19
|
}
|
20
|
+
let(:fake_shell){ FakeShell.new }
|
11
21
|
context "when displaying the command line" do
|
12
22
|
it "should display the current position" do
|
13
|
-
|
23
|
+
fake_shell.should_receive(:run).with("git rev-parse HEAD").and_return("0")
|
24
|
+
presenter = GitPresenter::Presentation.new(presentation, fake_shell)
|
14
25
|
presenter.status_line.should eql "1/3 >"
|
15
26
|
end
|
16
27
|
end
|
@@ -18,7 +29,8 @@ describe GitPresenter::Presentation do
|
|
18
29
|
|
19
30
|
context "when calculating the position" do
|
20
31
|
it "should return the index of the current commit" do
|
21
|
-
|
32
|
+
fake_shell.should_receive(:run).with("git rev-parse HEAD").and_return("0")
|
33
|
+
presenter = GitPresenter::Presentation.new(presentation, fake_shell)
|
22
34
|
presenter.position.should eql 0
|
23
35
|
end
|
24
36
|
end
|
data/spec/support/git_helpers.rb
CHANGED
@@ -71,12 +71,17 @@ class GitHelper
|
|
71
71
|
commits
|
72
72
|
end
|
73
73
|
|
74
|
-
def start_presentation(commands=[])
|
74
|
+
def start_presentation(commands=[], start_slide=0)
|
75
75
|
commits = initialise_presentation({:delay => true})
|
76
76
|
Dir.chdir(@presentation_dir) do
|
77
77
|
add_commands(commands) unless commands.empty?
|
78
|
+
if start_slide != 0
|
79
|
+
`git checkout -q #{commits[start_slide]}`
|
80
|
+
end
|
78
81
|
presenter = GitPresenter.new('.', false)
|
79
|
-
|
82
|
+
if start_slide == 0
|
83
|
+
presenter = presenter.execute('start')
|
84
|
+
end
|
80
85
|
yield(commits, presenter) if block_given?
|
81
86
|
end
|
82
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin Gemmell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/git_presenter.rb
|
117
117
|
- lib/git_presenter/controller.rb
|
118
118
|
- lib/git_presenter/presentation.rb
|
119
|
+
- lib/git_presenter/shell.rb
|
119
120
|
- lib/git_presenter/slide.rb
|
120
121
|
- spec/bugs/max_10_commits_being_parsed_spec.rb
|
121
122
|
- spec/integration/initialize_presentation_spec.rb
|