1
0
Fork 0
mirror of https://git.ludikovsky.name/git/fugitive.git synced 2024-06-25 19:40:33 +02:00

Adding files to the projects

Makefile is still empty but not for long I hope.
README starts to be something real.
src/archives.html is the templates for the archives page.
src/exclude is for .git/info/exclude
src/install.sh is the main script which will include other when generating
  fugitive.
src/post-receive.sh is still empty for now.
This commit is contained in:
p4bl0 2010-07-23 02:52:43 +02:00
parent 316be9ffd6
commit 4467a42aee
6 changed files with 183 additions and 0 deletions

1
Makefile Normal file
View file

@ -0,0 +1 @@
# should generate the fugitive shell script from hooks files and template

66
README Normal file
View file

@ -0,0 +1,66 @@
INFO
====
fugitive is a blog engine running on top of git using hooks to generate static
html pages and thus having only git as dependency.
INSTALL
=======
Simply run `fugitive --install <dir>`.
This will create the git repos with appropriate hooks and files in <dir>.
If <dir> isn't specified then the current working directory is used.
NOTE: You need to use the same process to install remote repository.
UPDATE
======
Simply run `fugitive --install-hooks <dir>`.
This will only (re)install fugitive hooks scripts.
If <dir> isn't specified then the current working directory is used.
CONFIGURATION
=============
There are three item in the "fugitive" section of the git config:
- "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.
- "articles-dir" is the path where fugitive will look for published articles.
Default value is "fugitive/articles". This path is relative to the root of
the git repository, must be in it and must not start with ".".
- "templates-dir" is the path where fugitive will look for templates files.
Default value is "fugitive/templates". This path is relative to the root of
the git repository, must be in it and must not start with ".".
NOTE: You must NOT put a trailing '/' at the end of any of those paths.
USAGE
=====
General use
-----------
Template system
---------------
IDEA
====
* make devrait gzippé puis base64 encodé les fichiers pour les mettres dans le
script d'install, et l'help aussi.
* index = cp de last article.
* trouver moyen de mettre des prev et next dans la nav

46
src/archives.html Normal file
View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html dir="ltr" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?fugitive-install name ?>'s blog: <?fugitive article_title ?></title>
<meta http-equiv="Content-type" content="application/xhtml+xml; charset=utf-8" />
<meta name="author" content="<?fugitive-install name ?>" />
<meta name="description" content="<?fugitive-install name ?>'s blog" />
<link rel="stylesheet" href="fugitive.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<div id="container">
<nav>
<ul>
<li><a href="index.html">home</a></li>
<li>archives</li>
</ul>
</nav>
<header>
<h1><?fugitive-install name ?>'s blog</h1>
<q>Weeks of coding can save you hours of planning.</q>
</header>
<article>
<header>
<h2>Archives</h2>
</header>
<section>
<?fugitive archives ?>
</section>
</article>
<footer>
<p>
<a href="http://www.gnu.org/copyleft/copyleft.html">copyleft</a>
<?fugitive-install name ?> <?fugitive-install year ?>
&mdash;
powered by <a href="http://gitorious.org/fugitive">fugitive</a>
</p>
<p>
last build was <?fugitive commit_hash ?>,
<time><?fugitive commit_datetime ?></time>,
<q><?fugitive commit_subject ?></q>
</p>
</footer>
</div>
</body>
</html>

0
src/exclude Normal file
View file

70
src/install.sh Normal file
View file

@ -0,0 +1,70 @@
#!/bin/sh
replace_var_by_string() {
sed "s/<?fugitive-install\s\+$1\s*?>/$2/"
}
fugitive_write_template() {
name=`git config --get user.name`
base64 -d | gunzip | replace_var_by_string name "$name" | \
replace_var_by_string year "`date +%Y`"
}
fugitive_install() {
DIR="."
if [ "$1" != "" ]; then DIR="$1"; fi
if [ ! -d "$DIR" ]; then mkdir -p "$DIR"; fi
cd "$DIR"
echo -n "Creating new git repository... "
git init >/dev/null
echo "done."
echo -n "Creating default directory tree... "
mkdir -p fugitive/{drafts,articles,templates}
echo "done."
echo -n "Adding default directory paths to git config... "
git config --add --path fugitive.templates-dir "fugitive/templates"
git config --add --path fugitive.articles-dir "fugitive/articles"
git config --add --path fugitive.public-dir "."
echo "done."
echo -n "Writing default template files... "
fugitive_write_template > fugitive/templates/article.html <<EOF
#INCLUDE:article.html#
EOF
fugitive_write_template > fugitive/templates/archives.html <<EOF
#INCLUDE:archives.html#
EOF
echo "done."
echo -n "Writing default css file... "
(base64 -d | gunzip) > fugitice.css <<EOF
#INCLUDE:fugitive.css#
EOF
echo "done."
echo -n "Installing fugitive hooks scripts... "
(base64 -d | gunzip) > .git/hooks/post-commit <<EOF
#INCLUDE:post-commit.sh#
EOF
chmod +x .git/hooks/post-receive
(base64 -d | gunzip) > .git/hooks/post-receive <<EOF
#INCLUDE:post-receive.sh#
EOF
chmod +x .git/hooks/post-receive
echo "done."
echo -n "Importing files into git repository... "
git add fugitive/templates/* fugitive.css >/dev/null
git commit -m "fugitive inital import" >/dev/null
echo "done."
echo -n "Preventing git to track generated html files... "
(base64 -d | gunzip) > .git/info/exclude <<EOF
#INCLUDE:exclude#
EOF
echo "done."
cd -
echo "Installation complete, please see the README file for an howto."
}
case "$1" in
"--help") fugitive_help >&2;;
"--install") fugitive_install "$2";;
"--install-hooks") fugitive_install_hooks "$2";;
*) fugitive_usage >&2;;
esac

0
src/post-receive.sh Normal file
View file