uxid 0.2.2 → 0.2.3
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/build.yml +72 -0
- data/.gitignore +43 -0
- data/CHANGELOG.md +6 -1
- data/Dangerfile +5 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +53 -4
- data/{LICENSE.txt → LICENSE} +0 -0
- data/lib/uxid/version.rb +1 -1
- data/uxid.gemspec +2 -2
- metadata +13 -11
- data/lib/uxid/crockford.rb +0 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 329b2b3ae00dc22cfc6a32ce123ad4f22a1211cc2d1851d1797211b838b59983
|
|
4
|
+
data.tar.gz: 586e48ce10bd900cf51a1fafc363640443d2f22e6ac845ddcaac85ae810467bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5516fd55ea9f94f64c4a7535b4d1bb751ba729021aad89e28a47fd23b7adb42183d2267374a28badacb0aab704fd591eb22a7d7f4ae0d3a589eb0ee04b2c384
|
|
7
|
+
data.tar.gz: a19e5b88e3e0d2b88931bfb146d2323595e848dbf4d6675726afc476c4a1a1a3810870bd1e34e7f92bbbf1b8014419bf97a7bebd5c3392f4a7f624043f56a555
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
danger:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
if: github.event_name == 'pull_request' # only run pull request when multiple trigger workflow
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout Repo
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
|
|
16
|
+
- name: Setup Ruby
|
|
17
|
+
uses: actions/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: '2.6'
|
|
20
|
+
|
|
21
|
+
- name: Cache Ruby Gems
|
|
22
|
+
uses: actions/cache@v2
|
|
23
|
+
with:
|
|
24
|
+
path: vendor/bundle
|
|
25
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
26
|
+
restore-keys: |
|
|
27
|
+
${{ runner.os }}-gems-
|
|
28
|
+
|
|
29
|
+
- name: Bundle Install
|
|
30
|
+
run: |
|
|
31
|
+
bundle config path vendor/bundle
|
|
32
|
+
bundle install --jobs 4 --retry 3
|
|
33
|
+
|
|
34
|
+
- name: Danger linting
|
|
35
|
+
uses: MeilCli/danger-action@v5
|
|
36
|
+
with:
|
|
37
|
+
plugins_file: Gemfile
|
|
38
|
+
install_path: vendor/bundle
|
|
39
|
+
danger_file: Dangerfile
|
|
40
|
+
danger_id: danger-pr
|
|
41
|
+
env:
|
|
42
|
+
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
|
|
43
|
+
|
|
44
|
+
tests:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
if: github.event_name == 'pull_request' # only run pull request when multiple trigger workflow
|
|
47
|
+
steps:
|
|
48
|
+
- name: Checkout Repo
|
|
49
|
+
uses: actions/checkout@v2
|
|
50
|
+
|
|
51
|
+
- name: Setup Ruby
|
|
52
|
+
uses: actions/setup-ruby@v1
|
|
53
|
+
with:
|
|
54
|
+
ruby-version: '2.6'
|
|
55
|
+
|
|
56
|
+
- name: Cache Ruby Gems
|
|
57
|
+
uses: actions/cache@v2
|
|
58
|
+
with:
|
|
59
|
+
path: vendor/bundle
|
|
60
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
61
|
+
restore-keys: |
|
|
62
|
+
${{ runner.os }}-gems-
|
|
63
|
+
|
|
64
|
+
- name: Bundle Install
|
|
65
|
+
run: |
|
|
66
|
+
bundle config path vendor/bundle
|
|
67
|
+
bundle install --jobs 4 --retry 3
|
|
68
|
+
|
|
69
|
+
- name: Run Tests
|
|
70
|
+
run: |
|
|
71
|
+
bundle config path vendor/bundle
|
|
72
|
+
bundle exec rake test
|
data/.gitignore
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Custom files
|
|
2
|
+
|
|
3
|
+
# Compiled source
|
|
4
|
+
*.com
|
|
5
|
+
*.class
|
|
6
|
+
*.dll
|
|
7
|
+
*.exe
|
|
8
|
+
*.o
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Packages
|
|
12
|
+
#
|
|
13
|
+
# It's better to unpack these files and commit the raw source
|
|
14
|
+
# git has its own built in compression methods
|
|
15
|
+
*.7z
|
|
16
|
+
*.dmg
|
|
17
|
+
*.gz
|
|
18
|
+
*.iso
|
|
19
|
+
*.jar
|
|
20
|
+
*.rar
|
|
21
|
+
*.tar
|
|
22
|
+
*.zip
|
|
23
|
+
|
|
24
|
+
# Logs and databases
|
|
25
|
+
*.log
|
|
26
|
+
*.sql
|
|
27
|
+
*.sqlite
|
|
28
|
+
|
|
29
|
+
# OS generated files #
|
|
30
|
+
.DS_Store
|
|
31
|
+
.DS_Store?
|
|
32
|
+
._*
|
|
33
|
+
.Spotlight-V100
|
|
34
|
+
.Trashes
|
|
35
|
+
ehthumbs.db
|
|
36
|
+
Thumbs.db
|
|
37
|
+
|
|
38
|
+
# Editor-made files
|
|
39
|
+
*.swp
|
|
40
|
+
|
|
41
|
+
#===== Ruby =====
|
|
42
|
+
*.gem
|
|
43
|
+
reports/
|
data/CHANGELOG.md
CHANGED
data/Dangerfile
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
uxid (0.2.
|
|
4
|
+
uxid (0.2.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -15,14 +15,44 @@ GEM
|
|
|
15
15
|
ice_nine (~> 0.11.0)
|
|
16
16
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
17
17
|
builder (3.2.4)
|
|
18
|
+
claide (1.0.3)
|
|
19
|
+
claide-plugins (0.9.2)
|
|
20
|
+
cork
|
|
21
|
+
nap
|
|
22
|
+
open4 (~> 1.3)
|
|
18
23
|
coderay (1.1.3)
|
|
19
24
|
coercible (1.0.0)
|
|
20
25
|
descendants_tracker (~> 0.0.1)
|
|
26
|
+
colored2 (3.1.2)
|
|
27
|
+
cork (0.3.0)
|
|
28
|
+
colored2 (~> 3.1)
|
|
29
|
+
danger (8.2.1)
|
|
30
|
+
claide (~> 1.0)
|
|
31
|
+
claide-plugins (>= 0.9.2)
|
|
32
|
+
colored2 (~> 3.1)
|
|
33
|
+
cork (~> 0.1)
|
|
34
|
+
faraday (>= 0.9.0, < 2.0)
|
|
35
|
+
faraday-http-cache (~> 2.0)
|
|
36
|
+
git (~> 1.7)
|
|
37
|
+
kramdown (~> 2.3)
|
|
38
|
+
kramdown-parser-gfm (~> 1.0)
|
|
39
|
+
no_proxy_fix
|
|
40
|
+
octokit (~> 4.7)
|
|
41
|
+
terminal-table (~> 1)
|
|
42
|
+
danger-commit_lint (0.0.7)
|
|
43
|
+
danger-plugin-api (~> 1.0)
|
|
44
|
+
danger-plugin-api (1.0.0)
|
|
45
|
+
danger (> 2.0)
|
|
21
46
|
descendants_tracker (0.0.4)
|
|
22
47
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
23
48
|
docile (1.3.2)
|
|
24
49
|
equalizer (0.0.11)
|
|
25
50
|
erubis (2.7.0)
|
|
51
|
+
faraday (1.1.0)
|
|
52
|
+
multipart-post (>= 1.2, < 3)
|
|
53
|
+
ruby2_keywords
|
|
54
|
+
faraday-http-cache (2.2.0)
|
|
55
|
+
faraday (>= 0.8)
|
|
26
56
|
flay (2.12.1)
|
|
27
57
|
erubis (~> 2.7.0)
|
|
28
58
|
path_expander (~> 1.0)
|
|
@@ -32,7 +62,13 @@ GEM
|
|
|
32
62
|
path_expander (~> 1.0)
|
|
33
63
|
ruby_parser (~> 3.1, > 3.1.0)
|
|
34
64
|
sexp_processor (~> 4.8)
|
|
65
|
+
git (1.7.0)
|
|
66
|
+
rchardet (~> 1.8)
|
|
35
67
|
ice_nine (0.11.2)
|
|
68
|
+
kramdown (2.3.0)
|
|
69
|
+
rexml
|
|
70
|
+
kramdown-parser-gfm (1.1.0)
|
|
71
|
+
kramdown (~> 2.0)
|
|
36
72
|
kwalify (0.7.2)
|
|
37
73
|
launchy (2.5.0)
|
|
38
74
|
addressable (~> 2.7)
|
|
@@ -45,6 +81,13 @@ GEM
|
|
|
45
81
|
builder
|
|
46
82
|
minitest (>= 5.0)
|
|
47
83
|
ruby-progressbar
|
|
84
|
+
multipart-post (2.1.1)
|
|
85
|
+
nap (1.1.0)
|
|
86
|
+
no_proxy_fix (0.1.2)
|
|
87
|
+
octokit (4.19.0)
|
|
88
|
+
faraday (>= 0.9)
|
|
89
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
|
90
|
+
open4 (1.3.4)
|
|
48
91
|
parallel (1.19.2)
|
|
49
92
|
parser (2.7.1.3)
|
|
50
93
|
ast (~> 2.4.0)
|
|
@@ -58,6 +101,7 @@ GEM
|
|
|
58
101
|
public_suffix (4.0.5)
|
|
59
102
|
rainbow (3.0.0)
|
|
60
103
|
rake (12.3.3)
|
|
104
|
+
rchardet (1.8.0)
|
|
61
105
|
reek (6.0.1)
|
|
62
106
|
kwalify (~> 0.7.0)
|
|
63
107
|
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
|
@@ -77,6 +121,7 @@ GEM
|
|
|
77
121
|
rubocop-ast (0.0.3)
|
|
78
122
|
parser (>= 2.7.0.1)
|
|
79
123
|
ruby-progressbar (1.10.1)
|
|
124
|
+
ruby2_keywords (0.0.2)
|
|
80
125
|
ruby_parser (3.14.2)
|
|
81
126
|
sexp_processor (~> 4.9)
|
|
82
127
|
rubycritic (4.5.0)
|
|
@@ -90,11 +135,16 @@ GEM
|
|
|
90
135
|
simplecov (>= 0.17.0)
|
|
91
136
|
tty-which (~> 0.4.0)
|
|
92
137
|
virtus (~> 1.0)
|
|
138
|
+
sawyer (0.8.2)
|
|
139
|
+
addressable (>= 2.3.5)
|
|
140
|
+
faraday (> 0.8, < 2.0)
|
|
93
141
|
sexp_processor (4.15.0)
|
|
94
142
|
simplecov (0.18.5)
|
|
95
143
|
docile (~> 1.1)
|
|
96
144
|
simplecov-html (~> 0.11)
|
|
97
145
|
simplecov-html (0.12.2)
|
|
146
|
+
terminal-table (1.8.0)
|
|
147
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
98
148
|
thread_safe (0.3.6)
|
|
99
149
|
tty-which (0.4.2)
|
|
100
150
|
unicode-display_width (1.7.0)
|
|
@@ -108,6 +158,8 @@ PLATFORMS
|
|
|
108
158
|
ruby
|
|
109
159
|
|
|
110
160
|
DEPENDENCIES
|
|
161
|
+
danger
|
|
162
|
+
danger-commit_lint
|
|
111
163
|
minitest (~> 5.0)
|
|
112
164
|
minitest-focus
|
|
113
165
|
minitest-reporters
|
|
@@ -117,6 +169,3 @@ DEPENDENCIES
|
|
|
117
169
|
rubycritic
|
|
118
170
|
simplecov
|
|
119
171
|
uxid!
|
|
120
|
-
|
|
121
|
-
BUNDLED WITH
|
|
122
|
-
2.1.4
|
data/{LICENSE.txt → LICENSE}
RENAMED
|
File without changes
|
data/lib/uxid/version.rb
CHANGED
data/uxid.gemspec
CHANGED
|
@@ -7,9 +7,9 @@ Gem::Specification.new do |spec|
|
|
|
7
7
|
spec.authors = ["JohnnyT"]
|
|
8
8
|
spec.email = ["ubergeek3141@gmail.com"]
|
|
9
9
|
|
|
10
|
-
spec.summary = "Generates IDs like:
|
|
10
|
+
spec.summary = "Generates IDs like: cus_01EPEY1JMK and txn_01EPEY2P06TR1RTV07 (similar to Stripe identifiers)."
|
|
11
11
|
spec.description = spec.summary
|
|
12
|
-
spec.homepage = "https://github.com/riddler/uxid
|
|
12
|
+
spec.homepage = "https://github.com/riddler/uxid-rb"
|
|
13
13
|
spec.license = "MIT"
|
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new ">= 2.3.0"
|
|
15
15
|
|
metadata
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uxid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JohnnyT
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-11-
|
|
11
|
+
date: 2020-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: 'Generates IDs like:
|
|
14
|
-
|
|
13
|
+
description: 'Generates IDs like: cus_01EPEY1JMK and txn_01EPEY2P06TR1RTV07 (similar
|
|
14
|
+
to Stripe identifiers).'
|
|
15
15
|
email:
|
|
16
16
|
- ubergeek3141@gmail.com
|
|
17
17
|
executables: []
|
|
18
18
|
extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
|
20
20
|
files:
|
|
21
|
+
- ".github/workflows/build.yml"
|
|
22
|
+
- ".gitignore"
|
|
21
23
|
- ".rubocop.yml"
|
|
22
24
|
- ".simplecov"
|
|
23
25
|
- CHANGELOG.md
|
|
26
|
+
- Dangerfile
|
|
24
27
|
- Gemfile
|
|
25
28
|
- Gemfile.lock
|
|
26
|
-
- LICENSE
|
|
29
|
+
- LICENSE
|
|
27
30
|
- README.md
|
|
28
31
|
- Rakefile
|
|
29
32
|
- bin/console
|
|
@@ -34,17 +37,16 @@ files:
|
|
|
34
37
|
- lib/tasks/quality.rake
|
|
35
38
|
- lib/tasks/test.rake
|
|
36
39
|
- lib/uxid.rb
|
|
37
|
-
- lib/uxid/crockford.rb
|
|
38
40
|
- lib/uxid/encoder.rb
|
|
39
41
|
- lib/uxid/model.rb
|
|
40
42
|
- lib/uxid/version.rb
|
|
41
43
|
- uxid.gemspec
|
|
42
|
-
homepage: https://github.com/riddler/uxid
|
|
44
|
+
homepage: https://github.com/riddler/uxid-rb
|
|
43
45
|
licenses:
|
|
44
46
|
- MIT
|
|
45
47
|
metadata:
|
|
46
|
-
homepage_uri: https://github.com/riddler/uxid
|
|
47
|
-
source_code_uri: https://github.com/riddler/uxid
|
|
48
|
+
homepage_uri: https://github.com/riddler/uxid-rb
|
|
49
|
+
source_code_uri: https://github.com/riddler/uxid-rb
|
|
48
50
|
post_install_message:
|
|
49
51
|
rdoc_options: []
|
|
50
52
|
require_paths:
|
|
@@ -63,6 +65,6 @@ requirements: []
|
|
|
63
65
|
rubygems_version: 3.1.4
|
|
64
66
|
signing_key:
|
|
65
67
|
specification_version: 4
|
|
66
|
-
summary: 'Generates IDs like:
|
|
67
|
-
|
|
68
|
+
summary: 'Generates IDs like: cus_01EPEY1JMK and txn_01EPEY2P06TR1RTV07 (similar to
|
|
69
|
+
Stripe identifiers).'
|
|
68
70
|
test_files: []
|
data/lib/uxid/crockford.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module UXID
|
|
2
|
-
module Crockford
|
|
3
|
-
ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ".freeze
|
|
4
|
-
|
|
5
|
-
class Chunk
|
|
6
|
-
def initialize bytes
|
|
7
|
-
@bytes = bytes
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def decode
|
|
11
|
-
bytes = @bytes.take_while {|c| c != 61} # strip padding
|
|
12
|
-
n = (bytes.length * 5.0 / 8.0).floor
|
|
13
|
-
p = bytes.length < 8 ? 5 - (n * 8) % 5 : 0
|
|
14
|
-
c = bytes.inject(0) do |m,o|
|
|
15
|
-
i = ALPHABET.index o.chr
|
|
16
|
-
raise ArgumentError, "invalid character '#{o.chr}'" if i.nil?
|
|
17
|
-
(m << 5) + i
|
|
18
|
-
end >> p
|
|
19
|
-
(0..n-1).to_a.reverse.collect {|i| ((c >> i * 8) & 0xff).chr}
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def encode
|
|
23
|
-
n = (@bytes.length * 8.0 / 5.0).ceil
|
|
24
|
-
p = n < 8 ? 5 - (@bytes.length * 8) % 5 : 0
|
|
25
|
-
c = @bytes.inject(0) {|m,o| (m << 8) + o} << p
|
|
26
|
-
[(0..n-1).to_a.reverse.collect {|i| ALPHABET[(c >> i * 5) & 0x1f].chr}]
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def self.chunks str, size
|
|
31
|
-
result = []
|
|
32
|
-
bytes = str.bytes
|
|
33
|
-
while bytes.any? do
|
|
34
|
-
chunk_bytes = bytes.take size
|
|
35
|
-
bytes = bytes.drop size
|
|
36
|
-
new_chunk = Chunk.new chunk_bytes
|
|
37
|
-
result << new_chunk
|
|
38
|
-
end
|
|
39
|
-
result
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def self.encode str
|
|
43
|
-
chunks(str, 5).collect(&:encode).flatten.join
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def self.decode str
|
|
47
|
-
chunks(str, 8).collect(&:decode).flatten.join
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|