安直な操作性はWinChalowのまま、ChangeLogのソース・ファイルをFTPサイトに置けると、共同作業や出先での作業に便利かもしれないテスト。
ローカルにも保存されるので、データ・バックアップにもなります
ここまでくると、subversion などを利用したいような気もする…
remote.conf (ChangeLogファイルを置くFTPサイト関係の設定ファイル)
$VAR1 = { ########### Do not change this line ############# # FTP address FTPHOST => 'ftpでアクセスするアドレス', # FTP login id LOGINID => 'ログインID', # FTP login password PASSWRD => 'パスワード', # Host FTP chalow data path PATHC => '/src', #ChangeLogファイルを置くディレクトリ # ChangeLog filename CLOGNAME => 'RemoteClog.txt', }; ########### Do not change this line #############
use strict;
use Net::FTP;
use Getopt::Std;
getopts('c:C:i:f:l:p:d:m:M:t:Dgshv', \ my %opt);
our $usage =<< "USAGE";
usage: $0 [options]
where
-c Config file name [remote.conf]
-C ChangeLog file name [RemoteClog.txt]
-P Local ChangeLog file path [$ENV{HOME}]
-i ChangeLog file charcode {Shift_JIS|EUC-JP|UTF8}
-f Ftp Host Address
-d FTP Host data path
-l Ftp LoginID
-p Ftp Password
-g Get remote changelog from FTP Host
-s Upload local changelog to FTP Host
-D Debug Mode
USAGE
croak $usage if ($opt{h}||$opt{v});
my $cfile = $opt{c}||'remote.conf';
my $config = require $cfile;
# User Data
our $FTPHOST = $opt{f}||$config->{FTPHOST};
our $LOGINID = $opt{l}||$config->{LOGINID};
our $PASSWRD = $opt{p}||$config->{PASSWRD};
# Host FTP chalow data path
our $PATH_C = $opt{d}||$config->{PATHC}||'/src';
our $CLOG = $opt{C}||$config->{CLOGNAME}||'RemoteClog.txt';
# End User Data ####################################################
our $incode = 'Shift_JIS';
our $localdatapath = $opt{P}||$ENV{HOME}||$ENV{USERPROFILE}||'C:\\';
#our $localdatapath = './var';
$localdatapath =~ s|\\|/|og;
debug("Datapath: [$localdatapath]\n");
my $localfile = $localdatapath . '/' . $CLOG;
my $ftp = Net::FTP->new("$FTPHOST");
doFtp('login',$LOGINID,$PASSWRD);
doFtp('cwd',$PATH_C);
($opt{s}) ? doFtp('put', $localfile, $CLOG)
: doFtp('get', $CLOG, $localfile);
doFtp('quit');
# End main #
sub doFtp
{
my $cmd = shift;
my $msg = ($_[0]) ? "[$_[0]]" : "";
debug("* $cmd $msg ... ");
my $res = ($ftp->$cmd(@_) ? 'OK.' : 'failed.');
debug("$res\n");
}
sub debug
{
my $msg = shift;
print STDOUT $msg if $opt{D};
}
// UNIX compatible changelog + time-stamping // FTP version // (C) Project PaoPei 2004 Japan // User defined parameters /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ // Set your mail address あなたのメールアドレス $mead ="<youraddress@xx.xx.jp>"; // Set your name other than Windows USERNAME, if you like. // あなたのお名前 $myname ="Who are you?"; // Set changelog file // ChangeLogファイル名。変更するとあちこち統一しなくてはなら // ないので面倒です。 $clog ="RemoteClog.txt"; // /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ // Set your name to USERNAME, if no name is specified above. $user =getenv("USERNAME"); if ($myname=="") $myname = $user; // Set changelog file $filepath = "C:\\Documents and Settings\\" + $user + "\\" + $clog; // FTP get DOS窓コマンド $cget =currentmacrodirectory + "\\ftpcget.cmd"; // 起動 runsync2 $cget; // Process starts // open changelog file openfile($filepath); gofiletop; $today = year + "-" + month + "-" + day; $topLineDate = gettext(0,0,10,0); if ($topLineDate == $today) { #r = yes; } else { searchdown $today, word; #r = result; } if (#r == 0) // if today's date is not found, insert date { insert "\n" + $today + " " + $myname + " " + $mead + "\n"; $endlf="\n\n"; #bs=28; } else { down; golinetop; $endlf="\n"; #bs=27; } // insert item format $titleform = "\n\t* []:"; insert $titleform; $now = "\n\t(" + $today + " " + hour + ":" + minute + ":" + second + ")" + $endlf; insert $now; left(#bs); endmacro;
:: ftpcget.cmd
:: FTP download ChangeLog and set format
:: Project PaoPei 2004 JAPAN
:: This program shall be in the public domain.
@echo off
::::::::::::::::::::::::::::::::::::::::
:::::::: User defined vars :::::::::
::::::::::::::::::::::::::::::::::::::::
:: Where is your perl.exe?
set myperl=C:\Perl\bin\perl.exe
:: Where is your winchalow?
set chalowpath=C:\Program Files\chalow
:: Your conf file
set ftpconf=\remote.conf
:::::::: End User defined vars :::::::::
: Do job
%myperl% %chalowpath%\ftpfile.pl -c %chalowpath%%ftpconf%
: After
set myperl=
set chalowpath=
set ftpconf=
:End