Composer.json获取最新的包版本和

时间:2015-12-10 12:33:27

标签: composer-php

对于每个新项目,我想:

  • 获取composer.json
  • 中所有软件包的最新版本
  • 一旦我拥有它们,我就不再想要获得最新版本 - 只是第一次运行的版本。

我知道我可以手动指定packagist.org的最新版本,但理想情况下我喜欢这种自动化。

我希望这是有道理的。

由于

2 个答案:

答案 0 :(得分:3)

  1. 最新套餐:
  2. Sub Utility() Dim objIE As Object, htmldoc As Object, data, i As Long, lrow As Long Dim TinNo As String Cells(1, 2).Select Range(Selection, Selection.End(xlDown)).Select lrow = Selection.Count For i = 1 To lrow Cells(i, 2) = cleartext(Cells(i, 2).Value) On Error Resume Next Next Set objIE = CreateObject("InternetExplorer.Application") With objIE .Navigate "http://mahavat.gov.in/Tin_Search/Tinsearch.jsp" Do While .readyState <> 4: DoEvents: Loop Set TIN = .document.getelementsbyname("tin") Set htmldoc = CreateObject("HTMLfile") 'data = Range("B1:G" & lrow) On Error Resume Next For i = 1 To lrow Set TIN = .document.getelementsbyname("tin") Cells(i, 2).Select If Not IsError(Cells(i, 2)) Then TIN.Item(0).Value = Cells(i, 2) .document.getElementById("Submit").Click Do While .Busy Or .readyState <> 4: DoEvents: Loop htmldoc.body.innerhtml = objIE.document.body.innerhtml temp = Trim(Split(htmldoc.getElementsByTagName("Table")(14).innertext, Cells(i, 2))(1)) If Err.Number <> 0 Then .Navigate "http://mahavat.gov.in/Tin_Search/Tinsearch.jsp" Do While .Busy Or .readyState <> 4: DoEvents: Loop Err.Clear Cells(i, 3) = "Invelid TIN(Shl'd Start with 27,Totl 12 Chr)" Cells(i, 4) = "Invelid TIN" Else Cells(i, 3) = Mid(temp, InStrRev(temp, " ") + 1, Len(temp)) Cells(i, 4) = Trim(Split(temp, Cells(i, 3))(0)) End If End If Next End With End Sub Function cleartext(inputstring As String) As String Dim onlynumbers As String onlynumbers = OnlyNums(inputstring) 'MsgBox onlynumbers onlynumbers = Mid(onlynumbers, InStr(1, onlynumbers, "27"), 11) & "V" 'MsgBox onlynumbers If Len(onlynumbers) < 12 Then cleartext = CVErr(xlErrValue) End If cleartext = onlynumbers End Function Function OnlyNums(sWord As String) As String Dim sChar As String Dim x As Integer Dim sTemp As String sTemp = "" For x = 1 To Len(sWord) sChar = Mid(sWord, x, 1) If Asc(sChar) >= 48 And _ Asc(sChar) <= 57 Then sTemp = sTemp & sChar End If Next OnlyNums = sTemp End Function

    1. 安装此软件包后,composer会将所有信息(和版本)转储到 composer.lock 。请勿删除此文件,也不要使用 composer update 。 总是使用 composer install ,因为这会迫使作曲家查看composer.lock文件中的包版本

答案 1 :(得分:0)

运行composer require vendor/package将向packagist.org咨询最新发布的版本,并添加最新版本和版本要求以便稍后获得此版本和兼容更新。

这将仅安装稳定版本。

初始安装后,您有两个选择:

  1. composer install将再次安装以前找到的软件包。
  2. composer update将查找符合版本要求的更新包。
  3. 永远不要无人看管update。开发人员应该有意识地运行它,然后运行测试套件以确定一切是否仍然有效(或者如果可用的话,持续集成作业会执行)。特别是在部署到生产时仅运行install