character_set 1.8.0 → 1.9.0

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +10 -0
  4. data/README.md +2 -1
  5. data/Rakefile +12 -5
  6. data/ext/character_set/character_set.c +78 -67
  7. data/ext/character_set/java/src/main/java/org/jaynetics/characterset/CharacterSetService.java +15 -0
  8. data/ext/character_set/java/src/main/java/org/jaynetics/characterset/RubyCharacterSet.java +493 -0
  9. data/ext/character_set/java/src/main/java/org/jaynetics/characterset/StringOperations.java +138 -0
  10. data/lib/character_set/java.rb +6 -0
  11. data/lib/character_set/parser.rb +5 -3
  12. data/lib/character_set/predefined_sets/assigned.cps +95 -58
  13. data/lib/character_set/predefined_sets/emoji.cps +9 -11
  14. data/lib/character_set/predefined_sets.rb +1 -1
  15. data/lib/character_set/ruby_fallback/character_set_methods.rb +7 -10
  16. data/lib/character_set/ruby_fallback/set_methods.rb +215 -52
  17. data/lib/character_set/ruby_fallback.rb +4 -18
  18. data/lib/character_set/shared_methods.rb +39 -2
  19. data/lib/character_set/version.rb +1 -1
  20. data/lib/character_set/writer.rb +1 -1
  21. data/lib/character_set.rb +6 -1
  22. metadata +8 -38
  23. data/.gitattributes +0 -3
  24. data/.github/workflows/gouteur.yml +0 -20
  25. data/.github/workflows/lint.yml +0 -29
  26. data/.github/workflows/tests.yml +0 -28
  27. data/.gitignore +0 -33
  28. data/.gouteur.yml +0 -2
  29. data/.rspec +0 -3
  30. data/BENCHMARK.md +0 -90
  31. data/Gemfile +0 -21
  32. data/bin/console +0 -21
  33. data/bin/setup +0 -8
  34. data/character_set.gemspec +0 -24
  35. data/ext/character_set/unicode_casefold_table.h +0 -1438
  36. data/ext/character_set/unicode_casefold_table.h.tmpl +0 -11
  37. data/lib/character_set/ruby_fallback/vendored_set_classes.rb +0 -385
  38. data/tasks/benchmark.rake +0 -20
  39. data/tasks/benchmarks/count_in.rb +0 -13
  40. data/tasks/benchmarks/cover.rb +0 -25
  41. data/tasks/benchmarks/delete_in.rb +0 -29
  42. data/tasks/benchmarks/keep_in.rb +0 -29
  43. data/tasks/benchmarks/scan.rb +0 -13
  44. data/tasks/benchmarks/shared.rb +0 -28
  45. data/tasks/benchmarks/used_by.rb +0 -25
  46. data/tasks/benchmarks/z_add.rb +0 -12
  47. data/tasks/benchmarks/z_delete.rb +0 -12
  48. data/tasks/benchmarks/z_merge.rb +0 -15
  49. data/tasks/benchmarks/z_minmax.rb +0 -12
  50. data/tasks/sync_casefold_data.rake +0 -20
  51. data/tasks/sync_predefined_sets.rake +0 -9
  52. data/tasks/sync_ruby_spec.rake +0 -65
@@ -1,95 +1,258 @@
1
1
  class CharacterSet
2
2
  module RubyFallback
3
+ # Set-like methods, backed by a Hash of codepoints (@__hash) and a
4
+ # memoized, sorted Array of its keys (@__keys) that mutators reset.
3
5
  module SetMethods
4
- (Enumerable.instance_methods -
5
- %i[include? member? to_a] +
6
- %i[empty? hash length size]).each do |mthd|
6
+ # Delegate Enumerable methods to the sorted keys Array. This is faster
7
+ # than the Enumerable implementations that go through #each, and it
8
+ # keeps CharacterSet::Pure free of C-implemented methods.
9
+ (Enumerable.instance_methods - %i[each include? member? to_a]).each do |mthd|
7
10
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
8
- def #{mthd}(*args, &block)
9
- @__set.#{mthd}(*args, &block)
11
+ def #{mthd}(...)
12
+ sorted_keys.#{mthd}(...)
10
13
  end
11
14
  RUBY
12
15
  end
13
16
 
14
- %i[< <= <=> > >= === disjoint? include? intersect? member?
15
- proper_subset? proper_superset? subset? superset?].each do |mthd|
16
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
17
- def #{mthd}(enum, &block)
18
- if enum.is_a?(CharacterSet) || enum.is_a?(CharacterSet::Pure)
19
- enum = enum.instance_variable_get(:@__set)
20
- end
21
- @__set.#{mthd}(enum, &block)
22
- end
23
- RUBY
17
+ def each(&block)
18
+ block or return enum_for(__method__) { size }
19
+ sorted_keys.each(&block)
20
+ self
24
21
  end
25
22
 
26
- %i[<< add add? clear delete delete? delete_if each filter! keep_if
27
- reject! select! subtract].each do |mthd|
28
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
29
- def #{mthd}(*args, &block)
30
- result = @__set.#{mthd}(*args, &block)
31
- result.is_a?(Set) ? self : result
32
- end
33
- RUBY
23
+ def to_a(stringify = false)
24
+ stringify ? sorted_keys.map { |cp| cp.chr('utf-8') } : sorted_keys.dup
34
25
  end
35
26
 
36
- %i[& + - ^ | difference intersection union].each do |mthd|
37
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
38
- def #{mthd}(enum, &block)
39
- if enum.respond_to?(:map)
40
- enum = enum.map { |el| el.is_a?(String) ? el.ord : el }
41
- end
42
- self.class.new(@__set.#{mthd}(enum, &block).to_a)
43
- end
44
- RUBY
27
+ def size
28
+ @__hash.size
45
29
  end
30
+ alias length size
46
31
 
47
- unless RUBY_PLATFORM[/java/i]
48
- def freeze
49
- @__set.to_a
50
- @__set.freeze
51
- super
52
- end
32
+ def empty?
33
+ @__hash.empty?
34
+ end
35
+
36
+ def hash
37
+ @__hash.hash
38
+ end
39
+
40
+ def include?(cp)
41
+ @__hash.key?(cp)
42
+ end
43
+ alias member? include?
44
+ alias === include?
45
+
46
+ def add(cp)
47
+ @__hash[cp] = true
48
+ @__keys = nil
49
+ self
50
+ end
51
+ alias << add
52
+
53
+ def add?(cp)
54
+ assert_not_frozen
55
+ add(cp) unless include?(cp)
56
+ end
57
+
58
+ def delete(cp)
59
+ @__keys = nil if @__hash.delete(cp)
60
+ self
61
+ end
62
+
63
+ def delete?(cp)
64
+ assert_not_frozen
65
+ delete(cp) if include?(cp)
66
+ end
67
+
68
+ def clear
69
+ @__hash.clear
70
+ @__keys = nil
71
+ self
72
+ end
73
+
74
+ def keep_if
75
+ assert_not_frozen
76
+ block_given? or return enum_for(__method__) { size }
77
+ old_size = size
78
+ sorted_keys.each { |cp| @__hash.delete(cp) unless yield(cp) }
79
+ @__keys = nil if size != old_size
80
+ self
81
+ end
82
+
83
+ def delete_if
84
+ assert_not_frozen
85
+ block_given? or return enum_for(__method__) { size }
86
+ keep_if { |cp| !yield(cp) }
53
87
  end
54
88
 
55
89
  def merge(other)
90
+ assert_not_frozen
56
91
  raise ArgumentError, 'pass an Enumerable' unless other.respond_to?(:each)
57
- # pass through #add to use the checks in SetMethodAdapters
58
- other.each { |e| add(e) }
92
+
93
+ if (other_hash = codepoint_hash(other))
94
+ # Members of another CharacterSet are valid codepoints already,
95
+ # so they can go in with one Hash#update instead of n adds.
96
+ @__hash.update(other_hash)
97
+ @__keys = nil
98
+ else
99
+ # pass through #add to use the checks in SetMethodAdapters
100
+ other.each { |e| add(e) }
101
+ end
102
+ self
103
+ end
104
+
105
+ # The operands of the following methods are always CharacterSets,
106
+ # ensured by SetMethodAdapters - but they might be C-backed, so
107
+ # only their public interface is used.
108
+
109
+ def subtract(other)
110
+ other.each { |cp| @__hash.delete(cp) }
111
+ @__keys = nil
59
112
  self
60
113
  end
61
114
 
115
+ def |(other)
116
+ dup.merge(other)
117
+ end
118
+ alias + |
119
+ alias union |
120
+
121
+ def -(other)
122
+ dup.subtract(other)
123
+ end
124
+ alias difference -
125
+
126
+ def &(other)
127
+ result = self.class.new
128
+ # Fresh results have no memoized keys yet, so their Hash can be
129
+ # filled directly.
130
+ result_hash = codepoint_hash(result)
131
+ small, large = size < other.size ? [self, other] : [other, self]
132
+ large = lookup(large)
133
+ small.each { |cp| result_hash[cp] = true if large.include?(cp) }
134
+ result
135
+ end
136
+ alias intersection &
137
+
138
+ def ^(other)
139
+ (self | other) - (self & other)
140
+ end
141
+
142
+ def intersect?(other)
143
+ small, large = size < other.size ? [self, other] : [other, self]
144
+ large = lookup(large)
145
+ small.any? { |cp| large.include?(cp) }
146
+ end
147
+
148
+ def disjoint?(other)
149
+ !intersect?(other)
150
+ end
151
+
152
+ def <=>(other)
153
+ return unless character_set?(other)
154
+
155
+ case size <=> other.size
156
+ when -1 then -1 if proper_subset?(other)
157
+ when +1 then +1 if proper_superset?(other)
158
+ else 0 if self == other
159
+ end
160
+ end
161
+
162
+ def subset?(other)
163
+ assert_character_set(other)
164
+ return false if size > other.size
165
+
166
+ other = lookup(other)
167
+ all? { |cp| other.include?(cp) }
168
+ end
169
+ alias <= subset?
170
+
171
+ def proper_subset?(other)
172
+ assert_character_set(other)
173
+ return false if size >= other.size
174
+
175
+ other = lookup(other)
176
+ all? { |cp| other.include?(cp) }
177
+ end
178
+ alias < proper_subset?
179
+
180
+ def superset?(other)
181
+ assert_character_set(other)
182
+ size >= other.size && other.all? { |cp| @__hash.key?(cp) }
183
+ end
184
+ alias >= superset?
185
+
186
+ def proper_superset?(other)
187
+ assert_character_set(other)
188
+ size > other.size && other.all? { |cp| @__hash.key?(cp) }
189
+ end
190
+ alias > proper_superset?
191
+
62
192
  def ==(other)
63
193
  if equal?(other)
64
194
  true
65
- elsif other.instance_of?(self.class)
66
- @__set == other.instance_variable_get(:@__set)
67
- elsif other.is_a?(CharacterSet) || other.is_a?(CharacterSet::Pure)
68
- size == other.size && other.all? { |cp| @__set.include?(cp) }
195
+ elsif (other_hash = codepoint_hash(other))
196
+ @__hash == other_hash
197
+ elsif character_set?(other)
198
+ size == other.size && other.all? { |cp| @__hash.key?(cp) }
69
199
  else
70
200
  false
71
201
  end
72
202
  end
73
203
 
74
204
  def eql?(other)
75
- return false unless other.is_a?(self.class)
205
+ other.is_a?(self.class) && @__hash.eql?(codepoint_hash(other))
206
+ end
76
207
 
77
- @__set.eql?(other.instance_variable_get(:@__set))
208
+ def freeze
209
+ sorted_keys.freeze
210
+ @__hash.freeze
211
+ super
78
212
  end
79
213
 
80
214
  def initialize_dup(orig)
81
215
  super
82
- @__set = orig.instance_variable_get(:@__set).dup
216
+ @__hash = @__hash.dup
217
+ @__keys = nil # dups are usually mutated, so don't bother copying
83
218
  end
84
219
 
85
- def initialize_clone(orig)
220
+ def initialize_clone(orig, freeze: nil)
86
221
  super
87
- @__set = orig.instance_variable_get(:@__set).clone
222
+ @__hash = @__hash.clone(freeze: freeze)
223
+ @__keys = @__keys&.clone(freeze: freeze)
88
224
  end
89
225
 
90
- def to_a(stringify = false)
91
- result = @__set.to_a
92
- stringify ? result.map { |cp| cp.chr('utf-8') } : result
226
+ private
227
+
228
+ def sorted_keys
229
+ @__keys ||= @__hash.keys.sort!
230
+ end
231
+
232
+ def character_set?(obj)
233
+ obj.is_a?(CharacterSet) ||
234
+ defined?(CharacterSet::Pure) && obj.is_a?(CharacterSet::Pure)
235
+ end
236
+
237
+ def assert_character_set(obj)
238
+ character_set?(obj) or raise ArgumentError, 'value must be a set'
239
+ end
240
+
241
+ def assert_not_frozen
242
+ raise FrozenError, "can't modify frozen #{self.class}" if frozen?
243
+ end
244
+
245
+ # The codepoint Hash of another Ruby-backed CharacterSet, or nil if
246
+ # `other` is not a CharacterSet - or is C-backed and so has no Hash.
247
+ def codepoint_hash(other)
248
+ other.instance_variable_get(:@__hash) if character_set?(other)
249
+ end
250
+
251
+ # The cheapest object that answers #include? for the codepoints of
252
+ # `set`: its Hash if it is Ruby-backed, which skips the argument checks
253
+ # of SetMethodAdapters, otherwise the set itself.
254
+ def lookup(set)
255
+ codepoint_hash(set) || set
93
256
  end
94
257
  end
95
258
  end
@@ -2,6 +2,8 @@ require 'character_set/ruby_fallback/set_methods'
2
2
  require 'character_set/ruby_fallback/character_set_methods'
3
3
 
4
4
  class CharacterSet
5
+ # The RubyFallback is used by non-standard Rubies that can't use
6
+ # the C extension. It is tested in the specs via CharacterSet::Pure.
5
7
  module RubyFallback
6
8
  include CharacterSet::RubyFallback::SetMethods
7
9
  include CharacterSet::RubyFallback::CharacterSetMethods
@@ -11,25 +13,9 @@ class CharacterSet
11
13
  end
12
14
 
13
15
  def initialize(enum = [])
14
- @__set = CharacterSet::RubyFallback::SortedSet.new
16
+ @__hash = {}
17
+ @__keys = nil
15
18
  super
16
19
  end
17
20
  end
18
21
  end
19
-
20
- if RUBY_PLATFORM[/java/i]
21
- # JRuby has sorted_set in the stdlib.
22
- require 'set'
23
- CharacterSet::RubyFallback::Set = ::Set
24
- CharacterSet::RubyFallback::SortedSet = ::SortedSet
25
- else
26
- # For other rubies, set/sorted_set are vendored due to dependency issues:
27
- #
28
- # - issues with default vs. installed gems such as [#2]
29
- # - issues with the sorted_set dependency rb_tree
30
- # - long-standing issues in recent versions of sorted_set
31
- #
32
- # The RubyFallback, and thus these set classes, are only used for testing,
33
- # and for exotic rubies which use neither C nor Java.
34
- require 'character_set/ruby_fallback/vendored_set_classes'
35
- end
@@ -82,6 +82,14 @@ class CharacterSet
82
82
  self - self.class.surrogate
83
83
  end
84
84
 
85
+ def marshal_dump
86
+ to_a
87
+ end
88
+
89
+ def marshal_load(data)
90
+ initialize(data)
91
+ end
92
+
85
93
  # CharacterSet-specific stringification methods
86
94
 
87
95
  def to_s(opts = {}, &block)
@@ -164,9 +172,38 @@ class CharacterSet
164
172
  each_with_object({}) { |cp, h| (h[yield(cp)] ||= self.class.new).add(cp) }
165
173
  end
166
174
 
175
+ # Note: Set#divide behavior with a 2-arity block changed in Ruby 4.
176
+ # This implementation has the new, more sensible behavior.
177
+ # https://github.com/ruby/ruby/blob/453a69e/spec/ruby/core/set/divide_spec.rb#L34-L48
167
178
  def divide(&func)
168
- require 'character_set/ruby_fallback'
169
- CharacterSet::RubyFallback::Set.new(to_a).divide(&func)
179
+ func or return enum_for(__method__) { size }
180
+
181
+ klass = defined?(::Set) ? ::Set : ::Array
182
+
183
+ if func.arity == 2
184
+ class << dig = {}
185
+ require 'tsort'
186
+ include TSort
187
+
188
+ alias tsort_each_node each_key
189
+ def tsort_each_child(node, &block)
190
+ fetch(node).each(&block)
191
+ end
192
+ end
193
+
194
+ each do |cp|
195
+ dig[cp] = arr = []
196
+ each { |cp2| arr << cp2 if cp != cp2 && func.call(cp, cp2) }
197
+ end
198
+
199
+ set = klass.new
200
+ dig.each_strongly_connected_component do |css|
201
+ set << self.class.new(css)
202
+ end
203
+ set
204
+ else
205
+ klass.new(classify(&func).values)
206
+ end
170
207
  end
171
208
 
172
209
  def join(separator = '')
@@ -1,3 +1,3 @@
1
1
  class CharacterSet
2
- VERSION = '1.8.0'
2
+ VERSION = '1.9.0'
3
3
  end
@@ -4,7 +4,7 @@ class CharacterSet
4
4
  def write(codepoint_ranges, opts = {}, &block)
5
5
  content = codepoint_ranges.map do |range|
6
6
  if range.size > 2 && opts[:abbreviate] != false
7
- bounds = [range.min, range.max]
7
+ bounds = [range.min, range.max] # minmax is slow on some rubies
8
8
  bounds.map { |cp| write_codepoint(cp, opts, &block) }.join('-')
9
9
  else
10
10
  range.map { |cp| write_codepoint(cp, opts, &block) }.join
data/lib/character_set.rb CHANGED
@@ -7,9 +7,14 @@ require 'character_set/shared_methods'
7
7
  require 'character_set/version'
8
8
  require 'character_set/writer'
9
9
 
10
+ # A set of Unicode codepoints with engine-specific storage backends.
10
11
  class CharacterSet
11
12
  begin
12
- require 'character_set/character_set'
13
+ if RUBY_ENGINE == 'jruby'
14
+ require 'character_set/java'
15
+ else
16
+ require 'character_set/character_set' # C extension
17
+ end
13
18
  rescue LoadError
14
19
  require 'character_set/ruby_fallback'
15
20
  prepend RubyFallback
metadata CHANGED
@@ -1,16 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: character_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janosch Müller
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description:
14
12
  email:
15
13
  - janosch84@gmail.com
16
14
  executables: []
@@ -18,33 +16,23 @@ extensions:
18
16
  - ext/character_set/extconf.rb
19
17
  extra_rdoc_files: []
20
18
  files:
21
- - ".gitattributes"
22
- - ".github/workflows/gouteur.yml"
23
- - ".github/workflows/lint.yml"
24
- - ".github/workflows/tests.yml"
25
- - ".gitignore"
26
- - ".gouteur.yml"
27
- - ".rspec"
28
19
  - ".rubocop.yml"
29
- - BENCHMARK.md
30
20
  - CHANGELOG.md
31
- - Gemfile
32
21
  - LICENSE.txt
33
22
  - README.md
34
23
  - Rakefile
35
- - bin/console
36
- - bin/setup
37
- - character_set.gemspec
38
24
  - ext/character_set/character_set.c
39
25
  - ext/character_set/extconf.rb
40
- - ext/character_set/unicode_casefold_table.h
41
- - ext/character_set/unicode_casefold_table.h.tmpl
26
+ - ext/character_set/java/src/main/java/org/jaynetics/characterset/CharacterSetService.java
27
+ - ext/character_set/java/src/main/java/org/jaynetics/characterset/RubyCharacterSet.java
28
+ - ext/character_set/java/src/main/java/org/jaynetics/characterset/StringOperations.java
42
29
  - lib/character_set.rb
43
30
  - lib/character_set/character.rb
44
31
  - lib/character_set/core_ext.rb
45
32
  - lib/character_set/core_ext/regexp_ext.rb
46
33
  - lib/character_set/core_ext/string_ext.rb
47
34
  - lib/character_set/expression_converter.rb
35
+ - lib/character_set/java.rb
48
36
  - lib/character_set/parser.rb
49
37
  - lib/character_set/predefined_sets.rb
50
38
  - lib/character_set/predefined_sets/any.cps
@@ -67,31 +55,14 @@ files:
67
55
  - lib/character_set/ruby_fallback.rb
68
56
  - lib/character_set/ruby_fallback/character_set_methods.rb
69
57
  - lib/character_set/ruby_fallback/set_methods.rb
70
- - lib/character_set/ruby_fallback/vendored_set_classes.rb
71
58
  - lib/character_set/set_method_adapters.rb
72
59
  - lib/character_set/shared_methods.rb
73
60
  - lib/character_set/version.rb
74
61
  - lib/character_set/writer.rb
75
- - tasks/benchmark.rake
76
- - tasks/benchmarks/count_in.rb
77
- - tasks/benchmarks/cover.rb
78
- - tasks/benchmarks/delete_in.rb
79
- - tasks/benchmarks/keep_in.rb
80
- - tasks/benchmarks/scan.rb
81
- - tasks/benchmarks/shared.rb
82
- - tasks/benchmarks/used_by.rb
83
- - tasks/benchmarks/z_add.rb
84
- - tasks/benchmarks/z_delete.rb
85
- - tasks/benchmarks/z_merge.rb
86
- - tasks/benchmarks/z_minmax.rb
87
- - tasks/sync_casefold_data.rake
88
- - tasks/sync_predefined_sets.rake
89
- - tasks/sync_ruby_spec.rake
90
62
  homepage: https://github.com/jaynetics/character_set
91
63
  licenses:
92
64
  - MIT
93
65
  metadata: {}
94
- post_install_message:
95
66
  rdoc_options: []
96
67
  require_paths:
97
68
  - lib
@@ -99,15 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
70
  requirements:
100
71
  - - ">="
101
72
  - !ruby/object:Gem::Version
102
- version: 2.1.0
73
+ version: 3.0.0
103
74
  required_rubygems_version: !ruby/object:Gem::Requirement
104
75
  requirements:
105
76
  - - ">="
106
77
  - !ruby/object:Gem::Version
107
78
  version: '0'
108
79
  requirements: []
109
- rubygems_version: 3.5.0.dev
110
- signing_key:
80
+ rubygems_version: 4.0.3
111
81
  specification_version: 4
112
82
  summary: Build, read, write and compare sets of Unicode codepoints.
113
83
  test_files: []
data/.gitattributes DELETED
@@ -1,3 +0,0 @@
1
- *.cps linguist-detectable=false
2
- benchmarks/* linguist-detectable=false
3
- spec/* linguist-detectable=false
@@ -1,20 +0,0 @@
1
- name: gouteur
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
-
9
- steps:
10
- - uses: actions/checkout@v2
11
- - name: Set up Ruby
12
- uses: ruby/setup-ruby@v1
13
- with:
14
- ruby-version: 3.3
15
- - name: Prepare
16
- run: |
17
- bundle install --jobs 4
18
- bundle exec rake compile
19
- - name: Test
20
- run: bundle exec gouteur
@@ -1,29 +0,0 @@
1
- # based on https://github.com/rails/rails/blob/4a78dcb/.github/workflows/rubocop.yml
2
-
3
- name: rubocop linting
4
-
5
- on: [push, pull_request]
6
-
7
- jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
-
11
- steps:
12
- - uses: actions/checkout@v2
13
- - name: Set up Ruby
14
- uses: ruby/setup-ruby@v1
15
- with:
16
- ruby-version: 3.3
17
- - name: Cache gems
18
- uses: actions/cache@v1
19
- with:
20
- path: vendor/bundle
21
- key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
22
- restore-keys: |
23
- ${{ runner.os }}-rubocop-
24
- - name: Install gems
25
- run: |
26
- bundle config path vendor/bundle
27
- bundle install --jobs 4 --retry 3
28
- - name: Run rubocop
29
- run: bundle exec rubocop --lint
@@ -1,28 +0,0 @@
1
- name: tests
2
-
3
- on:
4
- push:
5
- pull_request:
6
- schedule:
7
- - cron: '11 11 14 * *' # at 11:11 am on the 14th of every month
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
-
13
- strategy:
14
- matrix:
15
- ruby: [ '2.4', '2.7', '3.0', '3.1', '3.2', '3.3', 'ruby-head', 'jruby-head' ]
16
-
17
- steps:
18
- - uses: actions/checkout@v2
19
- - name: Set up Ruby ${{ matrix.ruby }}
20
- uses: ruby/setup-ruby@v1
21
- with:
22
- ruby-version: ${{ matrix.ruby }}
23
- - name: Install dependencies
24
- run: bundle install --jobs 4
25
- - name: Test with Rake
26
- run: bundle exec rake
27
- - uses: codecov/codecov-action@v3
28
- if: matrix.ruby == '3.2'
data/.gitignore DELETED
@@ -1,33 +0,0 @@
1
- *.bundle
2
- *.gem
3
- *.iml
4
- *.stTheme.cache
5
- *.sublime-project
6
- *.sublime-workspace
7
- *.swp
8
- *.tmlanguage.cache
9
- *.tmPreferences.cache
10
- *~
11
- .byebug_history
12
- .DS_Store
13
- .idea/
14
- .ruby-gemset
15
- .ruby-version
16
- .tags
17
- .tags1
18
- .tool-versions
19
- .vscode
20
- bbin/
21
- binstubs/*
22
- bundler_stubs/*/.yardoc
23
- Gemfile.lock
24
- /.bundle/
25
- /_yardoc/
26
- /coverage/
27
- /doc/
28
- /pkg/
29
- /spec/reports/
30
- /tmp/
31
-
32
- # rspec failure tracking
33
- .rspec_status
data/.gouteur.yml DELETED
@@ -1,2 +0,0 @@
1
- repos:
2
- - uri: https://github.com/jaynetics/js_regex
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper