2013年2月10日日曜日

[Trac]Windows に Trac をインストール

以下のパッケージをインストールする
Table 1. Trac に必要なパッケージ
パッケージバージョン入手先
Active Python2.5.5.7ActiveState
Python setuptools0.6c9(Python2.5 用)Python Package Index : setuptools 0.6c11
mod_python3.3.1 (Windows, Apache2.2 用)mod_python.org
  1. Active Python 2.5.5.7 をダウンロード、インストールする
  2. Windows 用の Python setupttols 0.6c をダウンロード、インストールする
  3. Python25/Scripts に easy_install.exe がインストールされているので実行する
    > easy_install.exe Trac
    Searching for Trac
    Reading http://pypi.python.org/simple/Trac/
    Reading http://trac.edgewall.com/
    Reading http://trac.edgewall.org/wiki/TracDownload
    Reading http://projects.edgewall.com/trac
    Reading http://projects.edgewall.com/trac/wiki/TracDownload
    Best match: Trac 0.11.4
    Downloading http://pypi.python.org/packages/2.5/T/Trac/Trac-0.11.4-py2.5.egg#md5
    =b97f05e8683b400c28cb022040c333e4
    Processing Trac-0.11.4-py2.5.egg
    creating c:\usr\python25\lib\site-packages\Trac-0.11.4-py2.5.egg
    Extracting Trac-0.11.4-py2.5.egg to c:\usr\python25\lib\site-packages
    Adding Trac 0.11.4 to easy-install.pth file
    Installing trac-admin-script.py script to C:\usr\Python25\Scripts
    Installing trac-admin.exe script to C:\usr\Python25\Scripts
    Installing tracd-script.py script to C:\usr\Python25\Scripts
    Installing tracd.exe script to C:\usr\Python25\Scripts
    
    Installed c:\usr\python25\lib\site-packages\trac-0.11.4-py2.5.egg
    Processing dependencies for Trac
    Searching for Genshi>=0.5
    Reading http://pypi.python.org/simple/Genshi/
    Reading http://genshi.edgewall.org/
    Reading http://genshi.edgewall.org/wiki/Download
    Best match: Genshi 0.5.1
    Downloading http://ftp.edgewall.com/pub/genshi/Genshi-0.5.1-py2.5-win32.egg
    Processing Genshi-0.5.1-py2.5-win32.egg
    Moving Genshi-0.5.1-py2.5-win32.egg to c:\usr\python25\lib\site-packages
    Adding Genshi 0.5.1 to easy-install.pth file
    
    Installed c:\usr\python25\lib\site-packages\genshi-0.5.1-py2.5-win32.egg
    Finished processing dependencies for Trac
    
  4. プロジェクトディレクトリを作成する
    C:\home>mkdir trac
    C:\home>cd trac
    C:\home\trac>mkdir test
    
  5. trac-admin.exe で初期化を行う
    C:\home\trac\test>c:\usr\Python25\Scripts\trac-admin.exe c:\home\trac\test initenv
    Creating a new Trac environment at c:\home\trac\test
    
    Trac will first ask a few questions about your environment
    in order to initialize and prepare the project database.
    
     Please enter the name of your project.
     This name will be used in page titles and descriptions.
    
    Project Name [My Project]> trac_test ← プロジェクト名を入力
    
     Please specify the connection string for the database to use.
     By default, a local SQLite database is created in the environment
     directory. It is also possible to use an already existing
     PostgreSQL database (check the Trac documentation for the exact
     connection string syntax).
    
    Database connection string [sqlite:db/trac.db]> (Enter)
    
     Please specify the type of version control system,
     By default, it will be svn.
    
     If you don't want to use Trac with version control integration,
     choose the default here and don't specify a repository directory.
     in the next question.
    
    Repository type [svn]> (Enter)
    
     Please specify the absolute path to the version control
     repository, or leave it blank to use Trac without a repository.
     You can also set the repository location later.
    
    Path to repository [/path/to/repos]> (Enter)
    
    Creating and Initializing Project
    (中略)
    Project environment for 'trac_test' created.
    
    You may now configure the environment by editing the file:
    
      c:\home\trac\test\conf\trac.ini
    
    If you'd like to take this new project environment for a test drive,
    try running the Trac standalone web server `tracd`:
    
      tracd --port 8000 c:\home\trac\test
    
    Then point your browser to http://localhost:8000/test.
    There you can also browse the documentation for your installed
    version of Trac, including information on further setup (such as
    deploying Trac to a real web server).
    
    The latest documentation can also always be found on the project
    website:
    
      http://trac.edgewall.org/
    
    Congratulations!
    
  6. Apache で動作するように mod_python 3.3.1 (win32, py2.5, Apache2.2) をダウンロード、インストールする
    Apache のインストール先を聞かれた時はインストーラは modules ディレクトリが知りたいので bin ディレクトリではなく Apache のルートディレクトリを指定する
  7. apache/conf/httpd.conf に以下を追記
    ### Trac ###
    LoadModule python_module modules/mod_python.so
    <IfModule python_module>
     <Location "/trac">
      SetHandler mod_python
      PythonInterpreter main_interpreter
      PythonHandler trac.web.modpython_frontend
      PythonOption TracEnvParentDir "c:\home\trac"
      PythonOption TracUriRoot /trac
     </Location>
    </IfModule>
    
  8. Apache を再起動する
  9. ブラウザで http://localhost/trac にアクセスし trac_test プロジェクトが表示されることを確認する
  10. ユーザ登録 (全プロジェクトを通してのユーザ登録) をする
    apache\bin\htpasswd.exe -c c:\home\trac\trac.htpasswd user-name
    Automatically using MD5 format.
    New password: ********
    Re-type new password: ********
    Adding password for user user-name
    
  11. httpd.conf の で囲まれた箇所に以下を追加
    AuthType Basic
    AuthName "Trac"
    AuthUserFile "c:\home\trac\trac.htpasswd"
    Require valid-user
    
  12. 作成したユーザに Admin 権限を与える
    C:\home\trac\test>c:\usr\Python25\Scripts\trac-admin.exe c:\home\trac\test
    Welcome to trac-admin 0.11.4
    Interactive Trac administration console.
    Copyright (c) 2003-2009 Edgewall Software
    
    Type:  '?' or 'help' for help on commands.
    
    Trac [c:\home\trac\test]> permission add user-name TRAC_ADMIN
    Trac [c:\home\trac\test]> permission list user-name
    (user-name で指定したユーザの権限一覧が表示される)
    
    User       Action
    --------------------------------
    user-name  BROWSER_VIEW
    user-name  CHANGESET_VIEW
    (以下略)
    

google-code-prettify

  1. google-code-prettify から prettify-21-Jul-2010.zip をダウンロードする
  2. ダウンロードしたファイルを展開する
  3. 適応する HTML ソースのヘッダに以下を追加する
    <head>
      <title>TEST</title>
      <link href="google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
      <script type="text/javascript" src="google-code-prettify/prettify.js"></script>
    </head>
    
  4. 適応する HTML ソースの body タグに onload="prettyPrint()" を追加する
    <body onload="prettyPrint()">
    
  5. 適応するプログラムコードの pre 要素に class="prettyprint" を追加する
    <pre class="prettyprint">
    

[Ubuntu]フォント (ttf) のインストール

Ubuntu へのフォントインストール
  1. /etc/fonts/fonts.conf でフォントのインストール先を確認する
    <dir>/usr/share/fonts</dir>
    <dir>/usr/share/X11/fonts</dir>
    <dir>/usr/local/share/fonts</dir>
    <dir>~/.fonts</dir>
    
  2. TrueType フォントは /usr/share/fonts/truetype/ の下に配置するのが慣例
  3. フォントファイルをコピーする
  4. .ttf ファイルのモードを rw-r--r-- に変更する
    $ sudo chmod 644 *
    
  5. フォントキャッシュをリフレッシュする
    $ sudo fc-cache -f -v
    
年賀状作成に利用できる行書フォント: 白舟書体

[Subversion]merge

trunk の更新を branch に適合する
$ svn diff -r 7:9 file:///c:/usr/svn/repositories/svn_test/trunk
$ svn merge -r 7:9 file:///c:/usr/svn/repositories/svn_test/trunk

[Subverion]log

log 確認
以下のようにすると test.c が変更されたときの更新コメントが見ることができる
$ svn log test.c
ログファイルの修正
  1. 修正するリビジョンの確認
    $ svn log file:///c:/usr/svn/repositories/svn_test/trunk -r 8
    ------------------------------------------------------------------------
    r8 | User Name | 2008-10-29 22:26:44 +0900 (水, 29 10 2008) | 1 line
    Add
    ------------------------------------------------------------------------
    
  2. ログのバックアップを取る
    $ svn log file:///c:/usr/svn/repositories/svn_test/trunk -r 1:HEAD > log.txt
    
  3. newlog.txt を作成して修正文章を入れる
  4. newlog.txt を反映する
    $ svnadmin setlog --bypass-hooks c:\usr\svn\repositories\svn_test -r 8 newlog.txt
    

[Subverion]タグ付け

tags の下にコピーをしてタグ付けとする。基本はブランチと同じでただのコピー
$ svn copy file:///c:/usr/svn/repositories/svn_test/trunk file:///c:/usr/svn/repositories/svn_test/tags/release-1.0 -m "Tagging the 1.0 release"

[Subverion]ブランチ作成

branches の下にコピーをして分岐さる
$ svn copy file:///c:/usr/svn/repositories/svn_test/trunk file:///c:/usr/svn/repositories/svn_test/branches/nakao-branch -m "Creating a private branch of /svn_test/trunk"