mktorrent 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mktorrent.rb +5 -5
- data/test/mktorrent_acceptance_test.rb +1 -0
- data/test/mktorrent_test.rb +4 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c56892f6cb759de12f6e04829f8985d5e08dc3d
|
4
|
+
data.tar.gz: 48ce59582b8df667828598f6562024d774193c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1f68f88860a011bdebbe20455be412fa7e8071839294874e7b8c18c201658d253c29550ec5018f882d42a97d016ebce8be3f9c5aa1c01cc76039dbec6a7811c
|
7
|
+
data.tar.gz: 8cb68e2cf5d9fc35b0be3fc9d0b36656773cfcac6f08d033713136535a1a5e795551d9bb00bd4d99fc7f94a5cb4a426c0f9062d9de36328097a8668dc2323b0c
|
data/lib/mktorrent.rb
CHANGED
@@ -10,7 +10,7 @@ require 'uri'
|
|
10
10
|
|
11
11
|
class Torrent
|
12
12
|
attr_reader :torrent_file
|
13
|
-
attr_accessor :info, :filehashes, :piecelength, :files, :defaultdir, :tracker, :size, :privacy, :
|
13
|
+
attr_accessor :info, :filehashes, :piecelength, :files, :defaultdir, :tracker, :size, :privacy, :webseed
|
14
14
|
|
15
15
|
# optionally initialize filename
|
16
16
|
def initialize(tracker)
|
@@ -21,7 +21,7 @@ class Torrent
|
|
21
21
|
@size = 0
|
22
22
|
@defaultdir = "torrent"
|
23
23
|
@privacy = 0
|
24
|
-
@
|
24
|
+
@webseed = ""
|
25
25
|
@dirbase = ""
|
26
26
|
build_the_torrent
|
27
27
|
end
|
@@ -72,7 +72,7 @@ class Torrent
|
|
72
72
|
}
|
73
73
|
}
|
74
74
|
@info[:info][:pieces] = ""
|
75
|
-
@info
|
75
|
+
@info.merge({ "url-list" => @webseed }) unless @webseed.empty?
|
76
76
|
if @files.count > 0
|
77
77
|
i = 0
|
78
78
|
read_pieces(all_files, @piecelength) do |piece|
|
@@ -140,9 +140,9 @@ class Torrent
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
def
|
143
|
+
def set_webseed(url)
|
144
144
|
validate_url!(url)
|
145
|
-
|
145
|
+
@webseed = url
|
146
146
|
end
|
147
147
|
|
148
148
|
def set_private
|
@@ -37,6 +37,7 @@ class MktorrentAcceptanceTest < Minitest::Test
|
|
37
37
|
def create_torrent_for_test
|
38
38
|
torrent = Torrent.new('http://some.tracker.com')
|
39
39
|
torrent.add_directory(VALIDPATH)
|
40
|
+
torrent.set_webseed("http://web.seed.com")
|
40
41
|
torrent.write_torrent('torrent_test.torrent')
|
41
42
|
torrent
|
42
43
|
end
|
data/test/mktorrent_test.rb
CHANGED
@@ -62,15 +62,14 @@ class MktorrentTest < Minitest::Test
|
|
62
62
|
assert_equal 1, @torrent.privacy
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
66
|
-
@torrent.
|
67
|
-
assert_equal
|
68
|
-
assert_equal WEBSEED, @torrent.webseeds.first
|
65
|
+
def test_set_valid_webseed
|
66
|
+
@torrent.set_webseed(WEBSEED)
|
67
|
+
assert_equal WEBSEED, @torrent.webseed
|
69
68
|
end
|
70
69
|
|
71
70
|
def test_add_invalid_webseed
|
72
71
|
assert_raises(ArgumentError) {
|
73
|
-
@torrent.
|
72
|
+
@torrent.set_webseed('uheoatnhuetano')
|
74
73
|
}
|
75
74
|
end
|
76
75
|
end
|