country_select 8.0.0 → 11.0.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/.codeclimate.yml +61 -0
- data/.github/workflows/codeql-analysis.yml +4 -4
- data/.github/workflows/test.yml +37 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +34 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +113 -53
- data/README.md +5 -16
- data/Rakefile +11 -14
- data/country_select.gemspec +14 -11
- data/gemfiles/actionpack-7.1.gemfile +9 -0
- data/gemfiles/actionpack-7.1.gemfile.lock +173 -0
- data/gemfiles/actionpack-7.2.gemfile +9 -0
- data/gemfiles/actionpack-7.2.gemfile.lock +181 -0
- data/gemfiles/actionpack-8.0.gemfile +9 -0
- data/gemfiles/actionpack-8.0.gemfile.lock +174 -0
- data/lib/country_select/country_select_helper.rb +5 -11
- data/lib/country_select/defaults.rb +2 -1
- data/lib/country_select/formats.rb +2 -0
- data/lib/country_select/tag_helper.rb +61 -51
- data/lib/country_select/version.rb +3 -1
- data/lib/country_select.rb +1 -1
- data/spec/country_select_spec.rb +106 -144
- data/spec/spec_helper.rb +7 -3
- metadata +41 -38
- data/.github/workflows/build.yml +0 -25
- data/gemfiles/actionpack-5.2.gemfile +0 -6
- data/gemfiles/actionpack-5.2.gemfile.lock +0 -98
- data/gemfiles/actionpack-6.0.gemfile +0 -6
- data/gemfiles/actionpack-6.0.gemfile.lock +0 -100
- data/gemfiles/actionpack-6.1.gemfile +0 -6
- data/gemfiles/actionpack-6.1.gemfile.lock +0 -99
- data/gemfiles/actionpack-7.0.gemfile +0 -6
- data/gemfiles/actionpack-7.0.gemfile.lock +0 -99
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a466635fed31b8e5cec2aa2e027b660fbe29192ea904148b0868d9e02de0c32
|
|
4
|
+
data.tar.gz: ec49cffffa6bfef5fbae3ce77534ef0d287d4dab4eb1657b26d51fd21be4873a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f4b1672b7fa38662430f15305ae861864152767b78fc1df8b88918c967f5f32c54ac7c29b813225b2d0476a0af19043b3ae3817742a069d4e9ac12ae4e3304b
|
|
7
|
+
data.tar.gz: 756db308e0954e380982a08c2df10d9b58437e537c4502ac51e79bdfad8ff41437713760d4da9865d2e65a995d6ad5030860428ba943801670e036c850103555
|
data/.codeclimate.yml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
version: "2"
|
|
2
|
+
checks:
|
|
3
|
+
argument-count:
|
|
4
|
+
enabled: true
|
|
5
|
+
config:
|
|
6
|
+
threshold: 4
|
|
7
|
+
complex-logic:
|
|
8
|
+
enabled: true
|
|
9
|
+
config:
|
|
10
|
+
threshold: 4
|
|
11
|
+
file-lines:
|
|
12
|
+
enabled: true
|
|
13
|
+
config:
|
|
14
|
+
threshold: 250
|
|
15
|
+
method-complexity:
|
|
16
|
+
enabled: true
|
|
17
|
+
config:
|
|
18
|
+
threshold: 5
|
|
19
|
+
method-count:
|
|
20
|
+
enabled: true
|
|
21
|
+
config:
|
|
22
|
+
threshold: 20
|
|
23
|
+
method-lines:
|
|
24
|
+
enabled: true
|
|
25
|
+
config:
|
|
26
|
+
threshold: 25
|
|
27
|
+
nested-control-flow:
|
|
28
|
+
enabled: true
|
|
29
|
+
config:
|
|
30
|
+
threshold: 4
|
|
31
|
+
return-statements:
|
|
32
|
+
enabled: true
|
|
33
|
+
config:
|
|
34
|
+
threshold: 4
|
|
35
|
+
plugins:
|
|
36
|
+
rubocop:
|
|
37
|
+
enabled: true
|
|
38
|
+
channel: rubocop-1-48-1
|
|
39
|
+
reek:
|
|
40
|
+
enabled: true
|
|
41
|
+
checks:
|
|
42
|
+
IrresponsibleModule:
|
|
43
|
+
enabled: false
|
|
44
|
+
TooManyStatements:
|
|
45
|
+
max_statements: 7
|
|
46
|
+
flog:
|
|
47
|
+
enabled: true
|
|
48
|
+
bundler-audit:
|
|
49
|
+
enabled: true
|
|
50
|
+
exclude_patterns:
|
|
51
|
+
- "config/"
|
|
52
|
+
- "db/"
|
|
53
|
+
- "dist/"
|
|
54
|
+
- "features/"
|
|
55
|
+
- "**/node_modules/"
|
|
56
|
+
- "script/"
|
|
57
|
+
- "**/spec/"
|
|
58
|
+
- "**/test/"
|
|
59
|
+
- "**/tests/"
|
|
60
|
+
- "**/vendor/"
|
|
61
|
+
- "**/*.d.ts"
|
|
@@ -38,11 +38,11 @@ jobs:
|
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
40
|
- name: Checkout repository
|
|
41
|
-
uses: actions/checkout@
|
|
41
|
+
uses: actions/checkout@v4
|
|
42
42
|
|
|
43
43
|
# Initializes the CodeQL tools for scanning.
|
|
44
44
|
- name: Initialize CodeQL
|
|
45
|
-
uses: github/codeql-action/init@
|
|
45
|
+
uses: github/codeql-action/init@v2
|
|
46
46
|
with:
|
|
47
47
|
languages: ${{ matrix.language }}
|
|
48
48
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -53,7 +53,7 @@ jobs:
|
|
|
53
53
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
54
54
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
55
55
|
- name: Autobuild
|
|
56
|
-
uses: github/codeql-action/autobuild@
|
|
56
|
+
uses: github/codeql-action/autobuild@v2
|
|
57
57
|
|
|
58
58
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
59
59
|
# 📚 https://git.io/JvXDl
|
|
@@ -67,4 +67,4 @@ jobs:
|
|
|
67
67
|
# make release
|
|
68
68
|
|
|
69
69
|
- name: Perform CodeQL Analysis
|
|
70
|
-
uses: github/codeql-action/analyze@
|
|
70
|
+
uses: github/codeql-action/analyze@v2
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths-ignore:
|
|
6
|
+
- 'README.md'
|
|
7
|
+
- 'CHANGELOG.md'
|
|
8
|
+
push:
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- 'README.md'
|
|
11
|
+
- 'CHANGELOG.md'
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
ruby: [3.2, 3.3, 3.4]
|
|
20
|
+
gemfile: [7.1, 7.2, '8.0']
|
|
21
|
+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
|
22
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/actionpack-${{ matrix.gemfile }}.gemfile
|
|
23
|
+
CC_TEST_REPORTER_ID: 0d09e6611c01dedd75511b1c60f62329d01729289e06375cfe67cefe67013d9f
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
27
|
+
uses: ruby/setup-ruby@v1
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
|
30
|
+
bundler-cache: true
|
|
31
|
+
cache-version: 10
|
|
32
|
+
- name: Run tests
|
|
33
|
+
|
|
34
|
+
run: bundle exec rake
|
|
35
|
+
- name: Publish code coverage
|
|
36
|
+
uses: paambaati/codeclimate-action@v5.0.0
|
|
37
|
+
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
NewCops: enable
|
|
3
|
+
TargetRubyVersion: 3.1
|
|
4
|
+
|
|
5
|
+
Metrics/MethodLength:
|
|
6
|
+
Enabled: false
|
|
7
|
+
|
|
8
|
+
Layout/LineLength:
|
|
9
|
+
Max: 120
|
|
10
|
+
AllowedPatterns: ['^ *# ']
|
|
11
|
+
|
|
12
|
+
Style/Documentation:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
Bundler/OrderedGems:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Naming/FileName:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'gemfiles/*'
|
|
21
|
+
|
|
22
|
+
Metrics/BlockLength:
|
|
23
|
+
Exclude:
|
|
24
|
+
- 'spec/**/*'
|
|
25
|
+
|
|
26
|
+
Style/MutableConstant:
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'lib/country_select/defaults.rb'
|
|
29
|
+
- 'lib/country_select/formats.rb'
|
|
30
|
+
|
|
31
|
+
Style/MethodCallWithoutArgsParentheses:
|
|
32
|
+
Exclude:
|
|
33
|
+
- 'lib/country_select/tag_helper.rb'
|
|
34
|
+
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## 11.0.0 2025-05-31
|
|
2
|
+
|
|
3
|
+
* fix: Improve sorting for non-Latin country names by @kiyohara in https://github.com/countries/country_select/pull/230
|
|
4
|
+
* Drop support for Ruby 3.1, Rails 7.0 and countries gem 5.x. Allow countries gem 8.x by @pmor in https://github.com/countries/country_select/pull/232
|
|
5
|
+
* Use <hr> as divider by @ursm in https://github.com/countries/country_select/pull/229
|
|
6
|
+
|
|
7
|
+
## 10.0.1 2025-01-04
|
|
8
|
+
|
|
9
|
+
* Add Ruby 3.4 and Rails 8.0 to the test matrix and drop Rails 6.1 tests. by @pmor in https://github.com/countries/country_select/pull/228
|
|
10
|
+
|
|
11
|
+
## 10.0.0 2024-09-29
|
|
12
|
+
|
|
13
|
+
* Drop support for Ruby 3.0 (EOL 2024-04-23) (@pmor)
|
|
14
|
+
* Add Rails 7.2 to the test matrix (@pmor)
|
|
15
|
+
* Update countries gem to 7.0.0 (@pmor)
|
|
16
|
+
|
|
17
|
+
## 9.0.0 2024-02-17
|
|
18
|
+
|
|
19
|
+
* Drop support for Ruby 2.7, Rails 5.2 and 6.0 (@pmor)
|
|
20
|
+
* Remove support for deprecated 1.x syntax (@pmor)
|
|
21
|
+
|
|
22
|
+
## 8.0.3 2023-10-07
|
|
23
|
+
|
|
24
|
+
* Fix when country name is nil. (@zerobearing2)
|
|
25
|
+
|
|
26
|
+
## 8.0.2 2023-08-01
|
|
27
|
+
|
|
28
|
+
* Code cleanup (@pmor)
|
|
29
|
+
* Update CodeQL to V2 (@scudco)
|
|
30
|
+
* Adding support for Rails 7.1 after recent Form Options helper changes (@ron-shinall)
|
|
31
|
+
|
|
32
|
+
## 8.0.1 2023-01-03
|
|
33
|
+
|
|
34
|
+
* Update README.md by (@ron-shinall)
|
|
35
|
+
* Update installation instructions by (@henrik)
|
|
36
|
+
* Fix deprecated File.exists? on ruby 3.2.0 by (@JNajera212)
|
|
37
|
+
* Fix priority country sorting bug by (@pmor)
|
|
38
|
+
* Update countries gem to 5.3.0 (@pmor)
|
|
39
|
+
|
|
1
40
|
## 8.0.0 2022-06-30
|
|
2
41
|
|
|
3
42
|
* Update countries gem to 5.1.0 (@pmor)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,86 +1,146 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
country_select (
|
|
5
|
-
countries (
|
|
4
|
+
country_select (10.0.1)
|
|
5
|
+
countries (> 6.0, < 9.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actionpack (
|
|
11
|
-
actionview (=
|
|
12
|
-
activesupport (=
|
|
13
|
-
|
|
10
|
+
actionpack (8.0.2)
|
|
11
|
+
actionview (= 8.0.2)
|
|
12
|
+
activesupport (= 8.0.2)
|
|
13
|
+
nokogiri (>= 1.8.5)
|
|
14
|
+
rack (>= 2.2.4)
|
|
15
|
+
rack-session (>= 1.0.1)
|
|
14
16
|
rack-test (>= 0.6.3)
|
|
15
|
-
rails-dom-testing (~> 2.
|
|
16
|
-
rails-html-sanitizer (~> 1.
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
rails-dom-testing (~> 2.2)
|
|
18
|
+
rails-html-sanitizer (~> 1.6)
|
|
19
|
+
useragent (~> 0.16)
|
|
20
|
+
actionview (8.0.2)
|
|
21
|
+
activesupport (= 8.0.2)
|
|
19
22
|
builder (~> 3.1)
|
|
20
|
-
erubi (~> 1.
|
|
21
|
-
rails-dom-testing (~> 2.
|
|
22
|
-
rails-html-sanitizer (~> 1.
|
|
23
|
-
activesupport (
|
|
24
|
-
|
|
23
|
+
erubi (~> 1.11)
|
|
24
|
+
rails-dom-testing (~> 2.2)
|
|
25
|
+
rails-html-sanitizer (~> 1.6)
|
|
26
|
+
activesupport (8.0.2)
|
|
27
|
+
base64
|
|
28
|
+
benchmark (>= 0.3)
|
|
29
|
+
bigdecimal
|
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
31
|
+
connection_pool (>= 2.2.5)
|
|
32
|
+
drb
|
|
25
33
|
i18n (>= 1.6, < 2)
|
|
34
|
+
logger (>= 1.4.2)
|
|
26
35
|
minitest (>= 5.1)
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
securerandom (>= 0.3)
|
|
37
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
38
|
+
uri (>= 0.13.1)
|
|
39
|
+
base64 (0.3.0)
|
|
40
|
+
benchmark (0.4.1)
|
|
41
|
+
bigdecimal (3.2.1)
|
|
42
|
+
builder (3.3.0)
|
|
29
43
|
coderay (1.1.3)
|
|
30
|
-
concurrent-ruby (1.
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
concurrent-ruby (1.3.5)
|
|
45
|
+
connection_pool (2.5.3)
|
|
46
|
+
countries (8.0.0)
|
|
47
|
+
unaccent (~> 0.3)
|
|
33
48
|
crass (1.0.6)
|
|
34
|
-
diff-lcs (1.
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
diff-lcs (1.6.2)
|
|
50
|
+
docile (1.4.1)
|
|
51
|
+
drb (2.2.3)
|
|
52
|
+
erubi (1.13.1)
|
|
53
|
+
i18n (1.14.7)
|
|
37
54
|
concurrent-ruby (~> 1.0)
|
|
38
|
-
|
|
55
|
+
logger (1.7.0)
|
|
56
|
+
loofah (2.24.1)
|
|
39
57
|
crass (~> 1.0.2)
|
|
40
|
-
nokogiri (>= 1.
|
|
41
|
-
method_source (1.
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
nokogiri (>= 1.12.0)
|
|
59
|
+
method_source (1.1.0)
|
|
60
|
+
mini_portile2 (2.8.9)
|
|
61
|
+
minitest (5.25.5)
|
|
62
|
+
nokogiri (1.18.8)
|
|
63
|
+
mini_portile2 (~> 2.8.2)
|
|
44
64
|
racc (~> 1.4)
|
|
45
|
-
|
|
65
|
+
nokogiri (1.18.8-aarch64-linux-gnu)
|
|
66
|
+
racc (~> 1.4)
|
|
67
|
+
nokogiri (1.18.8-aarch64-linux-musl)
|
|
68
|
+
racc (~> 1.4)
|
|
69
|
+
nokogiri (1.18.8-arm-linux-gnu)
|
|
70
|
+
racc (~> 1.4)
|
|
71
|
+
nokogiri (1.18.8-arm-linux-musl)
|
|
72
|
+
racc (~> 1.4)
|
|
73
|
+
nokogiri (1.18.8-arm64-darwin)
|
|
74
|
+
racc (~> 1.4)
|
|
75
|
+
nokogiri (1.18.8-x86_64-darwin)
|
|
76
|
+
racc (~> 1.4)
|
|
77
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
|
78
|
+
racc (~> 1.4)
|
|
79
|
+
nokogiri (1.18.8-x86_64-linux-musl)
|
|
80
|
+
racc (~> 1.4)
|
|
81
|
+
pry (0.15.2)
|
|
46
82
|
coderay (~> 1.1)
|
|
47
83
|
method_source (~> 1.0)
|
|
48
|
-
racc (1.
|
|
49
|
-
rack (
|
|
50
|
-
rack-
|
|
84
|
+
racc (1.8.1)
|
|
85
|
+
rack (3.1.15)
|
|
86
|
+
rack-session (2.1.1)
|
|
87
|
+
base64 (>= 0.1.0)
|
|
88
|
+
rack (>= 3.0.0)
|
|
89
|
+
rack-test (2.2.0)
|
|
51
90
|
rack (>= 1.3)
|
|
52
|
-
rails-dom-testing (2.0
|
|
53
|
-
activesupport (>=
|
|
91
|
+
rails-dom-testing (2.3.0)
|
|
92
|
+
activesupport (>= 5.0.0)
|
|
93
|
+
minitest
|
|
54
94
|
nokogiri (>= 1.6)
|
|
55
|
-
rails-html-sanitizer (1.
|
|
56
|
-
loofah (~> 2.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
rspec-
|
|
61
|
-
rspec-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
95
|
+
rails-html-sanitizer (1.6.2)
|
|
96
|
+
loofah (~> 2.21)
|
|
97
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
98
|
+
rake (13.3.0)
|
|
99
|
+
rspec (3.13.1)
|
|
100
|
+
rspec-core (~> 3.13.0)
|
|
101
|
+
rspec-expectations (~> 3.13.0)
|
|
102
|
+
rspec-mocks (~> 3.13.0)
|
|
103
|
+
rspec-core (3.13.4)
|
|
104
|
+
rspec-support (~> 3.13.0)
|
|
105
|
+
rspec-expectations (3.13.5)
|
|
65
106
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
66
|
-
rspec-support (~> 3.
|
|
67
|
-
rspec-mocks (3.
|
|
107
|
+
rspec-support (~> 3.13.0)
|
|
108
|
+
rspec-mocks (3.13.5)
|
|
68
109
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
69
|
-
rspec-support (~> 3.
|
|
70
|
-
rspec-support (3.
|
|
71
|
-
|
|
72
|
-
|
|
110
|
+
rspec-support (~> 3.13.0)
|
|
111
|
+
rspec-support (3.13.4)
|
|
112
|
+
securerandom (0.4.1)
|
|
113
|
+
simplecov (0.22.0)
|
|
114
|
+
docile (~> 1.1)
|
|
115
|
+
simplecov-html (~> 0.11)
|
|
116
|
+
simplecov_json_formatter (~> 0.1)
|
|
117
|
+
simplecov-html (0.13.1)
|
|
118
|
+
simplecov_json_formatter (0.1.4)
|
|
119
|
+
tzinfo (2.0.6)
|
|
73
120
|
concurrent-ruby (~> 1.0)
|
|
121
|
+
unaccent (0.4.0)
|
|
122
|
+
uri (1.0.3)
|
|
123
|
+
useragent (0.16.11)
|
|
74
124
|
|
|
75
125
|
PLATFORMS
|
|
76
|
-
|
|
126
|
+
aarch64-linux-gnu
|
|
127
|
+
aarch64-linux-musl
|
|
128
|
+
arm-linux-gnu
|
|
129
|
+
arm-linux-musl
|
|
130
|
+
arm64-darwin
|
|
131
|
+
ruby
|
|
132
|
+
x86_64-darwin
|
|
133
|
+
x86_64-linux
|
|
134
|
+
x86_64-linux-gnu
|
|
135
|
+
x86_64-linux-musl
|
|
77
136
|
|
|
78
137
|
DEPENDENCIES
|
|
79
|
-
actionpack (
|
|
138
|
+
actionpack (> 7.0)
|
|
80
139
|
country_select!
|
|
81
140
|
pry (~> 0)
|
|
82
141
|
rake (~> 13)
|
|
83
142
|
rspec (~> 3)
|
|
143
|
+
simplecov (~> 0.22)
|
|
84
144
|
|
|
85
145
|
BUNDLED WITH
|
|
86
|
-
2.
|
|
146
|
+
2.6.2
|
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Rails – Country Select
|
|
2
|
-
[](https://badge.fury.io/rb/
|
|
2
|
+
[](https://badge.fury.io/rb/country_select) [](https://github.com/countries/country_select/actions/workflows/test.yml)
|
|
3
3
|
[](https://codeclimate.com/github/countries/country_select)
|
|
4
4
|
[](https://github.com/countries/country_select/actions/workflows/codeql-analysis.yml)
|
|
5
5
|
|
|
@@ -29,13 +29,7 @@ gem install country_select
|
|
|
29
29
|
Or put the following in your Gemfile
|
|
30
30
|
|
|
31
31
|
```ruby
|
|
32
|
-
gem 'country_select', '~>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
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:
|
|
36
|
-
|
|
37
|
-
```ruby
|
|
38
|
-
gem 'country_select', require: 'country_select_without_sort_alphabetical'
|
|
32
|
+
gem 'country_select', '~> 8.0'
|
|
39
33
|
```
|
|
40
34
|
|
|
41
35
|
## Usage
|
|
@@ -82,11 +76,6 @@ Pre-selecting a particular country:
|
|
|
82
76
|
country_select("user", "country", selected: "GB")
|
|
83
77
|
```
|
|
84
78
|
|
|
85
|
-
Changing the divider when priority_countries is active.
|
|
86
|
-
```ruby
|
|
87
|
-
country_select("user", "country", priority_countries: ["AR", "US"], priority_countries_divider: "~~~~~~")
|
|
88
|
-
```
|
|
89
|
-
|
|
90
79
|
Using existing `select` options:
|
|
91
80
|
```ruby
|
|
92
81
|
country_select("user", "country", include_blank: true)
|
|
@@ -132,7 +121,7 @@ country_select("user", "country", format: :with_data_attrs)
|
|
|
132
121
|
### Using customized defaults
|
|
133
122
|
|
|
134
123
|
You can configure overridable defaults for `except`, `format`, `locale`,
|
|
135
|
-
`only
|
|
124
|
+
`only` and `priority_countries` in an initializer.
|
|
136
125
|
|
|
137
126
|
````ruby
|
|
138
127
|
# config/initializers/country_select.rb
|
|
@@ -193,8 +182,8 @@ end
|
|
|
193
182
|
## Example Application
|
|
194
183
|
|
|
195
184
|
An example Rails application demonstrating the different options is
|
|
196
|
-
available at [
|
|
197
|
-
The relevant view files live [here](https://github.com/
|
|
185
|
+
available at [countries/country_select_demo](https://github.com/countries/country_select_demo) and deployed to [country-select-demo.onrender.com](https://country-select-demo.onrender.com).
|
|
186
|
+
The relevant view files live [here](https://github.com/countries/country_select_demo/tree/master/app/views/demo).
|
|
198
187
|
|
|
199
188
|
## Contributing
|
|
200
189
|
|
data/Rakefile
CHANGED
|
@@ -9,28 +9,25 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
9
9
|
|
|
10
10
|
task default: 'spec'
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
task :update_gemfiles do
|
|
14
13
|
require 'pry'
|
|
15
14
|
Dir.glob('gemfiles/*.gemfile').each do |gemfile|
|
|
16
15
|
puts "Updating #{gemfile}...\n\n"
|
|
17
|
-
ENV['BUNDLE_GEMFILE']=gemfile
|
|
16
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
|
18
17
|
puts `bundle install --gemfile=#{gemfile} --no-cache`
|
|
19
18
|
puts `bundle update --gemfile=#{gemfile}`
|
|
20
19
|
|
|
21
20
|
lockfile = "#{gemfile}.lock"
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
puts ""
|
|
32
|
-
else
|
|
33
|
-
raise StandardError.new("Expected #{lockfile} to exist.")
|
|
22
|
+
raise(StandardError, "Expected #{lockfile} to exist.") unless File.exist?(lockfile)
|
|
23
|
+
|
|
24
|
+
parsed_lockfile = Bundler::LockfileParser.new(Bundler.read_file(lockfile))
|
|
25
|
+
# Ensure lockfile has x86_64-linux
|
|
26
|
+
if parsed_lockfile.platforms.map(&:to_s).none? { |p| p == 'x86_64-linux' }
|
|
27
|
+
puts "Adding platform x86_64-linux to #{lockfile}\n\n"
|
|
28
|
+
puts `bundle lock --add-platform x86_64-linux --gemfile=#{gemfile}`
|
|
34
29
|
end
|
|
30
|
+
|
|
31
|
+
puts ''
|
|
35
32
|
end
|
|
36
|
-
end
|
|
33
|
+
end
|
data/country_select.gemspec
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
3
4
|
require 'country_select/version'
|
|
4
5
|
|
|
5
6
|
Gem::Specification.new do |s|
|
|
@@ -9,24 +10,26 @@ Gem::Specification.new do |s|
|
|
|
9
10
|
s.authors = ['Stefan Penner']
|
|
10
11
|
s.email = ['stefan.penner@gmail.com']
|
|
11
12
|
s.homepage = 'https://github.com/countries/country_select'
|
|
12
|
-
s.summary =
|
|
13
|
-
s.description =
|
|
13
|
+
s.summary = 'Country Select Plugin'
|
|
14
|
+
s.description = 'Provides a simple helper to get an HTML select list of countries. \
|
|
15
|
+
The list of countries comes from the ISO 3166 standard. \
|
|
16
|
+
While it is a relatively neutral source of country names, it will still offend some users.'
|
|
14
17
|
|
|
15
18
|
s.metadata = { 'bug_tracker_uri' => 'http://github.com/countries/country_select/issues',
|
|
16
|
-
'changelog_uri' =>
|
|
17
|
-
'source_code_uri' =>
|
|
19
|
+
'changelog_uri' => 'https://github.com/countries/country_select/blob/master/CHANGELOG.md',
|
|
20
|
+
'source_code_uri' => 'https://github.com/countries/country_select',
|
|
21
|
+
'rubygems_mfa_required' => 'true' }
|
|
18
22
|
|
|
19
23
|
s.files = `git ls-files`.split("\n")
|
|
20
|
-
s.
|
|
21
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
24
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
22
25
|
s.require_paths = ['lib']
|
|
23
26
|
|
|
24
|
-
s.required_ruby_version = '>= 2
|
|
27
|
+
s.required_ruby_version = '>= 3.2'
|
|
25
28
|
|
|
26
|
-
s.add_development_dependency 'actionpack', '~> 7.0'
|
|
27
29
|
s.add_development_dependency 'pry', '~> 0'
|
|
28
30
|
s.add_development_dependency 'rake', '~> 13'
|
|
29
31
|
s.add_development_dependency 'rspec', '~> 3'
|
|
32
|
+
s.add_development_dependency 'simplecov', '~> 0.22'
|
|
30
33
|
|
|
31
|
-
s.add_dependency 'countries', '
|
|
34
|
+
s.add_dependency 'countries', '> 6.0', '< 9.0'
|
|
32
35
|
end
|