cardistry 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +33 -0
- data/README.md +82 -7
- data/cardistry.gemspec +8 -10
- data/lib/cardistry/version.rb +1 -1
- metadata +7 -5
- data/CODE_OF_CONDUCT.md +0 -74
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f23f4fcaa617afe7e2082023e94719bcbb72f027c34b411cceacb80a6f8cc2d
|
|
4
|
+
data.tar.gz: 44ba04791c6bf858527c72ecbaa43e206eb441420395251d1228c4c1ff44cef3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 68f71f2e2a2865552b89d45de906e420f8b9facf5a1b172755cb69d31ba853800e96664ed32d6fbc76229e3fce5bd75f6ddcb36c39c97879de3593bd18281784
|
|
7
|
+
data.tar.gz: c17f7e9d80cf05caf0f2fc5778415929468f06dcc5ec634c4aa8aaca7e488ca5aa4e42faebb68f7df4c13b6d49b11ab03e3508b400b77839b3a836303b77039f
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ main ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ main ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v2
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
26
|
+
# uses: ruby/setup-ruby@v1
|
|
27
|
+
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: 2.6
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: bundle install
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: bundle exec rake spec
|
data/README.md
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
[](https://badge.fury.io/rb/cardistry)
|
|
2
|
+
|
|
1
3
|
# Cardistry
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
Cardistry provides a few basic classes that model the behavior of a real deck of cards – and a (mostly!) complete test suite.
|
|
6
|
+
|
|
7
|
+
### Goals
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
- Easily extendable classes so that you can model your favorite decks and games, from poker to tarot, or even MTG or UNO.
|
|
10
|
+
- Realistic, simulated (not random!) riffle shuffling
|
|
11
|
+
- Common actions like cutting the deck, dealing individual cards to other locations, and more.
|
|
6
12
|
|
|
13
|
+
#### Intended Classes
|
|
14
|
+
- **Card** - Represents a single card, to be contained by other Classes
|
|
15
|
+
- **Deck** - An enumerable collection of cards.
|
|
16
|
+
- **Spread** (*not yet added*) – A sequence of positions, each with a name (ie "The River").
|
|
17
|
+
- **Hand** (*not yet added*) - A sortable collection of cards.
|
|
18
|
+
|
|
7
19
|
## Installation
|
|
8
20
|
|
|
9
21
|
Add this line to your application's Gemfile:
|
|
@@ -22,17 +34,80 @@ Or install it yourself as:
|
|
|
22
34
|
|
|
23
35
|
## Usage
|
|
24
36
|
|
|
25
|
-
|
|
37
|
+
### A Basic Deck
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
require 'cardistry'
|
|
41
|
+
|
|
42
|
+
deck = Cardistry::Deck.new
|
|
43
|
+
deck.load 'cards.json'
|
|
44
|
+
|
|
45
|
+
puts deck.size # 52
|
|
46
|
+
puts deck.info # "cards: 52, suits: [:spades, :hearts, :clubs, :diamonds]
|
|
47
|
+
puts deck.first # "Ace of Spades"
|
|
48
|
+
|
|
49
|
+
puts deck[0].suit # :spades
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Extending Classes
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
require 'cardistry'
|
|
57
|
+
|
|
58
|
+
class CoolerCard < Cardistry::Card
|
|
59
|
+
|
|
60
|
+
def to_s
|
|
61
|
+
"Cooler than #{super}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Example source data file
|
|
69
|
+
|
|
70
|
+
Eventually a standard poker style deck will be included. You can find something close in `spec/test_deck.json` for now.
|
|
71
|
+
|
|
72
|
+
*Note that currently, all fields except `rank` are optional, `kind` will default to `:pip`*
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
[
|
|
76
|
+
{
|
|
77
|
+
"name": "Ace of Spades",
|
|
78
|
+
"kind": "pip",
|
|
79
|
+
"suit": "spades",
|
|
80
|
+
"rank": 1
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// ...
|
|
84
|
+
|
|
85
|
+
{
|
|
86
|
+
"suit": "clubs",
|
|
87
|
+
"rank": 7
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// ...
|
|
91
|
+
|
|
92
|
+
{
|
|
93
|
+
"name": "Queen of Hearts",
|
|
94
|
+
"kind": "court",
|
|
95
|
+
"suit": "hearts",
|
|
96
|
+
"rank": 12
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// ...etc
|
|
100
|
+
]
|
|
101
|
+
```
|
|
102
|
+
|
|
26
103
|
|
|
27
104
|
## Development
|
|
28
105
|
|
|
29
106
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
107
|
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
-
|
|
33
108
|
## Contributing
|
|
34
109
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
110
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nickisnoble/cardistry.
|
|
36
111
|
|
|
37
112
|
## License
|
|
38
113
|
|
|
@@ -40,4 +115,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
40
115
|
|
|
41
116
|
## Code of Conduct
|
|
42
117
|
|
|
43
|
-
|
|
118
|
+
Be nice or leave!
|
data/cardistry.gemspec
CHANGED
|
@@ -10,20 +10,18 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.email = ["nick.noble@hey.com"]
|
|
11
11
|
|
|
12
12
|
spec.summary = %q{A toolkit for modeling cards, decks, hands, and spreads.}
|
|
13
|
-
spec.homepage = "https://
|
|
13
|
+
spec.homepage = "https://github.com/nickisnoble/cardistry"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# "public gem pushes."
|
|
26
|
-
# end
|
|
18
|
+
if spec.respond_to?(:metadata)
|
|
19
|
+
# spec.metadata["allowed_push_host"] = "http://rubygems.org/"
|
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/nickisnoble/cardistry"
|
|
22
|
+
else
|
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
24
|
+
end
|
|
27
25
|
|
|
28
26
|
# Specify which files should be added to the gem when it is released.
|
|
29
27
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/cardistry/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cardistry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Noble
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-01-
|
|
11
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -59,10 +59,10 @@ executables: []
|
|
|
59
59
|
extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
|
61
61
|
files:
|
|
62
|
+
- ".github/workflows/ruby.yml"
|
|
62
63
|
- ".gitignore"
|
|
63
64
|
- ".rspec"
|
|
64
65
|
- ".travis.yml"
|
|
65
|
-
- CODE_OF_CONDUCT.md
|
|
66
66
|
- Gemfile
|
|
67
67
|
- Gemfile.lock
|
|
68
68
|
- LICENSE.txt
|
|
@@ -75,10 +75,12 @@ files:
|
|
|
75
75
|
- lib/cardistry/card.rb
|
|
76
76
|
- lib/cardistry/deck.rb
|
|
77
77
|
- lib/cardistry/version.rb
|
|
78
|
-
homepage: https://
|
|
78
|
+
homepage: https://github.com/nickisnoble/cardistry
|
|
79
79
|
licenses:
|
|
80
80
|
- MIT
|
|
81
|
-
metadata:
|
|
81
|
+
metadata:
|
|
82
|
+
homepage_uri: https://github.com/nickisnoble/cardistry
|
|
83
|
+
source_code_uri: https://github.com/nickisnoble/cardistry
|
|
82
84
|
post_install_message:
|
|
83
85
|
rdoc_options: []
|
|
84
86
|
require_paths:
|
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
-
orientation.
|
|
11
|
-
|
|
12
|
-
## Our Standards
|
|
13
|
-
|
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
|
15
|
-
include:
|
|
16
|
-
|
|
17
|
-
* Using welcoming and inclusive language
|
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
|
19
|
-
* Gracefully accepting constructive criticism
|
|
20
|
-
* Focusing on what is best for the community
|
|
21
|
-
* Showing empathy towards other community members
|
|
22
|
-
|
|
23
|
-
Examples of unacceptable behavior by participants include:
|
|
24
|
-
|
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
-
advances
|
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
-
* Public or private harassment
|
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
|
30
|
-
address, without explicit permission
|
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
-
professional setting
|
|
33
|
-
|
|
34
|
-
## Our Responsibilities
|
|
35
|
-
|
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
-
response to any instances of unacceptable behavior.
|
|
39
|
-
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
-
threatening, offensive, or harmful.
|
|
45
|
-
|
|
46
|
-
## Scope
|
|
47
|
-
|
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
-
when an individual is representing the project or its community. Examples of
|
|
50
|
-
representing a project or community include using an official project e-mail
|
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
|
53
|
-
further defined and clarified by project maintainers.
|
|
54
|
-
|
|
55
|
-
## Enforcement
|
|
56
|
-
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at nick.noble@hey.com. All
|
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
|
63
|
-
|
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
-
members of the project's leadership.
|
|
67
|
-
|
|
68
|
-
## Attribution
|
|
69
|
-
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
-
|
|
73
|
-
[homepage]: http://contributor-covenant.org
|
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|