mktorrent 1.1.1 → 1.2.0
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 +8 -8
 - 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: 40013fae6c1b166f34155fe839dcb81ea1c9457d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b48e184f27de7f03296691733da993b99fa705fa
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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, ' 
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-11-11 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bencode
         
     |