Class: YARD::Nowpunk

Inherits:
Object
  • Object
show all
Defined in:
lib/yard-nowpunk.rb

Overview

TODO ([email protected]): Rename this to yard-github

Class Method Summary collapse

Class Method Details

.github_masterObject



24
25
26
# File 'lib/yard-nowpunk.rb', line 24

def github_master
  github_url + "/tree/master/"
end

.github_urlObject



20
21
22
# File 'lib/yard-nowpunk.rb', line 20

def github_url
  "http://" + parse_github_url_from_git_config
end

.parse_github_url_from_git_configObject



7
8
9
10
11
12
13
14
# File 'lib/yard-nowpunk.rb', line 7

def parse_github_url_from_git_config
  remote_origin = Git.open(Dir.pwd).config["remote.origin.url"]
  @url ||= if remote_origin =~ /@/
             remote_origin.gsub("git@", "").gsub(":", "/")
           else
             remote_origin.gsub("git://", "")
           end.gsub(".git", "")
end

.project_nameObject



16
17
18
# File 'lib/yard-nowpunk.rb', line 16

def project_name
  parse_github_url_from_git_config.match(/github\.com\/(.*)\/(.*)/)[2]
end