uxid 0.2.3 → 1.0.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.
data/Gemfile.lock DELETED
@@ -1,171 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- uxid (0.2.2)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- addressable (2.7.0)
10
- public_suffix (>= 2.0.2, < 5.0)
11
- ansi (1.5.0)
12
- ast (2.4.1)
13
- axiom-types (0.1.1)
14
- descendants_tracker (~> 0.0.4)
15
- ice_nine (~> 0.11.0)
16
- thread_safe (~> 0.3, >= 0.3.1)
17
- builder (3.2.4)
18
- claide (1.0.3)
19
- claide-plugins (0.9.2)
20
- cork
21
- nap
22
- open4 (~> 1.3)
23
- coderay (1.1.3)
24
- coercible (1.0.0)
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)
46
- descendants_tracker (0.0.4)
47
- thread_safe (~> 0.3, >= 0.3.1)
48
- docile (1.3.2)
49
- equalizer (0.0.11)
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)
56
- flay (2.12.1)
57
- erubis (~> 2.7.0)
58
- path_expander (~> 1.0)
59
- ruby_parser (~> 3.0)
60
- sexp_processor (~> 4.0)
61
- flog (4.6.4)
62
- path_expander (~> 1.0)
63
- ruby_parser (~> 3.1, > 3.1.0)
64
- sexp_processor (~> 4.8)
65
- git (1.7.0)
66
- rchardet (~> 1.8)
67
- ice_nine (0.11.2)
68
- kramdown (2.3.0)
69
- rexml
70
- kramdown-parser-gfm (1.1.0)
71
- kramdown (~> 2.0)
72
- kwalify (0.7.2)
73
- launchy (2.5.0)
74
- addressable (~> 2.7)
75
- method_source (0.9.2)
76
- minitest (5.14.1)
77
- minitest-focus (1.2.1)
78
- minitest (>= 4, < 6)
79
- minitest-reporters (1.4.2)
80
- ansi
81
- builder
82
- minitest (>= 5.0)
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)
91
- parallel (1.19.2)
92
- parser (2.7.1.3)
93
- ast (~> 2.4.0)
94
- path_expander (1.1.0)
95
- pry (0.12.2)
96
- coderay (~> 1.1.0)
97
- method_source (~> 0.9.0)
98
- pry-nav (0.3.0)
99
- pry (>= 0.9.10, < 0.13.0)
100
- psych (3.1.0)
101
- public_suffix (4.0.5)
102
- rainbow (3.0.0)
103
- rake (12.3.3)
104
- rchardet (1.8.0)
105
- reek (6.0.1)
106
- kwalify (~> 0.7.0)
107
- parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
108
- psych (~> 3.1.0)
109
- rainbow (>= 2.0, < 4.0)
110
- regexp_parser (1.7.1)
111
- rexml (3.2.4)
112
- rubocop (0.85.1)
113
- parallel (~> 1.10)
114
- parser (>= 2.7.0.1)
115
- rainbow (>= 2.2.2, < 4.0)
116
- regexp_parser (>= 1.7)
117
- rexml
118
- rubocop-ast (>= 0.0.3)
119
- ruby-progressbar (~> 1.7)
120
- unicode-display_width (>= 1.4.0, < 2.0)
121
- rubocop-ast (0.0.3)
122
- parser (>= 2.7.0.1)
123
- ruby-progressbar (1.10.1)
124
- ruby2_keywords (0.0.2)
125
- ruby_parser (3.14.2)
126
- sexp_processor (~> 4.9)
127
- rubycritic (4.5.0)
128
- flay (~> 2.8)
129
- flog (~> 4.4)
130
- launchy (>= 2.0.0)
131
- parser (>= 2.6.0)
132
- rainbow (~> 3.0)
133
- reek (~> 6.0, < 7.0)
134
- ruby_parser (~> 3.8)
135
- simplecov (>= 0.17.0)
136
- tty-which (~> 0.4.0)
137
- virtus (~> 1.0)
138
- sawyer (0.8.2)
139
- addressable (>= 2.3.5)
140
- faraday (> 0.8, < 2.0)
141
- sexp_processor (4.15.0)
142
- simplecov (0.18.5)
143
- docile (~> 1.1)
144
- simplecov-html (~> 0.11)
145
- simplecov-html (0.12.2)
146
- terminal-table (1.8.0)
147
- unicode-display_width (~> 1.1, >= 1.1.1)
148
- thread_safe (0.3.6)
149
- tty-which (0.4.2)
150
- unicode-display_width (1.7.0)
151
- virtus (1.0.5)
152
- axiom-types (~> 0.1)
153
- coercible (~> 1.0)
154
- descendants_tracker (~> 0.0, >= 0.0.3)
155
- equalizer (~> 0.0, >= 0.0.9)
156
-
157
- PLATFORMS
158
- ruby
159
-
160
- DEPENDENCIES
161
- danger
162
- danger-commit_lint
163
- minitest (~> 5.0)
164
- minitest-focus
165
- minitest-reporters
166
- pry-nav
167
- rake (~> 12.0)
168
- rubocop
169
- rubycritic
170
- simplecov
171
- uxid!
data/Rakefile DELETED
@@ -1,3 +0,0 @@
1
- Rake.add_rakelib "lib/tasks"
2
-
3
- task default: :test
data/bin/console DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "uxid"
5
-
6
- require "pry"
7
- Pry.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,4 +0,0 @@
1
- begin
2
- require "bundler/gem_tasks"
3
- rescue LoadError
4
- end
data/lib/tasks/check.rake DELETED
@@ -1,2 +0,0 @@
1
- desc "Runs tests, linting, audits, ..."
2
- task check: %w[ test linting:dev metrics:quality ]
@@ -1,19 +0,0 @@
1
- begin
2
- require "rubocop/rake_task"
3
-
4
- desc "Run Linting (RuboCop)"
5
- task linting: "linting:dev"
6
-
7
- namespace :linting do
8
- common_options = %w[ --display-cop-names --extra-details --config=.rubocop.yml --parallel ]
9
-
10
- RuboCop::RakeTask.new :dev do |t|
11
- t.options = common_options
12
- end
13
-
14
- RuboCop::RakeTask.new :report do |t|
15
- t.options = common_options + %w[ --format=html --out=reports/linting/index.html ]
16
- end
17
- end
18
- rescue LoadError
19
- end
@@ -1,12 +0,0 @@
1
- begin
2
- require "rubycritic/rake_task"
3
-
4
- namespace :metrics do
5
- RubyCritic::RakeTask.new do |task|
6
- task.name = "quality"
7
- task.paths = FileList["lib/**/*.rb"]
8
- task.options = "--format html --no-browser --path reports/quality"
9
- end
10
- end
11
- rescue LoadError
12
- end
data/lib/tasks/test.rake DELETED
@@ -1,8 +0,0 @@
1
- require "rake/testtask"
2
-
3
- Rake::TestTask.new :test do |t|
4
- t.libs << "lib"
5
- t.libs << "test"
6
- t.test_files = FileList["test/**/*_test.rb"]
7
- t.warning = false
8
- end
data/lib/uxid/model.rb DELETED
@@ -1,44 +0,0 @@
1
- require "uxid/encoder"
2
-
3
- module UXID
4
- class Model
5
- attr_accessor :time, :time_encoded, :entropy, :entropy_encoded, :prefix, :size, :rand_size
6
-
7
- def encode
8
- encoder = ::UXID::Encoder.new self
9
- encoder.encode
10
- end
11
-
12
- # Returns time as 48 bits
13
- def time_bytes
14
- return @time_bytes if @time_bytes
15
-
16
- time_ms = (@time.to_f * 1000).to_i
17
- bytes = [time_ms].pack "Q>"
18
- bytes_string = bytes[2..-1]
19
- @time_bytes = bytes_string.bytes
20
- end
21
-
22
- def entropy_bytes
23
- return @entropy_bytes if @entropy_bytes
24
-
25
- bytes_string = SecureRandom.random_bytes @rand_size
26
- @entropy_bytes = bytes_string.bytes
27
- return @entropy_bytes
28
- end
29
-
30
- def encoded
31
- id = time_encoded + entropy_encoded
32
-
33
- if has_prefix?
34
- [prefix, id].join UXID::DELIMITER
35
- else
36
- id
37
- end
38
- end
39
-
40
- def has_prefix?
41
- !(prefix.nil? || prefix == "")
42
- end
43
- end
44
- end
data/uxid.gemspec DELETED
@@ -1,27 +0,0 @@
1
- require_relative "lib/uxid/version"
2
- here = File.expand_path "..", __FILE__
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "uxid"
6
- spec.version = UXID::VERSION
7
- spec.authors = ["JohnnyT"]
8
- spec.email = ["ubergeek3141@gmail.com"]
9
-
10
- spec.summary = "Generates IDs like: cus_01EPEY1JMK and txn_01EPEY2P06TR1RTV07 (similar to Stripe identifiers)."
11
- spec.description = spec.summary
12
- spec.homepage = "https://github.com/riddler/uxid-rb"
13
- spec.license = "MIT"
14
- spec.required_ruby_version = Gem::Requirement.new ">= 2.3.0"
15
-
16
- spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = spec.homepage
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir here do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match %r{^(test|spec|features)/} }
23
- end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
26
- spec.require_paths = ["lib"]
27
- end