r_fast_r_furious 1.0.0 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/r_fast_r_furious/version.rb +1 -1
- data/lib/r_fast_r_furious.rb +3 -17
- data/r_fast_r_furious.gemspec +0 -3
- data/spec/helper.rb +0 -1
- data/spec/r_fast_r_furious_spec.rb +0 -5
- metadata +3 -33
- data/spec/fixtures/fast.js +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8b2bc0d21349f5184c7a82a56f0b7d0de15e449
|
4
|
+
data.tar.gz: ad9f64e28df85deb7213ffb595d527da164f0049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf07264e6ead97283b6e6dbc7b3ba8afa60dbc91227846ae458d1f58e2504f8dff767f8bb122b9f5601112ed1df436a9de3a233dca7ffc83010ae98d09ddb3c
|
7
|
+
data.tar.gz: d18eca63b323710e12d90dddf6822425a2dd0c7bf8aeae6b3b62fd895b7bc447307eaf6edd2d8fc10a9c23d2559e02dc12329cdb4d06c680e6d9af8bc51224e7
|
data/lib/r_fast_r_furious.rb
CHANGED
@@ -1,21 +1,7 @@
|
|
1
|
-
require "r_fast_r_furious/version"
|
2
|
-
require "v8"
|
3
|
-
require "net/http"
|
4
|
-
require "uri"
|
5
|
-
|
6
1
|
module RFastRFurious
|
7
|
-
|
8
|
-
def check(string
|
9
|
-
|
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
|
16
|
-
cxt = V8::Context.new
|
17
|
-
cxt.eval(content, "fast.js")
|
18
|
-
cxt["r_fast_r_furious"].call(string)
|
2
|
+
REGEX = /^((T(he)(?=.*the)|2(?=.* 2)) )?Fast (Five|(((and t\3)|\2(?=.*s$)|&(?!.*:)) Furious(( (6|7))|: Tokyo Drift)?))$/
|
3
|
+
def check(string)
|
4
|
+
!!REGEX.match(string)
|
19
5
|
end
|
20
6
|
module_function :check
|
21
7
|
end
|
data/r_fast_r_furious.gemspec
CHANGED
@@ -18,10 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "therubyracer"
|
22
|
-
|
23
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
22
|
spec.add_development_dependency "rake"
|
25
23
|
spec.add_development_dependency "rspec", ">= 2.14"
|
26
|
-
spec.add_development_dependency "webmock", ">= 1"
|
27
24
|
end
|
data/spec/helper.rb
CHANGED
@@ -4,11 +4,6 @@ RSpec.describe RFastRFurious do
|
|
4
4
|
|
5
5
|
describe ".check" do
|
6
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
7
|
AWESOME_MOVIES = [
|
13
8
|
"The Fast and the Furious",
|
14
9
|
"2 Fast 2 Furious",
|
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:
|
4
|
+
version: 2.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Carey-Smith
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: therubyracer
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +52,6 @@ dependencies:
|
|
66
52
|
- - '>='
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
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'
|
83
55
|
description: easily validate movie titles from the fast and the furious saga
|
84
56
|
email:
|
85
57
|
- tim@spork.in
|
@@ -97,7 +69,6 @@ files:
|
|
97
69
|
- lib/r_fast_r_furious.rb
|
98
70
|
- lib/r_fast_r_furious/version.rb
|
99
71
|
- r_fast_r_furious.gemspec
|
100
|
-
- spec/fixtures/fast.js
|
101
72
|
- spec/helper.rb
|
102
73
|
- spec/r_fast_r_furious_spec.rb
|
103
74
|
homepage: https://github.com/halorgium/r_fast_r_furious
|
@@ -115,9 +86,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
86
|
version: '0'
|
116
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
88
|
requirements:
|
118
|
-
- - '
|
89
|
+
- - '>'
|
119
90
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
91
|
+
version: 1.3.1
|
121
92
|
requirements: []
|
122
93
|
rubyforge_project:
|
123
94
|
rubygems_version: 2.0.0
|
@@ -125,6 +96,5 @@ signing_key:
|
|
125
96
|
specification_version: 4
|
126
97
|
summary: sometimes you just don't have enough time to read
|
127
98
|
test_files:
|
128
|
-
- spec/fixtures/fast.js
|
129
99
|
- spec/helper.rb
|
130
100
|
- spec/r_fast_r_furious_spec.rb
|
data/spec/fixtures/fast.js
DELETED
@@ -1,16 +0,0 @@
|
|
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
|
-
}));
|