diff --git a/recipes/MojoINI/recipe.yaml b/recipes/MojoINI/recipe.yaml deleted file mode 100644 index 0635b45d..00000000 --- a/recipes/MojoINI/recipe.yaml +++ /dev/null @@ -1,50 +0,0 @@ - - -context: - version: "0.1.0" - -package: - name: "mojo-ini" - version: ${{ version }} - -source: - - git: https://github.com/Hammad-hab/MojoINI.git - rev: 6ebe2f95e092582c254fd3bfcd59006371fe3d85 - -build: - number: 0 - script: - - mojo package src/mojoini -o ${{ PREFIX }}/lib/mojo/mojoini.mojopkg - -requirements: - host: - - max =25.4 - run: - - ${{ pin_compatible('max') }} - -tests: - - script: - - if: unix - then: - - mojo test - files: - source: - - test_parser.mojo - - test_perf.mojo - -about: - homepage: https://github.com/Hammad-hab/MojoINI.git - # Remember to specify the license variants for BSD, Apache, GPL, and LGPL. - # Use the SPDX identifier, e.g: GPL-2.0-only instead of GNU General Public License version 2.0 - # See https://spdx.org/licenses/ - license: MIT - # It is strongly encouraged to include a license file in the package, - # (even if the license doesn't require it) using the license_file entry. - # See https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#license-file - license_file: LICENSE - summary: Simple INI file parser for Mojo - repository: https://github.com/Hammad-hab/MojoINI.git - -extra: - maintainers: - - Hammad-hab diff --git a/recipes/mojo-ini/image.png b/recipes/mojo-ini/image.png new file mode 100644 index 00000000..c04f2371 Binary files /dev/null and b/recipes/mojo-ini/image.png differ diff --git a/recipes/mojo-ini/recipe.yaml b/recipes/mojo-ini/recipe.yaml new file mode 100644 index 00000000..673af4e6 --- /dev/null +++ b/recipes/mojo-ini/recipe.yaml @@ -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 diff --git a/recipes/mojo-ini/test_package.mojo b/recipes/mojo-ini/test_package.mojo new file mode 100644 index 00000000..ef9edb34 --- /dev/null +++ b/recipes/mojo-ini/test_package.mojo @@ -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")