CVSの使い方(応用編)

Written by Masahiko KIMOTO
Copyright (c) 1999 by Masahiko KIMOTO.

はじめに

CVSの使い方、応用編のテーマはWWWとの協調です。

WebコンテンツのCVS管理

WebコンテンツをCVS管理すると、とても便利です。複数の人が共同でWebコン テンツを編集できますし、一人で使う場合でもデスクトップでの作業とノート PC上で作業を並行して進められます。ここでは、commitした時に、 自動的にサーバにコンテンツを転送する方法について説明します。

レポジトリを覗いてみましょう。CVSROOTというディレクトリがありますね。 その中にはレポジトリの管理情報が含まれています。この中のmodulesという ファイルでは、moduleごとにcvsの各コマンドを実行したときに実行するプロ グラムを指定できます。書き方は、このファイルのコメントに全部書いてあり ます。

# Three different line formats are valid:
#       key     -a    aliases...
#       key [options] directory
#       key [options] directory files...
#
# Where "options" are composed of:
#       -i prog         Run "prog" on "cvs commit" from top-level of module.
#       -o prog         Run "prog" on "cvs checkout" of module.
#       -e prog         Run "prog" on "cvs export" of module.
#       -t prog         Run "prog" on "cvs rtag" of module.
#       -u prog         Run "prog" on "cvs update" of module.
#       -d dir          Place module in directory "dir" instead of module name.
#       -l              Top-level directory only -- do not recurse.
#
# NOTE:  If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias.  An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module.  This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.
たとえばpublic-htmlというモジュールを作成してあって、commitした 時に自動的にWWWサーバに転送するようにしたかったら、以下の行を追加します。
public-html -i scripts/dist-public-html public-html
ディレクトリは絶対pathでも$CVSROOTからの相対pathでも記述できます。 上記の場合$CVSROOT/dist-public-htmlには例えば以下の内容を書きます。
#!/bin/sh
rsh www.domain.name 'cd /htdocs/user/MYNAME/public-html;cvs update -d &
ただし、このコンテンツを複数の人で共有する場合はcvs updateした後に chmod -R g+w *を実行しておいた方が良いでしょう。

おっと、その前に。慌てないでください。CVSROOT以下のファイルは直接編集しては いけません。他のmoduleを編集する場合と同じように

cvs co CVSROOT
して取り出して編集した後commitしてください。

CVS Webを使おう

(執筆中…というより、インストールしなきゃと思いつつすすんでません)
Masahiko KIMOTO <kimoto@ohnolab.org>
Last modified: Sun Sep 5 04:33:35 1999