Sha256: d0fc255b8843d2c5a43dc01c8be6e0d454de49a8680c88236262c5efd0231ca4

Contents?: true

Size: 604 Bytes

Versions: 6

Compression:

Stored size: 604 Bytes

Contents

class GitPresenter::Slide
  attr_reader :commit, :message, :run

  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

  def to_s
    return "#{@commit[0..9]}, #{@message}" unless @commit.nil?
    "run: #{@run}"
  end

  private

  def checkout
    `git checkout -q . `
    `git checkout -q #{@commit}`
    @message + "\n"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git_presenter-1.4.0 lib/git_presenter/slide.rb
git_presenter-1.3.0 lib/git_presenter/slide.rb
git_presenter-1.2.0 lib/git_presenter/slide.rb
git_presenter-1.1.0 lib/git_presenter/slide.rb
git_presenter-1.0.0 lib/git_presenter/slide.rb
git_presenter-0.4.0 lib/git_presenter/slide.rb