Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Feb 2004 01:31:27 +0900 (JST)
From:      Fumihiko Kimura <jfkimura@yahoo.co.jp>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/63458: maintainer-update ports: www/tdiary
Message-ID:  <200402271631.i1RGVRxt040537@sh0.radio.gr.jp>
Resent-Message-ID: <200402271640.i1RGe6cg004652@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         63458
>Category:       ports
>Synopsis:       maintainer-update ports: www/tdiary
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 27 08:40:05 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Fumihiko Kimura
>Release:        FreeBSD 4.9-RELEASE-p2 i386
>Organization:
>Environment:
>Description:

Change point:

 * Adapted to ruby 1.8.x

>How-To-Repeat:

Checked:

	- Ruby 1.6.8 (FreeBSD 4.9-RELEASE)
	- Ruby 1.8.1 (FreeBSD 5.2.1-RELEASE)

>Fix:

=== begin  cut here ===
diff -urN tdiary-orig/Makefile tdiary/Makefile
--- tdiary-orig/Makefile	Sat Dec 13 22:09:36 2003
+++ tdiary/Makefile	Sat Feb 28 00:53:20 2004
@@ -7,7 +7,7 @@
 
 PORTNAME=	tdiary
 PORTVERSION=	1.5.6
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES?=	www ruby
 MASTER_SITES=	\
 		${MASTER_SITE_SOURCEFORGE} \
diff -urN tdiary-orig/files/pkg-message.in tdiary/files/pkg-message.in
--- tdiary-orig/files/pkg-message.in	Tue Dec  9 11:48:11 2003
+++ tdiary/files/pkg-message.in	Sat Feb 28 00:53:55 2004
@@ -3,20 +3,12 @@
 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
 
  * 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.
diff -urN tdiary-orig/files/tdiaryinst.rb.in tdiary/files/tdiaryinst.rb.in
--- tdiary-orig/files/tdiaryinst.rb.in	Sun Nov  9 21:59:57 2003
+++ tdiary/files/tdiaryinst.rb.in	Sat Feb 28 00:53:56 2004
@@ -13,7 +13,7 @@
 require 'find'
 require 'tempfile'
 
-# make install時に置換されるグローバル変数 --tdiarymaster, --lang オプションで上書き可能
+# 
 $OPT_TDIARYMASTER = "@@@@PREFIX@@@@/share/examples/tdiary"
 $OPT_LANG         = '@@@@LANG@@@@'
 
@@ -93,7 +93,6 @@
   exit 1
 end
 
-# 引数の解析
 parser = GetoptLong.new
 parser.set_options(
   ['--user',    '-u', GetoptLong::REQUIRED_ARGUMENT],
@@ -122,7 +121,7 @@
   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 @@
   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 @@
   end
 
   def prepareDirs
-    # インストール先ディレクトリの用意
     if ! FileTest.exist?("#{@passwd.dir}/#{@diarydir}")
       FileUtils16.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions)
     end
@@ -199,7 +196,7 @@
     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 @@
     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 @@
     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 @@
     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 @@
         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 @@
 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)
=== ended  cut here ===

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402271631.i1RGVRxt040537>