exception_notification-redmine 0.2.0 → 0.3.0

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: 7ea5ba9a31d299f90a015b6fddb06b635e543709
4
- data.tar.gz: abc9e443b816d759b577560e9973411df7ecb4d3
3
+ metadata.gz: 6235ab191a5880fb5c9c9718518050dd57e2d49a
4
+ data.tar.gz: 1ca42e1f816262522f350cb224f56eedd562d666
5
5
  SHA512:
6
- metadata.gz: b495d7d0926c6b2ffcd94fd31dea5800f4243d1b27ea76822d31f7df77c276774a9435acc17e14ce232bf3484727d9994afd901391d484a3a5d477f65df44b9d
7
- data.tar.gz: db0682b400dd395e92a13e09f8710d5d2be1562c95db26d8d0d64a2df661401a43dbcdb9f77d9064a26a6f4a5524f01177c5c91418373b143e4f32aca1323f65
6
+ metadata.gz: 70c2ab0f07145522de3484038b7a74da3225e449b81bbfd61eebbf704fc58eeff0ccd10839332a8becdfee9bfac087e71087da287aacc76955a271ad0b8b23a3
7
+ data.tar.gz: 7038fd21ffd6cb7996076841d48aa9711d81c9d55882d41f9cc6652e063f5382ac4ac3bb8449892f7587fabc9e05172424c92950505044ce9e4e78e8a1543588
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ ### Version 0.3.0
2
+ - Add to issue: assigned_to_id is now optional
3
+ - Add to issue: fixed_version_id (optional) to notifier (Thanks @hugoangelo)
4
+ - Update redmine.rb: Fixing uninitialized constant (Thanks @PofMagicfingers)
5
+ - Log some debug info when something goes wrong (Thanks @nathanvda)
6
+ - Loosen version restrictions (Thanks @nathanvda)
7
+
8
+ ### Version 0.2.0
9
+ - Add issue fomatting in Redmine
10
+ - Add default issue prefix title
11
+
12
+ ### Version 0.1.1
13
+ Update README.md
14
+
15
+ ### Version 0.1.0
16
+ - Version bump
17
+ - add README.md, TODO.md, and LICENCE
18
+
19
+ ### Version 0.0.2
20
+ Use a custom field to avoid creation of same issue multiple times
21
+
22
+ ### Version 0.0.1
23
+ Initial release
data/README.md CHANGED
@@ -39,8 +39,9 @@ Whatever::Application.config.middleware.use ExceptionNotification::Rack,
39
39
  # assigned_to_id: create issues which are assigned to the given user_id
40
40
  # priority_id: create issues with the given priority_id
41
41
  # status_id: create issues with the given status_id
42
+ # fixed_version_id: create issues with the given fixed_version_id (aka target version id)
42
43
  # x_checksum_cf_id: custom field used to avoid creation of the same issue multiple times. You must use the DOM id assigned by Redmine to this field in the issue form. You can find it by creating an issue manually in your project and inspecting the HTML form, you should see something like name="issue[custom_field_values][19]", in this case the id would be 19.
43
-
44
+
44
45
  :redmine => {
45
46
  :host_url => "https://redmine.example.com",
46
47
  :issues_url => "issues.json",
@@ -51,6 +52,7 @@ Whatever::Application.config.middleware.use ExceptionNotification::Rack,
51
52
  :assigned_to_id => "123",
52
53
  :priority_id => "6", # Urgent
53
54
  :status_id => "1", # New
55
+ :fixed_version_id => "1", # id of the issue target version on redmine
54
56
  :x_checksum_cf_id => "19" # DOM id in Redmine issue form
55
57
  }
56
58
  ```
@@ -21,11 +21,11 @@ Gem::Specification.new do |s|
21
21
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
22
  s.require_paths = ["lib"]
23
23
 
24
- s.add_dependency("exception_notification", "~> 4.0.1")
25
- s.add_dependency("httparty", "~> 0.10.2")
26
- s.add_dependency("json", "~> 1.8.1")
24
+ s.add_dependency("exception_notification", "~> 4.0")
25
+ s.add_dependency("httparty", "~> 0.10")
26
+ s.add_dependency("json", ">= 1.8")
27
27
 
28
28
  s.add_development_dependency "bundler", "~> 1.7"
29
- s.add_development_dependency "rake", "~> 10.0"
29
+ s.add_development_dependency "rake", ">= 10.0"
30
30
 
31
31
  end
@@ -1,5 +1,5 @@
1
1
  module ExceptionNotification
2
2
  module Redmine
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -5,16 +5,14 @@ require 'erb'
5
5
  require 'pp'
6
6
 
7
7
  module ExceptionNotifier
8
-
9
8
  class RedmineNotifier
10
-
11
9
  module Redmine
12
10
  class MissingController
13
11
  def method_missing(*args, &block)
14
12
  end
15
13
  end
16
14
  end
17
-
15
+
18
16
  def initialize(config)
19
17
  @config = config
20
18
  end
@@ -26,33 +24,34 @@ module ExceptionNotifier
26
24
  create_issue(issue) unless issue_exist?(issue)
27
25
  end
28
26
  end
29
-
27
+
30
28
  private
31
29
 
32
30
  def compose_data(env, exception, options = {})
33
31
  @env = env
34
32
  @exception = exception
35
33
  @options = options
36
- @kontroller = env['action_controller.instance'] || MissingController.new
34
+ @kontroller = env['action_controller.instance'] || Redmine::MissingController.new
37
35
  @request = ActionDispatch::Request.new(env)
38
36
  @backtrace = exception.backtrace ? clean_backtrace(exception) : []
39
37
  @data = (env['exception_notifier.exception_data'] || {}).merge(options[:data] || {})
40
38
  end
41
-
39
+
42
40
  def compose_issue
43
41
  issue = {}
44
42
  issue[:project_id] = @config[:project_id]
45
43
  issue[:tracker_id] = @config[:tracker_id]
46
44
  issue[:status_id] = @config[:status_id]
47
45
  issue[:priority_id] = @config[:priority_id]
48
- issue[:assigned_to_id] = @config[:assigned_to_id]
46
+ issue[:assigned_to_id] = @config[:assigned_to_id] unless @config[:assigned_to_id].nil?
47
+ issue[:fixed_version_id] = @config[:fixed_version_id] unless @config[:fixed_version_id].nil?
49
48
  issue[:subject] = compose_subject
50
49
  issue[:custom_fields] = [{ :id => @config[:x_checksum_cf_id],
51
50
  :value => encode_subject(issue[:subject])}]
52
51
  issue[:description] = compose_description
53
52
  issue
54
53
  end
55
-
54
+
56
55
  def compose_subject
57
56
  subject = "#{@config[:issues_prefix]} " || "[Error] "
58
57
  subject << "#{@kontroller.controller_name}##{@kontroller.action_name}" if @kontroller
@@ -83,14 +82,17 @@ module ExceptionNotifier
83
82
  x_checksum = issue[:custom_fields][0][:value]
84
83
  response = ::HTTParty.send(:get, issues_url("project_id" => @config[:project_id],
85
84
  "cf_#{@config[:x_checksum_cf_id]}" => x_checksum))
86
- raise "Unexpected Response" if response.nil? || response["total_count"].nil?
85
+ if response.nil? || response["total_count"].nil?
86
+ Rails.logger.debug "Received unexpected response: #{response.inspect}"
87
+ raise "Unexpected Response"
88
+ end
87
89
  response["total_count"] > 0
88
90
  end
89
91
 
90
92
  def encode_subject(subject)
91
93
  Digest::SHA2.hexdigest(subject)
92
94
  end
93
-
95
+
94
96
  def clean_backtrace(exception)
95
97
  if defined?(Rails) && Rails.respond_to?(:backtrace_cleaner)
96
98
  Rails.backtrace_cleaner.send(:filter, exception.backtrace)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_notification-redmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Piacentini
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 4.0.1
20
+ version: '4.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 4.0.1
27
+ version: '4.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: httparty
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.10.2
34
+ version: '0.10'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.10.2
41
+ version: '0.10'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: json
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 1.8.1
48
+ version: '1.8'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.8.1
55
+ version: '1.8'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -71,14 +71,14 @@ dependencies:
71
71
  name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '10.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '10.0'
84
84
  description: This Ruby gem is an extension of the exception_notification gem to support
@@ -91,7 +91,7 @@ extensions: []
91
91
  extra_rdoc_files: []
92
92
  files:
93
93
  - ".gitignore"
94
- - CHANGELOG
94
+ - CHANGELOG.md
95
95
  - Gemfile
96
96
  - LICENSE
97
97
  - README.md
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.6.11
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: This gem add a Redmine notifier to Exception Notification
data/CHANGELOG DELETED
@@ -1,7 +0,0 @@
1
- Version 0.0.1: Initial release
2
- Version 0.0.2: Use a custom field to avoid creation of same issue multiple times
3
- Version 0.1.0: Version bump, add README.md, TODO.md and LICENCE
4
- Version 0.1.1: Update README.md
5
- Version 0.2.0:
6
- - Add issue fomatting in Redmine
7
- - Add default issue prefix title