git_presenter 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.markdown +5 -1
- data/VERSION +1 -1
- data/git_presenter.gemspec +3 -3
- data/lib/git_presenter.rb +3 -3
- data/lib/git_presenter/controller.rb +5 -2
- data/lib/git_presenter/presentation.rb +2 -1
- data/spec/integration/initialize_presentation_spec.rb +6 -0
- data/spec/lib/git_presenter/presentation_spec.rb +13 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a10c89461bdb37a5cd273e9c6c70794d106351b3
|
4
|
+
data.tar.gz: e528f67d7e7f05213b322bfaa3345f5c41fad457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e039a8308e57e799cd64bb7731319b519cca0778538ff753851db2ffa33c95a79d6845a61b849197f08fa4600870d965a3688321660ed24a3fd5873dc3ba064
|
7
|
+
data.tar.gz: c803d8136b08d35a94d7994a008d4a8d9f7a01799242f2651573e7e54fbba0b55cf55b25de6da9f5bfbd4e3a30683b7ebc99fd8bff4bb3ec97f433de10b118c3
|
data/.travis.yml
CHANGED
data/README.markdown
CHANGED
@@ -35,7 +35,7 @@ gem install git_presenter
|
|
35
35
|
* start/s: move to start of presentation
|
36
36
|
* list/l : list slides in presentation
|
37
37
|
* help/h: display this message
|
38
|
-
|
38
|
+
|
39
39
|
## Other resources
|
40
40
|
There are couple of videos showing git presenter and how to us it
|
41
41
|
* (video 1)[https://vimeo.com/38949496]
|
@@ -56,6 +56,10 @@ It you find any bugs or have some feature requests please add an issue on the re
|
|
56
56
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
57
57
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
58
58
|
|
59
|
+
## Contributors
|
60
|
+
|
61
|
+
* (Luís Ferreira - Zamith)[https://github.com/zamith]
|
62
|
+
|
59
63
|
## Copyright
|
60
64
|
|
61
65
|
Copyright (c) 2012 Colin Gemmell
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.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.1.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.1.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-06-14"
|
15
15
|
s.description = "Code presentation tool using git"
|
16
16
|
s.email = "pythonandchips@gmail.com"
|
17
17
|
s.executables = ["git-presenter"]
|
data/lib/git_presenter.rb
CHANGED
@@ -4,9 +4,9 @@ require 'readline'
|
|
4
4
|
require 'launchy'
|
5
5
|
|
6
6
|
class GitPresenter
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
require_relative 'git_presenter/presentation'
|
8
|
+
require_relative 'git_presenter/controller'
|
9
|
+
require_relative 'git_presenter/slide'
|
10
10
|
|
11
11
|
def initialize(current_dir, interactive=true)
|
12
12
|
@controller = Controller.new(current_dir)
|
@@ -6,7 +6,7 @@ class GitPresenter::Controller
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def initialise_presentation
|
9
|
-
yaml = {"slides" => create_slides}.to_yaml
|
9
|
+
yaml = {"slides" => create_slides, "branch" => current_branch}.to_yaml
|
10
10
|
File.open(presentation_file_location, "w") do |file|
|
11
11
|
file.write(yaml)
|
12
12
|
end
|
@@ -24,7 +24,6 @@ class GitPresenter::Controller
|
|
24
24
|
def update_presentation
|
25
25
|
yaml = YAML.parse(File.open(@presentation_dir + "/.presentation", "r")).to_ruby
|
26
26
|
slides = create_slides(yaml['slides'].last["slide"]["commit"])
|
27
|
-
last_commit = yaml["slides"].last
|
28
27
|
yaml["slides"] = yaml["slides"] + slides
|
29
28
|
yaml["slides"].uniq!
|
30
29
|
write_file(yaml.to_yaml)
|
@@ -54,4 +53,8 @@ class GitPresenter::Controller
|
|
54
53
|
}
|
55
54
|
end
|
56
55
|
end
|
56
|
+
|
57
|
+
def current_branch
|
58
|
+
`git rev-parse --abbrev-ref HEAD`.strip
|
59
|
+
end
|
57
60
|
end
|
@@ -2,6 +2,7 @@ class GitPresenter::Presentation
|
|
2
2
|
attr_reader :slides, :current_slide
|
3
3
|
|
4
4
|
def initialize(presentation)
|
5
|
+
@branch = presentation["branch"]
|
5
6
|
@slides = presentation["slides"].map{|slide| GitPresenter::Slide.new(slide["slide"])}
|
6
7
|
@current_slide = slides.first
|
7
8
|
end
|
@@ -39,7 +40,7 @@ class GitPresenter::Presentation
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def exit
|
42
|
-
`git checkout -q
|
43
|
+
`git checkout -q #{@branch}`
|
43
44
|
:exit
|
44
45
|
end
|
45
46
|
|
@@ -20,6 +20,12 @@ describe "initializing a presentation" do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
it 'should have a branch note' do
|
24
|
+
@helper.initialise_presentation do |commits, yaml|
|
25
|
+
yaml["branch"].should_not be_nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
23
29
|
it "should contain a line for each commit to the repository" do
|
24
30
|
@helper.initialise_presentation do |commits, yaml|
|
25
31
|
yaml["slides"].length.should eql commits.length
|
@@ -4,7 +4,8 @@ describe GitPresenter::Presentation do
|
|
4
4
|
let(:presentation){ {"slides" => [
|
5
5
|
{"slide" => {"commit" => "0"}},
|
6
6
|
{"slide" => {"commit" => "1"}},
|
7
|
-
{"slide" => {"commit" => "2"}}]
|
7
|
+
{"slide" => {"commit" => "2"}}],
|
8
|
+
"branch" => "test"
|
8
9
|
}
|
9
10
|
}
|
10
11
|
context "when displaying the command line" do
|
@@ -83,5 +84,16 @@ describe GitPresenter::Presentation do
|
|
83
84
|
context "with help" do
|
84
85
|
it { given_command("help").should eql :help}
|
85
86
|
end
|
87
|
+
|
88
|
+
context "with exit" do
|
89
|
+
it { given_command("exit").should eql :exit}
|
90
|
+
it 'checks out to the correct branch' do
|
91
|
+
presenter = GitPresenter::Presentation.new(presentation)
|
92
|
+
|
93
|
+
expect(presenter).to receive(:'`').with("git checkout -q #{presentation['branch']}")
|
94
|
+
|
95
|
+
presenter.exit
|
96
|
+
end
|
97
|
+
end
|
86
98
|
end
|
87
99
|
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.1.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-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|