errbit_redmine_plugin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/Rakefile +1 -0
- data/errbit_redmine_plugin.gemspec +26 -0
- data/lib/errbit_redmine_plugin/issue_tracker.rb +121 -0
- data/lib/errbit_redmine_plugin/rails.rb +8 -0
- data/lib/errbit_redmine_plugin/version.rb +3 -0
- data/lib/errbit_redmine_plugin.rb +11 -0
- data/vendor/assets/images/redmine_create.png +0 -0
- data/vendor/assets/images/redmine_goto.png +0 -0
- data/vendor/assets/images/redmine_inactive.png +0 -0
- data/views/redmine_ticket_body.txt.erb +17 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a2bf92c79f4515f9fc6be17adb0491161d5f620a
|
4
|
+
data.tar.gz: bd608a8dbe230f5810f1ede49c860eb8e3a0d0de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a3eb69f96ce4a27eca5792549bdb9f96545f034df4fabf34263de5a01cc30e5d6c7e7bc93643da04c49b7be2b6dfb3d792c69b484dcbbe3ffb207a9f71667567
|
7
|
+
data.tar.gz: 69f1c54c377e1ee98a0f39ae62342dafd683b506fdc34dc17907d6bad252c2a1ef6816ca6168d9c913738b95727349b47244bf72e6b3707cb937c4c4bf626197
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.1
|
data/Gemfile
ADDED
data/LICENSE
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/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_redmine_plugin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "errbit_redmine_plugin"
|
8
|
+
spec.version = ErrbitRedminePlugin::VERSION
|
9
|
+
spec.authors = ["Stephen Crosby"]
|
10
|
+
spec.email = ["stevecrozz@gmail.com"]
|
11
|
+
spec.description = %q{Redmine integration for Errbit}
|
12
|
+
spec.summary = %q{Redmine integration for Errbit}
|
13
|
+
spec.homepage = "https://github.com/brandedcrate/errbit_redmine_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'
|
22
|
+
spec.add_runtime_dependency 'oruen_redmine_client', '~> 0'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 0'
|
26
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'redmine_client'
|
2
|
+
|
3
|
+
module ErrbitRedminePlugin
|
4
|
+
class IssueTracker < ErrbitPlugin::IssueTracker
|
5
|
+
|
6
|
+
LABEL = "redmine"
|
7
|
+
|
8
|
+
FIELDS = [
|
9
|
+
[:account, {
|
10
|
+
:label => "Redmine URL",
|
11
|
+
:placeholder => "http://www.redmine.org/"
|
12
|
+
}],
|
13
|
+
[:api_token, {
|
14
|
+
:placeholder => "API Token for your account"
|
15
|
+
}],
|
16
|
+
[:username, {
|
17
|
+
:placeholder => "Your username"
|
18
|
+
}],
|
19
|
+
[:password, {
|
20
|
+
:placeholder => "Your password"
|
21
|
+
}],
|
22
|
+
[:project_id, {
|
23
|
+
:label => "Ticket Project",
|
24
|
+
:placeholder => "Redmine Project where tickets will be created"
|
25
|
+
}],
|
26
|
+
[:alt_project_id, {
|
27
|
+
:optional => true,
|
28
|
+
:label => "App Project",
|
29
|
+
:placeholder => "Where app's files & revisions can be viewed. (Leave blank to use the above project by default)"
|
30
|
+
}]
|
31
|
+
]
|
32
|
+
|
33
|
+
NOTE = "REST web service must be enabled in Redmine"
|
34
|
+
|
35
|
+
def self.label
|
36
|
+
LABEL
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.note
|
40
|
+
NOTE
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.fields
|
44
|
+
FIELDS
|
45
|
+
end
|
46
|
+
|
47
|
+
def url
|
48
|
+
account = params['account']
|
49
|
+
|
50
|
+
acc_url = account.start_with?('http') ? account : "http://#{account}"
|
51
|
+
acc_url = acc_url.gsub(/\/$/, '')
|
52
|
+
URI.parse("#{acc_url}/projects/#{project_id}").to_s
|
53
|
+
rescue URI::InvalidURIError
|
54
|
+
end
|
55
|
+
|
56
|
+
def comments_allowed?
|
57
|
+
false
|
58
|
+
end
|
59
|
+
|
60
|
+
# configured properly if all the fields are filled in
|
61
|
+
def configured?
|
62
|
+
non_empty_params = params.reject { |k,v| v.empty? }.keys.map(&:intern)
|
63
|
+
(required_fields - non_empty_params).empty?
|
64
|
+
end
|
65
|
+
|
66
|
+
def required_fields
|
67
|
+
FIELDS.reject { |k,v| v[:optional] }.map { |f| f[0] }.map(&:intern)
|
68
|
+
end
|
69
|
+
|
70
|
+
def errors
|
71
|
+
errors = []
|
72
|
+
unless configured?
|
73
|
+
errors << [:base, 'You must specify your Redmine URL, API token, Username, Password and Project ID']
|
74
|
+
end
|
75
|
+
errors
|
76
|
+
end
|
77
|
+
|
78
|
+
def create_issue(problem, reported_by = nil)
|
79
|
+
token = params['api_token']
|
80
|
+
acc = params['account']
|
81
|
+
user = params['username']
|
82
|
+
passwd = params['password']
|
83
|
+
project_id = params['project_id']
|
84
|
+
|
85
|
+
RedmineClient::Base.configure do
|
86
|
+
self.token = token
|
87
|
+
self.user = user
|
88
|
+
self.password = passwd
|
89
|
+
self.site = acc
|
90
|
+
self.format = :xml
|
91
|
+
end
|
92
|
+
|
93
|
+
issue = RedmineClient::Issue.new(:project_id => project_id)
|
94
|
+
issue.subject = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}"
|
95
|
+
issue.description = self.class.body_template.result(binding)
|
96
|
+
issue.save!
|
97
|
+
|
98
|
+
problem.update_attributes(
|
99
|
+
:issue_link => issue_link(issue),
|
100
|
+
:issue_type => LABEL
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
def issue_link(issue)
|
105
|
+
project_id = params['project_id']
|
106
|
+
|
107
|
+
RedmineClient::Issue.site.to_s
|
108
|
+
.sub(/#{RedmineClient::Issue.site.path}$/, '') <<
|
109
|
+
RedmineClient::Issue.element_path(issue.id, :project_id => project_id)
|
110
|
+
.sub(/\.xml\?project_id=#{project_id}$/, "\?project_id=#{project_id}")
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.body_template
|
114
|
+
@body_template ||= ERB.new(File.read(
|
115
|
+
File.join(
|
116
|
+
ErrbitRedminePlugin.root, 'views', 'redmine_ticket_body.txt.erb'
|
117
|
+
)
|
118
|
+
))
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "errbit_redmine_plugin/version"
|
2
|
+
require 'errbit_redmine_plugin/issue_tracker'
|
3
|
+
require 'errbit_redmine_plugin/rails'
|
4
|
+
|
5
|
+
module ErrbitRedminePlugin
|
6
|
+
def self.root
|
7
|
+
File.expand_path '../..', __FILE__
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
ErrbitPlugin::Registry.add_issue_tracker(ErrbitRedminePlugin::IssueTracker)
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if notice = problem.notices.first %>
|
2
|
+
h2. Summary
|
3
|
+
<% if notice.request['url'].present? %>
|
4
|
+
h3. URL
|
5
|
+
|
6
|
+
"<%= notice.request['url'] %>":<%= notice.request['url'] %>
|
7
|
+
<% end %>
|
8
|
+
h3. Where
|
9
|
+
|
10
|
+
<%= notice.where %>
|
11
|
+
|
12
|
+
h3. When
|
13
|
+
|
14
|
+
<%= notice.created_at.to_s(:micro) %>
|
15
|
+
|
16
|
+
"More Details on Errbit":<%= problem.url %>
|
17
|
+
<% end %>
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: errbit_redmine_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-09-08 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'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oruen_redmine_client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Redmine integration for Errbit
|
70
|
+
email:
|
71
|
+
- stevecrozz@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".ruby-version"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- Rakefile
|
81
|
+
- errbit_redmine_plugin.gemspec
|
82
|
+
- lib/errbit_redmine_plugin.rb
|
83
|
+
- lib/errbit_redmine_plugin/issue_tracker.rb
|
84
|
+
- lib/errbit_redmine_plugin/rails.rb
|
85
|
+
- lib/errbit_redmine_plugin/version.rb
|
86
|
+
- vendor/assets/images/redmine_create.png
|
87
|
+
- vendor/assets/images/redmine_goto.png
|
88
|
+
- vendor/assets/images/redmine_inactive.png
|
89
|
+
- views/redmine_ticket_body.txt.erb
|
90
|
+
homepage: https://github.com/brandedcrate/errbit_redmine_plugin
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.2.2
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Redmine integration for Errbit
|
114
|
+
test_files: []
|
115
|
+
has_rdoc:
|