errbit_github_plugin 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/errbit_github_plugin.gemspec +3 -2
- data/lib/errbit_github_plugin.rb +4 -1
- data/lib/errbit_github_plugin/issue_tracker.rb +36 -43
- data/lib/errbit_github_plugin/version.rb +1 -1
- data/static/github_create.png +0 -0
- data/static/github_goto.png +0 -0
- data/static/github_inactive.png +0 -0
- metadata +7 -4
- data/lib/errbit_github_plugin/rails.rb +0 -8
- data/views/github_issues_body.txt.erb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa68dc7f2ff60cfa5bca4d26fd9889a36bca7ad
|
4
|
+
data.tar.gz: f80c19060d3f571fe4882b3c62efbe6bc585ad42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6101c37634049d1a0cdba1fad9c4f272f70ce64fa4e925265272974ad21d4fed6b61f91c4c133b957215931d40dc600ab81d4dccb715879a6a671023c0e1ef1
|
7
|
+
data.tar.gz: f3af3a3f80dda0814de880fd94b40a0497ecc7960f98df2c8bfb9063a078acd4c2ae73d91ba137130d2368c1432c0bcc4d9d0c1de836ae0b60153a3fb5e874cd
|
@@ -6,8 +6,9 @@ require 'errbit_github_plugin/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "errbit_github_plugin"
|
8
8
|
spec.version = ErrbitGithubPlugin::VERSION
|
9
|
-
spec.authors = ["Stephen Crosby"]
|
10
|
-
spec.email = ["stevecrozz@gmail.com"]
|
9
|
+
spec.authors = ["Stephen Crosby", "Cyril Mougel"]
|
10
|
+
spec.email = ["stevecrozz@gmail.com", "cyril.mougel@gmail.com"]
|
11
|
+
|
11
12
|
spec.description = %q{GitHub integration for Errbit}
|
12
13
|
spec.summary = %q{GitHub integration for Errbit}
|
13
14
|
spec.homepage = "https://github.com/brandedcrate/errbit_github_plugin"
|
data/lib/errbit_github_plugin.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require "errbit_github_plugin/version"
|
2
2
|
require 'errbit_github_plugin/error'
|
3
3
|
require 'errbit_github_plugin/issue_tracker'
|
4
|
-
require 'errbit_github_plugin/rails'
|
5
4
|
|
6
5
|
module ErrbitGithubPlugin
|
7
6
|
def self.root
|
8
7
|
File.expand_path '../..', __FILE__
|
9
8
|
end
|
9
|
+
|
10
|
+
def self.read_static_file(file)
|
11
|
+
File.read(File.join(self.root, 'static', file))
|
12
|
+
end
|
10
13
|
end
|
11
14
|
|
12
15
|
ErrbitPlugin::Registry.add_issue_tracker(ErrbitGithubPlugin::IssueTracker)
|
@@ -12,11 +12,11 @@ module ErrbitGithubPlugin
|
|
12
12
|
'OAuth token.'
|
13
13
|
|
14
14
|
FIELDS = {
|
15
|
-
:
|
16
|
-
:
|
15
|
+
username: {
|
16
|
+
placeholder: "Your username on GitHub"
|
17
17
|
},
|
18
|
-
:
|
19
|
-
:
|
18
|
+
password: {
|
19
|
+
placeholder: "Password for your account"
|
20
20
|
}
|
21
21
|
}
|
22
22
|
|
@@ -32,62 +32,55 @@ module ErrbitGithubPlugin
|
|
32
32
|
FIELDS
|
33
33
|
end
|
34
34
|
|
35
|
-
def self.
|
36
|
-
@
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
def self.icons
|
36
|
+
@icons ||= {
|
37
|
+
create: [
|
38
|
+
'image/png', ErrbitGithubPlugin.read_static_file('github_create.png')
|
39
|
+
],
|
40
|
+
goto: [
|
41
|
+
'image/png', ErrbitGithubPlugin.read_static_file('github_goto.png'),
|
42
|
+
],
|
43
|
+
inactive: [
|
44
|
+
'image/png', ErrbitGithubPlugin.read_static_file('github_inactive.png'),
|
45
|
+
]
|
46
|
+
}
|
41
47
|
end
|
42
48
|
|
43
|
-
attr_accessor :oauth_token
|
44
|
-
attr_reader :url
|
45
|
-
|
46
49
|
def configured?
|
47
|
-
|
50
|
+
errors.empty?
|
48
51
|
end
|
49
52
|
|
50
|
-
def
|
51
|
-
|
52
|
-
def project_id
|
53
|
-
app.github_repo
|
53
|
+
def url
|
54
|
+
"https://github.com/#{repo}/issues"
|
54
55
|
end
|
55
56
|
|
56
57
|
def errors
|
57
58
|
errors = []
|
58
|
-
if self.class.fields.detect {|f|
|
59
|
+
if self.class.fields.detect {|f| options[f[0]].blank? }
|
59
60
|
errors << [:base, 'You must specify your GitHub username and password']
|
60
61
|
end
|
62
|
+
if repo.blank?
|
63
|
+
errors << [:base, 'You must specify your GitHub repository url.']
|
64
|
+
end
|
61
65
|
errors
|
62
66
|
end
|
63
67
|
|
64
|
-
def
|
65
|
-
|
66
|
-
if oauth_token
|
67
|
-
Octokit::Client.new(
|
68
|
-
:login => params['username'], :oauth_token => oauth_token)
|
69
|
-
else
|
70
|
-
Octokit::Client.new(
|
71
|
-
:login => params['username'], :password => params['password'])
|
72
|
-
end
|
68
|
+
def repo
|
69
|
+
options[:github_repo]
|
73
70
|
end
|
74
71
|
|
75
|
-
def create_issue(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
@url = issue.html_url
|
83
|
-
problem.update_attributes(
|
84
|
-
:issue_link => issue.html_url,
|
85
|
-
:issue_type => self.class.label
|
86
|
-
)
|
87
|
-
|
88
|
-
rescue Octokit::Unauthorized
|
89
|
-
raise ErrbitGithubPlugin::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password."
|
72
|
+
def create_issue(title, body, user: {})
|
73
|
+
if user['github_login'] && user['github_oauth_token']
|
74
|
+
github_client = Octokit::Client.new(
|
75
|
+
login: user['github_login'], access_token: user['github_oauth_token'])
|
76
|
+
else
|
77
|
+
github_client = Octokit::Client.new(
|
78
|
+
login: options['username'], password: options['password'])
|
90
79
|
end
|
80
|
+
issue = github_client.create_issue(repo, title, body)
|
81
|
+
issue.html_url
|
82
|
+
rescue Octokit::Unauthorized
|
83
|
+
raise ErrbitGithubPlugin::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password."
|
91
84
|
end
|
92
85
|
end
|
93
86
|
end
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errbit_github_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Crosby
|
8
|
+
- Cyril Mougel
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: errbit_plugin
|
@@ -69,6 +70,7 @@ dependencies:
|
|
69
70
|
description: GitHub integration for Errbit
|
70
71
|
email:
|
71
72
|
- stevecrozz@gmail.com
|
73
|
+
- cyril.mougel@gmail.com
|
72
74
|
executables: []
|
73
75
|
extensions: []
|
74
76
|
extra_rdoc_files: []
|
@@ -82,11 +84,12 @@ files:
|
|
82
84
|
- lib/errbit_github_plugin.rb
|
83
85
|
- lib/errbit_github_plugin/error.rb
|
84
86
|
- lib/errbit_github_plugin/issue_tracker.rb
|
85
|
-
- lib/errbit_github_plugin/rails.rb
|
86
87
|
- lib/errbit_github_plugin/version.rb
|
88
|
+
- static/github_create.png
|
89
|
+
- static/github_goto.png
|
90
|
+
- static/github_inactive.png
|
87
91
|
- vendor/assets/images/github_create.png
|
88
92
|
- vendor/assets/images/github_inactive.png
|
89
|
-
- views/github_issues_body.txt.erb
|
90
93
|
homepage: https://github.com/brandedcrate/errbit_github_plugin
|
91
94
|
licenses:
|
92
95
|
- MIT
|
@@ -1,45 +0,0 @@
|
|
1
|
-
[See this exception on Errbit](<%= problem.url %> "See this exception on Errbit")
|
2
|
-
<% if notice = problem.notices.first %>
|
3
|
-
# <%= notice.message %> #
|
4
|
-
## Summary ##
|
5
|
-
<% if notice.request['url'].present? %>
|
6
|
-
### URL ###
|
7
|
-
[<%= notice.request['url'] %>](<%= notice.request['url'] %>)"
|
8
|
-
<% end %>
|
9
|
-
### Where ###
|
10
|
-
<%= notice.where %>
|
11
|
-
|
12
|
-
### Occured ###
|
13
|
-
<%= notice.created_at.to_s(:micro) %>
|
14
|
-
|
15
|
-
### Similar ###
|
16
|
-
<%= (notice.problem.notices_count - 1).to_s %>
|
17
|
-
|
18
|
-
## Params ##
|
19
|
-
```
|
20
|
-
<%= pretty_hash(notice.params) %>
|
21
|
-
```
|
22
|
-
|
23
|
-
## Session ##
|
24
|
-
```
|
25
|
-
<%= pretty_hash(notice.session) %>
|
26
|
-
```
|
27
|
-
|
28
|
-
## Backtrace ##
|
29
|
-
```
|
30
|
-
<% notice.backtrace_lines.each do |line| %><%= line.number %>: <%= line.file_relative %> -> **<%= line.method %>**
|
31
|
-
<% end %>
|
32
|
-
```
|
33
|
-
|
34
|
-
## Environment ##
|
35
|
-
|
36
|
-
<table>
|
37
|
-
<% for key, val in notice.env_vars %>
|
38
|
-
<tr>
|
39
|
-
<td><%= key %>:</td>
|
40
|
-
<td><%= val %></td>
|
41
|
-
</tr>
|
42
|
-
<% end %>
|
43
|
-
</table>
|
44
|
-
<% end %>
|
45
|
-
|