Class: Repomen::Repo::Service::GitHub

Inherits:
Base
  • Object
show all
Defined in:
lib/repomen/repo/service/git_hub.rb

Constant Summary collapse

SERVICE_REGEXP =
/(https:\/\/|git\@)github.com[\:\/]([^\/]+)\/([^\.]+)\.git$/

Instance Attribute Summary

Attributes inherited from Base

#url

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Repomen::Repo::Service::Base

Instance Method Details

#applicable?Boolean

Parameters:

  • url (String)

Returns:

  • (Boolean)


8
9
10
# File 'lib/repomen/repo/service/git_hub.rb', line 8

def applicable?
  url =~ SERVICE_REGEXP
end

#handler_classObject



12
13
14
# File 'lib/repomen/repo/service/git_hub.rb', line 12

def handler_class
  Handler::Git
end

#nameObject

overriding ‘git_hub’ here to make directories look prettier



17
18
19
# File 'lib/repomen/repo/service/git_hub.rb', line 17

def name
  :github
end

#repo_nameObject



21
22
23
# File 'lib/repomen/repo/service/git_hub.rb', line 21

def repo_name
  url =~ SERVICE_REGEXP && $3
end

#user_nameObject



25
26
27
# File 'lib/repomen/repo/service/git_hub.rb', line 25

def user_name
  url =~ SERVICE_REGEXP && $2
end