Skip to content

Commit

Permalink
support lower versions of gleam
Browse files Browse the repository at this point in the history
  • Loading branch information
bwireman committed Jun 1, 2024
1 parent 6ca8030 commit f4eea19
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version = "0.2.0"
licences = ["MIT"]
repository = { type = "github", user = "bwireman", repo = "go-over" }
description = "A tool to audit Erlang & Elixir dependency advisories as well as retired hex packages, to make sure your gleam projects really sparkle! ✨"
gleam = ">= 1.2.0"
gleam = ">= 0.34.1"

internal_modules = [
"go_over/*",
Expand Down
8 changes: 6 additions & 2 deletions src/go_over/advisories.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ fn read_adv(path: String) -> Advisory {
fn read_all_adv() -> List(Advisory) {
let packages_path = filepath.join(path(), "packages")

let packages = simplifile.read_directory(packages_path) |> unwrap([])
let packages =
simplifile.read_directory(packages_path)
|> unwrap([])
list.flat_map(packages, fn(dir) {
let dir_path = filepath.join(packages_path, dir)

let adv_names = simplifile.read_directory(dir_path) |> unwrap([])
let adv_names =
simplifile.read_directory(dir_path)
|> unwrap([])
list.map(adv_names, fn(adv_name) {
read_adv(filepath.join(dir_path, adv_name))
})
Expand Down
5 changes: 4 additions & 1 deletion src/go_over/cache.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ pub fn pull_if_not_cached(
_ -> {
pullfn()

let now = birl.utc_now() |> birl.to_unix() |> int.to_string()
let now =
birl.utc_now()
|> birl.to_unix()
|> int.to_string()
let assert Ok(_) =
path
|> cache_name()
Expand Down
24 changes: 18 additions & 6 deletions src/go_over/config.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,25 @@ pub fn read_config(path: String) -> Config {
let assert Ok(res) = simplifile.read(path)
let assert Ok(gleam) = tom.parse(res)

let go_over = tom.get_table(gleam, ["go-over"]) |> unwrap(dict.new())
let cache = tom.get_bool(go_over, ["cache"]) |> unwrap(True)
let ignore = tom.get_table(go_over, ["ignore"]) |> unwrap(dict.new())
let go_over =
tom.get_table(gleam, ["go-over"])
|> unwrap(dict.new())
let cache =
tom.get_bool(go_over, ["cache"])
|> unwrap(True)
let ignore =
tom.get_table(go_over, ["ignore"])
|> unwrap(dict.new())

let packages = tom.get_array(ignore, ["packages"]) |> unwrap([])
let severity = tom.get_array(ignore, ["severity"]) |> unwrap([])
let ids = tom.get_array(ignore, ["ids"]) |> unwrap([])
let packages =
tom.get_array(ignore, ["packages"])
|> unwrap([])
let severity =
tom.get_array(ignore, ["severity"])
|> unwrap([])
let ids =
tom.get_array(ignore, ["ids"])
|> unwrap([])

Config(
cache: cache,
Expand Down

0 comments on commit f4eea19

Please sign in to comment.