# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           python 1.0
PortGroup           fuse 1.0

name                py-gitfs
github.setup        presslabs ${python.rootname} 0.5.2
github.tarball_from archive
revision            0

categories-append   devel
platforms           {darwin any}
supported_archs     noarch
license             Apache-2
maintainers         nomaintainer

description         a FUSE file system that fully integrates with git
long_description    ${python.rootname} is {*}${description}. You can mount a \
                    remote repository’s branch locally, and any subsequent \
                    changes made to the files will be automatically committed \
                    to the remote.

homepage            https://www.presslabs.com/docs/code/${python.rootname}/

checksums           rmd160  965080148fc253fa3b7987b99b920e12f2daa9e7 \
                    sha256  921e24311e3b8ea3a5448d698a11a747618ee8dd62d5d43a85801de0b111cbf3 \
                    size    64141

python.versions     39

if {${name} ne ${subport}} {
    patchfiles      patch-mounter.py.diff \
                    patch-utils-args.py.diff

    post-patch {
        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/gitfs/utils/args.py
    }

    depends_build-append  \
                    port:py${python.version}-setuptools

    depends_lib-append \
                    port:py${python.version}-atomiclong \
                    port:py${python.version}-cffi \
                    port:py${python.version}-fusepy \
                    port:py${python.version}-pycparser \
                    port:py${python.version}-pygit2 \
                    port:py${python.version}-raven \
                    port:py${python.version}-six

    post-activate {
        # the default tmp folder from gitfs/utils/args.py
        xinstall -d ${prefix}/var/lib/${python.rootname}
    }

    if {[info exists ::env(USER)]} {
        set username $::env(USER)
    } else {
        set username {$USER}
    }

    notes "
A simple example of mounting a local “bare” repo:

    \$ cd .test.d/
    \$ mkdir mnt
    \$ gitfs file://${user_home}/Repos/test.git/ mnt/\
-o repo_path=gitclone,fetch_timeout=2,sync_timout=2

Verify with:

    \$ mount | grep osxfuse
    file://${user_home}/Repos/test.git/ on ${user_home}/.test.d/mnt\
(osxfuse, nodev, nosuid, synchronous, mounted by ${username})

In Finder you'll find the mount, and can unmount it from there as well.

    \$ open -R .

- - -

If you find the documentation to be a bit confusing, there are 2 great videos\
(talks) about ${python.rootname} you can watch:

  » https://www.youtube.com/watch?v=elA96lMW-gA (~32min)
  » https://www.youtube.com/watch?v=mdhZpFp5n80 (~27min)
    "

    livecheck.type  none
}
