从存储库中提取代码后,如何自动执行依赖项安装? [英] How do I automate dependency installation after pulling code from repository?
问题描述
我的同事和我开发了一个小型Python应用程序。我们使用Vagrant来设置开发环境。
My collegue and I develop a small Python application. We use Vagrant to set up development environments.
假设我的同事在应用程序中引入了新功能。 Feature的实现需要一个新的python依赖项(第三方软件包),并且依赖项本身需要一些系统库。如果我没有仔细阅读所有拉入的提交,我可能会错过,因为在运行项目之前必须先安装一些系统库。
Suppose my collegue introduces a new feature into the application. Feature's implementation requires a new python dependency (3rd party package) and the dependency itself needs some system libraries. If I do not read through all pulled commits carefully I can miss, that some systems libraries have to be installed prior running the project.
我们当然会更新 Vagrantfile
以在配置期间安装此类非python依赖项,因此,如果有人克隆了项目的存储库并会导致无所事事
,他将获得一个完全正常的开发环境,但是我应该怎么做才能在现有环境中自动进行更新?
Of course we update Vagrantfile
to install such non-python dependencies during provisioning, so if someone clones project's repository and issues vagrant up
he will get a fully working development environment, but what shoud I do to automate updates in my existing environment?
我们应该如何指示添加了新的依赖项(python或非python),我们需要通过触发特定命令来安装它?
How should we indicate, that a new dependency (python or non-python) was added and we need to install it by firing a specific command?
UPD 我可以尝试运行该应用程序,如果遇到任何错误,这是重新配置我的无用信息框的标志,但是对我来说测试一个手动功能并稍后运行配置脚本
UPD I can try and run the application and if I encounter any errors it is a sign to reprovision my vagrant box, but it seems tedious to me to test a feature by hands and run provisioning scripts later
推荐答案
我也遇到了Ruby。我们使用了Bundler,它是Ruby的依赖项管理系统。如果我输入新代码,然后运行它并得到时髦的异常消息,说明缺少某些依赖项,我就知道该是从命令行进行捆绑安装
的时候了。您的问题的解决方案是相同的。如果运行代码并收到错误消息,说明缺少依赖项,则对该异常的默认响应应为在命令行上无所事事
,然后重试。
I ran into this with Ruby as well. We used Bundler, which is a dependency management system for Ruby. If I pulled in new code, ran it and got funky exceptions saying that a certain dependency was missing, I just knew it was time for a bundle install
from the command line. The solution to your problem is the same. If you run the code and get errors saying a dependency is missing, your default response to that exception should be to vagrant up
on the command line, and try again.
禁止这样做,向您的队友发送一封有关新的或更新的依赖关系的说明的电子邮件是一个不错的方法,特别是如果无所事事
不足以解决缺少或不正确的依赖关系。
Barring that, sending an email to your teammates with instructions about the new or updated dependency is a good way to go, especially if a vagrant up
is insufficient to resolve the missing or incorrect dependency.
这篇关于从存储库中提取代码后,如何自动执行依赖项安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!