2009/08/21


テストも兼ねて...

追記
これだけだとなんなので...。
RSSもしくはAtomにrel="hub" href="http://pubsubhubbub.appspot.com"のlink要素を追加し、このpluginのhub_urlにRSSもしくはAtomのURLを指定すれば動きます。
Posted at by



2009/08/19


だいたいに10分くらいだと思う。
まずtinytinyhttpd(tthttpd)とmercurialは既に入っている事として

1. リポジトリを作る

# cd /path/to/repo
# hg init

2. hgwebdir.cgiを用意する

mercurialに含まれるhgwebdir.cgiを配置する。
# cd /path/to/web
# cp /path/to/hgwebdir.cgi .
mercurialのソースパッケージに入ってる

3. hgweb.configを用意する

hgwebdir.cgi用の設定ファイルを書く。
[paths]
repo = /path/to/repo

4. hgrcを作る

.hg/hgrcを作る(もしくは修正する)。 [web]
name = repo
description = my private repo
contact = mattn@example.com
push_ssl = false
allow_push = mattn iratqq hasegawa
allow_pull = *
allow_read = *
allow_archive = bz2, gz, zip
encoding = utf-8

5. パスワードファイルを書く

mattn:ggrks
iratqq:kkrkr
hasegawa:xss
プレインテキストなので要注意

6. tthttpdの設定ファイルを書く

Windowsならば [global]
port=8080
root=c:/path/to/repo
indexpages=hgwebdir.cgi

[mime/types]
cgi=@c:/python26/python.exe

[authentication]
/=POST,Admin!,c:/path/to/passwd
Unixならば [global]
port=8080
root=/path/to/repo
indexpages=hgwebdir.cgi
spawn_executable=on

[authentication]
/=POST,Admin!,/path/to/passwd
こんな感じ。

7. tthttpdを起動する

設定ファイルを指定して起動
# tthttpd -vvv -c repo.conf
tthttpd-hgweb1
うごいた。

8. clone/pushしてみる

# hg clone http://localhost:8080/hgwebdir.cgi/repo
destination directory: repo
no changes found
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
# cat > README

^D

# hg add README
# hg commit -m "first import"
# hg push
pushing to http://localhost:8080/hgwebdir.cgi/repo
searching for changes
http authorization required
realm: Admin!
user: mattn
password:
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files

tthttpd-hgweb2
うごいた。
最新版のtinytinyhttpdでしか動きません。

tthttpd.exeを含んだリポジトリフォルダごと持って歩けば、どこでもmercurialサーバになるね。
Posted at by



2009/08/18


色々と修正を施して、sinatraのdispatch.cgiも動くようになっています。またBASIC認証をサポートしましたので、tDiaryのupdate.rbだけに認証をかけられる様になっています。実際には、ターゲットURL、メソッド(GET/POSTなど)、ユーザ・パスワード一覧という設定が可能になったので、複数ユーザを扱う事も出来ます。
ただ現状、プレインテキストのみ対応ですので、これについては今後なんとかして行きたいと思っています。

本当ならば.htaccessを読み込ませたいのですが、.htaccessはcrypt/md5を使って暗号化されており、libcryptを使うとなれば依存が増えると同時に、ライセンス的にもグレーになってきますので、少し悩んでいます。どこかにPublic Domainで書かれたlibcrypt知りませんか?
Posted at by