Sha256: a1ede315a29ca0b8c9a3b0591e0fa439407c0b0865c0f0c994c6d1dfdc0e5925
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
module RepoAnalyzer class ProjectDataBridge EXCLUDED_FILE_NAMES = %w{. .. .keep .gitkeep} attr_reader :project_path def initialize(repo_name, project_path = Rails.root.to_s) @repo_name = repo_name @project_path = project_path end def file_exist?(file_path) File.exist?("#{project_path}/#{file_path}") end def file_content(file_path) return unless file_exist?(file_path) File.open("#{project_path}/#{file_path}").read end def dir_files(dir_path) Dir.glob("#{project_path}/#{dir_path}/**/*").reject do |file_name| EXCLUDED_FILE_NAMES.include?(file_name) end rescue Errno::ENOENT [] end def commits(options = {}) github_client.commits(repo_name, **options) end def contributors github_client.contributors(repo_name) end private attr_reader :repo_name def github_client @github_client ||= RepoAnalyzer::GithubClient.new( RepoAnalyzer.github_personal_token ) end end end
Version data entries
4 entries across 4 versions & 1 rubygems