ramparts 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9623918d77fd13b5006a4436fd147eb2cbe3c790
4
- data.tar.gz: cc81eb43b0c2378822b9bce67e35f7f6951c609d
3
+ metadata.gz: b17ce99a872d5b7e0ad592030da36d79281e8a02
4
+ data.tar.gz: ca7eb3757dadf41f2dcf32640ff85447a4c16c88
5
5
  SHA512:
6
- metadata.gz: 3532ef87767a9649195d6508284d1cc5603cbc3aaa7e8e7a3809c1db748bf36e0835a9591713418cd5c548f1348c128fca9f6965fb5fa2a4690155cc23a565ad
7
- data.tar.gz: 13cf057ea279241cabce865dd559db6178820fc9b4b44039f38bc30ae6101d1d2d3721094c2eddd45a28ded47bb7572219baabbbbaab3464cd4333f3e54d07d3
6
+ metadata.gz: b8c36fe133fa9106c0c31f9dd16a3db71a0f3b885c3866d6945d3f0bfa94c06bfcffbfe24d4a07a78acb7dbd0fe007bee9dab995003828079a1b359537e0e95e
7
+ data.tar.gz: 9cac1e785eb4ad69932e3c10a1c83b1d805bba21ec84d7c6738be2c78d0369fb05bbac957bf0ebfe679011f3e5a1eedee70c107a5062711a64831f1f5f295c2e
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.3.1 (09/10/2018)
4
+ - Fix long-running regex match
5
+
3
6
  ## 0.2.1 (14/12/2017)
4
7
  - Creating a `spec_helper.rb` and implement SimpleCov tool
5
8
  - Refactored test architecture to use hashes instead of arrays
@@ -15,4 +18,4 @@
15
18
  ## 0.0.4 (08/12/2017)
16
19
  - Use Ruby that's already installed on TravisCI
17
20
  - Implement [Stale](https://github.com/probot/stale) for issue
18
- - Add error messages, especially for malformed input
21
+ - Add error messages, especially for malformed input
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Ramparts - Spam Detection
1
+ # Ramparts - Spam Detection ![Build Status](https://travis-ci.com/CareGuide/ramparts.svg?token=pzv1C7M8Vzq9xx1zxDRH&branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/5b5bcd41603e34dbc615/maintainability)](https://codeclimate.com/github/CareGuide/ramparts/maintainability) [![Gem Version](https://badge.fury.io/rb/ramparts.svg)](http://badge.fury.io/rb/ramparts)
2
+
2
3
  Parses blocks of text to find phone numbers (including phonetic numbers), emails, and spammer urls
3
4
 
4
5
  ## Example
@@ -34,6 +35,16 @@ Count the occurrences of well known spam URLs and keywords
34
35
  >> Ramparts.count_urls(message)
35
36
  3
36
37
  ```
38
+ ## Installation
39
+
40
+ In the root directory of your project
41
+ ```
42
+ gem install ramparts
43
+ ```
44
+ Remember to require `ramparts` as necessary
45
+ ```
46
+ require 'ramparts'
47
+ ```
37
48
 
38
49
  ## API
39
50
 
data/ROADMAP.md CHANGED
@@ -5,7 +5,7 @@
5
5
  - [ ] Implement Automatic Deployments
6
6
  - [x] Look into using hashes instead of array for testing infrastructure
7
7
  - [ ] Look into using custom rspec matchers
8
- - [ ] Travis badge for marketing
8
+ - [x] Travis badge for marketing
9
9
  - [x] Use Ruby that's already installed on TravisCI
10
10
  - [ ] Use threads for true Map/Reduce. Look into [Celluloid](https://github.com/celluloid/celluloid)
11
11
  - [ ] Have check domain (for email matches) as an option (not only on :aggressive option) to reduce over matching
@@ -15,7 +15,7 @@
15
15
  - [ ] Implement URL functionality
16
16
  - [ ] Change URL to keywords list functionality
17
17
  - [ ] Robust-ify the overlapping interval scenario
18
- - [ ] Get setup on Code Climate once the repo goes open source
18
+ - [x] Get setup on Code Climate once the repo goes open source
19
19
  - [ ] Think about using InchCI (inline docs) instead of README
20
20
  - [x] Creating a `spec_helper.rb` and use tools like SimpleCov,
21
- - [ ] Look into using Shoulda matchers, and test randomization.
21
+ - [ ] Look into using Shoulda matchers, and test randomization.
@@ -82,7 +82,7 @@ class PhoneParser
82
82
  Regexp.new(/(\()?(\d|#{BASE_MATCHING}){1}([^\w]*(\d|#{BASE_MATCHING}){1}[^\w]*){5,}(\d|#{BASE_MATCHING}){1}/)
83
83
 
84
84
  # The final regex used to match phone numbers for MR
85
- MR_REGEX = Regexp.new(/(\-*\.?\d{1}\.?\-*){7,}/)
85
+ MR_REGEX = Regexp.new(/(\-*\.?\d{1}\.?\-?){7,}/)
86
86
 
87
87
  # Replacements used for phonetics for MR
88
88
  REPLACEMENTS = {
@@ -116,13 +116,8 @@ class PhoneParser
116
116
  # Parses the phone number for MR, uses a variety of options
117
117
  def parse_phone_number(text, options)
118
118
  text = text.delete(' ') if options.fetch(:remove_spaces, true)
119
-
120
119
  text = text.downcase.gsub(/#{REGEX_PHONETICS}/, REPLACEMENTS)
121
-
122
- if options.fetch(:parse_leet, true)
123
- text = text.gsub(/#{REGEX_LEET_SPEAK}/, LEET_REPLACEMENTS)
124
- end
125
-
120
+ text = text.gsub(/#{REGEX_LEET_SPEAK}/, LEET_REPLACEMENTS) if options.fetch(:parse_leet, true)
126
121
  text.gsub(/[^\w]/, '-').gsub(/[a-z]/, '.')
127
122
  end
128
123
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ramparts
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.authors = ['Brent Scheibelhut', 'CareGuide']
10
10
  s.email = ['brent.scheibelhut@careguide.com', 'info@careguide.com']
11
11
  s.homepage = 'https://github.com/CareGuide/ramparts'
12
+ s.metadata = { "source_code_uri" => "https://github.com/CareGuide/ramparts" }
12
13
  s.license = 'MIT'
13
14
  s.summary = %q{Parses blocks of text to find phone numbers (including phonetic numbers), emails, and bad url}
14
15
  s.description = %q{Parses blocks of text to find phone numbers (including phonetic numbers), emails, and bad url. Useful for finding scammers who tend to try to post their phone number in messages.}
@@ -21,4 +22,6 @@ Gem::Specification.new do |s|
21
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
23
  s.executables = `git ls-files -- bin/*`.split('\n').map{ |f| File.basename(f) }
23
24
  s.require_paths = ['lib']
25
+
26
+ s.required_ruby_version = '>= 2.1.0'
24
27
  end
@@ -11,6 +11,11 @@ PHONE_TRUTHY_WITH_ANSWERS_AND_SPACES = [
11
11
  ].freeze
12
12
 
13
13
  PHONE_TRUTHY_WITH_ANSWERS = [
14
+ {
15
+ matches: [],
16
+ text: 'Резюме и референс письма нет Во всех семьях я работаю по устной рекомендации знакомых В семье в которой Бен и Джорджик я уже 7 лет Мальчикам 9 и 6 лет Второго забирали вместе с папой из госпиталя Работала у них иногда и по 12 часов Они живут в 5 ти минутах ходьбы от меня Детки подросли И',
17
+ filtered: "Резюме и референс письма нет Во всех семьях я работаю по устной рекомендации знакомых В семье в которой Бен и Джорджик я уже 7 лет Мальчикам 9 и 6 лет Второго забирали вместе с папой из госпиталя Работала у них иногда и по 12 часов Они живут в 5 ти минутах ходьбы от меня Детки подросли И"
18
+ },
14
19
  {
15
20
  matches: ["5.5.5.4.3.8.4.8.3.8"],
16
21
  text: "I need a babysitter and errand for my son textme direct on my number if you are interested 5.5.5.4.3.8.4.8.3.8",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ramparts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Scheibelhut
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-02 00:00:00.000000000 Z
12
+ date: 2018-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -108,7 +108,8 @@ files:
108
108
  homepage: https://github.com/CareGuide/ramparts
109
109
  licenses:
110
110
  - MIT
111
- metadata: {}
111
+ metadata:
112
+ source_code_uri: https://github.com/CareGuide/ramparts
112
113
  post_install_message:
113
114
  rdoc_options: []
114
115
  require_paths:
@@ -117,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
118
  requirements:
118
119
  - - ">="
119
120
  - !ruby/object:Gem::Version
120
- version: '0'
121
+ version: 2.1.0
121
122
  required_rubygems_version: !ruby/object:Gem::Requirement
122
123
  requirements:
123
124
  - - ">="
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  version: '0'
126
127
  requirements: []
127
128
  rubyforge_project:
128
- rubygems_version: 2.6.13
129
+ rubygems_version: 2.6.14
129
130
  signing_key:
130
131
  specification_version: 4
131
132
  summary: Parses blocks of text to find phone numbers (including phonetic numbers),
@@ -145,3 +146,4 @@ test_files:
145
146
  - spec/parsers/url_parser_spec.rb
146
147
  - spec/spec_constants.rb
147
148
  - spec/spec_helper.rb
149
+ has_rdoc: