nerd_dice 0.2.1 → 0.3.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: 88266e9421830d581588170f03cab85b95f95b0f3727c943ae36aa590c6ef338
4
- data.tar.gz: 98e7fdc98609de1776400f3b4e8d04bbeff92fb0ef06814c06c967abcfd68a48
3
+ metadata.gz: fa0fb8eebb2386727cce81ce7a3c301599322a3531db13f01329aa26225c88b3
4
+ data.tar.gz: 205640e5b275ae107e0c2ee0ff1c10b777782f21c7a3c0ae7a5aac98e27f4841
5
5
  SHA512:
6
- metadata.gz: 8e0622aaeee447750ab14395eae84241ced009ff12986c29cb44c903669c7d0e5caed1916dd9693db1fc6da9c9af67bbe9ce2c845f9fa17d85c6a9614e9d9d2b
7
- data.tar.gz: c9b50c852027d64160a294aaca650ab882423984a8e79159214dc1ec5e8dd5ce7daa3b13507c616b2c8f218f1ade1f752890080ce7e16b52922992d3c8d49b51
6
+ metadata.gz: 0d275950feb1506a5a7602450690dab697c0ccd35b8d85a0869c4675c2dd714c85d2c744854ac7f69c7f204b1e55ecbf7e80f9209eb672ef4705d15fdbd10fd7
7
+ data.tar.gz: fb8d5aa2297ecbf722b9242caf2680272a502d801dbd94fd53c6bd359a21a50e6e0e1096a5c5518a25a9ef842609c6db0af7c6b5273f4a1fd2e4f2f6089d393e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby-version: ['3.0', '3.1', '3.2']
17
+ ruby-version: ['2.7', '3.0']
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -39,7 +39,7 @@ jobs:
39
39
  - name: Set up Ruby
40
40
  uses: ruby/setup-ruby@v1
41
41
  with:
42
- ruby-version: '3.2'
42
+ ruby-version: '3.0'
43
43
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44
44
  - name: Run rubocop
45
45
  run: bundle exec rubocop --parallel
@@ -51,7 +51,7 @@ jobs:
51
51
  - name: Set up Ruby
52
52
  uses: ruby/setup-ruby@v1
53
53
  with:
54
- ruby-version: '3.2'
54
+ ruby-version: '3.0'
55
55
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
56
56
  - name: Run benchmark script
57
57
  run: bin/nerd_dice_benchmark
data/.rubocop.yml CHANGED
@@ -1,11 +1,3 @@
1
- # RuboCop configuration file for NerdDice gem
2
- #
3
- # This is the RuboCop configuration for the gem. By default new cops are enabled
4
- # by default when the RuboCop gems are updated in the bundle. Before the would
5
- # show up as warnings until they were added to the configuration file. Now they
6
- # will be enabled by default, and a case-by-case descision can be made whether
7
- # to exclude new violations in the configuration explicitly or update the
8
- # codebase to the gem to conform to the new standard.
9
1
  require:
10
2
  - rubocop-performance
11
3
  - rubocop-rake
@@ -16,12 +8,14 @@ AllCops:
16
8
  # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
17
9
  # to ignore them, so only the ones explicitly set in this file are enabled.
18
10
  #DisabledByDefault: true
19
-
20
- # New cops are now enabled by default as of 2023-02-20
21
- NewCops: enable
22
11
  Exclude:
23
12
  - '**/templates/**/*'
24
13
  - '**/vendor/**/*'
14
+ - 'node_modules/**/*'
15
+
16
+ Performance:
17
+ Exclude:
18
+ - '**/test/**/*'
25
19
 
26
20
  # Prefer &&/|| over and/or.
27
21
  Style/AndOr:
@@ -117,6 +111,15 @@ Style/MethodDefParentheses:
117
111
  Style/FrozenStringLiteralComment:
118
112
  Enabled: true
119
113
  EnforcedStyle: always
114
+ Exclude:
115
+ - 'actionview/test/**/*.builder'
116
+ - 'actionview/test/**/*.ruby'
117
+ - 'actionpack/test/**/*.builder'
118
+ - 'actionpack/test/**/*.ruby'
119
+ - 'activestorage/db/migrate/**/*.rb'
120
+ - 'activestorage/db/update_migrate/**/*.rb'
121
+ - 'actionmailbox/db/migrate/**/*.rb'
122
+ - 'actiontext/db/migrate/**/*.rb'
120
123
 
121
124
  Style/RedundantFreeze:
122
125
  Enabled: true
@@ -188,6 +191,30 @@ Lint/UselessAssignment:
188
191
  Lint/DeprecatedClassMethods:
189
192
  Enabled: true
190
193
 
194
+ Lint/DuplicateBranch: # (new in 1.3)
195
+ Enabled: true
196
+
197
+ Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
198
+ Enabled: true
199
+
200
+ Lint/EmptyBlock: # (new in 1.1)
201
+ Enabled: true
202
+
203
+ Lint/EmptyClass: # (new in 1.3)
204
+ Enabled: true
205
+
206
+ Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
207
+ Enabled: true
208
+
209
+ Lint/ToEnumArguments: # (new in 1.1)
210
+ Enabled: true
211
+
212
+ Lint/UnexpectedBlockArity: # (new in 1.5)
213
+ Enabled: true
214
+
215
+ Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
216
+ Enabled: true
217
+
191
218
  Style/ParenthesesAroundCondition:
192
219
  Enabled: true
193
220
 
@@ -209,6 +236,27 @@ Style/ColonMethodCall:
209
236
  Style/TrivialAccessors:
210
237
  Enabled: true
211
238
 
239
+ Style/ArgumentsForwarding: # (new in 1.1)
240
+ Enabled: true
241
+
242
+ Style/CollectionCompact: # (new in 1.2)
243
+ Enabled: true
244
+
245
+ Style/DocumentDynamicEvalDefinition: # (new in 1.1)
246
+ Enabled: true
247
+
248
+ Style/NegatedIfElseCondition: # (new in 1.2)
249
+ Enabled: true
250
+
251
+ Style/NilLambda: # (new in 1.3)
252
+ Enabled: true
253
+
254
+ Style/RedundantArgument: # (new in 1.4)
255
+ Enabled: true
256
+
257
+ Style/SwapValues: # (new in 1.1)
258
+ Enabled: true
259
+
212
260
  Performance/FlatMap:
213
261
  Enabled: true
214
262
 
@@ -227,9 +275,128 @@ Performance/RegexpMatch:
227
275
  Performance/UnfreezeString:
228
276
  Enabled: true
229
277
 
278
+ Performance/AncestorsInclude: # (new in 1.7)
279
+ Enabled: true
280
+
281
+ Performance/BigDecimalWithNumericArgument: # (new in 1.7)
282
+ Enabled: true
283
+
284
+ Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
285
+ Enabled: true
286
+
287
+ Performance/CollectionLiteralInLoop: # (new in 1.8)
288
+ Enabled: true
289
+
290
+ Performance/ConstantRegexp: # (new in 1.9)
291
+ Enabled: true
292
+
293
+ Performance/MethodObjectAsBlock: # (new in 1.9)
294
+ Enabled: true
295
+
296
+ Performance/RedundantSortBlock: # (new in 1.7)
297
+ Enabled: true
298
+
299
+ Performance/RedundantStringChars: # (new in 1.7)
300
+ Enabled: true
301
+
302
+ Performance/ReverseFirst: # (new in 1.7)
303
+ Enabled: true
304
+
305
+ Performance/SortReverse: # (new in 1.7)
306
+ Enabled: true
307
+
308
+ Performance/Squeeze: # (new in 1.7)
309
+ Enabled: true
310
+
311
+ Performance/StringInclude: # (new in 1.7)
312
+ Enabled: true
313
+
314
+ Performance/Sum: # (new in 1.8)
315
+ Enabled: true
316
+
317
+ Layout/SpaceBeforeBrackets: # (new in 1.7)
318
+ Enabled: true
319
+
320
+ Lint/AmbiguousAssignment: # (new in 1.7)
321
+ Enabled: true
322
+
323
+ Lint/DeprecatedConstants: # (new in 1.8)
324
+ Enabled: true
325
+
326
+ Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
327
+ Enabled: true
328
+
329
+ Lint/RedundantDirGlobSort: # (new in 1.8)
330
+ Enabled: true
331
+
332
+ Style/EndlessMethod: # (new in 1.8)
333
+ Enabled: true
334
+
335
+ Style/HashExcept: # (new in 1.7)
336
+ Enabled: true
337
+
338
+ # Added 2021-08-14
339
+ Gemspec/DateAssignment: # (new in 1.10)
340
+ Enabled: true
341
+
342
+ Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
343
+ Enabled: true
344
+
345
+ Lint/EmptyInPattern: # (new in 1.16)
346
+ Enabled: true
347
+
348
+ Lint/NumberedParameterAssignment: # (new in 1.9)
349
+ Enabled: true
350
+
351
+ Lint/OrAssignmentToConstant: # (new in 1.9)
352
+ Enabled: true
353
+
354
+ Lint/SymbolConversion: # (new in 1.9)
355
+ Enabled: true
356
+
357
+ Lint/TripleQuotes: # (new in 1.9)
358
+ Enabled: true
359
+
360
+ Naming/InclusiveLanguage: # (new in 1.18)
361
+ Enabled: false
362
+
363
+ Style/HashConversion: # (new in 1.10)
364
+ Enabled: true
365
+
366
+ Style/IfWithBooleanLiteralBranches: # (new in 1.9)
367
+ Enabled: true
368
+
369
+ Style/InPatternThen: # (new in 1.16)
370
+ Enabled: true
371
+
372
+ Style/MultilineInPatternThen: # (new in 1.16)
373
+ Enabled: true
374
+
375
+ Style/QuotedSymbols: # (new in 1.16)
376
+ Enabled: true
377
+
378
+ Style/StringChars: # (new in 1.12)
379
+ Enabled: true
380
+
381
+ Performance/MapCompact: # (new in 1.11)
382
+ Enabled: true
383
+
384
+ Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
385
+ Enabled: true
386
+
387
+ Performance/RedundantSplitRegexpArgument: # (new in 1.10)
388
+ Enabled: true
389
+
390
+ RSpec/IdenticalEqualityAssertion: # (new in 2.4)
391
+ Enabled: true
392
+
393
+ RSpec/Rails/AvoidSetupHook: # (new in 2.4)
394
+ Enabled: true
395
+
230
396
  RSpec/MessageSpies:
231
397
  EnforcedStyle: receive
232
398
 
233
- # Disable inclusive language cop. None of RuboCop's business
234
- Naming/InclusiveLanguage:
235
- Enabled: false
399
+ Lint/AmbiguousRange: # new in 1.19
400
+ Enabled: true
401
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
402
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,8 +1,70 @@
1
1
  # Nerd Dice Changelog
2
2
 
3
- <img src="https://i.kym-cdn.com/photos/images/newsfeed/000/186/610/thankyou.png?1318726198" alt="Our CHANGELOG is in another castle" />
3
+ ## master \(unreleased\)
4
+ ### Added
5
+ ### Changed
6
+ ### Fixed
4
7
 
5
- ## Legacy Branch: See master
6
- This is a legacy maintenance branch.
8
+ ## 0.3.0 \(2021-09-11\)
9
+ ### Added
10
+ * Add new options to `NerdDice::Configuration`
11
+ - `ability_score_number_of_sides`
12
+ - `ability_score_dice_rolled`
13
+ - `ability_score_dice_kept`
14
+ * Add `NerdDice.harvest_totals` method that takes in a collection and returns the results of calling `total` on each element
15
+ * Add `NerdDice.roll_ability_scores` convenience method that returns an array of `DiceSet` objects based on options and/or configuration
16
+ * Add `NerdDice.total_ability_scores` convenience method that returns an array of integers based on options and/or configuration
17
+ * Add `NerdDice::Die` class that represents a single die object and mixes in the `Comparable` module
18
+ * Add `NerdDice::DiceSet` class that represents a collection of `Die` objects and mixes in the `Enumerable` module
19
+ * Add `NerdDice::SetsRandomizationTechnique` mixin module and include in the `DiceSet` and `Die` classes
20
+ * Add `die_background_color` and `die_foreground_color` to `Configuration` class with defaults defined as constants
21
+ * Add `NerdDice.roll_dice` method that behaves in a similar fashion to `total_dice` but returns a `DiceSet` object instead of an `Integer` and has additional optional arguments relating to the non-numeric attributes of the dice
22
+ * Add `coveralls_reborn` to RSpec and GitHub actions
23
+ * Add build badge to README
24
+ * Add Code Climate maintainability integration and badge to README
25
+ * Add `nerd_dice_benchmark` script to bin directory
26
+ * Add GitHub Action CI build
27
+ - Run RSpec test suite, fail if specs fail, report coverage via Coveralls
28
+ - Run RuboCop and fail if violations
29
+ - Run benchmark suite and fail if outside of allowed ratios
30
+ ### Changed
31
+ * Update RuboCop version and configuration
32
+ * Break up the NerdDice source code file into several smaller files that are included by the module
33
+ * Enforce that `NerdDice.configuration.ability_score_array_size` must be a positive duck-type integer
34
+ ### Fixed
7
35
 
8
- The [authoritative version of the CHANGELOG](https://github.com/statelesscode/nerd_dice/blob/master/CHANGELOG.md) is found on the master branch. All other release and maintenance branches are updated to point to master after being created.
36
+ ## 0.2.0 \(2021-01-28\)
37
+ ### Added
38
+ * Add ability to configure with `NerdDice.configure` block or `NerdDice.configuration`
39
+ - Configure `randomization_technique` as `:random_rand`, `:securerandom`, `:random_object`, or `randomized`
40
+ - Configure `refresh_seed_interval` to allow a periodic refresh of the seed
41
+ * Add `randomization_technique` option to `NerdDice.total_dice` method keyword arguments
42
+ * Add a lower-level `execute_die_roll` method that allows you to roll a single die with a generator specified
43
+ * Add ability to manually refresh or specify seed with `:refresh_seed!` method
44
+ ### Changed
45
+ * Change `opts = {}` final argument to use keyword args `**opts` in the `NerdDice.total_dice` method. Now the method can be called as follows:
46
+ ```ruby
47
+ # old
48
+ NerdDice.total_dice(20, 1, {bonus: 5})
49
+ NerdDice.total_dice(6, 3, {bonus: 1})
50
+
51
+ # new
52
+ NerdDice.total_dice(20, bonus: 5)
53
+ NerdDice.total_dice(6, 3, bonus: 1)
54
+ ```
55
+ * Call `:to_i` on bonus instead of using `:is_a?` and raise ArgumentError in the `NerdDice.total_dice` method if it doesn't respond to `:to_i`
56
+ * Added `securerandom` as an explicit dependency due to Ruby 3.x change to bundled gem
57
+ * `total_dice` no longer calls unqualified `.rand` which improves performance on all generators except for `:securerandom`
58
+ ### Fixed
59
+
60
+ ## 0.1.1 \(2020-12-12\)
61
+ ### Added
62
+ ### Changed
63
+ ### Fixed
64
+ * Fix broken link to CHANGELOG in gemspec
65
+ * Fix rubocop offenses from 0.1.0 and refactor specs
66
+
67
+ ## 0.1.0 \(2020-12-07\)
68
+
69
+ ### Added
70
+ * Add NerdDice.total_dice class method with the ability to roll multiple polyhedral dice and add a bonus
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in nerd_dice.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
9
- gem "rspec", "~> 3.12"
8
+ gem "rake", "~> 12.0"
9
+ gem "rspec", "~> 3.0"
data/Gemfile.lock CHANGED
@@ -1,92 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nerd_dice (0.2.1)
5
- securerandom (~> 0.2, >= 0.2.2)
4
+ nerd_dice (0.3.0)
5
+ securerandom (~> 0.1, >= 0.1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
- coveralls_reborn (0.27.0)
12
- simplecov (~> 0.22.0)
13
- term-ansicolor (~> 1.7)
14
- thor (~> 1.2)
15
- tins (~> 1.32)
16
- diff-lcs (1.5.0)
11
+ coveralls_reborn (0.22.0)
12
+ simplecov (>= 0.18.1, < 0.22.0)
13
+ term-ansicolor (~> 1.6)
14
+ thor (>= 0.20.3, < 2.0)
15
+ tins (~> 1.16)
16
+ diff-lcs (1.4.4)
17
17
  docile (1.4.0)
18
- json (2.6.3)
19
- parallel (1.22.1)
20
- parser (3.2.1.0)
18
+ parallel (1.20.1)
19
+ parser (3.0.2.0)
21
20
  ast (~> 2.4.1)
22
- rainbow (3.1.1)
23
- rake (13.0.6)
24
- regexp_parser (2.7.0)
21
+ rainbow (3.0.0)
22
+ rake (12.3.3)
23
+ regexp_parser (2.1.1)
25
24
  rexml (3.2.5)
26
- rspec (3.12.0)
27
- rspec-core (~> 3.12.0)
28
- rspec-expectations (~> 3.12.0)
29
- rspec-mocks (~> 3.12.0)
30
- rspec-core (3.12.1)
31
- rspec-support (~> 3.12.0)
32
- rspec-expectations (3.12.2)
25
+ rspec (3.10.0)
26
+ rspec-core (~> 3.10.0)
27
+ rspec-expectations (~> 3.10.0)
28
+ rspec-mocks (~> 3.10.0)
29
+ rspec-core (3.10.1)
30
+ rspec-support (~> 3.10.0)
31
+ rspec-expectations (3.10.1)
33
32
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.12.0)
35
- rspec-mocks (3.12.3)
33
+ rspec-support (~> 3.10.0)
34
+ rspec-mocks (3.10.2)
36
35
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.12.0)
38
- rspec-support (3.12.0)
39
- rubocop (1.46.0)
40
- json (~> 2.3)
36
+ rspec-support (~> 3.10.0)
37
+ rspec-support (3.10.2)
38
+ rubocop (1.20.0)
41
39
  parallel (~> 1.10)
42
- parser (>= 3.2.0.0)
40
+ parser (>= 3.0.0.0)
43
41
  rainbow (>= 2.2.2, < 4.0)
44
42
  regexp_parser (>= 1.8, < 3.0)
45
- rexml (>= 3.2.5, < 4.0)
46
- rubocop-ast (>= 1.26.0, < 2.0)
43
+ rexml
44
+ rubocop-ast (>= 1.9.1, < 2.0)
47
45
  ruby-progressbar (~> 1.7)
48
- unicode-display_width (>= 2.4.0, < 3.0)
49
- rubocop-ast (1.26.0)
50
- parser (>= 3.2.1.0)
51
- rubocop-capybara (2.17.1)
52
- rubocop (~> 1.41)
53
- rubocop-performance (1.16.0)
46
+ unicode-display_width (>= 1.4.0, < 3.0)
47
+ rubocop-ast (1.11.0)
48
+ parser (>= 3.0.1.1)
49
+ rubocop-performance (1.11.5)
54
50
  rubocop (>= 1.7.0, < 2.0)
55
51
  rubocop-ast (>= 0.4.0)
56
52
  rubocop-rake (0.6.0)
57
53
  rubocop (~> 1.0)
58
- rubocop-rspec (2.18.1)
59
- rubocop (~> 1.33)
60
- rubocop-capybara (~> 2.17)
54
+ rubocop-rspec (2.4.0)
55
+ rubocop (~> 1.0)
56
+ rubocop-ast (>= 1.1.0)
61
57
  ruby-progressbar (1.11.0)
62
- securerandom (0.2.2)
63
- simplecov (0.22.0)
58
+ securerandom (0.1.0)
59
+ simplecov (0.21.2)
64
60
  docile (~> 1.1)
65
61
  simplecov-html (~> 0.11)
66
62
  simplecov_json_formatter (~> 0.1)
67
63
  simplecov-html (0.12.3)
68
64
  simplecov-lcov (0.8.0)
69
- simplecov_json_formatter (0.1.4)
65
+ simplecov_json_formatter (0.1.3)
70
66
  sync (0.5.0)
71
67
  term-ansicolor (1.7.1)
72
68
  tins (~> 1.0)
73
- thor (1.2.1)
74
- tins (1.32.1)
69
+ thor (1.1.0)
70
+ tins (1.29.1)
75
71
  sync
76
- unicode-display_width (2.4.2)
72
+ unicode-display_width (2.0.0)
77
73
 
78
74
  PLATFORMS
79
75
  ruby
80
76
 
81
77
  DEPENDENCIES
82
- coveralls_reborn (~> 0.27.0)
78
+ coveralls_reborn (~> 0.22.0)
83
79
  nerd_dice!
84
- rake (~> 13.0)
85
- rspec (~> 3.12)
86
- rubocop (~> 1.46, >= 1.46.0)
87
- rubocop-performance (~> 1.16, >= 1.16.0)
80
+ rake (~> 12.0)
81
+ rspec (~> 3.0)
82
+ rubocop (~> 1.20, >= 1.20.0)
83
+ rubocop-performance (~> 1.11, >= 1.11.5)
88
84
  rubocop-rake (~> 0.6, >= 0.6.0)
89
- rubocop-rspec (~> 2.18, >= 2.18.1)
85
+ rubocop-rspec (~> 2.4, >= 2.4.0)
90
86
  simplecov-lcov (~> 0.8.0)
91
87
 
92
88
  BUNDLED WITH