Sha256: 3648527453cb4285be3af87f4819eeae3da3f88c1786d5686fa0e36d5a5eae0a
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 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 def clone_url replacement = "https://#{GitHubRecordsArchiver.token}:x-oauth-basic@" data[:clone_url].gsub(%r{https?://}, replacement) end def repo_dir @repo_dir ||= File.expand_path full_name, GitHubRecordsArchiver.dest_dir end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
github_records_archiver-0.3.1 | lib/github_records_archiver/repository.rb |
github_records_archiver-0.2.0 | lib/github_records_archiver/repository.rb |