Sha256: 1b595da2df25e48a2b713d621e76482af34d224293f76c61e2829d4c06212879

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require 'git'
require 'yaml'
require 'readline'
require 'launchy'

class GitPresenter
  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)
    @interactive = interactive
  end

  def execute(command)
    if command == 'init'
      @controller.initialise_presentation
    elsif command == 'start'
      @presentation = @controller.start_presentation
      if @interactive
        enter_run_loop
      end
    elsif command == 'update'
      @controller.update_presentation
    else
      puts @presentation.execute(command)
    end
    @presentation
  end

  private

  def enter_run_loop
    while command = Readline.readline(@presentation.status_line, true)
      result = @presentation.execute(command)
      exit if result == :exit
      puts result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_presenter-1.1.0 lib/git_presenter.rb