简体   繁体   English

安装和管理开源项目的最佳实践

[英]Best Practices for Setup and Management of an Open Source Project

Later this year I want to release a PHP framework that I've been working on as open source. 今年晚些时候,我想发布一个我一直在开源的PHP框架。 I do use source control (SVN), but it's on an extremely limited basis. 我确实使用了源代码控制(SVN),但它的使用非常有限。 I'm self-taught, I develop by myself and don't have the experience of working with large teams. 我是自学成才,我自己开发,没有与大型团队合作的经验。 I have some ideas about what can help make a project successful, but I'm fuzzy on some of the details. 关于什么可以帮助项目成功,我有一些想法,但我对一些细节很模糊。 Since it's not yet released, I want to do everything I can to set up the right infrastructure from the beginning. 由于它还没有发布,我想尽我所能从一开始就建立正确的基础设施。 What do I need to know in order to setup and manage a successful project? 为了设置和管理成功的项目,我需要知道什么?

Some ideas that I have to make it successful (beyond marketing it): 我必须使一些想法成功(除了营销之外):

  • Good documentation and tutorials 良好的文档和教程
  • Automated unit tests and builds to push update to the website 自动化单元测试和构建,以推动更新到网站
  • A clear roadmap 一个清晰的路线图
  • Bug Tracking integrated with the source control Bug跟踪与源代码管理集成
  • A style guide to keep the code consistent 用于保持代码一致的样式指南
  • A forum for the community to get support, share ideas, etc. 社区获得支持,分享想法等的论坛
  • A good example application built with the framework 用框架构建的一个很好的示例应用程序
  • A blog to keep the community informed 一个博客,让社区了解情况
  • Maintaining backwards compatibility wherever possible 尽可能保持向后兼容性

Some of my questions: 我的一些问题:

  • How do I setup and automate a one step submit-test-commit-generate API docs-push update to website process? 如何设置和自动化一步提交 - 测试 - 提交 - 生成API文档 - 推送更新到网站流程? Edit : Would Ant or Maven be good candidates for this? 编辑 :Ant或Maven会成为这个的好候选人吗? If so, do you know of any resources for setting up a PHP project using them? 如果是这样,您是否知道使用它们设置PHP项目的任何资源?
  • How do I handle (technically) submissions from other users? 如何处理(技术上)其他用户提交的内容? How can I ensure that those submissions must be approved before being integrated? 如何确保在整合之前必须批准这些提交?
  • What are some of the pitfalls that can be avoided in terms of the project community? 在项目社区方面可以避免哪些陷阱? I'd prefer to have it be as friendly and helpful as possible without a lot of drama. 我宁愿让它尽可能友好和乐于助人,没有太多的戏剧性。

I'd love to learn from your experience on any of these points. 我很乐意从你对这些方面的经验中学习。 If you think I'm missing anything big, please share that as well. 如果您认为我错过了任何重大内容,请分享。 Any resources (preferably geared toward a beginner) that you could point me towards would also be greatly appreciated. 您可以指向我的任何资源(最好是面向初学者)也会非常感激。

I'm just getting started in community projects, but I'll give you some advice on what I know. 我刚刚开始参与社区项目,但我会就你所知道的事情给你一些建议。

How do I setup and automate a one step submit-test-commit-generate API docs-push update to website process? 如何设置和自动化一步提交 - 测试 - 提交 - 生成API文档 - 推送更新到网站流程?

I've never implemented it as one process. 我从来没有将它作为一个过程实现。 You could just have a checklist, and possibly even create some scripts to do certain tasks. 你可以只有一个清单,甚至可能创建一些脚本来完成某些任务。 I've never worked with any source control that automates the uploading and such to be done by a script. 我从来没有使用任何自动上传的源代码控制,而是由脚本完成。 Most of the time, there is some web interaction to be involved. 大多数时候,都会涉及一些网络互动。

You don't want to push API changes until it's an official release. 在官方发布之前,您不希望推送API更改。

EDIT: Working Environment 编辑:工作环境

For PHP, most of the time, I either edit directly on the server and test it there, using a beta.example.com , or similar, before pushing to example.com. 对于PHP,大多数时候,我要么直接在服务器上进行编辑,然后使用beta.example.com或类似方法在那里进行测试,然后再推送到example.com。 You could also set up an web environment on your home PC (using XAMPP for Windows, or the standard LAMP installation on Linux). 您还可以在家用PC上设置Web环境(使用XAMPP for Windows,或Linux上的标准LAMP安装)。 You would probably just use a mirror of your repository here, so you'd do svn commit , or whichever is appropriate for the VCS or DVCS you choose. 您可能只是在这里使用存储库的镜像,因此您可以执行svn commit ,或者适合您选择的VCS或DVCS。

The fun part is testing this with different PHP versions. 有趣的部分是使用不同的PHP版本测试它。 I've not done this myself, but you could probably use a .htaccess file to run a different PHP binary in order to test it out. 我自己没有这样做,但是你可以使用.htaccess文件运行不同的PHP二进制文件来测试它。 I'm not really sure what the best option is for this is. 我不确定这是最好的选择。

I've not done much with API, as I've never created a library, but just doing a quick search I found http://www.phpdoc.org/ . 我没有做过很多API,因为我从来没有创建过一个库,但只是快速搜索我找到了http://www.phpdoc.org/ It looks like a mature project, so that might be a starting point. 它看起来像一个成熟的项目,所以这可能是一个起点。

As far as creating releases go, I generally create a script that only includes the files that are part of the distribution (it will filter out any VCS files, and anything that you don't want in the distributed file). 就创建版本而言,我通常创建一个脚本,该脚本仅包含作为发行版的一部分的文件(它将过滤掉任何VCS文件,以及您在分布式文件中不需要的任何内容)。 You could write a script around find on linux (which is what I do most of the time), or there may be other better options. 你可以在linux上find一个关于find的脚本(这是我大部分时间都在做的),或者可能还有其他更好的选择。

How do I handle (technically) submissions from other users? 如何处理(技术上)其他用户提交的内容? How can I ensure that those submissions must be approved before being integrated? 如何确保在整合之前必须批准这些提交?

This is mostly handled by the bug tracker, and limited access in the Version Control System. 这主要由错误跟踪器处理,并且在版本控制系统中受限制。 Usually, you, and the people you allow, can commit to the VCS. 通常,您和您允许的人可以提交VCS。 Other users can submit patches, but then you might have someone review the patch, test the patch, and commit. 其他用户可以提交补丁,但之后您可能会有人查看补丁,测试补丁并提交。 You could split these tasks up as a team, or assign a patch to one person and have them do it all. 您可以将这些任务拆分为一个团队,或者为一个人分配补丁并让他们全部完成。

What are some of the pitfalls that can be avoided in terms of the project community? 在项目社区方面可以避免哪些陷阱? I'd prefer to have it be as friendly and helpful as possible without a lot of drama. 我宁愿让它尽可能友好和乐于助人,没有太多的戏剧性。

I would just make sure to keep it as positive as possible with the project members and community. 我只想确保项目成员和社区尽可能保持积极态度。 There's going to be some disagreements, and it will drive a few people away, but as long as you have a stable product that meets the needs of most people, I think that's all that anyone can expect. 会有一些分歧,它会驱使一些人离开,但只要你有一个稳定的产品,满足大多数人的需求,我认为这是所有人都可以期待的。

One minor suggestion that's worked well for me: start using first-person plural pronouns, rather than singular ones. 一个小的建议,对我来说很有效:开始使用第一人称复数代词,而不是单代词。 That is, talk about "we" and "us" rather than "I" and "me." 也就是说,谈论“我们”和“我们”而不是“我”和“我”。 It encourages other people to participate when they feel like part of team, rather than when they feel like they're contributing your own self-aggrandizement. 它鼓励其他人在他们感觉自己是团队的一部分时参与,而不是当他们觉得他们正在贡献自己的自我强化时。

The most important thing you have to do is to attract users. 您必须做的最重要的事情是吸引用户。 Without users, you won't get any contributions and developers helping you out. 没有用户,您将无法获得任何贡献,开发人员会帮助您。 Because developers are users first, and then they decide to extend/fix something they use and might become contributors. 因为开发人员是用户的第一,然后他们决定扩展/修复他们使用的东西,并可能成为贡献者。

So to get users, you should consider 所以为了吸引用户,你应该考虑

  • describe what your framework does in one or two sentences at the top of your project page 在项目页面顶部的一两句话中描述您的框架所执行的操作
  • mention how your framework can be used and for what, what situations it is most useful for 提到你的框架是如何被使用的,以及它最有用的是什么情况
  • add a lot of examples on how to use it 添加了很多关于如何使用它的例子
  • mention whether your framework is stable, beta or alpha. 提一下你的框架是稳定的,beta还是alpha。 That's important because user need to know that before they start using it 这很重要,因为用户在开始使用之前需要知道这一点
  • also mention whether you want to keep improving it and keep working on it - most users don't want to use a framework that's abandoned (also keep in mind that a lot of users check your commits to see whether you really are working on it - if your last commit to the repository was months ago then you're not really working on it, so cheating isn't possible) 还要提一下你是否要继续改进它并继续努力 - 大多数用户不想使用被抛弃的框架(还要记住很多用户检查你的提交,看你是否真的在做它 - 如果您最近几次提交到存储库是在几个月前,那么您并没有真正开展工作,所以作弊是不可能的)

If you got all this, and people start submitting patches, you can use a patch tool to apply those to your source. 如果你得到了所有这些,并且人们开始提交补丁,你可以使用补丁工具将这些补丁工具应用到你的来源。 Depending on your version control system, you can either use the GNU patch, a diff/patch tool that comes with your version control or maybe even a GUI tool that helps you with this. 根据您的版本控制系统,您可以使用GNU补丁,版本控制附带的差异/补丁工具,甚至可以使用GUI工具来帮助您完成此操作。 SVN doesn't have a patch tool (yet), but 'svn diff' will create a patchfile which you can then apply with the GNU patch tool, or in case you're using TortoiseSVN, right-drag the patchfile to your working copy and have TortoiseMerge apply it for you. SVN没有补丁工具(但是),但'svn diff'将创建一个补丁文件,然后您可以使用GNU补丁工具,或者如果您正在使用TortoiseSVN,请将补丁文件右键拖动到您的工作副本并让TortoiseMerge为您应用它。

And on how to best deal with the community: 以及如何最好地与社区打交道:

  • answer questions in time, don't wait more than two or three days to answer questions 及时回答问题,不要等待两三天以上的回答问题
  • try to be nice, even with upset and angry people. 试着变得更好,即使有不安和愤怒的人。 Only if they keep bothering tell them to (still in a nice way if possible) go elsewhere 只有当他们一直困扰着告诉他们(如果可能的话,还是以一种很好的方式)去其他地方
  • always keep discussions about the project on a mailing list. 始终在邮件列表上继续讨论该项目。 You don't want to repeat the same discussions over and over again - if you have a mailing list, just point users to the archives before the discussion starts all over again 你不想一遍又一遍地重复同样的讨论 - 如果你有一个邮件列表,只需在讨论重新开始之前将用户指向存档

And you should watch the talk " How Open Source Projects Survive Poisonous People (And You Can Too) " - it's really good and tells you a lot on how to deal not just with 'poisonous people' but also how to deal with all people involved in your project. 而且你应该看一下“ 开源项目如何生存有毒人群(你也可以) ” - 这非常好,并且告诉你很多关于如何处理“有毒人”以及如何处理所有涉及的人在你的项目中。

我想补充一点,您应该让用户尽可能轻松地完成所有操作并修改代码 - 这些“高级用户”可以“转换”为开发人员或至少发送较小补丁的人。

Don't try to do it all yourself - for open source projects there are several hosting providers that solve most of the problems. 不要试图自己完成 - 对于开源项目,有几个托管服务提供商可以解决大多数问题。 I recommend codeplex or google code. 我推荐使用codeplex或谷歌代码。

Setting up build scripts will depend a certain amount on what platform you set up, but in general it's easy to add any tool you want into the script once you start using any sort of build script. 设置构建脚本在某种程度上取决于您设置的平台,但一般情况下,一旦开始使用任何类型的构建脚本,就可以轻松地将所需的任何工具添加到脚本中。

If you really need the one step process you describe, you need a build server. 如果您确实需要您描述的一步过程,则需要构建服务器。 I use TeamCity, which I have set up to watch for any changes in svn and trigger build/test whenever something is checked in. The build server will generally be able to perform any steps that you put into the build script. 我使用TeamCity,我已经设置了它来监视svn中的任何更改并在检查某些内容时触发构建/测试。构建服务器通常能够执行您在构建脚本中执行的任何步骤。

Read up on Git as an alternative to SVN 阅读Git作为SVN的替代方案

  • free public repository/bug tracker/wiki/fork-enabled community in Github (which hosts symfony and PHPUnit amongst others) Github中免费的公共存储库/ bug跟踪器/ wiki / fork-enabled社区(其中包含symfonyPHPUnit
  • " How do I handle (technically) submissions from other users? How can I ensure that those submissions must be approved before being integrated? " - with Git, pull what you/your closest team finds most interesting to the master branch 我如何处理(技术上)其他用户提交的内容?我如何确保在集成之前必须批准这些提交? ” - 使用Git,将你/你最亲密的团队最感兴趣的内容拉到主分支

Consistent API 一致的API

  • be inspired of other public API:s 受到其他公共API的启发:s
  • only change in major versions 只改变主要版本
  • guessable 可猜测

Interesting for both users & developers 对用户和开发人员都很有意思

  • clear goal (your roadmap - excellent) 明确目标(您的路线图 - 优秀)
  • useful, contra everything else available 有用,与其他一切可用
  • easy to use, but still not easy-enough-to-write/maintain-yourself 易于使用,但仍然不易于编写/维护自己

You could check out either Ant or Phing to build your project. 您可以查看Ant或Phing来构建您的项目。 Include CodeSniffer in the build and you'll save time checking for basic formatting errors/differences. 在构建中包含CodeSniffer ,您将节省检查基本格式错误/差异的时间。

These are all technical tips, about the soft part... treat humans with respect, a lot of interest and be overly excited about their contributions and make them feel that they're not wasting their time. 这些都是关于柔软部分的技术提示......尊重他人,非常感兴趣,对他们的贡献过于兴奋,让他们觉得他们不浪费时间。 That would appeal to me. 这对我很有吸引力。

Take a look at Karl Fogel's book on Producing Open Source Software . 看看Karl Fogel关于制作开源软件的书。 It probably has everything that you asked. 它可能包含你提出的所有问题。

You should also plan for engaging the community. 您还应该计划参与社区活动。 I'd recommend reading Jono Bacon's The Art of Community [ http://www.artofcommunityonline.org/] . 我建议阅读Jono Bacon的社区艺术[ http://www.artofcommunityonline.org/]

You have a great set of ideas to start. 你有很多想法可以开始。 You might have to start by trimming them down! 您可能必须从修剪它们开始! Ask yourself what's necessary for a first release. 问问自己第一次发布的必要条件。

  1. For automating the builds and tests, the scripting can be done with ant, maven or phing for PHP projects. 为了自动化构建和测试,脚本可以使用ant,maven或phing来完成PHP项目。

  2. You'll probably need a host so you can demo the product. 您可能需要一个主机,以便您可以演示该产品。 For PHP that is pretty easy to find. 对于很容易找到的PHP。

  3. You need an open source hosting provider-- especially github (but also google code, source forge, etc). 您需要一个开源托管服务提供商 - 尤其是github (还有谷歌代码,源代码伪造等)。 Github provides bug tracking, default licenses, blog and great mechanisms for accepting changes from the community. Github提供错误跟踪,默认许可,博客和接受社区变更的优秀机制。 Built on git, it facilitates distributed projects quite well. 它基于git,很好地促进了分布式项目。

Although it's good to have a one-step build and install in place, automating integration of others changes probably isn't important (or desirable) off the bat. 尽管一步构建和安装到位是件好事,但自动化其他更改的集成可能并不重要(或者不可取)。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM