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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1edaa0327ef87c3e253bba262945fd44ca79e5b75592da8730650a85c6bdc400
4
- data.tar.gz: 4aea0c8c2a93341410d9da2880390d06a9723effd283079b61b44c6b99b5ff3e
3
+ metadata.gz: 230543f0c4e5df603c672392ff904ee3d7750c3aef49191afe747b0fd897d9a8
4
+ data.tar.gz: e36bc8ed67aae24ab46e96d6a17de084c4f1a387a5f1d9527422d3e64be23439
5
5
  SHA512:
6
- metadata.gz: 03a78283cfb641590e7c5eda7054afe9ea63efffb7d268f6ce93289d66db56b6d67c83784792ffb715bb49c48ebd81a520cbbe2e5e225dd81364e52fbe98ed88
7
- data.tar.gz: a84b4d06796ccd2a9e9e27bb366b331bf0eaa3244e998b222d51917a89890730199cacd39ceece9ca2998c8280cd2abe6ae3cc64b77447d04b5707bae387404f
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.2.0
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
@@ -11,6 +11,4 @@ end
11
11
  group :test do
12
12
  gem 'base32-crockford'
13
13
  gem 'minitest'
14
- gem 'mocha'
15
- gem 'timecop'
16
14
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ulid (1.0.0)
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
- 1.17.3
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
@@ -1,4 +1,5 @@
1
- Dir.glob(File.join(File.dirname(__FILE__), '/**/*.rb')).sort.each { |f| require f }
1
+ require 'ulid/version'
2
+ require 'ulid/generator'
2
3
 
3
4
  module ULID
4
5
  extend Generator
data/lib/ulid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ULID
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
@@ -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
- Timecop.freeze do
16
- ulid1 = ULID.generate
17
- Timecop.travel Time.now + 1
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
- Timecop.freeze(Time.at(1_469_918_176.385)) do
34
- ulid = ULID.generate(Time.at(1_469_918_176.385))
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
- Timecop.freeze(input_time) do
44
- bytes = ULID.generate_bytes
45
- (time_ms,) = "\x0\x0#{bytes[0...6]}".unpack('Q>')
46
- encoded_time = Time.at(time_ms / 1000.0).utc
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.stubs(:random_bytes).returns(random_bytes)
54
- bytes = ULID.generate_bytes
55
- assert bytes[6..-1] == random_bytes
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
@@ -1,5 +1,4 @@
1
1
  require 'pry'
2
2
  require 'minitest/autorun'
3
3
  require 'minitest/pride'
4
- require 'mocha/mini_test'
5
4
  require 'ulid'
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.add_dependency 'sysrandom', '>= 1.0.0', '< 2.0' if RUBY_VERSION < '2.5'
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.0
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: 2019-04-02 00:00:00.000000000 Z
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