distributable:
  url: https://github.com/ttytm/wthrr-the-weathercrab/archive/refs/tags/{{ version.tag }}.tar.gz
  strip-components: 1

provides:
  - bin/wthrr

versions:
  github: ttytm/wthrr-the-weathercrab

dependencies:
  openssl.org: ^1.1

build:
  dependencies:
    rust-lang.org: '>=1.56'
    rust-lang.org/cargo: '*'
  script: cargo install --locked --path . --root {{prefix}}

test:
  fixture: |
    (
        address: "san juan, pr",
        language: "en_US",
        forecast: [
            week,
        ],
        units: (
            temperature: celsius,
            speed: kmh,
            time: military,
            precipitation: probability,
        ),
        gui: (
            border: rounded,
            color: default,
            graph: (
                style: lines(solid),
                rowspan: double,
                time_indicator: true,
            ),
            greeting: true,
        ),
    )
  script:
    - run: cat $FIXTURE > wthrr.ron
      working-directory: $WTHRR_HOME
    - wthrr 'san juan, pr'
  env:
    darwin:
      WTHRR_HOME: $HOME/Library/Application Support/weathercrab
    linux:
      WTHRR_HOME: $HOME/.config/weathercrab
