Skip to content
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commit a4d4f10

Browse files
committed
Merge pull request #775 from github/break-resources
Split resources.rb into smaller files
2 parents 0bffd03 + 7c573ec commit a4d4f10

21 files changed

Lines changed: 2550 additions & 2423 deletions

lib/resources.rb

Lines changed: 3 additions & 2423 deletions
Large diffs are not rendered by default.

lib/responses/admin.rb

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
require_relative 'user'
2+
require_relative 'orgs'
3+
4+
module GitHub
5+
module Resources
6+
module Responses
7+
ADMIN_STATS ||= {
8+
"repos" => {
9+
"total_repos" => 212,
10+
"root_repos" => 194,
11+
"fork_repos" => 18,
12+
"org_repos" => 51,
13+
"total_pushes" => 3082,
14+
"total_wikis" => 15
15+
},
16+
"hooks" => {
17+
"total_hooks" => 27,
18+
"active_hooks" => 23,
19+
"inactive_hooks" => 4
20+
},
21+
"pages" => {
22+
"total_pages" => 36
23+
},
24+
"orgs" => {
25+
"total_orgs" => 33,
26+
"disabled_orgs" => 0,
27+
"total_teams" => 60,
28+
"total_team_members" => 314
29+
},
30+
"users" => {
31+
"total_users" => 254,
32+
"admin_users" => 45,
33+
"suspended_users" => 21
34+
},
35+
"pulls" => {
36+
"total_pulls" => 86,
37+
"merged_pulls" => 60,
38+
"mergeable_pulls" => 21,
39+
"unmergeable_pulls" => 3,
40+
},
41+
"issues" => {
42+
"total_issues" => 179,
43+
"open_issues" => 83,
44+
"closed_issues" => 96
45+
},
46+
"milestones" => {
47+
"total_milestones" => 7,
48+
"open_milestones" => 6,
49+
"closed_milestones" => 1
50+
},
51+
"gists" => {
52+
"total_gists" => 178,
53+
"private_gists" => 151,
54+
"public_gists" => 25
55+
},
56+
"comments" => {
57+
"total_commit_comments" => 6,
58+
"total_gist_comments" => 28,
59+
"total_issue_comments" => 366,
60+
"total_pull_request_comments" => 30
61+
}
62+
}
63+
64+
LICENSING ||= {
65+
"seats" => 1400,
66+
"seats_used" => 1316,
67+
"seats_available" => 84,
68+
"kind" => "standard",
69+
"days_until_expiration" => 365,
70+
"expire_at" => "2016/02/06 12:41:52 -0600"
71+
}
72+
73+
INDEXING_SUCCESS ||= {
74+
"message" => "Repository 'kansaichris/japaning' has been added to the indexing queue"
75+
}
76+
77+
CONFIG_STATUSES ||= {
78+
"status" => "running",
79+
"progress" => [
80+
{
81+
"status" => "DONE",
82+
"key" => "Appliance core components"
83+
},
84+
{
85+
"status" => "DONE",
86+
"key" => "GitHub utilities"
87+
},
88+
{
89+
"status" => "DONE",
90+
"key" => "GitHub applications"
91+
},
92+
{
93+
"status" => "CONFIGURING",
94+
"key" => "GitHub services"
95+
},
96+
{
97+
"status" => "PENDING",
98+
"key" => "Reloading appliance services"
99+
}
100+
]
101+
}
102+
103+
FETCH_SETTINGS ||= {
104+
"enterprise" => {
105+
"private_mode" => false,
106+
"github_hostname" => "ghe.local",
107+
"auth_mode" => "default",
108+
"storage_mode" => "rootfs",
109+
"admin_password" => nil,
110+
"configuration_id" => 1401777404,
111+
"configuration_run_count" => 4,
112+
"package_version" => "11.10.332",
113+
"avatar" => {
114+
"enabled" => false,
115+
"uri" => ""
116+
},
117+
"customer" => {
118+
"name" => "GitHub",
119+
"email" => "stannis@themannis.biz",
120+
"uuid" => "af6cac80-e4e1-012e-d822-1231380e52e9",
121+
"secret_key_data" => "-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nlQcYBE5TCgsBEACk4yHpUcapplebaumBMXYMiLF+nCQ0lxpx...\n-----END PGP PRIVATE KEY BLOCK-----\n",
122+
"public_key_data" => "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nmI0ETqzZYgEEALSe6snowdenXyqvLfSQ34HWD6C7....\n-----END PGP PUBLIC KEY BLOCK-----\n"
123+
},
124+
"license" => {
125+
"seats" => 0,
126+
"evaluation" => false,
127+
"expire_at" => "2015-04-27T00:00:00-07:00",
128+
"perpetual" => false,
129+
"unlimited_seating" => true,
130+
"support_key" => "ssh-rsa AAAAB3N....",
131+
"ssh_allowed" => true
132+
},
133+
"github_ssl" => {
134+
"enabled" => false,
135+
"cert" => nil,
136+
"key" => nil
137+
},
138+
"ldap" => {
139+
"host" => "",
140+
"port" => "",
141+
"base" => [
142+
143+
],
144+
"uid" => "",
145+
"bind_dn" => "",
146+
"password" => "",
147+
"method" => "Plain",
148+
"user_groups" => [
149+
150+
],
151+
"admin_group" => ""
152+
},
153+
"cas" => {
154+
"url" => ""
155+
},
156+
"github_oauth" => {
157+
"client_id" => "12313412",
158+
"client_secret" => "kj123131132",
159+
"organization_name" => "Homestar Runners",
160+
"organization_team" => "homestarrunners/characters"
161+
},
162+
"smtp" => {
163+
"enabled" => true,
164+
"address" => "smtp.example.com",
165+
"authentication" => "plain",
166+
"port" => "1234",
167+
"domain" => "blah",
168+
"username" => "foo",
169+
"user_name" => "mr_foo",
170+
"enable_starttls_auto" => true,
171+
"password" => "bar",
172+
"support_address" => "enterprise@github.com",
173+
"noreply_address" => "noreply@github.com"
174+
},
175+
"dns" => {
176+
"primary_nameserver" => "8.8.8.8",
177+
"secondary_nameserver" => "8.8.4.4"
178+
},
179+
"ntp" => {
180+
"primary_server" => "0.ubuntu.pool.ntp.org",
181+
"secondary_server" => "1.ubuntu.pool.ntp.org"
182+
},
183+
"timezone" => {
184+
"identifier" => "UTC"
185+
},
186+
"device" => {
187+
"path" => "/dev/xyz"
188+
},
189+
"snmp" => {
190+
"enabled" => false,
191+
"community" => ""
192+
},
193+
"rsyslog" => {
194+
"enabled" => false,
195+
"server" => "",
196+
"protocol_name" => "TCP"
197+
},
198+
"assets" => {
199+
"storage" => "file",
200+
"bucket" => nil,
201+
"host_name" => nil,
202+
"key_id" => nil,
203+
"access_key" => nil
204+
},
205+
"pages" => {
206+
"enabled" => true
207+
},
208+
"collectd" => {
209+
"enabled" => false,
210+
"server" => "",
211+
"port" => "",
212+
"encryption" => "",
213+
"username" => "foo",
214+
"password" => "bar"
215+
}
216+
},
217+
"run_list" => [
218+
"role[configure]"
219+
]
220+
}
221+
222+
CHECK_MAINTENANCE_STATUS ||= {
223+
"status" => "scheduled",
224+
"scheduled_time" => "Tuesday, January 22 at 15 => 34 -0800",
225+
"connection_services" => [
226+
{
227+
"name" => "git operations", "number" => 0
228+
},
229+
{
230+
"name" => "mysql queries", "number" => 233
231+
},
232+
{
233+
"name" => "resque jobs", "number" => 54
234+
}
235+
]
236+
}
237+
238+
SET_MAINTENANCE_STATUS ||= {
239+
"status" => "scheduled",
240+
"scheduled_time" => "Tuesday, January 22 at 15 => 34 -0800",
241+
"connection_services" => [
242+
{
243+
"name" => "git operations", "number" => 0
244+
},
245+
{
246+
"name" => "mysql queries", "number" => 233
247+
},
248+
{
249+
"name" => "resque jobs", "number" => 54
250+
}
251+
]
252+
}
253+
254+
GET_AUTHORIZED_SSH_KEYS ||= [
255+
{
256+
"key" => "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
257+
"pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
258+
},
259+
{
260+
"key" => "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
261+
"pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
262+
}
263+
]
264+
265+
LDAP_USER_UPDATE ||= {
266+
'ldap_dn' => 'uid=asdf,ou=users,dc=github,dc=com'
267+
}.merge(USER)
268+
269+
LDAP_TEAM_UPDATE ||= {
270+
'ldap_dn' => 'cn=Enterprise Ops,ou=teams,dc=github,dc=com'
271+
}.merge(TEAM)
272+
273+
LDAP_SYNC_CONFIRM ||= {
274+
'status' => 'queued'
275+
}
276+
end
277+
end
278+
end

lib/responses/deployment.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
require_relative 'user'
2+
3+
module GitHub
4+
module Resources
5+
module Responses
6+
DEPLOYMENT ||= {
7+
"url" => "https://api.github.com/repos/octocat/example/deployments/1",
8+
"id" => 1,
9+
"sha" => "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
10+
"ref" => "master",
11+
"task" => "deploy",
12+
"payload" => {:task => 'deploy:migrate'},
13+
"environment" => "production",
14+
"description" => "Deploy request from hubot",
15+
"creator" => USER,
16+
"created_at" => "2012-07-20T01:19:13Z",
17+
"updated_at" => "2012-07-20T01:19:13Z",
18+
"statuses_url" => "https://api.github.com/repos/octocat/example/deployments/1/statuses",
19+
"repository_url" => "https://api.github.com/repos/octocat/example"
20+
}
21+
22+
DEPLOYMENT_STATUS ||= {
23+
"url" => "https://api.github.com/repos/octocat/example/deployments/42/statuses/1",
24+
"id" => 1,
25+
"state" => "success",
26+
"creator" => USER,
27+
"description" => "Deployment finished successfully.",
28+
"target_url" => "https://example.com/deployment/42/output",
29+
"created_at" => "2012-07-20T01:19:13Z",
30+
"updated_at" => "2012-07-20T01:19:13Z",
31+
"deployment_url" => "https://api.github.com/repos/octocat/example/deployments/42",
32+
"repository_url" => "https://api.github.com/repos/octocat/example",
33+
"deployment" => {
34+
"id" => 42,
35+
"ref" => "master",
36+
"sha" => "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
37+
"url" => "https://api.github.com/repos/octocat/example/deployments/42",
38+
"task" => "deploy",
39+
"creator" => USER,
40+
"environment" => "production",
41+
"payload" => {:task => 'deploy:migrate'},
42+
"created_at" => "2012-07-20T01:19:13Z",
43+
"updated_at" => "2012-07-20T01:19:13Z",
44+
"description" => "Deploy request from hubot",
45+
"statuses_url" => "https://api.github.com/repos/octocat/example/deployments/42/statuses"
46+
}
47+
}
48+
end
49+
end
50+
end

0 commit comments

Comments
 (0)