aboutsummaryrefslogtreecommitdiff
path: root/www/tdiary-devel
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2004-03-01 17:01:10 +0000
committerPav Lucistnik <pav@FreeBSD.org>2004-03-01 17:01:10 +0000
commit203e086c5982fdc26ca128635289d29ef156e0c9 (patch)
treeb6f5ce01e88dcbb259d64836122c876d5fa3e68f /www/tdiary-devel
parentba0f1959805581d098ac854e4e92da4dcf41b9c4 (diff)
downloadports-203e086c5982fdc26ca128635289d29ef156e0c9.tar.gz
ports-203e086c5982fdc26ca128635289d29ef156e0c9.zip
- Make this work with ruby 1.8
PR: ports/63458 Submitted by: Fumihiko Kimura <jfkimura@yahoo.co.jp> (maintainer)
Notes
Notes: svn path=/head/; revision=102655
Diffstat (limited to 'www/tdiary-devel')
-rw-r--r--www/tdiary-devel/Makefile2
-rw-r--r--www/tdiary-devel/files/pkg-message.in8
-rw-r--r--www/tdiary-devel/files/tdiaryinst.rb.in66
3 files changed, 37 insertions, 39 deletions
diff --git a/www/tdiary-devel/Makefile b/www/tdiary-devel/Makefile
index e370dc198d94..54adac531aa7 100644
--- a/www/tdiary-devel/Makefile
+++ b/www/tdiary-devel/Makefile
@@ -7,7 +7,7 @@
PORTNAME= tdiary
PORTVERSION= 1.5.6
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES?= www ruby
MASTER_SITES= \
${MASTER_SITE_SOURCEFORGE} \
diff --git a/www/tdiary-devel/files/pkg-message.in b/www/tdiary-devel/files/pkg-message.in
index 7641c845f302..da4b6adc0e12 100644
--- a/www/tdiary-devel/files/pkg-message.in
+++ b/www/tdiary-devel/files/pkg-message.in
@@ -3,8 +3,6 @@
There is a script to install tDiary in a user directory.
This script should be run manually.
-[Ruby 1.6.x]
-
# ruby %%EXAMPLESDIR%%/tdiaryinst.rb --user=User
or
% ruby %%EXAMPLESDIR%%/tdiaryinst.rb
@@ -12,12 +10,6 @@ This script should be run manually.
* Option: --suexec Use suExec for CGI execution
--help Display Help information
-[Ruby 1.8.x]
-
- # %%EXAMPLESDIR%%/tdiary-FreeBSD.sh User
- or
- % %%EXAMPLESDIR%%/tdiary-FreeBSD.sh install
-
---
There is a document by English in the following directories.
See ...
diff --git a/www/tdiary-devel/files/tdiaryinst.rb.in b/www/tdiary-devel/files/tdiaryinst.rb.in
index 23df82306bb4..ba909cbf0667 100644
--- a/www/tdiary-devel/files/tdiaryinst.rb.in
+++ b/www/tdiary-devel/files/tdiaryinst.rb.in
@@ -13,7 +13,7 @@ require 'fileutils'
require 'find'
require 'tempfile'
-# make install時に置換されるグローバル変数 --tdiarymaster, --lang オプションで上書き可能
+#
$OPT_TDIARYMASTER = "@@@@PREFIX@@@@/share/examples/tdiary"
$OPT_LANG = '@@@@LANG@@@@'
@@ -93,7 +93,6 @@ def usage
exit 1
end
-# 引数の解析
parser = GetoptLong.new
parser.set_options(
['--user', '-u', GetoptLong::REQUIRED_ARGUMENT],
@@ -122,7 +121,7 @@ class TdiaryInstall
attr_accessor :tdiarymaster
attr_accessor :tdconfig
attr_accessor :lang
- attr_reader :euid # tdiaryinstallを実行しているユーザID
+ attr_reader :euid
attr_accessor :username
attr_accessor :diarydir
attr_accessor :httpdir
@@ -130,23 +129,22 @@ class TdiaryInstall
attr_accessor :fileutilOptions
attr_accessor :author_name
attr_accessor :author_mail
- attr_reader :author_host #FK
- def initialize # 初期値の設定
- @passwd = Etc.getpwuid() # 初期値はログインユーザ
+ attr_reader :author_host
+ def initialize
+ @passwd = Etc.getpwuid()
@euid = @passwd.uid
- @username =(@passwd.name) # username=(value) メソッドで再定義している #FK
+ @username =(@passwd.name)
@diarydir = 'diary'
@httpdir = 'public_html'
@fileutilOptions = []
- @author_name = @passwd.gecos #FK
- @author_host = "#{`hostname`.chomp}" #FK
- @author_mail = "#{@username}@#{`hostname`.chomp}" #FK
+ @author_name = @passwd.gecos
+ @author_host = "#{`hostname`.chomp}"
+ @author_mail = "#{@username}@#{`hostname`.chomp}"
end
- def username=(value) # username を代入する際に passwdメンバ変数も更新する
+ def username=(value)
@username = value
- @passwd = Etc.getpwnam(@username) # getpwnam(3) により passwd 構造体を取得する
- # ユーザ名が存在しなかった場合、Etc.getpwnam() は例外を発生する。
+ @passwd = Etc.getpwnam(@username)
@author_name = @passwd.gecos
@author_mail = "#{@username}@#{`hostname`.chomp}"
end
@@ -190,7 +188,6 @@ class TdiaryInstall
end
def prepareDirs
- # インストール先ディレクトリの用意
if ! FileTest.exist?("#{@passwd.dir}/#{@diarydir}")
FileUtils16.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions)
end
@@ -199,7 +196,7 @@ class TdiaryInstall
end
end
- def linkBaseFile # tDiaryの配布ファイルはコピーしない
+ def linkBaseFile
FileUtils16.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
FileUtils16.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
FileUtils16.ln_s("#{@tdiarymaster}/doc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
@@ -215,13 +212,24 @@ class TdiaryInstall
FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions)
end
- def copyBaseFile # tDiaryの配布ファイルをすべてコピー
- FileUtils16.cp_r("#{@tdiarymaster}/", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ def copyBaseFile
+ FileUtils16.cp_r("#{@tdiarymaster}/doc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp_r("#{@tdiarymaster}/erb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp_r("#{@tdiarymaster}/misc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp_r("#{@tdiarymaster}/skel", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp_r("#{@tdiarymaster}/tdiary", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp_r("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+ FileUtils16.cp("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
+ FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions)
+ FileUtils16.cp("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
+ FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions)
+ FileUtils16.cp("#{@tdiarymaster}/tdiary.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
+ FileUtils16.cp("#{@tdiarymaster}/README", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
end
def installConfig
- # 設定ファイルを生成してインストール
- tempfile = Tempfile.new("tdiary.conf-ja") # 日本語環境サンプル
+ tempfile = Tempfile.new("tdiary.conf-ja")
tempfile.write tdiaryConfReplace("#{@tdiarymaster}/tdiary.conf.sample")
tempfile.close
FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-ja", *@fileutilOptions)
@@ -231,10 +239,9 @@ class TdiaryInstall
tempfile.close
FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-en", *@fileutilOptions)
- if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf") # tdiary.conf がなければ設置
+ if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf")
FileUtils16.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/#{@tdconfig}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf", *@fileutilOptions)
end
- # TODO: @langの値によって plugin/00lang.en.rb コピー/削除の制御もしたい
tempfile = Tempfile.new("dot.htaccess")
tempfile.write dothtaccessReplace("#{@tdiarymaster}/dot.htaccess")
@@ -245,27 +252,26 @@ class TdiaryInstall
end
end
- def setPermissions # ファイルコピー・生成以外の処理
+ def setPermissions
FileUtils16.chmod(0777, "#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) if ! defined?($OPT_SUEXEC)
FileUtils16.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) if ! defined?($OPT_SUEXEC)
FileUtils16.rm("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary-FreeBSD.sh", :force, *@fileutilOptions)
- if @euid == 0 then # superuser 権限でこのインストーラを実行している場合
- # すべてのディレクトリ・ファイルに chown で所有者変更
+ if @euid == 0 then
Find.find("#{@passwd.dir}/#{@diarydir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}") do |f|
File.chown(@passwd.uid, @passwd.gid, f)
end
- if File::Stat.new("#{@passwd.dir}/#{@httpdir}").uid == 0 # ~/public_html のオーナーがsuperuser
+ if File::Stat.new("#{@passwd.dir}/#{@httpdir}").uid == 0
File.chown(@passwd.uid, @passwd.gid, "#{@passwd.dir}/#{@httpdir}")
end
end
end
- def echo(s) # --quiet が指定されていなかった場合にメッセージを出力する
+ def echo(s)
STDOUT.print s if ! defined?($OPT_QUIET)
end
- def tdiaryConfReplace(filename) # サンプル tdiary.conf を書き換えるメソッド
+ def tdiaryConfReplace(filename)
s = ''
File.open(filename) { |fp|
fp.each { |line|
@@ -273,14 +279,14 @@ class TdiaryInstall
line = "@author_name = '#{@author_name}'\n" if line =~ /^\@author_name\s/
line = "@author_mail = '#{@author_mail}'\n" if line =~ /^\@author_mail\s/
line = "@html_title = '#{@author_name} diary'\n" if line =~ /^\@html_title\s/
- line = "@index_page = 'http://#{@author_host}/~#{@username}\/'" if line =~ /^\@index_page\s/ #FK
+ line = "@index_page = 'http://#{@author_host}/~#{@username}\/'" if line =~ /^\@index_page\s/
s += line
}
}
s
end
- def dothtaccessReplace(filename) # サンプル dot.htaccess を書き換えるメソッド
+ def dothtaccessReplace(filename)
s = ''
File.open(filename) { |fp|
fp.each { |line|
@@ -297,7 +303,7 @@ end
tdiaryinst = TdiaryInstall.new
tdiaryinst.tdiarymaster = $OPT_TDIARYMASTER
tdiaryinst.lang = $OPT_LANG
-tdiaryinst.username = $OPT_USER if defined?($OPT_USER) # $OPT_NAMEの設定より前でないといけない
+tdiaryinst.username = $OPT_USER if defined?($OPT_USER)
tdiaryinst.diarydir = $OPT_DIARYDIR if defined?($OPT_DIARYDIR)
tdiaryinst.httpdir = $OPT_HTTPDIR if defined?($OPT_HTTPDIR)
tdiaryinst.author_name = $OPT_NAME if defined?($OPT_NAME)