class LicenseAuto::Matcher::SourceURL

Match all kinds of source_url by their regex patterns.

The follow website URLs can get clear matched result:

Attributes

url[R]

Public Class Methods

new(url) click to toggle source

Struct a new matcher by url

# File lib/license_auto/matcher.rb, line 23
def initialize(url)
  @url = url
end

Public Instance Methods

match_bitbucket_resource() click to toggle source
# File lib/license_auto/matcher.rb, line 31
def match_bitbucket_resource
  github_resource.match(@url)
end
match_github_resource() click to toggle source
# File lib/license_auto/matcher.rb, line 27
def match_github_resource()
  github_resource.match(@url)
end
match_maven_default_central() click to toggle source
# File lib/license_auto/matcher.rb, line 35
def match_maven_default_central
  maven_default_central_resource.match(@url)
end

Private Instance Methods

bitbucket_resource() click to toggle source
# File lib/license_auto/matcher.rb, line 61
def bitbucket_resource
  /(?<protocol>http[s]?):\/\/(?<host>bitbucket\.org)\/(?<owner>.+)\/(?<repo>.+)(?<vcs>\.git)?/
end
github_resource() click to toggle source

FIXME: @Cissy

# File lib/license_auto/matcher.rb, line 49
def github_resource
  # /(git\+)?(?<protocol>(http[s]?|git))(:\/\/|@)(?<host>(www\.)?github\.com)(\/|:)(?<owner>.+)\/(?<repo>[^\/.]+)(?<vcs>\.git)?/
  /(git\+)?
  (?<protocol>(http[s]?|git))?
  (:\/\/|@)?
  (?<host>(www\.)?github\.com)
  (\/|:)
  (?<owner>.+)\/
  (?<repo>[^\/.]+)
  (?<vcs>\.git)?/x
end
maven_default_central_resource() click to toggle source

vcs: Version Control System

# File lib/license_auto/matcher.rb, line 44
def maven_default_central_resource
  /repo1\.maven\.org\/maven2/
end