Sha256: fc03fc537af766a9ca58bf4d753c4f76b9db2d2b35f8c1978bc9ac93471eb9e1

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require 'rio'

module Test
  module RIO
    module FTP
      module Const
        FTPUSER = 'ftp'
        
        FSROOT = rio('/home/ftp')
        #FTPHOST = '192.168.1.101'
        FTPHOST = 'localhost'
        FTPROOT = rio("ftp://#{FTPHOST}/")

        TESTDIR = rio('riotest')

        RODIR = rio('ro')
        RWDIR = rio('rw')
        FTP_RWROOT = FTPROOT/TESTDIR/RWDIR
        FTP_ROROOT = FTPROOT/TESTDIR/RODIR
        FS_RWROOT = FSROOT/TESTDIR/RWDIR
        FS_ROROOT = FSROOT/TESTDIR/RODIR
        
        PASSWDFILE = FSROOT/'etc/passwd'
        UID,GID = rio(PASSWDFILE).lines[/^#{FTPUSER}/][0].split(':')[2..3].map{|strid| strid.to_i}
      end
      include Const
      def init_test_files
        fsdir = rio(FSROOT,TESTDIR).delete!.mkdir
        rodir = rio(fsdir,RODIR).mkdir
        rwdir = rio(fsdir,RWDIR).mkdir
        f0 = rodir/'f0' < "File0\n"
        d0 = rio(rodir,'d0').mkdir
        f1 = rio(d0,'f1') < "File1\n"
        d1 = rio(d0,'d1').mkdir
        f2 = rio(d1,'f2') < "File2\n"
        f0.chown(UID,GID).chmod(0555)
        f1.chown(UID,GID).chmod(0555)
        f2.chown(UID,GID).chmod(0555)
        d1.chown(UID,GID).chmod(0555)
        d0.chown(UID,GID).chmod(0555)
        rodir.chown(UID,GID).chmod(0555)
        rwdir.chown(UID,GID).chmod(0777)
        fsdir.chown(UID,GID).chmod(0555)
        
        puts rio(FSROOT,TESTDIR).all[]
      end
      module_function :init_test_files
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rio-0.3.8 test/ftp/testdef.rb