summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README39
-rw-r--r--install.sh3
-rw-r--r--post-commit.sh7
3 files changed, 32 insertions, 17 deletions
diff --git a/README b/README
index b8a514f..f18a888 100644
--- a/README
+++ b/README
@@ -14,7 +14,7 @@ fugitive README file
<br />
<code>git clone git://gitorious.org/fugitive/fugitive.git fugitive</code>
<br />
- Then simply go in the newly created directory: <code>cd fugitive</code>, and
+ Then go in the newly created directory: <code>cd fugitive</code>, and
run the build script: <code>./build.sh</code>.
<br />
This will generate an executable file &quot;fugitive&quot;.
@@ -35,7 +35,7 @@ fugitive README file
</p>
<h3>Update</h3>
<p>
- Simply run <code>fugitive --install-hooks &lt;dir&gt;</code>.<br />
+ Run <code>fugitive --install-hooks &lt;dir&gt;</code>.<br />
This will only (re)install fugitive hooks scripts.<br />
If &lt;dir&gt; isn't specified then the current working directory is used.
</p>
@@ -43,37 +43,44 @@ fugitive README file
<h2>Configuration</h2>
<p>
- There are three item in the "fugitive" section of the git config:
+ There are three paths in the &quot;fugitive&quot; section of the git config:
</p>
<ul>
<li>
- "public-dir" is the path to the directory that will contain the generated
- html files. Defautlt value is ".", the root of the git repository. You
- could set it to "blog" for instance if you already have a static website
- under your git repos.
+ <em>public-dir</em> is the path to the directory that will contain the
+ generated html files. Defautlt value is &quot;.&quot;, the root of the git
+ repository. You could set it to &quot;blog&quot; for instance if you
+ already have a static website under your git repos.
</li>
<li>
- "articles-dir" is the path where fugitive will look for published articles.
- Default value is "_articles". This path is relative to the root of the git
- repository, must be in it and must not start with ".".
+ <em>articles-dir</em> is the path where fugitive will look for published
+ articles. Default value is &quot;_articles&quot;. This path is relative to
+ the root of the git repository, must be in it and must not start with
+ &quot;.&quot;.
</li>
<li>
- "templates-dir" is the path where fugitive will look for templates files.
- Default value is "_templates". This path is relative to the root of the git
- repository, must be in it and must not start with ".".
+ <em>templates-dire</em> is the path where fugitive will look for templates
+ files. Default value is &quot;_templates&quot;. This path is relative to
+ the root of the git repository, must be in it and must not start with
+ &quot;.&quot;.
</li>
</ul>
<p>
<strong>NOTE:</strong> You must NOT put a trailing '/' at the end of any of
those paths.
</p>
+<p>
+ If you want your article to be preprocessed by an external tool (markdown,
+ textile...) you need to set <em>preproc</em> to a command line that will take
+ the file path as argument and write to stdout.
+</p>
<h2>Usage</h2>
<h3>General use</h3>
<p>
Article you want to publish should be file without the .html extension in the
- "articles-dir" directory (see CONFIGURATION).
+ <em>articles-dir</em> directory (see CONFIGURATION).
</p>
<p>
The first line of the file will be used as title and the rest of the file as
@@ -81,8 +88,8 @@ fugitive README file
</p>
<p>
<strong>/!\ WARNINGS:</strong><br />
- DO NOT CREATE AN ARTICLE FILE NAMED "archives".<br />
- DO NOT CREATE AN ARTICLE FILE NAMED "index".
+ DO NOT CREATE AN ARTICLE FILE NAMED &quot;archives&quot;.<br />
+ DO NOT CREATE AN ARTICLE FILE NAMED &quot;index&quot;.
</p>
<h3>Template system</h3>
<p><em>*TODO*</em></p>
diff --git a/install.sh b/install.sh
index 8505ef9..a24f3c3 100644
--- a/install.sh
+++ b/install.sh
@@ -34,10 +34,11 @@ fugitive_install() {
echo -n "Creating default directory tree... "
mkdir -p _drafts _articles _templates
echo "done."
- echo -n "Adding default directory paths to git config... "
+ echo -n "Adding default directory paths and settings to git config... "
git config --add --path fugitive.templates-dir "_templates"
git config --add --path fugitive.articles-dir "_articles"
git config --add --path fugitive.public-dir "."
+ git config --add --path fugitive.preproc ""
echo "done."
echo -n "Writing default template files... "
fugitive_write_template > _templates/article.html <<EOF
diff --git a/post-commit.sh b/post-commit.sh
index d798121..30d9315 100644
--- a/post-commit.sh
+++ b/post-commit.sh
@@ -4,6 +4,7 @@ public_dir=`git config --get fugitive.public-dir`
if [ ! -d "$public_dir" ]; then mkdir -p "$public_dir"; fi
templates_dir=`git config --get fugitive.templates-dir`
articles_dir=`git config --get fugitive.articles-dir`
+preproc=`git config --get fugitive.preproc`
added_files=`git log -1 --name-status --pretty="format:" | grep -E '^A' | \
cut -f2`
@@ -193,6 +194,11 @@ new=$RANDOM.$$
for f in $added_files $new $modified_files; do
if [ "$f" != "${f#$articles_dir}" ]; then
modification=$((modification + 1))
+ if [ "$preproc" != "" ]; then
+ preproc_bak=`tempfile -p "fugitive" -d "$articles_dir"`
+ mv "$f" "$preproc_bak"
+ $preproc "$preproc_bak" > "$f"
+ fi
art="${f#$articles_dir/}"
echo -n "[fugitive] Generating $public_dir/$art.html from $f... "
cat "$templates_dir/article.html" | \
@@ -207,6 +213,7 @@ for f in $added_files $new $modified_files; do
echo "$art.html" >> .git/info/exclude
echo "done."
fi
+ if [ "$preproc" != "" ]; then mv "$preproc_bak" "$f"; fi
fi
if [ "$f" = "$new" ]; then new=""; fi
done