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)|[^\/]+)).*}.freeze

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, **args) ⇒ GitHubProject

Returns a new instance of GitHubProject.

Raises:

  • (ArgumentError)


20
21
22
23
24
25
# File 'lib/licensee/projects/github_project.rb', line 20

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

  super(**args)
end

Instance Attribute Details

#repoObject (readonly)

Returns the value of attribute repo.



27
28
29
# File 'lib/licensee/projects/github_project.rb', line 27

def repo
  @repo
end