games_dice 0.3.5 → 0.3.6

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.
data/.travis.yml CHANGED
@@ -6,4 +6,5 @@ rvm:
6
6
  - rbx-18mode
7
7
  - rbx-19mode
8
8
  - ree
9
-
9
+ - jruby-18mode
10
+ - jruby-19mode
data/README.md CHANGED
@@ -17,18 +17,21 @@ The main features of GamesDice are:
17
17
  * Counting number of "successes" from a set of dice
18
18
  * Keeping the best, or worst, results from a set of dice
19
19
  * Can explain how a result was achieved in terms of the individual die rolls
20
- * Can calculate probabilities and expected values (with some limitations)
20
+ * Can calculate probabilities and expected values
21
21
 
22
22
  There are no game mechanics implemented in GamesDice, such as the chance to hit in a fantasy combat
23
23
  game. There is no support for player interaction within a roll, such as player choice on whether or
24
24
  not to re-roll a specific die within a combined set. These things are of course possible if you use the
25
25
  gem as-is, and add them as features within your project code.
26
26
 
27
- ## Special Note on Versions Prior to 1.0.0
27
+ ## Supported Ruby Versions
28
28
 
29
- As of version 0.2.0, the gem has the same feature set as planned for version
30
- 1.0.0. Versions between 0.2.0 and 1.0.0 are being used mainly to improve
31
- code quality, documentation and performance.
29
+ GamesDice is tested routinely on
30
+
31
+ * MRI Ruby 1.8.7, 1.9.3 and 2.0.0
32
+ * Rubinius 1.8 and 1.9
33
+ * JRuby in 1.8 and 1.9 modes
34
+ * Ruby Enterprise Edition
32
35
 
33
36
  ## Installation
34
37
 
@@ -44,6 +47,21 @@ Or install it yourself as:
44
47
 
45
48
  $ gem install games_dice
46
49
 
50
+ When installed, GamesDice will attempt to install Ruby native extensions in C, for speeding up probabilities
51
+ calculations. However, all the features are available in pure Ruby, and the gem should fall back to that
52
+ automatically on installation if your system does not support C native extensions. You can verify which
53
+ is being installed by installing the gem in verbose mode:
54
+
55
+ $ gem install games_dice --verbose
56
+
57
+ You can also verify which version you are using in Ruby by calling the class method:
58
+
59
+ GamesDice::Probabilities.implemented_in
60
+
61
+ which will return either *:ruby* or *:c*. Other than this method, and a speed difference between
62
+ implementations, there should be no other difference. If you find one, then it will be considered
63
+ as a bug.
64
+
47
65
  ## Usage
48
66
 
49
67
  require 'games_dice'
@@ -1,3 +1,25 @@
1
1
  # ext/games_dice/extconf.rb
2
- require 'mkmf'
3
- create_makefile( 'games_dice/games_dice' )
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
12
+
13
+
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
24
+
25
+ end
data/games_dice.gemspec CHANGED
@@ -19,11 +19,15 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency "yard", ">= 0.8.6"
20
20
  gem.add_development_dependency "rake-compiler"
21
21
 
22
- # Red Carpet has a C extension, and v3.0.0 is does not compile for 1.8.7
23
- if RUBY_VERSION < "1.9.0"
24
- gem.add_development_dependency "redcarpet", ">=2.3.0", "<3.0.0"
25
- else
26
- gem.add_development_dependency "redcarpet", ">=2.3.0"
22
+ # Red Carpet renders README.md, and is optional even when developing the gem.
23
+ # 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
24
+ # is only really used in environments like Travis, and is safe to wrap like this in the gemspec.
25
+ if RUBY_DESCRIPTION !~ /jruby/
26
+ if RUBY_VERSION < "1.9.0"
27
+ gem.add_development_dependency "redcarpet", ">=2.3.0", "<3.0.0"
28
+ else
29
+ gem.add_development_dependency "redcarpet", ">=2.3.0"
30
+ end
27
31
  end
28
32
 
29
33
  gem.add_dependency "parslet", ">= 1.5.0"
@@ -371,6 +371,7 @@ class GamesDice::Probabilities
371
371
 
372
372
  end # class GamesDice::Probabilities
373
373
 
374
+ # @!visibility private
374
375
  # Helper module with optimised Ruby for counting variations of arrays, such as those returned by
375
376
  # Array#repeated_combination
376
377
  #
@@ -1,3 +1,3 @@
1
1
  module GamesDice
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: games_dice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-14 00:00:00.000000000 Z
12
+ date: 2013-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  segments:
167
167
  - 0
168
- hash: -335297493340390599
168
+ hash: 2590599779471533886
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  segments:
176
176
  - 0
177
- hash: -335297493340390599
177
+ hash: 2590599779471533886
178
178
  requirements: []
179
179
  rubyforge_project:
180
180
  rubygems_version: 1.8.24