class Gigest::GithubRepo

Public Class Methods

new(repository, gemfile) click to toggle source
# File lib/gigest/github/github_repo.rb, line 3
def initialize(repository, gemfile)
  @repository = repository
  @gemfile    = gemfile
end

Public Instance Methods

fork?() click to toggle source
# File lib/gigest/github/github_repo.rb, line 16
def fork?
  @repository.fork
end
gems() click to toggle source
# File lib/gigest/github/github_repo.rb, line 24
def gems
  return [] if !has_gemfile?

  @gems ||= process_gemfile
end
has_gemfile?() click to toggle source
# File lib/gigest/github/github_repo.rb, line 20
def has_gemfile?
  !@gemfile.nil?
end
name() click to toggle source
# File lib/gigest/github/github_repo.rb, line 8
def name
  @repository.full_name
end
private?() click to toggle source
# File lib/gigest/github/github_repo.rb, line 12
def private?
  @repository.private
end

Private Instance Methods

find_gem_name(string) click to toggle source
# File lib/gigest/github/github_repo.rb, line 38
def find_gem_name(string)
  regex_match = string.match(/gem\s+(?<sdq>['"])(?<name>[a-zA-Z0-9\-_]+)\k<sdq>/)
  regex_match.nil? ? nil : regex_match[:name]
end
process_gemfile() click to toggle source
# File lib/gigest/github/github_repo.rb, line 32
def process_gemfile
  @gemfile.split("\n").map do |string|
    string.start_with?("#") ? nil : find_gem_name(string)
  end.compact
end