Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding documentation how to map directories #160

Merged
merged 1 commit into from
Feb 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/sphinx/universal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,40 @@ Besides ``mappings``, the ``name``, ``sourceDirectory`` and ``target`` configura

**Note: The Universal plugin will make anything in a bin/ directory executable. This is to work around issues with JVM and file system manipulations.**

Mapping Examples
----------------
SBT provides and IO and .. Path: http://www.scala-sbt.org/0.13.1/docs/Detailed-Topics/Paths.html API, which
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/and/an/

.. ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH, .. is the link syntax noise from sphinx. Right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep ;) is markdown an option? Would be more readable on github too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not if we use sphinx. Right now all the "verison-specific" website hooks we've created are sphinx-specific, if we want to copy that out of the sbt build itself. Otherwise, Markdown would be nice :)

lets you define custom mappings easily. The files will appear in the generate universal zip, but also in your
debian/rpm/msi/dmg builds as described above in the conventions.

The ``packageBin in Compile`` dependency is only needed, if your files get generated
during the ``packageBin`` command or before. For static files you can remove it.

Mapping a complete directory.

.. code-block:: scala

mappings in Universal <++= (packageBin in Compile, target ) map { (_, target) =>
val dir = target / "scala-2.10" / "api"
(dir.***) pair relativeTo(dir.getParentFile)
}

This maps the ``api`` folder directly to the generate universal zip. ``dir.***`` is a short way for
``dir ** "*"``, which means _select all files including dir_. ``relativeTo(dir.getParentFile)``
generates a function with a ``file -> Option[String]`` mapping, which tries to generate a relative
string path from ``dir.getParentFile`` to the passed in file. ``pair`` uses the ``relativeTo``
function to generate a mapping ``File -> String``, which is _your file_ to _relative destination_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit terse as I read through it (which mirrors the general sbt docs right now). I wonder if we need to dig into the syntax one bit at time for folks or not....

Still this is WAY better than having nothing, and a really really good start. Great examples.


Mapping the content of a directory.

.. code-block:: scala

mappings in Universal <++= (packageBin in Compile, target ) map { (_, target) =>
val dir = target / "scala-2.10" / "api"
(dir.*** --- dir) pair relativeTo(dir)
}

The ``dir`` gets excluded and is used as root for ``relativeTo(dir)``.

Commands
--------
Expand Down