factor-connector-github 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/factor/connector/github_issue.rb +218 -0
- data/lib/factor/connector/{github.rb → github_repo.rb} +2 -2
- metadata +87 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 770c6119784cefa5118bbb7d485b2f6d1c91d269
|
4
|
+
data.tar.gz: f6c6fa74f647141cfa7251f57abf8a7f9c10df96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 45702fe229939bb6b62f9627388f0a96c160128fd49ecf80264073b036683cc49a5c3ec879138c02dd123b2752555d9f86089e2aa58ff346284379a4232d8038
|
7
|
+
data.tar.gz: 43519cb09706f9db247d2b5205a5973bc8bc4ee4824e1e2d78e5f2eccb58e713a0f4e58fbe4615b15b1352bb7a410e07522dd4e5390b26cefc010e837cdf174d
|
@@ -0,0 +1,218 @@
|
|
1
|
+
require 'factor-connector-api'
|
2
|
+
require 'github_api'
|
3
|
+
|
4
|
+
Factor::Connector.service 'github_issue' do
|
5
|
+
action 'list' do |params|
|
6
|
+
api_key = params['api_key']
|
7
|
+
username = params['username']
|
8
|
+
repo = params['repo']
|
9
|
+
filter = params['filter']
|
10
|
+
state = params['state']
|
11
|
+
since = params['since']
|
12
|
+
labels = params['labels']
|
13
|
+
sort = params['sort']
|
14
|
+
direction = params['direction']
|
15
|
+
|
16
|
+
fail 'API Key must be defined' unless api_key
|
17
|
+
|
18
|
+
info 'Connecting to Github'
|
19
|
+
begin
|
20
|
+
github = Github.new oauth_token: api_key
|
21
|
+
rescue
|
22
|
+
fail 'Unable to connect to Github'
|
23
|
+
end
|
24
|
+
|
25
|
+
payload = {
|
26
|
+
user: username,
|
27
|
+
repo: repo,
|
28
|
+
filter: filter,
|
29
|
+
state: state,
|
30
|
+
since: since,
|
31
|
+
labels: labels,
|
32
|
+
sort: sort,
|
33
|
+
direction: direction
|
34
|
+
}
|
35
|
+
|
36
|
+
info 'Getting all issues'
|
37
|
+
begin
|
38
|
+
issues = []
|
39
|
+
github_wrapper = github.issues.list payload
|
40
|
+
github_wrapper.body.each { |mash| issues << mash.to_hash }
|
41
|
+
rescue
|
42
|
+
fail 'Unable to get the issues'
|
43
|
+
end
|
44
|
+
|
45
|
+
action_callback issues
|
46
|
+
end
|
47
|
+
|
48
|
+
action 'get' do |params|
|
49
|
+
api_key = params['api_key']
|
50
|
+
username = params['username']
|
51
|
+
repo = params['repo']
|
52
|
+
id = params['id']
|
53
|
+
|
54
|
+
if repo
|
55
|
+
username, repo = repo.split('/') if repo.include?('/') && !username
|
56
|
+
repo, branch = repo.split('#') if repo.include?('#') && !branch
|
57
|
+
branch ||= 'master'
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
fail 'API key must be defined' unless api_key
|
62
|
+
fail 'Username must be defined' unless username
|
63
|
+
fail 'Repository must be defined' unless repo
|
64
|
+
|
65
|
+
info 'Connecting to Github'
|
66
|
+
begin
|
67
|
+
github = Github.new oauth_token: api_key
|
68
|
+
rescue
|
69
|
+
'Unable to connect to Github'
|
70
|
+
end
|
71
|
+
|
72
|
+
payload = {}
|
73
|
+
payload[:user] = username
|
74
|
+
payload[:repo] = repo
|
75
|
+
payload[:number] = id
|
76
|
+
|
77
|
+
info 'Updating issue'
|
78
|
+
begin
|
79
|
+
github_wrapper = github.issues.get payload
|
80
|
+
issue = github_wrapper.to_hash
|
81
|
+
rescue
|
82
|
+
fail 'Unable to get the issue'
|
83
|
+
end
|
84
|
+
|
85
|
+
action_callback issue
|
86
|
+
end
|
87
|
+
|
88
|
+
action 'create' do |params|
|
89
|
+
api_key = params['api_key']
|
90
|
+
username = params['username']
|
91
|
+
repo = params['repo']
|
92
|
+
title = params['title']
|
93
|
+
body = params['body']
|
94
|
+
labels = params['labels']
|
95
|
+
assignee = params['assignee']
|
96
|
+
|
97
|
+
if repo
|
98
|
+
username, repo = repo.split('/') if repo.include?('/') && !username
|
99
|
+
repo, branch = repo.split('#') if repo.include?('#') && !branch
|
100
|
+
branch ||= 'master'
|
101
|
+
end
|
102
|
+
|
103
|
+
fail 'API key must be defined' unless api_key
|
104
|
+
fail 'Title must be defined' unless title
|
105
|
+
fail 'Username must be defined' unless username
|
106
|
+
fail 'Repository must be defined' unless repo
|
107
|
+
|
108
|
+
info 'Connecting to Github'
|
109
|
+
begin
|
110
|
+
github = Github.new oauth_token: api_key
|
111
|
+
rescue
|
112
|
+
fail 'Unable to connect to Github'
|
113
|
+
end
|
114
|
+
|
115
|
+
payload = {}
|
116
|
+
payload[:user] = username
|
117
|
+
payload[:repo] = repo
|
118
|
+
payload[:title] = title
|
119
|
+
payload[:body] = body if body
|
120
|
+
payload[:assignee] = assignee if assignee
|
121
|
+
payload[:labels] = labels if labels
|
122
|
+
|
123
|
+
info 'Creating new issue'
|
124
|
+
begin
|
125
|
+
github_wrapper = github.issues.create payload
|
126
|
+
issue = github_wrapper.to_hash
|
127
|
+
rescue
|
128
|
+
fail 'Unable to create the issue'
|
129
|
+
end
|
130
|
+
|
131
|
+
info 'Issue has been created'
|
132
|
+
|
133
|
+
action_callback issue
|
134
|
+
end
|
135
|
+
|
136
|
+
action 'edit' do |params|
|
137
|
+
api_key = params['api_key']
|
138
|
+
username = params['username']
|
139
|
+
repo = params['repo']
|
140
|
+
title = params['title']
|
141
|
+
body = params['body']
|
142
|
+
number = params['id']
|
143
|
+
state = params['state']
|
144
|
+
labels = params['labels']
|
145
|
+
|
146
|
+
if repo
|
147
|
+
username, repo = repo.split('/') if repo.include?('/') && !username
|
148
|
+
repo, branch = repo.split('#') if repo.include?('#') && !branch
|
149
|
+
branch ||= 'master'
|
150
|
+
end
|
151
|
+
|
152
|
+
fail 'API key must be defined' unless api_key
|
153
|
+
fail 'Title must be defined' unless title
|
154
|
+
fail 'Username must be defined' unless username
|
155
|
+
fail 'Repository must be defined' unless repo
|
156
|
+
|
157
|
+
info 'Connecting to Github'
|
158
|
+
begin
|
159
|
+
github = Github.new oauth_token: api_key
|
160
|
+
rescue
|
161
|
+
fail 'Unable to connect to Github'
|
162
|
+
end
|
163
|
+
|
164
|
+
update = {}
|
165
|
+
update[:title] = title if title
|
166
|
+
update[:body] = body if body
|
167
|
+
update[:state] = state if state
|
168
|
+
update[:labels] = labels if labels
|
169
|
+
|
170
|
+
info 'Updating your issue'
|
171
|
+
begin
|
172
|
+
github_wrapper = github.issues.edit username, repo, number, update
|
173
|
+
issue = github_wrapper.to_hash
|
174
|
+
rescue
|
175
|
+
fail 'Unable to update the issue'
|
176
|
+
end
|
177
|
+
|
178
|
+
info 'Issue has been updated'
|
179
|
+
|
180
|
+
action_callback issue
|
181
|
+
end
|
182
|
+
|
183
|
+
action 'close' do |params|
|
184
|
+
api_key = params['api_key']
|
185
|
+
username = params['username']
|
186
|
+
repo = params['repo']
|
187
|
+
number = params['id']
|
188
|
+
|
189
|
+
if repo
|
190
|
+
username, repo = repo.split('/') if repo.include?('/') && !username
|
191
|
+
repo, branch = repo.split('#') if repo.include?('#') && !branch
|
192
|
+
branch ||= 'master'
|
193
|
+
end
|
194
|
+
|
195
|
+
fail 'API key must be defined' unless api_key
|
196
|
+
fail 'Username must be defined' unless api_key
|
197
|
+
fail 'Repository must be defined' unless repo
|
198
|
+
|
199
|
+
info 'Connecting to Github'
|
200
|
+
begin
|
201
|
+
github = Github.new oauth_token: api_key
|
202
|
+
rescue
|
203
|
+
fail 'unable to connect to Github'
|
204
|
+
end
|
205
|
+
|
206
|
+
info 'Closing the issue'
|
207
|
+
begin
|
208
|
+
github_wrapper = github.issues.edit username, repo, number, state: 'closed'
|
209
|
+
issue = github_wrapper.to_hash
|
210
|
+
rescue
|
211
|
+
fail 'Unable to close the issue'
|
212
|
+
end
|
213
|
+
|
214
|
+
info 'Issue has been closed'
|
215
|
+
|
216
|
+
action_callback issue
|
217
|
+
end
|
218
|
+
end
|
@@ -22,7 +22,7 @@ github_events = [
|
|
22
22
|
'team_add',
|
23
23
|
'watch']
|
24
24
|
|
25
|
-
Factor::Connector.service '
|
25
|
+
Factor::Connector.service 'github_repo' do
|
26
26
|
github_events.each do |github_event|
|
27
27
|
listener github_event do
|
28
28
|
start do |params|
|
@@ -233,4 +233,4 @@ Factor::Connector.service 'github' do
|
|
233
233
|
|
234
234
|
action_callback response_data
|
235
235
|
end
|
236
|
-
end
|
236
|
+
end
|
metadata
CHANGED
@@ -1,78 +1,145 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factor-connector-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Maciej Skierkowski
|
8
|
+
- Andrew Akers
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: github_api
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- - ~>
|
18
|
+
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: 0.11.3
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
|
-
- - ~>
|
25
|
+
- - "~>"
|
28
26
|
- !ruby/object:Gem::Version
|
29
27
|
version: 0.11.3
|
30
28
|
- !ruby/object:Gem::Dependency
|
31
29
|
name: factor-connector-api
|
32
30
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
31
|
requirements:
|
35
|
-
- - ~>
|
32
|
+
- - "~>"
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.0.
|
34
|
+
version: 0.0.13
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- - ~>
|
39
|
+
- - "~>"
|
44
40
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.0.
|
41
|
+
version: 0.0.13
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: codeclimate-test-reporter
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.4.1
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.4.1
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.1.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.1.0
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 10.3.2
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 10.3.2
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: wrong
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.7.1
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.7.1
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rubocop
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.26.1
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.26.1
|
46
112
|
description:
|
47
113
|
email:
|
48
114
|
- maciej@factor.io
|
115
|
+
- andrewrdakers@gmail.com
|
49
116
|
executables: []
|
50
117
|
extensions: []
|
51
118
|
extra_rdoc_files: []
|
52
119
|
files:
|
53
|
-
- lib/factor/connector/
|
120
|
+
- lib/factor/connector/github_issue.rb
|
121
|
+
- lib/factor/connector/github_repo.rb
|
54
122
|
homepage: https://factor.io
|
55
123
|
licenses: []
|
124
|
+
metadata: {}
|
56
125
|
post_install_message:
|
57
126
|
rdoc_options: []
|
58
127
|
require_paths:
|
59
128
|
- lib
|
60
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
130
|
requirements:
|
63
|
-
- -
|
131
|
+
- - ">="
|
64
132
|
- !ruby/object:Gem::Version
|
65
133
|
version: '0'
|
66
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
135
|
requirements:
|
69
|
-
- -
|
136
|
+
- - ">="
|
70
137
|
- !ruby/object:Gem::Version
|
71
138
|
version: '0'
|
72
139
|
requirements: []
|
73
140
|
rubyforge_project:
|
74
|
-
rubygems_version:
|
141
|
+
rubygems_version: 2.2.2
|
75
142
|
signing_key:
|
76
|
-
specification_version:
|
143
|
+
specification_version: 4
|
77
144
|
summary: Github Factor.io Connector
|
78
145
|
test_files: []
|