Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Commit 0035cd9

Browse files
committed
Revert "Upgrade Crystal to 0.35.1"
Kemal is having some issues in 0.35.0: kemalcr/kemal#575
1 parent 899b221 commit 0035cd9

File tree

7 files changed

+34
-37
lines changed

7 files changed

+34
-37
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
runs-on: ubuntu-latest
1414
container:
15-
image: crystallang/crystal:0.35.1-alpine
15+
image: crystallang/crystal:0.34.0-alpine
1616

1717
steps:
1818
- uses: actions/checkout@v2

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM crystallang/crystal:0.35.1-alpine AS builder
1+
FROM crystallang/crystal:0.34.0-alpine AS builder
22

33
WORKDIR /Mango
44

shard.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
version: 2.0
1+
version: 1.0
22
shards:
33
ameba:
4-
git: https://github.com/crystal-ameba/ameba.git
4+
github: crystal-ameba/ameba
55
version: 0.12.1
66

77
archive:
8-
git: https://github.com/hkalexling/archive.cr.git
8+
github: hkalexling/archive.cr
99
version: 0.2.0
1010

1111
baked_file_system:
12-
git: https://github.com/schovi/baked_file_system.git
12+
github: schovi/baked_file_system
1313
version: 0.9.8
1414

1515
clim:
16-
git: https://github.com/at-grandpa/clim.git
16+
github: at-grandpa/clim
1717
version: 0.12.0
1818

1919
db:
20-
git: https://github.com/crystal-lang/crystal-db.git
20+
github: crystal-lang/crystal-db
2121
version: 0.9.0
2222

2323
exception_page:
24-
git: https://github.com/crystal-loot/exception_page.git
24+
github: crystal-loot/exception_page
2525
version: 0.1.4
2626

2727
kemal:
28-
git: https://github.com/kemalcr/kemal.git
29-
version: 0.26.1+git.commit.a8c0f09b858162bd13c96663febef5527b322a32
28+
github: kemalcr/kemal
29+
version: 0.26.1
3030

3131
kemal-session:
32-
git: https://github.com/kemalcr/kemal-session.git
32+
github: kemalcr/kemal-session
3333
version: 0.12.1
3434

3535
kilt:
36-
git: https://github.com/jeromegn/kilt.git
36+
github: jeromegn/kilt
3737
version: 0.4.0
3838

3939
radix:
40-
git: https://github.com/luislavena/radix.git
40+
github: luislavena/radix
4141
version: 0.3.9
4242

4343
sqlite3:
44-
git: https://github.com/crystal-lang/crystal-sqlite3.git
44+
github: crystal-lang/crystal-sqlite3
4545
version: 0.16.0
4646

shard.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ targets:
88
mango:
99
main: src/mango.cr
1010

11-
crystal: 0.35.0
11+
crystal: 0.34.0
1212

1313
license: MIT
1414

1515
dependencies:
1616
kemal:
1717
github: kemalcr/kemal
18-
commit: a8c0f09b858162bd13c96663febef5527b322a32
1918
kemal-session:
2019
github: kemalcr/kemal-session
2120
sqlite3:

src/archive.cr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
require "compress/zip"
1+
require "zip"
22
require "archive"
33

4-
# A unified class to handle all supported archive formats. It uses the
5-
# Compress::Zip module in crystal standard library if the target file is a
6-
# zip archive. Otherwise it uses `archive.cr`.
4+
# A unified class to handle all supported archive formats. It uses the ::Zip
5+
# module in crystal standard library if the target file is a zip archive.
6+
# Otherwise it uses `archive.cr`.
77
class ArchiveFile
88
def initialize(@filename : String)
99
if [".cbz", ".zip"].includes? File.extname filename
10-
@archive_file = Compress::Zip::File.new filename
10+
@archive_file = Zip::File.new filename
1111
else
1212
@archive_file = Archive::File.new filename
1313
end
@@ -20,25 +20,25 @@ class ArchiveFile
2020
end
2121

2222
def close
23-
if @archive_file.is_a? Compress::Zip::File
24-
@archive_file.as(Compress::Zip::File).close
23+
if @archive_file.is_a? Zip::File
24+
@archive_file.as(Zip::File).close
2525
end
2626
end
2727

2828
# Lists all file entries
2929
def entries
30-
ary = [] of Compress::Zip::File::Entry | Archive::Entry
30+
ary = [] of Zip::File::Entry | Archive::Entry
3131
@archive_file.entries.map do |e|
32-
if (e.is_a? Compress::Zip::File::Entry && e.file?) ||
32+
if (e.is_a? Zip::File::Entry && e.file?) ||
3333
(e.is_a? Archive::Entry && e.info.file?)
3434
ary.push e
3535
end
3636
end
3737
ary
3838
end
3939

40-
def read_entry(e : Compress::Zip::File::Entry | Archive::Entry) : Bytes?
41-
if e.is_a? Compress::Zip::File::Entry
40+
def read_entry(e : Zip::File::Entry | Archive::Entry) : Bytes?
41+
if e.is_a? Zip::File::Entry
4242
data = nil
4343
e.open do |io|
4444
slice = Bytes.new e.uncompressed_size

src/logger.cr

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class Logger
3131
{% end %}
3232

3333
@log = Log.for("")
34-
@backend = Log::IOBackend.new
3534

36-
format_proc = ->(entry : Log::Entry, io : IO) do
35+
@backend = Log::IOBackend.new
36+
@backend.formatter = ->(entry : Log::Entry, io : IO) do
3737
color = :default
3838
{% begin %}
3939
case entry.severity.label.to_s().downcase
@@ -50,14 +50,12 @@ class Logger
5050
io << entry.message
5151
end
5252

53-
@backend.formatter = Log::Formatter.new &format_proc
54-
Log.setup @@severity, @backend
53+
Log.builder.bind "*", @@severity, @backend
5554
end
5655

5756
# Ignores @@severity and always log msg
5857
def log(msg)
59-
@backend.write Log::Entry.new "", Log::Severity::None, msg,
60-
Log::Metadata.empty, nil
58+
@backend.write Log::Entry.new "", Log::Severity::None, msg, nil
6159
end
6260

6361
def self.log(msg)

src/mangadex/downloader.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
require "./api"
22
require "sqlite3"
3-
require "compress/zip"
3+
require "zip"
44

55
module MangaDex
66
class PageJob
77
property success = false
88
property url : String
99
property filename : String
10-
property writer : Compress::Zip::Writer
10+
property writer : Zip::Writer
1111
property tries_remaning : Int32
1212

1313
def initialize(@url, @filename, @writer, @tries_remaning)
@@ -324,7 +324,7 @@ module MangaDex
324324
# Find the number of digits needed to store the number of pages
325325
len = Math.log10(chapter.pages.size).to_i + 1
326326

327-
writer = Compress::Zip::Writer.new zip_path
327+
writer = Zip::Writer.new zip_path
328328
# Create a buffered channel. It works as an FIFO queue
329329
channel = Channel(PageJob).new chapter.pages.size
330330
spawn do

0 commit comments

Comments
 (0)