games_dice 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c1046747fdad80e794bb7883aaaade1a14e737a39641b6e85e7c179e96a3375
4
+ data.tar.gz: 54b1c1aa41b58b53e8a72ad59f835de932fde926a038626a0df165605677300c
5
+ SHA512:
6
+ metadata.gz: 60e56aa2b32a4550ae6334c372ad1a9b0a07820c8a58ae4ce07c0ae3d5721ff91b8422d3d2d52b690e387738d3ee5bb6a7c05bed2d40145b776ef9a9d6295c0c
7
+ data.tar.gz: 7a0e7c3759def3b6f482e4242ae23b770c50876fc26f5464bca4e77b91cbf64596c901c4eb9cc69e9eee351d63fa8978426ceae7125eb34aa7c3e0856a0a8e1e
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6.0
3
+ NewCops: enable
4
+
5
+ Layout/LineLength:
6
+ Max: 120
7
+
8
+ Metrics/BlockLength:
9
+ IgnoredMethods:
10
+ - context
11
+ - describe
12
+ - shared_examples
13
+ - define
14
+
15
+
data/.travis.yml CHANGED
@@ -1,14 +1,11 @@
1
1
  language: ruby
2
+
3
+ before_install:
4
+ - gem install bundler
5
+
6
+ os:
7
+ - linux
8
+
2
9
  rvm:
3
- - "1.8.7"
4
- - "1.9.3"
5
- - "2.0.0"
6
- - rbx-18mode
7
- - rbx-19mode
8
- - ree
9
- - jruby-18mode
10
- - jruby-19mode
11
- - jruby-head
12
- allow_failures:
13
- rvm:
14
- - ruby-head
10
+ - "2.7.1"
11
+ - "3.0.0"
data/CHANGELOG.md CHANGED
@@ -1,59 +1,75 @@
1
1
  # GamesDice Changelog
2
2
 
3
- ## 0.3.9
3
+ ## 0.4.0 ( 19 September 2021 )
4
+
5
+ * Dropping support for older Ruby versions (< 2.6)
6
+ * Native extensions are no longer optional, to reduce maintenance overhead. Effectively dropping support for JRuby.
7
+ * Tidy up code for maintainability (Rubocop and RSpec)
8
+
9
+ ## 0.3.11 ( 26 May 2014 )
10
+
11
+ * Bugfix. Actually use custom PRNG passed to GamesDice.create or GamesDice::Bunch.new
12
+ * Dropping support for Ruby 1.8.* versions (it may still work if you restrict parslet version)
13
+
14
+ ## 0.3.10 ( 29 July 2013 )
15
+
16
+ * Non-functional changes to improve code quality metrics on CodeClimate
17
+ * Altered specs to improve accuracy of coverage metrics on Coveralls
18
+
19
+ ## 0.3.9 ( 23 July 2013 )
4
20
 
5
21
  * New methods for inspecting and iterating over potential values in GamesDice::Die
6
22
  * Code metric integration and badges for github
7
23
  * Non-functional changes to improve code quality metrics on CodeClimate
8
24
 
9
- ## 0.3.7
25
+ ## 0.3.7 ( 17 July 2013 )
10
26
 
11
27
  * Compatibility between pure Ruby and native extension code when handling bad method params
12
28
  * Added this changelog to documentation
13
29
 
14
- ## 0.3.6
30
+ ## 0.3.6 ( 15 July 2013 )
15
31
 
16
32
  * Extension building skipped, with fallback to pure Ruby, for JRuby compatibility
17
33
 
18
- ## 0.3.5
34
+ ## 0.3.5 ( 14 July 2013 )
19
35
 
20
36
  * Adjust C code to avoid warnings about C90 compatibility (warnings seen on Travis)
21
37
  * Note MIT license in gemspec
22
38
  * Add class method GamesDice::Probabilities.implemented_in
23
39
 
24
- ## 0.3.3
40
+ ## 0.3.3 ( 11 July 2013 )
25
41
 
26
42
  * Standardised code for Ruby 1.8.7 compatibility in GamesDice::Probabilities
27
43
  * Bug fix for probability calculations where distributions are added with mulipliers e.g. '2d6 - 1d8'
28
44
 
29
- ## 0.3.2
45
+ ## 0.3.2 ( 10 July 2013 )
30
46
 
31
47
  * Bug fix for Ruby 1.8.7 compatibility in GamesDice::Probabilities
32
48
 
33
- ## 0.3.1
49
+ ## 0.3.1 ( 10 July 2013 )
34
50
 
35
51
  * Bug fix for Ruby 1.8.7 compatibility in GamesDice::Probabilities
36
52
 
37
- ## 0.3.0
53
+ ## 0.3.0 ( 10 July 2013 )
38
54
 
39
55
  * Implemented GamesDice::Probabilities as native extension
40
56
 
41
- ## 0.2.4
57
+ ## 0.2.4 ( 18 June 2013 )
42
58
 
43
59
  * Minor speed improvements to GamesDice::Probabilities
44
60
 
45
- ## 0.2.3
61
+ ## 0.2.3 ( 12 June 2013 )
46
62
 
47
63
  * More YARD documentation
48
64
 
49
- ## 0.2.2
65
+ ## 0.2.2 ( 10 June 2013 )
50
66
 
51
67
  * Extended YARD documentation
52
68
 
53
- ## 0.2.1
69
+ ## 0.2.1 ( 5 June 2013 )
54
70
 
55
71
  * Started basic YARD documentation
56
72
 
57
- ## 0.2.0
73
+ ## 0.2.0 ( 30 May 2013 )
58
74
 
59
75
  * First version with a complete feature set
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Dependencies are in games_dice.gemspec
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/games_dice.png)](http://badge.fury.io/rb/games_dice)
3
3
  [![Build Status](https://travis-ci.org/neilslater/games_dice.png?branch=master)](http://travis-ci.org/neilslater/games_dice)
4
4
  [![Coverage Status](https://coveralls.io/repos/neilslater/games_dice/badge.png?branch=master)](https://coveralls.io/r/neilslater/games_dice?branch=master)
5
+ [![Inline docs](http://inch-ci.org/github/neilslater/games_dice.png?branch=master)](http://inch-ci.org/github/neilslater/games_dice)
5
6
  [![Code Climate](https://codeclimate.com/github/neilslater/games_dice.png)](https://codeclimate.com/github/neilslater/games_dice)
6
7
  [![Dependency Status](https://gemnasium.com/neilslater/games_dice.png)](https://gemnasium.com/neilslater/games_dice)
7
8
 
@@ -29,12 +30,11 @@ gem as-is, and add them as features within your project code.
29
30
 
30
31
  ## Supported Ruby Versions
31
32
 
32
- GamesDice is tested routinely on
33
+ GamesDice is tested routinely on MRI Rubies 1.9.3, 2.0.0, 2.1.0, 2.1.1 and JRuby, and the
34
+ "build passing" badge is based on those tests.
33
35
 
34
- * MRI Ruby 1.8.7, 1.9.3 and 2.0.0
35
- * Rubinius 1.8 and 1.9
36
- * JRuby in 1.8 and 1.9 modes
37
- * Ruby Enterprise Edition
36
+ It *should* also work in versions from 1.8.7, in Ruby Enterprise and in Rubinius, but it
37
+ is not tested routinely on those Rubies.
38
38
 
39
39
  ## Installation
40
40
 
data/Rakefile CHANGED
@@ -1,16 +1,19 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
  require 'rake/extensiontask'
4
- require "yard"
6
+ require 'yard'
5
7
 
6
8
  def can_compile_extensions
7
9
  return false if RUBY_DESCRIPTION =~ /jruby/
8
- return true
10
+
11
+ true
9
12
  end
10
13
 
11
- desc "GamesDice unit tests"
14
+ desc 'GamesDice unit tests'
12
15
  RSpec::Core::RakeTask.new(:test) do |t|
13
- t.pattern = "spec/*_spec.rb"
16
+ t.pattern = 'spec/*_spec.rb'
14
17
  t.verbose = false
15
18
  end
16
19
 
@@ -21,20 +24,20 @@ end
21
24
  gemspec = Gem::Specification.load('games_dice.gemspec')
22
25
  Rake::ExtensionTask.new do |ext|
23
26
  ext.name = 'games_dice'
24
- ext.source_pattern = "*.{c,h}"
27
+ ext.source_pattern = '*.{c,h}'
25
28
  ext.ext_dir = 'ext/games_dice'
26
29
  ext.lib_dir = 'lib/games_dice'
27
30
  ext.gem_spec = gemspec
28
31
  end
29
32
 
30
- task :delete_compiled_ext do |t|
33
+ task :delete_compiled_ext do |_t|
31
34
  `rm lib/games_dice/games_dice.*`
32
35
  end
33
36
 
34
- task :pure_test => [:delete_compiled_ext, :test]
37
+ task pure_test: %i[delete_compiled_ext test]
35
38
 
36
39
  if can_compile_extensions
37
- task :default => [:compile, :test]
40
+ task default: %i[compile test]
38
41
  else
39
- task :default => [:test]
42
+ task default: [:test]
40
43
  end
@@ -1,25 +1,7 @@
1
- # ext/games_dice/extconf.rb
2
- can_compile_extensions = false
3
- want_extensions = true
4
-
5
- begin
6
- require 'mkmf'
7
- can_compile_extensions = true
8
- rescue Exception
9
- # This will appear only in verbose mode.
10
- $stderr.puts "Could not require 'mkmf'. Not fatal: The extensions are optional."
11
- end
1
+ # frozen_string_literal: true
12
2
 
3
+ # ext/games_dice/extconf.rb
13
4
 
14
- if can_compile_extensions && want_extensions
15
- create_makefile( 'games_dice/games_dice' )
16
-
17
- else
18
- # Create a dummy Makefile, to satisfy Gem::Installer#install
19
- mfile = open("Makefile", "wb")
20
- mfile.puts '.PHONY: install'
21
- mfile.puts 'install:'
22
- mfile.puts "\t" + '@echo "Extensions not installed, falling back to pure Ruby version."'
23
- mfile.close
5
+ require 'mkmf'
24
6
 
25
- end
7
+ create_makefile('games_dice/games_dice')
@@ -472,7 +472,7 @@ ProbabilityList *pl_repeat_n_sum_k( ProbabilityList *pl, int n, int k, int kbest
472
472
  pl_result->offset = pl->offset * k;
473
473
 
474
474
  for ( i = 0; i < pl->slots; i++ ) {
475
- if ( ! pl->probs[i] > 0.0 ) continue;
475
+ if ( pl->probs[i] <= 0.0 ) continue;
476
476
 
477
477
  q = i + pl->offset;
478
478
  calc_keep_distributions( pl, k, q, kbest, keep_distributions );
data/games_dice.gemspec CHANGED
@@ -1,42 +1,40 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require 'English'
4
+ lib = File.expand_path('lib', __dir__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'games_dice/version'
5
7
 
6
8
  Gem::Specification.new do |gem|
7
- gem.name = "games_dice"
9
+ gem.name = 'games_dice'
8
10
  gem.version = GamesDice::VERSION
9
- gem.authors = ["Neil Slater"]
10
- gem.email = ["slobo777@gmail.com"]
11
- gem.description = %q{A library for simulating dice. Use it to construct dice-rolling systems used in role-playing and board games.}
12
- gem.summary = %q{Simulates and explains dice rolls from simple "1d6" to complex "roll 7 ten-sided dice, take best 3,
13
- results of 10 roll again and add on".}
14
- gem.homepage = "https://github.com/neilslater/games_dice"
15
- gem.license = "MIT"
11
+ gem.authors = ['Neil Slater']
12
+ gem.email = ['slobo777@gmail.com']
13
+ gem.description = 'A library for simulating dice. Use it to construct dice-rolling systems used in role-playing and board games.'
14
+ gem.summary = 'Simulates and explains dice rolls from simple "1d6" to complex "roll 7 ten-sided dice, take best 3,
15
+ results of 10 roll again and add on".'
16
+ gem.homepage = 'https://github.com/neilslater/games_dice'
17
+ gem.license = 'MIT'
16
18
 
17
- gem.add_development_dependency "rspec", ">= 2.13.0"
18
- gem.add_development_dependency "rake", ">= 1.9.1"
19
- gem.add_development_dependency "yard", ">= 0.8.6"
20
- gem.add_development_dependency "coveralls", ">= 0.6.7"
21
- gem.add_development_dependency "json", ">= 1.7.7"
22
- gem.add_development_dependency "rake-compiler"
19
+ gem.required_ruby_version = '>= 2.6.0'
20
+ gem.add_development_dependency 'coveralls', '>= 0.6.7'
21
+ gem.add_development_dependency 'json', '>= 1.7.7'
22
+ gem.add_development_dependency 'rake', '>= 1.9.1'
23
+ gem.add_development_dependency 'rake-compiler', '>= 0.8.3'
24
+ gem.add_development_dependency 'rspec', '>= 2.13.0'
25
+ gem.add_development_dependency 'rubocop', '>= 1.2.1'
26
+ gem.add_development_dependency 'yard', '>= 0.8.6'
23
27
 
24
28
  # Red Carpet renders README.md, and is optional even when developing the gem.
25
- # However, it has a C extension, and v3.0.0 is does not compile for 1.8.7. This only affects the gem build process, so
29
+ # However, it has a C extension, which will not work in JRuby. This only affects the gem build process, so
26
30
  # is only really used in environments like Travis, and is safe to wrap like this in the gemspec.
27
- if RUBY_DESCRIPTION !~ /jruby/
28
- if RUBY_VERSION < "1.9.0"
29
- gem.add_development_dependency "redcarpet", ">=2.3.0", "<3.0.0"
30
- else
31
- gem.add_development_dependency "redcarpet", ">=2.3.0"
32
- end
33
- end
31
+ gem.add_development_dependency 'redcarpet', '>=3.5.1' if RUBY_DESCRIPTION !~ /jruby/
34
32
 
35
- gem.add_dependency "parslet", ">= 1.5.0"
33
+ gem.add_dependency 'parslet', '>= 1.5.0'
36
34
 
37
- gem.files = `git ls-files`.split($/)
38
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
35
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
36
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
39
37
  gem.extensions = gem.files.grep(%r{/extconf\.rb$})
40
38
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
41
- gem.require_paths = ["lib"]
39
+ gem.require_paths = ['lib']
42
40
  end