Class: Licensee::Projects::GitHubProject

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

Defined Under Namespace

Classes: RepoNotFound

Constant Summary collapse

GITHUB_REPO_PATTERN =

If there’s any trailing data (e.g. ‘.git`) this pattern will ignore it: we’re going to use the API rather than clone the repo.

%r{https://github.com/([^/]+/([^/]+(?=\.git)|[^/]+)).*}

Constants inherited from Project

Project::HASH_METHODS

Instance Attribute Summary collapse

Attributes inherited from Project

#detect_packages, #detect_readme

Instance Method Summary collapse

Methods inherited from Project

#license, #license_file, #license_files, #licenses, #matched_file, #matched_files, #package_file, #readme_file

Methods included from HashHelper

#to_h

Constructor Details

#initialize(github_url, ref: nil, **args) ⇒ GitHubProject

Returns a new instance of GitHubProject.

Raises:

  • (ArgumentError)


24
25
26
27
28
29
30
31
# File 'lib/licensee/projects/github_project.rb', line 24

def initialize(github_url, ref: nil, **args)
  @repo = github_url[GITHUB_REPO_PATTERN, 1]
  raise ArgumentError, "Not a github URL: #{github_url}" unless @repo

  @ref = ref

  super(**args)
end

Instance Attribute Details

#refObject (readonly)

Returns the value of attribute ref.



15
16
17
# File 'lib/licensee/projects/github_project.rb', line 15

def ref
  @ref
end

#repoObject (readonly)

Returns the value of attribute repo.



15
16
17
# File 'lib/licensee/projects/github_project.rb', line 15

def repo
  @repo
end