rekkyo 1.0.0 → 1.1.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: a46a9d9c7bfe76738ef8f353e5e2a1920a9a4d4b3f98040b8a86279b4d2f354c
4
- data.tar.gz: 8f0fae02b3d788ed476a408abf097125d929ef327126128a7898fad354a97309
3
+ metadata.gz: 4a1f01bb3198a8a59e049bdc6cc02e163d40e1a1a52782aaa5065b3e13be54c5
4
+ data.tar.gz: ae9d4b9c66efc4ed80e814b32221881d6f4ee99203cf4dd381717a50c5faa4a3
5
5
  SHA512:
6
- metadata.gz: f7d9e88f1dc6852a09c9afecee8b45970f55b9d8d5e270b0dcd8ee0de9acb1513b37f031e6e930edb6e467fbc01e65997e76a0d131a93dea3aeb5d549bceb65b
7
- data.tar.gz: 2734fc74a40dc5cefb50fe9a2451ac8643bda470c1db8d0e78e6b5afa4211ea21cbfe3ff5fd0c8f79f112081192d871b447ff434a18c1fb3aa2c1a40c7f2317e
6
+ metadata.gz: d739847d3d7d8c2cc0c6eeb9e40f737ab969473477e0bc4b768efb8b3ce33212fb8de5eed7bc3532f282544cd3c1fecc926bb651bb52a729fa210649a8094fa2
7
+ data.tar.gz: 17968d571a80422c2f06476c959813628b546d04863d8503d5e19b1e357d34bf2bb68c08f298082fe3ae905ae7661944899683618061f0ce9aeccca5745efe31
@@ -0,0 +1,38 @@
1
+ name: Build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
11
+ activesupport: ['5.2', '6.0', '6.1', '7.0']
12
+ experimental: [false]
13
+ exclude:
14
+ - ruby: '2.5'
15
+ activesupport: '7.0'
16
+ - ruby: '2.6'
17
+ activesupport: '7.0'
18
+ - ruby: '2.7'
19
+ activesupport: '5.2'
20
+ - ruby: '3.0'
21
+ activesupport: '5.2'
22
+ - ruby: '3.1'
23
+ activesupport: '5.2'
24
+ continue-on-error: ${{ matrix.experimental }}
25
+ env:
26
+ APPRAISAL: activesupport_${{ matrix.activesupport }}
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - name: Set up Ruby
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ - name: Install dependencies
34
+ run: |
35
+ bundle install
36
+ bundle exec appraisal $APPRAISAL bundle install
37
+ - name: Run tests
38
+ run: bundle exec appraisal $APPRAISAL rake
data/.gitignore CHANGED
@@ -2,6 +2,8 @@
2
2
  /.yardoc
3
3
  /_yardoc/
4
4
  /Gemfile.lock
5
+ /gemfiles/*.lock
6
+ /gemfiles/.bundle/
5
7
  /coverage/
6
8
  /doc/
7
9
  /gemfiles/*.gemfile.lock
data/.rspec CHANGED
File without changes
data/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 2.5
3
+ Exclude:
4
+ - gemfiles/*
5
+ NewCops: enable
3
6
 
4
7
  Style/AsciiComments:
5
8
  Enabled: false
@@ -18,13 +21,14 @@ Layout/EndOfLine:
18
21
  Enabled: true
19
22
  EnforcedStyle: lf
20
23
 
24
+ Layout/LineLength:
25
+ Max: 128
26
+
21
27
  Metrics/BlockLength:
22
28
  Exclude:
29
+ - rekkyo.gemspec
23
30
  - spec/**/*
24
31
 
25
32
  Metrics/MethodLength:
26
33
  Exclude:
27
34
  - spec/**/*
28
-
29
- Metrics/LineLength:
30
- Max: 128
data/Appraisals ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise "activesupport_5.2" do
4
+ gem "activesupport", "~> 5.2.0"
5
+ end
6
+
7
+ appraise "activesupport_6.0" do
8
+ gem "activesupport", "~> 6.0.0"
9
+ end
10
+
11
+ appraise "activesupport_6.1" do
12
+ gem "activesupport", "~> 6.1.0"
13
+ end
14
+
15
+ appraise "activesupport_7.0" do
16
+ gem "activesupport", "~> 7.0.1"
17
+ end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,37 @@
1
1
  ## Unreleased
2
2
 
3
3
 
4
+ ## 1.1.0 (2022-11-25)
5
+
6
+ ### Changes
7
+
8
+ * Add ActiveSupport 6.0 support
9
+ * [PR#8](https://github.com/yujideveloper/rekkyo/pull/8)
10
+ * Add Ruby 2.7 support
11
+ * [PR#9](https://github.com/yujideveloper/rekkyo/pull/9)
12
+ * Add Ruby 3.0 and ActiveSupport 6.1 support
13
+ * [PR#12](https://github.com/yujideveloper/rekkyo/pull/12)
14
+ * Drop Ruby 2.4 support
15
+ * [PR#14](https://github.com/yujideveloper/rekkyo/pull/14)
16
+ * Call `super` when `Rekkyo::Type` is included
17
+ * [PR#16](https://github.com/yujideveloper/rekkyo/pull/16)
18
+ * Add Ruby 3.1 and ActiveSupport 7.0 support
19
+ * [PR#17](https://github.com/yujideveloper/rekkyo/pull/17)
20
+ * Override `freeze` method to freeze enum members
21
+ * [PR#18](https://github.com/yujideveloper/rekkyo/pull/18)
22
+ * Drop ActiveSupport 5.1 support
23
+ * [PR#19](https://github.com/yujideveloper/rekkyo/pull/19)
24
+ * Split `Rekkyo::Type::ClassMethods` module into role-specific modules
25
+ * [PR#19](https://github.com/yujideveloper/rekkyo/pull/20)
26
+
27
+ ### Misc
28
+
29
+ * Migrate CI from Travis CI from GitHub Actions
30
+ * [PR#11](https://github.com/yujideveloper/rekkyo/pull/11)
31
+ * Require MFA to release gem
32
+ * [PR#19](https://github.com/yujideveloper/rekkyo/pull/21)
33
+
34
+
4
35
  ## 1.0.0 (2019-04-08)
5
36
 
6
37
  ### Changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Rekkyo
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rekkyo.svg)](https://badge.fury.io/rb/rekkyo)
4
- [![Build Status](https://travis-ci.org/yujideveloper/rekkyo.svg?branch=master)](https://travis-ci.org/yujideveloper/rekkyo)
4
+ [![Build](https://github.com/yujideveloper/rekkyo/actions/workflows/ruby.yml/badge.svg)](https://github.com/yujideveloper/rekkyo/actions/workflows/ruby.yml)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/37d6334cedf5b04af831/maintainability)](https://codeclimate.com/github/yujideveloper/rekkyo/maintainability)
6
6
 
7
7
  Rekkyo (列挙) is a gem for defining an enumerated type in Ruby.
8
8
 
9
- This gem is inspired by [`Ruby::Enum`](https://github.com/dblock/ruby-enum) and [`Enum`](https://github.com/LIQIDTechnology/enum_class).
9
+ This gem is inspired by [`ruby-enum`](https://rubygems.org/gems/ruby-enum) and [`enum_class`](https://rubygems.org/gems/enum_class).
10
10
 
11
11
  ## Installation
12
12
 
data/Rakefile CHANGED
File without changes
@@ -1,6 +1,6 @@
1
- # frozen_string_literal: true
1
+ # This file was generated by Appraisal
2
2
 
3
- source "https://rubygems.org/"
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "activesupport", "~> 5.2.0"
6
6
 
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.1.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 7.0.1"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rekkyo
4
+ module Type
5
+ module DSLMethods
6
+ UNSPECIFIED = Object.new.freeze
7
+ private_constant :UNSPECIFIED
8
+
9
+ def member(key, value = UNSPECIFIED)
10
+ value = key if value == UNSPECIFIED
11
+ key = key.upcase.to_sym
12
+
13
+ validate_member(key, value)
14
+
15
+ self::Member.new(key, value).freeze.tap do |m|
16
+ @members << m
17
+
18
+ self.const_set(key, m)
19
+
20
+ self::Member.class_exec do
21
+ define_method(:"#{key.downcase}?") { self.match?(m) }
22
+ end
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def validate_member(key, value)
29
+ raise DuplicateMemberError if self.const_defined?(key, false) ||
30
+ @members.any? { |m| m.match? value }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rekkyo
4
+ module Type
5
+ module EnumMethods
6
+ def all
7
+ @members.dup
8
+ end
9
+
10
+ alias members all
11
+
12
+ def freeze
13
+ @members.freeze
14
+ super
15
+ end
16
+ end
17
+ end
18
+ end
File without changes
data/lib/rekkyo/type.rb CHANGED
@@ -6,47 +6,16 @@ module Rekkyo
6
6
  module Type
7
7
  class << self
8
8
  def included(klass)
9
+ super
9
10
  klass.const_set(:Member, Class.new(Member))
10
11
  klass.instance_variable_set(:@members, Set.new)
11
- klass.extend(ClassMethods)
12
- end
13
- end
14
-
15
- module ClassMethods
16
- UNSPECIFIED = Object.new.freeze
17
- private_constant :UNSPECIFIED
18
-
19
- def member(key, value = UNSPECIFIED)
20
- value = key if value == UNSPECIFIED
21
- key = key.upcase.to_sym
22
-
23
- validate_member(key, value)
24
-
25
- self::Member.new(key, value).freeze.tap do |m|
26
- @members << m
27
-
28
- self.const_set(key, m)
29
-
30
- self::Member.class_exec do
31
- define_method(:"#{key.downcase}?") { self.match?(m) }
32
- end
33
- end
34
- end
35
-
36
- def all
37
- @members.dup
38
- end
39
-
40
- alias members all
41
-
42
- private
43
-
44
- def validate_member(key, value)
45
- raise DuplicateMemberError if self.const_defined?(key, false) ||
46
- @members.any? { |m| m.match? value }
12
+ klass.extend(DSLMethods)
13
+ klass.extend(EnumMethods)
47
14
  end
48
15
  end
49
16
  end
50
17
  end
51
18
 
52
19
  require "rekkyo/type/member"
20
+ require "rekkyo/type/dsl_methods"
21
+ require "rekkyo/type/enum_methods"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rekkyo
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/rekkyo.rb CHANGED
@@ -4,8 +4,8 @@ require "rekkyo/version"
4
4
 
5
5
  module Rekkyo
6
6
  class Error < StandardError; end
7
- class DuplicateMemberError < Error
8
- end
7
+
8
+ class DuplicateMemberError < Error; end
9
9
  end
10
10
 
11
11
  require "rekkyo/type"
data/rekkyo.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata["source_code_uri"] = spec.homepage
20
20
  spec.metadata["changelog_uri"] = "https://github.com/yujideveloper/rekkyo/tree/master/CHANGELOG.md"
21
21
 
22
+ spec.metadata["rubygems_mfa_required"] = "true"
23
+
22
24
  # Specify which files should be added to the gem when it is released.
23
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
26
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -28,10 +30,13 @@ Gem::Specification.new do |spec|
28
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
31
  spec.require_paths = ["lib"]
30
32
 
33
+ spec.required_ruby_version = ">= 2.5"
34
+
35
+ spec.add_development_dependency "appraisal", ">= 2.4.1"
31
36
  spec.add_development_dependency "bundler", ">= 1.16"
32
37
  spec.add_development_dependency "pry", ">= 0.12.2"
33
38
  spec.add_development_dependency "pry-doc", ">= 0.13.5"
34
39
  spec.add_development_dependency "rake", "~> 12.3"
35
40
  spec.add_development_dependency "rspec", "~> 3.8"
36
- spec.add_development_dependency "rubocop", ">= 0.61.1"
41
+ spec.add_development_dependency "rubocop", ">= 1.25.0"
37
42
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rekkyo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Hanamura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appraisal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.4.1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.4.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 0.61.1
103
+ version: 1.25.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 0.61.1
110
+ version: 1.25.0
97
111
  description: Rekkyo is a gem for defining an enumerated type in Ruby.
98
112
  email:
99
113
  - yuji.developer@gmail.com
@@ -101,10 +115,11 @@ executables: []
101
115
  extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
118
+ - ".github/workflows/ruby.yml"
104
119
  - ".gitignore"
105
120
  - ".rspec"
106
121
  - ".rubocop.yml"
107
- - ".travis.yml"
122
+ - Appraisals
108
123
  - CHANGELOG.md
109
124
  - Gemfile
110
125
  - LICENSE.txt
@@ -112,10 +127,14 @@ files:
112
127
  - Rakefile
113
128
  - bin/console
114
129
  - bin/setup
115
- - gemfiles/activesupport_5.1.gemfile
116
130
  - gemfiles/activesupport_5.2.gemfile
131
+ - gemfiles/activesupport_6.0.gemfile
132
+ - gemfiles/activesupport_6.1.gemfile
133
+ - gemfiles/activesupport_7.0.gemfile
117
134
  - lib/rekkyo.rb
118
135
  - lib/rekkyo/type.rb
136
+ - lib/rekkyo/type/dsl_methods.rb
137
+ - lib/rekkyo/type/enum_methods.rb
119
138
  - lib/rekkyo/type/member.rb
120
139
  - lib/rekkyo/version.rb
121
140
  - rekkyo.gemspec
@@ -126,7 +145,8 @@ metadata:
126
145
  homepage_uri: https://github.com/yujideveloper/rekkyo
127
146
  source_code_uri: https://github.com/yujideveloper/rekkyo
128
147
  changelog_uri: https://github.com/yujideveloper/rekkyo/tree/master/CHANGELOG.md
129
- post_install_message:
148
+ rubygems_mfa_required: 'true'
149
+ post_install_message:
130
150
  rdoc_options: []
131
151
  require_paths:
132
152
  - lib
@@ -134,15 +154,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
154
  requirements:
135
155
  - - ">="
136
156
  - !ruby/object:Gem::Version
137
- version: '0'
157
+ version: '2.5'
138
158
  required_rubygems_version: !ruby/object:Gem::Requirement
139
159
  requirements:
140
160
  - - ">="
141
161
  - !ruby/object:Gem::Version
142
162
  version: '0'
143
163
  requirements: []
144
- rubygems_version: 3.0.3
145
- signing_key:
164
+ rubygems_version: 3.3.7
165
+ signing_key:
146
166
  specification_version: 4
147
167
  summary: An enumerated type in Ruby.
148
168
  test_files: []
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.4.5
7
- - 2.5.5
8
- - 2.6.2
9
- gemfile:
10
- - Gemfile
11
- - gemfiles/activesupport_5.1.gemfile
12
- - gemfiles/activesupport_5.2.gemfile
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org/"
4
-
5
- gem "activesupport", "~> 5.1.0"
6
-
7
- gemspec path: "../"