Class: Licensee::GitProject

Inherits:
Project
  • Object
show all
Defined in:
lib/licensee/project.rb

Overview

Git-based project

analyze a given git repository for license information

Defined Under Namespace

Classes: InvalidRepository

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Project

#detect_packages?, #license, #license_file, #matched_file, #package_file

Constructor Details

#initialize(repo, revision: nil, detect_packages: false) ⇒ GitProject

Returns a new instance of GitProject.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/licensee/project.rb', line 55

def initialize(repo, revision: nil, detect_packages: false)
  if repo.kind_of? Rugged::Repository
    @repository = repo
  else
    @repository = Rugged::Repository.new(repo)
  end

  @revision = revision
  super(detect_packages)
rescue Rugged::RepositoryError
  raise InvalidRepository
end

Instance Attribute Details

#repositoryObject (readonly)

Returns the value of attribute repository.



51
52
53
# File 'lib/licensee/project.rb', line 51

def repository
  @repository
end

#revisionObject (readonly)

Returns the value of attribute revision.



51
52
53
# File 'lib/licensee/project.rb', line 51

def revision
  @revision
end