Skip to content
Open
50 changes: 0 additions & 50 deletions recipes/MojoINI/recipe.yaml

This file was deleted.

Binary file added recipes/mojo-ini/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions recipes/mojo-ini/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
context:
version: 0.2.2
mojo_version: "=0.25.7"

package:
name: mojo-ini
version: ${{ version }}

source:
- git: https://github.com/DataBooth/mojo-ini.git
tag: v0.2.2

build:
number: 0
script:
- mkdir -p ${PREFIX}/lib/mojo
- mojo package src/ini -o ${PREFIX}/lib/mojo/ini.mojopkg

requirements:
build:
- mojo-compiler ${{ mojo_version }}
host:
- mojo-compiler ${{ mojo_version }}
run:
- ${{ pin_compatible('mojo-compiler') }}

tests:
- files:
source:
- test_package.mojo
script:
- mojo -I ${PREFIX}/lib/mojo test_package.mojo

about:
homepage: https://github.com/DataBooth/mojo-ini
license: Apache-2.0
license_file: LICENSE
summary: INI parser and writer for Mojo with Python configparser compatibility
description: |
mojo-ini provides native INI parsing and writing in Mojo with zero Python dependencies.
It supports classic INI syntax, multiline values (indented continuation), comments,
and includes a clean public API: parse(), to_ini(), parse_file(), write_file().
documentation: https://github.com/DataBooth/mojo-ini#readme
repository: https://github.com/DataBooth/mojo-ini

extra:
recipe-maintainers:
- mjboothaus
21 changes: 21 additions & 0 deletions recipes/mojo-ini/test_package.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from ini import parse, to_ini

fn main() raises:
# Parse a simple INI string
var cfg = parse("""
[App]
name = mojo-ini
version = 0.2.0
""")
if cfg["App"]["name"] != "mojo-ini":
raise Error("Parse failed: expected name=mojo-ini")

# Write a simple INI
var data = Dict[String, Dict[String, String]]()
data["App"] = Dict[String, String]()
data["App"]["name"] = "mojo-ini"
var out = to_ini(data)
if not ("[App]" in out and "name = mojo-ini" in out):
raise Error("Write failed: expected [App] with name = mojo-ini")

print("ok")
Loading