browsernizer 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dd10a5602dbe925a6e861a29820259986292e83
4
- data.tar.gz: 1a2602a4e5bda131e7f72a0d20a168e3bac2d079
3
+ metadata.gz: f4cd0e2044b75ac34c7a4a68c72c7d6476748d4a
4
+ data.tar.gz: ff8042973932bfeaef12dbb5a0cb375292b590e9
5
5
  SHA512:
6
- metadata.gz: 94f21d35f5197a663cf05a7b402f23bc8e596a65fe2df01b0bfe40f16756f272b8a281322250c2cd31b6554fe2f3af17ff477d4be77f1f19c7580e5ff8d7058d
7
- data.tar.gz: cb828676b75e87b317ce6b8d57c66961d6b1af7364cba1f865c67fe3f964b11fc6fda780bc97cbab4bb21eb4a5e5fdf01d853445a3aa81ed6837a4b964efcf9a
6
+ metadata.gz: 907c615e77e885e99e4d50cd8371329ae3bcae81179c6e3f1c704a2d6e1d03dde254db00b992cb62441f9f5f67e00b0b96e7980ea13f37e8c6539f989ca81571
7
+ data.tar.gz: 5d7746684726e83324391cd9e486e6ab7acd24eb36562ecc9c5c42e1b7ca91dd2874dca1c6d0d483c984e0a8ff87de3581fa00510da260a0221228ccc7625af6
data/README.md CHANGED
@@ -54,7 +54,7 @@ passed to it. If you wish to state that *mobile safari* is not supported, you
54
54
  can declare it like this:
55
55
 
56
56
  config.supported do |browser|
57
- !(browser.name == "Safari" && browser.mobile?)
57
+ !(browser.name == "Safari" && browser.device.mobile?)
58
58
  end
59
59
 
60
60
  The block should return false to block the browser, true to allow it, and nil if it
@@ -62,7 +62,7 @@ cannot decide. This way you can make any arbitrary User-Agent explicitly allowed
62
62
  even if its version would have been blocked otherwise:
63
63
 
64
64
  config.supported do |browser|
65
- true if browser.user_agent.include?('Linux')
65
+ true if browser.ua.include?('Linux')
66
66
  end
67
67
 
68
68
  Please note, that the order is important, thus the first block or requirement returning
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency "rake"
22
22
  s.add_development_dependency "rspec"
23
23
 
24
- s.add_runtime_dependency "browser", "> 0.1.4"
24
+ s.add_runtime_dependency "browser", ">= 2.0", "< 3.0"
25
25
  end
@@ -47,7 +47,7 @@ module Browsernizer
47
47
  end
48
48
 
49
49
  def get_browsers(env)
50
- raw_browser = ::Browser.new :ua => env["HTTP_USER_AGENT"]
50
+ raw_browser = ::Browser.new env["HTTP_USER_AGENT"]
51
51
  browser = Browsernizer::Browser.new raw_browser.name.to_s, raw_browser.full_version.to_s
52
52
  [raw_browser, browser]
53
53
  end
@@ -1,3 +1,3 @@
1
1
  module Browsernizer
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -5,12 +5,12 @@ describe Browsernizer::Browser do
5
5
  describe "#meets?(requirement)" do
6
6
  context "same vendor" do
7
7
  it "returns true if version is >= to requirement" do
8
- expect(browser("Chrome", "10.0").meets?(browser("Chrome", "10" ))).to be_true
9
- expect(browser("Chrome", "10.0").meets?(browser("Chrome", "10.1"))).to be_false
10
- expect(browser("Chrome", "10" ).meets?(browser("Chrome", " 9.1"))).to be_true
8
+ expect(browser("Chrome", "10.0").meets?(browser("Chrome", "10" ))).to be true
9
+ expect(browser("Chrome", "10.0").meets?(browser("Chrome", "10.1"))).to be false
10
+ expect(browser("Chrome", "10" ).meets?(browser("Chrome", " 9.1"))).to be true
11
11
  end
12
12
  it "returns false if requirement version is set to false" do
13
- expect(browser("Chrome", "10" ).meets?(browser("Chrome", false ))).to be_false
13
+ expect(browser("Chrome", "10" ).meets?(browser("Chrome", false ))).to be false
14
14
  end
15
15
  end
16
16
 
@@ -13,7 +13,7 @@ describe Browsernizer::Config do
13
13
 
14
14
  it "allows to unsupport browser by using false as version number" do
15
15
  subject.supported "Chrome", false
16
- expect(subject.get_supported[0].version).to be_false
16
+ expect(subject.get_supported[0].version).to be false
17
17
  end
18
18
  end
19
19
 
@@ -29,11 +29,11 @@ describe Browsernizer::Config do
29
29
  subject.exclude %r{^/assets}
30
30
  subject.exclude "/foo/bar.html"
31
31
 
32
- expect(subject.excluded?("/assets/foo.jpg")).to be_true
33
- expect(subject.excluded?("/Assets/foo.jpg")).to be_false
34
- expect(subject.excluded?("/prefix/assets/foo.jpg")).to be_false
35
- expect(subject.excluded?("/foo/bar.html")).to be_true
36
- expect(subject.excluded?("/foo/bar2.html")).to be_false
32
+ expect(subject.excluded?("/assets/foo.jpg")).to be true
33
+ expect(subject.excluded?("/Assets/foo.jpg")).to be false
34
+ expect(subject.excluded?("/prefix/assets/foo.jpg")).to be false
35
+ expect(subject.excluded?("/foo/bar.html")).to be true
36
+ expect(subject.excluded?("/foo/bar2.html")).to be false
37
37
  end
38
38
  end
39
39
 
@@ -7,12 +7,12 @@ describe Browsernizer::Router do
7
7
  subject do
8
8
  Browsernizer::Router.new(app) do |config|
9
9
  config.supported do |browser|
10
- true if browser.user_agent.include?('Spec')
10
+ true if browser.ua.include?('Spec')
11
11
  end
12
12
  config.supported "Firefox", false
13
13
  config.supported "Chrome", "7.1"
14
14
  config.supported do |browser|
15
- !(browser.safari? && browser.mobile?)
15
+ !(browser.safari? && browser.device.mobile?)
16
16
  end
17
17
  end
18
18
  end
@@ -27,7 +27,7 @@ describe Browsernizer::Router do
27
27
  context "All Good" do
28
28
  it "propagates request with updated env" do
29
29
  expect(app).to receive(:call) do |env|
30
- expect(env['browsernizer']['supported']).to be_true
30
+ expect(env['browsernizer']['supported']).to be true
31
31
  expect(env['browsernizer']['browser']).to eq("Chrome")
32
32
  expect(env['browsernizer']['version']).to eq("7.1.1")
33
33
  end
@@ -40,7 +40,7 @@ describe Browsernizer::Router do
40
40
  context "location not set" do
41
41
  it "propagates request with updated env" do
42
42
  expect(app).to receive(:call) do |env|
43
- expect(env['browsernizer']['supported']).to be_false
43
+ expect(env['browsernizer']['supported']).to be false
44
44
  end
45
45
  subject.call(@env)
46
46
  end
@@ -83,7 +83,7 @@ describe Browsernizer::Router do
83
83
  end
84
84
  it "propagates request with updated env" do
85
85
  expect(app).to receive(:call) do |env|
86
- expect(env['browsernizer']['supported']).to be_false
86
+ expect(env['browsernizer']['supported']).to be false
87
87
  end
88
88
  subject.call(@env)
89
89
  end
@@ -127,7 +127,7 @@ describe Browsernizer::Router do
127
127
 
128
128
  it "propagates request" do
129
129
  expect(app).to receive(:call) do |env|
130
- expect(env['browsernizer']['supported']).to be_true
130
+ expect(env['browsernizer']['supported']).to be true
131
131
  end
132
132
  subject.call(@env)
133
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsernizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Milovan Zogovic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: browser
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ - - "<"
46
49
  - !ruby/object:Gem::Version
47
- version: 0.1.4
50
+ version: '3.0'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - ">"
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '2.0'
58
+ - - "<"
53
59
  - !ruby/object:Gem::Version
54
- version: 0.1.4
60
+ version: '3.0'
55
61
  description: Rack middleware for redirecting unsupported user agents to "please upgrade"
56
62
  page
57
63
  email:
@@ -99,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
105
  version: '0'
100
106
  requirements: []
101
107
  rubyforge_project: browsernizer
102
- rubygems_version: 2.4.2
108
+ rubygems_version: 2.4.5.1
103
109
  signing_key:
104
110
  specification_version: 4
105
111
  summary: Want friendly "please upgrade your browser" page? This gem is for you.