mktorrent 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77a407ad2f074deddd8b6e6bdbce1597f8c17663
4
- data.tar.gz: 32614d20a89d1598dd993c7bd30f68a6ef2592e9
3
+ metadata.gz: f0121cae40e34b235dbdb5146784d4623bace715
4
+ data.tar.gz: 3c4334027500373162a40884d90c24a747f194d6
5
5
  SHA512:
6
- metadata.gz: 567a4b4b6ea9dd3d9b31f9af8893be1e46f130a67b88220e4750ca2fffb574650e8ffb220e8e3c35f88ff301f4983c22879696b3c7257ab3ee9db234a33c6008
7
- data.tar.gz: 85c02051c564166c4039ec3ecfc640eccc5aa1f83cd8f3c9af64ea123459edaea46805858cf0e904f4c2ed347e4ded6414e14dd481297ab394d8b092d7e4dcac
6
+ metadata.gz: 225390bdd81561840ce1184d1d215bb269306689806258f0db286666cb69a44359485f2118e94b362a7070f7696087edbab75366287da3f1b5e2181e92a46312
7
+ data.tar.gz: 5c83eb10cf3dd3880963458dbc2893f329a403a983af769b188eb7afd75da8ac7450b0f34035a88cdf7f59dac65be54071eb042e8590ae6a7fe06cbeff9aa0d1
@@ -27,7 +27,7 @@ class Torrent
27
27
  end
28
28
 
29
29
  def all_files
30
- unless @files.count < 1
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 |f|
42
- f = File.join(@dirbase, f) unless @dirbase.empty?
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
@@ -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.3
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-09-22 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bencode