rails_locale_detection 2.0.0.pre4 → 2.0.0

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: cdb3b948bbed5917988dec654d1f8772090111d9
4
- data.tar.gz: 6acebc0ba0c2efc4fe06e06cd9caa0307f9f3009
3
+ metadata.gz: b8c27829347e137b07d2ac81252de1d6bed5d84b
4
+ data.tar.gz: 2e16e6f84ec0cca5254e0d867dfa980f12ba4133
5
5
  SHA512:
6
- metadata.gz: be1f305e9d8d64f19d66709b80b4d478591fc9a3aec1c21d453fd11b7c8932d9f9f12d19e62ef2f1f1cf5864be302b61bef457c4c2853193923b7969537c98d8
7
- data.tar.gz: a5aaebfca2edca369aeeb4cfafd3354235457808bb71626483ac7299c87b918fe678b6f37c071acc618737d1121c8b9fb6a1b81930277e866a7b9591a6422205
6
+ metadata.gz: 0253574fbf32ae79988c5f1a1ffac47944049b9f8a077b675adbb27768ed142c2af2950806a6dfc3a4fba2483c4f96496fa1a07ecea9c8f614b8c444fd9260dc
7
+ data.tar.gz: 50894ac1a4a91059133f8ef04c9cd1ee2d25f1ffff9612526847548c2aee82f10020474c8f2383abf17332c0c85c6cf66cb67c0aac1c5e99454246f8cb7459b7
data/.gitignore CHANGED
@@ -16,4 +16,7 @@ pkg
16
16
 
17
17
  # rvm
18
18
  .rvmrc
19
- .ruby-*
19
+ .ruby-*
20
+
21
+ # appraisals
22
+ *.gemfile.lock
data/.travis.yml CHANGED
@@ -1,7 +1,12 @@
1
+ before_install: gem install bundler --version '1.10.6'
2
+
3
+ sudo: false
4
+
1
5
  gemfile:
2
- - gemfiles/rails3.gemfile
3
- - gemfiles/rails4.gemfile
4
-
6
+ - gemfiles/rails3.2.gemfile
7
+ - gemfiles/rails4.0.gemfile
8
+ - gemfiles/rails4.1.gemfile
9
+ - gemfiles/rails4.2.gemfile
10
+
5
11
  rvm:
6
- - "2.0.0"
7
- - "1.9.3"
12
+ - "2.2.0"
data/Appraisals CHANGED
@@ -1,7 +1,15 @@
1
- appraise "rails3" do
2
- gem "rails", "3.2.14"
1
+ appraise "rails3.2" do
2
+ gem "rails", "3.2.22"
3
3
  end
4
4
 
5
- appraise "rails4" do
6
- gem "rails", "4.0.0"
5
+ appraise "rails4.0" do
6
+ gem "rails", "4.0.13"
7
+ end
8
+
9
+ appraise "rails4.1" do
10
+ gem "rails", "4.1.13"
11
+ end
12
+
13
+ appraise "rails4.2" do
14
+ gem "rails", "4.2.4"
7
15
  end
data/Gemfile.lock CHANGED
@@ -1,117 +1,144 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_locale_detection (2.0.0.pre4)
5
- http_accept_language (~> 1.0.2)
4
+ rails_locale_detection (2.0.0)
5
+ http_accept_language (~> 2.0.5)
6
6
  rails (>= 3.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.13)
12
- actionpack (= 3.2.13)
13
- mail (~> 2.5.3)
14
- actionpack (3.2.13)
15
- activemodel (= 3.2.13)
16
- activesupport (= 3.2.13)
17
- builder (~> 3.0.0)
11
+ actionmailer (4.2.4)
12
+ actionpack (= 4.2.4)
13
+ actionview (= 4.2.4)
14
+ activejob (= 4.2.4)
15
+ 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)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.4)
25
+ activesupport (= 4.2.4)
26
+ builder (~> 3.1)
18
27
  erubis (~> 2.7.0)
19
- journey (~> 1.0.4)
20
- rack (~> 1.4.5)
21
- rack-cache (~> 1.2)
22
- rack-test (~> 0.6.1)
23
- sprockets (~> 2.2.1)
24
- activemodel (3.2.13)
25
- activesupport (= 3.2.13)
26
- builder (~> 3.0.0)
27
- activerecord (3.2.13)
28
- activemodel (= 3.2.13)
29
- activesupport (= 3.2.13)
30
- arel (~> 3.0.2)
31
- tzinfo (~> 0.3.29)
32
- activeresource (3.2.13)
33
- activemodel (= 3.2.13)
34
- activesupport (= 3.2.13)
35
- activesupport (3.2.13)
36
- i18n (= 0.6.1)
37
- multi_json (~> 1.0)
38
- appraisal (0.5.2)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ 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)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.1.0)
39
47
  bundler
40
48
  rake
41
- arel (3.0.2)
42
- builder (3.0.4)
43
- diff-lcs (1.2.1)
49
+ thor (>= 0.14.0)
50
+ arel (6.0.3)
51
+ builder (3.2.2)
52
+ diff-lcs (1.2.5)
44
53
  erubis (2.7.0)
45
- gem-release (0.5.3)
46
- hike (1.2.1)
47
- http_accept_language (1.0.2)
48
- i18n (0.6.1)
49
- journey (1.0.4)
50
- json (1.7.7)
51
- mail (2.5.4)
52
- mime-types (~> 1.16)
53
- treetop (~> 1.4.8)
54
- mime-types (1.23)
55
- multi_json (1.7.2)
56
- polyglot (0.3.3)
57
- rack (1.4.5)
58
- rack-cache (1.2)
59
- rack (>= 0.4)
60
- rack-ssl (1.3.3)
61
- rack
62
- rack-test (0.6.2)
54
+ gem-release (0.5.5)
55
+ globalid (0.3.6)
56
+ activesupport (>= 4.1.0)
57
+ http_accept_language (2.0.5)
58
+ i18n (0.7.0)
59
+ json (1.8.3)
60
+ loofah (2.0.3)
61
+ 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)
71
+ rack-test (0.6.3)
63
72
  rack (>= 1.0)
64
- rails (3.2.13)
65
- actionmailer (= 3.2.13)
66
- actionpack (= 3.2.13)
67
- activerecord (= 3.2.13)
68
- activeresource (= 3.2.13)
69
- activesupport (= 3.2.13)
70
- bundler (~> 1.0)
71
- railties (= 3.2.13)
72
- railties (3.2.13)
73
- actionpack (= 3.2.13)
74
- activesupport (= 3.2.13)
75
- rack-ssl (~> 1.3.2)
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
+ 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)
88
+ nokogiri (~> 1.6.0)
89
+ rails-deprecated_sanitizer (>= 1.0.1)
90
+ rails-html-sanitizer (1.0.2)
91
+ loofah (~> 2.0)
92
+ railties (4.2.4)
93
+ actionpack (= 4.2.4)
94
+ activesupport (= 4.2.4)
76
95
  rake (>= 0.8.7)
77
- rdoc (~> 3.4)
78
- thor (>= 0.14.6, < 2.0)
96
+ thor (>= 0.18.1, < 2.0)
79
97
  rake (10.0.4)
80
- rdoc (3.12.2)
81
- json (~> 1.4)
82
- rspec-core (2.13.1)
83
- rspec-expectations (2.13.0)
84
- diff-lcs (>= 1.1.3, < 2.0)
85
- rspec-mocks (2.13.0)
86
- rspec-rails (2.13.0)
98
+ rspec-core (3.3.2)
99
+ rspec-support (~> 3.3.0)
100
+ rspec-expectations (3.3.1)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.3.0)
103
+ rspec-mocks (3.3.2)
104
+ 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)
87
118
  actionpack (>= 3.0)
88
119
  activesupport (>= 3.0)
89
- railties (>= 3.0)
90
- rspec-core (~> 2.13.0)
91
- rspec-expectations (~> 2.13.0)
92
- rspec-mocks (~> 2.13.0)
93
- sprockets (2.2.2)
94
- hike (~> 1.2)
95
- multi_json (~> 1.0)
96
- rack (~> 1.0)
97
- tilt (~> 1.1, != 1.3.0)
98
- thor (0.18.1)
99
- tilt (1.3.6)
100
- timecop (0.6.1)
101
- treetop (1.4.14)
102
- polyglot
103
- polyglot (>= 0.3.1)
104
- tzinfo (0.3.37)
120
+ sprockets (>= 2.8, < 4.0)
121
+ test-unit (3.1.5)
122
+ power_assert
123
+ thor (0.19.1)
124
+ thread_safe (0.3.5)
125
+ timecop (0.6.3)
126
+ tzinfo (1.2.2)
127
+ thread_safe (~> 0.1)
105
128
 
106
129
  PLATFORMS
107
130
  ruby
108
131
 
109
132
  DEPENDENCIES
110
- appraisal (~> 0.5.2)
111
- bundler (~> 1.3.4)
133
+ appraisal (~> 2.1.0)
134
+ bundler (~> 1.10.6)
112
135
  gem-release (~> 0.5.3)
113
- i18n (~> 0.6.1)
136
+ i18n (~> 0.7.0)
114
137
  rails_locale_detection!
115
138
  rake (~> 10.0.4)
116
- rspec-rails (~> 2.13.0)
139
+ rspec-rails (~> 3.0)
140
+ test-unit (~> 3.0)
117
141
  timecop (~> 0.6.1)
142
+
143
+ BUNDLED WITH
144
+ 1.10.6
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "4.0.0"
5
+ gem "rails", "3.2.22"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "4.0.13"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "4.1.13"
6
+
7
+ gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "3.2.14"
5
+ gem "rails", "4.2.4"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -14,7 +14,7 @@ module RailsLocaleDetection
14
14
  end
15
15
 
16
16
  def locale_from_request
17
- validate_locale(request.preferred_language_from(available_locales))
17
+ validate_locale(http_accept_language.preferred_language_from(available_locales))
18
18
  end
19
19
 
20
20
  def locale_from_user
@@ -40,6 +40,6 @@ module RailsLocaleDetection
40
40
  # returns true if the default url option should be set for this request
41
41
  def set_default_url_option_for_request?
42
42
  RailsLocaleDetection.set_default_url_option === true || RailsLocaleDetection.set_default_url_option == :always || RailsLocaleDetection.set_default_url_option == :explicitly && params[locale_key].present?
43
- end
43
+ end
44
44
  end
45
- end
45
+ end
@@ -2,23 +2,23 @@ module RailsLocaleDetection
2
2
  class LocaleDetector
3
3
  include DetectionMethods
4
4
  include LocaleAccessors
5
-
5
+
6
6
  attr_reader :controller
7
-
8
- delegate :params, :request, :default_url_options, :user_locale, :to => :controller
9
-
7
+
8
+ delegate :params, :request, :default_url_options, :user_locale, :http_accept_language, :to => :controller
9
+
10
10
  def initialize(controller = nil)
11
11
  @controller = controller
12
12
  end
13
-
13
+
14
14
  def cookies
15
15
  request.cookie_jar
16
16
  end
17
-
17
+
18
18
  def locale_key
19
19
  RailsLocaleDetection.locale_key
20
20
  end
21
-
21
+
22
22
  def self.before(controller)
23
23
  new(controller).set_locale
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module RailsLocaleDetection
2
- VERSION = "2.0.0.pre4"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -12,20 +12,21 @@ Gem::Specification.new do |gem|
12
12
  gem.summary = "Locale setting for rails project"
13
13
  gem.homepage = "https://github.com/mateomurphy/rails_locale_detection"
14
14
  gem.license = 'MIT'
15
-
15
+
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ['lib']
20
-
21
- gem.add_dependency('http_accept_language', '~> 1.0.2')
22
- gem.add_dependency('rails', '>= 3.2.0')
23
-
24
- gem.add_development_dependency('appraisal', '~> 0.5.2')
25
- gem.add_development_dependency('bundler', '~> 1.3.4')
26
- gem.add_development_dependency('i18n', '~> 0.6.1')
27
- gem.add_development_dependency('gem-release', '~> 0.5.3')
28
- gem.add_development_dependency('rake', '~> 10.0.4')
29
- gem.add_development_dependency('rspec-rails', '~> 2.13.0')
20
+
21
+ gem.add_dependency('http_accept_language', '~> 2.0.5')
22
+ gem.add_dependency('rails', '>= 3.2.0')
23
+
24
+ gem.add_development_dependency('appraisal', '~> 2.1.0')
25
+ gem.add_development_dependency('bundler', '~> 1.10.6')
26
+ gem.add_development_dependency('i18n', '~> 0.7.0')
27
+ gem.add_development_dependency('gem-release', '~> 0.5.3')
28
+ gem.add_development_dependency('rake', '~> 10.0.4')
29
+ gem.add_development_dependency('rspec-rails', '~> 3.0')
30
30
  gem.add_development_dependency('timecop', '~> 0.6.1')
31
+ gem.add_development_dependency('test-unit', '~> 3.0')
31
32
  end
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CallbackTestsController do
4
-
3
+ describe CallbackTestsController, type: :controller do
4
+
5
5
  it "should automatically include the callback" do
6
- subject.class.ancestors.should include(RailsLocaleDetection::ControllerMethods)
6
+ expect(subject.class.ancestors).to include(RailsLocaleDetection::ControllerMethods)
7
7
  end
8
-
8
+
9
9
  it "should correctly detect the user locale" do
10
10
  get :show
11
-
12
- response.body.should eq('fr')
11
+
12
+ expect(response.body).to eq('fr')
13
13
  end
14
-
14
+
15
15
  end