xar 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 76ede0574b98fb7869d8aa37b218833d14f63c85
4
+ data.tar.gz: 70ea6c2bb6f537be73df66fa2f5a54d06b2b58e2
5
+ SHA512:
6
+ metadata.gz: a61147b22447df8c1e99d49b32c10163d0ca0ea7ee9b7fdb74ff7428ab7bd94a12c8ea01bbe799eca59e4dd657916e7687000f571afd8b8112aaf03ebe01a51a
7
+ data.tar.gz: 5ee03dd8a0bf71f2242baa32d33caf6717756e1c0915ed73186f1cf769ad8fe564e53914aec7d1dc46bcb6148a69d8d6f68ec72e67b3da5f3c662f6a119b7e52
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in xarb.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Adam Tanner
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Xar
2
+
3
+ Xar provides Ruby FFI bindings to libxar.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem "xar"
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install xar
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/xar/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = "spec/**/*_spec.rb"
6
+ end
7
+
8
+ task default: :test
@@ -0,0 +1,13 @@
1
+ require "ffi"
2
+ require "ffi/stat"
3
+
4
+ module Xar
5
+ def self.open(path, flag)
6
+ xar_t = Xar::Native.xar_open(path, flag)
7
+
8
+ Xar::Archive.new(xar_t)
9
+ end
10
+ end
11
+
12
+ require "xar/native"
13
+ require "xar/archive"
@@ -0,0 +1,5 @@
1
+ class Xar::Archive
2
+ def initialize(xar_t)
3
+ @xar_t = xar_t
4
+ end
5
+ end
@@ -0,0 +1,59 @@
1
+ module Xar::Native
2
+ extend FFI::Library
3
+
4
+ ffi_lib "libxar"
5
+
6
+ typedef :pointer, :xar_t
7
+ typedef :pointer, :xar_file_t
8
+ typedef :pointer, :xar_iter_t
9
+ typedef :pointer, :xar_subdoc_t
10
+ typedef :pointer, :xar_errctx_t
11
+
12
+ callback :err_handler_callback, [:int32, :int32, :xar_errctx_t, :pointer], :int32
13
+
14
+ FLAG = enum :read, 0,
15
+ :write, 1
16
+
17
+ attach_function :xar_open, [:string, FLAG], :xar_t
18
+ attach_function :xar_close, [:xar_t], :void
19
+
20
+ attach_function :xar_add, [:xar_t, :string], :xar_file_t
21
+ attach_function :xar_add_frombuffer, [:xar_t, :xar_file_t, :string, :string, :size_t], :xar_file_t
22
+ attach_function :xar_add_folder, [:xar_t, :xar_file_t, :string, FFI::Stat::Stat], :xar_file_t
23
+
24
+ attach_function :xar_extract, [:xar_t, :xar_file_t], :int32
25
+
26
+ attach_function :xar_register_errhandler, [:xar_t, :err_handler_callback, :pointer], :void
27
+ attach_function :xar_err_get_file, [:xar_errctx_t], :xar_file_t
28
+ attach_function :xar_err_get_string, [:xar_errctx_t], :string
29
+ attach_function :xar_err_get_errno, [:xar_errctx_t], :int
30
+
31
+ attach_function :xar_iter_new, [:void], :xar_iter_t
32
+ attach_function :xar_iter_free, [:xar_iter_t], :void
33
+
34
+ attach_function :xar_file_first, [:xar_t, :xar_iter_t], :xar_file_t
35
+ attach_function :xar_file_next, [:xar_iter_t], :xar_file_t
36
+
37
+ attach_function :xar_opt_set, [:xar_t, :string, :string], :int32
38
+ attach_function :xar_opt_get, [:xar_t, :string], :string
39
+
40
+ attach_function :xar_prop_set, [:xar_file_t, :string, :string], :int32
41
+ attach_function :xar_prop_get, [:xar_file_t, :string, :pointer], :int32
42
+ attach_function :xar_prop_first, [:xar_file_t, :xar_iter_t], :string
43
+ attach_function :xar_prop_next, [:xar_iter_t], :string
44
+
45
+ attach_function :xar_attr_set, [:xar_file_t, :string, :string, :string], :int32
46
+ attach_function :xar_attr_get, [:xar_file_t, :string, :string], :string
47
+ attach_function :xar_attr_first, [:xar_file_t, :string, :xar_iter_t], :string
48
+ attach_function :xar_attr_next, [:xar_iter_t], :string
49
+
50
+ attach_function :xar_subdoc_new, [:xar_t, :string], :xar_subdoc_t
51
+ attach_function :xar_subdoc_prop_set, [:xar_subdoc_t, :string, :string], :int32
52
+ attach_function :xar_subdoc_prop_get, [:xar_subdoc_t, :string, :pointer], :int32
53
+ attach_function :xar_subdoc_first, [:xar_t], :xar_subdoc_t
54
+ attach_function :xar_subdoc_next, [:xar_subdoc_t], :xar_subdoc_t
55
+ attach_function :xar_subdoc_name, [:xar_subdoc_t], :string
56
+ attach_function :xar_subdoc_copyout, [:xar_subdoc_t, :pointer, :pointer], :int32
57
+ attach_function :xar_subdoc_copyin, [:xar_subdoc_t, :string, :int], :int32
58
+ attach_function :xar_subdoc_remove, [:xar_subdoc_t], :void
59
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "xar"
7
+ spec.version = "0.0.0"
8
+ spec.authors = ["Adam Tanner"]
9
+ spec.email = ["adam@adamtanner.org"]
10
+ spec.summary = %q{ Ruby FFI bindings to libxar. }
11
+ spec.description = %q{ Ruby FFI bindings to libxar. }
12
+ spec.homepage = "https://github.com/adamtanner/xar"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^spec/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "ffi"
21
+ spec.add_dependency "ffi-stat"
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Tanner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ffi-stat
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: ' Ruby FFI bindings to libxar. '
70
+ email:
71
+ - adam@adamtanner.org
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/xar.rb
82
+ - lib/xar/archive.rb
83
+ - lib/xar/native.rb
84
+ - xar.gemspec
85
+ homepage: https://github.com/adamtanner/xar
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.0.3
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Ruby FFI bindings to libxar.
109
+ test_files: []