Sha256: 02402604a90c529cf3907fe549249521abf626edbb069732c806c9f35a167ec1

Contents?: true

Size: 726 Bytes

Versions: 6

Compression:

Stored size: 726 Bytes

Contents

# -*- encoding : utf-8 -*-
module GitStats
  class Generator
    delegate :add_command_observer, to: :@repo
    delegate :render_all, to: :@view

    def initialize(repo_path, out_path, first_commit_sha = nil, last_commit_sha = "HEAD")
      validate_repo_path(repo_path)

      @repo = GitData::Repo.new(path: repo_path, first_commit_sha: first_commit_sha, last_commit_sha: last_commit_sha)
      view_data = StatsView::ViewData.new(@repo)
      @view = StatsView::View.new(view_data, out_path)

      yield self if block_given?
    end

    private


    def validate_repo_path(repo_path)
      raise ArgumentError, "#{repo_path} is not a git repository" unless Validator.new.valid_repo_path?(repo_path)
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git_stats-1.0.11 lib/git_stats/generator.rb
git_stats-1.0.10 lib/git_stats/generator.rb
git_stats-1.0.9 lib/git_stats/generator.rb
git_stats-1.0.8 lib/git_stats/generator.rb
git_stats-1.0.7 lib/git_stats/generator.rb
git_stats-1.0.6 lib/git_stats/generator.rb