Skip to content

Commit b1878f3

Browse files
committed
Merge branch 'naming-directory-structure' into parser
2 parents a14fa18 + 0578d0a commit b1878f3

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed
File renamed without changes.

lib/onigumo_downloader.ex renamed to lib/onigumo/downloader.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ defmodule Onigumo.Downloader do
5050
end
5151

5252
def create_file_name(url) do
53-
Hash.md5(url, :hex)
53+
Onigumo.Utilities.Hash.md5(url, :hex)
5454
end
5555

5656
defp http_client() do

lib/spider_html.ex renamed to lib/spider/html.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Spider.HTML do
1+
defmodule Onigumo.Spider.HTML do
22
def find_links(document) do
33
Floki.parse_document!(document)
44
|> Floki.find("a")

lib/hash.ex renamed to lib/utilities/hash.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Hash do
1+
defmodule Onigumo.Utilities.Hash do
22
def md5(data, fmt) do
33
hash(:md5, data)
44
|> format(fmt)

test/hash_test.exs

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,28 @@ defmodule HashTest do
5353

5454
for {data, hash_hex, _} <- @known_md5s do
5555
test("hash MD5 #{inspect(data)} in hexadecimal") do
56-
hash = Hash.md5(unquote(data), :hex)
56+
hash = Onigumo.Utilities.Hash.md5(unquote(data), :hex)
5757
assert(hash == unquote(hash_hex))
5858
end
5959
end
6060

6161
for {data, _, hash_bin} <- @known_md5s do
6262
test("hash MD5 #{inspect(data)} in binary") do
63-
hash = Hash.md5(unquote(data), :bin)
63+
hash = Onigumo.Utilities.Hash.md5(unquote(data), :bin)
6464
assert(hash == unquote(hash_bin))
6565
end
6666
end
6767

6868
for {format, hash} <- @formatted_hashes do
6969
test("format #{inspect(@binary_hash)} in #{inspect(format)}") do
70-
formatted = Hash.format(@binary_hash, unquote(format))
70+
formatted = Onigumo.Utilities.Hash.format(@binary_hash, unquote(format))
7171
assert(formatted == unquote(hash))
7272
end
7373
end
7474

7575
for {func, known_hash} <- @known_hashes do
7676
test("hash #{inspect(@known_hash_data)} with #{inspect(func)}") do
77-
computed_hash = Hash.hash(unquote(func), @known_hash_data)
77+
computed_hash = Onigumo.Utilities.Hash.hash(unquote(func), @known_hash_data)
7878
assert(computed_hash == unquote(known_hash))
7979
end
8080
end

test/onigumo_downloader_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ defmodule OnigumoDownloaderTest do
116116
input_url = "https://onigumo.local/hello.html"
117117
created_file_name = Onigumo.Downloader.create_file_name(input_url)
118118

119-
expected_file_name = Hash.md5(input_url, :hex)
119+
expected_file_name = Onigumo.Utilities.Hash.md5(input_url, :hex)
120120
assert(created_file_name == expected_file_name)
121121
end
122122
end

test/spider_html_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ defmodule SpiderHtmlTest do
2121
</body>
2222
</html>)
2323

24-
describe("Spider.HTML.find_links/1") do
24+
describe("Onigumo.Spider.HTML.find_links/1") do
2525
test("find links in href attributes of 'a' tags") do
26-
links = Spider.HTML.find_links(@html)
26+
links = Onigumo.Spider.HTML.find_links(@html)
2727
assert links == @urls
2828
end
2929
end

0 commit comments

Comments
 (0)