pinch 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/pinch.rb +9 -1
- data/spec/pinch_spec.rb +11 -0
- metadata +34 -31
data/README.rdoc
CHANGED
data/lib/pinch.rb
CHANGED
@@ -3,7 +3,7 @@ require 'net/http'
|
|
3
3
|
require 'zlib'
|
4
4
|
|
5
5
|
class Pinch
|
6
|
-
VERSION = "0.0.
|
6
|
+
VERSION = "0.0.3"
|
7
7
|
|
8
8
|
attr_reader :uri
|
9
9
|
attr_reader :file_name
|
@@ -15,6 +15,10 @@ class Pinch
|
|
15
15
|
new(url).data(file_name)
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.file_list(url)
|
19
|
+
new(url).file_list
|
20
|
+
end
|
21
|
+
|
18
22
|
def initialize(url)
|
19
23
|
@uri = URI.parse(url)
|
20
24
|
@files = {}
|
@@ -41,6 +45,10 @@ class Pinch
|
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
48
|
+
def file_list
|
49
|
+
file_headers.keys
|
50
|
+
end
|
51
|
+
|
44
52
|
def data(file_name)
|
45
53
|
raise Errno::ENOENT if file_headers[file_name].nil?
|
46
54
|
|
data/spec/pinch_spec.rb
CHANGED
@@ -30,4 +30,15 @@ describe Pinch do
|
|
30
30
|
data.size.must_equal 2288
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
describe "#file_list" do
|
35
|
+
before do
|
36
|
+
@url = 'http://memention.com/ericjohnson-canabalt-ios-ef43b7d.zip'
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return a list with all the file names in the zip" do
|
40
|
+
file_list = Pinch.file_list(@url)
|
41
|
+
file_list.size.must_equal 491
|
42
|
+
end
|
43
|
+
end
|
33
44
|
end
|
metadata
CHANGED
@@ -1,38 +1,40 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pinch
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Peter Hellberg
|
9
9
|
- Edward Patel
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
13
|
+
|
14
|
+
date: 2011-07-05 00:00:00 +02:00
|
14
15
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
17
18
|
name: minitest
|
18
|
-
|
19
|
+
prerelease: false
|
20
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
21
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "0"
|
24
26
|
type: :development
|
25
|
-
|
26
|
-
|
27
|
-
description: Pinch makes it possible to download a specific file from within a ZIP
|
28
|
-
file over HTTP 1.1.
|
27
|
+
version_requirements: *id001
|
28
|
+
description: Pinch makes it possible to download a specific file from within a ZIP file over HTTP 1.1.
|
29
29
|
email: peter@c7.se
|
30
30
|
executables: []
|
31
|
+
|
31
32
|
extensions: []
|
32
|
-
|
33
|
+
|
34
|
+
extra_rdoc_files:
|
33
35
|
- README.rdoc
|
34
36
|
- MIT-LICENSE
|
35
|
-
files:
|
37
|
+
files:
|
36
38
|
- lib/pinch.rb
|
37
39
|
- MIT-LICENSE
|
38
40
|
- README.rdoc
|
@@ -41,33 +43,34 @@ files:
|
|
41
43
|
- spec/pinch_spec.rb
|
42
44
|
has_rdoc: true
|
43
45
|
homepage: https://github.com/peterhellberg/pinch
|
44
|
-
licenses:
|
46
|
+
licenses:
|
45
47
|
- MIT-LICENSE
|
46
48
|
post_install_message:
|
47
|
-
rdoc_options:
|
49
|
+
rdoc_options:
|
48
50
|
- --main
|
49
51
|
- README.rdoc
|
50
52
|
- --charset=UTF-8
|
51
|
-
require_paths:
|
53
|
+
require_paths:
|
52
54
|
- lib
|
53
55
|
- lib
|
54
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
57
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
59
61
|
version: 1.8.7
|
60
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
63
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version:
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
66
68
|
requirements: []
|
69
|
+
|
67
70
|
rubyforge_project:
|
68
71
|
rubygems_version: 1.6.2
|
69
72
|
signing_key:
|
70
73
|
specification_version: 3
|
71
74
|
summary: Retrieve a file from inside a zip file, over the network!
|
72
|
-
test_files:
|
75
|
+
test_files:
|
73
76
|
- spec/pinch_spec.rb
|