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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d4731c3daab47190d6c9e8bb7ab4a3e6c2969da
4
- data.tar.gz: bb119f7dbab44825092c5662c3b72764cd4c0b96
3
+ metadata.gz: 9c56892f6cb759de12f6e04829f8985d5e08dc3d
4
+ data.tar.gz: 48ce59582b8df667828598f6562024d774193c2f
5
5
  SHA512:
6
- metadata.gz: 8a6af671931fa2fc18678567a748890e59513c75f901db964fb4c440b1981205cb658ad776a5f7e537a7e30d1c81a0a82d85e1439c7b345a901be1aba7a88410
7
- data.tar.gz: 775bd09318ccf12386317b6dc31225f95d4f621cb2ee6e05361961e450ee8ff1b11d509f9a90272ac791497d1659df08f6d733510232b20bccd6cc121fa69bc6
6
+ metadata.gz: d1f68f88860a011bdebbe20455be412fa7e8071839294874e7b8c18c201658d253c29550ec5018f882d42a97d016ebce8be3f9c5aa1c01cc76039dbec6a7811c
7
+ data.tar.gz: 8cb68e2cf5d9fc35b0be3fc9d0b36656773cfcac6f08d033713136535a1a5e795551d9bb00bd4d99fc7f94a5cb4a426c0f9062d9de36328097a8668dc2323b0c
@@ -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, :webseeds
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
- @webseeds = []
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[:url-list] = @webseeds if @webseeds.any?
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 add_webseed(url)
143
+ def set_webseed(url)
144
144
  validate_url!(url)
145
- webseeds << url unless webseeds.include?(url)
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
@@ -62,15 +62,14 @@ class MktorrentTest < Minitest::Test
62
62
  assert_equal 1, @torrent.privacy
63
63
  end
64
64
 
65
- def test_add_valid_webseed
66
- @torrent.add_webseed(WEBSEED)
67
- assert_equal 1, @torrent.webseeds.count
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.add_webseed('uheoatnhuetano')
72
+ @torrent.set_webseed('uheoatnhuetano')
74
73
  }
75
74
  end
76
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mktorrent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothy Mukaibo