country_select 6.1.0 → 8.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
  SHA256:
3
- metadata.gz: 71ba22546abd291ceafd67c542882513e11e5778a0cf4e51e0afbfbd8d89e8ad
4
- data.tar.gz: 3d7d7c6cac8302237b651ef47ce0344cb337da19f240cc674e223238099eaa70
3
+ metadata.gz: c2e998f6961d73f6b512f6f2a8346f5f1b971b2fd48795772b9f2553970c2a7d
4
+ data.tar.gz: 72ecc080ff6e7c161d7e09686b170363fc29be7090e2541c41be0c8ab10ffde9
5
5
  SHA512:
6
- metadata.gz: 599f0e30a41591ded1d11103887341ad9c374250eeee5a6f3e7a6a86f5fb5fa4178a0acdba62ea187527ba9dc1c2c2b08a34bccd3a73534d6717adafe7816981
7
- data.tar.gz: 37cd7561ad08e569fa3133fcb9e740dce8dcef6c44cebbc26f6348808515e884af430073d5a911482df9695f7ec5867af28ddb4b5c1c578c5eb32dfadfbec470
6
+ metadata.gz: f69921ae492051bdad6a71fab965e03c71f6446e4fbeb6da5b583b5d70d2136302f7eb726aca6fb6e1a803491855fa94928b28face16161f44437dbe93c23e09
7
+ data.tar.gz: 87530ffdd430818801590107cdf6314cc32deb8f1ec42444ce4e0f8848c4a175934e7e4dac3c495d16b66633e7d819422297213d120014aabefb646b5b9639f0
@@ -12,13 +12,8 @@ jobs:
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
15
- ruby: [2.6, 2.7, '3.0', 3.1]
15
+ ruby: [2.7, '3.0', 3.1]
16
16
  gemfile: [5.2, '6.0', 6.1, '7.0']
17
- exclude:
18
- - ruby: 2.6
19
- gemfile: head
20
- - ruby: 2.6
21
- gemfile: '7.0'
22
17
  env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
23
18
  BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/actionpack-${{ matrix.gemfile }}.gemfile
24
19
  steps:
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '21 7 * * 5'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v3
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 8.0.0 2022-06-30
2
+
3
+ * Update countries gem to 5.1.0 (@pmor)
4
+ * Add deprecation warning for old priority country syntax (@pmor)
5
+ * Allow option to preserve the sort order as inputted in the `only` array of countries (@pmor)
6
+ * Remove `sort_alphabetical` dependency (@pmor)
7
+
8
+ ## 7.0.0 2022-04-03
9
+
10
+ * #200 - Drop support for Ruby 2.5 and 2.6 (@pmor)
11
+ * #201 - Upgrade countries gem to 5.0.0 (@pmor)
12
+
13
+ ## 6.1.1 2022-01-20
14
+
15
+ * #195 - Fix deprecation warning on find_by_name (@filipemendespi)
16
+
1
17
  ## 6.1.0 2022-01-16
2
18
 
3
19
  * #190 - Upgrade to countries 4.2 (@pmor)
data/Gemfile.lock CHANGED
@@ -1,92 +1,79 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- country_select (6.1.0)
5
- countries (~> 4.2)
6
- sort_alphabetical (~> 1.1)
4
+ country_select (7.0.0)
5
+ countries (~> 5.0)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
- actionpack (7.0.1)
12
- actionview (= 7.0.1)
13
- activesupport (= 7.0.1)
10
+ actionpack (7.0.3)
11
+ actionview (= 7.0.3)
12
+ activesupport (= 7.0.3)
14
13
  rack (~> 2.0, >= 2.2.0)
15
14
  rack-test (>= 0.6.3)
16
15
  rails-dom-testing (~> 2.0)
17
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (7.0.1)
19
- activesupport (= 7.0.1)
17
+ actionview (7.0.3)
18
+ activesupport (= 7.0.3)
20
19
  builder (~> 3.1)
21
20
  erubi (~> 1.4)
22
21
  rails-dom-testing (~> 2.0)
23
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (7.0.1)
23
+ activesupport (7.0.3)
25
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
25
  i18n (>= 1.6, < 2)
27
26
  minitest (>= 5.1)
28
27
  tzinfo (~> 2.0)
29
28
  builder (3.2.4)
30
29
  coderay (1.1.3)
31
- concurrent-ruby (1.1.9)
32
- countries (4.2.1)
33
- i18n_data (~> 0.15.0)
30
+ concurrent-ruby (1.1.10)
31
+ countries (5.1.0)
34
32
  sixarm_ruby_unaccent (~> 1.1)
35
33
  crass (1.0.6)
36
34
  diff-lcs (1.5.0)
37
35
  erubi (1.10.0)
38
- i18n (1.8.11)
36
+ i18n (1.10.0)
39
37
  concurrent-ruby (~> 1.0)
40
- i18n_data (0.15.0)
41
- simple_po_parser (~> 1.1)
42
- loofah (2.13.0)
38
+ loofah (2.18.0)
43
39
  crass (~> 1.0.2)
44
40
  nokogiri (>= 1.5.9)
45
41
  method_source (1.0.0)
46
- mini_portile2 (2.7.1)
47
- minitest (5.15.0)
48
- nokogiri (1.13.1)
49
- mini_portile2 (~> 2.7.0)
50
- racc (~> 1.4)
51
- nokogiri (1.13.1-x86_64-linux)
42
+ minitest (5.16.1)
43
+ nokogiri (1.13.6-x86_64-darwin)
52
44
  racc (~> 1.4)
53
45
  pry (0.14.1)
54
46
  coderay (~> 1.1)
55
47
  method_source (~> 1.0)
56
48
  racc (1.6.0)
57
- rack (2.2.3)
58
- rack-test (1.1.0)
59
- rack (>= 1.0, < 3)
49
+ rack (2.2.3.1)
50
+ rack-test (2.0.0)
51
+ rack (>= 1.3)
60
52
  rails-dom-testing (2.0.3)
61
53
  activesupport (>= 4.2.0)
62
54
  nokogiri (>= 1.6)
63
- rails-html-sanitizer (1.4.2)
55
+ rails-html-sanitizer (1.4.3)
64
56
  loofah (~> 2.3)
65
57
  rake (13.0.6)
66
- rspec (3.10.0)
67
- rspec-core (~> 3.10.0)
68
- rspec-expectations (~> 3.10.0)
69
- rspec-mocks (~> 3.10.0)
70
- rspec-core (3.10.1)
71
- rspec-support (~> 3.10.0)
72
- rspec-expectations (3.10.2)
58
+ rspec (3.11.0)
59
+ rspec-core (~> 3.11.0)
60
+ rspec-expectations (~> 3.11.0)
61
+ rspec-mocks (~> 3.11.0)
62
+ rspec-core (3.11.0)
63
+ rspec-support (~> 3.11.0)
64
+ rspec-expectations (3.11.0)
73
65
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.10.0)
75
- rspec-mocks (3.10.2)
66
+ rspec-support (~> 3.11.0)
67
+ rspec-mocks (3.11.1)
76
68
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.10.0)
78
- rspec-support (3.10.3)
79
- simple_po_parser (1.1.5)
69
+ rspec-support (~> 3.11.0)
70
+ rspec-support (3.11.0)
80
71
  sixarm_ruby_unaccent (1.2.0)
81
- sort_alphabetical (1.1.0)
82
- unicode_utils (>= 1.2.2)
83
72
  tzinfo (2.0.4)
84
73
  concurrent-ruby (~> 1.0)
85
- unicode_utils (1.4.0)
86
74
 
87
75
  PLATFORMS
88
- ruby
89
- x86_64-linux
76
+ x86_64-darwin-21
90
77
 
91
78
  DEPENDENCIES
92
79
  actionpack (~> 7.0)
@@ -96,4 +83,4 @@ DEPENDENCIES
96
83
  rspec (~> 3)
97
84
 
98
85
  BUNDLED WITH
99
- 2.3.3
86
+ 2.3.10
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Rails – Country Select
2
- [![build](https://github.com/stefanpenner/country_select/actions/workflows/build.yml/badge.svg)](https://github.com/stefanpenner/country_select/actions/workflows/build.yml)
2
+ [![Gem Version](https://badge.fury.io/rb/country_select.svg)](https://badge.fury.io/rb/countries) [![build](https://github.com/countries/country_select/actions/workflows/build.yml/badge.svg)](https://github.com/countries/country_select/actions/workflows/build.yml)
3
+ [![Code Climate](https://codeclimate.com/github/countries/country_select.svg)](https://codeclimate.com/github/countries/country_select)
4
+ [![CodeQL](https://github.com/countries/country_select/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/countries/country_select/actions/workflows/codeql-analysis.yml)
5
+
3
6
 
4
7
  Provides a simple helper to get an HTML select list of countries using the
5
8
  [ISO 3166-1 standard](https://en.wikipedia.org/wiki/ISO_3166-1).
@@ -14,7 +17,7 @@ to evaluate the suitability of this list given their user base.
14
17
 
15
18
  ## Reporting issues
16
19
 
17
- Open an issue on the [issue tracker](https://github.com/stefanpenner/country_select/issues/new). Ideally provide versions used, and code example that demonstrates the issue.
20
+ Open an issue on the [issue tracker](https://github.com/countries/country_select/issues/new). Ideally provide versions used, and code example that demonstrates the issue.
18
21
 
19
22
  ## Installation
20
23
 
@@ -54,13 +57,17 @@ country_select("user", "country")
54
57
  Supplying priority countries to be placed at the top of the list:
55
58
 
56
59
  ```ruby
57
- country_select("user", "country", priority_countries: ["GB", "FR", "DE"])
60
+ country_select("user", "country", priority_countries: ["GB", "FR", "DE"]) # Countries will be sorted by name according to the current locale
61
+ # or
62
+ country_select("user", "country", priority_countries: ["GB", "FR", "DE"], sort_provided: false) # Countries will be displayed is the provided order
58
63
  ```
59
64
 
60
65
  Supplying only certain countries:
61
66
 
62
67
  ```ruby
63
- country_select("user", "country", only: ["GB", "FR", "DE"])
68
+ country_select("user", "country", only: ["GB", "FR", "DE"]) # Countries will be sorted by name according to the current locale
69
+ # or
70
+ country_select("user", "country", only: ["GB", "FR", "DE"], sort_provided: false) # Countries will be displayed is the provided order
64
71
  ```
65
72
 
66
73
  Discarding certain countries:
@@ -177,7 +184,7 @@ class User < ActiveRecord::Base
177
184
  # (usually English) name if no translation is available
178
185
  def country_name
179
186
  country = ISO3166::Country[country_code]
180
- country.translations[I18n.locale.to_s] || country.iso_short_name
187
+ country.translations[I18n.locale.to_s] || country.common_name || country.iso_short_name
181
188
  end
182
189
 
183
190
  end
data/Rakefile CHANGED
@@ -8,3 +8,29 @@ require 'rspec/core/rake_task'
8
8
  RSpec::Core::RakeTask.new(:spec)
9
9
 
10
10
  task default: 'spec'
11
+
12
+
13
+ task :update_gemfiles do
14
+ require 'pry'
15
+ Dir.glob('gemfiles/*.gemfile').each do |gemfile|
16
+ puts "Updating #{gemfile}...\n\n"
17
+ ENV['BUNDLE_GEMFILE']=gemfile
18
+ puts `bundle install --gemfile=#{gemfile} --no-cache`
19
+ puts `bundle update --gemfile=#{gemfile}`
20
+
21
+ lockfile = "#{gemfile}.lock"
22
+
23
+ if File.exists? lockfile
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}`
29
+ end
30
+
31
+ puts ""
32
+ else
33
+ raise StandardError.new("Expected #{lockfile} to exist.")
34
+ end
35
+ end
36
+ end
@@ -8,22 +8,25 @@ Gem::Specification.new do |s|
8
8
  s.licenses = ['MIT']
9
9
  s.authors = ['Stefan Penner']
10
10
  s.email = ['stefan.penner@gmail.com']
11
- s.homepage = 'https://github.com/stefanpenner/country_select'
11
+ s.homepage = 'https://github.com/countries/country_select'
12
12
  s.summary = %q{Country Select Plugin}
13
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
14
 
15
+ s.metadata = { 'bug_tracker_uri' => 'http://github.com/countries/country_select/issues',
16
+ 'changelog_uri' => 'https://github.com/countries/country_select/blob/master/CHANGELOG.md',
17
+ 'source_code_uri' => 'https://github.com/countries/country_select' }
18
+
15
19
  s.files = `git ls-files`.split("\n")
16
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
22
  s.require_paths = ['lib']
19
23
 
20
- s.required_ruby_version = '>= 2.5'
24
+ s.required_ruby_version = '>= 2.7'
21
25
 
22
26
  s.add_development_dependency 'actionpack', '~> 7.0'
23
27
  s.add_development_dependency 'pry', '~> 0'
24
28
  s.add_development_dependency 'rake', '~> 13'
25
29
  s.add_development_dependency 'rspec', '~> 3'
26
30
 
27
- s.add_dependency 'countries', '~> 4.2'
28
- s.add_dependency 'sort_alphabetical', '~> 1.1'
31
+ s.add_dependency 'countries', '~> 5.0'
29
32
  end
@@ -2,5 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec :path => "../"
4
4
 
5
- gem "railties", "~> 5.2"
6
- gem "actionpack", "~> 5.2"
5
+ gem "railties", "~> 5.2.0"
6
+ gem "actionpack", "~> 5.2.0"
@@ -1,111 +1,98 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- country_select (6.1.0)
5
- countries (~> 4.2)
6
- sort_alphabetical (~> 1.1)
4
+ country_select (7.0.0)
5
+ countries (~> 5.0)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
- actionpack (5.2.6)
12
- actionview (= 5.2.6)
13
- activesupport (= 5.2.6)
10
+ actionpack (5.2.8)
11
+ actionview (= 5.2.8)
12
+ activesupport (= 5.2.8)
14
13
  rack (~> 2.0, >= 2.0.8)
15
14
  rack-test (>= 0.6.3)
16
15
  rails-dom-testing (~> 2.0)
17
16
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
- actionview (5.2.6)
19
- activesupport (= 5.2.6)
17
+ actionview (5.2.8)
18
+ activesupport (= 5.2.8)
20
19
  builder (~> 3.1)
21
20
  erubi (~> 1.4)
22
21
  rails-dom-testing (~> 2.0)
23
22
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
- activesupport (5.2.6)
23
+ activesupport (5.2.8)
25
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
25
  i18n (>= 0.7, < 2)
27
26
  minitest (~> 5.1)
28
27
  tzinfo (~> 1.1)
29
28
  builder (3.2.4)
30
29
  coderay (1.1.3)
31
- concurrent-ruby (1.1.9)
32
- countries (4.2.1)
33
- i18n_data (~> 0.15.0)
30
+ concurrent-ruby (1.1.10)
31
+ countries (5.1.0)
34
32
  sixarm_ruby_unaccent (~> 1.1)
35
33
  crass (1.0.6)
36
34
  diff-lcs (1.5.0)
37
35
  erubi (1.10.0)
38
- i18n (1.8.11)
36
+ i18n (1.10.0)
39
37
  concurrent-ruby (~> 1.0)
40
- i18n_data (0.15.0)
41
- simple_po_parser (~> 1.1)
42
- loofah (2.13.0)
38
+ loofah (2.18.0)
43
39
  crass (~> 1.0.2)
44
40
  nokogiri (>= 1.5.9)
45
41
  method_source (1.0.0)
46
- mini_portile2 (2.7.1)
47
- minitest (5.15.0)
48
- nokogiri (1.13.1)
49
- mini_portile2 (~> 2.7.0)
42
+ minitest (5.16.1)
43
+ nokogiri (1.13.6-x86_64-darwin)
50
44
  racc (~> 1.4)
51
- nokogiri (1.13.1-arm64-darwin)
52
- racc (~> 1.4)
53
- nokogiri (1.13.1-x86_64-linux)
45
+ nokogiri (1.13.6-x86_64-linux)
54
46
  racc (~> 1.4)
55
47
  pry (0.14.1)
56
48
  coderay (~> 1.1)
57
49
  method_source (~> 1.0)
58
50
  racc (1.6.0)
59
- rack (2.2.3)
60
- rack-test (1.1.0)
61
- rack (>= 1.0, < 3)
51
+ rack (2.2.3.1)
52
+ rack-test (2.0.2)
53
+ rack (>= 1.3)
62
54
  rails-dom-testing (2.0.3)
63
55
  activesupport (>= 4.2.0)
64
56
  nokogiri (>= 1.6)
65
- rails-html-sanitizer (1.4.2)
57
+ rails-html-sanitizer (1.4.3)
66
58
  loofah (~> 2.3)
67
- railties (5.2.6)
68
- actionpack (= 5.2.6)
69
- activesupport (= 5.2.6)
59
+ railties (5.2.8)
60
+ actionpack (= 5.2.8)
61
+ activesupport (= 5.2.8)
70
62
  method_source
71
63
  rake (>= 0.8.7)
72
64
  thor (>= 0.19.0, < 2.0)
73
65
  rake (13.0.6)
74
- rspec (3.10.0)
75
- rspec-core (~> 3.10.0)
76
- rspec-expectations (~> 3.10.0)
77
- rspec-mocks (~> 3.10.0)
78
- rspec-core (3.10.1)
79
- rspec-support (~> 3.10.0)
80
- rspec-expectations (3.10.2)
66
+ rspec (3.11.0)
67
+ rspec-core (~> 3.11.0)
68
+ rspec-expectations (~> 3.11.0)
69
+ rspec-mocks (~> 3.11.0)
70
+ rspec-core (3.11.0)
71
+ rspec-support (~> 3.11.0)
72
+ rspec-expectations (3.11.0)
81
73
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.10.0)
83
- rspec-mocks (3.10.2)
74
+ rspec-support (~> 3.11.0)
75
+ rspec-mocks (3.11.1)
84
76
  diff-lcs (>= 1.2.0, < 2.0)
85
- rspec-support (~> 3.10.0)
86
- rspec-support (3.10.3)
87
- simple_po_parser (1.1.5)
77
+ rspec-support (~> 3.11.0)
78
+ rspec-support (3.11.0)
88
79
  sixarm_ruby_unaccent (1.2.0)
89
- sort_alphabetical (1.1.0)
90
- unicode_utils (>= 1.2.2)
91
80
  thor (1.2.1)
92
81
  thread_safe (0.3.6)
93
82
  tzinfo (1.2.9)
94
83
  thread_safe (~> 0.1)
95
- unicode_utils (1.4.0)
96
84
 
97
85
  PLATFORMS
98
- arm64-darwin-21
99
- ruby
86
+ x86_64-darwin-21
100
87
  x86_64-linux
101
88
 
102
89
  DEPENDENCIES
103
- actionpack (~> 5.2)
90
+ actionpack (~> 5.2.0)
104
91
  country_select!
105
92
  pry (~> 0)
106
- railties (~> 5.2)
93
+ railties (~> 5.2.0)
107
94
  rake (~> 13)
108
95
  rspec (~> 3)
109
96
 
110
97
  BUNDLED WITH
111
- 2.3.3
98
+ 2.3.10
@@ -2,5 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec :path => "../"
4
4
 
5
- gem "railties", "~> 6.0"
6
- gem "actionpack", "~> 6.0"
5
+ gem "railties", "~> 6.0.0"
6
+ gem "actionpack", "~> 6.0.0"