browser 4.1.0 → 5.3.0
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 +4 -4
- data/.github/workflows/tests.yml +57 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +46 -3
- data/FUNDING.yml +3 -0
- data/README.md +101 -50
- data/bots.yml +299 -298
- data/browser.gemspec +5 -4
- data/lib/browser/accept_language.rb +4 -4
- data/lib/browser/alipay.rb +1 -1
- data/lib/browser/base.rb +72 -13
- data/lib/browser/blackberry.rb +1 -1
- data/lib/browser/bot/keyword_matcher.rb +1 -1
- data/lib/browser/browser.rb +21 -2
- data/lib/browser/chrome.rb +9 -3
- data/lib/browser/device.rb +12 -5
- data/lib/browser/device/android.rb +1 -1
- data/lib/browser/device/blackberry_playbook.rb +1 -1
- data/lib/browser/device/ipad.rb +1 -1
- data/lib/browser/device/iphone.rb +1 -1
- data/lib/browser/device/ipod_touch.rb +1 -1
- data/lib/browser/device/kindle.rb +1 -1
- data/lib/browser/device/kindle_fire.rb +1 -1
- data/lib/browser/device/playstation3.rb +1 -1
- data/lib/browser/device/playstation4.rb +1 -1
- data/lib/browser/device/psp.rb +1 -1
- data/lib/browser/device/psvita.rb +1 -1
- data/lib/browser/device/samsung.rb +33 -0
- data/lib/browser/device/surface.rb +1 -1
- data/lib/browser/device/switch.rb +1 -1
- data/lib/browser/device/tv.rb +1 -1
- data/lib/browser/device/unknown.rb +1 -1
- data/lib/browser/device/wii.rb +1 -1
- data/lib/browser/device/wiiu.rb +1 -1
- data/lib/browser/device/xbox_360.rb +1 -1
- data/lib/browser/device/xbox_one.rb +1 -1
- data/lib/browser/duck_duck_go.rb +1 -1
- data/lib/browser/edge.rb +2 -2
- data/lib/browser/electron.rb +1 -1
- data/lib/browser/facebook.rb +1 -1
- data/lib/browser/firefox.rb +1 -1
- data/lib/browser/google_search_app.rb +21 -0
- data/lib/browser/huawei_browser.rb +21 -0
- data/lib/browser/instagram.rb +1 -1
- data/lib/browser/internet_explorer.rb +2 -2
- data/lib/browser/maxthon.rb +21 -0
- data/lib/browser/micro_messenger.rb +1 -1
- data/lib/browser/miui_browser.rb +21 -0
- data/lib/browser/nokia.rb +1 -1
- data/lib/browser/opera.rb +1 -1
- data/lib/browser/otter.rb +1 -1
- data/lib/browser/phantom_js.rb +1 -1
- data/lib/browser/platform.rb +21 -15
- data/lib/browser/platform/adobe_air.rb +1 -1
- data/lib/browser/platform/android.rb +1 -1
- data/lib/browser/platform/blackberry.rb +1 -1
- data/lib/browser/platform/chrome_os.rb +1 -1
- data/lib/browser/platform/firefox_os.rb +1 -1
- data/lib/browser/platform/ios.rb +2 -2
- data/lib/browser/platform/kai_os.rb +23 -0
- data/lib/browser/platform/linux.rb +1 -1
- data/lib/browser/platform/mac.rb +2 -2
- data/lib/browser/platform/{other.rb → unknown.rb} +3 -3
- data/lib/browser/platform/windows.rb +2 -2
- data/lib/browser/platform/windows_mobile.rb +1 -1
- data/lib/browser/platform/windows_phone.rb +1 -1
- data/lib/browser/qq.rb +1 -1
- data/lib/browser/safari.rb +12 -3
- data/lib/browser/samsung_browser.rb +1 -1
- data/lib/browser/snapchat.rb +1 -1
- data/lib/browser/sougou_browser.rb +24 -0
- data/lib/browser/sputnik.rb +1 -1
- data/lib/browser/uc_browser.rb +1 -1
- data/lib/browser/{generic.rb → unknown.rb} +3 -3
- data/lib/browser/version.rb +1 -1
- data/lib/browser/weibo.rb +1 -1
- data/lib/browser/yandex.rb +1 -1
- data/samsung.yml +138 -0
- data/test/browser_test.rb +37 -6
- data/test/ua.yml +18 -4
- data/test/ua_bots.yml +3 -2
- data/test/unit/adobe_air_test.rb +1 -1
- data/test/unit/alipay_test.rb +6 -0
- data/test/unit/bots_test.rb +1 -1
- data/test/unit/console_test.rb +2 -2
- data/test/unit/device_test.rb +30 -3
- data/test/unit/duck_duck_go_test.rb +2 -0
- data/test/unit/google_search_app_test.rb +54 -0
- data/test/unit/huawei_browser_test.rb +25 -0
- data/test/unit/kai_os_test.rb +31 -0
- data/test/unit/maxthon_test.rb +25 -0
- data/test/unit/meta_test.rb +10 -1
- data/test/unit/miui_browser_test.rb +25 -0
- data/test/unit/opera_test.rb +1 -0
- data/test/unit/platform_test.rb +7 -7
- data/test/unit/qq_test.rb +12 -0
- data/test/unit/safari_test.rb +12 -7
- data/test/unit/samsung_browser_test.rb +1 -0
- data/test/unit/sougou_browser_test.rb +41 -0
- metadata +37 -16
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 972b76e90909836598cc70314c1608eeba4c4db13947bca76e4a350dc83cb741
|
4
|
+
data.tar.gz: 4d1d0f4bb18d2b57e82b91f04cfe6dfda5e02ea0fb967c12c87c3ad293a556c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae9b28f091921ffa7092ebe434cb5d518dc8fad41743af8f94c2240729379a44057d351da4beb5c5b5daade4a809deef13099e93ce222e4a43d419a2b791400
|
7
|
+
data.tar.gz: 7722b7ea98e7d8d870fbb4abb75128677db755423287d3930f5c09680316bd376a7fe18c500080d2314c29eec446b7b9927844e13c49ba687dcb5b447e311d94
|
@@ -0,0 +1,57 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
schedule:
|
12
|
+
- cron: "0 10 * * *"
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
build:
|
16
|
+
name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
|
17
|
+
runs-on: "ubuntu-latest"
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: ["2.7.x", "2.6.x", "2.5.x"]
|
22
|
+
gemfile:
|
23
|
+
- Gemfile
|
24
|
+
- gemfiles/rails5.gemfile
|
25
|
+
- gemfiles/rails6.gemfile
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v1
|
29
|
+
|
30
|
+
- uses: actions/cache@v2
|
31
|
+
with:
|
32
|
+
path: vendor/bundle
|
33
|
+
key: >
|
34
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
|
35
|
+
restore-keys: >
|
36
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
|
37
|
+
|
38
|
+
- name: Set up Ruby
|
39
|
+
uses: actions/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: ${{ matrix.ruby }}
|
42
|
+
|
43
|
+
- name: Install gem dependencies
|
44
|
+
env:
|
45
|
+
RAILS_ENV: test
|
46
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
47
|
+
run: |
|
48
|
+
gem install bundler
|
49
|
+
bundle config path vendor/bundle
|
50
|
+
bundle update --jobs 4 --retry 3
|
51
|
+
|
52
|
+
- name: Run Tests
|
53
|
+
env:
|
54
|
+
RAILS_ENV: test
|
55
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
56
|
+
run: |
|
57
|
+
bundle exec rake
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,51 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
4
|
-
|
5
|
-
|
3
|
+
## 5.3.0
|
4
|
+
|
5
|
+
- Bump up minimum required ruby version to 2.5.0. We're now relying on
|
6
|
+
`String#match?`, which was introduced by ruby-2.4, but given that ruby's
|
7
|
+
stable version is >= 2.5, seems reasonable.
|
8
|
+
|
9
|
+
## 5.2.0
|
10
|
+
|
11
|
+
- Add KaiOS detection.
|
12
|
+
- Replace `String#=~` with `String#match?` and other optimizations.
|
13
|
+
|
14
|
+
## 5.1.0
|
15
|
+
|
16
|
+
- Add Samsung device detection.
|
17
|
+
- Delay parsing `Accept-Language` until `Browser::Base#accept_language` is
|
18
|
+
called for the first time.
|
19
|
+
- Bump up default size limit for `Accept-Language` and `User-Agent` to 2048
|
20
|
+
bytes.
|
21
|
+
|
22
|
+
## 5.0.0
|
23
|
+
|
24
|
+
- Rename `Browser::Platform#other?` to `Browser::Platform#unknown?`.
|
25
|
+
- Unknown platforms now return `:unknown_platform` as the id.
|
26
|
+
- Unknown devices now return `:unknown_device` as the id.
|
27
|
+
- Unknown browsers now return `:unknown_browser` as the id.
|
28
|
+
- All the changes above affect how `browser.meta` is composed.
|
29
|
+
- Add method `Browser::Base#unknown?`.
|
30
|
+
- Fix issue with `Browser::Base#safari?` matching full version.
|
31
|
+
- Add Maxthon detection.
|
32
|
+
- Add Google Search App detection.
|
33
|
+
- Add Huawei Browser detection.
|
34
|
+
- Fix Duck Duck Go browser that was being recognized as a bot.
|
35
|
+
- Add Miui Browser detection.
|
36
|
+
- Add `Browser::Base#qq?`.
|
37
|
+
- Fix QQ detection.
|
38
|
+
- Fix Alipay detection.
|
39
|
+
- Add Sougou Browser detection.
|
40
|
+
- User agent has a size limit of 512 bytes. This can be customized through
|
41
|
+
`Browser.user_agent_size_limit`.
|
42
|
+
- Accept-Language has a size limit of 256 bytes. This can be customized through
|
43
|
+
`Browser.accept_language_size_limit`.
|
44
|
+
|
45
|
+
## 4.2.0
|
46
|
+
|
47
|
+
- Fix Chrome Lighthouse detection.
|
48
|
+
- Add Skype to bot list.
|
6
49
|
|
7
50
|
## 4.1.0
|
8
51
|
|
data/FUNDING.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Browser
|
2
2
|
|
3
|
-
[](https://github.com/fnando/browser)
|
4
4
|
[](https://codeclimate.com/github/fnando/browser)
|
5
|
-
[](https://codeclimate.com/github/fnando/browser/coverage)
|
6
5
|
[](https://rubygems.org/gems/browser)
|
7
6
|
[](https://rubygems.org/gems/browser)
|
8
7
|
|
@@ -34,6 +33,7 @@ browser.ie?
|
|
34
33
|
browser.ie?(6) # detect specific IE version
|
35
34
|
browser.ie?([">8", "<10"]) # detect specific IE (IE9).
|
36
35
|
browser.known? # has the browser been successfully detected?
|
36
|
+
browser.unknown? # the browser wasn't detected.
|
37
37
|
browser.meta # an array with several attributes
|
38
38
|
browser.name # readable browser name
|
39
39
|
browser.nokia?
|
@@ -43,6 +43,7 @@ browser.phantom_js?
|
|
43
43
|
browser.quicktime?
|
44
44
|
browser.safari?
|
45
45
|
browser.safari_webapp_mode?
|
46
|
+
browser.samsung_browser?
|
46
47
|
browser.to_s # the meta info joined by space
|
47
48
|
browser.uc_browser?
|
48
49
|
browser.version # major version number
|
@@ -50,9 +51,11 @@ browser.webkit?
|
|
50
51
|
browser.webkit_full_version
|
51
52
|
browser.yandex?
|
52
53
|
browser.wechat?
|
54
|
+
browser.qq?
|
53
55
|
browser.weibo?
|
54
56
|
browser.yandex?
|
55
57
|
browser.sputnik?
|
58
|
+
browser.sougou_browser?
|
56
59
|
|
57
60
|
# Get bot info
|
58
61
|
browser.bot.name
|
@@ -65,6 +68,7 @@ Browser::Bot.why?(ua)
|
|
65
68
|
browser.device
|
66
69
|
browser.device.id
|
67
70
|
browser.device.name
|
71
|
+
browser.device.unknown?
|
68
72
|
browser.device.blackberry_playbook?
|
69
73
|
browser.device.console?
|
70
74
|
browser.device.ipad?
|
@@ -85,6 +89,7 @@ browser.device.tv?
|
|
85
89
|
browser.device.vita?
|
86
90
|
browser.device.wii?
|
87
91
|
browser.device.wiiu?
|
92
|
+
browser.device.samsung?
|
88
93
|
browser.device.switch?
|
89
94
|
browser.device.xbox?
|
90
95
|
browser.device.xbox_360?
|
@@ -110,7 +115,7 @@ browser.platform.ios_app? # detect webview in an iOS app
|
|
110
115
|
browser.platform.ios_webview? # alias for ios_app?
|
111
116
|
browser.platform.linux?
|
112
117
|
browser.platform.mac?
|
113
|
-
browser.platform.
|
118
|
+
browser.platform.unknown?
|
114
119
|
browser.platform.windows10?
|
115
120
|
browser.platform.windows7?
|
116
121
|
browser.platform.windows8?
|
@@ -125,11 +130,14 @@ browser.platform.windows_wow64?
|
|
125
130
|
browser.platform.windows_x64?
|
126
131
|
browser.platform.windows_x64_inclusive?
|
127
132
|
browser.platform.windows_xp?
|
133
|
+
browser.platform.kai_os?
|
128
134
|
```
|
129
135
|
|
130
136
|
### Aliases
|
131
137
|
|
132
|
-
To add aliases like `mobile?` and `tablet?` to the base object (e.g
|
138
|
+
To add aliases like `mobile?` and `tablet?` to the base object (e.g
|
139
|
+
`browser.mobile?`), require the `browser/aliases` file and extend the
|
140
|
+
Browser::Base object like the following:
|
133
141
|
|
134
142
|
```ruby
|
135
143
|
require "browser/aliases"
|
@@ -141,13 +149,18 @@ browser.mobile? #=> false
|
|
141
149
|
|
142
150
|
### What's being detected?
|
143
151
|
|
144
|
-
- For a list of platform detections, check
|
145
|
-
|
146
|
-
- For a list of
|
152
|
+
- For a list of platform detections, check
|
153
|
+
[lib/browser/platform.rb](https://github.com/fnando/browser/blob/master/lib/browser/platform.rb)
|
154
|
+
- For a list of device detections, check
|
155
|
+
[lib/browser/device.rb](https://github.com/fnando/browser/blob/master/lib/browser/device.rb)
|
156
|
+
- For a list of bot detections, check
|
157
|
+
[bots.yml](https://github.com/fnando/browser/blob/master/bots.yml)
|
147
158
|
|
148
159
|
### Detecting modern browsers
|
149
160
|
|
150
|
-
To detect whether a browser can be considered as modern or not, create a method
|
161
|
+
To detect whether a browser can be considered as modern or not, create a method
|
162
|
+
that abstracts your versioning constraints. The following example will consider
|
163
|
+
any of the following browsers as a modern:
|
151
164
|
|
152
165
|
```ruby
|
153
166
|
# Expects an Browser instance,
|
@@ -175,7 +188,8 @@ Just add it to the Gemfile.
|
|
175
188
|
gem "browser"
|
176
189
|
```
|
177
190
|
|
178
|
-
This adds a helper method called `browser`, that inspects your current user
|
191
|
+
This adds a helper method called `browser`, that inspects your current user
|
192
|
+
agent.
|
179
193
|
|
180
194
|
```erb
|
181
195
|
<% if browser.ie?(6) %>
|
@@ -183,7 +197,8 @@ This adds a helper method called `browser`, that inspects your current user agen
|
|
183
197
|
<% end %>
|
184
198
|
```
|
185
199
|
|
186
|
-
If you want to use Browser on your Rails app but don't want to taint your
|
200
|
+
If you want to use Browser on your Rails app but don't want to taint your
|
201
|
+
controller, use the following line on your Gemfile:
|
187
202
|
|
188
203
|
```ruby
|
189
204
|
gem "browser", require: "browser/browser"
|
@@ -191,7 +206,8 @@ gem "browser", require: "browser/browser"
|
|
191
206
|
|
192
207
|
### Accept Language
|
193
208
|
|
194
|
-
Parses the accept-language header from an HTTP request and produces an array of
|
209
|
+
Parses the accept-language header from an HTTP request and produces an array of
|
210
|
+
language objects sorted by quality.
|
195
211
|
|
196
212
|
```ruby
|
197
213
|
browser = Browser.new("Some User Agent", accept_language: "en-us")
|
@@ -217,16 +233,22 @@ language.name
|
|
217
233
|
#=> "English/United States"
|
218
234
|
```
|
219
235
|
|
220
|
-
Result is always sorted in quality order from highest to lowest. As per the HTTP
|
236
|
+
Result is always sorted in quality order from highest to lowest. As per the HTTP
|
237
|
+
spec:
|
221
238
|
|
222
239
|
- omitting the quality value implies 1.0.
|
223
240
|
- quality value equal to zero means that is not accepted by the client.
|
224
241
|
|
225
242
|
### Internet Explorer
|
226
243
|
|
227
|
-
Internet Explorer has a compatibility view mode that allows newer versions
|
244
|
+
Internet Explorer has a compatibility view mode that allows newer versions
|
245
|
+
(IE8+) to run as an older version. Browser will always return the navigator
|
246
|
+
version, ignoring the compatibility view version, when defined. If you need to
|
247
|
+
get the engine's version, you have to use `Browser#msie_version` and
|
248
|
+
`Browser#msie_full_version`.
|
228
249
|
|
229
|
-
So, let's say an user activates compatibility view in a IE11 browser. This is
|
250
|
+
So, let's say an user activates compatibility view in a IE11 browser. This is
|
251
|
+
what you'll get:
|
230
252
|
|
231
253
|
```ruby
|
232
254
|
browser.version
|
@@ -245,11 +267,14 @@ browser.compatibility_view?
|
|
245
267
|
#=> true
|
246
268
|
```
|
247
269
|
|
248
|
-
This behavior changed in `v1.0.0`; previously there wasn't a way of getting the
|
270
|
+
This behavior changed in `v1.0.0`; previously there wasn't a way of getting the
|
271
|
+
real browser version.
|
249
272
|
|
250
273
|
### Safari
|
251
274
|
|
252
|
-
iOS webviews and web apps aren't detected as Safari anymore, so be aware of that
|
275
|
+
iOS webviews and web apps aren't detected as Safari anymore, so be aware of that
|
276
|
+
if that's your case. You can use a combination of platform and webkit detection
|
277
|
+
to do whatever you want.
|
253
278
|
|
254
279
|
```ruby
|
255
280
|
# iPad's Safari running as web app mode.
|
@@ -267,19 +292,25 @@ browser.platform.ios?
|
|
267
292
|
|
268
293
|
### Bots
|
269
294
|
|
270
|
-
The bot detection is quite aggressive. Anything that matches at least one of the
|
295
|
+
The bot detection is quite aggressive. Anything that matches at least one of the
|
296
|
+
following requirements will be considered a bot.
|
271
297
|
|
272
298
|
- Empty user agent string
|
273
299
|
- User agent that matches `/crawl|fetch|search|monitoring|spider|bot/`
|
274
|
-
- Any known bot listed under
|
300
|
+
- Any known bot listed under
|
301
|
+
[bots.yml](https://github.com/fnando/browser/blob/master/bots.yml)
|
275
302
|
|
276
|
-
To add custom matchers, you can add a callable object to
|
303
|
+
To add custom matchers, you can add a callable object to
|
304
|
+
`Browser::Bot.matchers`. The following example matches everything that has a
|
305
|
+
`externalhit` substring on it. The bot name will always be `General Bot`.
|
277
306
|
|
278
307
|
```ruby
|
279
|
-
Browser::Bot.matchers << ->(ua, _browser) { ua
|
308
|
+
Browser::Bot.matchers << ->(ua, _browser) { ua.match?(/externalhit/i) }
|
280
309
|
```
|
281
310
|
|
282
|
-
To clear all matchers, including the ones that are bundled, use
|
311
|
+
To clear all matchers, including the ones that are bundled, use
|
312
|
+
`Browser::Bot.matchers.clear`. You can re-add built-in matchers by doing the
|
313
|
+
following:
|
283
314
|
|
284
315
|
```ruby
|
285
316
|
Browser::Bot.matchers += Browser::Bot.default_matchers
|
@@ -302,7 +333,8 @@ use Browser::Middleware do
|
|
302
333
|
end
|
303
334
|
```
|
304
335
|
|
305
|
-
If you're using Rails, you can use the route helper methods. Just add something
|
336
|
+
If you're using Rails, you can use the route helper methods. Just add something
|
337
|
+
like the following to a initializer file (`config/initializers/browser.rb`).
|
306
338
|
|
307
339
|
```ruby
|
308
340
|
Rails.configuration.middleware.use Browser::Middleware do
|
@@ -310,7 +342,8 @@ Rails.configuration.middleware.use Browser::Middleware do
|
|
310
342
|
end
|
311
343
|
```
|
312
344
|
|
313
|
-
If you need access to the `Rack::Request` object (e.g. to exclude a path), you
|
345
|
+
If you need access to the `Rack::Request` object (e.g. to exclude a path), you
|
346
|
+
can do so with `request`.
|
314
347
|
|
315
348
|
```ruby
|
316
349
|
Rails.configuration.middleware.use Browser::Middleware do
|
@@ -318,6 +351,20 @@ Rails.configuration.middleware.use Browser::Middleware do
|
|
318
351
|
end
|
319
352
|
```
|
320
353
|
|
354
|
+
### Restrictions
|
355
|
+
|
356
|
+
- User agent has a size limit of 2048 bytes. This can be customized through
|
357
|
+
`Browser.user_agent_size_limit=(size)`.
|
358
|
+
- Accept-Language has a size limit of 2048 bytes. This can be customized through
|
359
|
+
`Browser.accept_language_size_limit=(size)`.
|
360
|
+
|
361
|
+
If size is not respected, then `Browser::Error` is raised.
|
362
|
+
|
363
|
+
```ruby
|
364
|
+
Browser.user_agent_size_limit = 4096
|
365
|
+
Browser.accept_language_size_limit = 4096
|
366
|
+
```
|
367
|
+
|
321
368
|
## Development
|
322
369
|
|
323
370
|
### Versioning
|
@@ -334,25 +381,28 @@ Once you've made your great commits (include tests, please):
|
|
334
381
|
4. Create a pull request
|
335
382
|
5. That's it!
|
336
383
|
|
337
|
-
Please respect the indentation rules and code style.
|
338
|
-
And
|
384
|
+
Please respect the indentation rules and code style. And use 2 spaces, not tabs.
|
385
|
+
And don't touch the version thing.
|
339
386
|
|
340
387
|
## Configuring environment
|
341
388
|
|
342
|
-
To configure your environment, you must have Ruby and bundler installed. Then
|
389
|
+
To configure your environment, you must have Ruby and bundler installed. Then
|
390
|
+
run `bundle install` to install all dependencies.
|
343
391
|
|
344
392
|
To run tests, execute `./bin/rake`.
|
345
393
|
|
346
394
|
### Adding new features
|
347
395
|
|
348
|
-
Before using your time to code a new feature, open a ticket asking if it makes
|
396
|
+
Before using your time to code a new feature, open a ticket asking if it makes
|
397
|
+
sense and if it's on this project's scope.
|
349
398
|
|
350
399
|
Don't forget to add a new entry to `CHANGELOG.md`.
|
351
400
|
|
352
401
|
#### Adding a new bot
|
353
402
|
|
354
403
|
1. Add the user agent to `test/ua_bots.yml`.
|
355
|
-
2. Add the readable name to `bots.yml`. The key must be something that matches
|
404
|
+
2. Add the readable name to `bots.yml`. The key must be something that matches
|
405
|
+
the user agent, in lowercased text.
|
356
406
|
3. Run tests.
|
357
407
|
|
358
408
|
Don't forget to add a new entry to `CHANGELOG.md`.
|
@@ -361,42 +411,43 @@ Don't forget to add a new entry to `CHANGELOG.md`.
|
|
361
411
|
|
362
412
|
1. Add the user agent to `test/ua_search_engines.yml`.
|
363
413
|
2. Add the same user agent to `test/ua_bots.yml`.
|
364
|
-
3. Add the readable name to `search_engines.yml`. The key must be something that
|
414
|
+
3. Add the readable name to `search_engines.yml`. The key must be something that
|
415
|
+
matches the user agent, in lowercased text.
|
365
416
|
4. Run tests.
|
366
417
|
|
367
418
|
Don't forget to add a new entry to `CHANGELOG.md`.
|
368
419
|
|
369
420
|
#### Wrong browser/platform/device detection
|
370
421
|
|
371
|
-
If you know how to fix it, follow the "Writing code" above. Open an issue
|
422
|
+
If you know how to fix it, follow the "Writing code" above. Open an issue
|
423
|
+
otherwise; make sure you fill in the issue template with all the required
|
424
|
+
information.
|
372
425
|
|
373
426
|
## Maintainer
|
374
427
|
|
375
|
-
|
428
|
+
- Nando Vieira - http://nandovieira.com
|
376
429
|
|
377
430
|
## Contributors
|
378
431
|
|
379
|
-
|
432
|
+
- https://github.com/fnando/browser/contributors
|
380
433
|
|
381
434
|
## License
|
382
435
|
|
383
436
|
(The MIT License)
|
384
437
|
|
385
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
IN
|
400
|
-
|
401
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
402
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
438
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
439
|
+
this software and associated documentation files (the 'Software'), to deal in
|
440
|
+
the Software without restriction, including without limitation the rights to
|
441
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
442
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
443
|
+
subject to the following conditions:
|
444
|
+
|
445
|
+
The above copyright notice and this permission notice shall be included in all
|
446
|
+
copies or substantial portions of the Software.
|
447
|
+
|
448
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
449
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
450
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
451
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
452
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
453
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|