mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-20 12:47:35 +00:00
ForEach method for repositories.
This commit is contained in:
Vendored
+7
@@ -267,3 +267,10 @@ func (collection *RemoteRepoCollection) ByName(name string) (*RemoteRepo, error)
|
|||||||
}
|
}
|
||||||
return nil, fmt.Errorf("mirror with name %s not found", name)
|
return nil, fmt.Errorf("mirror with name %s not found", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ForEach runs method for each repository
|
||||||
|
func (collection *RemoteRepoCollection) ForEach(handler func(*RemoteRepo)) {
|
||||||
|
for _, r := range collection.list {
|
||||||
|
handler(r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+9
@@ -109,6 +109,15 @@ func (s *RemoteRepoCollectionSuite) TestAddByName(c *C) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *RemoteRepoCollectionSuite) TestForEach(c *C) {
|
||||||
|
repo, _ := NewRemoteRepo("yandex", "http://mirror.yandex.ru/debian/", "squeeze", []string{"main"}, []string{})
|
||||||
|
s.collection.Add(repo)
|
||||||
|
|
||||||
|
count := 0
|
||||||
|
s.collection.ForEach(func(*RemoteRepo) { count++ })
|
||||||
|
c.Assert(count, Equals, 1)
|
||||||
|
}
|
||||||
|
|
||||||
const exampleReleaseFile = `Origin: LP-PPA-agenda-developers-daily
|
const exampleReleaseFile = `Origin: LP-PPA-agenda-developers-daily
|
||||||
Label: Agenda Daily Builds
|
Label: Agenda Daily Builds
|
||||||
Suite: precise
|
Suite: precise
|
||||||
|
|||||||
Reference in New Issue
Block a user