mktorrent 1.6.3 → 1.6.4
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.
- checksums.yaml +4 -4
- data/lib/mktorrent.rb +11 -3
- data/test/mktorrent_test.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0121cae40e34b235dbdb5146784d4623bace715
|
|
4
|
+
data.tar.gz: 3c4334027500373162a40884d90c24a747f194d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 225390bdd81561840ce1184d1d215bb269306689806258f0db286666cb69a44359485f2118e94b362a7070f7696087edbab75366287da3f1b5e2181e92a46312
|
|
7
|
+
data.tar.gz: 5c83eb10cf3dd3880963458dbc2893f329a403a983af769b188eb7afd75da8ac7450b0f34035a88cdf7f59dac65be54071eb042e8590ae6a7fe06cbeff9aa0d1
|
data/lib/mktorrent.rb
CHANGED
|
@@ -27,7 +27,7 @@ class Torrent
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def all_files
|
|
30
|
-
|
|
30
|
+
if @files.any?
|
|
31
31
|
@files.collect { |file| file[:path] }
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -36,10 +36,18 @@ class Torrent
|
|
|
36
36
|
@files.count
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def path_for_reading_pieces(f)
|
|
40
|
+
if @dirbase.empty? # it's a single file torrent
|
|
41
|
+
f = File.join(File.join(f))
|
|
42
|
+
end
|
|
43
|
+
f = File.join(@dirbase, f) unless @dirbase.empty?
|
|
44
|
+
f
|
|
45
|
+
end
|
|
46
|
+
|
|
39
47
|
def read_pieces(files, length)
|
|
40
48
|
buffer = ""
|
|
41
|
-
files.each do |
|
|
42
|
-
f =
|
|
49
|
+
files.each do |file|
|
|
50
|
+
f = path_for_reading_pieces(file)
|
|
43
51
|
next if File.directory?(f)
|
|
44
52
|
File.open(f) do |fh|
|
|
45
53
|
begin
|
data/test/mktorrent_test.rb
CHANGED
|
@@ -45,10 +45,11 @@ class MktorrentTest < Minitest::Test
|
|
|
45
45
|
assert_equal 3, @torrent.count
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# When adding a directory, only the folder that's added (and everything below) should appear in the metadata
|
|
48
49
|
def test_add_directory_uses_relative_paths
|
|
49
50
|
assert [ VALIDFILEPATH, VALIDFILE2PATH ].each { |p| p.start_with?(VALIDPATH) }
|
|
50
51
|
@torrent.add_directory(VALIDPATH)
|
|
51
|
-
assert @torrent.files.each { |f| ! f[:path].join('/').start_with?(VALIDPATH) }
|
|
52
|
+
assert @torrent.files.each { |f| ! f[:path].join('/').start_with?(File.basename(File.dirname(VALIDPATH))) }
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
def test_default_privacy
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mktorrent
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Timothy Mukaibo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bencode
|