digest-crc 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/integration.yml +26 -0
- data/.github/workflows/ruby.yml +30 -0
- data/.gitignore +1 -0
- data/ChangeLog.md +10 -0
- data/README.md +19 -1
- data/Rakefile +15 -2
- data/ext/digest/Rakefile +7 -12
- data/gemspec.yml +4 -4
- data/lib/digest/crc16_qt.rb +2 -1
- data/spec/crc16_qt_spec.rb +1 -1
- data/spec/integration/docker/Dockerfile.base +9 -0
- data/spec/integration/docker/Dockerfile.with-gcc +3 -0
- data/spec/integration/docker/Dockerfile.with-gcc-and-make +3 -0
- data/spec/integration/install_spec.rb +59 -0
- metadata +11 -6
- data/.travis.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d9232bc15248414404921523bad56602e83532f5d8d783c1f90bcbaaec045cd
|
4
|
+
data.tar.gz: 0e33fbe550c55afb0c56a9dce895f584a0eacc2d2957d00008b72338effcd03b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d6969231e3e6f5ffe90d97627f7e39e318713355009d2848d89e289aeae873a452865d4e34be9871fcc8d4d7725f369ab11dde24c45135ec610519b52c76a6
|
7
|
+
data.tar.gz: 562a7d60009f5ec9fe29ca8aa6555bed1607d7659b2903e3f2efcfb9f12e331e22e0ed370056c7f6d03f8443c282c2659b2192e259880510913c803380edaa5a
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags: [ 'v0.*' ]
|
6
|
+
pull_request:
|
7
|
+
paths: [ 'ext/**' ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
tests:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
name: Integration Testing
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Docker
|
18
|
+
uses: docker-practice/actions-setup-docker@master
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: 2.7
|
23
|
+
- name: Install dependencies
|
24
|
+
run: bundle install --jobs 4 --retry 3
|
25
|
+
- name: Run integration tests
|
26
|
+
run: bundle exec rake spec:integration
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [ push, pull_request ]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
tests:
|
7
|
+
runs-on: ${{ matrix.os }}
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
os:
|
12
|
+
- ubuntu-latest
|
13
|
+
- macos-latest
|
14
|
+
ruby:
|
15
|
+
- 2.4
|
16
|
+
- 2.5
|
17
|
+
- 2.6
|
18
|
+
- 2.7
|
19
|
+
- jruby
|
20
|
+
name: OS ${{ matrix.os }} / Ruby ${{ matrix.ruby }}
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
27
|
+
- name: Install dependencies
|
28
|
+
run: bundle install --jobs 4 --retry 3
|
29
|
+
- name: Run tests
|
30
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 0.6.2 / 2020-12-03
|
2
|
+
|
3
|
+
* Lower the rake dependency to `~> 12.0` for ruby 2.6.
|
4
|
+
* Fixed a bug in `ext/digest/Rakefile` which prevented digest-crc from being
|
5
|
+
installed on systems where C extensions could not be successfully compiled.
|
6
|
+
* Rake's `ruby` method, which in turn calls rake's `sh` method, raises
|
7
|
+
a `RuntimeError` exception when the ruby command fails, causing rake to
|
8
|
+
exit with an error code. Instead, rescue any `RuntimeError` exceptions and
|
9
|
+
fail gracefully.
|
10
|
+
|
1
11
|
### 0.6.1 / 2020-07-02
|
2
12
|
|
3
13
|
* Fix installation issues under bundler by adding rake as an explicit dependency
|
data/README.md
CHANGED
@@ -54,6 +54,24 @@ module.
|
|
54
54
|
gem install digest-crc
|
55
55
|
```
|
56
56
|
|
57
|
+
**Note:** to enable the C extensions ensure that you are using CRuby and have
|
58
|
+
a C compiler (`gcc` or `clang`) and `make` installed, _before_ installing
|
59
|
+
digest-crc.
|
60
|
+
|
61
|
+
* Debian / Ubuntu:
|
62
|
+
|
63
|
+
$ sudo apt install gcc make
|
64
|
+
|
65
|
+
* RedHat / Fedora:
|
66
|
+
|
67
|
+
$ sudo dnf install gcc make
|
68
|
+
|
69
|
+
* Alpine Linux:
|
70
|
+
|
71
|
+
$ apk add build-base
|
72
|
+
|
73
|
+
* macOS: install XCode
|
74
|
+
|
57
75
|
## Examples
|
58
76
|
|
59
77
|
Calculate a CRC32:
|
@@ -157,7 +175,7 @@ end
|
|
157
175
|
Digest::CRC64XZ#update 3.019690 0.000000 3.019690 ( 3.040971)
|
158
176
|
|
159
177
|
### C extensions (ruby 2.7.1)
|
160
|
-
|
178
|
+
|
161
179
|
$ bundle exec rake build:c_exts
|
162
180
|
...
|
163
181
|
$ bundle exec ./benchmarks.rb
|
data/Rakefile
CHANGED
@@ -23,19 +23,32 @@ CLEAN.include('ext/digest/crc*/Makefile')
|
|
23
23
|
CLEAN.include('ext/digest/crc*/*.o')
|
24
24
|
CLEAN.include('ext/digest/crc*/*.so')
|
25
25
|
|
26
|
+
file 'spec/integration/docker/digest-crc.gem' do |t|
|
27
|
+
sh "gem build -o #{t.name} digest-crc.gemspec"
|
28
|
+
end
|
29
|
+
|
26
30
|
require 'rspec/core/rake_task'
|
27
31
|
namespace :spec do
|
28
|
-
RSpec::Core::RakeTask.new(:pure)
|
32
|
+
RSpec::Core::RakeTask.new(:pure) do |t|
|
33
|
+
t.exclude_pattern = 'spec/integration/*_spec.rb'
|
34
|
+
end
|
29
35
|
task :pure => :clean
|
30
36
|
|
31
37
|
if RUBY_ENGINE == 'ruby'
|
32
|
-
RSpec::Core::RakeTask.new(:c_exts)
|
38
|
+
RSpec::Core::RakeTask.new(:c_exts) do |t|
|
39
|
+
t.exclude_pattern = 'spec/integration/*_spec.rb'
|
40
|
+
end
|
33
41
|
task :c_exts => 'build:c_exts'
|
34
42
|
end
|
43
|
+
|
44
|
+
RSpec::Core::RakeTask.new(:integration) do |t|
|
45
|
+
t.pattern = 'spec/integration/*_spec.rb'
|
46
|
+
end
|
35
47
|
end
|
36
48
|
|
37
49
|
task :spec => 'spec:pure'
|
38
50
|
task :spec => 'spec:c_exts' if RUBY_ENGINE == 'ruby'
|
51
|
+
|
39
52
|
task :test => :spec
|
40
53
|
task :default => :spec
|
41
54
|
|
data/ext/digest/Rakefile
CHANGED
@@ -13,14 +13,6 @@ rescue LoadError
|
|
13
13
|
fail_gracefully "mkmf is not installed"
|
14
14
|
end
|
15
15
|
|
16
|
-
MAKE = $make # set by mkmf
|
17
|
-
|
18
|
-
def make(target=nil)
|
19
|
-
if target then sh(MAKE,target)
|
20
|
-
else sh(MAKE)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
16
|
CRCS = Dir['crc*']
|
25
17
|
DLEXT = MakeMakefile::CONFIG['DLEXT']
|
26
18
|
|
@@ -29,7 +21,9 @@ CRCS.each do |crc|
|
|
29
21
|
|
30
22
|
file "#{crc}/Makefile" => "#{crc}/extconf.rb" do
|
31
23
|
Dir.chdir(crc) do
|
32
|
-
|
24
|
+
begin
|
25
|
+
ruby '-S', 'extconf.rb'
|
26
|
+
rescue
|
33
27
|
fail_gracefully "extconf.rb failed"
|
34
28
|
end
|
35
29
|
end
|
@@ -39,9 +33,10 @@ CRCS.each do |crc|
|
|
39
33
|
|
40
34
|
file "#{crc}/#{crc_ext_lib}" => "#{crc}/Makefile" do
|
41
35
|
Dir.chdir(crc) do
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
begin
|
37
|
+
sh 'make', 'clean'
|
38
|
+
sh 'make'
|
39
|
+
rescue
|
45
40
|
fail_gracefully "Unable to build C extensions"
|
46
41
|
end
|
47
42
|
end
|
data/gemspec.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
name: digest-crc
|
2
|
-
version: 0.6.
|
2
|
+
version: 0.6.2
|
3
3
|
summary: A Cyclic Redundancy Check (CRC) library for Ruby.
|
4
4
|
description:
|
5
5
|
Adds support for calculating Cyclic Redundancy Check (CRC) to the Digest
|
@@ -21,8 +21,8 @@ extensions:
|
|
21
21
|
|
22
22
|
has_yard: true
|
23
23
|
|
24
|
+
dependencies:
|
25
|
+
rake: ~> 12.0
|
26
|
+
|
24
27
|
development_dependencies:
|
25
28
|
bundler: ~> 2.0
|
26
|
-
|
27
|
-
dependencies:
|
28
|
-
rake: ~> 13.0
|
data/lib/digest/crc16_qt.rb
CHANGED
data/spec/crc16_qt_spec.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
describe "installing digest-crc" do
|
4
|
+
ROOT_DIR = File.expand_path('../../..',__FILE__)
|
5
|
+
DOCKER_DIR = File.expand_path('../docker', __FILE__)
|
6
|
+
|
7
|
+
IMAGES = %w[
|
8
|
+
test-digest-crc-base
|
9
|
+
test-digest-crc-with-gcc
|
10
|
+
test-digest-crc-with-gcc-and-make
|
11
|
+
]
|
12
|
+
|
13
|
+
before(:all) do
|
14
|
+
puts ">>> Building digest-crc gem ..."
|
15
|
+
Dir.chdir(ROOT_DIR) do
|
16
|
+
system 'gem', 'build',
|
17
|
+
'-o', File.join(DOCKER_DIR,'digest-crc.gem'),
|
18
|
+
'digest-crc.gemspec'
|
19
|
+
end
|
20
|
+
|
21
|
+
IMAGES.each do |image|
|
22
|
+
suffix = image.sub('test-digest-crc-','')
|
23
|
+
|
24
|
+
puts ">>> Building #{image} docker image ..."
|
25
|
+
Dir.chdir(DOCKER_DIR) do
|
26
|
+
system "docker build -t #{image} --file Dockerfile.#{suffix} ."
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when installing into a slim environment" do
|
32
|
+
let(:image) { 'test-digest-crc-base' }
|
33
|
+
|
34
|
+
it "should successfully install digest-crc" do
|
35
|
+
expect(system("docker run #{image}")).to be(true)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when gcc is installed" do
|
40
|
+
let(:image) { 'test-digest-crc-with-gcc' }
|
41
|
+
|
42
|
+
it "should successfully install digest-crc" do
|
43
|
+
expect(system("docker run #{image}")).to be(true)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when gcc and make are installed" do
|
48
|
+
let(:image) { 'test-digest-crc-with-gcc-and-make' }
|
49
|
+
|
50
|
+
it "should successfully install digest-crc" do
|
51
|
+
expect(system("docker run #{image}")).to be(true)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
after(:all) do
|
56
|
+
puts ">>> Removing test-digest-crc docker images ..."
|
57
|
+
system "docker image rm -f #{IMAGES.reverse.join(' ')}"
|
58
|
+
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-crc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '12.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '12.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,9 +49,10 @@ extra_rdoc_files:
|
|
49
49
|
- LICENSE.txt
|
50
50
|
- README.md
|
51
51
|
files:
|
52
|
+
- ".github/workflows/integration.yml"
|
53
|
+
- ".github/workflows/ruby.yml"
|
52
54
|
- ".gitignore"
|
53
55
|
- ".rspec"
|
54
|
-
- ".travis.yml"
|
55
56
|
- ".yardopts"
|
56
57
|
- ChangeLog.md
|
57
58
|
- Gemfile
|
@@ -223,6 +224,10 @@ files:
|
|
223
224
|
- spec/crc8_spec.rb
|
224
225
|
- spec/crc_examples.rb
|
225
226
|
- spec/crc_spec.rb
|
227
|
+
- spec/integration/docker/Dockerfile.base
|
228
|
+
- spec/integration/docker/Dockerfile.with-gcc
|
229
|
+
- spec/integration/docker/Dockerfile.with-gcc-and-make
|
230
|
+
- spec/integration/install_spec.rb
|
226
231
|
- spec/spec_helper.rb
|
227
232
|
homepage: https://github.com/postmodern/digest-crc#readme
|
228
233
|
licenses:
|
@@ -248,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
253
|
- !ruby/object:Gem::Version
|
249
254
|
version: '0'
|
250
255
|
requirements: []
|
251
|
-
rubygems_version: 3.1.
|
256
|
+
rubygems_version: 3.1.4
|
252
257
|
signing_key:
|
253
258
|
specification_version: 4
|
254
259
|
summary: A Cyclic Redundancy Check (CRC) library for Ruby.
|
data/.travis.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
before_install:
|
3
|
-
- gem update --system
|
4
|
-
- gem install bundler -v "~> 2.0"
|
5
|
-
|
6
|
-
language: ruby
|
7
|
-
sudo: false
|
8
|
-
cache:
|
9
|
-
- bundler
|
10
|
-
|
11
|
-
rvm:
|
12
|
-
- 2.5
|
13
|
-
- 2.6
|
14
|
-
- 2.7
|
15
|
-
- jruby
|
16
|
-
|
17
|
-
matrix:
|
18
|
-
include:
|
19
|
-
- os: linux
|
20
|
-
- os: osx
|
21
|
-
allow_failures:
|
22
|
-
- rvm: jruby
|
23
|
-
|
24
|
-
script: bundle exec rake spec
|