errbit_gitlab_plugin 0.1.0
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 +7 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/errbit_gitlab_plugin.gemspec +26 -0
- data/lib/errbit_gitlab_plugin/issue_tracker.rb +97 -0
- data/lib/errbit_gitlab_plugin/rails.rb +8 -0
- data/lib/errbit_gitlab_plugin/version.rb +3 -0
- data/lib/errbit_gitlab_plugin.rb +11 -0
- data/vendor/assets/images/gitlab_create.png +0 -0
- data/vendor/assets/images/gitlab_goto.png +0 -0
- data/vendor/assets/images/gitlab_inactive.png +0 -0
- data/views/gitlab_issues_body.txt.erb +29 -0
- data/views/gitlab_issues_summary.txt.erb +17 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0fdae03cfb0481b0da9efa7aa9d4ca02391a035a
|
4
|
+
data.tar.gz: 9e29e0427988426a3ac1e750e95bfa092390dbc4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d6ab5bfd04c9254c48ade0f847fefa6d370b984d1c95759b2a781540f41242f51b0505d78103528c64805ab80618e40a7a0fb1814c962abaea03a7ce2fb2bca
|
7
|
+
data.tar.gz: ea6f4b2002fb8f13b1beac573e1557b4b5579dc091c7ae8061baebd973e073466a477541aa4baac93562f638e4201266525779b07f0cefb34661fcf1f2c23545
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Cyril Mougel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# ErrbitGitlabPlugin
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'errbit_gitlab_plugin'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install errbit_gitlab_plugin
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'errbit_gitlab_plugin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "errbit_gitlab_plugin"
|
8
|
+
spec.version = ErrbitGitlabPlugin::VERSION
|
9
|
+
spec.authors = ["Stephen Crosby"]
|
10
|
+
spec.email = ["stevecrozz@gmail.com"]
|
11
|
+
spec.description = %q{Gitlab integration for Errbit}
|
12
|
+
spec.summary = %q{Gitlab integration for Errbit}
|
13
|
+
spec.homepage = "https://github.com/brandedcrate/errbit_gitlab_plugin"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'errbit_plugin', '~> 0.4', '>= 0.4.0'
|
22
|
+
spec.add_runtime_dependency 'gitlab', '~> 3.0.0', '>= 3.0.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 0'
|
26
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'gitlab'
|
2
|
+
|
3
|
+
module ErrbitGitlabPlugin
|
4
|
+
class IssueTracker < ErrbitPlugin::IssueTracker
|
5
|
+
LABEL = 'gitlab'
|
6
|
+
|
7
|
+
NOTE = ''
|
8
|
+
|
9
|
+
FIELDS = [
|
10
|
+
[:account, {
|
11
|
+
:label => "Gitlab URL",
|
12
|
+
:placeholder => "e.g. https://example.net"
|
13
|
+
}],
|
14
|
+
[:api_token, {
|
15
|
+
:placeholder => "API Token for your account"
|
16
|
+
}],
|
17
|
+
[:project_id, {
|
18
|
+
:label => "Ticket Project ID (use Number)",
|
19
|
+
:placeholder => "Gitlab Project where issues will be created"
|
20
|
+
}],
|
21
|
+
[:alt_project_id, {
|
22
|
+
:label => "Project Name (namespace/project)",
|
23
|
+
:placeholder => "Gitlab Project where issues will be created"
|
24
|
+
}]
|
25
|
+
]
|
26
|
+
|
27
|
+
def self.label
|
28
|
+
LABEL
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.note
|
32
|
+
NOTE
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.fields
|
36
|
+
FIELDS
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.body_template
|
40
|
+
@body_template ||= ERB.new(File.read(
|
41
|
+
File.join(
|
42
|
+
ErrbitGitlabPlugin.root, 'views', 'gitlab_issues_body.txt.erb'
|
43
|
+
)
|
44
|
+
))
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.summary_template
|
48
|
+
@summary_template ||= ERB.new(File.read(
|
49
|
+
File.join(
|
50
|
+
ErrbitGitlabPlugin.root, 'views', 'gitlab_issues_summary.txt.erb'
|
51
|
+
)
|
52
|
+
))
|
53
|
+
end
|
54
|
+
|
55
|
+
def url
|
56
|
+
sprintf('%s/%s/issues', params['account'], params['alt_project_id'])
|
57
|
+
end
|
58
|
+
|
59
|
+
def configured?
|
60
|
+
params['project_id'].present? && params['api_token'].present?
|
61
|
+
end
|
62
|
+
|
63
|
+
def comments_allowed?; false; end
|
64
|
+
|
65
|
+
def errors
|
66
|
+
errors = []
|
67
|
+
if self.class.fields.detect {|f| params[f[0]].blank? }
|
68
|
+
errors << [:base, 'You must specify your Gitlab URL, API token, Project ID and Project Name']
|
69
|
+
end
|
70
|
+
errors
|
71
|
+
end
|
72
|
+
|
73
|
+
def create_issue(problem, reported_by = nil)
|
74
|
+
Gitlab.configure do |config|
|
75
|
+
config.endpoint = sprintf('%s/api/v3', params['account'])
|
76
|
+
config.private_token = params['api_token']
|
77
|
+
config.user_agent = 'Errbit User Agent'
|
78
|
+
end
|
79
|
+
|
80
|
+
title = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}"
|
81
|
+
description_summary = self.class.summary_template.result(binding)
|
82
|
+
description_body = self.class.body_template.result(binding)
|
83
|
+
|
84
|
+
ticket = Gitlab.create_issue(params['project_id'], title, {
|
85
|
+
:description => description_summary,
|
86
|
+
:labels => "errbit"
|
87
|
+
})
|
88
|
+
|
89
|
+
Gitlab.create_issue_note(params['project_id'], ticket.id, description_body)
|
90
|
+
|
91
|
+
problem.update_attributes(
|
92
|
+
:issue_link => sprintf("%s/%s", url, ticket.id),
|
93
|
+
:issue_type => self.class.label
|
94
|
+
)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'errbit_gitlab_plugin/version'
|
2
|
+
require 'errbit_gitlab_plugin/issue_tracker'
|
3
|
+
require 'errbit_gitlab_plugin/rails'
|
4
|
+
|
5
|
+
module ErrbitGitlabPlugin
|
6
|
+
def self.root
|
7
|
+
File.expand_path '../..', __FILE__
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
ErrbitPlugin::Registry.add_issue_tracker(ErrbitGitlabPlugin::IssueTracker)
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<% if notice = problem.notices.first %>
|
2
|
+
## Params ##
|
3
|
+
```
|
4
|
+
<%= pretty_hash(notice.params) %>
|
5
|
+
```
|
6
|
+
|
7
|
+
## Session ##
|
8
|
+
```
|
9
|
+
<%= pretty_hash(notice.session) %>
|
10
|
+
```
|
11
|
+
|
12
|
+
## Backtrace ##
|
13
|
+
```
|
14
|
+
<% notice.backtrace_lines.each do |line| %><%= line.number %>: <%= line.file_relative %> -> **<%= line.method %>**
|
15
|
+
<% end %>
|
16
|
+
```
|
17
|
+
|
18
|
+
## Environment ##
|
19
|
+
|
20
|
+
<table>
|
21
|
+
<% for key, val in notice.env_vars %>
|
22
|
+
<tr>
|
23
|
+
<td><%= key %>:</td>
|
24
|
+
<td><%= val %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
28
|
+
<% end %>
|
29
|
+
|
@@ -0,0 +1,17 @@
|
|
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
|
+
<% end %>
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: errbit_gitlab_plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Crosby
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: errbit_plugin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.4.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.4.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: gitlab
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.0.0
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.0.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.0.0
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.0.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.3'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '1.3'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rake
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
description: Gitlab integration for Errbit
|
82
|
+
email:
|
83
|
+
- stevecrozz@gmail.com
|
84
|
+
executables: []
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
88
|
+
- ".gitignore"
|
89
|
+
- ".ruby-version"
|
90
|
+
- Gemfile
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- errbit_gitlab_plugin.gemspec
|
95
|
+
- lib/errbit_gitlab_plugin.rb
|
96
|
+
- lib/errbit_gitlab_plugin/issue_tracker.rb
|
97
|
+
- lib/errbit_gitlab_plugin/rails.rb
|
98
|
+
- lib/errbit_gitlab_plugin/version.rb
|
99
|
+
- vendor/assets/images/gitlab_create.png
|
100
|
+
- vendor/assets/images/gitlab_goto.png
|
101
|
+
- vendor/assets/images/gitlab_inactive.png
|
102
|
+
- views/gitlab_issues_body.txt.erb
|
103
|
+
- views/gitlab_issues_summary.txt.erb
|
104
|
+
homepage: https://github.com/brandedcrate/errbit_gitlab_plugin
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.2.2
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Gitlab integration for Errbit
|
128
|
+
test_files: []
|
129
|
+
has_rdoc:
|