tarruby 0.1.0-mswin32 → 0.1.1-mswin32
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.
- data/README.txt +2 -2
- data/ext/tarruby.c +12 -12
- data/lib/i386-mswin32/tarruby.so +0 -0
- metadata +1 -1
data/README.txt
CHANGED
@@ -21,7 +21,7 @@ gem install tarruby
|
|
21
21
|
|
22
22
|
require 'tarruby'
|
23
23
|
|
24
|
-
Tar.open('foo.tar', File::RDONLY) do |tar|
|
24
|
+
Tar.open('foo.tar', File::RDONLY, Tar::GNU) do |tar|
|
25
25
|
while tar.read # or 'tar.each do ...'
|
26
26
|
puts tar.pathname
|
27
27
|
tar.print_long_ls
|
@@ -48,7 +48,7 @@ gem install tarruby
|
|
48
48
|
|
49
49
|
require 'tarruby'
|
50
50
|
|
51
|
-
Tar.open('bar.tar', File::CREAT | File::WRONLY) do |tar|
|
51
|
+
Tar.open('bar.tar', File::CREAT | File::WRONLY, Tar::GNU) do |tar|
|
52
52
|
Dir.glob('**/*.c').each do |filename|
|
53
53
|
tar.append_file(filename)
|
54
54
|
end
|
data/ext/tarruby.c
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
#define INT2TIME(i) rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(i))
|
34
34
|
|
35
|
-
#define VERSION "0.1.
|
35
|
+
#define VERSION "0.1.1"
|
36
36
|
|
37
37
|
static VALUE Tar;
|
38
38
|
static VALUE Error;
|
@@ -169,7 +169,7 @@ static VALUE tarruby_close(VALUE self) {
|
|
169
169
|
Data_Get_Struct(self, struct tarruby_tar, p_tar);
|
170
170
|
|
171
171
|
if(tar_close(p_tar->tar) != 0) {
|
172
|
-
rb_raise(Error, "Close archive failed");
|
172
|
+
rb_raise(Error, "Close archive failed: %s", strerror(errno));
|
173
173
|
}
|
174
174
|
|
175
175
|
return Qnil;
|
@@ -192,7 +192,7 @@ static VALUE tarruby_s_open0(int argc, VALUE *argv, VALUE self, tartype_t *tarty
|
|
192
192
|
Data_Get_Struct(tar, struct tarruby_tar, p_tar);
|
193
193
|
|
194
194
|
if (tar_open(&p_tar->tar, s_pathname, tartype, i_oflags, i_mode, i_options) == -1) {
|
195
|
-
rb_raise(Error, "Open archive failed");
|
195
|
+
rb_raise(Error, "Open archive failed: %s", strerror(errno));
|
196
196
|
}
|
197
197
|
|
198
198
|
if (rb_block_given_p()) {
|
@@ -249,7 +249,7 @@ static VALUE tarruby_append_file(int argc, VALUE *argv, VALUE self) {
|
|
249
249
|
Data_Get_Struct(self, struct tarruby_tar, p_tar);
|
250
250
|
|
251
251
|
if (tar_append_file(p_tar->tar, s_realname, s_savename) != 0) {
|
252
|
-
rb_raise(Error, "Append file failed");
|
252
|
+
rb_raise(Error, "Append file failed: %s", strerror(errno));
|
253
253
|
}
|
254
254
|
|
255
255
|
return Qnil;
|
@@ -273,7 +273,7 @@ static VALUE tarruby_append_tree(int argc, VALUE *argv, VALUE self) {
|
|
273
273
|
Data_Get_Struct(self, struct tarruby_tar, p_tar);
|
274
274
|
|
275
275
|
if (tar_append_tree(p_tar->tar, s_realdir, s_savedir) != 0) {
|
276
|
-
rb_raise(Error, "Append tree failed");
|
276
|
+
rb_raise(Error, "Append tree failed: %s", strerror(errno));
|
277
277
|
}
|
278
278
|
|
279
279
|
return Qnil;
|
@@ -289,7 +289,7 @@ static VALUE tarruby_extract_file(VALUE self, VALUE realname) {
|
|
289
289
|
Data_Get_Struct(self, struct tarruby_tar, p_tar);
|
290
290
|
|
291
291
|
if (tar_extract_file(p_tar->tar, s_realname) != 0) {
|
292
|
-
rb_raise(Error, "Extract file failed");
|
292
|
+
rb_raise(Error, "Extract file failed: %s", strerror(errno));
|
293
293
|
}
|
294
294
|
|
295
295
|
p_tar->extracted = 1;
|
@@ -313,7 +313,7 @@ static VALUE tarruby_extract_buffer(VALUE self) {
|
|
313
313
|
buffer = rb_str_new("", 0);
|
314
314
|
|
315
315
|
if ((i = tar_extract_function(p_tar->tar, (void *) buffer, tarruby_extract_buffer0)) == -1) {
|
316
|
-
rb_raise(Error, "Extract buffer failed");
|
316
|
+
rb_raise(Error, "Extract buffer failed: %s", strerror(errno));
|
317
317
|
}
|
318
318
|
|
319
319
|
p_tar->extracted = 1;
|
@@ -339,7 +339,7 @@ static VALUE tarruby_extract_glob(int argc, VALUE *argv, VALUE self) {
|
|
339
339
|
Data_Get_Struct(self, struct tarruby_tar, p_tar);
|
340
340
|
|
341
341
|
if (tar_extract_glob(p_tar->tar, s_globname, s_prefix) != 0) {
|
342
|
-
rb_raise(Error, "Extract archive failed");
|
342
|
+
rb_raise(Error, "Extract archive failed: %s", strerror(errno));
|
343
343
|
}
|
344
344
|
|
345
345
|
p_tar->extracted = 1;
|
@@ -363,7 +363,7 @@ static VALUE tarruby_extract_all(int argc, VALUE *argv, VALUE self) {
|
|
363
363
|
Data_Get_Struct(self, struct tarruby_tar, p_tar);
|
364
364
|
|
365
365
|
if (tar_extract_all(p_tar->tar, s_prefix) != 0) {
|
366
|
-
rb_raise(Error, "Extract archive failed");
|
366
|
+
rb_raise(Error, "Extract archive failed: %s", strerror(errno));
|
367
367
|
}
|
368
368
|
|
369
369
|
p_tar->extracted = 1;
|
@@ -374,7 +374,7 @@ static VALUE tarruby_extract_all(int argc, VALUE *argv, VALUE self) {
|
|
374
374
|
static void tarruby_skip_regfile_if_not_extracted(struct tarruby_tar *p) {
|
375
375
|
if (!p->extracted) {
|
376
376
|
if (TH_ISREG(p->tar) && tar_skip_regfile(p->tar) != 0) {
|
377
|
-
rb_raise(Error, "Read archive failed");
|
377
|
+
rb_raise(Error, "Read archive failed: %s", strerror(errno));
|
378
378
|
}
|
379
379
|
|
380
380
|
p->extracted = 1;
|
@@ -390,7 +390,7 @@ static VALUE tarruby_read(VALUE self) {
|
|
390
390
|
tarruby_skip_regfile_if_not_extracted(p_tar);
|
391
391
|
|
392
392
|
if ((i = th_read(p_tar->tar)) == -1) {
|
393
|
-
rb_raise(Error, "Read archive failed");
|
393
|
+
rb_raise(Error, "Read archive failed: %s", strerror(errno));
|
394
394
|
}
|
395
395
|
|
396
396
|
p_tar->extracted = 0;
|
@@ -413,7 +413,7 @@ static VALUE tarruby_each(VALUE self) {
|
|
413
413
|
}
|
414
414
|
|
415
415
|
if (i == -1) {
|
416
|
-
rb_raise(Error, "Read archive failed");
|
416
|
+
rb_raise(Error, "Read archive failed: %s", strerror(errno));
|
417
417
|
}
|
418
418
|
|
419
419
|
return Qnil;
|
data/lib/i386-mswin32/tarruby.so
CHANGED
Binary file
|