File tree Expand file tree Collapse file tree 3 files changed +62
-10
lines changed
Expand file tree Collapse file tree 3 files changed +62
-10
lines changed Original file line number Diff line number Diff line change 33require 'errbit_github_plugin/issue_tracker'
44require 'errbit_github_plugin/rails'
55
6- ErrbitPlugin ::Register . add_issue_tracker (
7- 'IssueTrackers::GithubIssuesTracker' ,
8- ErrbitGithubPlugin ::IssueTracker
9- )
6+ module ErrbitGithubPlugin
7+ def self . root
8+ File . expand_path '../..' , __FILE__
9+ end
10+ end
11+
12+ ErrbitPlugin ::Registry . add_issue_tracker ( ErrbitGithubPlugin ::IssueTracker )
Original file line number Diff line number Diff line change @@ -53,26 +53,30 @@ def project_id
5353 app . github_repo
5454 end
5555
56- def check_params
56+ def errors
5757 errors = [ ]
5858 if self . class . fields . detect { |f | params [ f [ 0 ] ] . blank? }
5959 errors << [ :base , 'You must specify your GitHub username and password' ]
6060 end
6161 errors
6262 end
6363
64- def create_issue ( problem , reported_by = nil )
64+ def github_client
6565 # Login using OAuth token, if given.
6666 if oauth_token
67- client = Octokit ::Client . new ( :login => username , :oauth_token => oauth_token )
67+ Octokit ::Client . new (
68+ :login => params [ 'username' ] , :oauth_token => oauth_token )
6869 else
69- client = Octokit ::Client . new ( :login => username , :password => password )
70+ Octokit ::Client . new (
71+ :login => params [ 'username' ] , :password => params [ 'password' ] )
7072 end
73+ end
7174
75+ def create_issue ( problem , reported_by = nil )
7276 begin
73- issue = client . create_issue (
77+ issue = github_client . create_issue (
7478 project_id ,
75- issue_title ( problem ) ,
79+ "[ #{ problem . environment } ][ #{ problem . where } ] #{ problem . message . to_s . truncate ( 100 ) } " ,
7680 self . class . body_template . result ( binding ) . unpack ( 'C*' ) . pack ( 'U*' )
7781 )
7882 @url = issue . html_url
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments