carthage 本体の更新

swift でアプリを作り始めて carthage のお世話になっている。
今回とあるライブラリを使うため carthage でインストールしようとしたらこんなエラーが出た

$ carthage update
Please update to the latest Carthage version: 0.31.1. You currently are on 0.29.0
Failed to read file or folder at /Users/myname/Documents/Hoge/Sample1/Sample1/Cartfile: Error Domain=NSCocoaErrorDomain Code=260 "The file “Cartfile” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/myname/Documents/Hoge/Sample1/Sample1/Cartfile, NSUnderlyingError=0x7f96a0e03d20 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

brew update carthage みたいに打てばいいかな?と思ったが

$ brew update carthage
Error: This command updates brew itself, and does not take formula names.
Use 'brew upgrade carthage' instead.

ちがうらしい。
Google のお世話になり upgrade だと知った。(そもそも、エラーメッセージに upgrade を使えと書いてあった!)

$ brew upgrade carthage
Updating Homebrew...
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and mono0926/license-plist).
==> New Formulae

(途中省略)

==> Upgrading 1 outdated package:
carthage 0.29.0 -> 0.31.1
==> Upgrading carthage 
==> Downloading https://homebrew.bintray.com/bottles/carthage-0.31.1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring carthage-0.31.1.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/carthage/0.31.1: 69 files, 25.2MB

Play Framework

重い腰を上げて Java の世界もつまんでみようと Play Framework の本を購入してみたものの、最新バージョン(2.3.7)をダウンロードしたら activator という本に記載されたものとは違うコマンドを使ってアプリ開発をする形態となっていた。そのため本家の日本語のマニュアルを見ながらお試し。

■ インストール

1. https://www.playframework.com/download から “Download Play 2.3.7” というボタンをクリック

2. Downloadsフォルダに “activator-1.2.12-minimal” ができる

3. /usr/local に移動

4. PATH に activator へのパスを追加

■ 新規プロジェクトを作成

activator というコマンドでもろもろ管理をする構造になっているらしい。CakePHP でいう bake とか Rails でいう rails コマンドみたいな感じ。

$ activator new my-first-app play-java

MacBook Pro 上で実行したら、とにかく時間がかかった。久しぶりに待たされる環境での作業をした印象。この重さ(非力マシンだと遅い)が Java を敬遠する要因だったのだけどそれを改めて実感した。

■ 起動してみる

プロジェクトを作成したらすでに表示できるものがそろっているようなのでローカルで起動させて確認する。

$ activator run

しばらく(何分か)待つと

--- (Running the application, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0%0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

というメッセージがでて接続待ちになる。

ブラウザで

http://localhost:9000

にアクセスすると Scala のコンパイラが走るみたいで

[info] Compiling 4 Scala sources and 2 Java sources to /Users/aotake/Play/myFirstApp/target/scala-2.11/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.11.1. Compiling...
[info]   Compilation completed in 15.76 s
[info] play - Application started (Dev)

というメッセージが出た後ブラウザに画面が表示された。コンパイルに 15 秒ほどかかっているらしい。
コンパイルされた後に再アクセスするときは [info] も出力されず、すぐに画面表示がされた。

firstView

■ 停止

Ctr + D で activator のコンソール画面に戻る

■ activator の終了

exit で終了する

[myFirstApp] exit

mac に ffmpeg

macbookpro15$ brew install ffmpeg
==> Installing dependencies for ffmpeg: x264, faac, lame, xvid
==> Installing ffmpeg dependency: x264
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/x264-r2397.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring x264-r2397.mavericks.bottle.tar.gz
==> Caveats
Because libx264 has a rapidly-changing API, formulae that link against
it should be reinstalled each time you upgrade x264. Examples include:
   avidemux, ffmbc, ffmpeg, gst-plugins-ugly
==> Summary
  /usr/local/Cellar/x264/r2397: 9 files, 3.4M
==> Installing ffmpeg dependency: faac
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/faac-1.28.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring faac-1.28.mavericks.bottle.tar.gz
  /usr/local/Cellar/faac/1.28: 13 files, 720K
==> Installing ffmpeg dependency: lame
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/lame-3.99.5.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring lame-3.99.5.mavericks.bottle.tar.gz
  /usr/local/Cellar/lame/3.99.5: 25 files, 2.1M
==> Installing ffmpeg dependency: xvid
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/xvid-1.3.2.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring xvid-1.3.2.mavericks.bottle.tar.gz
  /usr/local/Cellar/xvid/1.3.2: 9 files, 1.3M
==> Installing ffmpeg
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ffmpeg-2.2.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ffmpeg-2.2.mavericks.bottle.tar.gz
  /usr/local/Cellar/ffmpeg/2.2: 192 files, 36M

mac の Command + Tab がおかしい

ある日突然 Command + Tab をすると、勝手に一番右まで移動するようになった。
途中のを選択したくてもフォーカスが移動する速度が速くて難しい。

その後、Launchpad を出すと、1ページ目しか表示されないことに気づいた。
画面下のページャで4ページ目を指定しても勝手に1ページ目に戻る。

さらに、Safari で Web を見ているときにスクロールの慣性が効かなくなっているだけでなく、かってに1ページ戻る動き(二本指で右にスワイプ?)をするようになった。

7時間描けてウィルスチェックまでしたのに、ウィルスの問題は無かった。

どこかのサイトにインテリマウスとの相性が悪いという記事があった。
もしかして、と思い、USB の無線発信器を PC から抜いたら元に戻った。

いままでそんなことなかったのだけど、Logicool の無線のトラックボールと Apple のトラックパッドを同時に使っていたのが問題だったようだ。

OpenSSL Update した

http://www.itmedia.co.jp/enterprise/articles/1406/06/news034.html

こんなのがあったので対応。

さくら7

# yum -y update openssl
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.jaist.ac.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package openssl.x86_64 0:1.0.1e-16.el6_5.7 will be updated
--> Processing Dependency: openssl = 1.0.1e-16.el6_5.7 for package: openssl-devel-1.0.1e-16.el6_5.7.x86_64
---> Package openssl.x86_64 0:1.0.1e-16.el6_5.14 will be an update
--> Running transaction check
---> Package openssl-devel.x86_64 0:1.0.1e-16.el6_5.7 will be updated
---> Package openssl-devel.x86_64 0:1.0.1e-16.el6_5.14 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch         Version                   Repository     Size
================================================================================
Updating:
 openssl             x86_64       1.0.1e-16.el6_5.14        updates       1.5 M
Updating for dependencies:
 openssl-devel       x86_64       1.0.1e-16.el6_5.14        updates       1.2 M

Transaction Summary
================================================================================
Upgrade       2 Package(s)

Total download size: 2.7 M
Downloading Packages:
(1/2): openssl-1.0.1e-16.el6_5.14.x86_64.rpm             | 1.5 MB     00:00     
(2/2): openssl-devel-1.0.1e-16.el6_5.14.x86_64.rpm       | 1.2 MB     00:00     
--------------------------------------------------------------------------------
Total                                           4.5 MB/s | 2.7 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : openssl-1.0.1e-16.el6_5.14.x86_64                            1/4 
  Updating   : openssl-devel-1.0.1e-16.el6_5.14.x86_64                      2/4 
  Cleanup    : openssl-devel-1.0.1e-16.el6_5.7.x86_64                       3/4 
  Cleanup    : openssl-1.0.1e-16.el6_5.7.x86_64                             4/4 
  Verifying  : openssl-1.0.1e-16.el6_5.14.x86_64                            1/4 
  Verifying  : openssl-devel-1.0.1e-16.el6_5.14.x86_64                      2/4 
  Verifying  : openssl-1.0.1e-16.el6_5.7.x86_64                             3/4 
  Verifying  : openssl-devel-1.0.1e-16.el6_5.7.x86_64                       4/4 

Updated:
  openssl.x86_64 0:1.0.1e-16.el6_5.14                                           

Dependency Updated:
  openssl-devel.x86_64 0:1.0.1e-16.el6_5.14                                     

Complete!

Sphinx で blockdiag や seqdiag の図をいれた PDF 生成

結構はまった。

blockdiag で図を PDF として生成して読み込ませるように conf.py を設定

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
]
extensions += ['sphinxcontrib.blockdiag']
blockdiag_fontpath = [ '/Library/Fonts/Microsoft/MS PGothic.ttf' ]
blockdiag_html_image_format = 'PNG'
blockdiag_tex_image_format = 'PDF'
extensions += ['sphinxcontrib.seqdiag']
seqdiag_fontpath = ['/Library/Fonts/Microsoft/MS PGothic.ttf']
seqdiag_antialias = True
seqdiag_html_image_format = 'PNG'
seqdiag_tex_image_format = 'PDF'

これでコンパイルすると

! LaTeX Error: Cannot determine size of graphic in blockdiag-8f01b70ed42f7a29a6
79015a8ce0818959e7ea2a.pdf (no BoundingBox).

というエラーが出て止まった。

いくつかのサイトには

latex_elements = {
    'classoptions': ',dvipdfmx',
}

を追加すれば良いとあるが、これだけだと

! Package babel Error: You haven't specified a language option.

と出て止まる。今度は

language = 'ja'

とすればよい、というサイトをちらほら見かけたが

こんどは
[code class="latex"]
! Package babel Error: You haven't loaded the language english yet.

と出て止まる。

english がどこに含まれているかを探したら aux ファイルにあったので
english と書いてあるところを japanese に書き換えてみた。

その後、いろいろ探し回って最終的に

latex_elements = {
    'pointsize': '10pt',
    'papersize': 'a4paper',
    'transition': '',
    'extraclassoptions': ',openany,oneside',
    'classoptions': ',dvipdfmx',
    'babel': '\\usepackage[japanese]{babel}',
    }
 
latex_docclass = {'manual': 'jreport'}

としたら図が取り込まれて PDF 生成までたどりつけた。(先の english を japanese に書き換える処理も必須かもしれない)

参考サイト: https://gist.github.com/shirou/9778468

redmine 2.5.0 から 2.5.1

$ cd /var/lib/redmine/apps/redmine-2.5
$ svn up
U    test/unit/helpers/application_helper_test.rb
U    test/functional/account_controller_test.rb
U    test/functional/watchers_controller_test.rb
U    test/functional/timelog_controller_test.rb
U    app/helpers/admin_helper.rb
U    app/helpers/projects_helper.rb
U    app/helpers/application_helper.rb
U    app/models/time_entry.rb
U    app/models/mailer.rb
U    app/models/custom_field.rb
U    app/controllers/watchers_controller.rb
U    app/controllers/journals_controller.rb
U    app/controllers/application_controller.rb
U    app/controllers/messages_controller.rb
U    app/views/admin/plugins.html.erb
U    app/views/projects/index.html.erb
U    app/views/issues/_form.html.erb
U    app/views/queries/_columns.html.erb
U    doc/CHANGELOG
U    config/configuration.yml.example
U    config/locales/lt.yml
U    config/locales/sr-YU.yml
U    config/locales/ro.yml
U    config/locales/lv.yml
U    config/locales/zh.yml
U    config/locales/ca.yml
U    config/locales/pt.yml
U    config/locales/pt-BR.yml
U    config/locales/tr.yml
U    config/locales/ru.yml
U    config/locales/en-GB.yml
U    config/locales/id.yml
U    config/locales/el.yml
U    config/locales/gl.yml
U    config/locales/ar.yml
U    config/locales/en.yml
U    config/locales/cs.yml
U    config/locales/es.yml
U    config/locales/mk.yml
U    config/locales/et.yml
U    config/locales/zh-TW.yml
U    config/locales/eu.yml
U    config/locales/ko.yml
U    config/locales/az.yml
U    config/locales/mn.yml
U    config/locales/it.yml
U    config/locales/sk.yml
U    config/locales/sl.yml
U    config/locales/uk.yml
U    config/locales/sq.yml
U    config/locales/sr.yml
U    config/locales/da.yml
U    config/locales/fa.yml
U    config/locales/bg.yml
U    config/locales/de.yml
U    config/locales/sv.yml
U    config/locales/ja.yml
U    config/locales/he.yml
U    config/locales/fi.yml
U    config/locales/bs.yml
U    config/locales/fr.yml
U    config/locales/nl.yml
U    config/locales/hr.yml
U    config/locales/pl.yml
U    config/locales/th.yml
U    config/locales/no.yml
U    config/locales/hu.yml
U    config/locales/vi.yml
U    lib/redmine/version.rb
U    Gemfile
U    public/javascripts/select_list_move.js
U    public/stylesheets/application.css
 U   .
リビジョン 13087 に更新しました。
$ su
パスワード:
# rake generate_secret_token
# RAILS_ENV=production rake db:migrate
# rake tmp:cache:clear
# rake tmp:sessions:clear
# /etc/rc.d/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

redmine 2.3 から 2.5 へ

Markdown が試験的にサポートされたらしいので入れ替えてみる

$ cd /var/lib/redmine/apps
$ svn co http://svn.redmine.org/redmine/branches/2.5-stable redmine-2.5
$ cp redmine-2.3/config/database.yml ./redmine-2.5/config/
$ cp redmine-2.3/config/configuration.yml redmine-2.5/config/
$ cp -rp redmine-2.3/files/* ./redmine-2.5/files/
$ cp -rp redmine-2.3/plugins/redmine_*/ redmine-2.3/plugins/sidebar_hide/ ./redmine-2.5/plugins/
$ cp -rp redmine-2.3/public/themes/gitmike/ ./redmine-2.5/public/themes/
$ su
# cd redmine-2.5
# bundle install --without development test postgresql sqlite
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing rake (10.1.1) 
Installing i18n (0.6.9) 
Installing multi_json (1.9.0) 
Installing activesupport (3.2.17) 
Using builder (3.0.0) 
Installing activemodel (3.2.17) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.3) 
Using tilt (1.4.1) 
Using sprockets (2.2.2) 
Installing actionpack (3.2.17) 
Installing mime-types (1.25.1) 
Installing polyglot (0.3.4) 
Using treetop (1.4.15) 
Using mail (2.5.4) 
Installing actionmailer (3.2.17) 
Installing arel (3.0.3) 
Installing tzinfo (0.3.39) 
Installing activerecord (3.2.17) 
Installing activeresource (3.2.17) 
Installing awesome_nested_set (2.1.6) 
Using bundler (1.2.3) 
Installing coderay (1.1.0) 
Using rack-ssl (1.3.3) 
Installing json (1.8.1) with native extensions 
Using rdoc (3.12.2) 
Using thor (0.18.1) 
Installing railties (3.2.17) 
Using jquery-rails (2.0.3) 
Using mysql (2.8.1) 
Installing mysql2 (0.3.15) with native extensions 
Using net-ldap (0.3.1) 
Installing ruby-openid (2.3.0) 
Installing rack-openid (1.4.2) 
Installing rails (3.2.17) 
Installing redcarpet (2.3.0) with native extensions 
Using rmagick (2.13.2) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
# rake generate_secret_token
Could not find gem 'simplecov-rcov (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
# rake generate_secret_token
# RAILS_ENV=production rake db:migrate
==  CreateQueriesRoles: migrating =============================================
-- create_table(:queries_roles, {:id=>false})
   -> 0.2759s
-- add_index(:queries_roles, [:query_id, :role_id], {:unique=>true, :name=>:queries_roles_ids})
   -> 0.0690s
==  CreateQueriesRoles: migrated (0.3455s) ====================================

==  AddQueriesVisibility: migrating ===========================================
-- add_column(:queries, :visibility, :integer, {:default=>0})
   -> 0.0818s
-- remove_column(:queries, :is_public)
   -> 0.0720s
==  AddQueriesVisibility: migrated (0.2916s) ==================================

==  CreateCustomFieldsRoles: migrating ========================================
-- create_table(:custom_fields_roles, {:id=>false})
   -> 0.0148s
-- add_index(:custom_fields_roles, [:custom_field_id, :role_id], {:unique=>true, :name=>:custom_fields_roles_ids})
   -> 0.0680s
==  CreateCustomFieldsRoles: migrated (0.0910s) ===============================

==  AddQueriesOptions: migrating ==============================================
-- add_column(:queries, :options, :text)
   -> 0.0471s
==  AddQueriesOptions: migrated (0.0474s) =====================================

==  AddUsersMustChangePasswd: migrating =======================================
-- add_column(:users, :must_change_passwd, :boolean, {:default=>false, :null=>false})
   -> 0.0691s
==  AddUsersMustChangePasswd: migrated (0.0693s) ==============================

==  RemoveEolsFromAttachmentsFilename: migrating ==============================
==  RemoveEolsFromAttachmentsFilename: migrated (0.0206s) =====================

==  SupportForMultipleCommitKeywords: migrating ===============================
==  SupportForMultipleCommitKeywords: migrated (0.2848s) ======================

==  AddRepositoriesCreatedOn: migrating =======================================
-- add_column(:repositories, :created_on, :timestamp)
   -> 0.0785s
==  AddRepositoriesCreatedOn: migrated (0.0787s) ==============================

==  AddCustomFieldsFormatStore: migrating =====================================
-- add_column(:custom_fields, :format_store, :text)
   -> 0.0507s
==  AddCustomFieldsFormatStore: migrated (0.0509s) ============================

==  AddCustomFieldsDescription: migrating =====================================
-- add_column(:custom_fields, :description, :text)
   -> 0.0631s
==  AddCustomFieldsDescription: migrated (0.0634s) ============================

==  RemoveCustomFieldsMinMaxLengthDefaultValues: migrating ====================
-- change_column(:custom_fields, :min_length, :int, {:default=>nil, :null=>true})
   -> 0.0686s
-- change_column(:custom_fields, :max_length, :int, {:default=>nil, :null=>true})
   -> 0.0586s
==  RemoveCustomFieldsMinMaxLengthDefaultValues: migrated (0.1340s) ===========

==  StoreRelationTypeInJournalDetails: migrating ==============================
==  StoreRelationTypeInJournalDetails: migrated (0.3738s) =====================

==  DeleteOrphanTimeEntriesCustomValues: migrating ============================
==  DeleteOrphanTimeEntriesCustomValues: migrated (0.0494s) ===================

==  ChangeChangesetsCommentsLimit: migrating ==================================
-- change_column(:changesets, :comments, :text, {:limit=>16777216})
   -> 1.9250s
==  ChangeChangesetsCommentsLimit: migrated (1.9253s) =========================
# rake tmp:cache:clear
# rake tmp:sessions:clear

あとは Apache 側

# cd /var/www/html
# ln -s /var/lib/redmine/apps/redmine-2.5/public redmine
# /etc/rc.d/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

動作確認はできたが、Markdown は全般の設定でしかできないようなので、Markdown の採用は見送り。

sidebar_hide プラグイン

http://www.redmine.org/plugins/sidebar_hide
https://github.com/bdemirkir/sidebar_hide

上記リポジトリから

$ cd /path/to
$ git clone https://github.com/bdemirkir/sidebar_hide

して redmine サイトにアクセスしたら Rails のエラー画面がでた。
諸々ディレクトリが無い事と、パーミッションが開いてないことが原因のようだったので以下のようにしたら動いた。

# mkdir -p /path/to/public/plugin_assets/sidebar_hide/images
# chmod 777 /path/to/public/plugin_assets/sidebar_hide/images
# mkdir -p /path/to/public/plugin_assets/sidebar_hide/stylesheets
# chmod 777 /path/to/public/plugin_assets/sidebar_hide/stylesheets
# mkdir -p /path/to/public/plugin_assets/sidebar_hide/javascripts
# chmod 777 /path/to/public/plugin_assets/sidebar_hide/javascripts

logwatch のメールが届かないとき

なにげに気になっていた

/etc/cron.daily のなかのスクリプトを手動実行してみる。

# perl ./0logwatch 
Can't exec "sendmail": No such file or directory at ./0logwatch line 1018,  line 2.
Can't execute sendmail -t: No such file or directory

sendmail が実行できないよ、的なメッセージがでていた。

# vi /usr/share/logwatch/default.conf/logwatch.conf

mailer = "sendmail -t"

mailer = "/usr/sbin/sendmail -t"

に変更。

そもそも無い場合は

# yum -y install logwatch

screen の縦分割

screen でも縦分割が欲しいと思い始めた今日この頃

$ sudo brew install --HEAD -f screen
Password:
Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

あれ??? “You can use brew with sudo” ってあるけど、 sudo 使ってるし。
というここで root で

# brew install --HEAD -f screen
Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

同じ結果になった。

他の記事でリポジトリの追加が必要、みたいなことがあったのでコピペで追加

$ brew tap homebrew/dupes
Cloning into '/usr/local/Library/Taps/homebrew-dupes'...
remote: Reusing existing pack: 1101, done.
remote: Total 1101 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1101/1101), 216.26 KiB | 191.00 KiB/s, done.
Resolving deltas: 100% (566/566), done.
Checking connectivity... done
Tapped 39 formula

再度やってみると

$ sudo brew install --HEAD -f screen
Password:
Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

おかしい。リポジトリを追加する記述があったサイトのコマンドをコピペしてみたら

$ brew install -f --HEAD --use-llvm screen
==> Cloning git://git.savannah.gnu.org/screen.git
Cloning into '/Library/Caches/Homebrew/screen--git'...
remote: Counting objects: 142, done.
remote: Compressing objects: 100% (133/133), done.
remote: Total 142 (delta 8), reused 107 (delta 4)
Receiving objects: 100% (142/142), 803.33 KiB | 205.00 KiB/s, done.
Resolving deltas: 100% (8/8), done.
Checking connectivity... done
==> Checking out branch master
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file src/acconfig.h
==> autoconf
==> autoheader
==> ./configure --prefix=/usr/local/Cellar/screen/HEAD --mandir=/usr/local/Cellar/screen/HEAD/share/man --infodir=/usr/local/Cellar/screen/HEAD/share/info --enable-colors256
==> make
==> make install
 /usr/local/Cellar/screen/HEAD: 25 files, 920K, built in 102 seconds

あれ・・・・sudo してないけどできちゃった。

-f と –HEAD の指定順序が問題だったのかな。

$ screen

無事に動いた。

pgpool II 3.3.2 にバージョンアップ

pgpool II 3.3.1 で segfault になっていた件で、3.3.2 で修正されていると期待。

クエリキャッシュ周りで修正があったようだ。
http://www.pgpool.net/docs/pgpool-II-3.3.2/doc/pgpool-ja.html#release3.3.2

$ wget http://www.pgpool.net/download.php?f=pgpool-II-3.3.2.tar.gz
$ tar xzvf pgpool-II-3.3.2.tar.gz
$ cd pgpool-II-3.3.2
$ cp ../pgpool-II-3.3.1/do-config.sh .
$ cat ./do-config.sh
#!/bin/sh
./configure --prefix=/usr/local/pgpool --with-pgsql=/usr/local/pgsql-9.3 --with-memcached=/usr
$ sh ./do-config.sh
$ make
$ make install
$ su
# /etc/rc.d/init.d/pgpool stop
# /etc/rc.d/init.d/pgpool start

これで様子見。

外部から MacBook Pro 上の vmware サーバにアクセスしたい

macbook pro の外部から macbook pro 上の vm の web にアクセスしたい

$ sudo vi /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf

で incomingtcp に

8888 = 192.168.163.11:80

のように設定を追記して、 Vmware を再起動すればよいらしい

$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start

が、上手くいかない。Nexus7 からアクセスして VMware の VM 上で netstat すると

# netstat -atn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 192.168.163.15:80           192.168.11.2:53169          SYN_RECV  

みたいな感じで ESTABLISH とかにならず SYN_RECV のまま変わらない。なんでかなぁ。

と、いったところでセキュリティ対策ソフトのパーソナルファイヤウォールが原因では?と気づいた。
ファイヤウォールの許可の設定をついかしたらできた。

pgpool II 3.3.1 でも segmentation fault

オンメモリクエリキャッシュを使いたいというのが去年のこと

http://lets.postgresql.jp/documents/technical/pgpool-II_3.2/on_memory_query_cache

あたりをみて pgpool II 3.2.0 をインストールした。
PostgreSQL 9.1.2 との組み合わせのテスト環境が残っていたので久しぶりにさわってみたら

SQLSTATE[HY000]: General error: 7 no connection to the server

なんていうエラーが出て止まった。

これなんだろう?と検索すると「PDO」が関係あるみたい。
/var/log/pgpool.log を見てみると

ERROR: pid 23162: Child process 23791 was terminated by segmentation fault

となっていた。このエラーで Google 先生に聞いてみると

http://www.pgpool.net/docs/pgpool-II-3.3.1/doc/pgpool-ja.html#release3.3.1

こんなものに遭遇した。「オンメモリクエリキャッシュ使用時に子プロセスが sig abort で異常終了するバグを修正しました。」とある。
まさにこれだろう、ということで 3.3.1 にバージョンアップすることに。

http://bmath.org/wordpress/?p=1480

ここでやった pgpool の手順通りインストールした。

が・・・・・PostgreSQL 9.1.2 + pgpool !! 3.3.1 + memcached 1.4.4 の組み合わせで同じエラーとなって時々止まる。

治っていないのでは????

PostgteSQL 9.3.1 と pg_bigm をインストール

6万件程度なのに検索が遅い、と思っていろいろ調べていたら

select count(*) from hoge;

みたいなクエリが重いみたいだった(1.2秒くらいかかってた)。

http://wiki.postgresql.org/wiki/Slow_Counting/ja をみたら

以下の記事は9.2より前のPostgreSQLバージョンにのみ適用されることに注意してください。今はインデックスオンリースキャンが実装されています。
以下の例のようなテーブル内の全行数を数えることは、PostgreSQLの性能が遅いことが分かっている操作の1つです。

という記述があった。

これは入れなければ!と 9.2.x をさがしにいったら 9.3.1 が出ていた。
使い方は知らないがマテリアルビューとかいうのが目玉らしい?

以前が http://bmath.org/wordpress/?p=1585 なので、1年ぶりくらいらしい。

0.下準備

root でインストール先を用意しておく

# mkdir /usr/local/pgsql-9.3
# chown -R postgres.postgres /usr/local/pgsql-9.3

postgres ユーザ、グループは作成済みとして前記事の 4 番からの作業をする。

1.まずはダウンロードと展開

$ su - postgres
$ cd /usr/local/pgsql/src
$ wget http://ftp.postgresql.org/pub/source/v9.3.1/postgresql-9.3.1.tar.bz2
$ tar xjvf postgresql-9.3.1.tar.bz2

2.コンパイルとインストール

$ cd postgresql-9.3.1
$ ./configure --prefix=/usr/local/pgsql-9.3 --with-pgport=65432
$ make
$ make install

3.データベース初期化

$ cd /usr/local/pgsql-9.3
$ ./bin/initdb -D /usr/local/pgsql-9.3/data --encoding=UTF8 --no-locale
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /usr/local/pgsql-9.3/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql-9.3/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    ./bin/postgres -D /usr/local/pgsql-9.3/data
or
    ./bin/pg_ctl -D /usr/local/pgsql-9.3/data -l logfile start

4.pg_bigm のインストール

まずソースを取得

$ cd /usr/local/pgsql-9.3/src/
$ git clone https://github.com/Masahiko-Sawada/pg_bigm-masahiko.git
Initialized empty Git repository in /usr/local/pgsql-9.3/src/pg_bigm-masahiko/.git/
remote: Counting objects: 56, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 56 (delta 27), reused 56 (delta 27)
Unpacking objects: 100% (56/56), done.

コンパイルしてインストール。github から取得したものには .o もあったので最初に make clean する。

$ mv pg_bigm-masahiko/ postgresql-9.3.1/contrib/
$ cd postgresql-9.3.1/contrib/
$ make clean
rm -f pg_bigm.so   libpg_bigm.a  libpg_bigm.pc
rm -f bigm_op.o bigm_gin.o
rm -rf results/ regression.diffs regression.out tmp_check/ log/
$ make USE_PGXS=1 PG_CONFIG=/usr/local/pgsql-9.3/bin/pg_config 
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I. -I. -I/usr/local/pgsql-9.3/include/server -I/usr/local/pgsql-9.3/include/internal -D_GNU_SOURCE   -c -o bigm_op.o bigm_op.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I. -I. -I/usr/local/pgsql-9.3/include/server -I/usr/local/pgsql-9.3/include/internal -D_GNU_SOURCE   -c -o bigm_gin.o bigm_gin.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -shared -o pg_bigm.so bigm_op.o bigm_gin.o -L/usr/local/pgsql-9.3/lib -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql-9.3/lib',--enable-new-dtags
$ make USE_PGXS=1 PG_CONFIG=/usr/local/pgsql-9.3/bin/pg_config install
/bin/mkdir -p '/usr/local/pgsql-9.3/lib'
/bin/mkdir -p '/usr/local/pgsql-9.3/share/extension'
/bin/mkdir -p '/usr/local/pgsql-9.3/share/extension'
/usr/bin/install -c -m 755  pg_bigm.so '/usr/local/pgsql-9.3/lib/pg_bigm.so'
/usr/bin/install -c -m 644 ./pg_bigm.control '/usr/local/pgsql-9.3/share/extension/'
/usr/bin/install -c -m 644 ./pg_bigm--1.0.sql  '/usr/local/pgsql-9.3/share/extension/'

5.pg_bigmの設定

/usr/local/pgsql-9.3/data/postgresql.conf の最後に以下を追記する

shared_preload_libraries = 'pg_bigm'

9.2 以降のバージョンでは

custom_variable_classes = 'pg_bigm'

の追記は不要らしい。

6.PostgreSQL を起動する

$ cd /usr/local/pgsql-9.3
$ ./bin/pg_ctl -D /usr/local/pgsql-9.3/data -l logfile start
bash-4.1$ ./bin/pg_ctl -D /usr/local/pgsql-9.3/data -l logfile start
server starting

7.起動の確認

$ ps ax | grep post
 3048 pts/0    S      0:00 /usr/local/pgsql-9.3/bin/postgres -D /usr/local/pgsql-9.3/data
 3056 ?        Ss     0:00 postgres: checkpointer process                                
 3057 ?        Ss     0:00 postgres: writer process                                      
 3058 ?        Ss     0:00 postgres: wal writer process                                  
 3059 ?        Ss     0:00 postgres: autovacuum launcher process                         
 3060 ?        Ss     0:00 postgres: stats collector process                             
 3062 pts/0    S+     0:00 grep post
21858 pts/0    S      0:00 su postgres
24120 ?        S      2:17 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
24125 ?        Ss     0:02 postgres: logger process                              
24129 ?        Ss    21:39 postgres: writer process                              
24130 ?        Ss     6:55 postgres: wal writer process                          
24131 ?        Ss     6:55 postgres: autovacuum launcher process                 
24132 ?        Ss    19:31 postgres: stats collector process                     
24816 ?        Ss    10:00 /usr/libexec/postfix/master

下側が現行の PostgreSQL 9.1.2。

8.接続確認

$ ./bin/psql 
psql (9.3.1, server 9.1.2)
Type "help" for help.

postgres=# \q

ポート指定しないとデフォルトの 5432 でつなぎに行くらしい。

$ ./bin/psql -p 65432
psql (9.3.1)
Type "help" for help.

postgres=# \q

ポートを指定したら 9.3.1 のほうを見に行った。

9.データベース作成

$ ./bin/createdb -p 65432 -U admin -E UTF-8 db_development
createdb: could not connect to database template1: FATAL:  role "admin" does not exist

先にユーザを作っておかないとダメらしい。admin をユーパーユーザで作成。

$ ./bin/createuser -p 65432 --createdb --superuser --password admin
Password:

再度 DB 作成

$ ./bin/createdb -p 65432 -U admin -E UTF-8 db_development

ここで、 createdb, createuser ともに “-p 65432” が無いと既存の DB 側にアクセスしようとするので注意すること。

10.pg_bigm のインストール

$ ./bin/psql -p 65432 -U admin db_development
psql (9.3.1)
Type "help" for help.

db_development=# CREATE EXTENSION pg_bigm;
CREATE EXTENSION
db_development=# \dx pg_bigm
                    List of installed extensions
  Name   | Version | Schema |              Description              
---------+---------+--------+---------------------------------------
 pg_bigm | 1.0     | public | text index searching based on bigrams
(1 row)

11.現行データベースのスキーマのみダンプ

-s オプションをつけるとスキーマのみのダンプとなる

/usr/local/pgsql/bin/pg_dump -s -U prod_user -p 5432 db_production > db_production-9.1.2.sql

12.スキーマをインポート

出力したダンプファイルを開いて

  • trgm を bigm に変更
  • prod_user (現DB の db_productionのユーザ)を admin (新DBの db_development のユーザ)に変更
$ ./bin/psql -p65432 -U admin -W db_development < db_production-9.1.2.sql
[/code]

13.データのみをダンプ

-a オプションをつけるとデータのみのダンプとなる

[code]
$ /usr/local/pgsql/bin/pg_dump  -U prod_user -p 5432 -a  db_production > db_production-data-9.1.2.sql

14.データをインポート


$ ./bin/psql -p65432 -U admin -W db_development < db_production-data-9.1.2.sql [/code]

sphinx をバージョンアップしてみた

Twitter で 1.2b3 が出たよ、的な事が流れていたのでやってみた。
やり方分からなかったけど、出来たのでメモ。

どうやら Python モジュールは

easy_install モジュール名

だけでなく

easy_install モジュール配布URL

でもいいらしい。どこかで見かけたのでやってみた。
https://pypi.python.org/pypi/Sphinx/1.2b3#downloads の egg の方のリンクURL をコピペ。

macbookpro15:~ aotake$ sudo easy_install https://pypi.python.org/packages/2.7/S/Sphinx/Sphinx-1.2b3-py2.7.egg#md5=6b1ba0dddfb9cd0fabc09e6e4730f30a
Password:
Downloading https://pypi.python.org/packages/2.7/S/Sphinx/Sphinx-1.2b3-py2.7.egg#md5=6b1ba0dddfb9cd0fabc09e6e4730f30a
Processing Sphinx-1.2b3-py2.7.egg
creating /Library/Python/2.7/site-packages/Sphinx-1.2b3-py2.7.egg
Extracting Sphinx-1.2b3-py2.7.egg to /Library/Python/2.7/site-packages
Removing Sphinx 1.2b2 from easy-install.pth file
Adding Sphinx 1.2b3 to easy-install.pth file
Installing sphinx-apidoc script to /usr/local/bin
Installing sphinx-build script to /usr/local/bin
Installing sphinx-quickstart script to /usr/local/bin
Installing sphinx-autogen script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/Sphinx-1.2b3-py2.7.egg
Processing dependencies for Sphinx==1.2b3
Finished processing dependencies for Sphinx==1.2b3

1.2b2 が削除されている。

macbookpro15:~ aotake$ sphinx-quickstart 
Welcome to the Sphinx 1.2b3 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Enter the root path for documentation.
> Root path for the documentation [.]: ^C
[Interrupted.]

結構簡単にできた。

sphinx の blockdiag も入れてみた

$ sudo easy_install sphinxcontrib-blockdiag
Password:
Searching for sphinxcontrib-blockdiag
Reading http://pypi.python.org/simple/sphinxcontrib-blockdiag/
Best match: sphinxcontrib-blockdiag 1.2.0
Downloading https://pypi.python.org/packages/source/s/sphinxcontrib-blockdiag/sphinxcontrib-blockdiag-1.2.0.tar.gz#md5=956689f558c37d341f0457ae830d4503
Processing sphinxcontrib-blockdiag-1.2.0.tar.gz
Running sphinxcontrib-blockdiag-1.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-xfQitM/sphinxcontrib-blockdiag-1.2.0/egg-dist-tmp-LksymY
warning: no files found matching 'CHANGES.*'
Adding sphinxcontrib-blockdiag 1.2.0 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/sphinxcontrib_blockdiag-1.2.0-py2.7.egg
Processing dependencies for sphinxcontrib-blockdiag
Searching for blockdiag>=1.2.0
Reading http://pypi.python.org/simple/blockdiag/
Best match: blockdiag 1.2.4
Downloading https://pypi.python.org/packages/source/b/blockdiag/blockdiag-1.2.4.tar.gz#md5=244334f60cc10b0cb73b5df5279bcdd1
Processing blockdiag-1.2.4.tar.gz
Running blockdiag-1.2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-4OEFQK/blockdiag-1.2.4/egg-dist-tmp-PPwhbe
zip_safe flag not set; analyzing archive contents...
blockdiag.tests.test_builder_separate: module references __file__
blockdiag.tests.test_generate_diagram: module references __file__
blockdiag.tests.test_pep8: module references __file__
blockdiag.tests.test_rst_directives: module references __file__
blockdiag.tests.test_utils_fontmap: module references __file__
blockdiag.tests.utils: module references __file__
Adding blockdiag 1.2.4 to easy-install.pth file
Installing blockdiag script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/blockdiag-1.2.4-py2.7.egg
Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://effbot.org/downloads/#Imaging
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://www.pythonware.com/products/pil
Best match: PIL 1.1.7
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7kkWeJ/PIL-1.1.7/egg-dist-tmp-YlSrM0
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
--- using frameworks at /System/Library/Frameworks
clang: warning: argument unused during compilation: '-mno-fused-madd'
_imaging.c:3017:5: warning: incompatible pointer types initializing 'lenfunc' (aka 'Py_ssize_t (*)(PyObject *)') with an expression of type 'inquiry' (aka 'int (*)(PyObject *)') [-Wincompatible-pointer-types]
    (inquiry) image_length, /*sq_length*/
    ^~~~~~~~~~~~~~~~~~~~~~
_imaging.c:3077:5: warning: incompatible pointer types initializing 'lenfunc' (aka 'Py_ssize_t (*)(PyObject *)') with an expression of type 'inquiry' (aka 'int (*)(PyObject *)') [-Wincompatible-pointer-types]
    (inquiry) NULL, /*mp_length*/
    ^~~~~~~~~~~~~~
2 warnings generated.
_imaging.c:379:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    n = PyObject_Length(arg);
      ~ ^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
#define PyObject_Length PyObject_Size
                        ^
_imaging.c:394:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int temp = PyInt_AsLong(op);
                    ~~~~   ^~~~~~~~~~~~~~~~
_imaging.c:400:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int temp = PyInt_AsLong(op);
                    ~~~~   ^~~~~~~~~~~~~~~~
_imaging.c:410:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int temp = PyInt_AsLong(op);
                    ~~~~   ^~~~~~~~~~~~~~~~
_imaging.c:416:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int temp = PyInt_AsLong(op);
                    ~~~~   ^~~~~~~~~~~~~~~~
_imaging.c:523:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            r = PyInt_AsLong(color);
              ~ ^~~~~~~~~~~~~~~~~~~
_imaging.c:531:21: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                r = PyInt_AS_LONG(color);
                  ~ ^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/intobject.h:51:51: note: expanded from macro 'PyInt_AS_LONG'
#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
_imaging.c:555:13: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        r = PyInt_AsLong(color);
          ~ ^~~~~~~~~~~~~~~~~~~
_imaging.c:569:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            r = PyInt_AsLong(color);
              ~ ^~~~~~~~~~~~~~~~~~~
_imaging.c:923:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        *x = PyInt_AS_LONG(value);
           ~ ^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/intobject.h:51:51: note: expanded from macro 'PyInt_AS_LONG'
#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
_imaging.c:931:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        *y = PyInt_AS_LONG(value);
           ~ ^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/intobject.h:51:51: note: expanded from macro 'PyInt_AS_LONG'
#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
                           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
_imaging.c:1221:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    n = PyObject_Length(data);
      ~ ^~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
#define PyObject_Length PyObject_Size
                        ^
_imaging.c:3009:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        y = i / im->xsize;
          ~ ~~^~~~~~~~~~~
_imaging.c:3017:5: warning: incompatible pointer types initializing 'lenfunc' (aka 'Py_ssize_t (*)(PyObject *)') with an expression of type 'inquiry' (aka 'int (*)(PyObject *)') [-Wincompatible-pointer-types]
    (inquiry) image_length, /*sq_length*/
    ^~~~~~~~~~~~~~~~~~~~~~
_imaging.c:3077:5: warning: incompatible pointer types initializing 'lenfunc' (aka 'Py_ssize_t (*)(PyObject *)') with an expression of type 'inquiry' (aka 'int (*)(PyObject *)') [-Wincompatible-pointer-types]
    (inquiry) NULL, /*mp_length*/
    ^~~~~~~~~~~~~~
15 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
path.c:85:33: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        double* p = alloc_array(count);
                    ~~~~~~~~~~~ ^~~~~
path.c:124:32: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        xy = alloc_array(path->count);
             ~~~~~~~~~~~ ~~~~~~^~~~~
path.c:129:15: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        return path->count;
        ~~~~~~ ~~~~~~^~~~~
path.c:152:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    n = PyObject_Length(data);
      ~ ^~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
#define PyObject_Length PyObject_Size
                        ^
path.c:257:26: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        xy = alloc_array(count);
             ~~~~~~~~~~~ ^~~~~
path.c:306:21: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    i = self->count - j;
      ~ ~~~~~~~~~~~~^~~
6 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/BitDecode.c:137:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/EpsEncode.c:78:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/GifDecode.c:146:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        return ptr - buffer;
                        ~~~~~~ ~~~~^~~~~~~~
libImaging/GifDecode.c:149:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        return ptr - buffer;
                        ~~~~~~ ~~~~^~~~~~~~
libImaging/GifDecode.c:296:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buffer;
    ~~~~~~ ~~~~^~~~~~~~
3 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/GifEncode.c:290:36: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        return ptr - buf;
                        ~~~~~~ ~~~~^~~~~
libImaging/GifEncode.c:313:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/HexDecode.c:34:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/LzwDecode.c:92:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                    return ptr - buf;;
                    ~~~~~~ ~~~~^~~~~
libImaging/LzwDecode.c:229:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/MspDecode.c:31:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
libImaging/MspDecode.c:90:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/PackDecode.c:32:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
libImaging/PackDecode.c:44:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
libImaging/PackDecode.c:62:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
3 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/Quant.c:1225:36: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
      hl[i]=mergesort_pixels(hl[i],i);
            ~~~~~~~~~~~~~~~~       ^
libImaging/Quant.c:1240:31: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
   root=median_cut(hl,nPixels,nQuantPixels);
        ~~~~~~~~~~            ^~~~~~~~~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/PcdDecode.c:42:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/PcxDecode.c:30:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
libImaging/PcxDecode.c:36:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/PcxEncode.c:53:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
libImaging/PcxEncode.c:84:36: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        return ptr - buf;
                        ~~~~~~ ~~~~^~~~~
libImaging/PcxEncode.c:106:40: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                            return ptr - buf;
                            ~~~~~~ ~~~~^~~~~
libImaging/PcxEncode.c:112:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                return ptr - buf;
                                ~~~~~~ ~~~~^~~~~
libImaging/PcxEncode.c:130:32: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                    return ptr - buf;
                    ~~~~~~ ~~~~^~~~~
libImaging/PcxEncode.c:136:36: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        return ptr - buf;
                        ~~~~~~ ~~~~^~~~~
6 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/RawDecode.c:59:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
libImaging/RawDecode.c:69:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/RawEncode.c:87:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/Storage.c:370:17: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
        bytes = strlen(mode); /* close enough */
              ~ ^~~~~~~~~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/SunRleDecode.c:33:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
libImaging/SunRleDecode.c:111:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/TgaRleDecode.c:48:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
libImaging/TgaRleDecode.c:117:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/XbmDecode.c:49:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return ptr - buf;
                ~~~~~~ ~~~~^~~~~
libImaging/XbmDecode.c:56:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            return ptr - buf;
            ~~~~~~ ~~~~^~~~~
2 warnings generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
libImaging/XbmEncode.c:105:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    return ptr - buf;
    ~~~~~~ ~~~~^~~~~
1 warning generated.
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: -framework Tcl: 'linker' input unused
clang: warning: -framework Tk: 'linker' input unused
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: -framework Tcl: 'linker' input unused
clang: warning: -framework Tk: 'linker' input unused
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      darwin 2.7.2 (default, Oct 11 2012, 20:14:37)
              [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
--------------------------------------------------------------------
--- TKINTER support available
*** JPEG support not available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
zip_safe flag not set; analyzing archive contents...
Image: module references __file__
Adding PIL 1.1.7 to easy-install.pth file
Installing pilconvert.py script to /usr/local/bin
Installing pildriver.py script to /usr/local/bin
Installing pilfile.py script to /usr/local/bin
Installing pilfont.py script to /usr/local/bin
Installing pilprint.py script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.8-intel.egg
Searching for webcolors
Reading http://pypi.python.org/simple/webcolors/
Best match: webcolors 1.4
Downloading https://pypi.python.org/packages/source/w/webcolors/webcolors-1.4.tar.gz#md5=35de9d785b5c04a9cc66a2eae0519254
Processing webcolors-1.4.tar.gz
Running webcolors-1.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-hVH_4e/webcolors-1.4/egg-dist-tmp-5oAxq5
zip_safe flag not set; analyzing archive contents...
Adding webcolors 1.4 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/webcolors-1.4-py2.7.egg
Searching for funcparserlib
Reading http://pypi.python.org/simple/funcparserlib/
Best match: funcparserlib 0.3.6
Downloading https://pypi.python.org/packages/source/f/funcparserlib/funcparserlib-0.3.6.tar.gz#md5=3aba546bdad5d0826596910551ce37c0
Processing funcparserlib-0.3.6.tar.gz
Running funcparserlib-0.3.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-bQBJB_/funcparserlib-0.3.6/egg-dist-tmp-7mXZYV
warning: no files found matching 'requires.txt'
zip_safe flag not set; analyzing archive contents...
Adding funcparserlib 0.3.6 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/funcparserlib-0.3.6-py2.7.egg
Finished processing dependencies for sphinxcontrib-blockdiag

日本語を使わないのならそのままいけそう。
日本語を使う場合は ttf のパスを指定するらしい。
/Library/Fonts/Osaka.ttf を指定したらエラーが出た。

macbookpro15:sphinx aotake$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.2b2
loading pickled environment... not yet created
building [html]: targets for 5 source files that are out of date
updating environment: 5 added, 0 changed, 0 removed
reading sources... [100%] subversion                                                                                                                                                           
looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/aotake/Dropbox/Docs/FL/hanhan/sphinx/blockdiag.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [ 80%] simframe                                                                                                                                                              
Exception occurred:
  File "/Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.8-intel.egg/ImageFont.py", line 34, in __getattr__
    raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed
The full traceback has been saved in /var/folders/3y/vc9v1tsd4fn5cpqj688vvw_h0000gn/T/sphinx-err-KBQVsR.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-users/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
make: *** [html] Error 1

PIL というのがないのかな?

macbookpro15:sphinx aotake$ sudo easy_install PIL
Password:
Searching for PIL
Best match: PIL 1.1.7
Processing PIL-1.1.7-py2.7-macosx-10.8-intel.egg
PIL 1.1.7 is already the active version in easy-install.pth
Installing pilconvert.py script to /usr/local/bin
Installing pildriver.py script to /usr/local/bin
Installing pilfile.py script to /usr/local/bin
Installing pilfont.py script to /usr/local/bin
Installing pilprint.py script to /usr/local/bin

Using /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.8-intel.egg
Processing dependencies for PIL
Finished processing dependencies for PIL

いや、よくよくエラーをよんでみたら「_imagingft」がインストールされてないと書いてる気がする。
全く同じようなエラーに対応した方がいた。
ここ

こちらの記事の通り(というか配布元のサイトの通り?)freetype2.rb を作成し

$ brew install freetype2
$ brew install libjpeg
$ easy_install pip
$ sudo pip uninstall pil
$ sudo pip install pip

としたら make できた。

なお、参照サイトでは brew を sudo で使っていたけど、sudo をつかうと

Cowardly refusing to `sudo brew'

というようなエラーを吐いてインストールできなかった。このときの参考にしたサイトはここここ
結局 sudo をつけずに brew コマンドを使えば動いた。

blockdiag 利用の課題

png が生成されるけど make latexpdfja すると png が読み込めなくてコンパイルが停止する。

sphinx の phpautodoc というのを試してみた。

エラーになっちゃうんだよね

bitbucket から git clone しても tar.gz を落としてからインストール

$ tar xzvf tk.phpautodoc-1.1.1.tar.gz
(途中省略)
$ sudo python ./setup.py  install
running install
running bdist_egg
running egg_info
writing requirements to src/tk.phpautodoc.egg-info/requires.txt
writing src/tk.phpautodoc.egg-info/PKG-INFO
writing top-level names to src/tk.phpautodoc.egg-info/top_level.txt
writing dependency_links to src/tk.phpautodoc.egg-info/dependency_links.txt
reading manifest file 'src/tk.phpautodoc.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.diag' under directory 'src'
writing manifest file 'src/tk.phpautodoc.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.8-intel/egg
running install_lib
running build_py
creating build
creating build/lib
copying src/sphinxcontrib_phpautodoc.py -> build/lib
creating build/lib/phply
copying src/phply/__init__.py -> build/lib/phply
copying src/phply/phpast.py -> build/lib/phply
copying src/phply/phplex.py -> build/lib/phply
copying src/phply/phpparse.py -> build/lib/phply
copying src/phply/pythonast.py -> build/lib/phply
creating build/bdist.macosx-10.8-intel
creating build/bdist.macosx-10.8-intel/egg
creating build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/__init__.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phpast.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phplex.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phpparse.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/pythonast.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/sphinxcontrib_phpautodoc.py -> build/bdist.macosx-10.8-intel/egg
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phpast.py to phpast.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phplex.py to phplex.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phpparse.py to phpparse.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/pythonast.py to pythonast.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/sphinxcontrib_phpautodoc.py to sphinxcontrib_phpautodoc.pyc
creating build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/PKG-INFO -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/SOURCES.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/dependency_links.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/requires.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/top_level.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/tk.phpautodoc-1.1.1-py2.7.egg' and adding 'build/bdist.macosx-10.8-intel/egg' to it
removing 'build/bdist.macosx-10.8-intel/egg' (and everything under it)
Processing tk.phpautodoc-1.1.1-py2.7.egg
Removing /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.1-py2.7.egg
Copying tk.phpautodoc-1.1.1-py2.7.egg to /Library/Python/2.7/site-packages
Removing tk.phpautodoc 1.1.0 from easy-install.pth file
Adding tk.phpautodoc 1.1.1 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.1-py2.7.egg
Processing dependencies for tk.phpautodoc==1.1.1
Searching for sphinxcontrib-phpdomain==0.1.4
Best match: sphinxcontrib-phpdomain 0.1.4
Processing sphinxcontrib_phpdomain-0.1.4-py2.7.egg
sphinxcontrib-phpdomain 0.1.4 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/sphinxcontrib_phpdomain-0.1.4-py2.7.egg
Searching for ply==3.4
Best match: ply 3.4
Processing ply-3.4-py2.7.egg
ply 3.4 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/ply-3.4-py2.7.egg
Searching for Sphinx==1.2b2
Best match: Sphinx 1.2b2
Processing Sphinx-1.2b2-py2.7.egg
Sphinx 1.2b2 is already the active version in easy-install.pth
Installing sphinx-apidoc script to /usr/local/bin
Installing sphinx-build script to /usr/local/bin
Installing sphinx-quickstart script to /usr/local/bin
Installing sphinx-autogen script to /usr/local/bin

Using /Library/Python/2.7/site-packages/Sphinx-1.2b2-py2.7.egg
Searching for Jinja2==2.7.1
Best match: Jinja2 2.7.1
Processing Jinja2-2.7.1-py2.7.egg
Jinja2 2.7.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/Jinja2-2.7.1-py2.7.egg
Searching for docutils==0.11
Best match: docutils 0.11
Processing docutils-0.11-py2.7.egg
docutils 0.11 is already the active version in easy-install.pth
Installing rst2html.py script to /usr/local/bin
Installing rst2latex.py script to /usr/local/bin
Installing rst2man.py script to /usr/local/bin
Installing rst2odt.py script to /usr/local/bin
Installing rst2odt_prepstyles.py script to /usr/local/bin
Installing rst2pseudoxml.py script to /usr/local/bin
Installing rst2s5.py script to /usr/local/bin
Installing rst2xetex.py script to /usr/local/bin
Installing rst2xml.py script to /usr/local/bin
Installing rstpep2html.py script to /usr/local/bin

Using /Library/Python/2.7/site-packages/docutils-0.11-py2.7.egg
Searching for Pygments==1.6
Best match: Pygments 1.6
Processing Pygments-1.6-py2.7.egg
Pygments 1.6 is already the active version in easy-install.pth
Installing pygmentize script to /usr/local/bin

Using /Library/Python/2.7/site-packages/Pygments-1.6-py2.7.egg
Searching for MarkupSafe==0.18
Best match: MarkupSafe 0.18
Processing MarkupSafe-0.18-py2.7-macosx-10.8-intel.egg
MarkupSafe 0.18 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/MarkupSafe-0.18-py2.7-macosx-10.8-intel.egg
Finished processing dependencies for tk.phpautodoc==1.1.1

してもこんなエラーが出て止まる。

$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.2b2
loading pickled environment... not yet created
building [html]: targets for 4 source files that are out of date
updating environment: 4 added, 0 changed, 0 removed
reading sources... [ 50%] phpautodoc                                                                                                      
Exception occurred:
  File "build/bdist.macosx-10.8-intel/egg/phply/phpparse.py", line 1363, in p_error
    raise SyntaxError('invalid syntax', (None, t.lineno, None, t.value))
  File "<string>", line 15
    int
SyntaxError: invalid syntax
The full traceback has been saved in /var/folders/3y/vc9v1tsd4fn5cpqj688vvw_h0000gn/T/sphinx-err-nQ10j2.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-users/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
make: *** [html] Error 1

その後

setup.py にある setup() にある url が

https://bitbucket.org/tk0miya/tk0.phpdoc

となっていたけど、ここに直接アクセスしたら 404 だった。ということでそれっぽい URL を探して

https://bitbucket.org/tk0miya/tk.phpautodoc

と変更して再度インストールしてみた

macbookpro15:tk.phpautodoc aotake$ vi setup.py 
macbookpro15:tk.phpautodoc aotake$ sudo python ./setup.py install
Password:
running install
running bdist_egg
running egg_info
writing requirements to src/tk.phpautodoc.egg-info/requires.txt
writing src/tk.phpautodoc.egg-info/PKG-INFO
writing top-level names to src/tk.phpautodoc.egg-info/top_level.txt
writing dependency_links to src/tk.phpautodoc.egg-info/dependency_links.txt
reading manifest file 'src/tk.phpautodoc.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.diag' under directory 'src'
writing manifest file 'src/tk.phpautodoc.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.8-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.8-intel/egg
creating build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/__init__.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phpast.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phplex.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phpparse.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/pythonast.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/sphinxcontrib_phpautodoc.py -> build/bdist.macosx-10.8-intel/egg
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phpast.py to phpast.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phplex.py to phplex.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phpparse.py to phpparse.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/pythonast.py to pythonast.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/sphinxcontrib_phpautodoc.py to sphinxcontrib_phpautodoc.pyc
creating build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/PKG-INFO -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/SOURCES.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/dependency_links.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/requires.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/top_level.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/tk.phpautodoc-1.1.0-py2.7.egg' and adding 'build/bdist.macosx-10.8-intel/egg' to it
removing 'build/bdist.macosx-10.8-intel/egg' (and everything under it)
Processing tk.phpautodoc-1.1.0-py2.7.egg
Removing /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.0-py2.7.egg
Copying tk.phpautodoc-1.1.0-py2.7.egg to /Library/Python/2.7/site-packages
Removing tk.phpautodoc 1.1.1 from easy-install.pth file
Adding tk.phpautodoc 1.1.0 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.0-py2.7.egg
Processing dependencies for tk.phpautodoc==1.1.0
Traceback (most recent call last):
  File "./setup.py", line 28, in <module>
    'mock'
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/install.py", line 76, in run
    self.do_egg_install()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/install.py", line 104, in do_egg_install
    cmd.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 211, in run
    self.easy_install(spec, not self.no_deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 427, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 478, in install_item
    self.process_distribution(spec, dist, deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 519, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 570, in resolve
    requirements.extend(dist.requires(req.extras)[::-1])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2149, in requires
    dm = self._dep_map
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2141, in _dep_map
    for extra,reqs in split_sections(self._get_metadata(name)):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2560, in split_sections
    for line in yield_lines(s):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1854, in yield_lines
    for ss in strs:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2163, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1181, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1178, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1238, in _get
    return self.loader.get_data(path)
zipimport.ZipImportError: bad local file header in /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.0-py2.7.egg

mock がない?みたいなメッセージがあったので mock というのが必要なのかもしれない。ということで easy_install でインストールしてみる(python よくわかんないから勘違いかも)。

macbookpro15:tk.phpautodoc aotake$ sudo easy_install mock
Password:
Searching for mock
Reading http://pypi.python.org/simple/mock/
Best match: mock 1.0.1
Downloading https://pypi.python.org/packages/source/m/mock/mock-1.0.1.zip#md5=869f08d003c289a97c1a6610faf5e913
Processing mock-1.0.1.zip
Running mock-1.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-kw8V5Y/mock-1.0.1/egg-dist-tmp-jVzHV_
warning: no files found matching '*.png' under directory 'docs'
warning: no files found matching '*.css' under directory 'docs'
warning: no files found matching '*.html' under directory 'docs'
warning: no files found matching '*.js' under directory 'docs'
zip_safe flag not set; analyzing archive contents...
Adding mock 1.0.1 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/mock-1.0.1-py2.7.egg
Processing dependencies for mock
Finished processing dependencies for mock

再度 tk.phpautodoc を入れてみる。

macbookpro15:tk.phpautodoc aotake$ sudo python ./setup.py install
running install
running bdist_egg
running egg_info
writing requirements to src/tk.phpautodoc.egg-info/requires.txt
writing src/tk.phpautodoc.egg-info/PKG-INFO
writing top-level names to src/tk.phpautodoc.egg-info/top_level.txt
writing dependency_links to src/tk.phpautodoc.egg-info/dependency_links.txt
reading manifest file 'src/tk.phpautodoc.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.diag' under directory 'src'
writing manifest file 'src/tk.phpautodoc.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.8-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.8-intel/egg
creating build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/__init__.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phpast.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phplex.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/phpparse.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/phply/pythonast.py -> build/bdist.macosx-10.8-intel/egg/phply
copying build/lib/sphinxcontrib_phpautodoc.py -> build/bdist.macosx-10.8-intel/egg
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phpast.py to phpast.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phplex.py to phplex.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/phpparse.py to phpparse.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/phply/pythonast.py to pythonast.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/sphinxcontrib_phpautodoc.py to sphinxcontrib_phpautodoc.pyc
creating build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/PKG-INFO -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/SOURCES.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/dependency_links.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/requires.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/tk.phpautodoc.egg-info/top_level.txt -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/tk.phpautodoc-1.1.0-py2.7.egg' and adding 'build/bdist.macosx-10.8-intel/egg' to it
removing 'build/bdist.macosx-10.8-intel/egg' (and everything under it)
Processing tk.phpautodoc-1.1.0-py2.7.egg
Removing /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.0-py2.7.egg
Copying tk.phpautodoc-1.1.0-py2.7.egg to /Library/Python/2.7/site-packages
tk.phpautodoc 1.1.0 is already the active version in easy-install.pth

Installed /Library/Python/2.7/site-packages/tk.phpautodoc-1.1.0-py2.7.egg
Processing dependencies for tk.phpautodoc==1.1.0
Searching for sphinxcontrib-phpdomain==0.1.4
Best match: sphinxcontrib-phpdomain 0.1.4
Processing sphinxcontrib_phpdomain-0.1.4-py2.7.egg
sphinxcontrib-phpdomain 0.1.4 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/sphinxcontrib_phpdomain-0.1.4-py2.7.egg
Searching for ply==3.4
Best match: ply 3.4
Processing ply-3.4-py2.7.egg
ply 3.4 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/ply-3.4-py2.7.egg
Searching for Sphinx==1.2b2
Best match: Sphinx 1.2b2
Processing Sphinx-1.2b2-py2.7.egg
Sphinx 1.2b2 is already the active version in easy-install.pth
Installing sphinx-apidoc script to /usr/local/bin
Installing sphinx-build script to /usr/local/bin
Installing sphinx-quickstart script to /usr/local/bin
Installing sphinx-autogen script to /usr/local/bin

Using /Library/Python/2.7/site-packages/Sphinx-1.2b2-py2.7.egg
Searching for Jinja2==2.7.1
Best match: Jinja2 2.7.1
Processing Jinja2-2.7.1-py2.7.egg
Jinja2 2.7.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/Jinja2-2.7.1-py2.7.egg
Searching for docutils==0.11
Best match: docutils 0.11
Processing docutils-0.11-py2.7.egg
docutils 0.11 is already the active version in easy-install.pth
Installing rst2html.py script to /usr/local/bin
Installing rst2latex.py script to /usr/local/bin
Installing rst2man.py script to /usr/local/bin
Installing rst2odt.py script to /usr/local/bin
Installing rst2odt_prepstyles.py script to /usr/local/bin
Installing rst2pseudoxml.py script to /usr/local/bin
Installing rst2s5.py script to /usr/local/bin
Installing rst2xetex.py script to /usr/local/bin
Installing rst2xml.py script to /usr/local/bin
Installing rstpep2html.py script to /usr/local/bin

Using /Library/Python/2.7/site-packages/docutils-0.11-py2.7.egg
Searching for Pygments==1.6
Best match: Pygments 1.6
Processing Pygments-1.6-py2.7.egg
Pygments 1.6 is already the active version in easy-install.pth
Installing pygmentize script to /usr/local/bin

Using /Library/Python/2.7/site-packages/Pygments-1.6-py2.7.egg
Searching for MarkupSafe==0.18
Best match: MarkupSafe 0.18
Processing MarkupSafe-0.18-py2.7-macosx-10.8-intel.egg
MarkupSafe 0.18 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/MarkupSafe-0.18-py2.7-macosx-10.8-intel.egg
Finished processing dependencies for tk.phpautodoc==1.1.0

これでいいのかな???

$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.2b2
loading pickled environment... not yet created
building [html]: targets for 4 source files that are out of date
updating environment: 4 added, 0 changed, 0 removed
reading sources... [ 25%] index                                                                                                                                                                
Exception occurred:
  File "build/bdist.macosx-10.8-intel/egg/phply/phpparse.py", line 1363, in p_error
    raise SyntaxError('invalid syntax', (None, t.lineno, None, t.value))
  File "<string>", line 15
    int
SyntaxError: invalid syntax
The full traceback has been saved in /var/folders/3y/vc9v1tsd4fn5cpqj688vvw_h0000gn/T/sphinx-err-rzUvSP.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-users/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
make: *** [html] Error 1

parseエラーが出ているみたいだけど、ひょっとしたらそもそもの PHP ファイルの方のエラーかも?

$ php -f hello.php 

Parse error: parse error, expecting `T_VARIABLE' in /Users/aotake/path/to/sphinx/hello.php on line 15

PHP のソースはこんな感じ

<?
/**
 * ほげほげする関数。
 */
function hogehoge($fuga) {
   # ...
}

/**
  * ふーふーするクラス。
  */
class Foo {
   /** ばー変数 */
  public int $bar;
}
&#91;/code&#93;

class Foo の "public int $bar" という書き方がだめってことだった。

ということで、このソースを修正したところ make html が通った。
修正した PHP のソース
&#91;code class="php"&#93;
<?php

/**
 * ほげほげする関数。
 */
function hogehoge($fuga) {
   # ...
}

/**
  * ふーふーするクラス。
  */
class Foo
{
   /** ばー変数 */
  var $bar;

  /**
   * コンストラクタ
   */
  public function __construct()
  {
  }

  /**
   * インデックス
   */
  public function index()
  {
  }
}
?>

ということで、php -f で確認して問題が無い事を確認してから make html しないと!

ドキュメント作成について

普段はメモを Redmine の Wiki に記載している。
正式ではないけど文書としての配布が必要となったときに PDF に変換していた。

しかしながら、

  1. 画像が埋め込まれない(どうやら png 形式がだめっぽい?)
  2. 文書が増えて階層化していったらまとめて PDF にできない

などの問題がありどうにかならないものかと思案し始めた。

徘徊していたら

  1. Redcloth というツールが Redmine の wiki に使われているらしい
    ということは、Redcloth を使って何とか出来ないか?
  2. Redmine の Wiki を Sphinx の rst形式に変換するツールを発見
  3. RedmineSphinxPlugin というRedmine 上で Sphinx ドキュメントを作成するプラグインがあるらしい

ということが分かった。

Redcloth

公式サイトはこちら
http://redcloth.org

最初のコメントによると

Textile is a simple text format that can be converted to html, eliminating the need to use html directly to create documents, blogs, or web pages.

貧弱な英訳をすれば「Textile は簡単なテキストフォーマットを HTML に変換するもので、HTML を直書きしなくてよくなるよ」ということのようだ。

PDF には出来ないようだ。
とりあえず、どんなものか試してみる。

手元の MacbookPro ではこれでインストールができた。

$ gem install RedCloth

サンプルテキスト

こんなテキストを text.txt として保存

h1. Give RedCloth a try!

A *simple* paragraph with
a line break, some _emphasis_ and a "link":http://redcloth.org

* an item
* and another

# one
# two

|_. title1 |_. title2 |
| hogehoge | fugafuga |

実行結果

保存したテキストを redcloth で変換してみる

$ redcloth test.txt 
<h1>Give RedCloth a try!</h1>
<p>A <strong>simple</strong> paragraph with<br />
a line break, some <em>emphasis</em> and a <a href="http://redcloth.org">link</a></p>
<ul>
	<li>an item</li>
	<li>and another</li>
</ul>
<ol>
	<li>one</li>
	<li>two</li>
</ol>
<table>
	<tr>
		<th>title1 </th>
		<th>title2 </th>
	</tr>
	<tr>
		<td> hogehoge </td>
		<td> fugafuga </td>
	</tr>
</table>

結構きれいな HTML が吐かれている気がする。が・・・・PDF じゃないので配布が出来ない。
その後も “redcloth pdf” でいろいろ試してみたけどそれっぽいものが見つからない。
redmine は redcloth から pdf を出力していないのかも。

【備考】
その後ソースをみて tcpdf を使っているらしいことを発見。textile の wiki テキストからどのように tcpdf に当て込んでいるのかは未確認。なんとなく Ruby なので(得意言語ではないので)読みたくない。

pandoc

pandoc は Textile を Shpinx のドキュメント形式に変換できるツール。
pandoc で Redmine の Wiki を Sphinx に変換しよう」を参考に。

こちらのインストールページからMac用のイメージをダウンロードしてインストールした。
http://johnmacfarlane.net/pandoc/installing.html

動作確認

先ほどの test.txt を rst に変換してみる

$ pandoc -f textile -t rst test.txt 
Give RedCloth a try!
====================

| A **simple** paragraph with
| a line break, some *emphasis* and a `link <http://redcloth.org>`__

-  an item
-  and another

#. one
#. two

+------------+------------+
| title1     | title2     |
+============+============+
| hogehoge   | fugafuga   |
+------------+------------+

これは便利!
さらに調べていたら pandoc の出力形式に docx があった。
こちらについては http://d.hatena.ne.jp/torazuka/20121015/pandoc を参考にした。

$ pandoc -f textile -t docx -o test.docx test.txt

出力結果はこんな感じ。悪くはない。Word はあまり詳しくないのだが、これだけ出来ていれば上等なほうかな。
pandoc_textile2docx

RedmineSphinxPlugin

Wikiの代わりに Sphinx が使えるって事だろうか?という期待を込めてやってみたのだが、Redmine 2.3 のプラグイン管理画面に表示されなかった。

インストールは「Redmine Sphinx Pluginの概要」を参照。

やったことを羅列すると
1. Settingslogicをインストール

$ gem install settingslogic

2. プラグインをインストール

# cd /var/lib/redmine/apps/redmine-2.3/plugins/
# git clone git://github.com/nishio-dens/RedmineSphinxPlugin.git
# mv RedmineSphinxPlugin/ redmine_sphinx
# cp redmine_sphinx/sample/sphinx_plugin_setting.yml.sample ../config/sphinx_plugin_setting.yml

3. 設定ファイル編集(内容は下記参照)

# vi ../config/sphinx_plugin_setting.yml 

4. 公開用ディレクトリ作成

# mkdir /home/web/htdocs/redminedoc
# chown aotake.aotake /home/web/htdocs/redminedoc/

sphinx_plugin_setting.yml はこんな感じに


# sphinx plugin setting

defaults: &defaults

server:
#Public Root Directory
document_root_path: /var/www/html ←自分のサーバのドキュメントルート
#Directory name to put your sphinx document
sphinx_dir: redminedoc ←ここはドキュメントを公開する適当なディレクトリ名に
#http server port
server_port: 80

sphinx:
sphinx_makefile_head: ‘# Makefile for Sphinx documentation’
build_dir_variable_name: ‘BUILDDIR’
sphinx_index_page: index.html

development:
<<: *defaults test: <<: *defaults production: <<: *defaults [/code] 5. Sphinx をインストール [code] # yum install python-sphinx [/code] ここまでやって redmine をリスタートしたものの、チケットの表示画面が白くなって止まる。 プラグインを外すとチケットが表示される、という結果になった。 このためこのプラグインは今回は見送ることにする。

結局

ここ数日いろいろ調べたけど、結局の所素直に Sphinx を使うのが一番妥当じゃないだろうかという気がしてきた。
ただ、redmine の wiki はプロジェクト立ち上げと同時にメンバー全員で気楽に書き始められるので、これはこれで残したい。
また既に作成済みの wiki で PDF 出力に困っているものは pandoc で rst に変換後、Sphinx 側で修正を加えてから PDF にするしかないかなと思う。

そういうわけで、

  • アイディアは Wiki でわいわいメモする
  • 整理されたドキュメントは Sphinx で作成する
  • Wiki の textile を流用したい場合は pandoc を使う
  • Sphinx のソースは Git で管理する
  • redmine のどこかに Sphinx の公開用 URL を記載
  • redmine のプロジェクトのリポジトリに Sphinx のリポジトリを追加
  • 提出するときは Sphinx で PDF 化

という感じで運用することにしてみる。

参考URL

■ redmine の wiki のデザインを変える
http://momonjya-mo.hatenablog.com/entry/2012/10/07/201432
■ pandoc で Redmine の Wiki を Sphinx に変換しよう
http://cointoss.hatenablog.com/entry/2012/12/15/105104
■ Redmine 1.3新機能紹介: PDFエクスポート機能の改善
http://blog.redmine.jp/articles/new-feature-1_3/improved-pdf-export/
■ Redmine Wikiで本当に使えるTextile記法を全て試してみた
http://blog.kuborn.info/2013/01/redmine-wikitextile.html
■ Mac OS X v10.6:プレビューを使って PDF 書類を結合する方法
http://support.apple.com/kb/HT4075?viewlocale=ja_JP&locale=ja_JP
■ Sphinx のインストール
http://sphinx-users.jp/gettingstarted/install_windows.html#install-sphinx
■ Redmine Sphinx Pluginの概要
http://nishio.hateblo.jp/entry/20110801/1312179870
■ support attachment images in PDF export
http://www.redmine.org/issues/3261
■ Sphinx のインストール
http://docs.sphinx-users.jp/install.html#mac-os-x-install-sphinx-using-macports
■ Sphinx のインストール
http://blog.withsin.net/2012/05/22/mac-sphinx-install/