mangdown 0.14.1 → 0.15.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/mangdown/adapter.rb +4 -0
 - data/lib/mangdown/chapter.rb +2 -2
 - data/lib/mangdown/support/tools.rb +15 -3
 - data/lib/mangdown/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8f61dfdfea20214539cb4f4ef676aca5dadbbf02
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4bad97970c5889d3e0f6be782efbc93387d6af00
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c29430c607fd9de1f654ef11631e5cf7ae6cbe21f3a4f34b36d59a074b5955aa1f0f2fa153b4dfadf7e2dc4f64cedc90e0f0805c019f0784a3b686b7e8e7fe5a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8d0bfe6dd9dbbe1cafe1297430f9e4f11e263bdf3dd1eede206bdf83139ea0da7edae7224a5af59df2f1c04e0dc82ebaa76c5c9de8182e4a4ae24bb03f512915
         
     | 
    
        data/lib/mangdown/adapter.rb
    CHANGED
    
    
    
        data/lib/mangdown/chapter.rb
    CHANGED
    
    | 
         @@ -56,7 +56,7 @@ module Mangdown 
     | 
|
| 
       56 
56 
     | 
    
         
             
                    setup_download_dir!(dir)
         
     | 
| 
       57 
57 
     | 
    
         
             
                  end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                  Tools.hydra_streaming(pages) do |stage, page, data = nil|
         
     | 
| 
      
 59 
     | 
    
         
            +
                  Tools.hydra_streaming(pages, adapter.hydra_opts) do |stage, page, data = nil|
         
     | 
| 
       60 
60 
     | 
    
         
             
                    case stage
         
     | 
| 
       61 
61 
     | 
    
         
             
                    when :failed
         
     | 
| 
       62 
62 
     | 
    
         
             
                      failed << page
         
     | 
| 
         @@ -93,7 +93,7 @@ module Mangdown 
     | 
|
| 
       93 
93 
     | 
    
         
             
                def fetch_each_page
         
     | 
| 
       94 
94 
     | 
    
         
             
                  pages = build_page_hashes
         
     | 
| 
       95 
95 
     | 
    
         
             
                  page_data = Hash.new { |h, k| h[k] = "" }
         
     | 
| 
       96 
     | 
    
         
            -
                  Tools.hydra_streaming(pages) do |status, page, data=nil|
         
     | 
| 
      
 96 
     | 
    
         
            +
                  Tools.hydra_streaming(pages, adapter.hydra_opts) do |status, page, data=nil|
         
     | 
| 
       97 
97 
     | 
    
         
             
                    case status
         
     | 
| 
       98 
98 
     | 
    
         
             
                    when :before
         
     | 
| 
       99 
99 
     | 
    
         
             
                      true
         
     | 
| 
         @@ -1,6 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'pathname'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'typhoeus'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            Typhoeus::Config.verbose = $DEBUG
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       4 
6 
     | 
    
         
             
            module Mangdown
         
     | 
| 
       5 
7 
     | 
    
         
             
              module Tools
         
     | 
| 
       6 
8 
     | 
    
         
             
                class << self
         
     | 
| 
         @@ -39,13 +41,13 @@ module Mangdown 
     | 
|
| 
       39 
41 
     | 
    
         
             
                    mime_to_extension(mime)
         
     | 
| 
       40 
42 
     | 
    
         
             
                  end
         
     | 
| 
       41 
43 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                  def hydra_streaming(objects)
         
     | 
| 
       43 
     | 
    
         
            -
                    hydra = Typhoeus::Hydra. 
     | 
| 
      
 44 
     | 
    
         
            +
                  def hydra_streaming(objects, hydra_opts = {})
         
     | 
| 
      
 45 
     | 
    
         
            +
                    hydra = Typhoeus::Hydra.new(hydra_opts)
         
     | 
| 
       44 
46 
     | 
    
         | 
| 
       45 
47 
     | 
    
         
             
                    requests = objects.map { |obj| 
         
     | 
| 
       46 
48 
     | 
    
         
             
                      next unless yield(:before, obj)
         
     | 
| 
       47 
49 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                      request =  
     | 
| 
      
 50 
     | 
    
         
            +
                      request = typhoeus(obj.uri)
         
     | 
| 
       49 
51 
     | 
    
         
             
                      request.on_headers do |response|
         
     | 
| 
       50 
52 
     | 
    
         
             
                        status = response.success? ? :succeeded : :failed
         
     | 
| 
       51 
53 
     | 
    
         
             
                        yield(status, obj)
         
     | 
| 
         @@ -65,6 +67,16 @@ module Mangdown 
     | 
|
| 
       65 
67 
     | 
    
         
             
                    requests
         
     | 
| 
       66 
68 
     | 
    
         
             
                  end
         
     | 
| 
       67 
69 
     | 
    
         | 
| 
      
 70 
     | 
    
         
            +
                  def typhoeus(uri)
         
     | 
| 
      
 71 
     | 
    
         
            +
                    Typhoeus::Request.new(uri, typhoeus_options)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  def typhoeus_options
         
     | 
| 
      
 75 
     | 
    
         
            +
                    {
         
     | 
| 
      
 76 
     | 
    
         
            +
                      headers: { "User-Agent" => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36' }
         
     | 
| 
      
 77 
     | 
    
         
            +
                    }
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       68 
80 
     | 
    
         
             
                  private
         
     | 
| 
       69 
81 
     | 
    
         | 
| 
       70 
82 
     | 
    
         
             
                  def mime_to_extension(mime)
         
     | 
    
        data/lib/mangdown/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mangdown
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.15.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - jphager2
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-10-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: typhoeus
         
     | 
| 
         @@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       164 
164 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       165 
165 
     | 
    
         
             
            requirements: []
         
     | 
| 
       166 
166 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       167 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 167 
     | 
    
         
            +
            rubygems_version: 2.6.13
         
     | 
| 
       168 
168 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       169 
169 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       170 
170 
     | 
    
         
             
            summary: Download Manga
         
     |