snappy 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDhhNWY2MDRkMGE4MGUzYTVmODU4OWU5ZjE1NjFmYzA1OWNlOWI5Mw==
5
+ data.tar.gz: !binary |-
6
+ Yzg3ZTcyNjIwNjUyMzhhZTk5NjliMDM5NTMzZGExODcwNTNmNTJjMQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YTc2MTFkZjQzYmY0ZWY2NzE0OThjNmU2YWUyYjNiNzIxYzhhZDhkYTI4MmFi
10
+ YWE1OGE3NWQ2OTI3MmEyNTcyOWU5NWEwM2U1ODJmYmFkODRjZGIwMDMxZGVh
11
+ Y2U5OTI4MzI4ODhmMmFlNGQzMmM3MmQwMWZmZWVlYzg5YjRlZjg=
12
+ data.tar.gz: !binary |-
13
+ NTZmOWU3NzRkZjZjYjhkNDc1NmU4YjYxNDMzOGIxOWM4NjNiYjAwODIzM2Q2
14
+ YWU1MjllYzdmODdmNDljYzA1Nzk5OGFiMzg2YjE3ZDVhN2FhNDI0NDk0OTll
15
+ MTVkNmRlMjgxZGI5YzY0YzY2MWIzM2I2OTRjYTkxODRmNjM3OGY=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile CHANGED
@@ -1,13 +1,4 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
1
+ source 'https://rubygems.org'
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "rspec", "~> 2.11.0"
10
- gem "bundler", "~> 1.1.0"
11
- gem "jeweler", "~> 1.8.4"
12
- gem "rcov", ">= 0"
13
- end
3
+ # Specify your gem's dependencies in snappy.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,6 @@
1
- Copyright (c) 2011 miyucy
1
+ Copyright (c) 2011-2013 miyucy
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Snappy
2
+
3
+ see http://code.google.com/p/snappy
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'snappy'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install snappy
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ require 'snappy'
23
+
24
+ Snappy.deflate(source)
25
+ # => Compressed data
26
+
27
+ Snappy.inflate(source)
28
+ # => Decompressed data
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,58 +1,8 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- require 'rbconfig'
4
- begin
5
- Bundler.setup(:default, :development)
6
- rescue Bundler::BundlerError => e
7
- $stderr.puts e.message
8
- $stderr.puts "Run `bundle install` to install missing gems"
9
- exit e.status_code
10
- end
11
- require 'rake'
12
-
13
- DLEXT = RbConfig::CONFIG['DLEXT']
14
-
15
- require 'jeweler'
16
- Jeweler::Tasks.new do |gem|
17
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
18
- gem.name = "snappy"
19
- gem.homepage = "http://github.com/miyucy/snappy"
20
- gem.license = "MIT"
21
- gem.summary = %Q{libsnappy binding for Ruby}
22
- gem.description = %Q{libsnappy binding for Ruby}
23
- gem.email = "miyucy@gmail.com"
24
- gem.authors = ["miyucy"]
25
- # Include your dependencies below. Runtime dependencies are required when using your gem,
26
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
27
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
28
- # gem.add_development_dependency 'rspec', '> 1.2.3'
29
- end
30
- Jeweler::RubygemsDotOrgTasks.new
31
-
32
- require 'rspec/core'
33
- require 'rspec/core/rake_task'
34
- RSpec::Core::RakeTask.new(:spec) do |spec|
35
- spec.pattern = FileList['spec/**/*_spec.rb']
36
- end
37
-
38
- RSpec::Core::RakeTask.new(:rcov) do |spec|
39
- spec.pattern = 'spec/**/*_spec.rb'
40
- spec.rcov = true
41
- end
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ require "rbconfig"
42
4
 
43
- task :default => :spec
44
-
45
- require 'rake/rdoctask'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
-
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "snappy #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('ext/**/*.cc')
53
- end
54
-
55
- task :spec => "ext/snappy.#{DLEXT}"
5
+ DLEXT = RbConfig::CONFIG["DLEXT"]
56
6
 
57
7
  file "ext/snappy.#{DLEXT}" => Dir.glob("ext/*{.rb,.c}") do
58
8
  Dir.chdir("ext") do
@@ -64,4 +14,10 @@ end
64
14
 
65
15
  task :clean do
66
16
  rm_rf(["ext/snappy.#{DLEXT}", "lib/snappy.#{DLEXT}", "ext/mkmf.log", "ext/config.h", "ext/api.o", "ext/Makefile", "ext/snappy.cc", "ext/snappy.h", "ext/snappy.o"] + Dir["ext/snappy-*"])
67
- end
17
+ end
18
+
19
+ Rake::TestTask.new do |t|
20
+ t.warning = true
21
+ t.verbose = true
22
+ end
23
+ task :test => "ext/snappy.#{DLEXT}"
data/ext/extconf.rb CHANGED
@@ -1,46 +1,13 @@
1
1
  require 'mkmf'
2
2
  require 'fileutils'
3
3
 
4
- def try_configure
5
- return if system "./configure --disable-option-checking --disable-dependency-tracking --disable-gtest --without-gflags"
6
-
7
- if try_run 'int main(int argc, char** argv){ return __builtin_expect(1, 1) ? 0 : 1; }'
8
- $defs << '-DHAVE_BUILTIN_EXPECT'
9
- end
10
-
11
- if try_run 'int main(int argc, char** argv){ return (__builtin_ctzll(0x100000000LL) == 32) ? 0 : 1; }'
12
- $defs << '-DHAVE_BUILTIN_CTZ'
13
- end
14
-
15
- have_header 'dlfcn.h'
16
- have_header 'inttypes.h'
17
- have_header 'memory.h'
18
- have_header 'stddef.h'
19
- have_header 'stdint.h'
20
- have_header 'stdlib.h'
21
- have_header 'strings.h'
22
- have_header 'string.h'
23
- have_header 'sys/byteswap.h'
24
- have_header 'sys/endian.h'
25
- have_header 'sys/mman.h'
26
- have_header 'sys/resource.h'
27
- have_header 'sys/stat.h'
28
- have_header 'sys/types.h'
29
- have_header 'unistd.h'
30
- have_header 'windows.h'
31
-
32
- if try_run 'int main(int argc, char** argv){ int i = 1; return *((char*)&i); }'
33
- $defs << '-DWORDS_BIGENDIAN'
34
- end
35
- end
36
-
37
4
  unless have_library 'snappy'
38
5
  dst = File.dirname File.expand_path __FILE__
39
6
 
40
7
  tar = 'tar'
41
8
  tar = 'gnutar' if find_executable 'gnutar'
42
9
 
43
- ver = "1.0.4"
10
+ ver = "1.1.0"
44
11
  src = "snappy-#{ver}"
45
12
 
46
13
  FileUtils.rm_rf File.join dst, src
@@ -49,7 +16,7 @@ unless have_library 'snappy'
49
16
  src = File.join dst, src
50
17
 
51
18
  Dir.chdir src do
52
- try_configure
19
+ system "./configure --disable-option-checking --disable-dependency-tracking --disable-gtest --without-gflags"
53
20
  end
54
21
 
55
22
  %w(
@@ -61,23 +28,12 @@ snappy-sinksource.cc
61
28
  snappy-sinksource.h
62
29
  snappy-stubs-internal.cc
63
30
  snappy-stubs-internal.h
31
+ snappy-stubs-public.h
64
32
  snappy.cc
65
33
  snappy.h
66
34
  ).each do |file|
67
35
  FileUtils.copy File.join(src, file), File.join(dst, file) if FileTest.exist? File.join(src, file)
68
36
  end
69
-
70
- hdr = File.open(File.join(src, 'snappy-stubs-public.h.in'), 'rb'){ |f| f.read }
71
- {
72
- %r'#if @ac_cv_have_stdint_h@' => '#ifdef HAVE_STDINT_H',
73
- %r'#if @ac_cv_have_stddef_h@' => '#ifdef HAVE_STDDEF_H',
74
- %r'@SNAPPY_MAJOR@' => '1',
75
- %r'@SNAPPY_MINOR@' => '0',
76
- %r'@SNAPPY_PATCHLEVEL@' => '4',
77
- }.each { |ptn, str| hdr.gsub! ptn, str }
78
- File.open(File.join(dst, 'snappy-stubs-public.h'), 'wb'){ |f| f.write hdr }
79
-
80
- FileUtils.touch 'config.h'
81
37
  end
82
38
 
83
39
  have_library 'stdc++'
data/lib/snappy/reader.rb CHANGED
@@ -2,7 +2,7 @@ module Snappy
2
2
  class Reader
3
3
  attr_reader :io, :magic, :default_version, :minimum_compatible_version
4
4
 
5
- def initialize io
5
+ def initialize(io)
6
6
  @io = io
7
7
  @io.set_encoding Encoding::ASCII_8BIT unless RUBY_VERSION =~ /^1\.8/
8
8
  read_header!
@@ -40,7 +40,7 @@ module Snappy
40
40
  private
41
41
 
42
42
  def read_header!
43
- magic_byte = @io.readchar()
43
+ magic_byte = @io.readchar
44
44
  @io.ungetc(magic_byte)
45
45
 
46
46
  if @io.length >= 16 && magic_byte == Snappy::Writer::MAGIC[0]
@@ -0,0 +1,3 @@
1
+ module Snappy
2
+ VERSION = "0.0.5"
3
+ end
data/lib/snappy/writer.rb CHANGED
@@ -7,7 +7,7 @@ module Snappy
7
7
 
8
8
  attr_reader :io, :block_size
9
9
 
10
- def initialize io, block_size = DEFAULT_BLOCK_SIZE
10
+ def initialize(io, block_size = DEFAULT_BLOCK_SIZE)
11
11
  @block_size = block_size
12
12
  @buffer = ""
13
13
  @io = io
@@ -19,7 +19,7 @@ module Snappy
19
19
  end
20
20
  end
21
21
 
22
- def << msg
22
+ def <<(msg)
23
23
  @buffer << msg.to_s
24
24
  dump! if @buffer.size > @block_size
25
25
  end
@@ -39,4 +39,4 @@ module Snappy
39
39
  @io << [MAGIC, DEFAULT_VERSION, MINIMUM_COMPATIBLE_VERSION].pack("a8NN")
40
40
  end
41
41
  end
42
- end
42
+ end
data/snappy.gemspec CHANGED
@@ -1,65 +1,25 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'snappy/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = "snappy"
8
- s.version = "0.0.4"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "snappy"
8
+ spec.version = Snappy::VERSION
9
+ spec.authors = ["miyucy"]
10
+ spec.email = ["fistfvck@gmail.com"]
11
+ spec.description = %q{libsnappy binding for Ruby}
12
+ spec.summary = %q{libsnappy binding for Ruby}
13
+ spec.homepage = "http://github.com/miyucy/snappy"
14
+ spec.license = "MIT"
9
15
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["miyucy"]
12
- s.date = "2012-12-17"
13
- s.description = "libsnappy binding for Ruby"
14
- s.email = "miyucy@gmail.com"
15
- s.extensions = ["ext/extconf.rb"]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".rspec",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE.txt",
26
- "README.rdoc",
27
- "Rakefile",
28
- "VERSION",
29
- "ext/api.cc",
30
- "ext/extconf.rb",
31
- "lib/snappy/reader.rb",
32
- "lib/snappy/writer.rb",
33
- "snappy.gemspec",
34
- "spec/snappy/reader_spec.rb",
35
- "spec/snappy/writer_spec.rb",
36
- "spec/spec_helper.rb"
37
- ]
38
- s.homepage = "http://github.com/miyucy/snappy"
39
- s.licenses = ["MIT"]
40
- s.require_paths = ["lib"]
41
- s.rubygems_version = "1.8.24"
42
- s.summary = "libsnappy binding for Ruby"
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+ spec.extensions = ["ext/extconf.rb"]
43
21
 
44
- if s.respond_to? :specification_version then
45
- s.specification_version = 3
46
-
47
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
- s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
49
- s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
50
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
51
- s.add_development_dependency(%q<rcov>, [">= 0"])
52
- else
53
- s.add_dependency(%q<rspec>, ["~> 2.11.0"])
54
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
56
- s.add_dependency(%q<rcov>, [">= 0"])
57
- end
58
- else
59
- s.add_dependency(%q<rspec>, ["~> 2.11.0"])
60
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
61
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
62
- s.add_dependency(%q<rcov>, [">= 0"])
63
- end
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "minitest"
64
25
  end
65
-
@@ -0,0 +1,113 @@
1
+ require "minitest/spec"
2
+ require "minitest/autorun"
3
+ require "snappy"
4
+ require "stringio"
5
+
6
+ describe Snappy::Reader do
7
+ before do
8
+ @buffer = StringIO.new
9
+ Snappy::Writer.new @buffer do |w|
10
+ w << "foo"
11
+ w << "bar"
12
+ w << "baz"
13
+ w << "quux"
14
+ end
15
+ @buffer.rewind
16
+ end
17
+
18
+ subject do
19
+ Snappy::Reader.new @buffer
20
+ end
21
+
22
+ describe :initialize do
23
+ it "should yield itself to the block" do
24
+ yielded = nil
25
+ returned = Snappy::Reader.new @buffer do |r|
26
+ yielded = r
27
+ end
28
+ returned.must_equal yielded
29
+ end
30
+
31
+ it "should read the header" do
32
+ subject.magic.must_equal Snappy::Writer::MAGIC
33
+ subject.default_version.must_equal Snappy::Writer::DEFAULT_VERSION
34
+ subject.minimum_compatible_version.must_equal Snappy::Writer::MINIMUM_COMPATIBLE_VERSION
35
+ end
36
+ end
37
+
38
+ describe :initialize_without_headers do
39
+ before do
40
+ @buffer = StringIO.new
41
+ @buffer << Snappy.deflate("HelloWorld" * 10)
42
+ @buffer.rewind
43
+ end
44
+
45
+ it "should inflate with a magic header" do
46
+ subject.read.must_equal "HelloWorld" * 10
47
+ end
48
+ end
49
+
50
+ describe :io do
51
+ it "should be a constructor argument" do
52
+ subject.io.must_equal @buffer
53
+ end
54
+ end
55
+
56
+ describe :each do
57
+ before do
58
+ Snappy::Writer.new @buffer do |w|
59
+ w << "foo"
60
+ w << "bar"
61
+ w.dump!
62
+ w << "baz"
63
+ w << "quux"
64
+ end
65
+ @buffer.rewind
66
+ end
67
+
68
+ it "should yield each chunk" do
69
+ chunks = []
70
+ Snappy::Reader.new(@buffer).each do |chunk|
71
+ chunks << chunk
72
+ end
73
+ chunks.must_equal ["foobar", "bazquux"]
74
+ end
75
+ end
76
+
77
+ describe :read do
78
+ before do
79
+ Snappy::Writer.new @buffer do |w|
80
+ w << "foo"
81
+ w << "bar"
82
+ w << "baz"
83
+ w << "quux"
84
+ end
85
+ @buffer.rewind
86
+ end
87
+
88
+ it "should return the bytes" do
89
+ Snappy::Reader.new(@buffer).read.must_equal "foobarbazquux"
90
+ end
91
+ end
92
+
93
+ describe :each_line do
94
+ before do
95
+ Snappy::Writer.new @buffer do |w|
96
+ w << "foo\n"
97
+ w << "bar"
98
+ w.dump!
99
+ w << "baz\n"
100
+ w << "quux\n"
101
+ end
102
+ @buffer.rewind
103
+ end
104
+
105
+ it "should yield each line" do
106
+ lines = []
107
+ Snappy::Reader.new(@buffer).each_line do |line|
108
+ lines << line
109
+ end
110
+ lines.must_equal ["foo", "barbaz", "quux"]
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,55 @@
1
+ require "minitest/spec"
2
+ require "minitest/autorun"
3
+ require "snappy"
4
+ require "stringio"
5
+
6
+ describe Snappy::Writer do
7
+ before do
8
+ @buffer = StringIO.new
9
+ end
10
+
11
+ subject do
12
+ Snappy::Writer.new @buffer
13
+ end
14
+
15
+ describe :initialize do
16
+ it "should yield itself to the block" do
17
+ yielded = nil
18
+ returned = Snappy::Writer.new @buffer do |w|
19
+ yielded = w
20
+ end
21
+ returned.must_equal yielded
22
+ end
23
+
24
+ it "should write the header" do
25
+ subject.io.string.must_equal [Snappy::Writer::MAGIC,
26
+ Snappy::Writer::DEFAULT_VERSION,
27
+ Snappy::Writer::MINIMUM_COMPATIBLE_VERSION].pack("a8NN")
28
+ end
29
+
30
+ it "should dump on the end of yield" do
31
+ Snappy::Writer.new @buffer do |w|
32
+ w << "foo"
33
+ end
34
+ foo = Snappy.deflate "foo"
35
+ @buffer.string[16, @buffer.size - 16].must_equal [foo.size, foo].pack("Na#{foo.size}")
36
+ end
37
+ end
38
+
39
+ describe :io do
40
+ it "should be a constructor argument" do
41
+ io = StringIO.new
42
+ Snappy::Writer.new(io).io.must_equal io
43
+ end
44
+ end
45
+
46
+ describe :block_size do
47
+ it "should default to DEFAULT_BLOCK_SIZE" do
48
+ Snappy::Writer.new(StringIO.new).block_size.must_equal Snappy::Writer::DEFAULT_BLOCK_SIZE
49
+ end
50
+
51
+ it "should be settable via the constructor" do
52
+ Snappy::Writer.new(StringIO.new, 42).block_size.must_equal 42
53
+ end
54
+ end
55
+ end
metadata CHANGED
@@ -1,68 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snappy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - miyucy
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-17 00:00:00.000000000 Z
11
+ date: 2013-03-06 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.11.0
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 2.11.0
30
13
  - !ruby/object:Gem::Dependency
31
14
  name: bundler
32
15
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
16
  requirements:
35
17
  - - ~>
36
18
  - !ruby/object:Gem::Version
37
- version: 1.1.0
19
+ version: '1.3'
38
20
  type: :development
39
21
  prerelease: false
40
22
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
23
  requirements:
43
24
  - - ~>
44
25
  - !ruby/object:Gem::Version
45
- version: 1.1.0
26
+ version: '1.3'
46
27
  - !ruby/object:Gem::Dependency
47
- name: jeweler
28
+ name: rake
48
29
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
30
  requirements:
51
- - - ~>
31
+ - - ! '>='
52
32
  - !ruby/object:Gem::Version
53
- version: 1.8.4
33
+ version: '0'
54
34
  type: :development
55
35
  prerelease: false
56
36
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
37
  requirements:
59
- - - ~>
38
+ - - ! '>='
60
39
  - !ruby/object:Gem::Version
61
- version: 1.8.4
40
+ version: '0'
62
41
  - !ruby/object:Gem::Dependency
63
- name: rcov
42
+ name: minitest
64
43
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
44
  requirements:
67
45
  - - ! '>='
68
46
  - !ruby/object:Gem::Version
@@ -70,62 +48,55 @@ dependencies:
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
51
  requirements:
75
52
  - - ! '>='
76
53
  - !ruby/object:Gem::Version
77
54
  version: '0'
78
55
  description: libsnappy binding for Ruby
79
- email: miyucy@gmail.com
56
+ email:
57
+ - fistfvck@gmail.com
80
58
  executables: []
81
59
  extensions:
82
60
  - ext/extconf.rb
83
- extra_rdoc_files:
84
- - LICENSE.txt
85
- - README.rdoc
61
+ extra_rdoc_files: []
86
62
  files:
87
- - .document
88
- - .rspec
63
+ - .gitignore
89
64
  - Gemfile
90
- - Gemfile.lock
91
65
  - LICENSE.txt
92
- - README.rdoc
66
+ - README.md
93
67
  - Rakefile
94
- - VERSION
95
68
  - ext/api.cc
96
69
  - ext/extconf.rb
97
70
  - lib/snappy/reader.rb
71
+ - lib/snappy/version.rb
98
72
  - lib/snappy/writer.rb
99
73
  - snappy.gemspec
100
- - spec/snappy/reader_spec.rb
101
- - spec/snappy/writer_spec.rb
102
- - spec/spec_helper.rb
74
+ - test/test-snappy-reader.rb
75
+ - test/test-snappy-writer.rb
103
76
  homepage: http://github.com/miyucy/snappy
104
77
  licenses:
105
78
  - MIT
79
+ metadata: {}
106
80
  post_install_message:
107
81
  rdoc_options: []
108
82
  require_paths:
109
83
  - lib
110
84
  required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
85
  requirements:
113
86
  - - ! '>='
114
87
  - !ruby/object:Gem::Version
115
88
  version: '0'
116
- segments:
117
- - 0
118
- hash: 3623024739862961287
119
89
  required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
90
  requirements:
122
91
  - - ! '>='
123
92
  - !ruby/object:Gem::Version
124
93
  version: '0'
125
94
  requirements: []
126
95
  rubyforge_project:
127
- rubygems_version: 1.8.24
96
+ rubygems_version: 2.0.0
128
97
  signing_key:
129
- specification_version: 3
98
+ specification_version: 4
130
99
  summary: libsnappy binding for Ruby
131
- test_files: []
100
+ test_files:
101
+ - test/test-snappy-reader.rb
102
+ - test/test-snappy-writer.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/Gemfile.lock DELETED
@@ -1,32 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- diff-lcs (1.1.3)
5
- git (1.2.5)
6
- jeweler (1.8.4)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
10
- rdoc
11
- json (1.7.5)
12
- rake (0.9.2.2)
13
- rcov (0.9.9)
14
- rdoc (3.12)
15
- json (~> 1.4)
16
- rspec (2.11.0)
17
- rspec-core (~> 2.11.0)
18
- rspec-expectations (~> 2.11.0)
19
- rspec-mocks (~> 2.11.0)
20
- rspec-core (2.11.1)
21
- rspec-expectations (2.11.3)
22
- diff-lcs (~> 1.1.3)
23
- rspec-mocks (2.11.2)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- bundler (~> 1.1.0)
30
- jeweler (~> 1.8.4)
31
- rcov
32
- rspec (~> 2.11.0)
data/README.rdoc DELETED
@@ -1,27 +0,0 @@
1
- = snappy
2
-
3
- see http://code.google.com/p/snappy
4
-
5
- require 'snappy'
6
-
7
- Snappy.deflate(source)
8
- # => Compressed data
9
-
10
- Snappy.inflate(source)
11
- # => Decompressed data
12
-
13
- == Contributing to snappy
14
-
15
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
16
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
17
- * Fork the project
18
- * Start a feature/bugfix branch
19
- * Commit and push until you are happy with your contribution
20
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
22
-
23
- == Copyright
24
-
25
- Copyright (c) 2011 miyucy. See LICENSE.txt for
26
- further details.
27
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.4
@@ -1,112 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Snappy
4
- describe Reader do
5
- before do
6
- @buffer = StringIO.new
7
- Writer.new @buffer do |w|
8
- w << "foo"
9
- w << "bar"
10
- w << "baz"
11
- w << "quux"
12
- end
13
- @buffer.rewind
14
- end
15
-
16
- subject do
17
- Reader.new @buffer
18
- end
19
-
20
- describe :initialize do
21
- it "should yield itself to the block" do
22
- yielded = nil
23
- returned = Reader.new @buffer do |r|
24
- yielded = r
25
- end
26
- returned.should == yielded
27
- end
28
-
29
- it "should read the header" do
30
- subject.magic.should == Writer::MAGIC
31
- subject.default_version.should == Writer::DEFAULT_VERSION
32
- subject.minimum_compatible_version == Writer::MINIMUM_COMPATIBLE_VERSION
33
- end
34
- end
35
-
36
- describe :initialize_without_headers do
37
- before do
38
- @buffer = StringIO.new
39
- @buffer << Snappy.deflate("HelloWorld" * 10)
40
- @buffer.rewind
41
- end
42
-
43
- it "should inflate with a magic header" do
44
- subject.read.should == ("HelloWorld" * 10)
45
- end
46
- end
47
-
48
- describe :io do
49
- it "should be a constructor argument" do
50
- subject.io.should == @buffer
51
- end
52
- end
53
-
54
- describe :each do
55
- before do
56
- Writer.new @buffer do |w|
57
- w << "foo"
58
- w << "bar"
59
- w.dump!
60
- w << "baz"
61
- w << "quux"
62
- end
63
- @buffer.rewind
64
- end
65
-
66
- it "should yield each chunk" do
67
- chunks = []
68
- Reader.new(@buffer).each do |chunk|
69
- chunks << chunk
70
- end
71
- chunks.should == ["foobar", "bazquux"]
72
- end
73
- end
74
-
75
- describe :read do
76
- before do
77
- Writer.new @buffer do |w|
78
- w << "foo"
79
- w << "bar"
80
- w << "baz"
81
- w << "quux"
82
- end
83
- @buffer.rewind
84
- end
85
-
86
- it "should return the bytes" do
87
- Reader.new(@buffer).read.should == "foobarbazquux"
88
- end
89
- end
90
-
91
- describe :each_line do
92
- before do
93
- Writer.new @buffer do |w|
94
- w << "foo\n"
95
- w << "bar"
96
- w.dump!
97
- w << "baz\n"
98
- w << "quux\n"
99
- end
100
- @buffer.rewind
101
- end
102
-
103
- it "should yield each line" do
104
- lines = []
105
- Reader.new(@buffer).each_line do |line|
106
- lines << line
107
- end
108
- lines.should == ["foo", "barbaz", "quux"]
109
- end
110
- end
111
- end
112
- end
@@ -1,52 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Snappy
4
- describe Writer do
5
- before do
6
- @buffer = StringIO.new
7
- end
8
-
9
- subject do
10
- Writer.new @buffer
11
- end
12
-
13
- describe :initialize do
14
- it "should yield itself to the block" do
15
- yielded = nil
16
- returned = Writer.new @buffer do |w|
17
- yielded = w
18
- end
19
- returned.should == yielded
20
- end
21
-
22
- it "should write the header" do
23
- subject.io.string.should == [Writer::MAGIC, Writer::DEFAULT_VERSION, Writer::MINIMUM_COMPATIBLE_VERSION].pack("a8NN")
24
- end
25
-
26
- it "should dump on the end of yield" do
27
- Writer.new @buffer do |w|
28
- w << "foo"
29
- end
30
- foo = Snappy.deflate "foo"
31
- @buffer.string[16, @buffer.size - 16].should == [foo.size, foo].pack("Na#{foo.size}")
32
- end
33
- end
34
-
35
- describe :io do
36
- it "should be a constructor argument" do
37
- io = StringIO.new
38
- Writer.new(io).io.should == io
39
- end
40
- end
41
-
42
- describe :block_size do
43
- it "should default to DEFAULT_BLOCK_SIZE" do
44
- Writer.new(StringIO.new).block_size.should == Writer::DEFAULT_BLOCK_SIZE
45
- end
46
-
47
- it "should be settable via the constructor" do
48
- Writer.new(StringIO.new, 42).block_size.should == 42
49
- end
50
- end
51
- end
52
- end
data/spec/spec_helper.rb DELETED
@@ -1,13 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rbconfig'
4
- require 'rspec'
5
- require "snappy.#{RbConfig::CONFIG['DLEXT']}"
6
-
7
- # Requires supporting files with custom matchers and macros, etc,
8
- # in ./support/ and its subdirectories.
9
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
-
11
- RSpec.configure do |config|
12
-
13
- end