lita-onewheel-cve 0.0.0 → 0.1.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: b19ac491e04e689d3204de5d024021c5053e2951
4
- data.tar.gz: 1d13a98cb3842cf1f14dbc189114596c5f37d6a5
3
+ metadata.gz: d158aeb9d1b922c42e1968b6ef4c48df35e69f94
4
+ data.tar.gz: 5bc0cadadd0a0dec07b3793840c355840d152b07
5
5
  SHA512:
6
- metadata.gz: 48576df8155843078baff47aaa8a7ec9ba0009ba0e1e5fbc02c5f74bc4448fb8cf19b261fdce942a0468dbe8151c959ef0ff08612da9e660adf55e6a382cf1d8
7
- data.tar.gz: 21bc2441b8308c56a75e48fd1b57293f4b20d136a8cc440215b98b9a4d5532938338ad7de85c1e60eefb105dfaed5548a119ddf3b83804d4b63808c113f2bf7d
6
+ metadata.gz: 8615408c8d014d74e5e3dc25d42e6b7015ad54e885737b141db877f5faca3473bebaf06e7bb172469b0f153276821568e30ce4c74625bf8721f64682666e6c67
7
+ data.tar.gz: 7dc1b3e3e44cb08a5290fe0c6b4d9c80c9f518d3475bf6c6050c3714da424b9e286ff6aadf63048d295affa0010e1befd882e3de7c9c1cf0aaf9ad0fe53f4e7a
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --profile 5
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Documentation:
2
+ Exclude:
3
+ - lib/lita/handlers/onewheel_cve.rb
4
+
5
+ FileName:
6
+ Exclude:
7
+ - lib/lita-onewheel-cve.rb
8
+
9
+ LineLength:
10
+ Max: 100
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.4
4
- script: bundle exec rake
5
- before_install:
6
- - gem update --system
3
+ - 2.2
4
+ - 2.3.0
7
5
  services:
8
6
  - redis-server
7
+ cache: bundler
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,9 @@
1
+ Pull requests are awesome! Pull requests with tests are even more awesome!
2
+
3
+ ## Quick steps
4
+
5
+ 1. Fork the repo.
6
+ 2. Run the tests: `bundle && rake`
7
+ 3. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, it needs a test!
8
+ 4. Make the test pass.
9
+ 5. Push to your fork and submit a pull request.
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2016 Andrew Kreps
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.rst CHANGED
@@ -1,21 +1,41 @@
1
- # lita-onewheel-cve
2
-
3
- [![Build Status](https://travis-ci.org/onewheelskyward/lita-onewheel-cve.png?branch=master)](https://travis-ci.org/onewheelskyward/lita-onewheel-cve)
4
- [![Coverage Status](https://coveralls.io/repos/onewheelskyward/lita-onewheel-cve/badge.png)](https://coveralls.io/r/onewheelskyward/lita-onewheel-cve)
1
+ lita-onewheel-cve
2
+ ----
3
+ |buildstatus|
4
+ |coveragestatus|
5
+ |license|
6
+ |rubygems|
7
+ |codeclimate|
8
+ |gemnasium|
9
+
10
+ .. |buildstatus| image:: https://travis-ci.org/onewheelskyward/lita-onewheel-cve.svg?branch=master
11
+ :target: https://travis-ci.org/onewheelskyward/lita-onewheel-cve
12
+ .. |coveragestatus| image:: https://coveralls.io/repos/github/onewheelskyward/lita-onewheel-cve/badge.svg?branch=master
13
+ :target: https://coveralls.io/github/onewheelskyward/lita-onewheel-cve?branch=master
14
+ .. |license| image:: https://img.shields.io/badge/license-MIT-brightgreen.svg
15
+ :target: https://tldrlegal.com/license/mit-license
16
+ .. |rubygems| image:: http://img.shields.io/gem/v/lita-onewheel-cve.svg
17
+ :target: https://rubygems.org/gems/lita-onewheel-cve
18
+ .. |codeclimate| image:: https://img.shields.io/codeclimate/github/onewheelskyward/lita-onewheel-cve.svg
19
+ :target: https://codeclimate.com/github/onewheelskyward/lita-onewheel-cve
20
+ .. |gemnasium| image:: https://img.shields.io/gemnasium/onewheelskyward/lita-onewheel-cve.svg
21
+ :target: https://gemnasium.com/onewheelskyward/lita-onewheel-cve
5
22
 
6
23
  Puts out links to CVEs when they're posted in chat.
7
24
 
8
- ## Installation
25
+ Configuration
26
+ ----
27
+ Optionally, override the default CVE search URL in your Lita configuration:
9
28
 
10
- Add lita-onewheel-cve to your Lita instance's Gemfile:
29
+ ``config.handlers.onewheel_cve.search_url = 'http://example.com/cve?id='``
11
30
 
12
- ``` ruby
13
- gem "lita-onewheel-cve"
14
- ```
31
+ Installation
32
+ ----
33
+ Add lita-onewheel-cve to your Lita instance's Gemfile:
15
34
 
16
- ## Usage
35
+ ``gem 'lita-onewheel-cve'``
17
36
 
18
- When someone mentions 'CVE-1234-1234' it'll post a link to mitre.org.
37
+ Usage
38
+ ----
39
+ When someone mentions 'CVE-1234-1234' it'll post a link to ``http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=1234-1234``.
19
40
 
20
41
  That's all, folks!
21
-
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new(:rubocop)
5
7
 
6
- task default: :spec
8
+ task default: [:spec, :rubocop]
@@ -1,11 +1,22 @@
1
1
  module Lita
2
2
  module Handlers
3
3
  class OnewheelCve < Handler
4
- route /cve-(\d{4}-\d{4})/i, :handle_cve, help: {'text including cve-1234-1234' => 'Will return a link to cve.mitre.org.'}
4
+ config :search_url, default: 'http://www.cve.mitre.org/cgi-bin/cvename.cgi?name='
5
+
6
+ route(
7
+ /(\s|^)cve-(?<id>\d{4}-\d{4})/i,
8
+ :handle_cve,
9
+ help: {
10
+ 'text including cve-1234-1234' => 'Will return a link to cve.mitre.org.'
11
+ }
12
+ )
5
13
 
6
14
  def handle_cve(response)
7
- response.reply 'http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=' + response.matches[0][0]
15
+ id = response.match_data['id']
16
+ url = config.search_url + id
17
+ response.reply url
8
18
  end
19
+
9
20
  Lita.register_handler(self)
10
21
  end
11
22
  end
@@ -8,5 +8,5 @@ require 'lita/handlers/onewheel_cve'
8
8
 
9
9
  Lita::Handlers::OnewheelCve.template_root File.expand_path(
10
10
  File.join('..', '..', 'templates'),
11
- __FILE__
11
+ __FILE__
12
12
  )
@@ -1,15 +1,15 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-cve'
3
- spec.version = '0.0.0'
3
+ spec.version = '0.1.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'CVE decoder to pull the root link from a CVE posted in chat.'
7
- spec.summary = 'See desc.'
7
+ spec.summary = spec.description
8
8
  spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-cve'
9
9
  spec.license = 'MIT'
10
10
  spec.metadata = { 'lita_plugin_type' => 'handler' }
11
11
 
12
- spec.files = `git ls-files`.split($/)
12
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
13
13
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
15
  spec.require_paths = ['lib']
@@ -17,10 +17,11 @@ Gem::Specification.new do |spec|
17
17
  spec.add_runtime_dependency 'lita', '~> 4.7'
18
18
 
19
19
  spec.add_development_dependency 'bundler', '~> 1.3'
20
- # spec.add_development_dependency 'pry-byebug'
20
+ spec.add_development_dependency 'coveralls', '~> 0.8'
21
+ spec.add_development_dependency 'pry-byebug'
21
22
  spec.add_development_dependency 'rake', '~> 10.4'
22
23
  spec.add_development_dependency 'rack-test', '~> 0.6'
23
24
  spec.add_development_dependency 'rspec', '~> 3.4'
25
+ spec.add_development_dependency 'rubocop'
24
26
  spec.add_development_dependency 'simplecov', '~> 0.11'
25
- spec.add_development_dependency 'coveralls', '~> 0.8'
26
27
  end
@@ -1,13 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Lita::Handlers::OnewheelCve, lita_handler: true do
4
- it { is_expected.to route(' cve-2015-1234 ') }
5
- it { is_expected.to_not route(' cve-12-12 ') }
6
- it { is_expected.to_not route('other text with cve within it ') }
4
+ it { is_expected.to route(' cve-2015-1234 ').to(:handle_cve) }
5
+ it { is_expected.to_not route(' cve-12-12 ').to(:handle_cve) }
6
+ it { is_expected.to_not route('http://example.com/cve-2015-1234').to(:handle_cve) }
7
7
 
8
8
  it 'will return a cve link to the thing' do
9
9
  send_message 'oh man cve-2015-1234 is so awesome'
10
- puts replies.last
11
10
  expect(replies.last).to eq('http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2015-1234')
12
11
  end
13
12
  end
data/spec/spec_helper.rb CHANGED
@@ -9,6 +9,21 @@ SimpleCov.start { add_filter '/spec/' }
9
9
  require 'lita-onewheel-cve'
10
10
  require 'lita/rspec'
11
11
 
12
- # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
13
- # was generated with Lita 4, the compatibility mode should be left disabled.
14
12
  Lita.version_3_compatibility_mode = false
13
+
14
+ RSpec.configure do |config|
15
+ config.expect_with :rspec do |expectations|
16
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
17
+ end
18
+
19
+ config.mock_with :rspec do |mocks|
20
+ mocks.verify_partial_doubles = true
21
+ end
22
+
23
+ config.filter_run :focus
24
+ config.run_all_when_everything_filtered = true
25
+ config.default_formatter = 'doc' if config.files_to_run.one?
26
+ config.order = :random
27
+
28
+ Kernel.srand config.seed
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-cve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rake
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,33 +109,33 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: '3.4'
83
111
  - !ruby/object:Gem::Dependency
84
- name: simplecov
112
+ name: rubocop
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - "~>"
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
- version: '0.11'
117
+ version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - "~>"
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
- version: '0.11'
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: coveralls
126
+ name: simplecov
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - "~>"
102
130
  - !ruby/object:Gem::Version
103
- version: '0.8'
131
+ version: '0.11'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
- version: '0.8'
138
+ version: '0.11'
111
139
  description: CVE decoder to pull the root link from a CVE posted in chat.
112
140
  email:
113
141
  - andrew.kreps@gmail.com
@@ -116,8 +144,12 @@ extensions: []
116
144
  extra_rdoc_files: []
117
145
  files:
118
146
  - ".gitignore"
147
+ - ".rspec"
148
+ - ".rubocop.yml"
119
149
  - ".travis.yml"
150
+ - CONTRIBUTING.md
120
151
  - Gemfile
152
+ - LICENSE
121
153
  - README.rst
122
154
  - Rakefile
123
155
  - lib/lita-onewheel-cve.rb
@@ -146,10 +178,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
178
  version: '0'
147
179
  requirements: []
148
180
  rubyforge_project:
149
- rubygems_version: 2.4.5.1
181
+ rubygems_version: 2.5.1
150
182
  signing_key:
151
183
  specification_version: 4
152
- summary: See desc.
184
+ summary: CVE decoder to pull the root link from a CVE posted in chat.
153
185
  test_files:
154
186
  - spec/lita/handlers/onewheel_cve_spec.rb
155
187
  - spec/spec_helper.rb