Installation
============

FileWiki comes with a command-line based interface, as well as a
(rather experimental) web interface.


Prerequisites
-------------

As all Perl programs, FileWiki depends on some standard modules, which
are available on CPAN. The Makefile will complain about missing modules.

Depending on what plugins you enable, you will need:

  * Text::Markdown (needed for the example sites)
  * Text::Textile
  * Pod::Simple::HTML
  * Image::ExifTool (needed for gallery sites)
  * Image::Magick (needed for gallery sites)
  * ...


Instructions
------------

First, [download] the newest FileWiki release.
Unzip the tarball, go to the filewiki directory and type:

    perl Makefile.PL
    make
    sudo make install

This will install the `filewiki` executable along with the FileWiki
Perl modules to your system. The Makefile will warn you about missing
Perl modules.

That's it! Now you can build FileWiki sites:

    filewiki examples/helloworld.org

This will build the `helloworld.org` example site to the target directory
`/tmp/filewiki/htdocs`.

Have a look at the more complex `example.org` site, this is intended to
give you an idea on how FileWiki works.

  [download]: https://digint.ch/download/filewiki/releases


### Gallery

In order to create a photo gallery, you first have to set the
`gallery_base` variable to a folder containing your photos:

    file: examples/gallery.org/tree.vars

    # change this path:
    gallery_base=/path/to/photos

Optionally modify the other variables in `tree.vars` and
`gallery.tree.vars` in order to change the resulting web site
appearance.

In order for the slideshow to work, you need to provide the [blueimp
gallery] scripts in `examples/gallery.org/scripts/blueimp-gallery/`:

    cd examples/gallery.org/scripts
    wget http://github.com/blueimp/Gallery/archive/2.15.2.tar.gz
    tar -x -f 2.15.2.tar.gz
    mv Gallery-2.15.2 blueimp-gallery

By default, FileWiki gallery depends on external tools to convert your
image and video resources:

  * PerlMagick API from the [ImageMagick] suite (package called
    `ImageMagick-perl` on some distros)
  * `ffmpeg` tool from [FFmpeg]

Now if everything is set up, you can now build your personal gallery:

    filewiki -v examples/gallery.org

Point your browser to `file:///tmp/filewiki/htdocs/index.html` to see
the resulting website. Enrich the pages by providing information on
photos (in `myphoto.jpg.vars`) and directories (in `dir.vars`):

    title    Spaghetti
    summary  The best spaghetti I ever had in my life!
    desc     This is a long description about my trip to Italy ...

If you're happy with the results, comment out the `URI_PREFIX`
variable and run filewiki again.

    file: examples/gallery.org/tree.vars

    # comment out URI_PREFIX (or set to some prefix on your site, e.g. "/my-gallery/"):
    #URI_PREFIX=$OUTPUT_DIR

If you want FileWiki to automatically install your site to a remote
server, edit the `CMD_INSTALL` variable and run:

    filewiki -c install examples/gallery.org

Note that FileWiki resource plugins do not rebuild resources (images
and videos in this case) if their targets in `OUTPUT_DIR` are already
present. You need to set the `RESOURCES_FORCE_REBUILD` variable or
manually delete the files in `OUTPUT_DIR` if you want the targets to
be rebuilt (e.g. after changing the image dimensions).

  [blueimp gallery]: http://github.com/blueimp/Gallery
  [ImageMagick]: http://www.imagemagick.org
  [FFmpeg]: http://ffmpeg.org


### Apache Handler

An example on how to configure FileWiki as a HTTP PerlResponseHandler
is provided in the Apache::FileWiki::Handler perl module
documentation.

Note that this is rather experimental, and *very insecure*, so make
sure you don't install this on a publicly available location. You have
been warned!
