mangdown 0.10.2 → 0.11.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/mangafox.rb +42 -0
- data/lib/mangdown/adapter/mangahere.rb +46 -0
- data/lib/mangdown/adapter/mangapanda.rb +13 -0
- data/lib/mangdown/adapter/mangareader.rb +45 -0
- data/lib/mangdown/adapter/wiemanga.rb +44 -0
- data/lib/mangdown/adapter.rb +85 -0
- data/lib/mangdown/chapter.rb +49 -94
- data/lib/mangdown/commands.rb +12 -4
- data/lib/mangdown/manga.rb +15 -20
- data/lib/mangdown/manga_list.rb +3 -13
- data/lib/mangdown/mangdown.rb +7 -0
- data/lib/mangdown/mangdown_hash.rb +15 -7
- data/lib/mangdown/page.rb +8 -16
- data/lib/mangdown/properties.rb +14 -76
- data/lib/mangdown/tools.rb +69 -7
- data/lib/mangdown.rb +7 -2
- data/spec/lib/mangdown/chapter_spec.rb +1 -1
- data/spec/lib/mangdown/mangdown_hash_spec.rb +2 -7
- data/spec/lib/mangdown/page_spec.rb +23 -2
- metadata +38 -12
- data/spec/mangdown/chapter_spec.rb +0 -80
- data/spec/mangdown/commands_spec.rb +0 -66
- data/spec/mangdown/manga_list_spec.rb +0 -17
- data/spec/mangdown/manga_spec.rb +0 -92
- data/spec/mangdown/mangdown_hash_spec.rb +0 -17
- data/spec/mangdown/page_spec.rb +0 -39
- data/spec/mangdown/popular_spec.rb +0 -67
- data/spec/mangdown/tools_spec.rb +0 -20
data/spec/mangdown/page_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Mangdown
|
4
|
-
describe Page do
|
5
|
-
before(:all) do
|
6
|
-
@dir = Dir.pwd
|
7
|
-
@page_hash = MDHash.new(
|
8
|
-
uri: 'http://i25.mangareader.net/bleach/537/bleach-4149721.jpg',
|
9
|
-
name: "Bleach 537 - Page 1"
|
10
|
-
)
|
11
|
-
|
12
|
-
@page = @page_hash.to_page
|
13
|
-
@page.download
|
14
|
-
PAGE_STUB_PATH = File.expand_path('../../objects/page.yml',
|
15
|
-
__FILE__)
|
16
|
-
|
17
|
-
File.open(PAGE_STUB_PATH, 'w+') do |file|
|
18
|
-
file.write(@page.to_yaml)
|
19
|
-
end
|
20
|
-
@page2 = YAML.load(File.open(PAGE_STUB_PATH, 'r').read)
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when page is downloaded" do
|
24
|
-
it "should download itself to the current directory" do
|
25
|
-
expect(Dir.glob(@dir + '/*')).to include(@dir + '/' + @page.name)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "when a page is compared with a page loaded from a .yml file" do
|
30
|
-
it "should compare with #eql?" do
|
31
|
-
expect(@page.eql?(@page2))
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should not compare with ==" do
|
35
|
-
expect(!@page == @page2)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
module Mangdown
|
4
|
-
describe PopularManga do
|
5
|
-
before(:all) do
|
6
|
-
end
|
7
|
-
|
8
|
-
context "when initialized" do
|
9
|
-
before(:each) do
|
10
|
-
end
|
11
|
-
|
12
|
-
context "with top 20" do
|
13
|
-
it "should have a manga list with top 20 mangas" do
|
14
|
-
@pop2 = PopularManga.new('http://www.mangareader.net/popular', 20)
|
15
|
-
expect(@pop2.mangas_list.length).to eq(20)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "with top 50" do
|
20
|
-
it "should have a manga list with top 50 mangas" do
|
21
|
-
@pop3 = PopularManga.new('http://www.mangareader.net/popular', 50)
|
22
|
-
expect(@pop3.mangas_list.length).to eq(50)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "with top 90" do
|
27
|
-
it "should have a manga list with top 90 mangas" do
|
28
|
-
@pop4 = PopularManga.new('http://www.mangareader.net/popular', 90)
|
29
|
-
expect(@pop4.mangas_list.length).to eq(90)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have an empty mangas array" do
|
34
|
-
@pop = PopularManga.new('http://www.mangareader.net/popular', 20)
|
35
|
-
expect(@pop.mangas).to be_empty
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "when get_manga is called" do
|
40
|
-
it "should have 1 manga in mangas" do
|
41
|
-
@pop = PopularManga.new('http://www.mangareader.net/popular', 20)
|
42
|
-
@pop.get_manga(1)
|
43
|
-
expect(@pop.mangas.length).to eq(1)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should have 2 mangas in mangas" do
|
47
|
-
@pop = PopularManga.new('http://www.mangareader.net/popular', 20)
|
48
|
-
@pop.get_manga(1)
|
49
|
-
@pop.get_manga(2)
|
50
|
-
expect(@pop.mangas.length).to eq(2)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should have Bleach in mangas" do
|
54
|
-
@pop = PopularManga.new('http://www.mangareader.net/popular', 20)
|
55
|
-
@pop.get_manga(1)
|
56
|
-
expect(@pop.mangas.length).to eq(1)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should only get manga once" do
|
60
|
-
@pop = PopularManga.new('http://www.mangareader.net/popular', 20)
|
61
|
-
@pop.get_manga(1)
|
62
|
-
@pop.get_manga(1)
|
63
|
-
expect(@pop.mangas.length).to eq(1)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
data/spec/mangdown/tools_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# Move these to a Tools spec
|
2
|
-
=begin
|
3
|
-
context "when the functions for get_pages are run" do
|
4
|
-
it "should have the right chapter uri" do
|
5
|
-
expect(@chapter.uri).to eq(@@uri)
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should get the right image link and name from a uri" do
|
9
|
-
expect(@chapter.get_page).to eq(
|
10
|
-
['http://i25.mangareader.net/bleach/537/bleach-4149721.jpg',
|
11
|
-
'Bleach 537 - Page 1'])
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should get the right root from uri" do
|
15
|
-
expect(@chapter.get_root(@@uri)).to eq('http://www.mangareader.net')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
=end
|
19
|
-
|
20
|
-
|