errbit_plugin 0.5.0 → 0.6.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: 379974aa8a736ab97c68e86d35a8a4abe74cf078
4
- data.tar.gz: 68538a72756d7286cab6603f2fd5ff0eaf853a9e
3
+ metadata.gz: 0da88b0c10182c8a6cdcd9027d600a3149dc2e29
4
+ data.tar.gz: 0ebd3654aff4015119a467f1db58967f3f5c70b4
5
5
  SHA512:
6
- metadata.gz: 0946dc453bf1c7a0eb1ec1091edd135287e7734684fb3291b2e29241739fbaa321adedde1ba71f14b2d29a60c72a90b9d010fbea810475937136616970f7b232
7
- data.tar.gz: 8487cad20bfe5f99001a0a3974424b4de1fea6a100336ff344bbe6fc72aa263d8e98c2c6d2dea9448fb4579b31f3484dc9ad9e6d522e87a64fb0cdd473e00b1c
6
+ metadata.gz: 67de6652286cec7dc1f78c2496235a2f10460786e7327c0900b66bef4d394d567d216de034df19757a0c7892e06547a51b655424350742b36a2bd0a249423a52
7
+ data.tar.gz: c33bc5ac88fe5707687e63c8ee7aaba80c90a361d0d6e9bdba064cbf26c1cde1e9862ab3b6ec9a570ca763dfc2fda0f876a6aa93043b67f5c6ca113d07f003e7
@@ -1,13 +1,15 @@
1
1
  language: ruby
2
2
  env:
3
3
  - COVERAGE=true
4
+ before_install:
5
+ - gem install bundler
4
6
  script: bundle exec rspec spec
5
7
  rvm:
6
- - 2.0.0
7
- - 1.9.3
8
- - rbx-19mode
8
+ - 2.1
9
+ - 2.2
10
+ - 2.3.0
11
+ - rbx-2
9
12
  - ruby-head
10
13
  matrix:
11
14
  allow_failures:
12
- - rvm: rbx-19mode
13
15
  - rvm: ruby-head
data/README.md CHANGED
@@ -16,7 +16,9 @@ errbit to an issue in an external issue tracker like Github. An app within
16
16
  errbit can be associated an issue tracker or not. When there is an association,
17
17
  errbit users can choose 'create issue' from an error page which will both
18
18
  create an issue on the external issue tracker out of the given error and link
19
- that issue to the errbit error.
19
+ that issue to the errbit error. Likewise, a user can also choose 'close issue'
20
+ to close the issue on the external issue tracker, if your plugin provides a
21
+ method to do so.
20
22
 
21
23
  Your issue tracker plugin is responsible for providing the interface defined by
22
24
  ErrbitPlugin::IssueTracker. All of the required methods must be implemented and
@@ -42,7 +44,8 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
42
44
  placeholder: "Some placeholder text"
43
45
  },
44
46
  password: {
45
- placeholder: "Some more placeholder text"
47
+ placeholder: "Some more placeholder text",
48
+ label: "Passphrase" # a label to use in the UI instead of 'password'
46
49
  }
47
50
  }
48
51
  end
@@ -63,30 +66,53 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
63
66
  # errbit know by returning a Boolean here
64
67
  def configured?
65
68
  # In this case, we'll say this issue tracker is configured when username
66
- # is set
67
- !!params['username']
69
+ # and password are set
70
+ options[:username].present? && options[:password].present?
68
71
  end
69
72
 
70
73
  # Called to validate user input. Just return a hash of errors if there are
71
74
  # any
72
75
  def errors
73
- if @params['field_one']
76
+ if options[:username]
74
77
  {}
75
78
  else
76
- { :field_one, 'Field One must be present' }
79
+ { field_one: 'username must be present' }
77
80
  end
78
81
  end
79
82
 
80
83
  # This is where you actually go create the issue on the external issue
81
- # tracker. You get access to everything in params, a problem resource and a
82
- # user resource (reported_by). Once you've created an external issue, save
83
- # its type and url on the problem resource.
84
- def create_issue(problem, reported_by = nil)
84
+ # tracker. You get access to everything in options, an issue title, body and
85
+ # a user record representing the user who's creating the issue.
86
+ #
87
+ # Return a string with a link to the issue
88
+ def create_issue(title, body, user: {})
85
89
  # Create an issue! Then update the problem to link it.
86
- problem.update_attributes(
87
- :issue_type => 'bug',
88
- :issue_link => 'http://some-remote-tracker.com/mynewissue'
89
- )
90
+
91
+ 'http://sometracker.com/my/issue/123'
92
+ end
93
+
94
+ # This method is optional. Errbit will create body text for your issue by
95
+ # calling render_to_string with some arguments. If you want control over
96
+ # those arguments, you can specify them here. You can control which file is
97
+ # rendered and anything else Rails allows you to specify as arguments in
98
+ # render_to_string.
99
+ #
100
+ # If you don't implement this method, Errbit will render a body using a
101
+ # default template
102
+ #
103
+ # @see http://apidock.com/rails/ActionController/Base/render_to_string
104
+ def render_body_args
105
+ # In this example, we want to render a special file
106
+ ['/path/to/some/template', formats: [:rdoc]]
107
+ end
108
+
109
+ # This method is optional, and is where you actually go close the issue on
110
+ # the external issue tracker. You get access to everything in options, a
111
+ # string with a link to the issue # and a user resource.
112
+ #
113
+ # return true if successful, false otherwise
114
+ def close_issue(issue_link, user = {})
115
+ # Close the issue! (Perhaps using the passed in issue_link url to identify it.)
90
116
  end
91
117
 
92
118
  # The URL for your remote issue tracker
@@ -96,6 +122,8 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker
96
122
  end
97
123
  ```
98
124
 
125
+
126
+
99
127
  ## Contributing
100
128
 
101
129
  Discuss any changes you'd like to make with the authors on the mailing list, or
@@ -23,7 +23,8 @@ module ErrbitPlugin
23
23
  def configured?; false; end
24
24
  def errors; {}; end
25
25
  def url; ''; end
26
- def create_issue(*); true; end
26
+ def create_issue(*); false; end
27
+ def close_issue(*); false; end
27
28
  end
28
29
  end
29
30
 
@@ -1,3 +1,3 @@
1
1
  module ErrbitPlugin
2
- VERSION = "0.5.0"
2
+ VERSION = '0.6.0'
3
3
  end
@@ -12,6 +12,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
12
12
  def configured?; true; end
13
13
  def errors; true; end
14
14
  def create_issue; 'http'; end
15
+ def close_issue; 'http'; end
15
16
  def url; 'http'; end
16
17
  end
17
18
 
@@ -30,6 +31,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
30
31
  def configured?; true; end
31
32
  def errors; true; end
32
33
  def create_issue; 'http'; end
34
+ def close_issue; 'http'; end
33
35
  def url; 'http'; end
34
36
  end
35
37
 
@@ -52,6 +54,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
52
54
  def configured?; true; end
53
55
  def errors; true; end
54
56
  def create_issue; 'http'; end
57
+ def close_issue; 'http'; end
55
58
  def url; 'http'; end
56
59
  end
57
60
 
@@ -59,7 +62,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
59
62
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
60
63
  end
61
64
 
62
- it 'say not implement configured?' do
65
+ it 'say not implement label method' do
63
66
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
64
67
  is.valid?
65
68
  expect(is.errors).to eql [[:class_method_missing, :label]]
@@ -74,6 +77,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
74
77
  def configured?; true; end
75
78
  def errors; true; end
76
79
  def create_issue; 'http'; end
80
+ def close_issue; 'http'; end
77
81
  def url; 'http'; end
78
82
  end
79
83
 
@@ -81,7 +85,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
81
85
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
82
86
  end
83
87
 
84
- it 'say not implement configured?' do
88
+ it 'say not implement icons method' do
85
89
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
86
90
  is.valid?
87
91
  expect(is.errors).to eql [[:class_method_missing, :icons]]
@@ -96,6 +100,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
96
100
  def configured?; true; end
97
101
  def errors; true; end
98
102
  def create_issue; 'http'; end
103
+ def close_issue; 'http'; end
99
104
  def url; 'http'; end
100
105
  end
101
106
 
@@ -103,7 +108,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
103
108
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
104
109
  end
105
110
 
106
- it 'say not implement configured?' do
111
+ it 'say not implement fields method' do
107
112
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
108
113
  is.valid?
109
114
  expect(is.errors).to eql [[:class_method_missing, :fields]]
@@ -118,6 +123,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
118
123
  def self.icons; {}; end
119
124
  def errors; true; end
120
125
  def create_issue; 'http'; end
126
+ def close_issue; 'http'; end
121
127
  def url; 'http'; end
122
128
  end
123
129
 
@@ -125,7 +131,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
125
131
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
126
132
  end
127
133
 
128
- it 'say not implement configured?' do
134
+ it 'say not implement configured? method' do
129
135
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
130
136
  is.valid?
131
137
  expect(is.errors).to eql [[:instance_method_missing, :configured?]]
@@ -140,6 +146,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
140
146
  def self.icons; {}; end
141
147
  def configured?; true; end
142
148
  def create_issue; 'http'; end
149
+ def close_issue; 'http'; end
143
150
  def url; 'http'; end
144
151
  end
145
152
 
@@ -147,7 +154,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
147
154
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
148
155
  end
149
156
 
150
- it 'say not implement errors' do
157
+ it 'say not implement errors method' do
151
158
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
152
159
  is.valid?
153
160
  expect(is.errors).to eql [[:instance_method_missing, :errors]]
@@ -162,19 +169,43 @@ describe ErrbitPlugin::ValidateIssueTracker do
162
169
  def self.icons; {}; end
163
170
  def configured?; true; end
164
171
  def errors; true; end
172
+ def close_issue; 'http'; end
165
173
  def url; 'http'; end
166
174
  end
167
175
 
168
176
  it 'not valid' do
169
177
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
170
178
  end
171
- it 'say not implement url' do
179
+ it 'say not implement create_issue method' do
172
180
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
173
181
  is.valid?
174
182
  expect(is.errors).to eql [[:instance_method_missing, :create_issue]]
175
183
  end
176
184
  end
177
185
 
186
+ context "without close_issue method" do
187
+ # this is an optional method
188
+ klass = Class.new(ErrbitPlugin::IssueTracker) do
189
+ def self.label; 'foo'; end
190
+ def self.note; 'foo'; end
191
+ def self.fields; ['foo']; end
192
+ def self.icons; {}; end
193
+ def configured?; true; end
194
+ def errors; true; end
195
+ def create_issue; 'http'; end
196
+ def url; 'http'; end
197
+ end
198
+
199
+ it 'is valid' do
200
+ expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true
201
+ end
202
+ it 'not say not implement close_issue method' do
203
+ is = ErrbitPlugin::ValidateIssueTracker.new(klass)
204
+ is.valid?
205
+ expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]]
206
+ end
207
+ end
208
+
178
209
  context "without url method" do
179
210
  klass = Class.new(ErrbitPlugin::IssueTracker) do
180
211
  def self.label; 'foo'; end
@@ -184,13 +215,14 @@ describe ErrbitPlugin::ValidateIssueTracker do
184
215
  def configured?; true; end
185
216
  def errors; true; end
186
217
  def create_issue; 'http'; end
218
+ def close_issue; 'http'; end
187
219
  end
188
220
 
189
221
  it 'not valid' do
190
222
  expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false
191
223
  end
192
224
 
193
- it 'say not implement url' do
225
+ it 'say not implement url method' do
194
226
  is = ErrbitPlugin::ValidateIssueTracker.new(klass)
195
227
  is.valid?
196
228
  expect(is.errors).to eql [[:instance_method_missing, :url]]
@@ -205,6 +237,7 @@ describe ErrbitPlugin::ValidateIssueTracker do
205
237
  def configured?; true; end
206
238
  def errors; true; end
207
239
  def create_issue; 'http'; end
240
+ def close_issue; 'http'; end
208
241
  def url; 'foo'; end
209
242
  end
210
243
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errbit_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.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: 2015-04-23 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler