rails_locale_detection 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8c27829347e137b07d2ac81252de1d6bed5d84b
4
- data.tar.gz: 2e16e6f84ec0cca5254e0d867dfa980f12ba4133
3
+ metadata.gz: c4ef48a5c499b6e9a8da66926f5d9cca930e4d24
4
+ data.tar.gz: 37bcb6e85096e563494c3d022c7485247365501c
5
5
  SHA512:
6
- metadata.gz: 0253574fbf32ae79988c5f1a1ffac47944049b9f8a077b675adbb27768ed142c2af2950806a6dfc3a4fba2483c4f96496fa1a07ecea9c8f614b8c444fd9260dc
7
- data.tar.gz: 50894ac1a4a91059133f8ef04c9cd1ee2d25f1ffff9612526847548c2aee82f10020474c8f2383abf17332c0c85c6cf66cb67c0aac1c5e99454246f8cb7459b7
6
+ metadata.gz: d7f1a95d8eeb1aa084e5f672bd886e3fc32797b2d8caeb984a15dbfef60a09c4e2d401187742945fb4183406cee690ae2c5c78d4855de40dc86b423cc988d295
7
+ data.tar.gz: c3374a4b12d24be47e3528152fd34fa2eda2b693d721ada42c683241074e8de8a3f63a472b4869101bd3db430d61de5e0b08aa6bf0a5fb2f79d1d16e99acc928
@@ -1,4 +1,4 @@
1
- before_install: gem install bundler --version '1.10.6'
1
+ before_install: gem install bundler --version '1.12.5'
2
2
 
3
3
  sudo: false
4
4
 
@@ -7,6 +7,7 @@ gemfile:
7
7
  - gemfiles/rails4.0.gemfile
8
8
  - gemfiles/rails4.1.gemfile
9
9
  - gemfiles/rails4.2.gemfile
10
+ - gemfiles/rails5.0.gemfile
10
11
 
11
12
  rvm:
12
- - "2.2.0"
13
+ - "2.3.0"
data/Appraisals CHANGED
@@ -12,4 +12,8 @@ end
12
12
 
13
13
  appraise "rails4.2" do
14
14
  gem "rails", "4.2.4"
15
- end
15
+ end
16
+
17
+ appraise "rails5.0" do
18
+ gem "rails", "5.0.0"
19
+ end
@@ -8,47 +8,50 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (4.2.4)
12
- actionpack (= 4.2.4)
13
- actionview (= 4.2.4)
14
- activejob (= 4.2.4)
11
+ actioncable (5.0.0)
12
+ actionpack (= 5.0.0)
13
+ nio4r (~> 1.2)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.0.0)
16
+ actionpack (= 5.0.0)
17
+ actionview (= 5.0.0)
18
+ activejob (= 5.0.0)
15
19
  mail (~> 2.5, >= 2.5.4)
16
- rails-dom-testing (~> 1.0, >= 1.0.5)
17
- actionpack (4.2.4)
18
- actionview (= 4.2.4)
19
- activesupport (= 4.2.4)
20
- rack (~> 1.6)
21
- rack-test (~> 0.6.2)
22
- rails-dom-testing (~> 1.0, >= 1.0.5)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.0.0)
22
+ actionview (= 5.0.0)
23
+ activesupport (= 5.0.0)
24
+ rack (~> 2.0)
25
+ rack-test (~> 0.6.3)
26
+ rails-dom-testing (~> 2.0)
23
27
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
- actionview (4.2.4)
25
- activesupport (= 4.2.4)
28
+ actionview (5.0.0)
29
+ activesupport (= 5.0.0)
26
30
  builder (~> 3.1)
27
31
  erubis (~> 2.7.0)
28
- rails-dom-testing (~> 1.0, >= 1.0.5)
32
+ rails-dom-testing (~> 2.0)
29
33
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
- activejob (4.2.4)
31
- activesupport (= 4.2.4)
32
- globalid (>= 0.3.0)
33
- activemodel (4.2.4)
34
- activesupport (= 4.2.4)
35
- builder (~> 3.1)
36
- activerecord (4.2.4)
37
- activemodel (= 4.2.4)
38
- activesupport (= 4.2.4)
39
- arel (~> 6.0)
40
- activesupport (4.2.4)
34
+ activejob (5.0.0)
35
+ activesupport (= 5.0.0)
36
+ globalid (>= 0.3.6)
37
+ activemodel (5.0.0)
38
+ activesupport (= 5.0.0)
39
+ activerecord (5.0.0)
40
+ activemodel (= 5.0.0)
41
+ activesupport (= 5.0.0)
42
+ arel (~> 7.0)
43
+ activesupport (5.0.0)
44
+ concurrent-ruby (~> 1.0, >= 1.0.2)
41
45
  i18n (~> 0.7)
42
- json (~> 1.7, >= 1.7.7)
43
46
  minitest (~> 5.1)
44
- thread_safe (~> 0.3, >= 0.3.4)
45
47
  tzinfo (~> 1.1)
46
48
  appraisal (2.1.0)
47
49
  bundler
48
50
  rake
49
51
  thor (>= 0.14.0)
50
- arel (6.0.3)
52
+ arel (7.1.0)
51
53
  builder (3.2.2)
54
+ concurrent-ruby (1.0.2)
52
55
  diff-lcs (1.2.5)
53
56
  erubis (2.7.0)
54
57
  gem-release (0.5.5)
@@ -56,89 +59,97 @@ GEM
56
59
  activesupport (>= 4.1.0)
57
60
  http_accept_language (2.0.5)
58
61
  i18n (0.7.0)
59
- json (1.8.3)
60
62
  loofah (2.0.3)
61
63
  nokogiri (>= 1.5.9)
62
- mail (2.6.3)
63
- mime-types (>= 1.16, < 3)
64
- mime-types (2.6.2)
65
- mini_portile (0.6.2)
66
- minitest (5.8.1)
67
- nokogiri (1.6.6.2)
68
- mini_portile (~> 0.6.0)
69
- power_assert (0.2.4)
70
- rack (1.6.4)
64
+ mail (2.6.4)
65
+ mime-types (>= 1.16, < 4)
66
+ method_source (0.8.2)
67
+ mime-types (3.1)
68
+ mime-types-data (~> 3.2015)
69
+ mime-types-data (3.2016.0521)
70
+ mini_portile2 (2.1.0)
71
+ minitest (5.9.0)
72
+ nio4r (1.2.1)
73
+ nokogiri (1.6.8)
74
+ mini_portile2 (~> 2.1.0)
75
+ pkg-config (~> 1.1.7)
76
+ pkg-config (1.1.7)
77
+ power_assert (0.3.0)
78
+ rack (2.0.1)
71
79
  rack-test (0.6.3)
72
80
  rack (>= 1.0)
73
- rails (4.2.4)
74
- actionmailer (= 4.2.4)
75
- actionpack (= 4.2.4)
76
- actionview (= 4.2.4)
77
- activejob (= 4.2.4)
78
- activemodel (= 4.2.4)
79
- activerecord (= 4.2.4)
80
- activesupport (= 4.2.4)
81
+ rails (5.0.0)
82
+ actioncable (= 5.0.0)
83
+ actionmailer (= 5.0.0)
84
+ actionpack (= 5.0.0)
85
+ actionview (= 5.0.0)
86
+ activejob (= 5.0.0)
87
+ activemodel (= 5.0.0)
88
+ activerecord (= 5.0.0)
89
+ activesupport (= 5.0.0)
81
90
  bundler (>= 1.3.0, < 2.0)
82
- railties (= 4.2.4)
83
- sprockets-rails
84
- rails-deprecated_sanitizer (1.0.3)
85
- activesupport (>= 4.2.0.alpha)
86
- rails-dom-testing (1.0.7)
87
- activesupport (>= 4.2.0.beta, < 5.0)
91
+ railties (= 5.0.0)
92
+ sprockets-rails (>= 2.0.0)
93
+ rails-dom-testing (2.0.1)
94
+ activesupport (>= 4.2.0, < 6.0)
88
95
  nokogiri (~> 1.6.0)
89
- rails-deprecated_sanitizer (>= 1.0.1)
90
- rails-html-sanitizer (1.0.2)
96
+ rails-html-sanitizer (1.0.3)
91
97
  loofah (~> 2.0)
92
- railties (4.2.4)
93
- actionpack (= 4.2.4)
94
- activesupport (= 4.2.4)
98
+ railties (5.0.0)
99
+ actionpack (= 5.0.0)
100
+ activesupport (= 5.0.0)
101
+ method_source
95
102
  rake (>= 0.8.7)
96
103
  thor (>= 0.18.1, < 2.0)
97
- rake (10.0.4)
98
- rspec-core (3.3.2)
99
- rspec-support (~> 3.3.0)
100
- rspec-expectations (3.3.1)
104
+ rake (11.2.2)
105
+ rspec-core (3.5.1)
106
+ rspec-support (~> 3.5.0)
107
+ rspec-expectations (3.5.0)
101
108
  diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.3.0)
103
- rspec-mocks (3.3.2)
109
+ rspec-support (~> 3.5.0)
110
+ rspec-mocks (3.5.0)
104
111
  diff-lcs (>= 1.2.0, < 2.0)
105
- rspec-support (~> 3.3.0)
106
- rspec-rails (3.3.3)
107
- actionpack (>= 3.0, < 4.3)
108
- activesupport (>= 3.0, < 4.3)
109
- railties (>= 3.0, < 4.3)
110
- rspec-core (~> 3.3.0)
111
- rspec-expectations (~> 3.3.0)
112
- rspec-mocks (~> 3.3.0)
113
- rspec-support (~> 3.3.0)
114
- rspec-support (3.3.0)
115
- sprockets (3.4.0)
116
- rack (> 1, < 3)
117
- sprockets-rails (2.3.3)
112
+ rspec-support (~> 3.5.0)
113
+ rspec-rails (3.5.1)
118
114
  actionpack (>= 3.0)
119
115
  activesupport (>= 3.0)
120
- sprockets (>= 2.8, < 4.0)
121
- test-unit (3.1.5)
116
+ railties (>= 3.0)
117
+ rspec-core (~> 3.5.0)
118
+ rspec-expectations (~> 3.5.0)
119
+ rspec-mocks (~> 3.5.0)
120
+ rspec-support (~> 3.5.0)
121
+ rspec-support (3.5.0)
122
+ sprockets (3.7.0)
123
+ concurrent-ruby (~> 1.0)
124
+ rack (> 1, < 3)
125
+ sprockets-rails (3.1.1)
126
+ actionpack (>= 4.0)
127
+ activesupport (>= 4.0)
128
+ sprockets (>= 3.0.0)
129
+ test-unit (3.2.1)
122
130
  power_assert
123
131
  thor (0.19.1)
124
132
  thread_safe (0.3.5)
125
133
  timecop (0.6.3)
126
134
  tzinfo (1.2.2)
127
135
  thread_safe (~> 0.1)
136
+ websocket-driver (0.6.4)
137
+ websocket-extensions (>= 0.1.0)
138
+ websocket-extensions (0.1.2)
128
139
 
129
140
  PLATFORMS
130
141
  ruby
131
142
 
132
143
  DEPENDENCIES
133
144
  appraisal (~> 2.1.0)
134
- bundler (~> 1.10.6)
145
+ bundler (~> 1.12.5)
135
146
  gem-release (~> 0.5.3)
136
147
  i18n (~> 0.7.0)
137
148
  rails_locale_detection!
138
- rake (~> 10.0.4)
149
+ rake (~> 11.2.2)
139
150
  rspec-rails (~> 3.0)
140
151
  test-unit (~> 3.0)
141
152
  timecop (~> 0.6.1)
142
153
 
143
154
  BUNDLED WITH
144
- 1.10.6
155
+ 1.12.5
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "5.0.0"
6
+
7
+ gemspec :path => "../"
@@ -8,8 +8,14 @@ module RailsLocaleDetection
8
8
  end
9
9
 
10
10
  module ClassMethods
11
- def detect_locale
12
- append_before_filter LocaleDetector
11
+ if ::Rails.version.to_s < "4.0"
12
+ def detect_locale
13
+ append_before_filter LocaleDetector
14
+ end
15
+ else
16
+ def detect_locale
17
+ append_before_action LocaleDetector
18
+ end
13
19
  end
14
20
  end
15
21
 
@@ -17,4 +23,4 @@ module RailsLocaleDetection
17
23
  nil
18
24
  end
19
25
  end
20
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsLocaleDetection
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ["Mateo Murphy"]
10
10
  gem.email = ["mateo.murphy@gmail.com"]
11
11
  gem.description = "Sets the current locale of a request using a combination of params, cookies, and http headers"
12
- gem.summary = "Locale setting for rails project"
12
+ gem.summary = "Locale setting for rails projects"
13
13
  gem.homepage = "https://github.com/mateomurphy/rails_locale_detection"
14
14
  gem.license = 'MIT'
15
15
 
@@ -22,10 +22,10 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency('rails', '>= 3.2.0')
23
23
 
24
24
  gem.add_development_dependency('appraisal', '~> 2.1.0')
25
- gem.add_development_dependency('bundler', '~> 1.10.6')
25
+ gem.add_development_dependency('bundler', '~> 1.12.5')
26
26
  gem.add_development_dependency('i18n', '~> 0.7.0')
27
27
  gem.add_development_dependency('gem-release', '~> 0.5.3')
28
- gem.add_development_dependency('rake', '~> 10.0.4')
28
+ gem.add_development_dependency('rake', '~> 11.2.2')
29
29
  gem.add_development_dependency('rspec-rails', '~> 3.0')
30
30
  gem.add_development_dependency('timecop', '~> 0.6.1')
31
31
  gem.add_development_dependency('test-unit', '~> 3.0')
@@ -12,8 +12,23 @@ describe RailsLocaleDetection::ControllerMethods do
12
12
  expect(controller.class).to respond_to(:detect_locale)
13
13
  end
14
14
 
15
- it 'should add a before filter' do
16
- expect(controller.class.before_filters).to eq([[RailsLocaleDetection::LocaleDetector]])
15
+ context 'when the rails is 4.0 or later' do
16
+ before do
17
+ skip "Rails version is #{::Rails.version.to_s}" unless ::Rails.version.to_s >= '4.0'
18
+ end
19
+
20
+ it 'adds the detector as a before action' do
21
+ expect(controller.class.before_actions).to eq([[RailsLocaleDetection::LocaleDetector]])
22
+ end
17
23
  end
18
24
 
25
+ context 'when the rails is less than 4.0' do
26
+ before do
27
+ skip "Rails version is #{::Rails.version.to_s}" unless ::Rails.version.to_s < '4.0'
28
+ end
29
+
30
+ it 'adds the detector as a before filter' do
31
+ expect(controller.class.before_filters).to eq([[RailsLocaleDetection::LocaleDetector]])
32
+ end
33
+ end
19
34
  end
@@ -6,7 +6,11 @@ class MockRequest
6
6
  def initialize
7
7
  @env = {'HTTP_ACCEPT_LANGUAGE' => ''}
8
8
  @cookies = {}
9
- @cookie_jar = ActionDispatch::Cookies::CookieJar.build(self)
9
+ @cookie_jar = if ::Rails.version.to_s < "5.0"
10
+ ActionDispatch::Cookies::CookieJar.build(self)
11
+ else
12
+ ActionDispatch::Cookies::CookieJar.build(self, @cookies)
13
+ end
10
14
  end
11
15
 
12
16
  def host
@@ -16,7 +20,6 @@ class MockRequest
16
20
  def ssl?
17
21
  false
18
22
  end
19
-
20
23
  end
21
24
 
22
25
  class MockUser
@@ -42,6 +45,7 @@ class MockController
42
45
 
43
46
  class << self
44
47
  attr_reader :before_filters
48
+ attr_reader :before_actions
45
49
  end
46
50
 
47
51
  def self.before_filter(*args)
@@ -54,6 +58,11 @@ class MockController
54
58
  @before_filters << args
55
59
  end
56
60
 
61
+ def self.append_before_action(*args)
62
+ @before_actions ||= []
63
+ @before_actions << args
64
+ end
65
+
57
66
  include RailsLocaleDetection::ControllerMethods
58
67
  include HttpAcceptLanguage::EasyAccess
59
- end
68
+ end
@@ -2,7 +2,7 @@ class MockApplication
2
2
  def self.env_config
3
3
  {}
4
4
  end
5
-
5
+
6
6
  def self.routes
7
7
  @routes ||= ActionDispatch::Routing::RouteSet.new
8
8
  end
@@ -15,16 +15,21 @@ end
15
15
  ::Rails.application = MockApplication
16
16
 
17
17
  ActionController::Base.send :include, RailsLocaleDetection::ControllerMethods
18
- ActionController::Base.send :include, Rails.application.routes.url_helpers
18
+ ActionController::Base.send :include, Rails.application.routes.url_helpers
19
19
 
20
20
  class CallbackTestsController < ActionController::Base
21
21
 
22
22
  def user_locale
23
23
  :fr
24
24
  end
25
-
25
+
26
26
  def show
27
- render :text => current_locale
27
+ if ::Rails.version.to_s < "4.1"
28
+ render text: current_locale
29
+ else
30
+ render plain: current_locale
31
+ end
32
+
28
33
  end
29
-
30
- end
34
+
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_locale_detection
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateo Murphy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-14 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http_accept_language
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.10.6
61
+ version: 1.12.5
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.10.6
68
+ version: 1.12.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: i18n
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 10.0.4
103
+ version: 11.2.2
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 10.0.4
110
+ version: 11.2.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -172,6 +172,7 @@ files:
172
172
  - gemfiles/rails4.0.gemfile
173
173
  - gemfiles/rails4.1.gemfile
174
174
  - gemfiles/rails4.2.gemfile
175
+ - gemfiles/rails5.0.gemfile
175
176
  - lib/rails_locale_detection.rb
176
177
  - lib/rails_locale_detection/controller_methods.rb
177
178
  - lib/rails_locale_detection/detection_methods.rb
@@ -208,10 +209,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
209
  version: '0'
209
210
  requirements: []
210
211
  rubyforge_project:
211
- rubygems_version: 2.4.6
212
+ rubygems_version: 2.6.6
212
213
  signing_key:
213
214
  specification_version: 4
214
- summary: Locale setting for rails project
215
+ summary: Locale setting for rails projects
215
216
  test_files:
216
217
  - spec/controllers/callback_tests_controller_spec.rb
217
218
  - spec/rails_locale_detection/config_spec.rb