Class: InchCI::GitHubInfo::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/inch_ci/git_hub_info.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Repo

Returns a new instance of Repo.

Parameters:

  • nwo (String)

    name with owner (e.g. “rrrene/inch”)


46
47
48
49
# File 'lib/inch_ci/git_hub_info.rb', line 46

def initialize(repo)
  @repo = repo
  @nwo = repo.full_name
end

Instance Method Details

#branchesObject


51
52
53
54
# File 'lib/inch_ci/git_hub_info.rb', line 51

def branches
  list = GitHubInfo.client.branches(@nwo)
  list.map { |branch| branch[:name] }
end

#default_branchObject


56
57
58
# File 'lib/inch_ci/git_hub_info.rb', line 56

def default_branch
  @repo[:default_branch]
end

#descriptionObject


84
85
86
# File 'lib/inch_ci/git_hub_info.rb', line 84

def description
  @repo[:description]
end

#documentation_urlObject


92
93
94
95
96
# File 'lib/inch_ci/git_hub_info.rb', line 92

def documentation_url
  if language.to_s.downcase == "ruby"
    "http://rubydoc.info/github/#{@nwo}/master/frames"
  end
end

#fork?Boolean

Returns:

  • (Boolean)

60
61
62
# File 'lib/inch_ci/git_hub_info.rb', line 60

def fork?
  @repo[:fork]
end

#homepage_urlObject


64
65
66
# File 'lib/inch_ci/git_hub_info.rb', line 64

def homepage_url
  @repo[:homepage]
end

#hooksObject


68
69
70
# File 'lib/inch_ci/git_hub_info.rb', line 68

def hooks
  @client.hooks(@nwo)
end

#languageObject


72
73
74
# File 'lib/inch_ci/git_hub_info.rb', line 72

def language
  @repo[:language]
end

#languagesObject


76
77
78
# File 'lib/inch_ci/git_hub_info.rb', line 76

def languages
  @languages ||= [] # retrieve_languages
end

#nameObject


80
81
82
# File 'lib/inch_ci/git_hub_info.rb', line 80

def name
  @repo[:full_name]
end

#source_code_urlObject


88
89
90
# File 'lib/inch_ci/git_hub_info.rb', line 88

def source_code_url
  @repo[:html_url]
end

#urlObject

Used to check if the project is already known.


99
100
101
# File 'lib/inch_ci/git_hub_info.rb', line 99

def url
  RepoURL.new(@repo[:html_url]).repo_url
end