diff options
-rw-r--r-- | www/tdiary-devel/Makefile | 78 | ||||
-rw-r--r-- | www/tdiary-devel/files/tdiary-FreeBSD.sh.in | 3 | ||||
-rw-r--r-- | www/tdiary-devel/files/tdiaryinst.rb.in | 111 | ||||
-rw-r--r-- | www/tdiary-devel/pkg-message | 8 | ||||
-rw-r--r-- | www/tdiary/Makefile | 78 | ||||
-rw-r--r-- | www/tdiary/files/tdiary-FreeBSD.sh.in | 3 | ||||
-rw-r--r-- | www/tdiary/files/tdiaryinst.rb.in | 111 | ||||
-rw-r--r-- | www/tdiary/pkg-message | 8 |
8 files changed, 262 insertions, 138 deletions
diff --git a/www/tdiary-devel/Makefile b/www/tdiary-devel/Makefile index 719715532f90..d20d027262ef 100644 --- a/www/tdiary-devel/Makefile +++ b/www/tdiary-devel/Makefile @@ -7,7 +7,7 @@ PORTNAME= tdiary PORTVERSION= 1.5.5 -#PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES?= www ruby MASTER_SITES= \ ${MASTER_SITE_SOURCEFORGE} \ @@ -18,39 +18,41 @@ DISTNAME= ${PORTNAME}-full-${PORTVERSION} MAINTAINER= jfkimura@yahoo.co.jp COMMENT= A Web-based diary system (like weblog) written in Ruby -.if defined(WITH_TDIARY_UCONV) -RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/uconv.so:${PORTSDIR}/japanese/ruby-uconv -.endif -.if defined(WITH_TDIARY_NORA) -RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/web/escape_ext.so:${PORTSDIR}/www/ruby-nora +NO_BUILD= yes +USE_RUBY= yes +.if !defined(WITHOUT_RUBY_FEATURES) +USE_RUBY_FEATURES= fileutils .endif -NO_BUILD= yes -USE_RUBY= yes RUBY_SHEBANG_FILES= index.rb update.rb misc/convert2.rb misc/posttdiary.rb misc/plugin/squeeze.rb misc/plugin/weather.rb \ misc/plugin/windex.rb misc/plugin/a/a_conf.rb misc/plugin/todo/todo.rb misc/plugin/trackback/tb.rb TDIARYDIR= ${EXAMPLESDIR} WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} - .if !defined(TDIARY_LANG) TDIARY_LANG= tdiary.conf-en .endif +.if defined(WITH_TDIARY_UCONV) +RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/uconv.so:${PORTSDIR}/japanese/ruby-uconv +.endif +.if defined(WITH_TDIARY_NORA) +RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/web/escape_ext.so:${PORTSDIR}/www/ruby-nora +.endif + pre-everything:: +.if ! ${TDIARY_LANG} == "tdiary.conf-en" @${ECHO_MSG} - @${ECHO_MSG} "=============================================================" + @${ECHO_MSG} "=============================================================================" @${ECHO_MSG} "You may use the following options:" + @${ECHO_MSG} " WITH_TDIARY_UCONV=yes (RDF file creates with UTF-8 : output_rdf.rb)" + @${ECHO_MSG} " WITH_TDIARY_NORA=yes (with Referer header support : disp_referrer.rb)" + @${ECHO_MSG} "=============================================================================" @${ECHO_MSG} - @${ECHO_MSG} "WITH_TDIARY_UCONV=yes (with UTF-8 support : output_rdf.rb)" - @${ECHO_MSG} "WITH_TDIARY_NORA=yes (with Referer header support : disp_referrer.rb)" - @${ECHO_MSG} - @${ECHO_MSG} "=============================================================" - @${ECHO_MSG} +.endif do-install: -# @if [ -d ${TDIARYDIR} ]; then ${RM} -rf ${TDIARYDIR}; fi - -${MKDIR} ${TDIARYDIR} + @-${MKDIR} ${TDIARYDIR} @${SED} -e 's,@@@@PREFIX@@@@,${PREFIX},g' \ -e 's,@@@@LANG@@@@,${TDIARY_LANG},g' \ ${FILESDIR}/tdiaryinst.rb.in > ${TDIARYDIR}/tdiaryinst.rb @@ -58,32 +60,38 @@ do-install: -e 's,@@@@LANG@@@@,${TDIARY_LANG},g' \ ${FILESDIR}/tdiary-FreeBSD.sh.in > ${TDIARYDIR}/tdiary-FreeBSD.sh @${CHMOD} ugo=rx ${TDIARYDIR}/tdiary-FreeBSD.sh - ${CP} -pR ${WRKSRC}/ ${TDIARYDIR} + @${CP} -pR ${WRKSRC}/ ${TDIARYDIR} .if defined(WITH_TDIARY_UCONV) - ${INSTALL_DATA} ${WRKSRC}/misc/plugin/output_rdf.rb ${TDIARYDIR}/plugin + @${ECHO_MSG} "===> Option : WITH_TDIARY_UCONV .. Done." + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/output_rdf.rb ${TDIARYDIR}/plugin + @${TOUCH} ${TDIARYDIR}/t.rdf + @${CHMOD} 706 ${TDIARYDIR}/t.rdf + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/output_rdf.rb' >> ${TMPPLIST} + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/t.rdf' >> ${TMPPLIST} .endif .if defined(WITH_TDIARY_NORA) - ${INSTALL_DATA} ${WRKSRC}/misc/plugin/disp_referrer.rb ${TDIARYDIR}/plugin + @${ECHO_MSG} "===> Option : WITH_TDIARY_NORA .. Done." + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/disp_referrer.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/disp_referrer.rb' >> ${TMPPLIST} .endif - ${INSTALL_DATA} ${WRKSRC}/misc/plugin/comment_mail-sendmail.rb ${TDIARYDIR}/plugin + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/comment_mail-sendmail.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/comment_mail-sendmail.rb' >> ${TMPPLIST} .if ${TDIARY_LANG} == tdiary.conf-en - ${INSTALL_DATA} ${WRKSRC}/misc/i18n/00lang.en.rb ${TDIARYDIR}/plugin + @${ECHO_MSG} "===> TDIARY : English Language messages support" + @${INSTALL_DATA} ${WRKSRC}/misc/i18n/00lang.en.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/00lang.en.rb' >> ${TMPPLIST} + @${RUBY} -i -pe 'sub(/%Y-%m-%d/, "%Y-%m-%d [%a]")' ${TDIARYDIR}/misc/i18n/tdiary.conf.sample-en +.else + @${ECHO_MSG} "===> TDIARY : Japanese Language messages support" + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/jdate.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/jdate.rb' >> ${TMPPLIST} + @${RUBY} -i -pe 'sub(/%Y-%m-%d/, "%Y-%m-%d [%J]")' ${TDIARYDIR}/tdiary.conf.sample .endif @${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${TDIARYDIR} post-install: - @cd ${WRKSRC} && ${FIND} . -type f -o -type l | ${SED} -e 's,^\.,share/examples/${PORTNAME},' >> ${TMPPLIST} -.if defined(WITH_TDIARY_UCONV) - @${ECHO} 'share/examples/${PORTNAME}/plugin/output_rdf.rb' >> ${TMPPLIST} -.endif -.if defined(WITH_TDIARY_NORA) - @${ECHO} 'share/examples/${PORTNAME}/plugin/disp_referrer.rb' >> ${TMPPLIST} -.endif - @${ECHO} 'share/examples/${PORTNAME}/plugin/comment_mail-sendmail.rb' >> ${TMPPLIST} -.if ${TDIARY_LANG} == tdiary.conf-en - @${ECHO} 'share/examples/${PORTNAME}/plugin/00lang.en.rb' >> ${TMPPLIST} -.endif - @cd ${WRKSRC} && ${FIND} . -type d -depth | ${SED} -e 's,^\.,@dirrm share/examples/${PORTNAME},' >> ${TMPPLIST} - @${SED} -e "s,@@@@PREFIX@@@@,${PREFIX},g" ${PKGMESSAGE} + @cd ${WRKSRC} && ${FIND} . -type f -o -type l | ${SED} -e 's,^\.,${TDIARYDIR:S|${LOCALBASE}/||},' >> ${TMPPLIST} + @cd ${WRKSRC} && ${FIND} . -type d -depth | ${SED} -e 's,^\.,@dirrm ${TDIARYDIR:S|${LOCALBASE}/||},' >> ${TMPPLIST} + @${SED} -e "s,%%EXAMPLESDIR%%,${EXAMPLESDIR},g" ${PKGMESSAGE} .include <bsd.port.mk> diff --git a/www/tdiary-devel/files/tdiary-FreeBSD.sh.in b/www/tdiary-devel/files/tdiary-FreeBSD.sh.in index 09c92d0abf77..8008b0cda1b6 100644 --- a/www/tdiary-devel/files/tdiary-FreeBSD.sh.in +++ b/www/tdiary-devel/files/tdiary-FreeBSD.sh.in @@ -54,9 +54,6 @@ install) HOMEOWN=`grep ^$USER: /etc/passwd | cut -f3 -d':'` HOMEGRP=`grep ^$USER: /etc/passwd | cut -f4 -d':'` HOMEDIR=`grep ^$USER: /etc/passwd | cut -f6 -d':'` -# HOMEOWN=$USER -# HOMEGRP=$GROUP -# HOMEDIR=$HOME echo "HOME Directory : " ${HOMEDIR} USERNAME=$USER ;; diff --git a/www/tdiary-devel/files/tdiaryinst.rb.in b/www/tdiary-devel/files/tdiaryinst.rb.in index da176f83bd40..23df82306bb4 100644 --- a/www/tdiary-devel/files/tdiaryinst.rb.in +++ b/www/tdiary-devel/files/tdiaryinst.rb.in @@ -1,8 +1,8 @@ -#!/usr/local/bin/ruby +#!/usr/bin/env ruby # # tdiaryinstall.rb - tDiary user directory copy script -# Date created: 13 July 2003 -# Whom: KAMIYA Satosi <mimoriso@anet.ne.jp> +# Date created: 13 July 2003 +# Whom: KAMIYA Satosi <mimoriso@anet.ne.jp> # # $FreeBSD$ # @@ -17,6 +17,63 @@ require 'tempfile' $OPT_TDIARYMASTER = "@@@@PREFIX@@@@/share/examples/tdiary" $OPT_LANG = '@@@@LANG@@@@' +module FileUtils16 + def FileUtils16.mkdir_p(dir, *options) + begin + FileUtils.mkdir_p(dir, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.mkdir_p(dir, optionhash) + end + end + def FileUtils16.cp(src, dest, *options) + begin + FileUtils.cp(src, dest, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.cp(src, dest, optionhash) + end + end + def FileUtils16.cp_r(src, dest, *options) + begin + FileUtils.cp_r(src, dest, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.cp_r(src, dest, optionhash) + end + end + def FileUtils16.rm(list, *options) + begin + FileUtils.rm(list, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.rm(list, optionhash) + end + end + def FileUtils16.ln_s(list, destdir, *options) + begin + FileUtils.ln_s(list, destdir, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.ln_s(list, destdir, optionhash) + end + end + def FileUtils16.chmod(mode, list, *options) + begin + FileUtils.chmod(mode, list, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.chmod(mode, list, optionhash) + end + end +end + def usage STDERR.print "Usage: #{File.basename($0)} [options]\n" STDERR.print "Options:\n" @@ -73,17 +130,17 @@ class TdiaryInstall attr_accessor :fileutilOptions attr_accessor :author_name attr_accessor :author_mail - attr_accessor :author_host + attr_reader :author_host #FK def initialize # 初期値の設定 @passwd = Etc.getpwuid() # 初期値はログインユーザ @euid = @passwd.uid - @username = (@passwd.name) # username=(value) メソッドで再定義している + @username =(@passwd.name) # username=(value) メソッドで再定義している #FK @diarydir = 'diary' @httpdir = 'public_html' @fileutilOptions = [] - @author_name = @passwd.gecos # F.Kimura - @author_host = "#{`hostname`.chomp}" # F.Kimura - @author_mail = "#{@username}@#{`hostname`.chomp}" + @author_name = @passwd.gecos #FK + @author_host = "#{`hostname`.chomp}" #FK + @author_mail = "#{@username}@#{`hostname`.chomp}" #FK end def username=(value) # username を代入する際に passwdメンバ変数も更新する @@ -135,31 +192,31 @@ class TdiaryInstall def prepareDirs # インストール先ディレクトリの用意 if ! FileTest.exist?("#{@passwd.dir}/#{@diarydir}") - FileUtils.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) + FileUtils16.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) end if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}") - FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) + FileUtils16.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) end end def linkBaseFile # tDiaryの配布ファイルはコピーしない - FileUtils.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions) - FileUtils.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) - FileUtils.ln_s("#{@tdiarymaster}/doc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) + 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) tempfile = Tempfile.new("index.rb") tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/index'\n" tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) + FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) tempfile = Tempfile.new("update.rb") tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/update'\n" tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) + FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) end def copyBaseFile # tDiaryの配布ファイルをすべてコピー - FileUtils.cp_r("#{@tdiarymaster}/", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions) + FileUtils16.cp_r("#{@tdiarymaster}/", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions) end def installConfig @@ -167,31 +224,31 @@ class TdiaryInstall tempfile = Tempfile.new("tdiary.conf-ja") # 日本語環境サンプル tempfile.write tdiaryConfReplace("#{@tdiarymaster}/tdiary.conf.sample") tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-ja", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-ja", *@fileutilOptions) tempfile = Tempfile.new("tdiary.conf-en") # sample configuration for English Environment tempfile.write tdiaryConfReplace("#{@tdiarymaster}/misc/i18n/tdiary.conf.sample-en") tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-en", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-en", *@fileutilOptions) if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf") # tdiary.conf がなければ設置 - FileUtils.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/#{@tdconfig}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf", *@fileutilOptions) + 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") tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", *@fileutilOptions) if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess") - FileUtils.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", *@fileutilOptions) + FileUtils16.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", *@fileutilOptions) end end def setPermissions # ファイルコピー・生成以外の処理 - FileUtils.chmod(0777, "#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) if ! defined?($OPT_SUEXEC) - FileUtils.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) if ! defined?($OPT_SUEXEC) - FileUtils.rm("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary-FreeBSD.sh", :force, *@fileutilOptions) + 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 で所有者変更 @@ -216,7 +273,7 @@ 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/ # F.Kimura + line = "@index_page = 'http://#{@author_host}/~#{@username}\/'" if line =~ /^\@index_page\s/ #FK s += line } } diff --git a/www/tdiary-devel/pkg-message b/www/tdiary-devel/pkg-message index e16258eb3bb8..9de93afe68bd 100644 --- a/www/tdiary-devel/pkg-message +++ b/www/tdiary-devel/pkg-message @@ -3,16 +3,16 @@ There is a script to install tDiary in a user directory. This script should be run manually. - # ruby @@@@PREFIX@@@@/share/examples/tdiary/tdiaryinst.rb --user=hoge + # ruby %%EXAMPLESDIR%%/tdiaryinst.rb --user=hoge or - % ruby @@@@PREFIX@@@@/share/examples/tdiary/tdiaryinst.rb + % ruby %%EXAMPLESDIR%%/tdiaryinst.rb same as script : - @@@@PREFIX@@@@/share/examples/tdiary/tdiary-FreeBSD.sh + %%EXAMPLESDIR%%/tdiary-FreeBSD.sh There is a document by English in the following directories. See ... - @@@@PREFIX@@@@/share/examples/tdiary/misc/i18n/ + %%EXAMPLESDIR%%/misc/i18n/ and Explanation by English of a tDiary system can refer to the following page : diff --git a/www/tdiary/Makefile b/www/tdiary/Makefile index 719715532f90..d20d027262ef 100644 --- a/www/tdiary/Makefile +++ b/www/tdiary/Makefile @@ -7,7 +7,7 @@ PORTNAME= tdiary PORTVERSION= 1.5.5 -#PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES?= www ruby MASTER_SITES= \ ${MASTER_SITE_SOURCEFORGE} \ @@ -18,39 +18,41 @@ DISTNAME= ${PORTNAME}-full-${PORTVERSION} MAINTAINER= jfkimura@yahoo.co.jp COMMENT= A Web-based diary system (like weblog) written in Ruby -.if defined(WITH_TDIARY_UCONV) -RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/uconv.so:${PORTSDIR}/japanese/ruby-uconv -.endif -.if defined(WITH_TDIARY_NORA) -RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/web/escape_ext.so:${PORTSDIR}/www/ruby-nora +NO_BUILD= yes +USE_RUBY= yes +.if !defined(WITHOUT_RUBY_FEATURES) +USE_RUBY_FEATURES= fileutils .endif -NO_BUILD= yes -USE_RUBY= yes RUBY_SHEBANG_FILES= index.rb update.rb misc/convert2.rb misc/posttdiary.rb misc/plugin/squeeze.rb misc/plugin/weather.rb \ misc/plugin/windex.rb misc/plugin/a/a_conf.rb misc/plugin/todo/todo.rb misc/plugin/trackback/tb.rb TDIARYDIR= ${EXAMPLESDIR} WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} - .if !defined(TDIARY_LANG) TDIARY_LANG= tdiary.conf-en .endif +.if defined(WITH_TDIARY_UCONV) +RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/uconv.so:${PORTSDIR}/japanese/ruby-uconv +.endif +.if defined(WITH_TDIARY_NORA) +RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/web/escape_ext.so:${PORTSDIR}/www/ruby-nora +.endif + pre-everything:: +.if ! ${TDIARY_LANG} == "tdiary.conf-en" @${ECHO_MSG} - @${ECHO_MSG} "=============================================================" + @${ECHO_MSG} "=============================================================================" @${ECHO_MSG} "You may use the following options:" + @${ECHO_MSG} " WITH_TDIARY_UCONV=yes (RDF file creates with UTF-8 : output_rdf.rb)" + @${ECHO_MSG} " WITH_TDIARY_NORA=yes (with Referer header support : disp_referrer.rb)" + @${ECHO_MSG} "=============================================================================" @${ECHO_MSG} - @${ECHO_MSG} "WITH_TDIARY_UCONV=yes (with UTF-8 support : output_rdf.rb)" - @${ECHO_MSG} "WITH_TDIARY_NORA=yes (with Referer header support : disp_referrer.rb)" - @${ECHO_MSG} - @${ECHO_MSG} "=============================================================" - @${ECHO_MSG} +.endif do-install: -# @if [ -d ${TDIARYDIR} ]; then ${RM} -rf ${TDIARYDIR}; fi - -${MKDIR} ${TDIARYDIR} + @-${MKDIR} ${TDIARYDIR} @${SED} -e 's,@@@@PREFIX@@@@,${PREFIX},g' \ -e 's,@@@@LANG@@@@,${TDIARY_LANG},g' \ ${FILESDIR}/tdiaryinst.rb.in > ${TDIARYDIR}/tdiaryinst.rb @@ -58,32 +60,38 @@ do-install: -e 's,@@@@LANG@@@@,${TDIARY_LANG},g' \ ${FILESDIR}/tdiary-FreeBSD.sh.in > ${TDIARYDIR}/tdiary-FreeBSD.sh @${CHMOD} ugo=rx ${TDIARYDIR}/tdiary-FreeBSD.sh - ${CP} -pR ${WRKSRC}/ ${TDIARYDIR} + @${CP} -pR ${WRKSRC}/ ${TDIARYDIR} .if defined(WITH_TDIARY_UCONV) - ${INSTALL_DATA} ${WRKSRC}/misc/plugin/output_rdf.rb ${TDIARYDIR}/plugin + @${ECHO_MSG} "===> Option : WITH_TDIARY_UCONV .. Done." + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/output_rdf.rb ${TDIARYDIR}/plugin + @${TOUCH} ${TDIARYDIR}/t.rdf + @${CHMOD} 706 ${TDIARYDIR}/t.rdf + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/output_rdf.rb' >> ${TMPPLIST} + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/t.rdf' >> ${TMPPLIST} .endif .if defined(WITH_TDIARY_NORA) - ${INSTALL_DATA} ${WRKSRC}/misc/plugin/disp_referrer.rb ${TDIARYDIR}/plugin + @${ECHO_MSG} "===> Option : WITH_TDIARY_NORA .. Done." + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/disp_referrer.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/disp_referrer.rb' >> ${TMPPLIST} .endif - ${INSTALL_DATA} ${WRKSRC}/misc/plugin/comment_mail-sendmail.rb ${TDIARYDIR}/plugin + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/comment_mail-sendmail.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/comment_mail-sendmail.rb' >> ${TMPPLIST} .if ${TDIARY_LANG} == tdiary.conf-en - ${INSTALL_DATA} ${WRKSRC}/misc/i18n/00lang.en.rb ${TDIARYDIR}/plugin + @${ECHO_MSG} "===> TDIARY : English Language messages support" + @${INSTALL_DATA} ${WRKSRC}/misc/i18n/00lang.en.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/00lang.en.rb' >> ${TMPPLIST} + @${RUBY} -i -pe 'sub(/%Y-%m-%d/, "%Y-%m-%d [%a]")' ${TDIARYDIR}/misc/i18n/tdiary.conf.sample-en +.else + @${ECHO_MSG} "===> TDIARY : Japanese Language messages support" + @${INSTALL_DATA} ${WRKSRC}/misc/plugin/jdate.rb ${TDIARYDIR}/plugin + @${ECHO_CMD} '${TDIARYDIR:S|${LOCALBASE}/||}/plugin/jdate.rb' >> ${TMPPLIST} + @${RUBY} -i -pe 'sub(/%Y-%m-%d/, "%Y-%m-%d [%J]")' ${TDIARYDIR}/tdiary.conf.sample .endif @${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${TDIARYDIR} post-install: - @cd ${WRKSRC} && ${FIND} . -type f -o -type l | ${SED} -e 's,^\.,share/examples/${PORTNAME},' >> ${TMPPLIST} -.if defined(WITH_TDIARY_UCONV) - @${ECHO} 'share/examples/${PORTNAME}/plugin/output_rdf.rb' >> ${TMPPLIST} -.endif -.if defined(WITH_TDIARY_NORA) - @${ECHO} 'share/examples/${PORTNAME}/plugin/disp_referrer.rb' >> ${TMPPLIST} -.endif - @${ECHO} 'share/examples/${PORTNAME}/plugin/comment_mail-sendmail.rb' >> ${TMPPLIST} -.if ${TDIARY_LANG} == tdiary.conf-en - @${ECHO} 'share/examples/${PORTNAME}/plugin/00lang.en.rb' >> ${TMPPLIST} -.endif - @cd ${WRKSRC} && ${FIND} . -type d -depth | ${SED} -e 's,^\.,@dirrm share/examples/${PORTNAME},' >> ${TMPPLIST} - @${SED} -e "s,@@@@PREFIX@@@@,${PREFIX},g" ${PKGMESSAGE} + @cd ${WRKSRC} && ${FIND} . -type f -o -type l | ${SED} -e 's,^\.,${TDIARYDIR:S|${LOCALBASE}/||},' >> ${TMPPLIST} + @cd ${WRKSRC} && ${FIND} . -type d -depth | ${SED} -e 's,^\.,@dirrm ${TDIARYDIR:S|${LOCALBASE}/||},' >> ${TMPPLIST} + @${SED} -e "s,%%EXAMPLESDIR%%,${EXAMPLESDIR},g" ${PKGMESSAGE} .include <bsd.port.mk> diff --git a/www/tdiary/files/tdiary-FreeBSD.sh.in b/www/tdiary/files/tdiary-FreeBSD.sh.in index 09c92d0abf77..8008b0cda1b6 100644 --- a/www/tdiary/files/tdiary-FreeBSD.sh.in +++ b/www/tdiary/files/tdiary-FreeBSD.sh.in @@ -54,9 +54,6 @@ install) HOMEOWN=`grep ^$USER: /etc/passwd | cut -f3 -d':'` HOMEGRP=`grep ^$USER: /etc/passwd | cut -f4 -d':'` HOMEDIR=`grep ^$USER: /etc/passwd | cut -f6 -d':'` -# HOMEOWN=$USER -# HOMEGRP=$GROUP -# HOMEDIR=$HOME echo "HOME Directory : " ${HOMEDIR} USERNAME=$USER ;; diff --git a/www/tdiary/files/tdiaryinst.rb.in b/www/tdiary/files/tdiaryinst.rb.in index da176f83bd40..23df82306bb4 100644 --- a/www/tdiary/files/tdiaryinst.rb.in +++ b/www/tdiary/files/tdiaryinst.rb.in @@ -1,8 +1,8 @@ -#!/usr/local/bin/ruby +#!/usr/bin/env ruby # # tdiaryinstall.rb - tDiary user directory copy script -# Date created: 13 July 2003 -# Whom: KAMIYA Satosi <mimoriso@anet.ne.jp> +# Date created: 13 July 2003 +# Whom: KAMIYA Satosi <mimoriso@anet.ne.jp> # # $FreeBSD$ # @@ -17,6 +17,63 @@ require 'tempfile' $OPT_TDIARYMASTER = "@@@@PREFIX@@@@/share/examples/tdiary" $OPT_LANG = '@@@@LANG@@@@' +module FileUtils16 + def FileUtils16.mkdir_p(dir, *options) + begin + FileUtils.mkdir_p(dir, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.mkdir_p(dir, optionhash) + end + end + def FileUtils16.cp(src, dest, *options) + begin + FileUtils.cp(src, dest, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.cp(src, dest, optionhash) + end + end + def FileUtils16.cp_r(src, dest, *options) + begin + FileUtils.cp_r(src, dest, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.cp_r(src, dest, optionhash) + end + end + def FileUtils16.rm(list, *options) + begin + FileUtils.rm(list, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.rm(list, optionhash) + end + end + def FileUtils16.ln_s(list, destdir, *options) + begin + FileUtils.ln_s(list, destdir, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.ln_s(list, destdir, optionhash) + end + end + def FileUtils16.chmod(mode, list, *options) + begin + FileUtils.chmod(mode, list, *options) + rescue TypeError + optionhash = {} + options.each { |o| optionhash[o] = true } + FileUtils.chmod(mode, list, optionhash) + end + end +end + def usage STDERR.print "Usage: #{File.basename($0)} [options]\n" STDERR.print "Options:\n" @@ -73,17 +130,17 @@ class TdiaryInstall attr_accessor :fileutilOptions attr_accessor :author_name attr_accessor :author_mail - attr_accessor :author_host + attr_reader :author_host #FK def initialize # 初期値の設定 @passwd = Etc.getpwuid() # 初期値はログインユーザ @euid = @passwd.uid - @username = (@passwd.name) # username=(value) メソッドで再定義している + @username =(@passwd.name) # username=(value) メソッドで再定義している #FK @diarydir = 'diary' @httpdir = 'public_html' @fileutilOptions = [] - @author_name = @passwd.gecos # F.Kimura - @author_host = "#{`hostname`.chomp}" # F.Kimura - @author_mail = "#{@username}@#{`hostname`.chomp}" + @author_name = @passwd.gecos #FK + @author_host = "#{`hostname`.chomp}" #FK + @author_mail = "#{@username}@#{`hostname`.chomp}" #FK end def username=(value) # username を代入する際に passwdメンバ変数も更新する @@ -135,31 +192,31 @@ class TdiaryInstall def prepareDirs # インストール先ディレクトリの用意 if ! FileTest.exist?("#{@passwd.dir}/#{@diarydir}") - FileUtils.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) + FileUtils16.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) end if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}") - FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) + FileUtils16.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) end end def linkBaseFile # tDiaryの配布ファイルはコピーしない - FileUtils.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions) - FileUtils.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) - FileUtils.ln_s("#{@tdiarymaster}/doc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) + 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) tempfile = Tempfile.new("index.rb") tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/index'\n" tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) + FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", *@fileutilOptions) tempfile = Tempfile.new("update.rb") tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/update'\n" tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) + FileUtils16.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", *@fileutilOptions) end def copyBaseFile # tDiaryの配布ファイルをすべてコピー - FileUtils.cp_r("#{@tdiarymaster}/", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions) + FileUtils16.cp_r("#{@tdiarymaster}/", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions) end def installConfig @@ -167,31 +224,31 @@ class TdiaryInstall tempfile = Tempfile.new("tdiary.conf-ja") # 日本語環境サンプル tempfile.write tdiaryConfReplace("#{@tdiarymaster}/tdiary.conf.sample") tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-ja", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-ja", *@fileutilOptions) tempfile = Tempfile.new("tdiary.conf-en") # sample configuration for English Environment tempfile.write tdiaryConfReplace("#{@tdiarymaster}/misc/i18n/tdiary.conf.sample-en") tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-en", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-en", *@fileutilOptions) if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf") # tdiary.conf がなければ設置 - FileUtils.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/#{@tdconfig}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf", *@fileutilOptions) + 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") tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", *@fileutilOptions) + FileUtils16.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", *@fileutilOptions) if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess") - FileUtils.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", *@fileutilOptions) + FileUtils16.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", *@fileutilOptions) end end def setPermissions # ファイルコピー・生成以外の処理 - FileUtils.chmod(0777, "#{@passwd.dir}/#{@diarydir}", *@fileutilOptions) if ! defined?($OPT_SUEXEC) - FileUtils.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions) if ! defined?($OPT_SUEXEC) - FileUtils.rm("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary-FreeBSD.sh", :force, *@fileutilOptions) + 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 で所有者変更 @@ -216,7 +273,7 @@ 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/ # F.Kimura + line = "@index_page = 'http://#{@author_host}/~#{@username}\/'" if line =~ /^\@index_page\s/ #FK s += line } } diff --git a/www/tdiary/pkg-message b/www/tdiary/pkg-message index e16258eb3bb8..9de93afe68bd 100644 --- a/www/tdiary/pkg-message +++ b/www/tdiary/pkg-message @@ -3,16 +3,16 @@ There is a script to install tDiary in a user directory. This script should be run manually. - # ruby @@@@PREFIX@@@@/share/examples/tdiary/tdiaryinst.rb --user=hoge + # ruby %%EXAMPLESDIR%%/tdiaryinst.rb --user=hoge or - % ruby @@@@PREFIX@@@@/share/examples/tdiary/tdiaryinst.rb + % ruby %%EXAMPLESDIR%%/tdiaryinst.rb same as script : - @@@@PREFIX@@@@/share/examples/tdiary/tdiary-FreeBSD.sh + %%EXAMPLESDIR%%/tdiary-FreeBSD.sh There is a document by English in the following directories. See ... - @@@@PREFIX@@@@/share/examples/tdiary/misc/i18n/ + %%EXAMPLESDIR%%/misc/i18n/ and Explanation by English of a tDiary system can refer to the following page : |