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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5db97ceae85d640608de26f0cc8930f42d8c8e97
4
- data.tar.gz: e3dc5d0c2727226addd3ffad366becda46f1b39a
3
+ metadata.gz: 533f1ae25b8fdd5f75c4b02c543ce60066810746
4
+ data.tar.gz: d93a9dfbbee23934a83a28518fea21773bc63dda
5
5
  SHA512:
6
- metadata.gz: 5596010d1556a0800a9b28b3512023a5624a8b3e0fc18b46d2ca5677578de44fe4e4390958f2f7832b4b3327341ffd113f00f32ca0eb9674b9ce9aa49a2ebbdd
7
- data.tar.gz: 458b5a8cc280cefc6ef18fecb40dc10ad944a8179deab1cae12132cec9a5bf8018857aa0ee5fefd5ef8903967ad33563ba0ccc0f54078d26a4ac2975e8eee310
6
+ metadata.gz: 4c7c09a594b947d6708ed41af3816c9e2772bf7561f6bb07d5612538bdcc77b762d5d37440e4a8e5fa80826f18fa7febb3b49d6d12cc03a172e749027c34202e
7
+ data.tar.gz: 23ee8ab5139f369cff367d5fa8307c3ad9f9405ddebcd93306413eeca5a49f2e506750f492caf47034819ac5eab4d5f7ecf091ff9f1d1d3ff47e7e5a610ac30a
@@ -5,6 +5,7 @@ cache:
5
5
  directories:
6
6
  - "$HOME/.ccache"
7
7
  rvm:
8
+ - 1.9.3
8
9
  - 2.2.0
9
10
  - 2.3.3
10
11
  - 2.4.0
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/brotli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
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 dependencies. 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.
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
@@ -4,4 +4,5 @@ IFS=$'\n\t'
4
4
 
5
5
  bundle install
6
6
 
7
- # Do any other automated setup that you need to do here
7
+ # Ensure Brotli library dependencies are available
8
+ git submodule update --init
@@ -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
  }
@@ -2,7 +2,12 @@
2
2
  #define BROTLI_H 1
3
3
 
4
4
  #include "ruby.h"
5
+
6
+ // ruby/thread.h is ruby 2.x
7
+ #ifdef HAVE_RUBY_THREAD_H
5
8
  #include "ruby/thread.h"
9
+ #endif
10
+
6
11
  #include "enc/encode.h"
7
12
  #include "dec/decode.h"
8
13
  #include "buffer.h"
@@ -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(__dir__, dir))
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(__dir__, '..', '..', 'vendor', 'brotli', dir, '*.[ch]'))]
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) }
@@ -1,3 +1,3 @@
1
1
  module Brotli
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -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(__dir__, '..', 'vendor', 'brotli', 'tests', 'testdata', 'alice29.txt'), __FILE__) }
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(__dir__, '..', 'vendor', 'brotli', 'tests', 'testdata', 'alice29.txt.compressed'), __FILE__)
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
@@ -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(__dir__, '..', 'vendor', 'brotli', 'tests', 'testdata', 'lcet10.txt'), __FILE__) }
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(__dir__, '..', 'vendor', 'brotli', 'tests', 'testdata', 'lcet10.txt.compressed'), __FILE__) }
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.7
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-04-11 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler