你用Phing吗?

发布于 2024-07-05 05:51:49 字数 574 浏览 8 评论 0原文

有人使用 Phing 来部署 PHP 应用程序吗?如果是,你如何使用它? 目前,我们有一个手写的“设置”脚本,每当我们部署项目的新实例时都会运行该脚本。 我们只需从 SVN 签出并运行它。 它设置一些基本配置变量,安装或重新加载数据库,并为站点实例生成虚拟主机。

我经常想也许我们应该使用 Phing。 我没有太多使用 ant,所以我不太了解 Phing 应该做什么除了像我们的安装脚本那样编写将文件从一个地方复制到另一个地方的脚本之外,还可以执行其他操作。 您可以举例说明哪些更高级的用途,以帮助我理解为什么我们愿意或不愿意集成 Phing< /a> 进入我们的进程?

Does anyone use Phing to deploy PHP applications, and if so how do you use it? We currently have a hand-written "setup" script that we run whenever we deploy a new instance of our project. We just check out from SVN and run it. It sets some basic configuration variables, installs or reloads the database, and generates a v-host for the site instance.

I have often thought that maybe we should be using Phing. I haven't used ant much, so I don't have a real sense of what Phing is supposed to do other than script the copying of files from one place to another much as our setup script does. What are some more advanced uses that you can give examples of to help me understand why we would or would not want to integrate Phing into our process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

阳光下的泡沫是彩色的 2024-07-12 05:51:50

我们使用 phing 来部署 SemanticScuttle

  • 生成用于分发的 zip 存档
  • 创建 PEAR
  • 上传 zip SourceForge
  • 使用新的包文件更新 PEAR 通道
  • 将 reStructuredText 文档渲染为 html 文件并上传。 目前正在使用 exec,但我正在为其编写一个单独的任务

上传 zip 文件和通道是通过 rsync 完成的,不幸的是 phing 不支持通过特殊任务 - 但使用 exec 总是可以的并且工作得很好。

最后,它节省了大量时间,我们能够使用一个命令来测试、打包和部署我们的应用程序(这为我们提供了 乔尔测试)。 没有它我就不想活下去。

请参阅 build.xml 代码

We use phing to deploy SemanticScuttle:

  • generate zip archive for distribution
  • create PEAR package
  • upload zip to SourceForge
  • update the PEAR channel with the new package file
  • render reStructuredText documentation into html files and uploading them. Currently with exec but I'm on the way writing a separate task for it.

Uploading the zip file and the channel is done via rsync, which is unfortunately not supported by phing through a special task - but using exec is always possible and works nicely.

In the end, it saves a lot of time and we're able to test, package and deploy our app with one single command (which gives us another point on the Joel Test). I would not want to live without it.

See the build.xml code.

慕巷 2024-07-12 05:51:50

对我来说,令人信服的答案是 phing 理解 PHP 类路径。 蚂蚁没有。 我不想让 ant build.xml 充满 exec 命令。 我碰巧主要是一名 java 程序员,并且仍在使用 phing。 这是完成这项工作的最佳工具。

The compelling answer for me is that phing understands PHP classpaths. Ant doesn't. I don't want to have an ant build.xml full of exec commands. I happen to be primarily a java programmer and still use phing. It's the best tool for the job.

栖迟 2024-07-12 05:51:50

我从 Ant 迁移到 Phing “只是因为”它是 PHP。 我使用它从不同的 subversion 存储库导出、复制内容、构建不同的安装包等,所有这些都使用 20 行可重用的 xml 文件和包含项目特定内容的配置文件。 我不可能用自定义脚本那么快地做到这一点。 我还计划集成 api 文档生成和单元测试。 爱它!

I moved from Ant to Phing 'just because' it's PHP. I use it to export from different subversion repositories, copy stuff around, build different installation packages, etc all of that with a 20 line reusable xml file and a config file with project specific stuff. No way I could do it that fast with a custom script. I also plan to integrate api documentation generation and unit tests. Love it!

梦境 2024-07-12 05:51:50

来自 Federico Cargnelutti 的 博客帖子

功能包括文件转换(例如令牌
替换、XSLT 转换、
Smarty 模板转换),文件
系统操作、交互构建
支持、SQL执行、CVS
操作、创建 PEAR 的工具
包等等。

当然,您可以为上述所有内容编写自定义脚本。 然而,使用像 Phing 这样的专门构建工具可以给您带来许多好处。 您将使用经过验证的框架,因此不必担心设置“基础设施”,您可以专注于需要编写的代码。 使用 Phing 还将使新成员加入您的团队时变得更容易,如果他们以前使用过 Phing(或 Ant,这是 Phing 的基础),他们将能够了解正在发生的事情。

From Federico Cargnelutti's blog post:

Features include file transformations (e.g. token
replacement, XSLT transformation,
Smarty template transformations), file
system operations, interactive build
support, SQL execution, CVS
operations, tools for creating PEAR
packages, and much more.

Of course you could write custom scripts for all of the above. However, using a specialized build tool like Phing gives you a number of benefits. You'll be using a proven framework so instead of having to worry about setting up "infrastructure" you can focus on the code you need to write. Using Phing will also make it easier for when new members join your team, they'll be able to understand what is going on if they've used Phing (or Ant, which is what Phing is based on) before.

奢望 2024-07-12 05:51:50

我没有看到任何令人信服的理由去使用 phing。 我的意思是,PHP 程序员是否应该“仅仅因为”用 PHP 编写 Eclipse 插件更容易而尝试重写 Eclipse? 我不这么认为。

Ant 有更好的文档,包括一些不错的 o'reilly 书籍,并且它在 Java 领域已经很成熟,因此您可以避免以下问题:(1)“我们还没有将功能 X 复制到 phing”和 (2) 风险phing 项目即将终止。 这里一篇关于配置 PHPUnit 以与 ant 和 Cruisecontrol 配合使用的文章:没那么难。 并且您可以免费获得 Eclipse 集成。

祝你好运!

I don't see any compelling reason to go with phing. I mean, should PHP programmers attempt a rewrite of Eclipse "just because" it might somehow be easier to write Eclipse plugins in PHP? I don't think so.

Ant has better documentation, including some nice o'reilly books, and it's well-established in the Java universe, so you avoid the problems of (1) "we haven't copied feature X to phing yet" and (2) the risk of the phing project going dead. Here's an article on configuring PHPUnit to work with ant and cruisecontrol: not that hard. And you get eclipse integration for free.

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文