ulid 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gempush.yml +32 -0
- data/.github/workflows/ruby.yml +20 -0
- data/CHANGELOG.md +11 -1
- data/Gemfile +0 -2
- data/Gemfile.lock +2 -8
- data/README.md +1 -0
- data/lib/ulid.rb +2 -1
- data/lib/ulid/version.rb +1 -1
- data/spec/lib/ulid_spec.rb +13 -19
- data/spec/spec_helper.rb +0 -1
- data/ulid.gemspec +4 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 230543f0c4e5df603c672392ff904ee3d7750c3aef49191afe747b0fd897d9a8
|
4
|
+
data.tar.gz: e36bc8ed67aae24ab46e96d6a17de084c4f1a387a5f1d9527422d3e64be23439
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7ca4e1e1abbc036fe57fdaa0d4195b7f90bc39c0db58a1cc4b51578b3527d92980e49aee197743ff641cf20112aa9afce60f9f265bced12b73b7e4e0f7c4c06
|
7
|
+
data.tar.gz: 809c3242b413c8e52397350fb4f36c71cb1b59f3a70054ad72c1ea2a713e5373ed9f9231a29a2329999c33430cdd2a5a4f9c4f728a1715f587faba2ee61b5b8e
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: Build + Publish
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby 2.6
|
19
|
+
uses: actions/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.6.x
|
22
|
+
|
23
|
+
- name: Publish to RubyGems
|
24
|
+
run: |
|
25
|
+
mkdir -p $HOME/.gem
|
26
|
+
touch $HOME/.gem/credentials
|
27
|
+
chmod 0600 $HOME/.gem/credentials
|
28
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
29
|
+
gem build *.gemspec
|
30
|
+
gem push *.gem
|
31
|
+
env:
|
32
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- name: Set up Ruby 2.6
|
13
|
+
uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6.x
|
16
|
+
- name: Build and test with Rake
|
17
|
+
run: |
|
18
|
+
gem install bundler
|
19
|
+
bundle install --jobs 4 --retry 3
|
20
|
+
bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
# 1.
|
1
|
+
# 1.1.1
|
2
|
+
|
3
|
+
- PR #19 - Remove Timecop gem
|
4
|
+
|
5
|
+
- PR #18 - Remove Mocha gem
|
6
|
+
|
7
|
+
- PR #17 - Add post_install_message to install sysrandom gem
|
8
|
+
|
9
|
+
- PR #16 - Remove circular require warning
|
10
|
+
|
11
|
+
# 1.1.0
|
2
12
|
|
3
13
|
- PR #14 - Ruby 2.5+ does not need sysrandom
|
4
14
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ulid (1.
|
4
|
+
ulid (1.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -10,11 +10,8 @@ GEM
|
|
10
10
|
base32-crockford (0.1.0)
|
11
11
|
byebug (9.1.0)
|
12
12
|
coderay (1.1.2)
|
13
|
-
metaclass (0.0.4)
|
14
13
|
method_source (0.9.0)
|
15
14
|
minitest (5.10.3)
|
16
|
-
mocha (1.3.0)
|
17
|
-
metaclass (~> 0.0.1)
|
18
15
|
parallel (1.12.0)
|
19
16
|
parser (2.4.0.0)
|
20
17
|
ast (~> 2.2)
|
@@ -36,7 +33,6 @@ GEM
|
|
36
33
|
ruby-progressbar (~> 1.7)
|
37
34
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
38
35
|
ruby-progressbar (1.8.3)
|
39
|
-
timecop (0.9.1)
|
40
36
|
unicode-display_width (1.3.0)
|
41
37
|
|
42
38
|
PLATFORMS
|
@@ -45,12 +41,10 @@ PLATFORMS
|
|
45
41
|
DEPENDENCIES
|
46
42
|
base32-crockford
|
47
43
|
minitest
|
48
|
-
mocha
|
49
44
|
pry-byebug
|
50
45
|
rake
|
51
46
|
rubocop
|
52
|
-
timecop
|
53
47
|
ulid!
|
54
48
|
|
55
49
|
BUNDLED WITH
|
56
|
-
|
50
|
+
2.0.1
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@ Universally Unique Lexicographically Sortable Identifier implementation for Ruby
|
|
10
10
|
<br>
|
11
11
|
</h1>
|
12
12
|
|
13
|
+
![Ruby](https://github.com/rafaelsales/ulid/workflows/Ruby/badge.svg)
|
13
14
|
[![Gem Downloads](http://img.shields.io/gem/dt/ulid.svg)](https://rubygems.org/gems/ulid)
|
14
15
|
[![GitHub License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/rafaelsales/ulid)
|
15
16
|
|
data/lib/ulid.rb
CHANGED
data/lib/ulid/version.rb
CHANGED
data/spec/lib/ulid_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'timecop'
|
3
2
|
require 'base32/crockford'
|
4
3
|
|
5
4
|
describe ULID do
|
@@ -12,11 +11,9 @@ describe ULID do
|
|
12
11
|
|
13
12
|
it 'is sortable' do
|
14
13
|
ulid1, ulid2 = nil
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
ulid2 = ULID.generate
|
19
|
-
end
|
14
|
+
input_time = Time.now
|
15
|
+
ulid1 = ULID.generate(input_time)
|
16
|
+
ulid2 = ULID.generate(input_time + 1)
|
20
17
|
assert ulid2 > ulid1
|
21
18
|
end
|
22
19
|
|
@@ -30,29 +27,26 @@ describe ULID do
|
|
30
27
|
it 'encodes the timestamp in the first 10 characters' do
|
31
28
|
# test case taken from original ulid README:
|
32
29
|
# https://github.com/alizain/ulid#seed-time
|
33
|
-
|
34
|
-
|
35
|
-
assert_equal '01ARYZ6S41', ulid[0...10]
|
36
|
-
end
|
30
|
+
ulid = ULID.generate(Time.at(1_469_918_176.385))
|
31
|
+
assert_equal '01ARYZ6S41', ulid[0...10]
|
37
32
|
end
|
38
33
|
end
|
39
34
|
|
40
35
|
describe 'underlying binary' do
|
41
36
|
it 'encodes the timestamp in the high 48 bits' do
|
42
37
|
input_time = Time.now.utc
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
assert_in_delta input_time, encoded_time, 0.001
|
48
|
-
end
|
38
|
+
bytes = ULID.generate_bytes(input_time)
|
39
|
+
(time_ms,) = "\x0\x0#{bytes[0...6]}".unpack('Q>')
|
40
|
+
encoded_time = Time.at(time_ms / 1000.0).utc
|
41
|
+
assert_in_delta input_time, encoded_time, 0.001
|
49
42
|
end
|
50
43
|
|
51
44
|
it 'encodes the remaining 80 bits as random' do
|
52
45
|
random_bytes = SecureRandom.random_bytes(ULID::Generator::RANDOM_BYTES)
|
53
|
-
ULID.
|
54
|
-
|
55
|
-
|
46
|
+
ULID.stub(:random_bytes, random_bytes) do
|
47
|
+
bytes = ULID.generate_bytes
|
48
|
+
assert bytes[6..-1] == random_bytes
|
49
|
+
end
|
56
50
|
end
|
57
51
|
end
|
58
52
|
end
|
data/spec/spec_helper.rb
CHANGED
data/ulid.gemspec
CHANGED
@@ -17,5 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.
|
20
|
+
spec.post_install_message = %q[
|
21
|
+
ulid gem needs to install sysrandom gem if you use Ruby 2.4 or older.
|
22
|
+
Execute `gem install sysrandom` or add `gem "sysrandom"` to Gemfile.
|
23
|
+
]
|
21
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ulid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Sales
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -18,6 +18,8 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- ".circleci/config.yml"
|
21
|
+
- ".github/workflows/gempush.yml"
|
22
|
+
- ".github/workflows/ruby.yml"
|
21
23
|
- ".gitignore"
|
22
24
|
- ".rubocop.yml"
|
23
25
|
- CHANGELOG.md
|
@@ -37,7 +39,10 @@ homepage: https://github.com/rafaelsales/ulid
|
|
37
39
|
licenses:
|
38
40
|
- MIT
|
39
41
|
metadata: {}
|
40
|
-
post_install_message:
|
42
|
+
post_install_message: |2
|
43
|
+
|
44
|
+
ulid gem needs to install sysrandom gem if you use Ruby 2.4 or older.
|
45
|
+
Execute `gem install sysrandom` or add `gem "sysrandom"` to Gemfile.
|
41
46
|
rdoc_options: []
|
42
47
|
require_paths:
|
43
48
|
- lib
|
@@ -53,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
58
|
version: '0'
|
54
59
|
requirements: []
|
55
60
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.7.6
|
61
|
+
rubygems_version: 2.7.6.2
|
57
62
|
signing_key:
|
58
63
|
specification_version: 4
|
59
64
|
summary: Universally Unique Lexicographically Sortable Identifier implementation for
|