From a7a5ac48d40e39f54363687936773d4ce33b9c3e Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Fri, 8 Jun 2012 22:42:53 +0100 Subject: [PATCH 01/41] on exit will checkout master branch --- Gemfile | 1 + Gemfile.lock | 8 ++++++++ lib/git_presenter/presentation.rb | 5 ++++- spec/integration/moving_through_presentation_spec.rb | 11 +++++++++++ spec/spec_helper.rb | 1 + spec/support/git_helpers.rb | 8 ++++++++ 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d97919c..2a42877 100644 --- a/Gemfile +++ b/Gemfile @@ -12,4 +12,5 @@ group :development do gem "bundler" gem "jeweler", "~> 1.6" gem "rcov", "~> 0.9" + gem 'pry' end diff --git a/Gemfile.lock b/Gemfile.lock index 2b54913..cf52975 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: http://rubygems.org/ specs: + coderay (1.0.6) diff-lcs (1.1.3) git (1.2.5) grit (2.5.0) @@ -13,8 +14,13 @@ GEM rake rdoc json (1.7.3) + method_source (0.7.1) mime-types (1.18) posix-spawn (0.3.6) + pry (0.9.9.6) + coderay (~> 1.0.5) + method_source (~> 0.7.1) + slop (>= 2.4.4, < 3) rake (0.9.2.2) rcov (0.9.11) rdoc (3.12) @@ -27,6 +33,7 @@ GEM rspec-expectations (2.10.0) diff-lcs (~> 1.1.3) rspec-mocks (2.10.1) + slop (2.4.4) PLATFORMS ruby @@ -35,5 +42,6 @@ DEPENDENCIES bundler grit (~> 2.4) jeweler (~> 1.6) + pry rcov (~> 0.9) rspec (~> 2.7) diff --git a/lib/git_presenter/presentation.rb b/lib/git_presenter/presentation.rb index 0d810bb..004bd48 100644 --- a/lib/git_presenter/presentation.rb +++ b/lib/git_presenter/presentation.rb @@ -28,7 +28,6 @@ def execute(user_command) end return commit(user_command.to_i) if command == :commit return bash_command(user_command) if command == :command - return :exit if command == :exit self.send(command) end @@ -40,6 +39,10 @@ def status_line "#{position+1}/#{total_slides} >" end + def exit + `git checkout -q master` + end + def position slides.index(@current_slide) end diff --git a/spec/integration/moving_through_presentation_spec.rb b/spec/integration/moving_through_presentation_spec.rb index 7de37af..0278a1c 100644 --- a/spec/integration/moving_through_presentation_spec.rb +++ b/spec/integration/moving_through_presentation_spec.rb @@ -162,4 +162,15 @@ end end end + + context "when exiting a presentation" do + it "should set the repo back to the master branch" do + @helper.start_presentation do |commits, presenter| + presenter.execute("next") + presenter.execute("exit") + @helper.current_branch.should_not be_nil + @helper.current_branch.name.should eql "master" + end + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 260c08c..80547b3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ require 'rspec' +require 'pry' require "support/git_helpers" require "support/command_line_helper" require_relative "../lib/git_presenter" diff --git a/spec/support/git_helpers.rb b/spec/support/git_helpers.rb index bda65b6..141eb51 100644 --- a/spec/support/git_helpers.rb +++ b/spec/support/git_helpers.rb @@ -91,4 +91,12 @@ def add_command(command, add_command_to_commit=nil) end end end + + def current_branch + Dir.chdir(PRESENTATION_DIR) do + repo = Grit::Repo.init('.') + repo.head + end + end + end From bce8395bee332810f36757bef08dc9bd67a71c73 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sun, 10 Jun 2012 00:16:22 +0200 Subject: [PATCH 02/41] removed jruby 1.9 as posix-spawn has a problem --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 566b34c..68a17f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,4 @@ language: ruby rvm: - 1.9.2 - 1.9.3 - - jruby-19mode # JRuby in 1.9 mode + # - jruby-19mode # JRuby in 1.9 mode From 17b29993f6e095d73b43e2858713171c7f6ab900 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sun, 10 Jun 2012 00:18:02 +0200 Subject: [PATCH 03/41] Update master --- README.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 5f25ff3..cf3164e 100644 --- a/README.markdown +++ b/README.markdown @@ -17,7 +17,9 @@ Any and all feedback is welcome ## Pre-requisites * Git -* Ruby version 1.9.2 or 1.9.3 or jruby in 1.9 mode (basically anything with 1.9 at the end) +* Ruby version 1.9.2 or 1.9.3 + +Note jruby is currently unsupported as there is a problem with posix-spawn and jruby ## Installation From 517c7afa0c4631f81fa6abf777e133c198b8ffa7 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Fri, 29 Jun 2012 19:04:30 +0100 Subject: [PATCH 04/41] merge error sorted --- lib/git_presenter/presentation.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/git_presenter/presentation.rb b/lib/git_presenter/presentation.rb index 02cb853..a805bcb 100644 --- a/lib/git_presenter/presentation.rb +++ b/lib/git_presenter/presentation.rb @@ -27,7 +27,6 @@ def execute(user_command) end return commit(user_command.to_i) if command == :commit return bash_command(user_command) if command == :command - return :exit if command == :exit self.send(command) end @@ -37,10 +36,10 @@ def bash_command(user_command) def status_line "#{position+1}/#{total_slides} >" - end + end - def exit - `git checkout -q master` + def exit + `git checkout -q master` end def position From b27baa821d354c7285e2a97a57a9f63c65e66678 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Fri, 29 Jun 2012 19:12:41 +0100 Subject: [PATCH 05/41] Version bump to 0.3.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f477849..9325c3c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.2 \ No newline at end of file +0.3.0 \ No newline at end of file From e7f153ced6e2b140afda4de395d0343b774dac1c Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Fri, 29 Jun 2012 19:14:34 +0100 Subject: [PATCH 06/41] updated readme file bumped version --- README.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index cf3164e..a748191 100644 --- a/README.markdown +++ b/README.markdown @@ -18,7 +18,7 @@ Any and all feedback is welcome * Git * Ruby version 1.9.2 or 1.9.3 - + Note jruby is currently unsupported as there is a problem with posix-spawn and jruby ## Installation @@ -30,6 +30,7 @@ gem install git_presenter * Commit to git as you develop your code. * When the code is ready use the "git-presenter init" command to initialise * Once it is initialised you can start the presentation with "git-presenter start" +* Make more commits if need be and use "git-presenter update" * Then use the following command to navigate the presentation * next/n: move to next slide * back/b: move back a slide From 18301122f4cd8aba796bba933effe93d814d4d3d Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Fri, 29 Jun 2012 19:21:07 +0100 Subject: [PATCH 07/41] Regenerate gemspec for version 0.3.0 --- git_presenter.gemspec | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index d7fc137..b6a70b2 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = "git_presenter" - s.version = "0.2.2" + s.version = "0.3.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Colin Gemmell"] - s.date = "2012-04-17" + s.date = "2012-06-29" s.description = "Code presentation tool using git" s.email = "pythonandchips@gmail.com" s.executables = ["git-presenter"] @@ -29,16 +29,17 @@ Gem::Specification.new do |s| "bin/git-presenter", "git_presenter.gemspec", "lib/git_presenter.rb", - "lib/git_presenter/parser.rb", + "lib/git_presenter/controller.rb", "lib/git_presenter/presentation.rb", "lib/git_presenter/slide.rb", - "lib/git_presenter/writer.rb", + "spec/bugs/max_10_commits_being_parsed_spec.rb", "spec/integration/initialize_presentation_spec.rb", "spec/integration/moving_through_presentation_spec.rb", "spec/integration/start_presentation_spec.rb", + "spec/integration/update_presentation_spec.rb", + "spec/lib/git_presenter/controller_spec.rb", "spec/lib/git_presenter/presentation_spec.rb", "spec/lib/git_presenter/slide_spec.rb", - "spec/lib/git_presenter/writer_spec.rb", "spec/spec_helper.rb", "spec/support/command_line_helper.rb", "spec/support/git_helpers.rb" @@ -54,23 +55,29 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 2.4"]) + s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 2.7"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 1.6"]) s.add_development_dependency(%q, ["~> 0.9"]) + s.add_development_dependency(%q, [">= 0"]) else s.add_dependency(%q, ["~> 2.4"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 1.6"]) s.add_dependency(%q, ["~> 0.9"]) + s.add_dependency(%q, [">= 0"]) end else s.add_dependency(%q, ["~> 2.4"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 1.6"]) s.add_dependency(%q, ["~> 0.9"]) + s.add_dependency(%q, [">= 0"]) end end From fee03b13b6419e1ef65e83431011ff7f88737cee Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Tue, 10 Jul 2012 21:18:24 +0100 Subject: [PATCH 08/41] allow user to launch external applications from a slide --- Gemfile | 1 + Gemfile.lock | 4 +++ lib/git_presenter.rb | 19 ++++++------ lib/git_presenter/slide.rb | 2 ++ .../moving_through_presentation_spec.rb | 15 ++++++++-- spec/integration/start_presentation_spec.rb | 2 +- spec/lib/git_presenter/slide_spec.rb | 17 +++++++++++ spec/support/git_helpers.rb | 29 +++++++++++++++++-- 8 files changed, 75 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 49d8d64..970deec 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ source "http://rubygems.org" # gem "activesupport", ">= 2.3.5" # gem "grit", "~> 2.4" +gem "launchy", "~> 2.1" # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. diff --git a/Gemfile.lock b/Gemfile.lock index cf52975..ab63bc8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: http://rubygems.org/ specs: + addressable (2.2.8) coderay (1.0.6) diff-lcs (1.1.3) git (1.2.5) @@ -14,6 +15,8 @@ GEM rake rdoc json (1.7.3) + launchy (2.1.0) + addressable (~> 2.2.6) method_source (0.7.1) mime-types (1.18) posix-spawn (0.3.6) @@ -42,6 +45,7 @@ DEPENDENCIES bundler grit (~> 2.4) jeweler (~> 1.6) + launchy (~> 2.1) pry rcov (~> 0.9) rspec (~> 2.7) diff --git a/lib/git_presenter.rb b/lib/git_presenter.rb index 9dc764c..2066cc1 100644 --- a/lib/git_presenter.rb +++ b/lib/git_presenter.rb @@ -1,11 +1,12 @@ -require "grit" -require "yaml" -require "readline" +require 'grit' +require 'yaml' +require 'readline' +require 'launchy' class GitPresenter - require "git_presenter/presentation" - require "git_presenter/controller" - require "git_presenter/slide" + require 'git_presenter/presentation' + require 'git_presenter/controller' + require 'git_presenter/slide' def initialize(current_dir, interactive=true) @controller = Controller.new(current_dir) @@ -13,14 +14,14 @@ def initialize(current_dir, interactive=true) end def execute(command) - if command == "init" + if command == 'init' @controller.initialise_presentation - elsif command == "start" + elsif command == 'start' @presentation = @controller.start_presentation if @interactive enter_run_loop end - elsif command == "update" + elsif command == 'update' @controller.update_presentation else puts @presentation.execute(command) diff --git a/lib/git_presenter/slide.rb b/lib/git_presenter/slide.rb index 95d6b2d..b7c38e5 100644 --- a/lib/git_presenter/slide.rb +++ b/lib/git_presenter/slide.rb @@ -5,12 +5,14 @@ def initialize(slide) @commit = slide["commit"] @message = slide["message"] @run = slide["run"] + @launch = slide["launch"] end def execute output = "" output << checkout unless @commit.nil? output << `#{run}` unless @run.nil? + Launchy.open(@launch) unless @launch.nil? output end diff --git a/spec/integration/moving_through_presentation_spec.rb b/spec/integration/moving_through_presentation_spec.rb index 5c1774a..987d03c 100644 --- a/spec/integration/moving_through_presentation_spec.rb +++ b/spec/integration/moving_through_presentation_spec.rb @@ -135,7 +135,7 @@ context "when the slide contains a run command only" do it "should execute the command" do command_line_helper = CommandLineHelper.capture_output - @helper.start_presentation("echo hello world") do |commits, presenter| + @helper.start_presentation([:run => "echo hello world"]) do |commits, presenter| presenter.execute("next") presenter.execute("next") presenter.execute("next").strip.should eql "hello world" @@ -146,7 +146,7 @@ context "when the slide has a commit and a run command" do it "should checkout the commit and then execute the command" do command_line_helper = CommandLineHelper.capture_output - @helper.start_presentation("echo hello world", 2) do |commits, presenter| + @helper.start_presentation([:run => "echo hello world",:on_slide => 2]) do |commits, presenter| presenter.execute("next") presenter.execute("next").should eql "#{commits[2].message}\nhello world\n" end @@ -163,6 +163,17 @@ end end + context "when opening an application" do + it "should open the with launchy" do + command_line_helper = CommandLineHelper.capture_output + @helper.start_presentation([:launch => 'readme', :on_slide => 2]) do |commits, presenter| + Launchy.should_receive(:open).with('readme').once + presenter.execute("next") + presenter.execute("next") + end + end + end + context "when exiting a presentation" do it "should set the repo back to the master branch" do @helper.start_presentation do |commits, presenter| diff --git a/spec/integration/start_presentation_spec.rb b/spec/integration/start_presentation_spec.rb index 150e163..23dfc93 100644 --- a/spec/integration/start_presentation_spec.rb +++ b/spec/integration/start_presentation_spec.rb @@ -31,7 +31,7 @@ it "the last commit should be a command" do command = "echo hello world" - @helper.start_presentation(command) do |commits, presenter| + @helper.start_presentation([:run => command]) do |commits, presenter| presenter.slides[3].run.should eql command end end diff --git a/spec/lib/git_presenter/slide_spec.rb b/spec/lib/git_presenter/slide_spec.rb index 79f5d54..ca127f4 100644 --- a/spec/lib/git_presenter/slide_spec.rb +++ b/spec/lib/git_presenter/slide_spec.rb @@ -31,6 +31,23 @@ end end + context "when slide contains a launch command" do + it "should launch the application for the file type" do + command_line_helper = CommandLineHelper.capture_output + Launchy.should_receive(:open).with("readme").once + slide = GitPresenter::Slide.new({"launch" => "readme"}) + slide.execute + end + + it "should not try and launch if no launch supplied" do + command_line_helper = CommandLineHelper.capture_output + Launchy.should_receive(:open).with("readme").never + slide = GitPresenter::Slide.new({"commit" => "number", "message" => "checkout", "run" => "echo hello world"}) + slide.stub(:checkout).and_return("checkout\n") + slide.execute.should eql "checkout\nhello world\n" + end + end + context "when slide contains only a commit" do it "should checkout the code then run the command" do command_line_helper = CommandLineHelper.capture_output diff --git a/spec/support/git_helpers.rb b/spec/support/git_helpers.rb index f9457c9..7851f3e 100644 --- a/spec/support/git_helpers.rb +++ b/spec/support/git_helpers.rb @@ -71,10 +71,10 @@ def initialise_presentation(params={}) commits end - def start_presentation(command="", add_command_to_commit=nil) + def start_presentation(commands=[]) commits = initialise_presentation({:delay => true}) Dir.chdir(@presentation_dir) do - add_command(command, add_command_to_commit) unless command.empty? + add_commands(commands) unless commands.empty? presenter = GitPresenter.new('.', false) presenter = presenter.execute('start') yield(commits, presenter) if block_given? @@ -102,6 +102,31 @@ def remove_from_presentation_at(index) removed_commit end + def add_commands(commands) + commands.each do |command| + if command.include?(:run) + add_command(command[:run], command[:on_slide]) + end + if command.include?(:launch) + add_launch(command[:launch], command[:on_slide]) + end + end + end + + def add_launch(command, add_command_to_commit=nil) + Dir.chdir(PRESENTATION_DIR) do + presentation = YAML.parse(File.open(".presentation")).to_ruby + if !add_command_to_commit.nil? + presentation["slides"][add_command_to_commit]["slide"]["launch"] = command + else + presentation["slides"] << {"slide" => {"launch" => command}} + end + File.open(".presentation", "w") do |file| + file.write(presentation.to_yaml) + end + end + end + def add_command(command, add_command_to_commit=nil) Dir.chdir(PRESENTATION_DIR) do presentation = YAML.parse(File.open(".presentation")).to_ruby From e434e12089769c841ca1d91b2c24a76f22f91df4 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Tue, 10 Jul 2012 21:27:23 +0100 Subject: [PATCH 09/41] fixed exit command --- lib/git_presenter/presentation.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/git_presenter/presentation.rb b/lib/git_presenter/presentation.rb index a805bcb..d36eb53 100644 --- a/lib/git_presenter/presentation.rb +++ b/lib/git_presenter/presentation.rb @@ -40,6 +40,7 @@ def status_line def exit `git checkout -q master` + :exit end def position From 157c6df2ca5ed62fe82a38659409f7db9d69d0ba Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Tue, 10 Jul 2012 21:44:16 +0100 Subject: [PATCH 10/41] Version bump to 0.4.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9325c3c..60a2d3e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 \ No newline at end of file +0.4.0 \ No newline at end of file From c04d145da93763400711c969ffa2da50a90200b5 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Tue, 10 Jul 2012 21:44:31 +0100 Subject: [PATCH 11/41] Regenerate gemspec for version 0.4.0 --- git_presenter.gemspec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index b6a70b2..c1f6acb 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = "git_presenter" - s.version = "0.3.0" + s.version = "0.4.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Colin Gemmell"] - s.date = "2012-06-29" + s.date = "2012-07-10" s.description = "Code presentation tool using git" s.email = "pythonandchips@gmail.com" s.executables = ["git-presenter"] @@ -55,6 +55,7 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 2.4"]) + s.add_runtime_dependency(%q, ["~> 2.1"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 2.7"]) s.add_development_dependency(%q, [">= 0"]) @@ -63,6 +64,7 @@ Gem::Specification.new do |s| s.add_development_dependency(%q, [">= 0"]) else s.add_dependency(%q, ["~> 2.4"]) + s.add_dependency(%q, ["~> 2.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) @@ -72,6 +74,7 @@ Gem::Specification.new do |s| end else s.add_dependency(%q, ["~> 2.4"]) + s.add_dependency(%q, ["~> 2.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) From 9ff07ec3e012bf087a22485e4883ddb264cc4577 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Fri, 5 Apr 2013 13:29:15 +0200 Subject: [PATCH 12/41] Change status to complete --- README.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index a748191..b9e8ed1 100644 --- a/README.markdown +++ b/README.markdown @@ -11,8 +11,7 @@ Git-presenter hope to solve this problem by giving a presentation style interfac ## Current status -Early version but the basics are there to be used. -Any and all feedback is welcome +Complete. ## Pre-requisites From 02b2fd7d38316e616d7965c38e5a5ff676dfc1eb Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 11 May 2013 15:41:59 +0200 Subject: [PATCH 13/41] Added links to videos --- README.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.markdown b/README.markdown index b9e8ed1..acb7825 100644 --- a/README.markdown +++ b/README.markdown @@ -37,6 +37,11 @@ gem install git_presenter * start/s: move to start of presentation * list/l : list slides in presentation * help/h: display this message + +## Other resources +There are couple of videos showing git presenter and how to us it +* (video 1)[https://vimeo.com/38949496] +* (video 2)[https://vimeo.com/39225144] ## Bugs/Features/Prase From ad4de8155202830b71d36ddac36e2fbfd814d0d4 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 26 Feb 2014 20:08:45 +0000 Subject: [PATCH 14/41] removed rcov. doesnt work with ruby 2.0.0 --- Gemfile | 2 -- Gemfile.lock | 2 -- git_presenter.gemspec | 3 --- 3 files changed, 7 deletions(-) diff --git a/Gemfile b/Gemfile index 970deec..803ee87 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,4 @@ group :development do gem "rspec", "~> 2.7" gem "bundler" gem "jeweler", "~> 1.6" - gem "rcov", "~> 0.9" - gem 'pry' end diff --git a/Gemfile.lock b/Gemfile.lock index ab63bc8..4969f77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,7 +25,6 @@ GEM method_source (~> 0.7.1) slop (>= 2.4.4, < 3) rake (0.9.2.2) - rcov (0.9.11) rdoc (3.12) json (~> 1.4) rspec (2.10.0) @@ -47,5 +46,4 @@ DEPENDENCIES jeweler (~> 1.6) launchy (~> 2.1) pry - rcov (~> 0.9) rspec (~> 2.7) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index c1f6acb..55a75dc 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -60,7 +60,6 @@ Gem::Specification.new do |s| s.add_development_dependency(%q, ["~> 2.7"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 1.6"]) - s.add_development_dependency(%q, ["~> 0.9"]) s.add_development_dependency(%q, [">= 0"]) else s.add_dependency(%q, ["~> 2.4"]) @@ -69,7 +68,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 1.6"]) - s.add_dependency(%q, ["~> 0.9"]) s.add_dependency(%q, [">= 0"]) end else @@ -79,7 +77,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 1.6"]) - s.add_dependency(%q, ["~> 0.9"]) s.add_dependency(%q, [">= 0"]) end end From 8f19c1e94b73b203fde1c97542f8fab3347f95d7 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 26 Feb 2014 23:22:58 +0000 Subject: [PATCH 15/41] Version bump to 1.0.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 60a2d3e..afaf360 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0 \ No newline at end of file +1.0.0 \ No newline at end of file From 6a5bfab71448a3fc73c79d31cc9c0f00371366a3 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 26 Feb 2014 23:29:54 +0000 Subject: [PATCH 16/41] removed grit and moved to ruby/git --- Gemfile | 2 +- Gemfile.lock | 85 ++++++++++++------- Rakefile | 22 ----- git_presenter.gemspec | 3 - lib/git_presenter.rb | 2 +- lib/git_presenter/controller.rb | 8 +- .../initialize_presentation_spec.rb | 4 +- .../moving_through_presentation_spec.rb | 22 ++--- spec/integration/start_presentation_spec.rb | 6 +- spec/integration/update_presentation_spec.rb | 2 +- spec/support/git_helpers.rb | 14 +-- 11 files changed, 84 insertions(+), 86 deletions(-) diff --git a/Gemfile b/Gemfile index 803ee87..b1a71e5 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "http://rubygems.org" # Example: # gem "activesupport", ">= 2.3.5" # -gem "grit", "~> 2.4" +gem "git" gem "launchy", "~> 2.1" # Add dependencies to develop your gem here. diff --git a/Gemfile.lock b/Gemfile.lock index 4969f77..41cac98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,48 +1,71 @@ GEM remote: http://rubygems.org/ specs: - addressable (2.2.8) - coderay (1.0.6) - diff-lcs (1.1.3) - git (1.2.5) - grit (2.5.0) - diff-lcs (~> 1.1) - mime-types (~> 1.15) - posix-spawn (~> 0.3.6) - jeweler (1.8.3) + addressable (2.3.5) + builder (3.2.2) + coderay (1.1.0) + diff-lcs (1.2.5) + faraday (0.8.9) + multipart-post (~> 1.2.0) + git (1.2.6) + github_api (0.10.1) + addressable + faraday (~> 0.8.1) + hashie (>= 1.2) + multi_json (~> 1.4) + nokogiri (~> 1.5.2) + oauth2 + hashie (2.0.5) + highline (1.6.20) + jeweler (1.8.8) + builder bundler (~> 1.0) git (>= 1.2.5) + github_api (= 0.10.1) + highline (>= 1.6.15) + nokogiri (= 1.5.10) rake rdoc - json (1.7.3) - launchy (2.1.0) - addressable (~> 2.2.6) - method_source (0.7.1) - mime-types (1.18) - posix-spawn (0.3.6) - pry (0.9.9.6) - coderay (~> 1.0.5) - method_source (~> 0.7.1) - slop (>= 2.4.4, < 3) - rake (0.9.2.2) - rdoc (3.12) + json (1.8.1) + jwt (0.1.11) + multi_json (>= 1.5) + launchy (2.4.2) + addressable (~> 2.3) + method_source (0.8.2) + multi_json (1.8.4) + multi_xml (0.5.5) + multipart-post (1.2.0) + nokogiri (1.5.10) + oauth2 (0.9.3) + faraday (>= 0.8, < 0.10) + jwt (~> 0.1.8) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (~> 1.2) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + rack (1.5.2) + rake (10.1.1) + rdoc (4.1.1) json (~> 1.4) - rspec (2.10.0) - rspec-core (~> 2.10.0) - rspec-expectations (~> 2.10.0) - rspec-mocks (~> 2.10.0) - rspec-core (2.10.1) - rspec-expectations (2.10.0) - diff-lcs (~> 1.1.3) - rspec-mocks (2.10.1) - slop (2.4.4) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.7) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.6) + slop (3.4.7) PLATFORMS ruby DEPENDENCIES bundler - grit (~> 2.4) + git jeweler (~> 1.6) launchy (~> 2.1) pry diff --git a/Rakefile b/Rakefile index c334f91..cc72f74 100644 --- a/Rakefile +++ b/Rakefile @@ -25,25 +25,3 @@ Jeweler::Tasks.new do |gem| end Jeweler::RubygemsDotOrgTasks.new -require 'rspec/core' -require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = FileList['spec/**/*_spec.rb'] -end - -RSpec::Core::RakeTask.new(:rcov) do |spec| - spec.pattern = 'spec/**/*_spec.rb' - spec.rcov = true -end - -task :default => :spec - -require 'rake/rdoctask' -Rake::RDocTask.new do |rdoc| - version = File.exist?('VERSION') ? File.read('VERSION') : "" - - rdoc.rdoc_dir = 'rdoc' - rdoc.title = "git_presenter #{version}" - rdoc.rdoc_files.include('README*') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/git_presenter.gemspec b/git_presenter.gemspec index 55a75dc..69823ae 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -54,7 +54,6 @@ Gem::Specification.new do |s| s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 2.4"]) s.add_runtime_dependency(%q, ["~> 2.1"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 2.7"]) @@ -62,7 +61,6 @@ Gem::Specification.new do |s| s.add_development_dependency(%q, ["~> 1.6"]) s.add_development_dependency(%q, [">= 0"]) else - s.add_dependency(%q, ["~> 2.4"]) s.add_dependency(%q, ["~> 2.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) @@ -71,7 +69,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) end else - s.add_dependency(%q, ["~> 2.4"]) s.add_dependency(%q, ["~> 2.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) diff --git a/lib/git_presenter.rb b/lib/git_presenter.rb index 2066cc1..e9ff87b 100644 --- a/lib/git_presenter.rb +++ b/lib/git_presenter.rb @@ -1,4 +1,4 @@ -require 'grit' +require 'git' require 'yaml' require 'readline' require 'launchy' diff --git a/lib/git_presenter/controller.rb b/lib/git_presenter/controller.rb index 685b072..7de3789 100644 --- a/lib/git_presenter/controller.rb +++ b/lib/git_presenter/controller.rb @@ -44,12 +44,12 @@ def presentation_file_location end def create_slides(last_commit=nil) - repo = Grit::Repo.new(".", "master") - commits = repo.commits("master", false).reverse - commits = commits.drop_while{|commit| commit.id != last_commit}[1..-1] unless last_commit.nil? + repo = Git.open(".") + commits = repo.log.to_a.reverse + commits = commits.drop_while{|commit| commit.sha != last_commit}[1..-1] unless last_commit.nil? commits.map do |commit| {"slide" => - {"commit" => commit.id, + {"commit" => commit.sha, "message" => commit.message} } end diff --git a/spec/integration/initialize_presentation_spec.rb b/spec/integration/initialize_presentation_spec.rb index a0aa9bb..84b9f22 100644 --- a/spec/integration/initialize_presentation_spec.rb +++ b/spec/integration/initialize_presentation_spec.rb @@ -28,13 +28,13 @@ it "first line should contain the first commit number" do @helper.initialise_presentation({:delay => true}) do |commits, yaml| - yaml["slides"][0]["slide"]["commit"].should eql commits.first.id + yaml["slides"][0]["slide"]["commit"].should eql commits.first.sha end end it "second line should contain the second commit number" do @helper.initialise_presentation({:delay => true}) do |commits, yaml| - yaml["slides"][1]["slide"]["commit"].should eql commits[1].id + yaml["slides"][1]["slide"]["commit"].should eql commits[1].sha end end end diff --git a/spec/integration/moving_through_presentation_spec.rb b/spec/integration/moving_through_presentation_spec.rb index 987d03c..da53ee2 100644 --- a/spec/integration/moving_through_presentation_spec.rb +++ b/spec/integration/moving_through_presentation_spec.rb @@ -11,7 +11,7 @@ it "should move to the next commit" do @helper.start_presentation do |commits, presenter| presenter.execute("next") - @helper.head_position.should eql commits[1].id + @helper.head_position.should eql commits[1].sha end end @@ -19,7 +19,7 @@ @helper.start_presentation do |commits, presenter| presenter.execute("next") presenter.execute("next") - @helper.head_position.should eql commits[2].id + @helper.head_position.should eql commits[2].sha end end end @@ -30,7 +30,7 @@ presenter.execute("next") @helper.edit_file("inner commit") presenter.execute("next") - @helper.head_position.should eql commits[2].id + @helper.head_position.should eql commits[2].sha end end end @@ -42,7 +42,7 @@ presenter.execute("next") presenter.execute("next") presenter.execute("next") - @helper.head_position.should eql commits[2].id + @helper.head_position.should eql commits[2].sha end end end @@ -53,7 +53,7 @@ presenter.execute("next") presenter.execute("next") presenter.execute("back") - @helper.head_position.should eql commits[1].id + @helper.head_position.should eql commits[1].sha end end end @@ -67,7 +67,7 @@ presenter.execute("back") presenter.execute("back") presenter.execute("back") - @helper.head_position.should eql commits[0].id + @helper.head_position.should eql commits[0].sha end end end @@ -78,7 +78,7 @@ presenter.execute("next") presenter.execute("next") presenter.execute("start") - @helper.head_position.should eql commits[0].id + @helper.head_position.should eql commits[0].sha end end end @@ -87,7 +87,7 @@ it "should move the last commit" do @helper.start_presentation do |commits, presenter| presenter.execute("end") - @helper.head_position.should eql commits.last.id + @helper.head_position.should eql commits.last.sha end end end @@ -96,7 +96,7 @@ it "should checkout the specific commit" do @helper.start_presentation do |commits, presenter| presenter.execute("2") - @helper.head_position.should eql commits[1].id + @helper.head_position.should eql commits[1].sha end end end @@ -104,7 +104,7 @@ context "list presentation" do it "should print a list of commits" do @helper.start_presentation do |commits, presenter| - expected_output = (["*#{commits.first.id[0..9]}, #{commits.first.message}"] + commits[1..-1].map{|commit| "#{commit.id[0..9]}, #{commit.message}"}).join("\n") + expected_output = (["*#{commits.first.sha[0..9]}, #{commits.first.message}"] + commits[1..-1].map{|commit| "#{commit.sha[0..9]}, #{commit.message}"}).join("\n") presentation = presenter.execute("list") presentation.should eql expected_output end @@ -180,7 +180,7 @@ presenter.execute("next") presenter.execute("exit") @helper.current_branch.should_not be_nil - @helper.current_branch.name.should eql "master" + @helper.current_branch.should eql "master" end end end diff --git a/spec/integration/start_presentation_spec.rb b/spec/integration/start_presentation_spec.rb index 23dfc93..d2f88d2 100644 --- a/spec/integration/start_presentation_spec.rb +++ b/spec/integration/start_presentation_spec.rb @@ -19,13 +19,13 @@ it "first commit should be first commit in file" do @helper.start_presentation do |commits, presenter| - presenter.slides[0].commit.should eql commits[0].id + presenter.slides[0].commit.should eql commits[0].sha end end it "second commit should be second commit in file" do @helper.start_presentation do |commits, presenter| - presenter.slides[1].commit.should eql commits[1].id + presenter.slides[1].commit.should eql commits[1].sha end end @@ -38,7 +38,7 @@ it "should have the presentation at first commit" do @helper.start_presentation do |commits, presenter| - @helper.head_position.should eql commits.first.id + @helper.head_position.should eql commits.first.sha end end end diff --git a/spec/integration/update_presentation_spec.rb b/spec/integration/update_presentation_spec.rb index 1e2507c..bfb1103 100644 --- a/spec/integration/update_presentation_spec.rb +++ b/spec/integration/update_presentation_spec.rb @@ -18,7 +18,7 @@ commits = @helper.initialise_presentation({:delay => true}) new_commit = @helper.edit_file_and_commit("forth commit", "d") @helper.update_presentation do |yaml| - yaml["slides"].last["slide"]["commit"].should eql new_commit.id + yaml["slides"].last["slide"]["commit"].should eql new_commit.sha end end diff --git a/spec/support/git_helpers.rb b/spec/support/git_helpers.rb index 7851f3e..3f3b6c5 100644 --- a/spec/support/git_helpers.rb +++ b/spec/support/git_helpers.rb @@ -16,10 +16,10 @@ def initialise_test_repo(presentation_dir, delay, no_of_commits) content = ('a'..'z').to_a Dir.mkdir(presentation_dir) Dir.chdir(presentation_dir) do - @git_repo = Grit::Repo.init(".") + @git_repo = Git.init(".") (1..no_of_commits).each do |n| - edit_file_and_commit("commit number #{n}", content[n]) - commits << @git_repo.commits[0] + commit = edit_file_and_commit("commit number #{n}", content[n]) + commits << commit #need to make it sleep for a second. #git is not accurate enough with the speed of the test #to sort correctly only when required @@ -40,7 +40,7 @@ def edit_file_and_commit(commit_message, content) edit_file(content) @git_repo.add(".") @git_repo.commit_all(commit_message) - @git_repo.commits[0] + @git_repo.log.to_a[0] end def setup_presentation_file(commits) @@ -56,7 +56,7 @@ def clean_up_repo(dir) end def head_position - File.open(@presentation_dir + '/.git/HEAD').lines.first.strip + File.open(@presentation_dir + '/.git/HEAD').each_line.first.strip end def initialise_presentation(params={}) @@ -143,8 +143,8 @@ def add_command(command, add_command_to_commit=nil) def current_branch Dir.chdir(PRESENTATION_DIR) do - repo = Grit::Repo.init('.') - repo.head + repo = Git.open('.') + repo.current_branch end end From e2110a3afea49edf0bbded1a4c8bc2b0597db13e Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 26 Feb 2014 23:43:40 +0000 Subject: [PATCH 17/41] updated read me --- Gemfile.lock | 14 ++++++++++++++ README.markdown | 4 +--- Rakefile | 1 - 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 41cac98..5682cae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,7 @@ GEM diff-lcs (1.2.5) faraday (0.8.9) multipart-post (~> 1.2.0) + ffi (1.9.3-java) git (1.2.6) github_api (0.10.1) addressable @@ -27,15 +28,20 @@ GEM rake rdoc json (1.8.1) + json (1.8.1-java) jwt (0.1.11) multi_json (>= 1.5) launchy (2.4.2) addressable (~> 2.3) + launchy (2.4.2-java) + addressable (~> 2.3) + spoon (~> 0.0.1) method_source (0.8.2) multi_json (1.8.4) multi_xml (0.5.5) multipart-post (1.2.0) nokogiri (1.5.10) + nokogiri (1.5.10-java) oauth2 (0.9.3) faraday (>= 0.8, < 0.10) jwt (~> 0.1.8) @@ -46,6 +52,11 @@ GEM coderay (~> 1.0) method_source (~> 0.8) slop (~> 3.4) + pry (0.9.12.6-java) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + spoon (~> 0.0) rack (1.5.2) rake (10.1.1) rdoc (4.1.1) @@ -59,8 +70,11 @@ GEM diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) slop (3.4.7) + spoon (0.0.4) + ffi PLATFORMS + java ruby DEPENDENCIES diff --git a/README.markdown b/README.markdown index a748191..3890645 100644 --- a/README.markdown +++ b/README.markdown @@ -17,9 +17,7 @@ Any and all feedback is welcome ## Pre-requisites * Git -* Ruby version 1.9.2 or 1.9.3 - -Note jruby is currently unsupported as there is a problem with posix-spawn and jruby +* Ruby version 1.9.2, 1.9.3, 2.0.0, 2.1.0 and jruby ## Installation diff --git a/Rakefile b/Rakefile index cc72f74..307ee28 100644 --- a/Rakefile +++ b/Rakefile @@ -24,4 +24,3 @@ Jeweler::Tasks.new do |gem| # dependencies defined in Gemfile end Jeweler::RubygemsDotOrgTasks.new - From 34a6db96fd58002f008286ef5890ee71244cba86 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 26 Feb 2014 23:44:56 +0000 Subject: [PATCH 18/41] updated travis file --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 68a17f2..3b90973 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,6 @@ language: ruby rvm: - 1.9.2 - 1.9.3 + - 2.0.0 + - 2.1.0 # - jruby-19mode # JRuby in 1.9 mode From 04b25dc3a8ca38eb0992375b4355edc45045ecaa Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 26 Feb 2014 23:45:26 +0000 Subject: [PATCH 19/41] Regenerate gemspec for version 1.0.0 --- git_presenter.gemspec | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index 69823ae..22c791c 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -2,14 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- +# stub: git_presenter 1.0.0 ruby lib Gem::Specification.new do |s| s.name = "git_presenter" - s.version = "0.4.0" + s.version = "1.0.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.require_paths = ["lib"] s.authors = ["Colin Gemmell"] - s.date = "2012-07-10" + s.date = "2014-02-26" s.description = "Code presentation tool using git" s.email = "pythonandchips@gmail.com" s.executables = ["git-presenter"] @@ -46,35 +48,34 @@ Gem::Specification.new do |s| ] s.homepage = "http://github.com/pythonandchips/git-presenter" s.licenses = ["MIT"] - s.require_paths = ["lib"] - s.rubygems_version = "1.8.15" + s.rubygems_version = "2.2.2" s.summary = "Code presentation tool using git" if s.respond_to? :specification_version then - s.specification_version = 3 + s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, ["~> 2.1"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 2.7"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, ["~> 1.6"]) - s.add_development_dependency(%q, [">= 0"]) else + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 1.6"]) - s.add_dependency(%q, [">= 0"]) end else + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 2.7"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 1.6"]) - s.add_dependency(%q, [">= 0"]) end end From 502347dd08feefb469b9a0f252f8fe3c39602fc4 Mon Sep 17 00:00:00 2001 From: Zamith Date: Sat, 7 Jun 2014 19:07:23 +0100 Subject: [PATCH 20/41] Adds support for multiple presentations on different branches * Saves the current branch in `.presentation` at the time of initialization * The exit command checks out to that branch instead of always checking out to master --- lib/git_presenter.rb | 6 +++--- lib/git_presenter/controller.rb | 7 +++++-- lib/git_presenter/presentation.rb | 3 ++- spec/integration/initialize_presentation_spec.rb | 6 ++++++ spec/lib/git_presenter/presentation_spec.rb | 14 +++++++++++++- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/git_presenter.rb b/lib/git_presenter.rb index e9ff87b..e98f8ef 100644 --- a/lib/git_presenter.rb +++ b/lib/git_presenter.rb @@ -4,9 +4,9 @@ require 'launchy' class GitPresenter - require 'git_presenter/presentation' - require 'git_presenter/controller' - require 'git_presenter/slide' + require_relative 'git_presenter/presentation' + require_relative 'git_presenter/controller' + require_relative 'git_presenter/slide' def initialize(current_dir, interactive=true) @controller = Controller.new(current_dir) diff --git a/lib/git_presenter/controller.rb b/lib/git_presenter/controller.rb index 7de3789..b372785 100644 --- a/lib/git_presenter/controller.rb +++ b/lib/git_presenter/controller.rb @@ -6,7 +6,7 @@ def initialize(file_path) end def initialise_presentation - yaml = {"slides" => create_slides}.to_yaml + yaml = {"slides" => create_slides, "branch" => current_branch}.to_yaml File.open(presentation_file_location, "w") do |file| file.write(yaml) end @@ -24,7 +24,6 @@ def start_presentation def update_presentation yaml = YAML.parse(File.open(@presentation_dir + "/.presentation", "r")).to_ruby slides = create_slides(yaml['slides'].last["slide"]["commit"]) - last_commit = yaml["slides"].last yaml["slides"] = yaml["slides"] + slides yaml["slides"].uniq! write_file(yaml.to_yaml) @@ -54,4 +53,8 @@ def create_slides(last_commit=nil) } end end + + def current_branch + `git rev-parse --abbrev-ref HEAD`.strip + end end diff --git a/lib/git_presenter/presentation.rb b/lib/git_presenter/presentation.rb index d36eb53..e59d522 100644 --- a/lib/git_presenter/presentation.rb +++ b/lib/git_presenter/presentation.rb @@ -2,6 +2,7 @@ class GitPresenter::Presentation attr_reader :slides, :current_slide def initialize(presentation) + @branch = presentation["branch"] @slides = presentation["slides"].map{|slide| GitPresenter::Slide.new(slide["slide"])} @current_slide = slides.first end @@ -39,7 +40,7 @@ def status_line end def exit - `git checkout -q master` + `git checkout -q #{@branch}` :exit end diff --git a/spec/integration/initialize_presentation_spec.rb b/spec/integration/initialize_presentation_spec.rb index 84b9f22..0eec84a 100644 --- a/spec/integration/initialize_presentation_spec.rb +++ b/spec/integration/initialize_presentation_spec.rb @@ -20,6 +20,12 @@ end end + it 'should have a branch note' do + @helper.initialise_presentation do |commits, yaml| + yaml["branch"].should_not be_nil + end + end + it "should contain a line for each commit to the repository" do @helper.initialise_presentation do |commits, yaml| yaml["slides"].length.should eql commits.length diff --git a/spec/lib/git_presenter/presentation_spec.rb b/spec/lib/git_presenter/presentation_spec.rb index 5a24142..d988cb9 100644 --- a/spec/lib/git_presenter/presentation_spec.rb +++ b/spec/lib/git_presenter/presentation_spec.rb @@ -4,7 +4,8 @@ let(:presentation){ {"slides" => [ {"slide" => {"commit" => "0"}}, {"slide" => {"commit" => "1"}}, - {"slide" => {"commit" => "2"}}] + {"slide" => {"commit" => "2"}}], + "branch" => "test" } } context "when displaying the command line" do @@ -83,5 +84,16 @@ def given_command(command) context "with help" do it { given_command("help").should eql :help} end + + context "with exit" do + it { given_command("exit").should eql :exit} + it 'checks out to the correct branch' do + presenter = GitPresenter::Presentation.new(presentation) + + expect(presenter).to receive(:'`').with("git checkout -q #{presentation['branch']}") + + presenter.exit + end + end end end From 55b13ff43931f6b20c03149fd76fa6c25d95ebc9 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 14 Jun 2014 15:38:40 +0100 Subject: [PATCH 21/41] added zamith as a contributor --- README.markdown | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 380401e..098b6f8 100644 --- a/README.markdown +++ b/README.markdown @@ -35,7 +35,7 @@ gem install git_presenter * start/s: move to start of presentation * list/l : list slides in presentation * help/h: display this message - + ## Other resources There are couple of videos showing git presenter and how to us it * (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 * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * 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. +## Contributors + +* (Luís Ferreira - Zamith)[https://github.com/zamith] + ## Copyright Copyright (c) 2012 Colin Gemmell From 053cd5236fccacefaaf0fe401ccb9c163f345814 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 14 Jun 2014 15:39:57 +0100 Subject: [PATCH 22/41] updated travis file to run rspec --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3b90973..7bf5931 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,3 +5,4 @@ rvm: - 2.0.0 - 2.1.0 # - jruby-19mode # JRuby in 1.9 mode +script: "bundle exec rspec spec" From 946db22f3555d52734ee158d8722eab1f1176dfd Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 14 Jun 2014 15:42:45 +0100 Subject: [PATCH 23/41] Version bump to 1.1.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index afaf360..1cc5f65 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.1.0 \ No newline at end of file From 7b5aa0d4b5b2c5702cc3a36a672dbbc7ba7a3600 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 14 Jun 2014 15:42:50 +0100 Subject: [PATCH 24/41] Regenerate gemspec for version 1.1.0 --- git_presenter.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index 22c791c..0ebbf8f 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: git_presenter 1.0.0 ruby lib +# stub: git_presenter 1.1.0 ruby lib Gem::Specification.new do |s| s.name = "git_presenter" - s.version = "1.0.0" + s.version = "1.1.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Colin Gemmell"] - s.date = "2014-02-26" + s.date = "2014-06-14" s.description = "Code presentation tool using git" s.email = "pythonandchips@gmail.com" s.executables = ["git-presenter"] From cf0569c871fea04562daef53dbd49a666c87b5e3 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 14 Jun 2014 15:48:31 +0100 Subject: [PATCH 25/41] Update to use drone.io for build --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 098b6f8..b9754f0 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ # git-presenter -[![Build Status](https://secure.travis-ci.org/pythonandchips/git-presenter.png?branch=master)](http://travis-ci.org/pythonandchips/git-presenter) +[![Build Status](https://drone.io/github.com/pythonandchips/git-presenter/status.png)](https://drone.io/github.com/pythonandchips/git-presenter/latest) When presenting code live on stage you have a few choices: From 3ebd79ca31bc981623ca4ee93d71837ea4cabea1 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 9 Jul 2014 21:42:08 +0100 Subject: [PATCH 26/41] add command mode for text editor integration --- README.markdown | 9 ++++++++- bin/git-presenter | 8 +++++++- lib/git_presenter.rb | 8 ++++++++ lib/git_presenter/controller.rb | 8 ++++++-- lib/git_presenter/presentation.rb | 12 +++++++++--- lib/git_presenter/shell.rb | 5 +++++ .../moving_through_presentation_spec.rb | 9 +++++++++ spec/lib/git_presenter/presentation_spec.rb | 16 ++++++++++++++-- spec/support/git_helpers.rb | 9 +++++++-- 9 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 lib/git_presenter/shell.rb diff --git a/README.markdown b/README.markdown index 098b6f8..68a34df 100644 --- a/README.markdown +++ b/README.markdown @@ -36,6 +36,14 @@ gem install git_presenter * list/l : list slides in presentation * help/h: display this message +###Command mode + +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. + +To start a presentation in command mode use "git-presenter start -c" + +Once started you run "git-presenter {{command}}" e.g. to move to the next slide run "git-presenter next" + ## Other resources There are couple of videos showing git presenter and how to us it * (video 1)[https://vimeo.com/38949496] @@ -82,4 +90,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/bin/git-presenter b/bin/git-presenter index b7be041..96826dc 100644 --- a/bin/git-presenter +++ b/bin/git-presenter @@ -4,5 +4,11 @@ require_relative "../lib/git_presenter" YAML::ENGINE.yamler = 'psych' -presenter = GitPresenter.new(Dir.pwd) +if ARGV[1] == "-c" + interactive = false +else + interactive = true +end + +presenter = GitPresenter.new(Dir.pwd, interactive) presenter.execute(ARGV[0]) diff --git a/lib/git_presenter.rb b/lib/git_presenter.rb index e98f8ef..0bd4efb 100644 --- a/lib/git_presenter.rb +++ b/lib/git_presenter.rb @@ -7,6 +7,7 @@ class GitPresenter require_relative 'git_presenter/presentation' require_relative 'git_presenter/controller' require_relative 'git_presenter/slide' + require_relative 'git_presenter/shell' def initialize(current_dir, interactive=true) @controller = Controller.new(current_dir) @@ -24,11 +25,18 @@ def execute(command) elsif command == 'update' @controller.update_presentation else + if @presentation.nil? + @presentation = @controller.load_presentation + end puts @presentation.execute(command) end @presentation end + def current_slide + @presentation.current_slide + end + private def enter_run_loop diff --git a/lib/git_presenter/controller.rb b/lib/git_presenter/controller.rb index b372785..c047ba2 100644 --- a/lib/git_presenter/controller.rb +++ b/lib/git_presenter/controller.rb @@ -14,9 +14,13 @@ def initialise_presentation puts "run 'git-presenter start' to begin the presentation" end - def start_presentation + def load_presentation yaml = YAML.parse(File.open(@presentation_dir + "/.presentation", "r")).to_ruby - presenter = GitPresenter::Presentation.new(yaml) + GitPresenter::Presentation.new(yaml) + end + + def start_presentation + presenter = load_presentation puts presenter.start presenter end diff --git a/lib/git_presenter/presentation.rb b/lib/git_presenter/presentation.rb index e59d522..ebf00cc 100644 --- a/lib/git_presenter/presentation.rb +++ b/lib/git_presenter/presentation.rb @@ -1,10 +1,16 @@ class GitPresenter::Presentation attr_reader :slides, :current_slide - def initialize(presentation) + def initialize(presentation, shell=GitPresenter::Shell.new) @branch = presentation["branch"] @slides = presentation["slides"].map{|slide| GitPresenter::Slide.new(slide["slide"])} - @current_slide = slides.first + @shell = shell + @current_slide = find_current_slide + end + + def find_current_slide + sha = @shell.run("git rev-parse HEAD").strip + @slides.detect{|s| s.commit == sha} end def command_for(command) @@ -45,7 +51,7 @@ def exit end def position - slides.index(@current_slide) + @slides.index(@current_slide) end def total_slides diff --git a/lib/git_presenter/shell.rb b/lib/git_presenter/shell.rb new file mode 100644 index 0000000..9da374d --- /dev/null +++ b/lib/git_presenter/shell.rb @@ -0,0 +1,5 @@ +class GitPresenter::Shell + def run(command) + `#{command}`.strip + end +end diff --git a/spec/integration/moving_through_presentation_spec.rb b/spec/integration/moving_through_presentation_spec.rb index da53ee2..b6c243f 100644 --- a/spec/integration/moving_through_presentation_spec.rb +++ b/spec/integration/moving_through_presentation_spec.rb @@ -184,4 +184,13 @@ end end end + + context "when running in command mode" do + it "should set the current slide to commit" do + @helper.start_presentation([], 1) do |commits, presenter| + presenter.execute("list") + presenter.current_slide.commit.should eql commits[1].sha + end + end + end end diff --git a/spec/lib/git_presenter/presentation_spec.rb b/spec/lib/git_presenter/presentation_spec.rb index d988cb9..56aa733 100644 --- a/spec/lib/git_presenter/presentation_spec.rb +++ b/spec/lib/git_presenter/presentation_spec.rb @@ -1,5 +1,14 @@ require "spec_helper" +class FakeShell + attr_reader :ran_commands + def initialize() + @ran_commands = [] + end + def run(command) + @ran_commands << command + end +end describe GitPresenter::Presentation do let(:presentation){ {"slides" => [ {"slide" => {"commit" => "0"}}, @@ -8,9 +17,11 @@ "branch" => "test" } } + let(:fake_shell){ FakeShell.new } context "when displaying the command line" do it "should display the current position" do - presenter = GitPresenter::Presentation.new(presentation) + fake_shell.should_receive(:run).with("git rev-parse HEAD").and_return("0") + presenter = GitPresenter::Presentation.new(presentation, fake_shell) presenter.status_line.should eql "1/3 >" end end @@ -18,7 +29,8 @@ context "when calculating the position" do it "should return the index of the current commit" do - presenter = GitPresenter::Presentation.new(presentation) + fake_shell.should_receive(:run).with("git rev-parse HEAD").and_return("0") + presenter = GitPresenter::Presentation.new(presentation, fake_shell) presenter.position.should eql 0 end end diff --git a/spec/support/git_helpers.rb b/spec/support/git_helpers.rb index 3f3b6c5..547320b 100644 --- a/spec/support/git_helpers.rb +++ b/spec/support/git_helpers.rb @@ -71,12 +71,17 @@ def initialise_presentation(params={}) commits end - def start_presentation(commands=[]) + def start_presentation(commands=[], start_slide=0) commits = initialise_presentation({:delay => true}) Dir.chdir(@presentation_dir) do add_commands(commands) unless commands.empty? + if start_slide != 0 + `git checkout -q #{commits[start_slide]}` + end presenter = GitPresenter.new('.', false) - presenter = presenter.execute('start') + if start_slide == 0 + presenter = presenter.execute('start') + end yield(commits, presenter) if block_given? end end From 9179a90340f04fca9458c374cbd0ffc13be0d3cf Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 9 Jul 2014 21:43:14 +0100 Subject: [PATCH 27/41] Version bump to 1.2.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1cc5f65..867e524 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.0 \ No newline at end of file +1.2.0 \ No newline at end of file From 2d7ee6ffb356e94e5ace6213af2c6590c312c274 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Wed, 9 Jul 2014 21:43:20 +0100 Subject: [PATCH 28/41] Regenerate gemspec for version 1.2.0 --- git_presenter.gemspec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index 0ebbf8f..58feed8 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: git_presenter 1.1.0 ruby lib +# stub: git_presenter 1.2.0 ruby lib Gem::Specification.new do |s| s.name = "git_presenter" - s.version = "1.1.0" + s.version = "1.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Colin Gemmell"] - s.date = "2014-06-14" + s.date = "2014-07-09" s.description = "Code presentation tool using git" s.email = "pythonandchips@gmail.com" s.executables = ["git-presenter"] @@ -33,6 +33,7 @@ Gem::Specification.new do |s| "lib/git_presenter.rb", "lib/git_presenter/controller.rb", "lib/git_presenter/presentation.rb", + "lib/git_presenter/shell.rb", "lib/git_presenter/slide.rb", "spec/bugs/max_10_commits_being_parsed_spec.rb", "spec/integration/initialize_presentation_spec.rb", From f143c6c807730f0b4b0b1c9637588a1b6984db0f Mon Sep 17 00:00:00 2001 From: Joe Wright Date: Mon, 11 Sep 2017 21:10:37 +0100 Subject: [PATCH 29/41] Fix markdown syntax and minor typo --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 2d266d8..12e2089 100644 --- a/README.markdown +++ b/README.markdown @@ -36,7 +36,7 @@ gem install git_presenter * list/l : list slides in presentation * help/h: display this message -###Command mode +### Command mode 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. @@ -49,7 +49,7 @@ There are couple of videos showing git presenter and how to us it * (video 1)[https://vimeo.com/38949496] * (video 2)[https://vimeo.com/39225144] -## Bugs/Features/Prase +## Bugs/Features/Praise It you find any bugs or have some feature requests please add an issue on the repository. Or if you just want to get in touch and tell me how awesome git presenter is you can get me on twitter @colin_gemmell or drop me an email at pythonandchips{at}gmail.com From 89906f6366d7af6aae3d2b880c63b8083bd80442 Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Fri, 8 Jan 2021 15:58:34 -0700 Subject: [PATCH 30/41] build: up versions of launchy (~> 2.5) and jeweler (~> 2.3) --- Gemfile | 4 +- Gemfile.lock | 133 ++++++++++++++++++++++++++++----------------------- 2 files changed, 74 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index b1a71e5..b67cb29 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source "http://rubygems.org" # gem "activesupport", ">= 2.3.5" # gem "git" -gem "launchy", "~> 2.1" +gem 'launchy', '~> 2.5' # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. @@ -12,5 +12,5 @@ group :development do gem "pry" gem "rspec", "~> 2.7" gem "bundler" - gem "jeweler", "~> 1.6" + gem 'jeweler', '~> 2.3' end diff --git a/Gemfile.lock b/Gemfile.lock index 5682cae..6a715bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,77 +1,85 @@ GEM remote: http://rubygems.org/ specs: - addressable (2.3.5) - builder (3.2.2) - coderay (1.1.0) - diff-lcs (1.2.5) - faraday (0.8.9) - multipart-post (~> 1.2.0) - ffi (1.9.3-java) - git (1.2.6) - github_api (0.10.1) - addressable - faraday (~> 0.8.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + builder (3.2.4) + coderay (1.1.3) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + diff-lcs (1.4.4) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) + ffi (1.14.2-java) + git (1.8.1) + rchardet (~> 1.8) + github_api (0.11.3) + addressable (~> 2.3) + descendants_tracker (~> 0.0.1) + faraday (~> 0.8, < 0.10) hashie (>= 1.2) - multi_json (~> 1.4) - nokogiri (~> 1.5.2) + multi_json (>= 1.7.5, < 2.0) + nokogiri (~> 1.6.0) oauth2 - hashie (2.0.5) - highline (1.6.20) - jeweler (1.8.8) + hashie (4.1.0) + highline (2.0.3) + jar-dependencies (0.4.1) + jeweler (2.3.5) builder - bundler (~> 1.0) + bundler (>= 1.0) git (>= 1.2.5) - github_api (= 0.10.1) + github_api (~> 0.11.0) highline (>= 1.6.15) - nokogiri (= 1.5.10) + nokogiri (>= 1.5.10) + psych (~> 2.2) rake rdoc - json (1.8.1) - json (1.8.1-java) - jwt (0.1.11) - multi_json (>= 1.5) - launchy (2.4.2) - addressable (~> 2.3) - launchy (2.4.2-java) - addressable (~> 2.3) - spoon (~> 0.0.1) - method_source (0.8.2) - multi_json (1.8.4) - multi_xml (0.5.5) - multipart-post (1.2.0) - nokogiri (1.5.10) - nokogiri (1.5.10-java) - oauth2 (0.9.3) - faraday (>= 0.8, < 0.10) - jwt (~> 0.1.8) + semver2 + jwt (2.2.2) + launchy (2.5.0) + addressable (~> 2.7) + method_source (1.0.0) + mini_portile2 (2.1.0) + multi_json (1.15.0) + multi_xml (0.6.0) + multipart-post (2.1.1) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + nokogiri (1.6.8.1-java) + oauth2 (1.4.4) + faraday (>= 0.8, < 2.0) + jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (~> 1.2) - pry (0.9.12.6) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - pry (0.9.12.6-java) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) + rack (>= 1.2, < 3) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry (0.13.1-java) + coderay (~> 1.1) + method_source (~> 1.0) spoon (~> 0.0) - rack (1.5.2) - rake (10.1.1) - rdoc (4.1.1) - json (~> 1.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.7) - rspec-expectations (2.14.5) + psych (2.2.4) + psych (2.2.4-java) + jar-dependencies (>= 0.1.7) + public_suffix (4.0.6) + rack (2.2.3) + rake (13.0.3) + rchardet (1.8.0) + rdoc (6.3.0) + rspec (2.99.0) + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + rspec-core (2.99.2) + rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - slop (3.4.7) - spoon (0.0.4) + rspec-mocks (2.99.4) + semver2 (3.4.2) + spoon (0.0.6) ffi + thread_safe (0.3.6) + thread_safe (0.3.6-java) PLATFORMS java @@ -80,7 +88,10 @@ PLATFORMS DEPENDENCIES bundler git - jeweler (~> 1.6) - launchy (~> 2.1) + jeweler (~> 2.3) + launchy (~> 2.5) pry rspec (~> 2.7) + +BUNDLED WITH + 2.2.3 From b45895262df640c48f82da6812c8b31f027687cd Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Fri, 8 Jan 2021 16:01:24 -0700 Subject: [PATCH 31/41] refactor: use be_truthy over be_true (rspec deprecation warning) --- spec/integration/initialize_presentation_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/initialize_presentation_spec.rb b/spec/integration/initialize_presentation_spec.rb index 0eec84a..570a5cd 100644 --- a/spec/integration/initialize_presentation_spec.rb +++ b/spec/integration/initialize_presentation_spec.rb @@ -10,7 +10,7 @@ context ".presentation file" do it "should be written to root directory" do @helper.initialise_presentation do - File.exists?(".presentation").should be_true + File.exists?(".presentation").should be_truthy end end From e56ef847e38250a1663877fd4845a1e95df87fce Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Fri, 8 Jan 2021 15:59:24 -0700 Subject: [PATCH 32/41] ci: added ruby 3.0.0 to list of ci rubies --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7bf5931..7f8535f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,5 +4,6 @@ rvm: - 1.9.3 - 2.0.0 - 2.1.0 + - 3.0.0 # - jruby-19mode # JRuby in 1.9 mode script: "bundle exec rspec spec" From 0bb0e6ebb87325a3b0eab99407f9d8012bbaa397 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Mon, 11 Jan 2021 18:53:47 +0000 Subject: [PATCH 33/41] bump version. Support for ruby 3.0.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 867e524..f0bb29e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0 \ No newline at end of file +1.3.0 From cba5bb2d2d58b37ec04b97d9c4725ccb1648b9f2 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Mon, 11 Jan 2021 18:53:59 +0000 Subject: [PATCH 34/41] Regenerate gemspec for version 1.3.0 --- git_presenter.gemspec | 63 +++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index 58feed8..513c79e 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -2,19 +2,19 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: git_presenter 1.2.0 ruby lib +# stub: git_presenter 1.3.0 ruby lib Gem::Specification.new do |s| - s.name = "git_presenter" - s.version = "1.2.0" + s.name = "git_presenter".freeze + s.version = "1.3.0" - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.require_paths = ["lib"] - s.authors = ["Colin Gemmell"] - s.date = "2014-07-09" - s.description = "Code presentation tool using git" - s.email = "pythonandchips@gmail.com" - s.executables = ["git-presenter"] + s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= + s.require_paths = ["lib".freeze] + s.authors = ["Colin Gemmell".freeze] + s.date = "2021-01-11" + s.description = "Code presentation tool using git".freeze + s.email = "pythonandchips@gmail.com".freeze + s.executables = ["git-presenter".freeze] s.extra_rdoc_files = [ "LICENSE.txt", "README.markdown" @@ -47,36 +47,29 @@ Gem::Specification.new do |s| "spec/support/command_line_helper.rb", "spec/support/git_helpers.rb" ] - s.homepage = "http://github.com/pythonandchips/git-presenter" - s.licenses = ["MIT"] - s.rubygems_version = "2.2.2" - s.summary = "Code presentation tool using git" + s.homepage = "http://github.com/pythonandchips/git-presenter".freeze + s.licenses = ["MIT".freeze] + s.rubygems_version = "3.2.3".freeze + s.summary = "Code presentation tool using git".freeze if s.respond_to? :specification_version then s.specification_version = 4 + end - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 2.1"]) - s.add_development_dependency(%q, [">= 0"]) - s.add_development_dependency(%q, ["~> 2.7"]) - s.add_development_dependency(%q, [">= 0"]) - s.add_development_dependency(%q, ["~> 1.6"]) - else - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 2.1"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 2.7"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 1.6"]) - end + if s.respond_to? :add_runtime_dependency then + s.add_runtime_dependency(%q.freeze, [">= 0"]) + s.add_runtime_dependency(%q.freeze, ["~> 2.5"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, ["~> 2.7"]) + s.add_development_dependency(%q.freeze, [">= 0"]) + s.add_development_dependency(%q.freeze, ["~> 2.3"]) else - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 2.1"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 2.7"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 1.6"]) + s.add_dependency(%q.freeze, [">= 0"]) + s.add_dependency(%q.freeze, ["~> 2.5"]) + s.add_dependency(%q.freeze, [">= 0"]) + s.add_dependency(%q.freeze, ["~> 2.7"]) + s.add_dependency(%q.freeze, [">= 0"]) + s.add_dependency(%q.freeze, ["~> 2.3"]) end end From b96a63b9bcb15a8daf11af9572a0d7dcb6409d30 Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Wed, 13 Jan 2021 11:17:19 -0700 Subject: [PATCH 35/41] fix: 'handle uninitialized constant Psych::ENGINE (NameError)' in ruby >2.2 --- bin/git-presenter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-presenter b/bin/git-presenter index 96826dc..20d2966 100644 --- a/bin/git-presenter +++ b/bin/git-presenter @@ -2,7 +2,7 @@ require "rubygems" require_relative "../lib/git_presenter" -YAML::ENGINE.yamler = 'psych' +YAML::ENGINE.yamler = 'psych' if defined?(Psych::ENGINE) if ARGV[1] == "-c" interactive = false From d98556b7926c6a13cebfcb8db5f83c9dfea85e93 Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Wed, 13 Jan 2021 11:20:37 -0700 Subject: [PATCH 36/41] build: gitignore *.gem and a_file.rb test product --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 1bef0bd..850f17e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ doc .bundle pkg presentation +a_file.rb +git_presenter*.gem From b133c3a4879d159566be3d5882caae2272e043bd Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 1 May 2021 17:28:49 +0100 Subject: [PATCH 37/41] update gems --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6a715bd..3c61f02 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GEM diff-lcs (1.4.4) faraday (0.9.2) multipart-post (>= 1.2, < 3) - ffi (1.14.2-java) + ffi (1.15.0-java) git (1.8.1) rchardet (~> 1.8) github_api (0.11.3) @@ -35,7 +35,7 @@ GEM rake rdoc semver2 - jwt (2.2.2) + jwt (2.2.3) launchy (2.5.0) addressable (~> 2.7) method_source (1.0.0) @@ -46,16 +46,16 @@ GEM nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) nokogiri (1.6.8.1-java) - oauth2 (1.4.4) + oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - pry (0.13.1) + pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - pry (0.13.1-java) + pry (0.14.1-java) coderay (~> 1.1) method_source (~> 1.0) spoon (~> 0.0) From b6ea8310613261d124d34efaa938d428093a391d Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 1 May 2021 17:33:21 +0100 Subject: [PATCH 38/41] bump version --- VERSION | 2 +- bin/git-presenter | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 bin/git-presenter diff --git a/VERSION b/VERSION index f0bb29e..88c5fb8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.0 +1.4.0 diff --git a/bin/git-presenter b/bin/git-presenter old mode 100644 new mode 100755 From 4b14f3d2a529e5d4a27de46bf0ca57d7988f9231 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 1 May 2021 18:01:31 +0100 Subject: [PATCH 39/41] use env to start ruby --- bin/git-presenter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-presenter b/bin/git-presenter index 20d2966..f2c7fe8 100755 --- a/bin/git-presenter +++ b/bin/git-presenter @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby require "rubygems" require_relative "../lib/git_presenter" From 814f271a97dd61686147929614a6f0bb20053158 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 1 May 2021 18:24:42 +0100 Subject: [PATCH 40/41] update rspec --- Gemfile | 12 +++---- Gemfile.lock | 33 +++++++++-------- spec/bugs/max_10_commits_being_parsed_spec.rb | 2 +- .../initialize_presentation_spec.rb | 12 +++---- .../moving_through_presentation_spec.rb | 36 +++++++++---------- spec/integration/start_presentation_spec.rb | 10 +++--- spec/integration/update_presentation_spec.rb | 8 ++--- spec/lib/git_presenter/presentation_spec.rb | 34 +++++++++--------- spec/lib/git_presenter/slide_spec.rb | 16 ++++----- 9 files changed, 84 insertions(+), 79 deletions(-) diff --git a/Gemfile b/Gemfile index b67cb29..23ca1d6 100644 --- a/Gemfile +++ b/Gemfile @@ -3,14 +3,14 @@ source "http://rubygems.org" # Example: # gem "activesupport", ">= 2.3.5" # -gem "git" -gem 'launchy', '~> 2.5' +gem "git", "1.8.1" +gem 'launchy', "2.5.0" # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do - gem "pry" - gem "rspec", "~> 2.7" - gem "bundler" - gem 'jeweler', '~> 2.3' + gem "pry", "0.14.1" + gem "rspec", "3.10.0" + gem "bundler", "2.2.3" + gem 'jeweler', "2.3.5" end diff --git a/Gemfile.lock b/Gemfile.lock index 3c61f02..7e15336 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,14 +67,19 @@ GEM rake (13.0.3) rchardet (1.8.0) rdoc (6.3.0) - rspec (2.99.0) - rspec-core (~> 2.99.0) - rspec-expectations (~> 2.99.0) - rspec-mocks (~> 2.99.0) - rspec-core (2.99.2) - rspec-expectations (2.99.2) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.99.4) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.1) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-support (3.10.2) semver2 (3.4.2) spoon (0.0.6) ffi @@ -86,12 +91,12 @@ PLATFORMS ruby DEPENDENCIES - bundler - git - jeweler (~> 2.3) - launchy (~> 2.5) - pry - rspec (~> 2.7) + bundler (= 2.2.3) + git (= 1.8.1) + jeweler (= 2.3.5) + launchy (= 2.5.0) + pry (= 0.14.1) + rspec (= 3.10.0) BUNDLED WITH 2.2.3 diff --git a/spec/bugs/max_10_commits_being_parsed_spec.rb b/spec/bugs/max_10_commits_being_parsed_spec.rb index d4706c3..3e966d1 100644 --- a/spec/bugs/max_10_commits_being_parsed_spec.rb +++ b/spec/bugs/max_10_commits_being_parsed_spec.rb @@ -7,7 +7,7 @@ it "should parse more than 10 commits" do @helper.initialise_presentation({:no_of_commits => 13}) do |commits, yaml| - yaml["slides"].length.should eql 13 + expect(yaml["slides"].length).to eql 13 end end end diff --git a/spec/integration/initialize_presentation_spec.rb b/spec/integration/initialize_presentation_spec.rb index 570a5cd..8653628 100644 --- a/spec/integration/initialize_presentation_spec.rb +++ b/spec/integration/initialize_presentation_spec.rb @@ -10,37 +10,37 @@ context ".presentation file" do it "should be written to root directory" do @helper.initialise_presentation do - File.exists?(".presentation").should be_truthy + expect(File.exists?(".presentation")).to be_truthy end end it "should have a slides node" do @helper.initialise_presentation do |commits, yaml| - yaml["slides"].should_not be_nil + expect(yaml["slides"]).not_to be_nil end end it 'should have a branch note' do @helper.initialise_presentation do |commits, yaml| - yaml["branch"].should_not be_nil + expect(yaml["branch"]).not_to be_nil end end it "should contain a line for each commit to the repository" do @helper.initialise_presentation do |commits, yaml| - yaml["slides"].length.should eql commits.length + expect(yaml["slides"].length).not_to eql commits.length end end it "first line should contain the first commit number" do @helper.initialise_presentation({:delay => true}) do |commits, yaml| - yaml["slides"][0]["slide"]["commit"].should eql commits.first.sha + expect(yaml["slides"][0]["slide"]["commit"]).to eql commits.first.sha end end it "second line should contain the second commit number" do @helper.initialise_presentation({:delay => true}) do |commits, yaml| - yaml["slides"][1]["slide"]["commit"].should eql commits[1].sha + expect(yaml["slides"][1]["slide"]["commit"]).to eql commits[1].sha end end end diff --git a/spec/integration/moving_through_presentation_spec.rb b/spec/integration/moving_through_presentation_spec.rb index b6c243f..7dd7e49 100644 --- a/spec/integration/moving_through_presentation_spec.rb +++ b/spec/integration/moving_through_presentation_spec.rb @@ -11,7 +11,7 @@ it "should move to the next commit" do @helper.start_presentation do |commits, presenter| presenter.execute("next") - @helper.head_position.should eql commits[1].sha + expect(@helper.head_position).to eql commits[1].sha end end @@ -19,7 +19,7 @@ @helper.start_presentation do |commits, presenter| presenter.execute("next") presenter.execute("next") - @helper.head_position.should eql commits[2].sha + expect(@helper.head_position).to eql commits[2].sha end end end @@ -30,7 +30,7 @@ presenter.execute("next") @helper.edit_file("inner commit") presenter.execute("next") - @helper.head_position.should eql commits[2].sha + expect(@helper.head_position).to eql commits[2].sha end end end @@ -42,7 +42,7 @@ presenter.execute("next") presenter.execute("next") presenter.execute("next") - @helper.head_position.should eql commits[2].sha + expect(@helper.head_position).to eql commits[2].sha end end end @@ -53,7 +53,7 @@ presenter.execute("next") presenter.execute("next") presenter.execute("back") - @helper.head_position.should eql commits[1].sha + expect(@helper.head_position).to eql commits[1].sha end end end @@ -67,7 +67,7 @@ presenter.execute("back") presenter.execute("back") presenter.execute("back") - @helper.head_position.should eql commits[0].sha + expect(@helper.head_position).to eql commits[0].sha end end end @@ -78,7 +78,7 @@ presenter.execute("next") presenter.execute("next") presenter.execute("start") - @helper.head_position.should eql commits[0].sha + expect(@helper.head_position).to eql commits[0].sha end end end @@ -87,7 +87,7 @@ it "should move the last commit" do @helper.start_presentation do |commits, presenter| presenter.execute("end") - @helper.head_position.should eql commits.last.sha + expect(@helper.head_position).to eql commits.last.sha end end end @@ -96,7 +96,7 @@ it "should checkout the specific commit" do @helper.start_presentation do |commits, presenter| presenter.execute("2") - @helper.head_position.should eql commits[1].sha + expect(@helper.head_position).to eql commits[1].sha end end end @@ -106,7 +106,7 @@ @helper.start_presentation do |commits, presenter| expected_output = (["*#{commits.first.sha[0..9]}, #{commits.first.message}"] + commits[1..-1].map{|commit| "#{commit.sha[0..9]}, #{commit.message}"}).join("\n") presentation = presenter.execute("list") - presentation.should eql expected_output + expect(presentation).to eql expected_output end end end @@ -127,7 +127,7 @@ exit: exit from the presentation EOH message = presenter.execute("help") - message.should eql help_text + expect(message).to eql help_text end end end @@ -138,7 +138,7 @@ @helper.start_presentation([:run => "echo hello world"]) do |commits, presenter| presenter.execute("next") presenter.execute("next") - presenter.execute("next").strip.should eql "hello world" + expect(presenter.execute("next").strip).to eql "hello world" end end end @@ -148,7 +148,7 @@ command_line_helper = CommandLineHelper.capture_output @helper.start_presentation([:run => "echo hello world",:on_slide => 2]) do |commits, presenter| presenter.execute("next") - presenter.execute("next").should eql "#{commits[2].message}\nhello world\n" + expect(presenter.execute("next")).to eql "#{commits[2].message}\nhello world\n" end end end @@ -158,7 +158,7 @@ command_line_helper = CommandLineHelper.capture_output @helper.start_presentation do |commits, presenter| presenter.execute("!echo hello world") - command_line_helper.command_output.strip.should end_with "hello world" + expect(command_line_helper.command_output.strip).to end_with "hello world" end end end @@ -167,7 +167,7 @@ it "should open the with launchy" do command_line_helper = CommandLineHelper.capture_output @helper.start_presentation([:launch => 'readme', :on_slide => 2]) do |commits, presenter| - Launchy.should_receive(:open).with('readme').once + expect(Launchy).to receive(:open).with('readme').once presenter.execute("next") presenter.execute("next") end @@ -179,8 +179,8 @@ @helper.start_presentation do |commits, presenter| presenter.execute("next") presenter.execute("exit") - @helper.current_branch.should_not be_nil - @helper.current_branch.should eql "master" + expect(@helper.current_branch).not_to be_nil + expect(@helper.current_branch).to eql "master" end end end @@ -189,7 +189,7 @@ it "should set the current slide to commit" do @helper.start_presentation([], 1) do |commits, presenter| presenter.execute("list") - presenter.current_slide.commit.should eql commits[1].sha + expect(presenter.current_slide.commit).to eql commits[1].sha end end end diff --git a/spec/integration/start_presentation_spec.rb b/spec/integration/start_presentation_spec.rb index d2f88d2..b820638 100644 --- a/spec/integration/start_presentation_spec.rb +++ b/spec/integration/start_presentation_spec.rb @@ -13,32 +13,32 @@ Dir.chdir(presentation_dir) do presenter = GitPresenter.new(".", false) presentation = presenter.execute('start') - presentation.slides.length.should eql 4 + expect(presentation.slides.length).to eql 4 end end it "first commit should be first commit in file" do @helper.start_presentation do |commits, presenter| - presenter.slides[0].commit.should eql commits[0].sha + expect(presenter.slides[0].commit).to eql commits[0].sha end end it "second commit should be second commit in file" do @helper.start_presentation do |commits, presenter| - presenter.slides[1].commit.should eql commits[1].sha + expect(presenter.slides[1].commit).to eql commits[1].sha end end it "the last commit should be a command" do command = "echo hello world" @helper.start_presentation([:run => command]) do |commits, presenter| - presenter.slides[3].run.should eql command + expect(presenter.slides[3].run).to eql command end end it "should have the presentation at first commit" do @helper.start_presentation do |commits, presenter| - @helper.head_position.should eql commits.first.sha + expect(@helper.head_position).to eql commits.first.sha end end end diff --git a/spec/integration/update_presentation_spec.rb b/spec/integration/update_presentation_spec.rb index bfb1103..fafb4d6 100644 --- a/spec/integration/update_presentation_spec.rb +++ b/spec/integration/update_presentation_spec.rb @@ -10,7 +10,7 @@ commits = @helper.initialise_presentation({:delay => true}) new_commit = @helper.edit_file_and_commit("forth commit", "d") @helper.update_presentation do |yaml| - yaml["slides"].length.should eql (commits.length + 1) + expect(yaml["slides"].length).to eql (commits.length + 1) end end @@ -18,7 +18,7 @@ commits = @helper.initialise_presentation({:delay => true}) new_commit = @helper.edit_file_and_commit("forth commit", "d") @helper.update_presentation do |yaml| - yaml["slides"].last["slide"]["commit"].should eql new_commit.sha + expect(yaml["slides"].last["slide"]["commit"]).to eql new_commit.sha end end @@ -27,7 +27,7 @@ removed_commit = @helper.remove_from_presentation_at(1) new_commit = @helper.edit_file_and_commit("forth commit", "d") @helper.update_presentation do |yaml| - yaml["slides"].length.should eql (commits.length) + expect(yaml["slides"].length).to eql (commits.length) end end @@ -36,7 +36,7 @@ removed_commit = @helper.remove_from_presentation_at(1) new_commit = @helper.edit_file_and_commit("forth commit", "d") @helper.update_presentation - @command_line.command_output.should include "Your presentation has been updated" + expect(@command_line.command_output).to include "Your presentation has been updated" end end diff --git a/spec/lib/git_presenter/presentation_spec.rb b/spec/lib/git_presenter/presentation_spec.rb index 56aa733..c40ef5c 100644 --- a/spec/lib/git_presenter/presentation_spec.rb +++ b/spec/lib/git_presenter/presentation_spec.rb @@ -22,16 +22,16 @@ def run(command) it "should display the current position" do fake_shell.should_receive(:run).with("git rev-parse HEAD").and_return("0") presenter = GitPresenter::Presentation.new(presentation, fake_shell) - presenter.status_line.should eql "1/3 >" + expect(presenter.status_line).to eql "1/3 >" end end context "when calculating the position" do it "should return the index of the current commit" do - fake_shell.should_receive(:run).with("git rev-parse HEAD").and_return("0") + expect(fake_shell).to receive(:run).with("git rev-parse HEAD").and_return("0") presenter = GitPresenter::Presentation.new(presentation, fake_shell) - presenter.position.should eql 0 + expect(presenter.position).to eql 0 end end @@ -42,59 +42,59 @@ def given_command(command) end context "with bash command" do - it { given_command("!echo hello world").should eql :command } + it { expect(given_command("!echo hello world")).to eql :command } end context "with next" do - it { given_command("next").should eql :next } + it { expect(given_command("next")).to eql :next } end context "with next" do - it { given_command("n").should eql :next } + it { expect(given_command("n")).to eql :next } end context "with back" do - it { given_command("back").should eql :previous } + it { expect(given_command("back")).to eql :previous } end context "with b" do - it { given_command("b").should eql :previous } + it { expect(given_command("b")).to eql :previous } end context "with start" do - it { given_command("start").should eql :start } + it { expect(given_command("start")).to eql :start } end context "with s" do - it { given_command("s").should eql :start } + it { expect(given_command("s")).to eql :start } end context "with end" do - it { given_command("end").should eql :end } + it { expect(given_command("end")).to eql :end } end context "with e" do - it { given_command("e").should eql :end } + it { expect(given_command("e")).to eql :end } end context "with list" do - it { given_command("list").should eql :list } + it { expect(given_command("list")).to eql :list } end context "with l" do - it { given_command("l").should eql :list } + it { expect(given_command("l")).to eql :list } end context "with any number" do - it { given_command("6").should eql :commit} + it { expect(given_command("6")).to eql :commit} end context "with h" do - it { given_command("h").should eql :help} + it { expect(given_command("h")).to eql :help} end context "with help" do - it { given_command("help").should eql :help} + it { expect(given_command("help")).to eql :help} end context "with exit" do diff --git a/spec/lib/git_presenter/slide_spec.rb b/spec/lib/git_presenter/slide_spec.rb index ca127f4..b4bff4f 100644 --- a/spec/lib/git_presenter/slide_spec.rb +++ b/spec/lib/git_presenter/slide_spec.rb @@ -4,12 +4,12 @@ context "when displaying as string" do it "should write out the commit id and the message" do slide = GitPresenter::Slide.new({"commit" => "012345678901234567890","message" => "message"}) - slide.to_s.should eql "0123456789, message" + expect(slide.to_s).to eql "0123456789, message" end it "should not blow up if no command exists" do slide = GitPresenter::Slide.new({"run" => "echo hello world"}) - slide.to_s.should eql "run: echo hello world" + expect(slide.to_s).to eql "run: echo hello world" end end @@ -18,7 +18,7 @@ it "should run that command" do command_line_helper = CommandLineHelper.capture_output slide = GitPresenter::Slide.new({"run" => "echo hello world"}) - slide.execute.strip.should eql "hello world" + expect(slide.execute.strip).to eql "hello world" end end @@ -27,24 +27,24 @@ command_line_helper = CommandLineHelper.capture_output slide = GitPresenter::Slide.new({"commit" => "number", "message" => "checkout", "run" => "echo hello world"}) slide.stub(:checkout).and_return("checkout\n") - slide.execute.should eql "checkout\nhello world\n" + expect(slide.execute).to eql "checkout\nhello world\n" end end context "when slide contains a launch command" do it "should launch the application for the file type" do command_line_helper = CommandLineHelper.capture_output - Launchy.should_receive(:open).with("readme").once + expect(Launchy).to receive(:open).with("readme").once slide = GitPresenter::Slide.new({"launch" => "readme"}) slide.execute end it "should not try and launch if no launch supplied" do command_line_helper = CommandLineHelper.capture_output - Launchy.should_receive(:open).with("readme").never + expect(Launchy).to receive(:open).with("readme").never slide = GitPresenter::Slide.new({"commit" => "number", "message" => "checkout", "run" => "echo hello world"}) slide.stub(:checkout).and_return("checkout\n") - slide.execute.should eql "checkout\nhello world\n" + expect(slide.execute).to eql "checkout\nhello world\n" end end @@ -53,7 +53,7 @@ command_line_helper = CommandLineHelper.capture_output slide = GitPresenter::Slide.new({"commit" => "number", "message" => "checkout"}) slide.stub(:checkout).and_return("checkout\n") - slide.execute.should eql "checkout\n" + expect(slide.execute).to eql "checkout\n" end end end From df3372b939a0176ea8d33f9ca8111bb5ca76f3f3 Mon Sep 17 00:00:00 2001 From: Colin Gemmell Date: Sat, 1 May 2021 18:26:09 +0100 Subject: [PATCH 41/41] Regenerate gemspec for version 1.4.0 --- git_presenter.gemspec | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/git_presenter.gemspec b/git_presenter.gemspec index 513c79e..b6c4a85 100644 --- a/git_presenter.gemspec +++ b/git_presenter.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: git_presenter 1.3.0 ruby lib +# stub: git_presenter 1.4.0 ruby lib Gem::Specification.new do |s| s.name = "git_presenter".freeze - s.version = "1.3.0" + s.version = "1.4.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Colin Gemmell".freeze] - s.date = "2021-01-11" + s.date = "2021-05-01" s.description = "Code presentation tool using git".freeze s.email = "pythonandchips@gmail.com".freeze s.executables = ["git-presenter".freeze] @@ -57,19 +57,19 @@ Gem::Specification.new do |s| end if s.respond_to? :add_runtime_dependency then - s.add_runtime_dependency(%q.freeze, [">= 0"]) - s.add_runtime_dependency(%q.freeze, ["~> 2.5"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, ["~> 2.7"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, ["~> 2.3"]) + s.add_runtime_dependency(%q.freeze, ["= 1.8.1"]) + s.add_runtime_dependency(%q.freeze, ["= 2.5.0"]) + s.add_development_dependency(%q.freeze, ["= 0.14.1"]) + s.add_development_dependency(%q.freeze, ["= 3.10.0"]) + s.add_development_dependency(%q.freeze, ["= 2.2.3"]) + s.add_development_dependency(%q.freeze, ["= 2.3.5"]) else - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, ["~> 2.5"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, ["~> 2.7"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, ["~> 2.3"]) + s.add_dependency(%q.freeze, ["= 1.8.1"]) + s.add_dependency(%q.freeze, ["= 2.5.0"]) + s.add_dependency(%q.freeze, ["= 0.14.1"]) + s.add_dependency(%q.freeze, ["= 3.10.0"]) + s.add_dependency(%q.freeze, ["= 2.2.3"]) + s.add_dependency(%q.freeze, ["= 2.3.5"]) end end