Sha256: 06c50c1b6edbe6cfe12755ee010b847b2f4f221b44ba64d75907be4cfed19541
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module GitHubRecordsArchiver class Repository < GitRepository attr_reader :name include DataHelper KEYS = %i[ name full_name description private fork homepage forks_count stargazers_count watchers_count size ].freeze def initialize(name_or_hash) if name_or_hash.is_a?(String) @name = name_or_hash else @data = name_or_hash.to_h @name = @data[:full_name] end end def data @data ||= GitHubRecordsArchiver.client.repository(name) end def wiki @wiki ||= Wiki.new(self) if has_wiki? end def issues @issues ||= begin issues = GitHubRecordsArchiver.client.list_issues name, state: 'all' issues.map { |i| Issue.from_hash(self, i) } end end def issues_dir @issues_dir ||= begin dir = File.expand_path 'issues', repo_dir FileUtils.mkdir_p(dir) unless Dir.exist?(dir) dir end end private def repo_dir @repo_dir ||= File.expand_path data[:name], GitHubRecordsArchiver.dest_dir end def clone_url replacement = "https://#{GitHubRecordsArchiver.token}:x-oauth-basic@" data[:clone_url].gsub(%r{https?://}, replacement) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github_records_archiver-0.1.0 | lib/github_records_archiver/repository.rb |