r_fast_r_furious 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Rakefile +6 -0
- data/lib/r_fast_r_furious/version.rb +1 -1
- data/lib/r_fast_r_furious.rb +6 -1
- data/r_fast_r_furious.gemspec +2 -0
- data/spec/fixtures/fast.js +16 -0
- data/spec/helper.rb +3 -0
- data/spec/r_fast_r_furious_spec.rb +38 -0
- metadata +40 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 079294ba1e7d7c5b54a85f3ed7cf78039f682ac0
|
4
|
+
data.tar.gz: 93e3ce990ee5eb2a27f3e6fad05294395d2095af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbe6c96bea961f8630fb092262e543d17ddbb9125979f1cbfe0bc6cba61488d98bdcdc3b575fdc5240406bb9fd935fe122b3ea2f9baf68251a02ec79606dd2b1
|
7
|
+
data.tar.gz: c5ac2540911c153b84edfc862ea0bc3a33934883494581116cd89db6a5f31b17745415c713ea84a76dd5a982591f3e0193512a4476cc15b1aee1751f94c9ea1c
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Rakefile
CHANGED
data/lib/r_fast_r_furious.rb
CHANGED
@@ -7,7 +7,12 @@ module RFastRFurious
|
|
7
7
|
SOURCE = "https://raw.github.com/alunny/r_fast_r_furious/master/fast.js"
|
8
8
|
def check(string, url = SOURCE)
|
9
9
|
uri = URI.parse(SOURCE)
|
10
|
-
|
10
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
11
|
+
http.use_ssl = true
|
12
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
13
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
14
|
+
response = http.request(request)
|
15
|
+
content = response.body
|
11
16
|
cxt = V8::Context.new
|
12
17
|
cxt.eval(content, "fast.js")
|
13
18
|
cxt["r_fast_r_furious"].call(string)
|
data/r_fast_r_furious.gemspec
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
(function (root, factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(factory);
|
4
|
+
} else if (typeof exports === 'object') {
|
5
|
+
module.exports = factory();
|
6
|
+
} else {
|
7
|
+
// Browser globals (root is window)
|
8
|
+
root.r_fast_r_furious = factory();
|
9
|
+
}
|
10
|
+
}(this, function () {
|
11
|
+
var r_fast = /^((T(he)(?=.*the)|2(?=.* 2)) )?Fast (Five|(((and t\3)|\2(?=.*s$)|&(?!.*:)) Furious(( (6|7))|: Tokyo Drift)?))$/;
|
12
|
+
|
13
|
+
return function (str) {
|
14
|
+
return r_fast.test(str);
|
15
|
+
}
|
16
|
+
}));
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
RSpec.describe RFastRFurious do
|
4
|
+
|
5
|
+
describe ".check" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
stub_request(:get, "https://raw.github.com/alunny/r_fast_r_furious/master/fast.js").
|
9
|
+
to_return(:body => File.new(File.expand_path("../fixtures/fast.js", __FILE__)))
|
10
|
+
end
|
11
|
+
|
12
|
+
AWESOME_MOVIES = [
|
13
|
+
"The Fast and the Furious",
|
14
|
+
"2 Fast 2 Furious",
|
15
|
+
"The Fast and the Furious: Tokyo Drift",
|
16
|
+
"Fast & Furious",
|
17
|
+
"Fast Five",
|
18
|
+
]
|
19
|
+
|
20
|
+
AWESOME_MOVIES.each do |title|
|
21
|
+
it "is true for \"#{title}\"" do
|
22
|
+
expect(RFastRFurious.check(title)).to be_true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
UNAWESOME_MOVIES = [
|
27
|
+
"The Sorrow and the Pity",
|
28
|
+
]
|
29
|
+
|
30
|
+
UNAWESOME_MOVIES.each do |title|
|
31
|
+
it "is false for \"#{title}\"" do
|
32
|
+
expect(RFastRFurious.check(title)).to be_false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_fast_r_furious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Carey-Smith
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.14'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.14'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1'
|
55
83
|
description: easily validate movie titles from the fast and the furious saga
|
56
84
|
email:
|
57
85
|
- tim@spork.in
|
@@ -60,6 +88,8 @@ extensions: []
|
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
62
90
|
- .gitignore
|
91
|
+
- .rspec
|
92
|
+
- .travis.yml
|
63
93
|
- Gemfile
|
64
94
|
- LICENSE
|
65
95
|
- README.md
|
@@ -67,6 +97,9 @@ files:
|
|
67
97
|
- lib/r_fast_r_furious.rb
|
68
98
|
- lib/r_fast_r_furious/version.rb
|
69
99
|
- r_fast_r_furious.gemspec
|
100
|
+
- spec/fixtures/fast.js
|
101
|
+
- spec/helper.rb
|
102
|
+
- spec/r_fast_r_furious_spec.rb
|
70
103
|
homepage: https://github.com/halorgium/r_fast_r_furious
|
71
104
|
licenses:
|
72
105
|
- Public Domain
|
@@ -82,13 +115,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
115
|
version: '0'
|
83
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
117
|
requirements:
|
85
|
-
- - '
|
118
|
+
- - '>='
|
86
119
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
120
|
+
version: '0'
|
88
121
|
requirements: []
|
89
122
|
rubyforge_project:
|
90
123
|
rubygems_version: 2.0.0
|
91
124
|
signing_key:
|
92
125
|
specification_version: 4
|
93
126
|
summary: sometimes you just don't have enough time to read
|
94
|
-
test_files:
|
127
|
+
test_files:
|
128
|
+
- spec/fixtures/fast.js
|
129
|
+
- spec/helper.rb
|
130
|
+
- spec/r_fast_r_furious_spec.rb
|