brotli 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +10 -5
- data/bin/setup +2 -1
- data/ext/brotli/brotli.c +8 -0
- data/ext/brotli/brotli.h +5 -0
- data/ext/brotli/extconf.rb +2 -2
- data/lib/brotli/version.rb +1 -1
- data/spec/brotli_spec.rb +2 -2
- data/spec/inflate_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 533f1ae25b8fdd5f75c4b02c543ce60066810746
|
4
|
+
data.tar.gz: d93a9dfbbee23934a83a28518fea21773bc63dda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c7c09a594b947d6708ed41af3816c9e2772bf7561f6bb07d5612538bdcc77b762d5d37440e4a8e5fa80826f18fa7febb3b49d6d12cc03a172e749027c34202e
|
7
|
+
data.tar.gz: 23ee8ab5139f369cff367d5fa8307c3ad9f9405ddebcd93306413eeca5a49f2e506750f492caf47034819ac5eab4d5f7ecf091ff9f1d1d3ff47e7e5a610ac30a
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
# Brotli ![](https://travis-ci.org/miyucy/brotli.svg)
|
1
|
+
# Brotli [![](https://travis-ci.org/miyucy/brotli.svg)](https://travis-ci.org/miyucy/brotli)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Brotli is a Ruby implementation of the Brotli generic-purpose lossless
|
4
|
+
compression algorithm that compresses data using a combination of a modern
|
5
|
+
variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling,
|
6
|
+
with a compression ratio comparable to the best currently available
|
7
|
+
general-purpose compression methods. It is similar in speed with deflate but
|
8
|
+
offers more dense compression.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -32,7 +35,9 @@ See spec/brotli_spec.rb
|
|
32
35
|
|
33
36
|
## Development
|
34
37
|
|
35
|
-
After checking out the repo, run `bin/setup` to install
|
38
|
+
After checking out the repo, run `bin/setup` to install bundle and Brotli C library dependencies.
|
39
|
+
|
40
|
+
Run `rake build` to build brotli extension for ruby. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
41
|
|
37
42
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
43
|
|
data/bin/setup
CHANGED
data/ext/brotli/brotli.c
CHANGED
@@ -85,7 +85,11 @@ brotli_inflate(VALUE self, VALUE str)
|
|
85
85
|
NULL);
|
86
86
|
args.r = BROTLI_RESULT_ERROR;
|
87
87
|
|
88
|
+
#ifdef HAVE_RUBY_THREAD_H
|
88
89
|
rb_thread_call_without_gvl(brotli_inflate_no_gvl, (void *)&args, NULL, NULL);
|
90
|
+
#else
|
91
|
+
brotli_inflate_no_gvl((void *)&args);
|
92
|
+
#endif
|
89
93
|
if (args.r == BROTLI_DECODER_RESULT_SUCCESS) {
|
90
94
|
value = rb_str_new(args.buffer->ptr, args.buffer->used);
|
91
95
|
delete_buffer(args.buffer);
|
@@ -254,7 +258,11 @@ brotli_deflate(int argc, VALUE *argv, VALUE self)
|
|
254
258
|
args.buffer = create_buffer(BUFSIZ);
|
255
259
|
args.finished = BROTLI_FALSE;
|
256
260
|
|
261
|
+
#ifdef HAVE_RUBY_THREAD_H
|
257
262
|
rb_thread_call_without_gvl(brotli_deflate_no_gvl, (void *)&args, NULL, NULL);
|
263
|
+
#else
|
264
|
+
brotli_deflate_no_gvl((void *)&args);
|
265
|
+
#endif
|
258
266
|
if (args.finished == BROTLI_TRUE) {
|
259
267
|
value = rb_str_new(args.buffer->ptr, args.buffer->used);
|
260
268
|
}
|
data/ext/brotli/brotli.h
CHANGED
data/ext/brotli/extconf.rb
CHANGED
@@ -8,11 +8,11 @@ create_makefile('brotli/brotli')
|
|
8
8
|
|
9
9
|
def acopy(dir)
|
10
10
|
# source dir
|
11
|
-
FileUtils.mkdir_p File.expand_path(File.join(
|
11
|
+
FileUtils.mkdir_p File.expand_path(File.join(File.dirname(__FILE__), dir))
|
12
12
|
# object dir
|
13
13
|
FileUtils.mkdir_p dir
|
14
14
|
|
15
|
-
files = Dir[File.expand_path(File.join(
|
15
|
+
files = Dir[File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'brotli', dir, '*.[ch]'))]
|
16
16
|
FileUtils.cp files, dir, verbose: true
|
17
17
|
|
18
18
|
srcs = files.map { |e| File.basename e }.select { |e| e.end_with? '.c' }.map { |e| File.join(dir, e) }
|
data/lib/brotli/version.rb
CHANGED
data/spec/brotli_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'zlib'
|
3
3
|
|
4
4
|
describe Brotli do
|
5
|
-
let!(:data) { File.binread File.expand_path(File.join(
|
5
|
+
let!(:data) { File.binread File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'brotli', 'tests', 'testdata', 'alice29.txt'), __FILE__) }
|
6
6
|
|
7
7
|
context 'deflate/inflate' do
|
8
8
|
it 'with example data' do
|
@@ -82,7 +82,7 @@ describe Brotli do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'inflate' do
|
85
|
-
compressed = File.binread File.expand_path(File.join(
|
85
|
+
compressed = File.binread File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'brotli', 'tests', 'testdata', 'alice29.txt.compressed'), __FILE__)
|
86
86
|
expect(Brotli.inflate(compressed)).to eq data
|
87
87
|
end
|
88
88
|
end
|
data/spec/inflate_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require 'thread'
|
|
5
5
|
describe Brotli do
|
6
6
|
context 'deflate' do
|
7
7
|
let(:sample) { 10 }
|
8
|
-
let(:datum) { File.binread File.expand_path(File.join(
|
8
|
+
let(:datum) { File.binread File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'brotli', 'tests', 'testdata', 'lcet10.txt'), __FILE__) }
|
9
9
|
let!(:data) { sample.times.map { datum.dup } }
|
10
10
|
|
11
11
|
it 'seq' do
|
@@ -39,7 +39,7 @@ describe Brotli do
|
|
39
39
|
|
40
40
|
context 'inflate' do
|
41
41
|
let(:sample) { 1000 }
|
42
|
-
let(:datum) { File.binread File.expand_path(File.join(
|
42
|
+
let(:datum) { File.binread File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', 'brotli', 'tests', 'testdata', 'lcet10.txt.compressed'), __FILE__) }
|
43
43
|
let!(:data) { sample.times.map { datum.dup } }
|
44
44
|
|
45
45
|
it 'seq' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brotli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miyucy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|