country_select 3.1.0 → 5.0.1

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.
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Rails – Country Select
2
- [![Build Status](https://travis-ci.org/stefanpenner/country_select.svg)](https://travis-ci.org/stefanpenner/country_select)
2
+ [![Build Status](https://travis-ci.org/stefanpenner/country_select.svg?branch=master)](https://travis-ci.org/stefanpenner/country_select)
3
3
 
4
4
  Provides a simple helper to get an HTML select list of countries using the
5
5
  [ISO 3166-1 standard](https://en.wikipedia.org/wiki/ISO_3166-1).
@@ -26,7 +26,7 @@ gem install country_select
26
26
  Or put the following in your Gemfile
27
27
 
28
28
  ```ruby
29
- gem 'country_select'
29
+ gem 'country_select', '~> 4.0'
30
30
  ```
31
31
 
32
32
  If you don't want to require `sort_alphabetical` (it depends on `unicode_utils` which is known to use lots of memory) you can opt out of using it as follows:
@@ -75,6 +75,11 @@ Pre-selecting a particular country:
75
75
  country_select("user", "country", selected: "GB")
76
76
  ```
77
77
 
78
+ Changing the divider when priority_countries is active.
79
+ ```ruby
80
+ country_select("user", "country", priority_countries: ["AR", "US"], priority_countries_divider: "~~~~~~")
81
+ ```
82
+
78
83
  Using existing `select` options:
79
84
  ```ruby
80
85
  country_select("user", "country", include_blank: true)
@@ -93,13 +98,28 @@ You can define a custom formatter which will receive an
93
98
  [`ISO3166::Country`](https://github.com/hexorx/countries/blob/master/lib/countries/country.rb)
94
99
  ```ruby
95
100
  # config/initializers/country_select.rb
101
+
102
+ # Return a string to customize the text in the <option> tag, `value` attribute will remain unchanged
96
103
  CountrySelect::FORMATS[:with_alpha2] = lambda do |country|
97
104
  "#{country.name} (#{country.alpha2})"
98
105
  end
106
+
107
+ # Return an array to customize <option> text, `value` and other HTML attributes
108
+ CountrySelect::FORMATS[:with_data_attrs] = lambda do |country|
109
+ [
110
+ country.name,
111
+ country.alpha2,
112
+ {
113
+ 'data-country-code' => country.country_code,
114
+ 'data-alpha3' => country.alpha3
115
+ }
116
+ ]
117
+ end
99
118
  ```
100
119
 
101
120
  ```ruby
102
121
  country_select("user", "country", format: :with_alpha2)
122
+ country_select("user", "country", format: :with_data_attrs)
103
123
  ```
104
124
 
105
125
  ### ISO 3166-1 alpha-2 codes
@@ -173,7 +193,7 @@ changing the dependencies in the gemspec.
173
193
  ```shell
174
194
  for i in gemfiles/*.gemfile
175
195
  do
176
- BUNDLE_GEMFILE=$i bundle install --no-deployment
196
+ BUNDLE_GEMFILE=$i bundle install --local
177
197
  done
178
198
  ```
179
199
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'rake'
3
5
  require 'bundler/gem_tasks'
@@ -7,4 +9,4 @@ require 'wwtd/tasks'
7
9
  require 'rspec/core/rake_task'
8
10
  RSpec::Core::RakeTask.new(:spec)
9
11
 
10
- task default: "wwtd:local"
12
+ task default: 'spec'
@@ -10,23 +10,21 @@ Gem::Specification.new do |s|
10
10
  s.email = ['stefan.penner@gmail.com']
11
11
  s.homepage = 'https://github.com/stefanpenner/country_select'
12
12
  s.summary = %q{Country Select Plugin}
13
- s.description = %q{Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it will still offend some users.}
14
-
15
- s.rubyforge_project = 'country_select'
13
+ s.description = %q{Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it will still offend some users.}
16
14
 
17
15
  s.files = `git ls-files`.split("\n")
18
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
18
  s.require_paths = ['lib']
21
19
 
22
- s.required_ruby_version = '>= 2'
20
+ s.required_ruby_version = '>= 2.5'
23
21
 
24
- s.add_development_dependency 'actionpack', '~> 3'
22
+ s.add_development_dependency 'actionpack', '~> 6.1'
25
23
  s.add_development_dependency 'pry', '~> 0'
26
- s.add_development_dependency 'rake'
24
+ s.add_development_dependency 'rake', '~> 13'
27
25
  s.add_development_dependency 'rspec', '~> 3'
28
- s.add_development_dependency 'wwtd'
26
+ s.add_development_dependency 'wwtd', '~> 1'
29
27
 
30
- s.add_dependency 'countries', '~> 2.0'
31
- s.add_dependency 'sort_alphabetical', '~> 1.0'
28
+ s.add_dependency 'countries', '~> 3.0'
29
+ s.add_dependency 'sort_alphabetical', '~> 1.1'
32
30
  end
@@ -7,9 +7,3 @@ git "https://github.com/rails/rails.git" do
7
7
  gem "actionview"
8
8
  gem "activesupport"
9
9
  end
10
-
11
- platforms :rbx do
12
- gem "racc"
13
- gem "rubysl", "~> 2.0"
14
- gem "psych"
15
- end
@@ -1,297 +1,93 @@
1
1
  GIT
2
2
  remote: https://github.com/rails/rails.git
3
- revision: f4d52eee07954c510a8318176d6d11100afabf7b
3
+ revision: 14f35cde18de77cd7ab5d6f17d83fa8bc92ba383
4
4
  specs:
5
- actionpack (5.2.0.alpha)
6
- actionview (= 5.2.0.alpha)
7
- activesupport (= 5.2.0.alpha)
8
- rack (~> 2.0)
9
- rack-test (~> 0.6.3)
5
+ actionpack (7.0.0.alpha)
6
+ actionview (= 7.0.0.alpha)
7
+ activesupport (= 7.0.0.alpha)
8
+ rack (~> 2.0, >= 2.0.9)
9
+ rack-test (>= 0.6.3)
10
10
  rails-dom-testing (~> 2.0)
11
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
12
- actionview (5.2.0.alpha)
13
- activesupport (= 5.2.0.alpha)
11
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
12
+ actionview (7.0.0.alpha)
13
+ activesupport (= 7.0.0.alpha)
14
14
  builder (~> 3.1)
15
15
  erubi (~> 1.4)
16
16
  rails-dom-testing (~> 2.0)
17
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
18
- activesupport (5.2.0.alpha)
17
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
18
+ activesupport (7.0.0.alpha)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
- i18n (~> 0.7)
21
- minitest (~> 5.1)
22
- tzinfo (~> 1.1)
20
+ i18n (>= 1.6, < 2)
21
+ minitest (>= 5.1)
22
+ tzinfo (~> 2.0)
23
+ zeitwerk (~> 2.3)
23
24
 
24
25
  PATH
25
26
  remote: ..
26
27
  specs:
27
- country_select (3.0.0)
28
- countries (~> 2.0)
29
- sort_alphabetical (~> 1.0)
28
+ country_select (5.0.1)
29
+ countries (~> 3.0)
30
+ sort_alphabetical (~> 1.1)
30
31
 
31
32
  GEM
32
33
  remote: https://rubygems.org/
33
34
  specs:
34
- builder (3.2.3)
35
- coderay (1.1.1)
36
- concurrent-ruby (1.0.5)
37
- countries (2.0.8)
38
- i18n_data (~> 0.7.0)
39
- money (~> 6.7)
35
+ builder (3.2.4)
36
+ coderay (1.1.3)
37
+ concurrent-ruby (1.1.8)
38
+ countries (3.0.1)
39
+ i18n_data (~> 0.10.0)
40
40
  sixarm_ruby_unaccent (~> 1.1)
41
41
  unicode_utils (~> 1.4)
42
- diff-lcs (1.3)
43
- erubi (1.6.1)
44
- ffi2-generators (0.1.1)
45
- i18n (0.8.6)
46
- i18n_data (0.7.0)
47
- loofah (2.0.3)
42
+ crass (1.0.6)
43
+ diff-lcs (1.4.4)
44
+ erubi (1.10.0)
45
+ i18n (1.8.9)
46
+ concurrent-ruby (~> 1.0)
47
+ i18n_data (0.10.0)
48
+ loofah (2.9.0)
49
+ crass (~> 1.0.2)
48
50
  nokogiri (>= 1.5.9)
49
- method_source (0.8.2)
50
- mini_portile2 (2.2.0)
51
- minitest (5.10.2)
52
- money (6.9.0)
53
- i18n (>= 0.6.4, < 0.9)
54
- nokogiri (1.8.0)
55
- mini_portile2 (~> 2.2.0)
56
- pry (0.10.4)
57
- coderay (~> 1.1.0)
58
- method_source (~> 0.8.1)
59
- slop (~> 3.4)
60
- psych (2.2.4)
61
- racc (1.4.14)
62
- rack (2.0.3)
63
- rack-test (0.6.3)
64
- rack (>= 1.0)
51
+ method_source (1.0.0)
52
+ mini_portile2 (2.5.0)
53
+ minitest (5.14.4)
54
+ nokogiri (1.11.1)
55
+ mini_portile2 (~> 2.5.0)
56
+ racc (~> 1.4)
57
+ pry (0.14.0)
58
+ coderay (~> 1.1)
59
+ method_source (~> 1.0)
60
+ racc (1.5.2)
61
+ rack (2.2.3)
62
+ rack-test (1.1.0)
63
+ rack (>= 1.0, < 3)
65
64
  rails-dom-testing (2.0.3)
66
65
  activesupport (>= 4.2.0)
67
66
  nokogiri (>= 1.6)
68
- rails-html-sanitizer (1.0.3)
69
- loofah (~> 2.0)
70
- rake (12.0.0)
71
- rspec (3.6.0)
72
- rspec-core (~> 3.6.0)
73
- rspec-expectations (~> 3.6.0)
74
- rspec-mocks (~> 3.6.0)
75
- rspec-core (3.6.0)
76
- rspec-support (~> 3.6.0)
77
- rspec-expectations (3.6.0)
67
+ rails-html-sanitizer (1.3.0)
68
+ loofah (~> 2.3)
69
+ rake (13.0.3)
70
+ rspec (3.10.0)
71
+ rspec-core (~> 3.10.0)
72
+ rspec-expectations (~> 3.10.0)
73
+ rspec-mocks (~> 3.10.0)
74
+ rspec-core (3.10.1)
75
+ rspec-support (~> 3.10.0)
76
+ rspec-expectations (3.10.1)
78
77
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.6.0)
80
- rspec-mocks (3.6.0)
78
+ rspec-support (~> 3.10.0)
79
+ rspec-mocks (3.10.2)
81
80
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.6.0)
83
- rspec-support (3.6.0)
84
- rubysl (2.2.0)
85
- rubysl-abbrev (~> 2.0)
86
- rubysl-base64 (~> 2.0)
87
- rubysl-benchmark (~> 2.0)
88
- rubysl-bigdecimal (~> 2.0)
89
- rubysl-cgi (~> 2.0)
90
- rubysl-cgi-session (~> 2.0)
91
- rubysl-cmath (~> 2.0)
92
- rubysl-complex (~> 2.0)
93
- rubysl-continuation (~> 2.0)
94
- rubysl-coverage (~> 2.0)
95
- rubysl-csv (~> 2.0)
96
- rubysl-curses (~> 2.0)
97
- rubysl-date (~> 2.0)
98
- rubysl-delegate (~> 2.0)
99
- rubysl-digest (~> 2.0)
100
- rubysl-drb (~> 2.0)
101
- rubysl-e2mmap (~> 2.0)
102
- rubysl-english (~> 2.0)
103
- rubysl-enumerator (~> 2.0)
104
- rubysl-erb (~> 2.0)
105
- rubysl-etc (~> 2.0)
106
- rubysl-expect (~> 2.0)
107
- rubysl-fcntl (~> 2.0)
108
- rubysl-fiber (~> 2.0)
109
- rubysl-fileutils (~> 2.0)
110
- rubysl-find (~> 2.0)
111
- rubysl-forwardable (~> 2.0)
112
- rubysl-getoptlong (~> 2.0)
113
- rubysl-gserver (~> 2.0)
114
- rubysl-io-console (~> 2.0)
115
- rubysl-io-nonblock (~> 2.0)
116
- rubysl-io-wait (~> 2.0)
117
- rubysl-ipaddr (~> 2.0)
118
- rubysl-irb (~> 2.1)
119
- rubysl-logger (~> 2.0)
120
- rubysl-mathn (~> 2.0)
121
- rubysl-matrix (~> 2.0)
122
- rubysl-mkmf (~> 2.0)
123
- rubysl-monitor (~> 2.0)
124
- rubysl-mutex_m (~> 2.0)
125
- rubysl-net-ftp (~> 2.0)
126
- rubysl-net-http (~> 2.0)
127
- rubysl-net-imap (~> 2.0)
128
- rubysl-net-pop (~> 2.0)
129
- rubysl-net-protocol (~> 2.0)
130
- rubysl-net-smtp (~> 2.0)
131
- rubysl-net-telnet (~> 2.0)
132
- rubysl-nkf (~> 2.0)
133
- rubysl-observer (~> 2.0)
134
- rubysl-open-uri (~> 2.0)
135
- rubysl-open3 (~> 2.0)
136
- rubysl-openssl (~> 2.0)
137
- rubysl-optparse (~> 2.0)
138
- rubysl-ostruct (~> 2.0)
139
- rubysl-pathname (~> 2.0)
140
- rubysl-prettyprint (~> 2.0)
141
- rubysl-prime (~> 2.0)
142
- rubysl-profile (~> 2.0)
143
- rubysl-profiler (~> 2.0)
144
- rubysl-pstore (~> 2.0)
145
- rubysl-pty (~> 2.0)
146
- rubysl-rational (~> 2.0)
147
- rubysl-resolv (~> 2.0)
148
- rubysl-rexml (~> 2.0)
149
- rubysl-rinda (~> 2.0)
150
- rubysl-rss (~> 2.0)
151
- rubysl-scanf (~> 2.0)
152
- rubysl-securerandom (~> 2.0)
153
- rubysl-set (~> 2.0)
154
- rubysl-shellwords (~> 2.0)
155
- rubysl-singleton (~> 2.0)
156
- rubysl-socket (~> 2.0)
157
- rubysl-stringio (~> 2.0)
158
- rubysl-strscan (~> 2.0)
159
- rubysl-sync (~> 2.0)
160
- rubysl-syslog (~> 2.0)
161
- rubysl-tempfile (~> 2.0)
162
- rubysl-thread (~> 2.0)
163
- rubysl-thwait (~> 2.0)
164
- rubysl-time (~> 2.0)
165
- rubysl-timeout (~> 2.0)
166
- rubysl-tmpdir (~> 2.0)
167
- rubysl-tsort (~> 2.0)
168
- rubysl-un (~> 2.0)
169
- rubysl-unicode_normalize (~> 2.0)
170
- rubysl-uri (~> 2.0)
171
- rubysl-weakref (~> 2.0)
172
- rubysl-webrick (~> 2.0)
173
- rubysl-xmlrpc (~> 2.0)
174
- rubysl-yaml (~> 2.0)
175
- rubysl-zlib (~> 2.0)
176
- rubysl-abbrev (2.0.4)
177
- rubysl-base64 (2.0.0)
178
- rubysl-benchmark (2.0.1)
179
- rubysl-bigdecimal (2.0.2)
180
- rubysl-cgi (2.0.1)
181
- rubysl-cgi-session (2.1.0)
182
- rubysl-cmath (2.0.0)
183
- rubysl-complex (2.0.0)
184
- rubysl-continuation (2.0.0)
185
- rubysl-coverage (2.1)
186
- rubysl-csv (2.0.2)
187
- rubysl-english (~> 2.0)
188
- rubysl-curses (2.0.1)
189
- rubysl-date (2.0.9)
190
- rubysl-delegate (2.0.1)
191
- rubysl-digest (2.0.8)
192
- rubysl-drb (2.0.1)
193
- rubysl-e2mmap (2.0.0)
194
- rubysl-english (2.0.0)
195
- rubysl-enumerator (2.0.0)
196
- rubysl-erb (2.0.2)
197
- rubysl-etc (2.0.3)
198
- ffi2-generators (~> 0.1)
199
- rubysl-expect (2.0.0)
200
- rubysl-fcntl (2.0.4)
201
- ffi2-generators (~> 0.1)
202
- rubysl-fiber (2.0.0)
203
- rubysl-fileutils (2.0.3)
204
- rubysl-find (2.0.1)
205
- rubysl-forwardable (2.0.1)
206
- rubysl-getoptlong (2.0.0)
207
- rubysl-gserver (2.0.0)
208
- rubysl-socket (~> 2.0)
209
- rubysl-thread (~> 2.0)
210
- rubysl-io-console (2.0.0)
211
- rubysl-io-nonblock (2.0.0)
212
- rubysl-io-wait (2.0.0)
213
- rubysl-ipaddr (2.0.0)
214
- rubysl-irb (2.1.1)
215
- rubysl-e2mmap (~> 2.0)
216
- rubysl-mathn (~> 2.0)
217
- rubysl-thread (~> 2.0)
218
- rubysl-logger (2.1.0)
219
- rubysl-mathn (2.0.0)
220
- rubysl-matrix (2.1.0)
221
- rubysl-e2mmap (~> 2.0)
222
- rubysl-mkmf (2.1)
223
- rubysl-fileutils (~> 2.0)
224
- rubysl-shellwords (~> 2.0)
225
- rubysl-monitor (2.0.0)
226
- rubysl-mutex_m (2.0.0)
227
- rubysl-net-ftp (2.0.1)
228
- rubysl-net-http (2.0.4)
229
- rubysl-cgi (~> 2.0)
230
- rubysl-erb (~> 2.0)
231
- rubysl-singleton (~> 2.0)
232
- rubysl-net-imap (2.0.1)
233
- rubysl-net-pop (2.0.1)
234
- rubysl-net-protocol (2.0.1)
235
- rubysl-net-smtp (2.0.1)
236
- rubysl-net-telnet (2.0.0)
237
- rubysl-nkf (2.0.1)
238
- rubysl-observer (2.0.0)
239
- rubysl-open-uri (2.0.0)
240
- rubysl-open3 (2.0.0)
241
- rubysl-openssl (2.9)
242
- rubysl-optparse (2.0.1)
243
- rubysl-shellwords (~> 2.0)
244
- rubysl-ostruct (2.1.0)
245
- rubysl-pathname (2.3)
246
- rubysl-prettyprint (2.0.3)
247
- rubysl-prime (2.0.1)
248
- rubysl-profile (2.0.0)
249
- rubysl-profiler (2.1)
250
- rubysl-pstore (2.0.0)
251
- rubysl-pty (2.0.3)
252
- rubysl-rational (2.0.1)
253
- rubysl-resolv (2.1.2)
254
- rubysl-rexml (2.0.4)
255
- rubysl-rinda (2.0.1)
256
- rubysl-rss (2.0.0)
257
- rubysl-scanf (2.0.0)
258
- rubysl-securerandom (2.0.0)
259
- rubysl-set (2.0.1)
260
- rubysl-shellwords (2.0.0)
261
- rubysl-singleton (2.0.0)
262
- rubysl-socket (2.2.1)
263
- rubysl-fcntl (~> 2.0)
264
- rubysl-stringio (2.1.0)
265
- rubysl-strscan (2.0.0)
266
- rubysl-sync (2.0.0)
267
- rubysl-syslog (2.1.0)
268
- ffi2-generators (~> 0.1)
269
- rubysl-tempfile (2.0.1)
270
- rubysl-thread (2.0.3)
271
- rubysl-thwait (2.0.0)
272
- rubysl-time (2.0.3)
273
- rubysl-timeout (2.0.0)
274
- rubysl-tmpdir (2.0.1)
275
- rubysl-tsort (2.0.1)
276
- rubysl-un (2.0.0)
277
- rubysl-fileutils (~> 2.0)
278
- rubysl-optparse (~> 2.0)
279
- rubysl-unicode_normalize (2.0)
280
- rubysl-uri (2.0.0)
281
- rubysl-weakref (2.0.0)
282
- rubysl-webrick (2.0.0)
283
- rubysl-xmlrpc (2.0.0)
284
- rubysl-yaml (2.1.0)
285
- rubysl-zlib (2.0.1)
286
- sixarm_ruby_unaccent (1.1.2)
287
- slop (3.6.0)
81
+ rspec-support (~> 3.10.0)
82
+ rspec-support (3.10.2)
83
+ sixarm_ruby_unaccent (1.2.0)
288
84
  sort_alphabetical (1.1.0)
289
85
  unicode_utils (>= 1.2.2)
290
- thread_safe (0.3.6)
291
- tzinfo (1.2.3)
292
- thread_safe (~> 0.1)
86
+ tzinfo (2.0.4)
87
+ concurrent-ruby (~> 1.0)
293
88
  unicode_utils (1.4.0)
294
- wwtd (1.3.0)
89
+ wwtd (1.4.1)
90
+ zeitwerk (2.4.2)
295
91
 
296
92
  PLATFORMS
297
93
  ruby
@@ -302,12 +98,9 @@ DEPENDENCIES
302
98
  activesupport!
303
99
  country_select!
304
100
  pry (~> 0)
305
- psych
306
- racc
307
- rake
101
+ rake (~> 13)
308
102
  rspec (~> 3)
309
- rubysl (~> 2.0)
310
- wwtd
103
+ wwtd (~> 1)
311
104
 
312
105
  BUNDLED WITH
313
- 1.15.1
106
+ 2.2.13