Skip to content

Commit bdff693

Browse files
fingolfinjekyllbot
authored andcommitted
Allow detecting archived or disabled repos (#176)
Merge pull request 176
1 parent 7e042d4 commit bdff693

5 files changed

Lines changed: 9 additions & 1 deletion

File tree

docs/site.github.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The following sample information is exposed to Jekyll templates in the `site.git
7272
"releases": [ Release Objects ],
7373
"latest_release": [ Release Object ],
7474
"private": false,
75+
"archived": false,
76+
"disabled": false,
7577
"license": {
7678
"key": "mit",
7779
"name": "MIT License",

lib/jekyll-github-metadata/metadata_drop.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def keys
6969
def_delegator :repository, :releases, :releases
7070
def_delegator :repository, :latest_release, :latest_release
7171
def_delegator :repository, :private?, :private
72+
def_delegator :repository, :archived?, :archived
73+
def_delegator :repository, :disabled?, :disabled
7274
def_delegator :repository, :license, :license
7375
def_delegator :repository, :source, :source
7476

lib/jekyll-github-metadata/repository.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def self.def_hash_delegator(hash, key, method)
2626
def_hash_delegator :repo_info, :description, :tagline
2727
def_hash_delegator :repo_info, :has_downloads, :show_downloads?
2828
def_hash_delegator :repo_info, :private, :private?
29+
def_hash_delegator :repo_info, :archived, :archived?
30+
def_hash_delegator :repo_info, :disabled, :disabled?
2931
def_hash_delegator :latest_release, :url, :latest_release_url
3032
def_hash_delegator :source, :branch, :git_ref
3133

spec/spec_helpers/integration_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def expected_values
3838
"releases" => %r!"tag_name"=>"v1.1.0"!,
3939
"latest_release" => %r!assets_url!,
4040
"private" => false,
41+
"archived" => false,
42+
"disabled" => false,
4143
"license" => %r!"key"=>"mit"!,
4244
"source" => { "branch" => "gh-pages", "path" => "/" },
4345
}

spec/webmock/api_get_repo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"id":24088214,"name":"github-metadata","full_name":"jekyll/github-metadata","owner":{"login":"jekyll","id":3083652,"avatar_url":"https://avatars.githubusercontent.com/u/3083652?v=3","gravatar_id":"","url":"https://api.github.com/users/jekyll","html_url":"https://github.com/jekyll","followers_url":"https://api.github.com/users/jekyll/followers","following_url":"https://api.github.com/users/jekyll/following{/other_user}","gists_url":"https://api.github.com/users/jekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/jekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jekyll/subscriptions","organizations_url":"https://api.github.com/users/jekyll/orgs","repos_url":"https://api.github.com/users/jekyll/repos","events_url":"https://api.github.com/users/jekyll/events{/privacy}","received_events_url":"https://api.github.com/users/jekyll/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jekyll/github-metadata","description":":octocat: `site.github`","fork":false,"url":"https://api.github.com/repos/jekyll/github-metadata","forks_url":"https://api.github.com/repos/jekyll/github-metadata/forks","keys_url":"https://api.github.com/repos/jekyll/github-metadata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jekyll/github-metadata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jekyll/github-metadata/teams","hooks_url":"https://api.github.com/repos/jekyll/github-metadata/hooks","issue_events_url":"https://api.github.com/repos/jekyll/github-metadata/issues/events{/number}","events_url":"https://api.github.com/repos/jekyll/github-metadata/events","assignees_url":"https://api.github.com/repos/jekyll/github-metadata/assignees{/user}","branches_url":"https://api.github.com/repos/jekyll/github-metadata/branches{/branch}","tags_url":"https://api.github.com/repos/jekyll/github-metadata/tags","blobs_url":"https://api.github.com/repos/jekyll/github-metadata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jekyll/github-metadata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jekyll/github-metadata/git/refs{/sha}","trees_url":"https://api.github.com/repos/jekyll/github-metadata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jekyll/github-metadata/statuses/{sha}","languages_url":"https://api.github.com/repos/jekyll/github-metadata/languages","stargazers_url":"https://api.github.com/repos/jekyll/github-metadata/stargazers","contributors_url":"https://api.github.com/repos/jekyll/github-metadata/contributors","subscribers_url":"https://api.github.com/repos/jekyll/github-metadata/subscribers","subscription_url":"https://api.github.com/repos/jekyll/github-metadata/subscription","commits_url":"https://api.github.com/repos/jekyll/github-metadata/commits{/sha}","git_commits_url":"https://api.github.com/repos/jekyll/github-metadata/git/commits{/sha}","comments_url":"https://api.github.com/repos/jekyll/github-metadata/comments{/number}","issue_comment_url":"https://api.github.com/repos/jekyll/github-metadata/issues/comments{/number}","contents_url":"https://api.github.com/repos/jekyll/github-metadata/contents/{+path}","compare_url":"https://api.github.com/repos/jekyll/github-metadata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jekyll/github-metadata/merges","archive_url":"https://api.github.com/repos/jekyll/github-metadata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jekyll/github-metadata/downloads","issues_url":"https://api.github.com/repos/jekyll/github-metadata/issues{/number}","pulls_url":"https://api.github.com/repos/jekyll/github-metadata/pulls{/number}","milestones_url":"https://api.github.com/repos/jekyll/github-metadata/milestones{/number}","notifications_url":"https://api.github.com/repos/jekyll/github-metadata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jekyll/github-metadata/labels{/name}","releases_url":"https://api.github.com/repos/jekyll/github-metadata/releases{/id}","deployments_url":"https://api.github.com/repos/jekyll/github-metadata/deployments","created_at":"2014-09-16T06:32:03Z","updated_at":"2016-01-30T15:32:29Z","pushed_at":"2016-02-05T20:28:20Z","git_url":"git://github.com/jekyll/github-metadata.git","ssh_url":"git@github.com:jekyll/github-metadata.git","clone_url":"https://github.com/jekyll/github-metadata.git","svn_url":"https://github.com/jekyll/github-metadata","homepage":"https://help.github.com/articles/repository-metadata-on-github-pages","size":67,"stargazers_count":22,"watchers_count":22,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":22,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"organization":{"login":"jekyll","id":3083652,"avatar_url":"https://avatars.githubusercontent.com/u/3083652?v=3","gravatar_id":"","url":"https://api.github.com/users/jekyll","html_url":"https://github.com/jekyll","followers_url":"https://api.github.com/users/jekyll/followers","following_url":"https://api.github.com/users/jekyll/following{/other_user}","gists_url":"https://api.github.com/users/jekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/jekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jekyll/subscriptions","organizations_url":"https://api.github.com/users/jekyll/orgs","repos_url":"https://api.github.com/users/jekyll/repos","events_url":"https://api.github.com/users/jekyll/events{/privacy}","received_events_url":"https://api.github.com/users/jekyll/received_events","type":"Organization","site_admin":false},"network_count":4,"subscribers_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"}}
1+
{"id":24088214,"name":"github-metadata","full_name":"jekyll/github-metadata","owner":{"login":"jekyll","id":3083652,"avatar_url":"https://avatars.githubusercontent.com/u/3083652?v=3","gravatar_id":"","url":"https://api.github.com/users/jekyll","html_url":"https://github.com/jekyll","followers_url":"https://api.github.com/users/jekyll/followers","following_url":"https://api.github.com/users/jekyll/following{/other_user}","gists_url":"https://api.github.com/users/jekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/jekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jekyll/subscriptions","organizations_url":"https://api.github.com/users/jekyll/orgs","repos_url":"https://api.github.com/users/jekyll/repos","events_url":"https://api.github.com/users/jekyll/events{/privacy}","received_events_url":"https://api.github.com/users/jekyll/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jekyll/github-metadata","description":":octocat: `site.github`","fork":false,"url":"https://api.github.com/repos/jekyll/github-metadata","forks_url":"https://api.github.com/repos/jekyll/github-metadata/forks","keys_url":"https://api.github.com/repos/jekyll/github-metadata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jekyll/github-metadata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jekyll/github-metadata/teams","hooks_url":"https://api.github.com/repos/jekyll/github-metadata/hooks","issue_events_url":"https://api.github.com/repos/jekyll/github-metadata/issues/events{/number}","events_url":"https://api.github.com/repos/jekyll/github-metadata/events","assignees_url":"https://api.github.com/repos/jekyll/github-metadata/assignees{/user}","branches_url":"https://api.github.com/repos/jekyll/github-metadata/branches{/branch}","tags_url":"https://api.github.com/repos/jekyll/github-metadata/tags","blobs_url":"https://api.github.com/repos/jekyll/github-metadata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jekyll/github-metadata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jekyll/github-metadata/git/refs{/sha}","trees_url":"https://api.github.com/repos/jekyll/github-metadata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jekyll/github-metadata/statuses/{sha}","languages_url":"https://api.github.com/repos/jekyll/github-metadata/languages","stargazers_url":"https://api.github.com/repos/jekyll/github-metadata/stargazers","contributors_url":"https://api.github.com/repos/jekyll/github-metadata/contributors","subscribers_url":"https://api.github.com/repos/jekyll/github-metadata/subscribers","subscription_url":"https://api.github.com/repos/jekyll/github-metadata/subscription","commits_url":"https://api.github.com/repos/jekyll/github-metadata/commits{/sha}","git_commits_url":"https://api.github.com/repos/jekyll/github-metadata/git/commits{/sha}","comments_url":"https://api.github.com/repos/jekyll/github-metadata/comments{/number}","issue_comment_url":"https://api.github.com/repos/jekyll/github-metadata/issues/comments{/number}","contents_url":"https://api.github.com/repos/jekyll/github-metadata/contents/{+path}","compare_url":"https://api.github.com/repos/jekyll/github-metadata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jekyll/github-metadata/merges","archive_url":"https://api.github.com/repos/jekyll/github-metadata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jekyll/github-metadata/downloads","issues_url":"https://api.github.com/repos/jekyll/github-metadata/issues{/number}","pulls_url":"https://api.github.com/repos/jekyll/github-metadata/pulls{/number}","milestones_url":"https://api.github.com/repos/jekyll/github-metadata/milestones{/number}","notifications_url":"https://api.github.com/repos/jekyll/github-metadata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jekyll/github-metadata/labels{/name}","releases_url":"https://api.github.com/repos/jekyll/github-metadata/releases{/id}","deployments_url":"https://api.github.com/repos/jekyll/github-metadata/deployments","created_at":"2014-09-16T06:32:03Z","updated_at":"2016-01-30T15:32:29Z","pushed_at":"2016-02-05T20:28:20Z","git_url":"git://github.com/jekyll/github-metadata.git","ssh_url":"git@github.com:jekyll/github-metadata.git","clone_url":"https://github.com/jekyll/github-metadata.git","svn_url":"https://github.com/jekyll/github-metadata","homepage":"https://help.github.com/articles/repository-metadata-on-github-pages","size":67,"stargazers_count":22,"watchers_count":22,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":22,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"organization":{"login":"jekyll","id":3083652,"avatar_url":"https://avatars.githubusercontent.com/u/3083652?v=3","gravatar_id":"","url":"https://api.github.com/users/jekyll","html_url":"https://github.com/jekyll","followers_url":"https://api.github.com/users/jekyll/followers","following_url":"https://api.github.com/users/jekyll/following{/other_user}","gists_url":"https://api.github.com/users/jekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/jekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jekyll/subscriptions","organizations_url":"https://api.github.com/users/jekyll/orgs","repos_url":"https://api.github.com/users/jekyll/repos","events_url":"https://api.github.com/users/jekyll/events{/privacy}","received_events_url":"https://api.github.com/users/jekyll/received_events","type":"Organization","site_admin":false},"network_count":4,"subscribers_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"}}

0 commit comments

Comments
 (0)