redmine-reporting 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b87630b0f4b777429f6c3ff4de4586eee52909
|
4
|
+
data.tar.gz: 7a86c92b6a44c5d88e2bdfb43d2ebdd2d389e360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258104f8eab4e65d97e8df80fc6cf278d17baca7fcbf1afee9d75f6c5f34077f353764e2d6d791b4d61dcec09804ebba61e3b41e4ec3a401c78cee5dd9309c24
|
7
|
+
data.tar.gz: 7b12cc3281fc0698042d343962af12f21e8ae0f6d441152009357f77725173e6b469544e2b8d465ca4fdb44dd575c584d10009d217d986ea0e475892aedd2c2d
|
@@ -30,12 +30,12 @@ module Redmine
|
|
30
30
|
|
31
31
|
Redmine::Reporting.report(exception) do
|
32
32
|
notes do
|
33
|
-
section("URL: #{desc[:url]}", '')
|
33
|
+
section("URL: #{desc[:url]} (#{desc[:params][:controller]}##{desc[:params][:action]})", '')
|
34
34
|
section('Parameters') do
|
35
|
-
output(desc[:params].collect{|k,v| "*
|
35
|
+
output(desc[:params].select{|k,v| ![:controller, :action].include?(k)}.collect{|k,v| "* *#{k}:* #{v}"}.join("\n"))
|
36
36
|
end
|
37
37
|
section('Session') do
|
38
|
-
output(desc[:session].collect{|k,v| "*
|
38
|
+
output(desc[:session].collect{|k,v| "* *#{k}:* #{v}"}.join("\n"))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -28,6 +28,8 @@ module Redmine
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def commit
|
31
|
+
reference_id = "#{Zlib.crc32(Time.now.to_f.to_s).to_s(16)}#{Zlib.crc32(@subject).to_s(16)}#{Zlib.crc32(@description).to_s(16)}"
|
32
|
+
|
31
33
|
options = (config[:http_options] || {}).merge({
|
32
34
|
headers: {
|
33
35
|
'Content-type' => 'application/json',
|
@@ -35,7 +37,10 @@ module Redmine
|
|
35
37
|
}
|
36
38
|
})
|
37
39
|
|
38
|
-
if
|
40
|
+
# add reference_id to description if updates are disabled
|
41
|
+
@description = "h1. #{reference_id}\n\n#{@description}" if config[:no_update]
|
42
|
+
|
43
|
+
if saved_issue_id.nil?
|
39
44
|
resp = HTTParty.post("#{config[:base_url]}/issues.json", options.merge({
|
40
45
|
body: {
|
41
46
|
issue: {
|
@@ -50,12 +55,12 @@ module Redmine
|
|
50
55
|
|
51
56
|
iid = resp['issue']['id'] rescue nil
|
52
57
|
|
53
|
-
|
58
|
+
save_issue_data(iid, reference_id) unless iid.nil?
|
54
59
|
end
|
55
60
|
|
56
|
-
return false if issue_id.nil?
|
61
|
+
return false if (issue_id = saved_issue_id).nil?
|
57
62
|
|
58
|
-
|
63
|
+
return saved_reference_id if config[:no_update]
|
59
64
|
|
60
65
|
resp = HTTParty.put("#{config[:base_url]}/issues/#{issue_id}.json", options.merge({
|
61
66
|
body: {
|
@@ -65,6 +70,8 @@ module Redmine
|
|
65
70
|
}.to_json
|
66
71
|
}))
|
67
72
|
|
73
|
+
save_issue_data(issue_id, reference_id)
|
74
|
+
|
68
75
|
reference_id
|
69
76
|
rescue => e
|
70
77
|
# TODO ignore
|
@@ -81,6 +88,10 @@ module Redmine
|
|
81
88
|
nil
|
82
89
|
end
|
83
90
|
|
91
|
+
def chapter(title, content=nil, &block)
|
92
|
+
syntax_section('h1', title, content, &block)
|
93
|
+
end
|
94
|
+
|
84
95
|
def section(title, content=nil, &block)
|
85
96
|
syntax_section('h2', title, content, &block)
|
86
97
|
end
|
@@ -116,13 +127,26 @@ module Redmine
|
|
116
127
|
File.join(Dir.tmpdir, "redmine_reporting_#{issue_hash}")
|
117
128
|
end
|
118
129
|
|
119
|
-
def issue_id
|
130
|
+
def save_issue_data(issue_id, reference_id)
|
131
|
+
File.open(issue_id_file, File::CREAT|File::TRUNC|File::RDWR, 0600) {|f| f.write("#{issue_id.to_s};#{reference_id}")}
|
132
|
+
end
|
133
|
+
|
134
|
+
def read_issue_data
|
135
|
+
data = [nil, nil]
|
136
|
+
|
120
137
|
if File.exists?(issue_id_file)
|
121
|
-
|
122
|
-
return id if id > 0
|
138
|
+
data = File.open(issue_id_file, 'r').read.split(';').collect{|d| d.strip} rescue [nil, nil]
|
123
139
|
end
|
124
140
|
|
125
|
-
|
141
|
+
data
|
142
|
+
end
|
143
|
+
|
144
|
+
def saved_issue_id
|
145
|
+
read_issue_data.first
|
146
|
+
end
|
147
|
+
|
148
|
+
def saved_reference_id
|
149
|
+
read_issue_data.last
|
126
150
|
end
|
127
151
|
|
128
152
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine-reporting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|