country_select 7.0.0 → 8.0.3

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
  SHA256:
3
- metadata.gz: c90fbc7dfe822e709d24caaa9f6ea4aadbc565d056acd04a83881fd456d77d04
4
- data.tar.gz: b8b38e3f7c4b907df636ecb611db60c26aa95c7e355a102ce9b4b5b0395fc77a
3
+ metadata.gz: c801f19e2389f6c0fd8d88b666bc31b382e5b7321033b94de1378df8c020726b
4
+ data.tar.gz: 92d3b1031fb53cd0ae189e84391553436281680aaceaffd8540192d629ad5940
5
5
  SHA512:
6
- metadata.gz: 6c467912e59762ce36aecdff5b9ff177b10745a5462437be8d4b3eb283d6e92d1629b3eaa08f1ac2581bb28b212e2b43114bfbcc88ee5118fd0290b596817dd8
7
- data.tar.gz: c29e2c423c6cbf990ff80de5b1415945e90f1425ca5bc82a8cb819edca7438c22d4bba374fc52a6d467c29bab8b823d53b50ad8e70fe5d28afa8a8069ffff083
6
+ metadata.gz: 6a8ff3e9f846e6b2081e925f4edac27409eeb9c62918bb6dec07a0a39540ec5f501792da09299d8de3d340118ae227c8d09c408da04ee92dd489a72f76ea73c5
7
+ data.tar.gz: 9f56a57c00a86df1e5d38fc98b269764c6c7938951a77481dac5edfe57c09f9011fb386d5501296556f6d45ede72272199c70ec6140a2e9c5fa6a9f7e1127015
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"
@@ -42,7 +42,7 @@ jobs:
42
42
 
43
43
  # Initializes the CodeQL tools for scanning.
44
44
  - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v1
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@v1
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@v1
70
+ uses: github/codeql-action/analyze@v2
@@ -0,0 +1,36 @@
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.0', 3.1, 3.2]
20
+ gemfile: [6.1, '7.0', 7.1]
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@v3
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
+ - name: Run tests
32
+
33
+ run: bundle exec rake
34
+ - name: Publish code coverage
35
+ uses: paambaati/codeclimate-action@v4.0.0
36
+
data/.gitignore CHANGED
@@ -4,3 +4,4 @@
4
4
  pkg/*
5
5
  .ruby-version
6
6
  vendor/bundle
7
+ coverage
data/.rubocop.yml ADDED
@@ -0,0 +1,34 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.7
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,28 @@
1
+ ## 8.0.3 2023-10-07
2
+
3
+ * Fix when country name is nil. (@zerobearing2)
4
+
5
+ ## 8.0.2 2023-08-01
6
+
7
+ * Code cleanup (@pmor)
8
+ * Update CodeQL to V2 (@scudco)
9
+ * Adding support for Rails 7.1 after recent Form Options helper changes (@ron-shinall)
10
+
11
+ ## 8.0.1 2023-01-03
12
+
13
+ * Update README.md by (@ron-shinall)
14
+ * Update installation instructions by (@henrik)
15
+ * Fix deprecated File.exists? on ruby 3.2.0 by (@JNajera212)
16
+ * Fix priority country sorting bug by (@pmor)
17
+ * Update countries gem to 5.3.0 (@pmor)
18
+
19
+ ## 8.0.0 2022-06-30
20
+
21
+ * Update countries gem to 5.1.0 (@pmor)
22
+ * Add deprecation warning for old priority country syntax (@pmor)
23
+ * Allow option to preserve the sort order as inputted in the `only` array of countries (@pmor)
24
+ * Remove `sort_alphabetical` dependency (@pmor)
25
+
1
26
  ## 7.0.0 2022-04-03
2
27
 
3
28
  * #200 - Drop support for Ruby 2.5 and 2.6 (@pmor)
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,87 +1,115 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- country_select (6.1.1)
4
+ country_select (8.0.3)
5
5
  countries (~> 5.0)
6
- sort_alphabetical (~> 1.1)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
- actionpack (7.0.2.3)
12
- actionview (= 7.0.2.3)
13
- activesupport (= 7.0.2.3)
14
- rack (~> 2.0, >= 2.2.0)
10
+ actionpack (7.1.0)
11
+ actionview (= 7.1.0)
12
+ activesupport (= 7.1.0)
13
+ nokogiri (>= 1.8.5)
14
+ rack (>= 2.2.4)
15
+ rack-session (>= 1.0.1)
15
16
  rack-test (>= 0.6.3)
16
- rails-dom-testing (~> 2.0)
17
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (7.0.2.3)
19
- activesupport (= 7.0.2.3)
17
+ rails-dom-testing (~> 2.2)
18
+ rails-html-sanitizer (~> 1.6)
19
+ actionview (7.1.0)
20
+ activesupport (= 7.1.0)
20
21
  builder (~> 3.1)
21
- erubi (~> 1.4)
22
- rails-dom-testing (~> 2.0)
23
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (7.0.2.3)
22
+ erubi (~> 1.11)
23
+ rails-dom-testing (~> 2.2)
24
+ rails-html-sanitizer (~> 1.6)
25
+ activesupport (7.1.0)
26
+ base64
27
+ bigdecimal
25
28
  concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ connection_pool (>= 2.2.5)
30
+ drb
26
31
  i18n (>= 1.6, < 2)
27
32
  minitest (>= 5.1)
33
+ mutex_m
28
34
  tzinfo (~> 2.0)
35
+ base64 (0.1.1)
36
+ bigdecimal (3.1.4)
29
37
  builder (3.2.4)
30
38
  coderay (1.1.3)
31
- concurrent-ruby (1.1.10)
32
- countries (5.0.0)
33
- i18n_data (~> 0.16.0)
34
- sixarm_ruby_unaccent (~> 1.1)
39
+ concurrent-ruby (1.2.2)
40
+ connection_pool (2.4.1)
41
+ countries (5.6.0)
42
+ unaccent (~> 0.3)
35
43
  crass (1.0.6)
36
44
  diff-lcs (1.5.0)
37
- erubi (1.10.0)
38
- i18n (1.10.0)
45
+ docile (1.4.0)
46
+ drb (2.1.1)
47
+ ruby2_keywords
48
+ erubi (1.12.0)
49
+ i18n (1.14.1)
39
50
  concurrent-ruby (~> 1.0)
40
- i18n_data (0.16.0)
41
- simple_po_parser (~> 1.1)
42
- loofah (2.16.0)
51
+ loofah (2.21.3)
43
52
  crass (~> 1.0.2)
44
- nokogiri (>= 1.5.9)
53
+ nokogiri (>= 1.12.0)
45
54
  method_source (1.0.0)
46
- minitest (5.15.0)
47
- nokogiri (1.13.3-x86_64-darwin)
55
+ mini_portile2 (2.8.4)
56
+ minitest (5.20.0)
57
+ mutex_m (0.1.2)
58
+ nokogiri (1.15.4)
59
+ mini_portile2 (~> 2.8.2)
48
60
  racc (~> 1.4)
49
- pry (0.14.1)
61
+ nokogiri (1.15.4-arm64-darwin)
62
+ racc (~> 1.4)
63
+ nokogiri (1.15.4-x86_64-darwin)
64
+ racc (~> 1.4)
65
+ nokogiri (1.15.4-x86_64-linux)
66
+ racc (~> 1.4)
67
+ pry (0.14.2)
50
68
  coderay (~> 1.1)
51
69
  method_source (~> 1.0)
52
- racc (1.6.0)
53
- rack (2.2.3)
54
- rack-test (1.1.0)
55
- rack (>= 1.0, < 3)
56
- rails-dom-testing (2.0.3)
57
- activesupport (>= 4.2.0)
70
+ racc (1.7.1)
71
+ rack (3.0.8)
72
+ rack-session (2.0.0)
73
+ rack (>= 3.0.0)
74
+ rack-test (2.1.0)
75
+ rack (>= 1.3)
76
+ rails-dom-testing (2.2.0)
77
+ activesupport (>= 5.0.0)
78
+ minitest
58
79
  nokogiri (>= 1.6)
59
- rails-html-sanitizer (1.4.2)
60
- loofah (~> 2.3)
80
+ rails-html-sanitizer (1.6.0)
81
+ loofah (~> 2.21)
82
+ nokogiri (~> 1.14)
61
83
  rake (13.0.6)
62
- rspec (3.11.0)
63
- rspec-core (~> 3.11.0)
64
- rspec-expectations (~> 3.11.0)
65
- rspec-mocks (~> 3.11.0)
66
- rspec-core (3.11.0)
67
- rspec-support (~> 3.11.0)
68
- rspec-expectations (3.11.0)
84
+ rspec (3.12.0)
85
+ rspec-core (~> 3.12.0)
86
+ rspec-expectations (~> 3.12.0)
87
+ rspec-mocks (~> 3.12.0)
88
+ rspec-core (3.12.2)
89
+ rspec-support (~> 3.12.0)
90
+ rspec-expectations (3.12.3)
69
91
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.11.0)
71
- rspec-mocks (3.11.1)
92
+ rspec-support (~> 3.12.0)
93
+ rspec-mocks (3.12.6)
72
94
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.11.0)
74
- rspec-support (3.11.0)
75
- simple_po_parser (1.1.6)
76
- sixarm_ruby_unaccent (1.2.0)
77
- sort_alphabetical (1.1.0)
78
- unicode_utils (>= 1.2.2)
79
- tzinfo (2.0.4)
95
+ rspec-support (~> 3.12.0)
96
+ rspec-support (3.12.1)
97
+ ruby2_keywords (0.0.5)
98
+ simplecov (0.22.0)
99
+ docile (~> 1.1)
100
+ simplecov-html (~> 0.11)
101
+ simplecov_json_formatter (~> 0.1)
102
+ simplecov-html (0.12.3)
103
+ simplecov_json_formatter (0.1.4)
104
+ tzinfo (2.0.6)
80
105
  concurrent-ruby (~> 1.0)
81
- unicode_utils (1.4.0)
106
+ unaccent (0.4.0)
82
107
 
83
108
  PLATFORMS
84
- x86_64-darwin-21
109
+ arm64-darwin-22
110
+ ruby
111
+ x86_64-darwin-22
112
+ x86_64-linux
85
113
 
86
114
  DEPENDENCIES
87
115
  actionpack (~> 7.0)
@@ -89,6 +117,7 @@ DEPENDENCIES
89
117
  pry (~> 0)
90
118
  rake (~> 13)
91
119
  rspec (~> 3)
120
+ simplecov (~> 0.22)
92
121
 
93
122
  BUNDLED WITH
94
- 2.3.10
123
+ 2.4.19
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Rails – Country Select
2
- [![build](https://github.com/countries/country_select/actions/workflows/build.yml/badge.svg)](https://github.com/countries/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/test.yml/badge.svg)](https://github.com/countries/country_select/actions/workflows/test.yml)
3
3
  [![Code Climate](https://codeclimate.com/github/countries/country_select.svg)](https://codeclimate.com/github/countries/country_select)
4
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
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', '~> 6.0'
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
@@ -57,13 +51,17 @@ country_select("user", "country")
57
51
  Supplying priority countries to be placed at the top of the list:
58
52
 
59
53
  ```ruby
60
- country_select("user", "country", priority_countries: ["GB", "FR", "DE"])
54
+ country_select("user", "country", priority_countries: ["GB", "FR", "DE"]) # Countries will be sorted by name according to the current locale
55
+ # or
56
+ country_select("user", "country", priority_countries: ["GB", "FR", "DE"], sort_provided: false) # Countries will be displayed is the provided order
61
57
  ```
62
58
 
63
59
  Supplying only certain countries:
64
60
 
65
61
  ```ruby
66
- country_select("user", "country", only: ["GB", "FR", "DE"])
62
+ country_select("user", "country", only: ["GB", "FR", "DE"]) # Countries will be sorted by name according to the current locale
63
+ # or
64
+ country_select("user", "country", only: ["GB", "FR", "DE"], sort_provided: false) # Countries will be displayed is the provided order
67
65
  ```
68
66
 
69
67
  Discarding certain countries:
@@ -189,8 +187,8 @@ end
189
187
  ## Example Application
190
188
 
191
189
  An example Rails application demonstrating the different options is
192
- available at [scudco/country_select_test](https://github.com/scudco/country_select_test).
193
- The relevant view files live [here](https://github.com/scudco/country_select_test/tree/master/app/views/welcome).
190
+ 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).
191
+ The relevant view files live [here](https://github.com/countries/country_select_demo/tree/master/app/views/demo).
194
192
 
195
193
  ## Contributing
196
194
 
data/Rakefile CHANGED
@@ -8,3 +8,26 @@ require 'rspec/core/rake_task'
8
8
  RSpec::Core::RakeTask.new(:spec)
9
9
 
10
10
  task default: 'spec'
11
+
12
+ task :update_gemfiles do
13
+ require 'pry'
14
+ Dir.glob('gemfiles/*.gemfile').each do |gemfile|
15
+ puts "Updating #{gemfile}...\n\n"
16
+ ENV['BUNDLE_GEMFILE'] = gemfile
17
+ puts `bundle install --gemfile=#{gemfile} --no-cache`
18
+ puts `bundle update --gemfile=#{gemfile}`
19
+
20
+ lockfile = "#{gemfile}.lock"
21
+
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}`
29
+ end
30
+
31
+ puts ''
32
+ end
33
+ end
@@ -1,5 +1,6 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
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,16 +10,18 @@ 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 = %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.}
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' => 'https://github.com/countries/country_select/blob/master/CHANGELOG.md',
17
- 'source_code_uri' => 'https://github.com/countries/country_select' }
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.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
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
27
  s.required_ruby_version = '>= 2.7'
@@ -27,7 +30,7 @@ Gem::Specification.new do |s|
27
30
  s.add_development_dependency 'pry', '~> 0'
28
31
  s.add_development_dependency 'rake', '~> 13'
29
32
  s.add_development_dependency 'rspec', '~> 3'
33
+ s.add_development_dependency 'simplecov', '~> 0.22'
30
34
 
31
35
  s.add_dependency 'countries', '~> 5.0'
32
- s.add_dependency 'sort_alphabetical', '~> 1.1'
33
36
  end
@@ -1,6 +1,9 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- gemspec :path => "../"
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "railties", "~> 6.1"
6
- gem "actionpack", "~> 6.1"
5
+ gemspec path: '../'
6
+
7
+ gem 'railties', '~> 6.1.0'
8
+ gem 'actionpack', '~> 6.1.0'
9
+ gem 'nokogiri', '= 1.14.0.rc1'