fast_woothee 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.gitmodules +6 -0
- data/.rspec +2 -0
- data/.travis.yml +75 -0
- data/Cargo.lock +150 -0
- data/Cargo.toml +16 -0
- data/Gemfile +5 -0
- data/README.md +45 -0
- data/Rakefile +16 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/fast_woothee.gemspec +34 -0
- data/lib/fast_woothee.rb +6 -0
- data/src/lib.rs +49 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1fb21b93bf4af62df0d4bda39071e7a0f9c4b53f
|
4
|
+
data.tar.gz: a1ade53c734982b0d1cb0eda9086479fb6a06409
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e31cb3aa870a3fc83381e72959101eb5fff51922ba51762c5614dc6096d8629038ca85d9254f07db37716327a5d85a7877f7c1803aa4c90a89bd94e075c032f2
|
7
|
+
data.tar.gz: e842e4b98909a1c9ceeafe1eccb86f7fe9b5a97c7a20016d55b44f7d97adbc32a33d2150f50ead3bd04ad8d839f919535b2431edb0a3e377de8650c0d2d4e334
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: rust
|
3
|
+
os:
|
4
|
+
- linux
|
5
|
+
- osx
|
6
|
+
dist: trusty
|
7
|
+
osx_image: xcode8.1
|
8
|
+
rust: stable
|
9
|
+
env:
|
10
|
+
global:
|
11
|
+
- THERMITE_DEBUG_FILENAME: "/tmp/thermite-debug.log"
|
12
|
+
matrix:
|
13
|
+
- WOOTHEE_RUBY_VERSION: 2.3.3
|
14
|
+
- WOOTHEE_RUBY_VERSION: 2.4.0
|
15
|
+
matrix:
|
16
|
+
include:
|
17
|
+
- os: osx
|
18
|
+
osx_image: xcode8
|
19
|
+
env: WOOTHEE_RUBY_VERSION=2.3.3
|
20
|
+
- os: osx
|
21
|
+
osx_image: xcode8
|
22
|
+
env: WOOTHEE_RUBY_VERSION=2.4.0
|
23
|
+
cache:
|
24
|
+
cargo: true
|
25
|
+
directories:
|
26
|
+
- "$TRAVIS_BUILD_DIR/vendor/bundle"
|
27
|
+
- "$HOME/.cache/pip"
|
28
|
+
before_install:
|
29
|
+
- |
|
30
|
+
rvm install "$WOOTHEE_RUBY_VERSION"
|
31
|
+
rvm use "$WOOTHEE_RUBY_VERSION"
|
32
|
+
ruby --version
|
33
|
+
if [[ "$TRAVIS_OS_NAME" == "osx" ]] && ! which bundle > /dev/null; then
|
34
|
+
gem install bundler
|
35
|
+
fi
|
36
|
+
- bundle install --jobs=3 --retry=3 --path=$TRAVIS_BUILD_DIR/vendor/bundle
|
37
|
+
before_script:
|
38
|
+
- |
|
39
|
+
export PATH=$HOME/Library/Python/2.7/bin:$HOME/.local/bin:$PATH
|
40
|
+
if [[ "$TRAVIS_OS_NAME" == "osx" ]] && ! which pip > /dev/null; then
|
41
|
+
wget https://bootstrap.pypa.io/get-pip.py
|
42
|
+
python get-pip.py --user
|
43
|
+
fi
|
44
|
+
pip install 'travis-cargo<0.2' --user
|
45
|
+
script:
|
46
|
+
- travis-cargo build
|
47
|
+
- bundle exec rake spec
|
48
|
+
- bundle exec rake thermite:tarball
|
49
|
+
# - bundle exec rake install
|
50
|
+
# - |
|
51
|
+
# if [[ -z "$TRAVIS_TAG" ]]; then
|
52
|
+
# gem uninstall fast_woothee
|
53
|
+
# CARGO=fake bundle exec rake install
|
54
|
+
# fi
|
55
|
+
# - |
|
56
|
+
# if [[ -z "$TRAVIS_TAG" ]]; then
|
57
|
+
# gem uninstall fast_woothee
|
58
|
+
# gem install minitest
|
59
|
+
# CARGO=fake gem install pkg/*.gem
|
60
|
+
# rspec spec
|
61
|
+
# fi
|
62
|
+
# - |
|
63
|
+
# if [[ -f "$THERMITE_DEBUG_FILENAME" ]]; then
|
64
|
+
# cat $THERMITE_DEBUG_FILENAME;
|
65
|
+
# fi
|
66
|
+
deploy:
|
67
|
+
provider: releases
|
68
|
+
api_key:
|
69
|
+
secure: 3sPpXpRZ5FzEL3wYaGDD9jSXiPl9SLA4F0GME8JMnN69UyNPmqN5Dy5FHEN0HzQSn+RQ5hxkN3GFJgIZ1v7acJ66cgBJL5SCuol3qCeXg8dEYssOREeM5VFAwb4+y3gUNgD/nNmYJVHKZezVaLE/VOwCQyRj3BDqnlG0bVCzc9yjE81SmjUy9/ABBWRBrlC+tyrwAg+qaZLFg537RrAy4wFngr7xrilvnFxh4M+UCB1o7xzQbGBaunFf7K3+bG9mENBUdsr5fkMIr3HfXilBERpVbGXbMAhseprPQBlbTz1u96uQFuf892hIxQOtJxTAMlvOBOchFjnd/B4mm1oLEwLKJkPBC/hiGwXbM5MvWJxLnH1T6P9Hz9Vv7M3qLv7k3+/sNxnQ048AyH+IAVYXT85QGcRXlNQoQFUs6NBl4MC/izfcfLLcLbt5FBWWWofFguzgrGqJYdLk00QL+V8aQ/5kqwsOjaJTx46fLABBTfRmQTPZWOcJWta/ZCLK+MKpvVPbjInQyh9pLkfQrmjRNyNvdYpI8zGkd25EvUSo5fjLpx0pqHmptiyP6EmuD1PKPPR/lLuDknPZoh9l1kGseYYIzLPd164rfhrgtwSVArUusp/ZV1aUDUufIZGJSwz/AJwnX9h2hEQOQElr0f6PUA3a9MTvS6r+jMasASysm1I=
|
70
|
+
file: fast_woothee-*.tar.gz
|
71
|
+
file_glob: true
|
72
|
+
skip_cleanup: true
|
73
|
+
on:
|
74
|
+
repo: ianks/fast_woothee
|
75
|
+
tags: true
|
data/Cargo.lock
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
[root]
|
2
|
+
name = "fast_woothee"
|
3
|
+
version = "0.1.0"
|
4
|
+
dependencies = [
|
5
|
+
"ruru 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
6
|
+
"woothee 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
7
|
+
]
|
8
|
+
|
9
|
+
[[package]]
|
10
|
+
name = "aho-corasick"
|
11
|
+
version = "0.6.2"
|
12
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
13
|
+
dependencies = [
|
14
|
+
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
15
|
+
]
|
16
|
+
|
17
|
+
[[package]]
|
18
|
+
name = "kernel32-sys"
|
19
|
+
version = "0.2.2"
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
21
|
+
dependencies = [
|
22
|
+
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
23
|
+
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
24
|
+
]
|
25
|
+
|
26
|
+
[[package]]
|
27
|
+
name = "lazy_static"
|
28
|
+
version = "0.2.2"
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30
|
+
|
31
|
+
[[package]]
|
32
|
+
name = "libc"
|
33
|
+
version = "0.2.21"
|
34
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
35
|
+
|
36
|
+
[[package]]
|
37
|
+
name = "memchr"
|
38
|
+
version = "1.0.1"
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
40
|
+
dependencies = [
|
41
|
+
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
42
|
+
]
|
43
|
+
|
44
|
+
[[package]]
|
45
|
+
name = "regex"
|
46
|
+
version = "0.2.1"
|
47
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
48
|
+
dependencies = [
|
49
|
+
"aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
50
|
+
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
51
|
+
"regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
52
|
+
"thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
53
|
+
"utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
54
|
+
]
|
55
|
+
|
56
|
+
[[package]]
|
57
|
+
name = "regex-syntax"
|
58
|
+
version = "0.4.0"
|
59
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
60
|
+
|
61
|
+
[[package]]
|
62
|
+
name = "ruby-sys"
|
63
|
+
version = "0.2.20"
|
64
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
65
|
+
dependencies = [
|
66
|
+
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
67
|
+
]
|
68
|
+
|
69
|
+
[[package]]
|
70
|
+
name = "ruru"
|
71
|
+
version = "0.9.3"
|
72
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
73
|
+
dependencies = [
|
74
|
+
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
75
|
+
"ruby-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
76
|
+
]
|
77
|
+
|
78
|
+
[[package]]
|
79
|
+
name = "thread-id"
|
80
|
+
version = "3.0.0"
|
81
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
82
|
+
dependencies = [
|
83
|
+
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
84
|
+
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
85
|
+
]
|
86
|
+
|
87
|
+
[[package]]
|
88
|
+
name = "thread_local"
|
89
|
+
version = "0.3.3"
|
90
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
91
|
+
dependencies = [
|
92
|
+
"thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
93
|
+
"unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
94
|
+
]
|
95
|
+
|
96
|
+
[[package]]
|
97
|
+
name = "unreachable"
|
98
|
+
version = "0.1.1"
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
100
|
+
dependencies = [
|
101
|
+
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
102
|
+
]
|
103
|
+
|
104
|
+
[[package]]
|
105
|
+
name = "utf8-ranges"
|
106
|
+
version = "1.0.0"
|
107
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
108
|
+
|
109
|
+
[[package]]
|
110
|
+
name = "void"
|
111
|
+
version = "1.0.2"
|
112
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
113
|
+
|
114
|
+
[[package]]
|
115
|
+
name = "winapi"
|
116
|
+
version = "0.2.8"
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
118
|
+
|
119
|
+
[[package]]
|
120
|
+
name = "winapi-build"
|
121
|
+
version = "0.1.1"
|
122
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
123
|
+
|
124
|
+
[[package]]
|
125
|
+
name = "woothee"
|
126
|
+
version = "0.6.0"
|
127
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
128
|
+
dependencies = [
|
129
|
+
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
130
|
+
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
131
|
+
]
|
132
|
+
|
133
|
+
[metadata]
|
134
|
+
"checksum aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0638fd549427caa90c499814196d1b9e3725eb4d15d7339d6de073a680ed0ca2"
|
135
|
+
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
136
|
+
"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"
|
137
|
+
"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135"
|
138
|
+
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
|
139
|
+
"checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01"
|
140
|
+
"checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457"
|
141
|
+
"checksum ruby-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e71509f17ce93733dc196258e168b58050490a156b04563816a8120a74ba04c7"
|
142
|
+
"checksum ruru 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6486d6c50b7a08246a492a61893635c1977d41c138041d443eb603f6298e0273"
|
143
|
+
"checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a"
|
144
|
+
"checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7"
|
145
|
+
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
|
146
|
+
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
|
147
|
+
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
148
|
+
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
149
|
+
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
150
|
+
"checksum woothee 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5eff4904540e8ee3b18e107610397f48cd78983e7d327c9769814ae30b0d34a6"
|
data/Cargo.toml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
[package]
|
2
|
+
name = "fast_woothee"
|
3
|
+
version = "1.0.0"
|
4
|
+
authors = ["Ian Ker-Seymer <i.kerseymer@gmail.com>"]
|
5
|
+
|
6
|
+
[lib]
|
7
|
+
crate-type = ["dylib"]
|
8
|
+
|
9
|
+
[dependencies]
|
10
|
+
woothee = "^0.6"
|
11
|
+
ruru = "*"
|
12
|
+
|
13
|
+
|
14
|
+
[package.metadata.thermite]
|
15
|
+
github_releases = true
|
16
|
+
github_release_type = "latest"
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# FastWoothee
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/ianks/fast_woothee.svg?branch=master)](https://travis-ci.org/ianks/fast_woothee)
|
4
|
+
|
5
|
+
Ruby Bindings to [woothee-rust](https://github.com/hhatto/woothee-rust) for
|
6
|
+
performant, and safe user-agent parsing.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'fast_woothee'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install fast_woothee
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
FastWoothee.parse 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405'
|
28
|
+
# {:name=>"Webview", :category=>"smartphone", :os=>"iPad", :os_version=>"3.2.1", :browser_type=>"browser", :version=>"UNKNOWN", :vendor=>"OS vendor"}
|
29
|
+
```
|
30
|
+
|
31
|
+
## Development
|
32
|
+
|
33
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
34
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
35
|
+
prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
38
|
+
release a new version, update the version number in `version.rb`, and then run
|
39
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
40
|
+
git commits and tags, and push the `.gem` file to
|
41
|
+
[rubygems.org](https://rubygems.org).
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ianks/fast_woothee.
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'thermite/tasks'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:rspec)
|
8
|
+
|
9
|
+
Thermite::Tasks.new
|
10
|
+
|
11
|
+
desc 'Run Rust & Ruby testsuites'
|
12
|
+
task spec: ['thermite:build', 'thermite:test'] do
|
13
|
+
Rake::Task[:rspec].invoke
|
14
|
+
end
|
15
|
+
|
16
|
+
task default: %w(thermite:build)
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path('../lib', __FILE__)
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "fast_woothee"
|
9
|
+
spec.version = "1.0.0"
|
10
|
+
spec.authors = ["Ian Ker-Seymer"]
|
11
|
+
spec.email = ["i.kerseymer@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = 'Ruby bindings for woothee-rust'
|
14
|
+
spec.description = 'Ruby bindings to woothee-rust'
|
15
|
+
spec.homepage = "https://github.com/ianks/fast_woothee"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
spec.extensions = ['Rakefile']
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'thermite', '~> 0'
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rake-compiler"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
spec.add_development_dependency "ffi", "~> 1.9"
|
32
|
+
spec.add_development_dependency "pry"
|
33
|
+
spec.add_development_dependency "pry-doc"
|
34
|
+
end
|
data/lib/fast_woothee.rb
ADDED
data/src/lib.rs
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#[macro_use]
|
2
|
+
extern crate ruru;
|
3
|
+
extern crate woothee;
|
4
|
+
|
5
|
+
use ruru::{Symbol, Boolean, RString, Class, Hash, Object};
|
6
|
+
|
7
|
+
use woothee::parser::Parser;
|
8
|
+
|
9
|
+
class!(FastWoothee);
|
10
|
+
|
11
|
+
methods!(
|
12
|
+
FastWoothee,
|
13
|
+
_itself,
|
14
|
+
fn parse(ua_string: RString) -> Hash {
|
15
|
+
let mut hash = Hash::new();
|
16
|
+
|
17
|
+
let parser = Parser::new();
|
18
|
+
match parser.parse(ua_string.unwrap_or(RString::new("")).to_str()) {
|
19
|
+
None => hash,
|
20
|
+
Some(result) => {
|
21
|
+
hash.store(Symbol::new("name"), RString::new(result.name));
|
22
|
+
hash.store(Symbol::new("category"), RString::new(result.category));
|
23
|
+
hash.store(Symbol::new("os"), RString::new(result.os));
|
24
|
+
hash.store(Symbol::new("os_version"), RString::new(&*result.os_version));
|
25
|
+
hash.store(Symbol::new("browser_type"), RString::new(result.browser_type));
|
26
|
+
hash.store(Symbol::new("version"), RString::new(&*result.version));
|
27
|
+
hash.store(Symbol::new("vendor"), RString::new(result.vendor));
|
28
|
+
hash
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
);
|
33
|
+
|
34
|
+
methods!(
|
35
|
+
FastWoothee,
|
36
|
+
_itself,
|
37
|
+
fn crawler(ua_string: RString) -> Boolean {
|
38
|
+
Boolean::new(woothee::is_crawler(ua_string.unwrap_or(RString::new("")).to_str()))
|
39
|
+
}
|
40
|
+
);
|
41
|
+
|
42
|
+
#[no_mangle]
|
43
|
+
pub extern fn initialize_fast_woothee() {
|
44
|
+
Class::new("FastWoothee", None).define(|itself| {
|
45
|
+
itself.const_set("VERSION", &RString::new("1.0.0").freeze());
|
46
|
+
itself.def_self("parse", parse);
|
47
|
+
itself.def_self("crawler?", crawler);
|
48
|
+
});
|
49
|
+
}
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fast_woothee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ian Ker-Seymer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thermite
|
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
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-compiler
|
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'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ffi
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-doc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Ruby bindings to woothee-rust
|
126
|
+
email:
|
127
|
+
- i.kerseymer@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions:
|
130
|
+
- Rakefile
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".gitmodules"
|
135
|
+
- ".rspec"
|
136
|
+
- ".travis.yml"
|
137
|
+
- Cargo.lock
|
138
|
+
- Cargo.toml
|
139
|
+
- Gemfile
|
140
|
+
- README.md
|
141
|
+
- Rakefile
|
142
|
+
- bin/console
|
143
|
+
- bin/setup
|
144
|
+
- fast_woothee.gemspec
|
145
|
+
- lib/fast_woothee.rb
|
146
|
+
- src/lib.rs
|
147
|
+
homepage: https://github.com/ianks/fast_woothee
|
148
|
+
licenses: []
|
149
|
+
metadata: {}
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 2.5.1
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: Ruby bindings for woothee-rust
|
170
|
+
test_files: []
|