turkish_id 1.3.0 → 1.4.0
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/dependabot.yml +8 -0
- data/.github/workflows/publish.yml +24 -0
- data/.github/workflows/test.yml +53 -0
- data/.tool-versions +1 -0
- data/Gemfile +4 -9
- data/LICENSE.txt +1 -1
- data/README.md +16 -6
- data/Rakefile +2 -2
- data/bin/console +3 -3
- data/bin/setup +0 -0
- data/bin/turkish_id +8 -19
- data/lib/turkish_id/version.rb +1 -1
- data/lib/turkish_id.rb +4 -4
- data/turkish_id.gemspec +20 -14
- metadata +81 -10
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4dbab23fd1a1c8ee8c67c3630a171a135bed41bce82708dc6c03c42b61651bf3
|
|
4
|
+
data.tar.gz: '0385cf9eb915caf2a0f8c41cb3663e7bdb2c9b50d17b8915f6fc2e1416eab8f8'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39f88acd307c6a3ac8d5c446cad44ed78a5fb7f998d8fdd4223c5550705880d67d617ed106f1465de98fb9c3c92415e72901b5ce8582fe3a04d80502f8c1402e
|
|
7
|
+
data.tar.gz: 6fa037e2073337069638a364f2a8277f48d50630a0bd80f46a43a5ef49bd674b5226dcfa941dd59d02c7c43466a8b6403be4288df33ad3403fbd748b04f6497a
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
name: Publish Packages
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v2
|
|
14
|
+
|
|
15
|
+
- name: Set up Ruby
|
|
16
|
+
uses: ruby/setup-ruby@v1
|
|
17
|
+
with:
|
|
18
|
+
bundler-cache: true
|
|
19
|
+
|
|
20
|
+
- name: Publish to RubyGems
|
|
21
|
+
uses: dawidd6/action-publish-gem@v1
|
|
22
|
+
with:
|
|
23
|
+
api_key: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
|
24
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
push:
|
|
7
|
+
branches: [ develop, master ]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
GIT_COMMIT_SHA: ${{ github.sha }}
|
|
11
|
+
GIT_BRANCH: ${{ github.ref }}
|
|
12
|
+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
|
|
16
|
+
lint:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
name: lint ${{ matrix.ruby }}
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
ruby: [ '2.6.9', '2.7.5', '3.0.3', '3.1.1' ]
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v2
|
|
26
|
+
- uses: ruby/setup-ruby@v1
|
|
27
|
+
with:
|
|
28
|
+
ruby-version: ${{ matrix.ruby }}
|
|
29
|
+
bundler-cache: true
|
|
30
|
+
|
|
31
|
+
- name: StandardRB
|
|
32
|
+
continue-on-error: ${{ matrix.experimental }}
|
|
33
|
+
run: bundle exec standardrb --parallel --format progress
|
|
34
|
+
|
|
35
|
+
test:
|
|
36
|
+
needs: [ lint ]
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
name: test ${{ matrix.ruby }}
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
matrix:
|
|
42
|
+
ruby: [ '2.6.9', '2.7.5', '3.0.3', '3.1.1' ]
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v2
|
|
46
|
+
- uses: ruby/setup-ruby@v1
|
|
47
|
+
with:
|
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
|
49
|
+
bundler-cache: true
|
|
50
|
+
|
|
51
|
+
- name: Test
|
|
52
|
+
continue-on-error: ${{ matrix.experimental }}
|
|
53
|
+
run: bundle exec rake
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.1.1
|
data/Gemfile
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
gemspec
|
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
gem 'rake'
|
|
11
|
-
gem 'rspec'
|
|
12
|
-
gem 'simplecov'
|
|
13
|
-
end
|
|
7
|
+
# Specify your gem's dependencies in viabtc.gemspec
|
|
8
|
+
gemspec
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Turkish ID 🔖
|
|
2
2
|
|
|
3
|
-
[](https://github.com/krmbzds/turkish_id/actions/workflows/test.yml)
|
|
4
|
+
[](https://coveralls.io/github/krmbzds/turkish_id)
|
|
5
|
+
[](https://rubygems.org/gems/turkish_id)
|
|
6
|
+
[](https://rubygems.org/gems/turkish_id)
|
|
7
|
+
[](https://codeclimate.com/github/krmbzds/turkish_id)
|
|
8
|
+
[](https://github.com/krmbzds/turkish_id)
|
|
9
|
+
[](https://www.rubydoc.info/gems/turkish_id)
|
|
4
10
|
|
|
5
11
|
This gem provides methods to validate Turkish Identification Numbers.
|
|
6
12
|
|
|
@@ -39,7 +45,10 @@ identity_number.valid? #=> true
|
|
|
39
45
|
Or use the command line executable:
|
|
40
46
|
|
|
41
47
|
```sh
|
|
42
|
-
$ turkish_id 10000000078 #=>
|
|
48
|
+
$ turkish_id 10000000078 #=> true
|
|
49
|
+
$ echo $? #=> 0
|
|
50
|
+
$ turkish_id 10000000079 #=> false
|
|
51
|
+
$ echo $? #=> 1
|
|
43
52
|
```
|
|
44
53
|
|
|
45
54
|
### Generating Relatives
|
|
@@ -98,9 +107,10 @@ Remember that a valid identification number does not imply the existence of an I
|
|
|
98
107
|
|
|
99
108
|
This gem is used in production and tested against the following Ruby versions:
|
|
100
109
|
|
|
101
|
-
- ✅ `
|
|
102
|
-
- ✅ `
|
|
103
|
-
-
|
|
110
|
+
- ✅ `3.1.1` (stable)
|
|
111
|
+
- ✅ `3.0.3` (stable)
|
|
112
|
+
- ✅ `2.7.5` (stable)
|
|
113
|
+
- ⏳ `2.6.9` (security maintenance)
|
|
104
114
|
|
|
105
115
|
## Development
|
|
106
116
|
|
|
@@ -126,7 +136,7 @@ Yes.
|
|
|
126
136
|
|
|
127
137
|
## License
|
|
128
138
|
|
|
129
|
-
Copyright ©
|
|
139
|
+
Copyright © 2015-2022 [Kerem Bozdas][Personal Webpage]
|
|
130
140
|
|
|
131
141
|
This gem is available under the terms of the [MIT License][License].
|
|
132
142
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
require
|
|
5
|
-
require
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
require "turkish_id"
|
|
6
6
|
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
|
9
9
|
|
|
10
|
-
require
|
|
10
|
+
require "irb"
|
|
11
11
|
IRB.start
|
data/bin/setup
CHANGED
|
File without changes
|
data/bin/turkish_id
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
lib = File.expand_path(File.dirname(__FILE__) +
|
|
4
|
+
lib = File.expand_path(File.dirname(__FILE__) + "/../lib")
|
|
5
5
|
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
|
6
6
|
|
|
7
|
-
require
|
|
7
|
+
require "turkish_id"
|
|
8
8
|
|
|
9
9
|
@help = '
|
|
10
10
|
Usage
|
|
@@ -16,21 +16,10 @@ require 'turkish_id'
|
|
|
16
16
|
|
|
17
17
|
'
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
if ARGV[0]
|
|
20
|
+
result = TurkishId.new(ARGV[0]).valid?
|
|
21
|
+
$stdout.puts result
|
|
22
|
+
exit result ? 0 : 1
|
|
23
|
+
else
|
|
24
|
+
$stdout.puts @help
|
|
21
25
|
end
|
|
22
|
-
|
|
23
|
-
def validate_id(id_number)
|
|
24
|
-
identity_number = TurkishId.new(id_number)
|
|
25
|
-
print_result(identity_number.valid?)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def print_result(result)
|
|
29
|
-
STDOUT.puts "Your identification number is #{result ? 'valid' : 'invalid'}."
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def print_help
|
|
33
|
-
STDOUT.puts @help
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
parse_input
|
data/lib/turkish_id/version.rb
CHANGED
data/lib/turkish_id.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "turkish_id/version"
|
|
4
4
|
|
|
5
5
|
class TurkishId
|
|
6
6
|
attr_reader :id_number, :checksum, :elder_relative, :younger_relative
|
|
@@ -32,7 +32,7 @@ class TurkishId
|
|
|
32
32
|
|
|
33
33
|
# Return checksum
|
|
34
34
|
[d10, d11]
|
|
35
|
-
rescue
|
|
35
|
+
rescue
|
|
36
36
|
[]
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ class TurkishId
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def next_relative(id_array, direction)
|
|
45
|
-
tree = {
|
|
45
|
+
tree = {up: 1, down: -1}
|
|
46
46
|
get_core(id_array) + 29_999 * tree[direction]
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -60,7 +60,7 @@ class TurkishId
|
|
|
60
60
|
|
|
61
61
|
def get_id_array(id)
|
|
62
62
|
split_num(Integer(id))
|
|
63
|
-
rescue
|
|
63
|
+
rescue
|
|
64
64
|
[]
|
|
65
65
|
end
|
|
66
66
|
|
data/turkish_id.gemspec
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path(
|
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require
|
|
5
|
+
require "turkish_id/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name
|
|
9
|
-
spec.version
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
8
|
+
spec.name = "turkish_id"
|
|
9
|
+
spec.version = TurkishId::VERSION
|
|
10
|
+
spec.authors = ["Kerem Bozdas"]
|
|
11
|
+
spec.email = ["krmbzds.github@gmail.com"]
|
|
12
12
|
|
|
13
|
-
spec.summary
|
|
14
|
-
spec.description
|
|
15
|
-
spec.homepage
|
|
16
|
-
spec.license
|
|
13
|
+
spec.summary = "Validate Turkish Identification Numbers and More!"
|
|
14
|
+
spec.description = "Validate Turkish Identification Numbers and More!"
|
|
15
|
+
spec.homepage = "https://github.com/krmbzds/turkish_id"
|
|
16
|
+
spec.license = "MIT"
|
|
17
17
|
|
|
18
|
-
spec.files
|
|
19
|
-
spec.bindir
|
|
20
|
-
spec.executables
|
|
21
|
-
spec.require_paths = [
|
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
|
+
spec.bindir = "bin"
|
|
20
|
+
spec.executables = ["turkish_id"]
|
|
21
|
+
spec.require_paths = ["lib", "lib/turkish_id"]
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler"
|
|
24
|
+
spec.add_development_dependency "rake"
|
|
25
|
+
spec.add_development_dependency "rspec"
|
|
26
|
+
spec.add_development_dependency "standard"
|
|
27
|
+
spec.add_development_dependency "coveralls_reborn"
|
|
22
28
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,85 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: turkish_id
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kerem Bozdas
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: standard
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: coveralls_reborn
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
13
83
|
description: Validate Turkish Identification Numbers and More!
|
|
14
84
|
email:
|
|
15
85
|
- krmbzds.github@gmail.com
|
|
@@ -18,11 +88,12 @@ executables:
|
|
|
18
88
|
extensions: []
|
|
19
89
|
extra_rdoc_files: []
|
|
20
90
|
files:
|
|
91
|
+
- ".github/dependabot.yml"
|
|
92
|
+
- ".github/workflows/publish.yml"
|
|
93
|
+
- ".github/workflows/test.yml"
|
|
21
94
|
- ".gitignore"
|
|
22
95
|
- ".rspec"
|
|
23
|
-
- ".
|
|
24
|
-
- ".ruby-version"
|
|
25
|
-
- ".travis.yml"
|
|
96
|
+
- ".tool-versions"
|
|
26
97
|
- Gemfile
|
|
27
98
|
- LICENSE.txt
|
|
28
99
|
- README.md
|
|
@@ -37,7 +108,7 @@ homepage: https://github.com/krmbzds/turkish_id
|
|
|
37
108
|
licenses:
|
|
38
109
|
- MIT
|
|
39
110
|
metadata: {}
|
|
40
|
-
post_install_message:
|
|
111
|
+
post_install_message:
|
|
41
112
|
rdoc_options: []
|
|
42
113
|
require_paths:
|
|
43
114
|
- lib
|
|
@@ -53,8 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
53
124
|
- !ruby/object:Gem::Version
|
|
54
125
|
version: '0'
|
|
55
126
|
requirements: []
|
|
56
|
-
rubygems_version: 3.
|
|
57
|
-
signing_key:
|
|
127
|
+
rubygems_version: 3.3.7
|
|
128
|
+
signing_key:
|
|
58
129
|
specification_version: 4
|
|
59
130
|
summary: Validate Turkish Identification Numbers and More!
|
|
60
131
|
test_files: []
|
data/.ruby-gemset
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
turkish_id
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ruby-2.7.1
|
data/.travis.yml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
rvm:
|
|
3
|
-
- 2.7.1
|
|
4
|
-
- 2.6.6
|
|
5
|
-
- 2.5.8
|
|
6
|
-
before_install:
|
|
7
|
-
- 'gem update --system'
|
|
8
|
-
- 'gem --version'
|
|
9
|
-
- 'gem install bundler'
|
|
10
|
-
env:
|
|
11
|
-
global:
|
|
12
|
-
- CC_TEST_REPORTER_ID=92655ba2c8b47200f80e996afb80c410b9491514845d414d7517108ad35a5178
|
|
13
|
-
before_script:
|
|
14
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
15
|
-
- chmod +x ./cc-test-reporter
|
|
16
|
-
- ./cc-test-reporter before-build
|
|
17
|
-
script:
|
|
18
|
-
- bundle exec rspec
|
|
19
|
-
after_script:
|
|
20
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|