github-rundeck 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/github-rundeck.rb +34 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47d1b7364c0c57961c587257fd0cd862652a2386
|
4
|
+
data.tar.gz: 2c1627c159047cd8de857e371e1ac3ad1a98e2b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3732824f6d991df279724a9db58461198bf4f3e30eec8c6528cef34afdf08de0bba10b23996517eb5fa87d10c5aff7005a6f99c8e9d1bc8f683be1e5d874acaf
|
7
|
+
data.tar.gz: 5db88ee35bf05004fc8c688dbfa13e52cc775dfeeaea761531df6ebd47f207111c5f7a8d3b8e051953f2fb34d879b429a9409711ab43830b060e995f0970b6bf
|
data/lib/github-rundeck.rb
CHANGED
@@ -24,7 +24,7 @@ class GithubRunDeck < Sinatra::Base
|
|
24
24
|
register Sinatra::Reloader
|
25
25
|
end
|
26
26
|
|
27
|
-
VERSION = '0.1.
|
27
|
+
VERSION = '0.1.2'.freeze
|
28
28
|
|
29
29
|
######################
|
30
30
|
# => Definitions <=#
|
@@ -32,7 +32,7 @@ class GithubRunDeck < Sinatra::Base
|
|
32
32
|
|
33
33
|
def ghclient
|
34
34
|
# => Instantiate a new GitHub Client
|
35
|
-
Github::Client
|
35
|
+
Github::Client.new
|
36
36
|
end
|
37
37
|
|
38
38
|
def serialize(response)
|
@@ -91,23 +91,51 @@ class GithubRunDeck < Sinatra::Base
|
|
91
91
|
|
92
92
|
# => Get Organization Repo List
|
93
93
|
get '/repos/org/:org' do |org|
|
94
|
-
ghresponse = ghclient.list(org: org, per_page: 100)
|
94
|
+
ghresponse = ghclient.repos.list(org: org, per_page: 100)
|
95
95
|
etag ghresponse.headers.etag
|
96
96
|
body serialize(ghresponse)
|
97
97
|
end
|
98
98
|
|
99
99
|
# => Get User Repo List
|
100
100
|
get '/repos/user/:user' do |user|
|
101
|
-
ghresponse = ghclient.list(user: user, per_page: 100)
|
101
|
+
ghresponse = ghclient.repos.list(user: user, per_page: 100)
|
102
102
|
etag ghresponse.headers.etag
|
103
103
|
body serialize(ghresponse)
|
104
104
|
end
|
105
105
|
|
106
106
|
# => Get Branch/Tag Names
|
107
107
|
get '/revisions/:user/:repo' do |user, repo|
|
108
|
-
branches = ghclient.branches(user: user, repo: repo)
|
109
|
-
tags = ghclient.tags(user: user, repo: repo)
|
108
|
+
branches = ghclient.repos.branches(user: user, repo: repo)
|
109
|
+
tags = ghclient.repos.tags(user: user, repo: repo)
|
110
110
|
body serialize_revisions(branches, tags)
|
111
111
|
end
|
112
|
+
|
113
|
+
# => Compare Branch/Tags
|
114
|
+
get '/compare/:user/:repo' do |user, repo|
|
115
|
+
# => Check Parameters - Default to Master
|
116
|
+
refs = [
|
117
|
+
{ 'target' => params['ref1'] || 'master' },
|
118
|
+
{ 'target' => params['ref2'] || 'master' }
|
119
|
+
]
|
120
|
+
|
121
|
+
begin
|
122
|
+
refs.each do |ref|
|
123
|
+
# => Pull the SHA
|
124
|
+
ref['sha'] = ghclient.git_data.trees.get(user, repo, ref['target']).first[1]
|
125
|
+
end
|
126
|
+
|
127
|
+
if refs[0]['sha'] == refs[1]['sha']
|
128
|
+
return "ref1(#{user}/#{repo}/#{refs[0]['target']}) is the same as ref2(#{user}/#{repo}/#{refs[1]['target']})".to_json
|
129
|
+
else
|
130
|
+
status 500 unless params['errorok'] == '1'
|
131
|
+
return "ALERT!!! - ref1(#{user}/#{repo}/#{refs[0]['target']}) is different than ref2(#{user}/#{repo}/#{refs[1]['target']})".to_json
|
132
|
+
end
|
133
|
+
|
134
|
+
# => Catch any GitHub Errors
|
135
|
+
rescue Github::Error::GithubError => e
|
136
|
+
status 500 unless params['errorok'] == '1'
|
137
|
+
e.message.to_json
|
138
|
+
end
|
139
|
+
end
|
112
140
|
end
|
113
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-rundeck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Dwyer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|