errbit_redmine_plugin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/errbit_redmine_plugin.rb +5 -2
- data/lib/errbit_redmine_plugin/issue_tracker.rb +29 -26
- data/lib/errbit_redmine_plugin/version.rb +1 -1
- data/{vendor/assets/images → static}/redmine_create.png +0 -0
- data/{vendor/assets/images → static}/redmine_goto.png +0 -0
- data/{vendor/assets/images → static}/redmine_inactive.png +0 -0
- metadata +5 -8
- data/.ruby-version +0 -1
- data/lib/errbit_redmine_plugin/rails.rb +0 -8
- data/views/redmine_ticket_body.txt.erb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef1b42ae759806849e109ba560739bfad3a9469
|
4
|
+
data.tar.gz: 121672f941acf7f90a5982dab9d527654e4cb4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de3712d4eef32ca420438aaf4b9fa06d1d67eaaafb1bb93de3c7ebc74fe74363b4bd36d3094ce22c70b49518c3c8116db2019274dd29bbb5714a04d48e45eff8
|
7
|
+
data.tar.gz: c8b8367d5bc32a22d299790aea6ab02f67f208a7875dc6aac016b6eedc5ad02075d5cfa008c3fbd3bcea85d8bfedf6d2d79340aeb2b13f7a435b1ea159dfa4b5
|
@@ -1,11 +1,14 @@
|
|
1
|
-
require
|
1
|
+
require 'errbit_redmine_plugin/version'
|
2
2
|
require 'errbit_redmine_plugin/issue_tracker'
|
3
|
-
require 'errbit_redmine_plugin/rails'
|
4
3
|
|
5
4
|
module ErrbitRedminePlugin
|
6
5
|
def self.root
|
7
6
|
File.expand_path '../..', __FILE__
|
8
7
|
end
|
8
|
+
|
9
|
+
def self.read_static_file(file)
|
10
|
+
File.read(File.join(self.root, 'static', file))
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
ErrbitPlugin::Registry.add_issue_tracker(ErrbitRedminePlugin::IssueTracker)
|
@@ -49,9 +49,23 @@ module ErrbitRedminePlugin
|
|
49
49
|
FIELDS
|
50
50
|
end
|
51
51
|
|
52
|
+
def self.icons
|
53
|
+
@icons ||= {
|
54
|
+
create: [
|
55
|
+
'image/png', ErrbitRedminePlugin.read_static_file('redmine_create.png')
|
56
|
+
],
|
57
|
+
goto: [
|
58
|
+
'image/png', ErrbitRedminePlugin.read_static_file('redmine_goto.png'),
|
59
|
+
],
|
60
|
+
inactive: [
|
61
|
+
'image/png', ErrbitRedminePlugin.read_static_file('redmine_inactive.png'),
|
62
|
+
]
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
52
66
|
def url
|
53
|
-
account =
|
54
|
-
project_id =
|
67
|
+
account = options['account']
|
68
|
+
project_id = options['project_id']
|
55
69
|
|
56
70
|
acc_url = account.start_with?('http') ? account : "http://#{account}"
|
57
71
|
acc_url = acc_url.gsub(/\/$/, '')
|
@@ -65,8 +79,8 @@ module ErrbitRedminePlugin
|
|
65
79
|
|
66
80
|
# configured properly if all the fields are filled in
|
67
81
|
def configured?
|
68
|
-
|
69
|
-
(required_fields -
|
82
|
+
non_empty_options = options.reject { |k,v| v.empty? }.keys.map(&:intern)
|
83
|
+
(required_fields - non_empty_options).empty?
|
70
84
|
end
|
71
85
|
|
72
86
|
def required_fields
|
@@ -81,13 +95,13 @@ module ErrbitRedminePlugin
|
|
81
95
|
errors
|
82
96
|
end
|
83
97
|
|
84
|
-
def create_issue(
|
85
|
-
token =
|
86
|
-
acc =
|
87
|
-
user =
|
88
|
-
passwd =
|
89
|
-
project_id =
|
90
|
-
tracker_id =
|
98
|
+
def create_issue(title, body, user: {})
|
99
|
+
token = options['api_token']
|
100
|
+
acc = options['account']
|
101
|
+
user = options['username']
|
102
|
+
passwd = options['password']
|
103
|
+
project_id = options['project_id']
|
104
|
+
tracker_id = options['tracker_id']
|
91
105
|
|
92
106
|
RedmineClient::Base.configure do
|
93
107
|
self.token = token
|
@@ -98,32 +112,21 @@ module ErrbitRedminePlugin
|
|
98
112
|
end
|
99
113
|
|
100
114
|
issue = RedmineClient::Issue.new(:project_id => project_id)
|
101
|
-
issue.subject =
|
102
|
-
issue.description =
|
115
|
+
issue.subject = title
|
116
|
+
issue.description = body
|
103
117
|
issue.tracker_id = tracker_id if tracker_id.present?
|
104
118
|
issue.save!
|
105
119
|
|
106
|
-
|
107
|
-
:issue_link => issue_link(issue),
|
108
|
-
:issue_type => LABEL
|
109
|
-
)
|
120
|
+
issue_link(issue)
|
110
121
|
end
|
111
122
|
|
112
123
|
def issue_link(issue)
|
113
|
-
project_id =
|
124
|
+
project_id = options['project_id']
|
114
125
|
|
115
126
|
RedmineClient::Issue.site.to_s
|
116
127
|
.sub(/#{RedmineClient::Issue.site.path}$/, '') <<
|
117
128
|
RedmineClient::Issue.element_path(issue.id, :project_id => project_id)
|
118
129
|
.sub(/\.xml\?project_id=#{project_id}$/, "\?project_id=#{project_id}")
|
119
130
|
end
|
120
|
-
|
121
|
-
def self.body_template
|
122
|
-
@body_template ||= ERB.new(File.read(
|
123
|
-
File.join(
|
124
|
-
ErrbitRedminePlugin.root, 'views', 'redmine_ticket_body.txt.erb'
|
125
|
-
)
|
126
|
-
))
|
127
|
-
end
|
128
131
|
end
|
129
132
|
end
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errbit_redmine_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Crosby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: errbit_plugin
|
@@ -74,19 +74,16 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
|
-
- ".ruby-version"
|
78
77
|
- Gemfile
|
79
78
|
- LICENSE
|
80
79
|
- Rakefile
|
81
80
|
- errbit_redmine_plugin.gemspec
|
82
81
|
- lib/errbit_redmine_plugin.rb
|
83
82
|
- lib/errbit_redmine_plugin/issue_tracker.rb
|
84
|
-
- lib/errbit_redmine_plugin/rails.rb
|
85
83
|
- lib/errbit_redmine_plugin/version.rb
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
- views/redmine_ticket_body.txt.erb
|
84
|
+
- static/redmine_create.png
|
85
|
+
- static/redmine_goto.png
|
86
|
+
- static/redmine_inactive.png
|
90
87
|
homepage: https://github.com/brandedcrate/errbit_redmine_plugin
|
91
88
|
licenses:
|
92
89
|
- MIT
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.1
|
@@ -1,17 +0,0 @@
|
|
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 %>
|