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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff53ecfb7e10ed33b14d595638647f990101288a
4
- data.tar.gz: ab240fcfcca18705d0c9e266d4a5f65e2bb35c84
3
+ metadata.gz: 4ef1b42ae759806849e109ba560739bfad3a9469
4
+ data.tar.gz: 121672f941acf7f90a5982dab9d527654e4cb4e4
5
5
  SHA512:
6
- metadata.gz: d95d4d007b7a78ddf1d6322d89b66ce077ff6b17bfe415bfa7f62676be0383353359df1886b3fc22b602f1dfe637d943226f5557e0c2b7a69abe5226930238c7
7
- data.tar.gz: 3359d03bd57cf75c7d6a5ac83e2c5080dd217e00a29b2685c0344565c470500ac3357ec22169c2bcd740d0d758b50532ebd36325edc32d92776195a14b4f746c
6
+ metadata.gz: de3712d4eef32ca420438aaf4b9fa06d1d67eaaafb1bb93de3c7ebc74fe74363b4bd36d3094ce22c70b49518c3c8116db2019274dd29bbb5714a04d48e45eff8
7
+ data.tar.gz: c8b8367d5bc32a22d299790aea6ab02f67f208a7875dc6aac016b6eedc5ad02075d5cfa008c3fbd3bcea85d8bfedf6d2d79340aeb2b13f7a435b1ea159dfa4b5
@@ -1,11 +1,14 @@
1
- require "errbit_redmine_plugin/version"
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 = params['account']
54
- project_id = params['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
- non_empty_params = params.reject { |k,v| v.empty? }.keys.map(&:intern)
69
- (required_fields - non_empty_params).empty?
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(problem, reported_by = nil)
85
- token = params['api_token']
86
- acc = params['account']
87
- user = params['username']
88
- passwd = params['password']
89
- project_id = params['project_id']
90
- tracker_id = params['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 = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}"
102
- issue.description = self.class.body_template.result(binding)
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
- problem.update_attributes(
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 = params['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
@@ -1,3 +1,3 @@
1
1
  module ErrbitRedminePlugin
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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: 2014-12-07 00:00:00.000000000 Z
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
- - 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
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
@@ -1 +0,0 @@
1
- 2.1.1
@@ -1,8 +0,0 @@
1
- if defined?(Rails)
2
- module ErrbitRedminePlugin
3
- module Rails
4
- class Engine < ::Rails::Engine
5
- end
6
- end
7
- end
8
- end
@@ -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 %>