enumerate_it 3.1.0 → 3.2.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: 62a4ffbc91037108d9fff3f8582f8c7730cad76cca3345d22f451b7b569cff39
4
- data.tar.gz: baad05bcde8471ac5ea25ed8220e263321569c8680826430182b793c4bc6a7ec
3
+ metadata.gz: 71119e1fa6ccbb6d77ba404a1009c31a3174de08fb540bef2c98550bd6062a28
4
+ data.tar.gz: 4247b33c271222ca52293ae9c5ef55f8d4f9d9c8af28dfe198a23ef64ca4a6d2
5
5
  SHA512:
6
- metadata.gz: aa58121d321fec8c2c05a1c98100623cb250775e30ea54c3c7b46fffca5f75b5969064ed39342873311917e3c1e6d1ae8dd0f6b70f5067404401984e7122620f
7
- data.tar.gz: 4cfe227c91770ffdb58a6ab150b1cc6f21708aeb9d990670320510a1a50e28df12747613515f77f3071dc48772951bbf4b3b9547027a95203b5c2764ab421527
6
+ metadata.gz: 696c8511a033407677a8cced966bb6bac68b56e0abd0b97b2d96f2400a71165e57f5685aa288ab25a7f7938682562a24933301126197e0ec491fbcbfbe1f717a
7
+ data.tar.gz: 59ddf99c1c9358908abc21fdc7b4fcd42513c8326ffdae8f54fba0d06ae4738720ef56827e0abdfa0041cbfe2cbab870fb1950905d9b3763095d02ef5736fd1a
@@ -1,12 +1,14 @@
1
- require: rubocop-rspec
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rake
2
4
 
3
5
  inherit_mode:
4
6
  merge:
5
7
  - Exclude
6
8
 
7
9
  AllCops:
8
- TargetRubyVersion: 2.4
9
- DisplayCopNames: true
10
+ NewCops: enable
11
+ TargetRubyVersion: 2.5
10
12
 
11
13
  Exclude:
12
14
  - 'lib/generators/enumerate_it/enum/templates/**/*'
@@ -21,6 +23,12 @@ Layout/EndAlignment:
21
23
  Layout/LineLength:
22
24
  Max: 100
23
25
 
26
+ Lint/RaiseException:
27
+ Enabled: true
28
+
29
+ Lint/StructNewOverride:
30
+ Enabled: true
31
+
24
32
  Metrics/BlockLength:
25
33
  Exclude:
26
34
  - 'spec/**/*'
@@ -60,6 +68,9 @@ Naming/PredicateName:
60
68
  Exclude:
61
69
  - 'lib/enumerate_it/class_methods.rb'
62
70
 
71
+ Naming/VariableNumber:
72
+ EnforcedStyle: snake_case
73
+
63
74
  RSpec/MultipleExpectations:
64
75
  Enabled: false
65
76
 
@@ -5,31 +5,20 @@ sudo: false
5
5
  cache: bundler
6
6
 
7
7
  script:
8
- - "ruby -e \"RUBY_VERSION == '2.7.0' ? system('bundle exec rubocop') : exit(0)\""
8
+ - "ruby -e \"RUBY_VERSION == '2.7.2' ? system('bundle exec rubocop') : exit(0)\""
9
9
  - bundle exec rake spec
10
10
 
11
11
  rvm:
12
- - 2.4.9
13
- - 2.5.7
14
- - 2.6.5
15
- - 2.7.0
12
+ - 2.5.8
13
+ - 2.6.6
14
+ - 2.7.2
16
15
 
17
16
  gemfile:
18
- - gemfiles/rails_4.2.gemfile
19
17
  - gemfiles/rails_5.0.gemfile
20
18
  - gemfiles/rails_5.1.gemfile
21
19
  - gemfiles/rails_5.2.gemfile
22
20
  - gemfiles/rails_6.0.gemfile
23
21
 
24
- matrix:
25
- exclude:
26
- # Rails 4.2 isn't compatible with Ruby 2.7+
27
- - rvm: 2.7.0
28
- gemfile: gemfiles/rails_4.2.gemfile
29
- # Rails 6 requires Ruby 2.5+
30
- - rvm: 2.4.9
31
- gemfile: gemfiles/rails_6.0.gemfile
32
-
33
22
  addons:
34
23
  code_climate:
35
24
  repo_token: 60e4a18e2a4bc86a98f92847f16756876c13d1e772058a9b3296643b04a697d7
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.reject { |key| key =~ /rc|racecar|beta|pre/ }
6
6
 
7
- %w[4.2 5.0 5.1 5.2 6.0].each do |version|
7
+ %w[5.0 5.1 5.2 6.0].each do |version|
8
8
  appraise "rails_#{version}" do
9
9
  current_version = rails_versions
10
10
  .select { |key| key.match(/\A#{version}/) }
@@ -13,6 +13,6 @@ rails_versions = JSON.parse(Net::HTTP.get(URI('https://rubygems.org/api/v1/versi
13
13
  gem 'activesupport', "~> #{current_version}"
14
14
  gem 'activerecord', "~> #{current_version}"
15
15
 
16
- gem 'sqlite3', Gem::Version.new(version) > Gem::Version.new(5.0) ? '~> 1.4.1' : '< 1.4'
16
+ gem 'sqlite3', Gem::Version.new(version) > Gem::Version.new(5.0) ? '~> 1.4.2' : '< 1.4'
17
17
  end
18
18
  end
@@ -1,71 +1,77 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (3.1.0)
5
- activesupport (>= 4.2.0)
4
+ enumerate_it (3.2.0)
5
+ activesupport (>= 5.0.7.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (6.0.2.1)
10
+ activesupport (6.0.3.4)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
12
  i18n (>= 0.7, < 2)
13
13
  minitest (~> 5.1)
14
14
  tzinfo (~> 1.1)
15
- zeitwerk (~> 2.2)
16
- appraisal (2.2.0)
15
+ zeitwerk (~> 2.2, >= 2.2.2)
16
+ appraisal (2.3.0)
17
17
  bundler
18
18
  rake
19
19
  thor (>= 0.14.0)
20
- ast (2.4.0)
21
- coderay (1.1.2)
22
- concurrent-ruby (1.1.6)
23
- diff-lcs (1.3)
24
- i18n (1.8.2)
20
+ ast (2.4.1)
21
+ coderay (1.1.3)
22
+ concurrent-ruby (1.1.7)
23
+ diff-lcs (1.4.4)
24
+ i18n (1.8.5)
25
25
  concurrent-ruby (~> 1.0)
26
- jaro_winkler (1.5.4)
27
- method_source (0.9.2)
28
- minitest (5.14.0)
29
- parallel (1.19.1)
30
- parser (2.7.0.4)
31
- ast (~> 2.4.0)
32
- pry (0.12.2)
33
- coderay (~> 1.1.0)
34
- method_source (~> 0.9.0)
26
+ method_source (1.0.0)
27
+ minitest (5.14.2)
28
+ parallel (1.20.1)
29
+ parser (2.7.2.0)
30
+ ast (~> 2.4.1)
31
+ pry (0.13.1)
32
+ coderay (~> 1.1)
33
+ method_source (~> 1.0)
35
34
  rainbow (3.0.0)
36
35
  rake (13.0.1)
36
+ regexp_parser (2.0.0)
37
37
  rexml (3.2.4)
38
- rspec (3.9.0)
39
- rspec-core (~> 3.9.0)
40
- rspec-expectations (~> 3.9.0)
41
- rspec-mocks (~> 3.9.0)
42
- rspec-core (3.9.1)
43
- rspec-support (~> 3.9.1)
44
- rspec-expectations (3.9.0)
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.0)
43
+ rspec-support (~> 3.10.0)
44
+ rspec-expectations (3.10.0)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.9.0)
47
- rspec-mocks (3.9.1)
46
+ rspec-support (~> 3.10.0)
47
+ rspec-mocks (3.10.0)
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.9.0)
50
- rspec-support (3.9.2)
51
- rubocop (0.80.1)
52
- jaro_winkler (~> 1.5.1)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-support (3.10.0)
51
+ rubocop (1.5.2)
53
52
  parallel (~> 1.10)
54
- parser (>= 2.7.0.1)
53
+ parser (>= 2.7.1.5)
55
54
  rainbow (>= 2.2.2, < 4.0)
55
+ regexp_parser (>= 1.8, < 3.0)
56
56
  rexml
57
+ rubocop-ast (>= 1.2.0, < 2.0)
57
58
  ruby-progressbar (~> 1.7)
58
- unicode-display_width (>= 1.4.0, < 1.7)
59
- rubocop-rspec (1.38.1)
60
- rubocop (>= 0.68.1)
59
+ unicode-display_width (>= 1.4.0, < 2.0)
60
+ rubocop-ast (1.3.0)
61
+ parser (>= 2.7.1.5)
62
+ rubocop-rake (0.5.1)
63
+ rubocop
64
+ rubocop-rspec (2.0.1)
65
+ rubocop (~> 1.0)
66
+ rubocop-ast (>= 1.1.0)
61
67
  ruby-progressbar (1.10.1)
62
68
  thor (1.0.1)
63
69
  thread_safe (0.3.6)
64
- tzinfo (1.2.6)
70
+ tzinfo (1.2.8)
65
71
  thread_safe (~> 0.1)
66
- unicode-display_width (1.6.1)
72
+ unicode-display_width (1.7.0)
67
73
  wwtd (1.4.1)
68
- zeitwerk (2.3.0)
74
+ zeitwerk (2.4.2)
69
75
 
70
76
  PLATFORMS
71
77
  ruby
@@ -78,6 +84,7 @@ DEPENDENCIES
78
84
  rake
79
85
  rspec
80
86
  rubocop
87
+ rubocop-rake
81
88
  rubocop-rspec
82
89
  wwtd
83
90
 
data/README.md CHANGED
@@ -403,8 +403,8 @@ You sure can! 😄
403
403
 
404
404
  #### What versions of Ruby and Rails are supported?
405
405
 
406
- * **Ruby**: `2.4+`
407
- * **Rails** `4.2+`
406
+ * **Ruby**: `2.5+`
407
+ * **Rails** `5.0+`
408
408
 
409
409
  All versions are tested via
410
410
  [Travis](https://github.com/lucascaton/enumerate_it/blob/master/.travis.yml).
data/Rakefile CHANGED
@@ -1,14 +1,7 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
2
3
 
3
- if ENV['APPRAISAL_INITIALIZED'] || ENV['TRAVIS']
4
- require 'rspec/core/rake_task'
4
+ Bundler::GemHelper.install_tasks
5
+ RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- Bundler::GemHelper.install_tasks
7
- RSpec::Core::RakeTask.new(:spec)
8
-
9
- task default: :spec
10
- else
11
- require 'appraisal'
12
-
13
- task default: :appraisal
14
- end
7
+ task default: :spec
@@ -1,4 +1,5 @@
1
- require File.expand_path('lib/enumerate_it/version', __dir__)
1
+ $LOAD_PATH << File.expand_path('lib', __dir__)
2
+ require 'enumerate_it/version'
2
3
 
3
4
  Gem::Specification.new do |gem|
4
5
  gem.authors = ['Cássio Marques', 'Lucas Caton']
@@ -12,14 +13,14 @@ Gem::Specification.new do |gem|
12
13
  gem.name = 'enumerate_it'
13
14
  gem.require_paths = ['lib']
14
15
  gem.version = EnumerateIt::VERSION
15
- gem.required_ruby_version = '>= 2.4.7'
16
+ gem.required_ruby_version = '>= 2.5.8'
16
17
 
17
18
  gem.metadata = {
18
19
  'source_code_uri' => 'https://github.com/lucascaton/enumerate_it',
19
20
  'changelog_uri' => 'https://github.com/lucascaton/enumerate_it/releases'
20
21
  }
21
22
 
22
- gem.add_dependency 'activesupport', '>= 4.2.0'
23
+ gem.add_dependency 'activesupport', '>= 5.0.7.2'
23
24
 
24
25
  gem.add_development_dependency 'appraisal'
25
26
  gem.add_development_dependency 'bundler'
@@ -27,6 +28,7 @@ Gem::Specification.new do |gem|
27
28
  gem.add_development_dependency 'rake'
28
29
  gem.add_development_dependency 'rspec'
29
30
  gem.add_development_dependency 'rubocop'
31
+ gem.add_development_dependency 'rubocop-rake'
30
32
  gem.add_development_dependency 'rubocop-rspec'
31
33
  gem.add_development_dependency 'wwtd'
32
34
  end
@@ -4,6 +4,6 @@ source 'https://rubygems.org'
4
4
 
5
5
  gem 'activerecord', '~> 5.1.7'
6
6
  gem 'activesupport', '~> 5.1.7'
7
- gem 'sqlite3', '~> 1.4.1'
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', '~> 5.2.4.1'
6
- gem 'activesupport', '~> 5.2.4.1'
7
- gem 'sqlite3', '~> 1.4.1'
5
+ gem 'activerecord', '~> 5.2.4.4'
6
+ gem 'activesupport', '~> 5.2.4.4'
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.2.1'
6
- gem 'activesupport', '~> 6.0.2.1'
7
- gem 'sqlite3', '~> 1.4.1'
5
+ gem 'activerecord', '~> 6.0.3.4'
6
+ gem 'activesupport', '~> 6.0.3.4'
7
+ gem 'sqlite3', '~> 1.4.2'
8
8
 
9
9
  gemspec path: '../'
@@ -43,16 +43,16 @@ module EnumerateIt
43
43
  list.length
44
44
  end
45
45
 
46
- def each_translation
47
- each_value { |value| yield t(value) }
46
+ def each_translation(&block)
47
+ each_value { |value| block.call t(value) }
48
48
  end
49
49
 
50
50
  def translations
51
51
  list.map { |value| t(value) }
52
52
  end
53
53
 
54
- def each_value
55
- list.each { |value| yield value }
54
+ def each_value(&block)
55
+ list.each(&block)
56
56
  end
57
57
 
58
58
  def to_json(options = nil)
@@ -1,3 +1,3 @@
1
1
  module EnumerateIt
2
- VERSION = '3.1.0'.freeze
2
+ VERSION = '3.2.0'.freeze
3
3
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe EnumerateIt::Base do
4
4
  it 'creates constants for each enumeration value' do
@@ -1,10 +1,11 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe EnumerateIt do
4
4
  let :test_class do
5
5
  Class.new do
6
6
  extend EnumerateIt
7
7
  attr_accessor :foobar
8
+
8
9
  has_enumeration_for :foobar, with: TestEnumeration
9
10
 
10
11
  def initialize(foobar)
@@ -62,6 +63,7 @@ describe EnumerateIt do
62
63
  Class.new do
63
64
  extend EnumerateIt
64
65
  attr_accessor :foobar
66
+
65
67
  has_enumeration_for :foobar, with: TestEnumerationWithoutArray
66
68
 
67
69
  def initialize(foobar)
@@ -92,6 +94,7 @@ describe EnumerateIt do
92
94
  Class.new do
93
95
  extend EnumerateIt
94
96
  attr_accessor :test_enumeration
97
+
95
98
  has_enumeration_for :test_enumeration
96
99
 
97
100
  def initialize(test_enumeration_value)
@@ -109,14 +112,17 @@ describe EnumerateIt do
109
112
  context 'when using a nested class as the enumeration' do
110
113
  let :class_with_nested_enum do
111
114
  Class.new do
115
+ # rubocop:disable Lint/ConstantDefinitionInBlock
112
116
  # rubocop:disable RSpec/LeakyConstantDeclaration
113
117
  class NestedEnum < EnumerateIt::Base
114
118
  associate_values foo: %w[1 Blerrgh], bar: ['2' => 'Blarghhh']
115
119
  end
116
120
  # rubocop:enable RSpec/LeakyConstantDeclaration
121
+ # rubocop:enable Lint/ConstantDefinitionInBlock
117
122
 
118
123
  extend EnumerateIt
119
124
  attr_accessor :nested_enum
125
+
120
126
  has_enumeration_for :nested_enum
121
127
 
122
128
  def initialize(nested_enum_value)
@@ -137,6 +143,7 @@ describe EnumerateIt do
137
143
  Class.new do
138
144
  extend EnumerateIt
139
145
  attr_accessor :foobar
146
+
140
147
  has_enumeration_for :foobar, with: TestEnumeration, create_helpers: true
141
148
 
142
149
  def initialize(foobar)
@@ -177,6 +184,7 @@ describe EnumerateIt do
177
184
  Class.new do
178
185
  extend EnumerateIt
179
186
  attr_accessor :foobar
187
+
180
188
  has_enumeration_for :foobar, with: TestEnumeration, create_helpers: { prefix: true }
181
189
 
182
190
  def initialize(foobar)
@@ -218,6 +226,7 @@ describe EnumerateIt do
218
226
  Class.new do
219
227
  extend EnumerateIt
220
228
  attr_accessor :foo
229
+
221
230
  has_enumeration_for :foo, with: PolymorphicEnum, create_helpers: { polymorphic: true }
222
231
  end
223
232
  end
@@ -243,6 +252,7 @@ describe EnumerateIt do
243
252
  Class.new do
244
253
  extend EnumerateIt
245
254
  attr_accessor :foo
255
+
246
256
  has_enumeration_for :foo, with: PolymorphicEnum,
247
257
  create_helpers: { polymorphic: { suffix: '_strategy' } }
248
258
  end
@@ -283,7 +293,7 @@ describe EnumerateIt do
283
293
 
284
294
  TestEnumeration.enumeration.each do |symbol, pair|
285
295
  expect(test_class_with_scope.public_send(symbol).to_sql)
286
- .to match(/WHERE "test_class_with_scopes"."foobar" = \'#{pair.first}\'/)
296
+ .to match(/WHERE "test_class_with_scopes"."foobar" = '#{pair.first}'/)
287
297
  end
288
298
  end
289
299
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cássio Marques
8
8
  - Lucas Caton
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-12 00:00:00.000000000 Z
12
+ date: 2020-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.2.0
20
+ version: 5.0.7.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 4.2.0
27
+ version: 5.0.7.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: appraisal
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rubocop-rake
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rubocop-rspec
114
128
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +152,7 @@ dependencies:
138
152
  - !ruby/object:Gem::Version
139
153
  version: '0'
140
154
  description: Enumerations for Ruby with some magic powers!
141
- email:
155
+ email:
142
156
  executables: []
143
157
  extensions: []
144
158
  extra_rdoc_files: []
@@ -155,7 +169,6 @@ files:
155
169
  - README.md
156
170
  - Rakefile
157
171
  - enumerate_it.gemspec
158
- - gemfiles/rails_4.2.gemfile
159
172
  - gemfiles/rails_5.0.gemfile
160
173
  - gemfiles/rails_5.1.gemfile
161
174
  - gemfiles/rails_5.2.gemfile
@@ -180,7 +193,7 @@ licenses:
180
193
  metadata:
181
194
  source_code_uri: https://github.com/lucascaton/enumerate_it
182
195
  changelog_uri: https://github.com/lucascaton/enumerate_it/releases
183
- post_install_message:
196
+ post_install_message:
184
197
  rdoc_options: []
185
198
  require_paths:
186
199
  - lib
@@ -188,15 +201,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
201
  requirements:
189
202
  - - ">="
190
203
  - !ruby/object:Gem::Version
191
- version: 2.4.7
204
+ version: 2.5.8
192
205
  required_rubygems_version: !ruby/object:Gem::Requirement
193
206
  requirements:
194
207
  - - ">="
195
208
  - !ruby/object:Gem::Version
196
209
  version: '0'
197
210
  requirements: []
198
- rubygems_version: 3.0.3
199
- signing_key:
211
+ rubygems_version: 3.1.4
212
+ signing_key:
200
213
  specification_version: 4
201
214
  summary: Ruby Enumerations
202
215
  test_files:
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord', '~> 4.2.11.1'
6
- gem 'activesupport', '~> 4.2.11.1'
7
- gem 'sqlite3', '< 1.4'
8
-
9
- gemspec path: '../'