name: rove
title: Rove
base: core20
license: MIT
architectures: [ amd64 ]
icon: data/icon.svg
summary: An asynchronous nomadic game about exploring as part of a loose community.
# TODO: Add more to the description
description: |
  An asynchronous nomadic game about exploring as part of a loose community.
confinement: strict
adopt-info: go-rove

apps:
  rove:
    command: bin/rove
    plugs: 
      - network
    environment:
      ROVE_USER_DATA: $SNAP_USER_DATA
      
  rove-server:
    command: bin/rove-server
    plugs:
      - network
      - network-bind
    environment:
      WORDS_FILE : "$SNAP/data/words_alpha.txt"
      DATA_PATH : $SNAP_USER_DATA
      
parts:
  go-rove:
    plugin: go
    source-type: local
    source: .
    build-packages:
      - gcc-multilib
    override-pull: |
      snapcraftctl pull
      version=$(git describe --always --long --dirty --tags)
      sed -i "s/undefined/$version/" pkg/version/version.go
      snapcraftctl set-version $version
      git describe --exact-match --tags HEAD 2> /dev/null && snapcraftctl set-grade "stable" || snapcraftctl set-grade "devel"

  copy-data:
    plugin: dump
    source-type: local
    source: data
    organize:
      '*.txt' : data/