enumerate_it 3.2.2 → 3.2.4

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: 114c01d4c307676728a2efbdc215df6596e5d915c8557d99f7ad3b9ff3230db0
4
- data.tar.gz: ba845cf17d00731c6966148855ef2cc2cdbb37916d4c73fb6cdb070fae91c228
3
+ metadata.gz: eb83f052edf5a989af33b9734d8307c774b08504255a433ba86105b93dc71298
4
+ data.tar.gz: 62282a46a5759e6e61b053ca80adeb674c1df7ffb9d392652b818e4009e94ca9
5
5
  SHA512:
6
- metadata.gz: a8c91bf450d10feb513dd975e1d94c034722e4a99198f2379fbd4fa6fb281cabe3de559082ad450ab71e9191db89dcfe6fdeaa0ed943d8b3627f01fdc1c64599
7
- data.tar.gz: be7eeb6ba615cdc711a32d10eaf8f7fb26ec2a29c64e18520c3bac960d875f025536c2b432ebdb2691da8d0d0a8c03575bde9979f05047384fdcbc2d3cbf9d39
6
+ metadata.gz: e6c9483acab55bd80890ff5cea29c82e4a58c4ace98af47edce11244327b4d51c27d6966988d4f4a820864654576fb9c7c829a447dc1a99f45d411ce384b91ad
7
+ data.tar.gz: 04f383f747ff8349c4ec58e495fd08a0b654e90bb5c5337833ee257e8122204dd6786bd2cefbaf74e7b934c06219f238f2be1ead4da7f359fa72c0e3c45a4904
@@ -13,12 +13,14 @@ jobs:
13
13
  - 2.6
14
14
  - 2.7
15
15
  - 3.0
16
+ - 3.1
16
17
  gemfile:
17
18
  - gemfiles/rails_5.0.gemfile
18
19
  - gemfiles/rails_5.1.gemfile
19
20
  - gemfiles/rails_5.2.gemfile
20
21
  - gemfiles/rails_6.0.gemfile
21
22
  - gemfiles/rails_6.1.gemfile
23
+ - gemfiles/rails_7.0.gemfile
22
24
  exclude:
23
25
  # Rails < 6 does not support Ruby 3+:
24
26
  # https://github.com/rails/rails/issues/40938#issuecomment-751357907
@@ -28,6 +30,18 @@ jobs:
28
30
  gemfile: gemfiles/rails_5.1.gemfile
29
31
  - ruby: 3.0
30
32
  gemfile: gemfiles/rails_5.2.gemfile
33
+ - ruby: 3.1
34
+ gemfile: gemfiles/rails_5.0.gemfile
35
+ - ruby: 3.1
36
+ gemfile: gemfiles/rails_5.1.gemfile
37
+ - ruby: 3.1
38
+ gemfile: gemfiles/rails_5.2.gemfile
39
+
40
+ # Rails 7.0 requires Ruby 2.7+
41
+ - ruby: 2.5
42
+ gemfile: gemfiles/rails_7.0.gemfile
43
+ - ruby: 2.6
44
+ gemfile: gemfiles/rails_7.0.gemfile
31
45
 
32
46
  env:
33
47
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
@@ -36,7 +50,7 @@ jobs:
36
50
 
37
51
  steps:
38
52
  - name: Checkout
39
- uses: actions/checkout@v2
53
+ uses: actions/checkout@v3
40
54
  - name: Set up Ruby
41
55
  uses: ruby/setup-ruby@v1
42
56
  with:
@@ -44,7 +58,7 @@ jobs:
44
58
  bundler-cache: true
45
59
 
46
60
  - name: Rubocop
47
- if: ${{ matrix.ruby == '3.0' }}
61
+ if: ${{ matrix.ruby == '3.1' }}
48
62
  run: "bundle exec rubocop"
49
63
 
50
64
  - name: Tests
data/Appraisals CHANGED
@@ -4,7 +4,7 @@ require 'json'
4
4
  rails_versions = JSON.parse(Net::HTTP.get(URI('https://rubygems.org/api/v1/versions/rails.json')))
5
5
  .group_by { |version| version['number'] }.keys.grep_v(/rc|racecar|beta|pre/)
6
6
 
7
- %w[5.0 5.1 5.2 6.0 6.1].each do |version|
7
+ %w[5.0 5.1 5.2 6.0 6.1 7.0].each do |version|
8
8
  appraise "rails_#{version}" do
9
9
  current_version = rails_versions
10
10
  .select { |key| key.match(/\A#{version}/) }
data/CHANGELOG.md CHANGED
@@ -1 +1,4 @@
1
- Changes are maintained under [Releases](https://github.com/lucascaton/enumerate_it/releases).
1
+ # CHANGELOG
2
+
3
+ Changes follows the [Semantic Versioning](https://semver.org/) specification and
4
+ you can see them on the [releases page](../../releases).
data/Gemfile.lock CHANGED
@@ -1,76 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (3.2.2)
4
+ enumerate_it (3.2.4)
5
5
  activesupport (>= 5.0.7.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (6.1.4.1)
10
+ activesupport (7.0.4)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
12
  i18n (>= 1.6, < 2)
13
13
  minitest (>= 5.1)
14
14
  tzinfo (~> 2.0)
15
- zeitwerk (~> 2.3)
16
15
  appraisal (2.4.1)
17
16
  bundler
18
17
  rake
19
18
  thor (>= 0.14.0)
20
19
  ast (2.4.2)
21
20
  coderay (1.1.3)
22
- concurrent-ruby (1.1.9)
23
- diff-lcs (1.4.4)
24
- i18n (1.8.11)
21
+ concurrent-ruby (1.1.10)
22
+ diff-lcs (1.5.0)
23
+ i18n (1.12.0)
25
24
  concurrent-ruby (~> 1.0)
25
+ json (2.6.2)
26
26
  method_source (1.0.0)
27
- minitest (5.14.4)
28
- parallel (1.20.1)
29
- parser (3.0.2.0)
27
+ minitest (5.16.3)
28
+ parallel (1.22.1)
29
+ parser (3.1.2.1)
30
30
  ast (~> 2.4.1)
31
31
  pry (0.14.1)
32
32
  coderay (~> 1.1)
33
33
  method_source (~> 1.0)
34
- rainbow (3.0.0)
34
+ rainbow (3.1.1)
35
35
  rake (13.0.6)
36
- regexp_parser (2.1.1)
36
+ regexp_parser (2.5.0)
37
37
  rexml (3.2.5)
38
- rspec (3.10.0)
39
- rspec-core (~> 3.10.0)
40
- rspec-expectations (~> 3.10.0)
41
- rspec-mocks (~> 3.10.0)
42
- rspec-core (3.10.1)
43
- rspec-support (~> 3.10.0)
44
- rspec-expectations (3.10.1)
38
+ rspec (3.11.0)
39
+ rspec-core (~> 3.11.0)
40
+ rspec-expectations (~> 3.11.0)
41
+ rspec-mocks (~> 3.11.0)
42
+ rspec-core (3.11.0)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-expectations (3.11.0)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.10.0)
47
- rspec-mocks (3.10.2)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-mocks (3.11.1)
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.10.0)
50
- rspec-support (3.10.2)
51
- rubocop (1.18.4)
49
+ rspec-support (~> 3.11.0)
50
+ rspec-support (3.11.0)
51
+ rubocop (1.36.0)
52
+ json (~> 2.3)
52
53
  parallel (~> 1.10)
53
- parser (>= 3.0.0.0)
54
+ parser (>= 3.1.2.1)
54
55
  rainbow (>= 2.2.2, < 4.0)
55
56
  regexp_parser (>= 1.8, < 3.0)
56
- rexml
57
- rubocop-ast (>= 1.8.0, < 2.0)
57
+ rexml (>= 3.2.5, < 4.0)
58
+ rubocop-ast (>= 1.20.1, < 2.0)
58
59
  ruby-progressbar (~> 1.7)
59
60
  unicode-display_width (>= 1.4.0, < 3.0)
60
- rubocop-ast (1.8.0)
61
- parser (>= 3.0.1.1)
61
+ rubocop-ast (1.21.0)
62
+ parser (>= 3.1.1.0)
62
63
  rubocop-rake (0.6.0)
63
64
  rubocop (~> 1.0)
64
- rubocop-rspec (2.4.0)
65
- rubocop (~> 1.0)
66
- rubocop-ast (>= 1.1.0)
65
+ rubocop-rspec (2.12.1)
66
+ rubocop (~> 1.31)
67
67
  ruby-progressbar (1.11.0)
68
- thor (1.1.0)
69
- tzinfo (2.0.4)
68
+ thor (1.2.1)
69
+ tzinfo (2.0.5)
70
70
  concurrent-ruby (~> 1.0)
71
- unicode-display_width (2.0.0)
71
+ unicode-display_width (2.2.0)
72
72
  wwtd (1.4.1)
73
- zeitwerk (2.5.1)
74
73
 
75
74
  PLATFORMS
76
75
  ruby
@@ -88,4 +87,4 @@ DEPENDENCIES
88
87
  wwtd
89
88
 
90
89
  BUNDLED WITH
91
- 2.2.24
90
+ 2.3.21
data/README.md CHANGED
@@ -521,14 +521,15 @@ You can also sort it by its **value** using `sort_by :value`.
521
521
 
522
522
  ## Changelog
523
523
 
524
- Changes are maintained under [Releases page](https://github.com/lucascaton/enumerate_it/releases).
524
+ Changes follows the [Semantic Versioning](https://semver.org/) specification and
525
+ you can see them on the [releases page](../../releases).
525
526
 
526
527
  ## Note on Patches/Pull Requests
527
528
 
528
529
  * Fork the project.
529
530
  * Make your feature addition or bug fix.
530
531
  * Add tests for it. This is important so we don't break it in a future version unintentionally.
531
- * [Optional] Run the tests agaist a specific Gemfile: `$ bundle exec appraisal rails_6.1 rake spec`.
532
+ * [Optional] Run the tests agaist a specific Gemfile: `$ bundle exec appraisal rails_7.0 rake spec`.
532
533
  * Run the tests agaist all supported versions: `$ bundle exec rake` (or `$ bundle exec wwtd`)
533
534
  * Commit, but please do not mess with `Rakefile`, version, or history.
534
535
  * Send a Pull Request. Bonus points for topic branches.
data/enumerate_it.gemspec CHANGED
@@ -9,7 +9,6 @@ Gem::Specification.new do |gem|
9
9
  gem.license = 'MIT'
10
10
 
11
11
  gem.files = `git ls-files`.split("\n")
12
- gem.test_files = `git ls-files -- spec/*`.split("\n")
13
12
  gem.name = 'enumerate_it'
14
13
  gem.require_paths = ['lib']
15
14
  gem.version = EnumerateIt::VERSION
@@ -17,7 +16,8 @@ Gem::Specification.new do |gem|
17
16
 
18
17
  gem.metadata = {
19
18
  'source_code_uri' => 'https://github.com/lucascaton/enumerate_it',
20
- 'changelog_uri' => 'https://github.com/lucascaton/enumerate_it/releases'
19
+ 'changelog_uri' => 'https://github.com/lucascaton/enumerate_it/releases',
20
+ 'rubygems_mfa_required' => 'true'
21
21
  }
22
22
 
23
23
  gem.add_dependency 'activesupport', '>= 5.0.7.2'
@@ -2,8 +2,8 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'activerecord', '~> 5.2.6'
6
- gem 'activesupport', '~> 5.2.6'
5
+ gem 'activerecord', '~> 5.2.8.1'
6
+ gem 'activesupport', '~> 5.2.8.1'
7
7
  gem 'sqlite3', '~> 1.4.2'
8
8
 
9
9
  gemspec path: '../'
@@ -2,8 +2,8 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'activerecord', '~> 6.0.4.1'
6
- gem 'activesupport', '~> 6.0.4.1'
5
+ gem 'activerecord', '~> 6.0.6'
6
+ gem 'activesupport', '~> 6.0.6'
7
7
  gem 'sqlite3', '~> 1.4.2'
8
8
 
9
9
  gemspec path: '../'
@@ -2,8 +2,8 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'activerecord', '~> 6.1.4.1'
6
- gem 'activesupport', '~> 6.1.4.1'
5
+ gem 'activerecord', '~> 6.1.7'
6
+ gem 'activesupport', '~> 6.1.7'
7
7
  gem 'sqlite3', '~> 1.4.2'
8
8
 
9
9
  gemspec path: '../'
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'activerecord', '~> 7.0.4'
6
+ gem 'activesupport', '~> 7.0.4'
7
+ gem 'sqlite3', '~> 1.4.2'
8
+
9
+ gemspec path: '../'
@@ -1,3 +1,3 @@
1
1
  module EnumerateIt
2
- VERSION = '3.2.2'.freeze
2
+ VERSION = '3.2.4'.freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  Description:
2
- Creates an EnumerateIt class an its locale file
2
+ Creates an EnumerateIt class and its locale file
3
3
 
4
4
  Example:
5
5
  rails g enumerate_it:enum CivilStatus single married divorced widower concubinage separated stable
@@ -11,5 +11,5 @@ Example:
11
11
  rails g enumerate_it:enum CivilStatus single:1 married:2 divorced:3 widower:4
12
12
 
13
13
  This will create:
14
- app/enumerations/civil_status.rb with `associate_values :single => 1, :married => 2, :divorced => 2, :widower => 4`
14
+ app/enumerations/civil_status.rb with `associate_values single: 1, married: 2, divorced: 3, widower: 4`
15
15
  config/locales/civil_status.yml
@@ -3,7 +3,7 @@ module EnumerateIt
3
3
  class EnumGenerator < Rails::Generators::NamedBase
4
4
  source_root File.expand_path('templates', __dir__)
5
5
 
6
- argument :attributes, type: 'array'
6
+ argument :attributes, type: :hash
7
7
 
8
8
  class_option :singular, type: 'string', desc: 'Singular name for i18n'
9
9
 
@@ -29,12 +29,10 @@ module EnumerateIt
29
29
  singular_name
30
30
  end
31
31
 
32
- def locale_fields
33
- attributes.map(&:name)
34
- end
35
-
36
32
  def fields
37
- if attributes.first.type == :string
33
+ if attributes.empty?
34
+ args
35
+ elsif attributes.first.type == :string
38
36
  attributes.map(&:name)
39
37
  else
40
38
  attributes.map { |attribute| [attribute.name, attribute.type] }
@@ -1,6 +1,6 @@
1
1
  <%= default_lang %>:
2
2
  enumerations:
3
3
  <%= singular_name %>:
4
- <%- locale_fields.each do |name| -%>
4
+ <%- fields.each do |name, _| -%>
5
5
  <%= name %>: '<%= name.humanize %>'
6
6
  <%- end -%>
@@ -308,12 +308,12 @@ describe EnumerateIt::Base do
308
308
  end
309
309
 
310
310
  it 'passes the given options to the validation method' do
311
- expect(active_record_stub_class)
312
- .to receive(:validates_presence_of).with(:bla, if: :some_method)
313
-
314
311
  active_record_stub_class.class_eval do
315
312
  has_enumeration_for :bla, with: TestEnumeration, required: { if: :some_method }
316
313
  end
314
+
315
+ expect(active_record_stub_class)
316
+ .to have_received(:validates_presence_of).with(:bla, if: :some_method)
317
317
  end
318
318
 
319
319
  it 'does not require the attribute by default' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cássio Marques
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-07 00:00:00.000000000 Z
12
+ date: 2022-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -174,6 +174,7 @@ files:
174
174
  - gemfiles/rails_5.2.gemfile
175
175
  - gemfiles/rails_6.0.gemfile
176
176
  - gemfiles/rails_6.1.gemfile
177
+ - gemfiles/rails_7.0.gemfile
177
178
  - lib/enumerate_it.rb
178
179
  - lib/enumerate_it/base.rb
179
180
  - lib/enumerate_it/class_methods.rb
@@ -194,6 +195,7 @@ licenses:
194
195
  metadata:
195
196
  source_code_uri: https://github.com/lucascaton/enumerate_it
196
197
  changelog_uri: https://github.com/lucascaton/enumerate_it/releases
198
+ rubygems_mfa_required: 'true'
197
199
  post_install_message:
198
200
  rdoc_options: []
199
201
  require_paths:
@@ -209,14 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
211
  - !ruby/object:Gem::Version
210
212
  version: '0'
211
213
  requirements: []
212
- rubygems_version: 3.2.26
214
+ rubygems_version: 3.3.7
213
215
  signing_key:
214
216
  specification_version: 4
215
217
  summary: Ruby Enumerations
216
- test_files:
217
- - spec/enumerate_it/base_spec.rb
218
- - spec/enumerate_it_spec.rb
219
- - spec/i18n/en.yml
220
- - spec/i18n/pt.yml
221
- - spec/spec_helper.rb
222
- - spec/support/test_classes.rb
218
+ test_files: []