mktorrent 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mktorrent.rb +8 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53a5d9886eae06ed9809a44aad5977dd92fbc6fd
4
- data.tar.gz: c8765076c792efb461acbce6fc654fa1b1602765
3
+ metadata.gz: 40013fae6c1b166f34155fe839dcb81ea1c9457d
4
+ data.tar.gz: b48e184f27de7f03296691733da993b99fa705fa
5
5
  SHA512:
6
- metadata.gz: 9ffa74c6f1f5730a2eb4d865b419ced51aecde96b19051a854ad81d42d98161f68990957bce04a089b7f05c7f1d65e5bfffd01288b0900126e1e91ae0a43b393
7
- data.tar.gz: 29d69a42b732edb8dfeb271daefe622d8afe79ab392ce60f1316ef17e475c7d91d753fac7c57f258fdf8e159b3765263283fb7c11522ed0dbb4cb757771ef5c7
6
+ metadata.gz: 2e5ea1994b7b8e5ee2609dec3d0c8e016e6962eff8399fe118c3b8df1fdb7287350c0743a430c4decb85f57148f0ac522a31050f5e6a9739e62ce577133d6beb
7
+ data.tar.gz: 6c8acd9ef4d10e7fdbbe8ccb60a750f5a7433edcbbf7fd431a88b99329032885239c93f108e07e2cb02f8adb825a88036c4298d05d7ce2e06739c23b01a4f712
data/lib/mktorrent.rb CHANGED
@@ -28,7 +28,7 @@ class Torrent
28
28
  def all_files
29
29
  unless @files.count < 1
30
30
  all_files = []
31
- @files.each do |f|
31
+ @files.each do |f|
32
32
  all_files << f[:path]
33
33
  end
34
34
  end
@@ -57,7 +57,7 @@ class Torrent
57
57
  end
58
58
 
59
59
  yield buffer
60
- end
60
+ end
61
61
 
62
62
  def build
63
63
  @info = { :announce => @tracker,
@@ -65,9 +65,9 @@ class Torrent
65
65
  :info => { :name => @defaultdir,
66
66
  :'piece length' => @piecelength,
67
67
  :files => @files,
68
- :private => @privacy
69
- }
70
- }
68
+ :private => @privacy
69
+ }
70
+ }
71
71
  @info[:info][:pieces] = ""
72
72
  if @files.count > 0
73
73
  i = 0
@@ -80,10 +80,10 @@ class Torrent
80
80
  end
81
81
  end
82
82
  end
83
-
83
+
84
84
  def write_torrent(filename)
85
85
  build_the_torrent
86
- open(filename, 'w') do |torrentfile|
86
+ open(filename, 'wb') do |torrentfile|
87
87
  torrentfile.write self.to_s
88
88
  end
89
89
  torrent_file = "#{`pwd`.chomp}/#{filename}"
@@ -100,7 +100,7 @@ class Torrent
100
100
 
101
101
  def add_file(filepath)
102
102
  if((@files.select { |f| f[:path].join('/') == filepath } ).count > 0)
103
- raise IOError, "Can't add duplicate file #{File.basename(filepath)}"
103
+ raise IOError, "Can't add duplicate file #{File.basename(filepath)}"
104
104
  end
105
105
 
106
106
  if File.exist?(filepath)
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.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothy Mukaibo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-04 00:00:00.000000000 Z
11
+ date: 2014-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bencode