CrISBN - Crystal ISBN Library
Links to repo
CrISBN - Crystal library to handle ISBNs. The goal is for this library to handle any action you'd want from an ISBN such as validate, generate new ones, check to see if an ISBN belongs to something and what, and other actions that come to mind.
This project came about when I was toying with the idea of a tool that can generate a random ISBN then search that book for you display a new book to checkout, and since there wasn't one I created it in the language I was familiar with. From that I decided to create a tool-set that allows me to not just generate ISBNs but check other ISBNs, validate them, search for them, etc.
Installation
- Recommended: if you want to use
cake
, which ismake
for crystal then, (this is recommended )- Make sure you have cake installed
curl https://raw.githubusercontent.com/axvm/cake/master/install.sh | bash
- Run
cake build
- Run
./bin/crisbn
- Make sure you have cake installed
- if you want to use
make
runmake build
Usage
Add it to your shard.yml
:
dependencies: crisbn: github: MaterialFuture/crisbn
and then install the library into your project:
$ shards install
If you want to use this in your project just reference is with
ISBN::Generate.english # => "1829404728394"
I also have a lottery-like class that is used that could be used elsewhere, right now it's accessed like
RandNum.fromZero # => 0-9
or
RandNum.fromOne # => 1-9
You can also validate an ISBN by using like below
ISBN::Generate.english(ISBN)
For more examples look in examples/
directory.
Development
-
All dev will be done in
src
-
Run using
crystal src/crisbn.cr
-
Recommended: if you want to use
cake
, which ismake
for crystal- Make sure you have cake installed
curl https://raw.githubusercontent.com/axvm/cake/master/install.sh | bash
- Run
cake build
- Run
./bin/crisbn
- Make sure you have cake installed
-
if you want to use
make
runmake build
Spec/Test
Run crystal spec
to make sure that all the tests pass before developing, and if there's anything that fails let me know or feel free to make a PR or issue.
Contributing
- Fork it (https://github.com/MaterialFuture/crisbn/forks/new)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- MaterialFuture - creator and maintainer
Notes
ISBN number generated from list here: https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_to_ISBN-13_conversion