duanliang8464 2013-07-24 14:18
浏览 60

使用phing在localhost上部署测试应用程序

I am developing a site using codeigniter framework. I am trying to understand PHING. At first I thought if we write some xml file it builds that folder structure. But when I read the documentation it seems to copy files from local to remote host.

Does it copy all the files from your system to remote host? Or am I wrong? If so how is it different from copying files manually in filezilla?

Secondly if it copies the files...I want to test that functionality in localhost. I found following script on google. I changed hostname to localhost and tried but it is saying it cannot connect to the host. If anyone tested on localhost before can you please tell me how to do it?

<?xml version="1.0" ?>
<project name="Shared hosting deployment" default="deploy-application-files" basedir=".">

    <property name="ftp.host" value="localhost" />
    <property name="ftp.port" value="21" />
    <property name="ftp.username" value="uname" />
    <property name="ftp.password" value="pass" />
    <property name="ftp.dir" value="C:\wamp\www\mlp_phing" />
    <property name="ftp.mode" value="ascii" />

    <!-- FILESETS -->
    <fileset dir="." id="files.images">
        <include name="images/**/*" />
        <include name="favicon.ico" />
    </fileset>
    <fileset dir="." id="files.application">
        <include name="system/application/**/*" />
        <include name="css/*" />
        <include name="js/*" />
    </fileset>
    <fileset dir="." id="files.system">
        <include name="system/**/*" />
        <exclude name="system/application/**/*" />
        <include name="index.php" />
        <include name="robots.txt" />
        <include name=".htaccess" />
    </fileset>

    <!-- DEPLOYMENT TARGETS -->
    <target name="deploy">
        <echo message="Copying fileset '${deploy.fileset.refid}' to ${ftp.host} in ${ftp.mode} mode" />
        <ftpdeploy
            host="${ftp.host}"
            port="${ftp.port}"
            username="${ftp.username}"
            password="${ftp.password}"
            dir="${ftp.dir}"
            mode="${ftp.mode}">
            <fileset refid="${deploy.fileset.refid}" />
        </ftpdeploy>
    </target>
    <target name="deploy-images">
        <echo msg="Deploying image files" />
        <phingcall target="deploy">
            <property name="deploy.fileset.refid" value="files.images" />
            <property name="ftp.mode" value="binary" override="true" />
        </phingcall>
    </target>
    <target name="deploy-application-files">
        <echo msg="Deploying application files" />
        <phingcall target="deploy">
            <property name="deploy.fileset.refid" value="files.application" />
        </phingcall>
    </target>
    <target name="deploy-system-files">
        <echo msg="Deploying system files" />
        <phingcall target="deploy">
            <property name="deploy.fileset.refid" value="files.system" />
        </phingcall>
    </target>
    <target name="deploy-all">
        <phingcall target="deploy-images" />
        <phingcall target="deploy-application-files" />
        <phingcall target="deploy-system-files" />
    </target>
</project>
  • 写回答

1条回答 默认 最新

  • dsue14118 2013-07-31 07:22
    关注

    Phing has lot of commands, several of which are similar to linux or you can use the ExecTask and just run native commands.

    To create a file you would just write <touch file="README.txt" /> and to create a directory you would write <mkdir dir="myDirectory" />

    But that's not really how Phing is meant to be used, instead you would do something like:

    <touch file="${my.files.name}" /> and then in build.properties you would set ${my.files.name}

    If you want to grab remote files you can use FtpDeployTask for FTP, SshTask to use SSH, the GitCloneTask to use git, etc, etc (there are more options).

    If you just want to build a file structure you should have a look at Compser , it sounds like you're not understanding the basics of Phing so I suggest reading the docs and trying something simple,

    http://www.phing.info/docs/guide/stable/

    Phing and Filezilla have nothing in common (well besides FTP support in Phing), Phing is https://en.wikipedia.org/wiki/Build_automation

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题