Skip to content

Commit

Permalink
Require Inko 0.17.0 or newer
Browse files Browse the repository at this point in the history
Changelog: changed
  • Loading branch information
yorickpeterse committed Oct 28, 2024
1 parent 559a019 commit 5bc8a6b
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ at `./build/idoc/public`. For more information, run `idoc --help`.

## Requirements

- Inko 0.15.0 or newer
- Inko 0.17.0 or newer

## Installation

Expand Down
8 changes: 4 additions & 4 deletions inko.pkg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require https://github.com/yorickpeterse/inko-wobsite 0.18.0 0059ab6b2eec4b72d2b94025733ec464688d2d02
require https://github.com/yorickpeterse/inko-wobsite 0.19.0 fa5e47733423aa6a902028e69de5a374a1757377
require https://github.com/yorickpeterse/inko-builder 0.13.0 7a38803e1fcd80e19ad2ea8fd90b9babf70e93a6
require https://github.com/yorickpeterse/inko-markdown 0.20.1 3fd768dc4c2ffdb310fe5190fdb7c2de5760317d
require https://github.com/yorickpeterse/inko-syntax 0.11.0 6ce493b98401f41771000ed05cd16dcee454aaba
require inko 0.16.0
require https://github.com/yorickpeterse/inko-markdown 0.21.0 3726c10b499242cb3febc931a82e35217e2f987a
require https://github.com/yorickpeterse/inko-syntax 0.12.0 517256f97795fea9cab8d188aa2afef2dbe50685
require inko 0.17.0
8 changes: 4 additions & 4 deletions src/idoc/cmd.inko
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ fn generate_json(
) -> Result[Nil, String] {
let cmd = Command.new(executable)

cmd.argument('doc')
cmd.stdin(Stream.Null)
cmd.arguments.push('doc')
cmd.stdin = Stream.Null

if private { cmd.argument('--private') }
if private { cmd.arguments.push('--private') }

if dependencies { cmd.argument('--dependencies') }
if dependencies { cmd.arguments.push('--dependencies') }

let status = try cmd.spawn.then(fn (c) { c.wait }).map_error(fn (e) {
'failed to start `inko doc`: ${e}'
Expand Down
9 changes: 4 additions & 5 deletions src/idoc/ir.inko
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import std.clone (Clone)
import std.cmp (Compare, Ordering)
import std.fs.file (ReadOnlyFile)
import std.fs.path (Path)
import std.iter (Stream)
import std.json (Error, ErrorKind, PullParser)
import std.range (InclusiveRange)
import wobsite.markdown (SyntaxHighlight)
import std.sync (Channel)

let META = '$meta.json'

Expand Down Expand Up @@ -118,7 +117,7 @@ class Module {
fn static parse_all(
directory: ref Path,
) -> Result[Array[uni Module], String] {
let chan = Channel.new(size: 128)
let chan = Channel.new
let mut pending = try directory
.list
.then(fn (iter) {
Expand All @@ -128,7 +127,7 @@ class Module {
Ok({ @path = p, @type = File })
if p.extension.or('') == 'json' and p.tail.starts_with?('$').false?
-> {
Parser().parse(recover p.clone, chan)
Parser().parse(recover p.clone, recover chan.clone)
Result.Ok(sum + 1)
}
case Ok(_) -> Result.Ok(sum)
Expand Down Expand Up @@ -869,7 +868,7 @@ impl Symbol for Trait {
class async Parser {
fn async parse(
input: uni Path,
output: Channel[uni Result[Module, (Path, Error)]],
output: uni Channel[uni Result[Module, (Path, Error)]],
) {
let res = recover {
let input = recover input
Expand Down
1 change: 0 additions & 1 deletion src/idoc/page/class.inko
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import builder.html
import idoc.fs (read_source_code)
import idoc.html (
atomic, container, head, header, highlight_inko, implementations, link_to,
methods, page_title, private, search_results, sidebar, symbol_info,
Expand Down
4 changes: 2 additions & 2 deletions src/idoc/page/constant.inko
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import builder.html
import idoc.fs (read_source_code)
import idoc.html (
container, head, header, highlight_inko, link_to, page_title, private,
search_results, sidebar, source_block, symbol_info, with_table_of_contents,
container, head, header, link_to, page_title, private, search_results,
sidebar, source_block, with_table_of_contents,
)
import idoc.ir (Constant)
import idoc.module_name (ModuleName)
Expand Down
5 changes: 2 additions & 3 deletions src/idoc/page/method.inko
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import builder.html
import idoc.fs (read_source_code)
import idoc.html (
container, head, header, highlight_inko, link_to, page_title, private,
search_results, sidebar, source_block, symbol_info, with_table_of_contents,
container, head, header, link_to, page_title, private, search_results,
sidebar, source_block, with_table_of_contents,
)
import idoc.ir (Method)
import idoc.module_name (ModuleName)
import std.fs.path (Path)
import wobsite (Files, UpdateAssetLinks)
import wobsite.url (file_url)

Expand Down
4 changes: 0 additions & 4 deletions src/idoc/page/module.inko
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import idoc.html (
value_type, with_table_of_contents,
)
import idoc.ir
import idoc.markdown (Markdown)
import idoc.module_name (ModuleName)
import idoc.url (relative_url)
import std.cmp (Compare, Ordering)
import std.iter (Iter)
import wobsite (Files, UpdateAssetLinks)
import wobsite.markdown (SyntaxHighlight)
import wobsite.url (file_url)

class enum ValueSemantics {
Expand Down
1 change: 0 additions & 1 deletion src/idoc/page/modules.inko
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import idoc.module_name (ModuleName)
import idoc.url (relative_url)
import std.fs.path (Path)
import wobsite (Files, UpdateAssetLinks)
import wobsite.markdown (SyntaxHighlight)
import wobsite.url (file_url)

let TITLE = 'Documentation'
Expand Down
1 change: 0 additions & 1 deletion src/idoc/page/search.inko
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import std.cmp (Compare, Ordering)
import std.int (ToInt)
import std.json (Json)
import wobsite (Files)
import wobsite.markdown (SyntaxHighlight)

class enum Kind {
case Module
Expand Down
7 changes: 2 additions & 5 deletions src/idoc/page/trait.inko
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import builder.html
import idoc.fs (read_source_code)
import idoc.html (
atomic, container, head, header, highlight_inko, implementations, link_to,
methods, page_title, private, search_results, sidebar, source_block,
symbol_info, type_signature, value_type, with_table_of_contents,
container, head, header, highlight_inko, implementations, link_to, methods,
page_title, private, search_results, sidebar, with_table_of_contents,
)
import idoc.ir
import idoc.module_name (ModuleName)
import std.set (Set)
import wobsite (Files, UpdateAssetLinks)
import wobsite.url (file_url)

Expand Down
6 changes: 3 additions & 3 deletions src/main.inko
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import idoc.cmd (run)
import std.env (arguments, working_directory)
import std.io (Write)
import std.stdio (STDERR, STDOUT)
import std.stdio (Stderr, Stdout)
import std.sys (exit)

class async Main {
fn async main {
let out = STDOUT.new as Write
let out = Stdout.new as Write
let pwd = working_directory.or_else(fn (_) { '.'.to_path })

match run(arguments, pwd, out) {
case Ok(_) -> {}
case Error(e) -> {
# https://github.com/inko-lang/inko/issues/634
STDERR.new.print('\e[31;1merror\e[0m: ${e}')
Stderr.new.print('\e[31;1merror\e[0m: ${e}')
exit(1)
}
}
Expand Down
9 changes: 5 additions & 4 deletions test/idoc/test_ir.inko
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import markdown
import std.cmp (Ordering)
import std.json (PullParser)
import std.range (InclusiveRange)
import std.sync (Channel)
import std.test (Tests)

fn two_paragraphs -> Markdown {
Expand Down Expand Up @@ -1125,17 +1126,17 @@ fn pub tests(t: mut Tests) {

t.test('Parser.parse with valid modules', fn (t) {
let dir = recover 'fixtures/valid/simple.json'.to_path
let chan = Channel.new(size: 1)
let chan = Channel.new

ir.Parser().parse(dir, chan)
ir.Parser().parse(dir, recover chan.clone)
t.true(chan.receive.ok?)
})

t.test('Parser.parse with invalid modules', fn (t) {
let dir = recover 'fixtures/invalid/simple.json'.to_path
let chan = Channel.new(size: 1)
let chan = Channel.new

ir.Parser().parse(dir, chan)
ir.Parser().parse(dir, recover chan.clone)
t.true(chan.receive.error?)
})

Expand Down

0 comments on commit 5bc8a6b

Please sign in to comment.