Class: Licensee::Projects::GitProject
- Defined in:
- lib/licensee/projects/git_project.rb
Defined Under Namespace
Classes: InvalidRepository
Constant Summary
Constants inherited from Project
Instance Attribute Summary collapse
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Attributes inherited from Project
#detect_packages, #detect_readme
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(repo, revision: nil, **args) ⇒ GitProject
constructor
A new instance of GitProject.
- #repository ⇒ Object
Methods inherited from Project
#license, #license_file, #license_files, #licenses, #matched_file, #matched_files, #package_file, #readme_file
Methods included from HashHelper
Constructor Details
#initialize(repo, revision: nil, **args) ⇒ GitProject
Returns a new instance of GitProject.
20 21 22 23 24 25 26 27 |
# File 'lib/licensee/projects/git_project.rb', line 20 def initialize(repo, revision: nil, **args) @raw_repo = repo @revision = revision raise InvalidRepository if repository.head_unborn? super(**args) end |
Instance Attribute Details
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
16 17 18 |
# File 'lib/licensee/projects/git_project.rb', line 16 def revision @revision end |
Instance Method Details
#close ⇒ Object
39 40 41 |
# File 'lib/licensee/projects/git_project.rb', line 39 def close repository.close end |
#repository ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/licensee/projects/git_project.rb', line 29 def repository @repository ||= if @raw_repo.is_a? Rugged::Repository @raw_repo else Rugged::Repository.new(@raw_repo) end rescue Rugged::OSError, Rugged::RepositoryError raise InvalidRepository end |