mangdown 0.16.1 → 0.17.0

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: 322812e01eff29a30192673634873fcd286770c3
4
- data.tar.gz: 97d4cc14476ec3a43d0ba11af6e9c541b65f3d63
3
+ metadata.gz: 394d93835122c8b78b98f83c09908786c75831e9
4
+ data.tar.gz: 3d50677445c08b240f46a8be8e9fd95d94cd81ff
5
5
  SHA512:
6
- metadata.gz: 8697dd6bd034b1634494ae62dae674271d8864cdefb2b905c3dd7ffc901a604bb3e5593c90a0a2a1ce4fcc5e2e2bb3c66f042a555d8a249c84bba5d6fdd927e4
7
- data.tar.gz: bd1051ea8ea0e0974157b48d4f249fdc37fc34dfa9137ce0531be7d003ddd4dc0036bfa81683e25565e1427730c5b207c9c3de25f7a0ea1a20e3352d7c8f7191
6
+ metadata.gz: 69b858ea5267457078c49f113002013a660086abbf12f6d1ccf4b70ba2123659eb59e14f362f7fe74c190b3646b7eb771ff296e8334c606dc2fd1658a5eab6fd
7
+ data.tar.gz: c2d48bdec2d6e5e771e7979d39e214ad57c0240142591e7bdf6abf774ec97e6131d75ec67b298ab5cc0f00995f71579335218435ab57f68a9de434610a64d3ae
data/lib/mangdown.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'uri'
3
+ require 'addressable/uri'
4
4
  require 'nokogiri'
5
5
  require 'yaml'
6
6
  require 'zip'
7
7
  require 'filemagic'
8
- require 'cgi'
9
8
 
10
9
  require_relative 'mangdown/error'
11
10
 
@@ -68,7 +68,7 @@ module Mangdown
68
68
  (1..last_page).map do |page|
69
69
  slug = manga_name.tr(' ', '-').gsub(/[:,!]/, '')
70
70
  uri = "#{root}/#{slug}/#{chapter_number}/#{page}"
71
- uri = CGI.escape(uri).downcase
71
+ uri = Addressable::URI.escape(uri).downcase
72
72
  { uri: uri, name: page, site: site }
73
73
  end
74
74
  end
@@ -13,7 +13,7 @@ module Mangdown
13
13
  @name = name
14
14
  @manga = manga
15
15
  @chapter = chapter
16
- @uri = CGI.escape(uri)
16
+ @uri = Addressable::URI.escape(uri)
17
17
  @pages = []
18
18
  end
19
19
 
@@ -4,15 +4,14 @@ require_relative '../mangdown'
4
4
 
5
5
  # Simple client for Mangdown
6
6
  module M
7
- class << self
8
-
9
- DATA_FILE_PATH = Dir.home + '/.manga_list.yml'
10
- HELP_FILE_PATH = File.expand_path(
11
- '../../README.md', File.dirname(__FILE__)
12
- )
7
+ DATA_FILE_PATH = Dir.home + '/.manga_list.yml'
8
+ HELP_FILE_PATH = File.expand_path(
9
+ '../../README.md', File.dirname(__FILE__)
10
+ )
13
11
 
14
- MANGA_PAGES = ['http://www.mangareader.net/alphabetical'].freeze
12
+ DEFAULT_MANGA_PAGES = ['http://www.mangareader.net/alphabetical'].freeze
15
13
 
14
+ class << self
16
15
  # return a list of hash with :uri and :name of mangas found in list
17
16
  def find(search)
18
17
  search = Regexp.new(/^#{search}$/) if search.respond_to?(:to_str)
@@ -37,6 +36,10 @@ module M
37
36
  File.delete(DATA_FILE_PATH) if File.exist?(DATA_FILE_PATH)
38
37
  end
39
38
 
39
+ def manga_pages
40
+ @manga_pages ||= DEFAULT_MANGA_PAGES.dup
41
+ end
42
+
40
43
  private
41
44
 
42
45
  # convenience method to access the data file path
@@ -51,7 +54,7 @@ module M
51
54
 
52
55
  # attempt to get the list from the data file
53
56
  def data_from_file
54
- YAML.safe_load(File.read(path)) if file_current?(path)
57
+ YAML.load(File.read(path)) if file_current?(path)
55
58
  end
56
59
 
57
60
  # get saved current manga list, if data is less than a week old
@@ -60,7 +63,7 @@ module M
60
63
  data = data_from_file
61
64
  return Mangdown::MangaList.from_data(data) if data
62
65
 
63
- list = MANGA_PAGES.inject([]) do |manga, uri|
66
+ list = manga_pages.inject([]) do |manga, uri|
64
67
  list = Mangdown::MDHash.new(uri: uri).to_manga_list
65
68
  list.merge(manga)
66
69
  end
@@ -12,7 +12,7 @@ module Mangdown
12
12
 
13
13
  def initialize(uri, name)
14
14
  @name = name
15
- @uri = CGI.escape(uri)
15
+ @uri = Addressable::URI.escape(uri)
16
16
  @chapters = []
17
17
  end
18
18
 
@@ -20,7 +20,7 @@ module Mangdown
20
20
 
21
21
  @adapter = Mangdown.adapter!(uri, site, nil, name)
22
22
 
23
- @uri = CGI.escape(uri)
23
+ @uri = Addressable::URI.escape(uri)
24
24
  @site = adapter.site
25
25
  end
26
26
 
data/lib/mangdown/page.rb CHANGED
@@ -12,7 +12,7 @@ module Mangdown
12
12
  @name = Tools.valid_path_name(name)
13
13
  @chapter = chapter
14
14
  @manga = manga
15
- @uri = CGI.escape(uri)
15
+ @uri = Addressable::URI.escape(uri)
16
16
  end
17
17
 
18
18
  # explicit conversion to page
@@ -19,7 +19,7 @@ module Mangdown
19
19
  end
20
20
 
21
21
  def get_root(uri)
22
- uri = URI.parse(uri)
22
+ uri = Addressable::URI.parse(uri)
23
23
  @root = "#{uri.scheme}://#{uri.host}"
24
24
  end
25
25
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mangdown
4
- VERSION = '0.16.1'
4
+ VERSION = '0.17.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mangdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jphager2
@@ -11,19 +11,19 @@ cert_chain: []
11
11
  date: 2017-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: typhoeus
14
+ name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ruby-filemagic
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rubyzip
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,33 +67,33 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.1'
55
69
  - !ruby/object:Gem::Dependency
56
- name: ruby-filemagic
70
+ name: typhoeus
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: '0.7'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: '0.7'
69
83
  - !ruby/object:Gem::Dependency
70
- name: webmock
84
+ name: minitest
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ">="
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0'
89
+ version: '5.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: '5.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -95,21 +109,21 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: minitest
112
+ name: rubocop
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '5.0'
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '5.0'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: rubocop
126
+ name: webmock
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="