-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description <!-- Please do not leave this blank This PR [adds/removes/fixes/replaces] the [feature/bug/etc]. --> Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. ## What type of PR is this? (check all applicable) - [x] 🍕 Feature - [x] 🐛 Bug Fix - [x] 📝 Documentation Update - [ ] 🎨 Style - [ ] 🧑💻 Code Refactor - [ ] 🔥 Performance Improvements - [x] ✅ Test - [ ] 🤖 Build - [ ] 🔁 CI - [ ] 📦 Chore (Release) - [ ] ⏩ Revert ## Related Tickets & Documents <!-- Please use this format link issue numbers: Fixes #123 https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword --> - Related Issue #633 ## Added tests? - [x] 👍 yes - [ ] 🙅 no, because they aren't needed - [ ] 🙋 no, because I need help - [ ] Separate ticket for tests # (issue/pr) Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration ## Added to documentation? - [ ] 📜 README.md - [ ] 🙅 no documentation needed ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Uwe Krueger <[email protected]>
- Loading branch information
1 parent
b60bac1
commit 137c796
Showing
30 changed files
with
667 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package npm | ||
|
||
import ( | ||
"github.com/open-component-model/ocm/pkg/listformat" | ||
) | ||
|
||
var usage = ` | ||
This repository type can be used to access credentials stored in a file | ||
following the NPM npmrc format (~/.npmrc). It take into account the | ||
credentials helper section, also. If enabled, the described | ||
credentials will be automatically assigned to appropriate consumer ids. | ||
` | ||
|
||
var format = `The repository specification supports the following fields: | ||
` + listformat.FormatListElements("", listformat.StringElementDescriptionList{ | ||
"npmrcFile", "*string*: the file path to a NPM npmrc file", | ||
"propagateConsumerIdentity", "*bool*(optional): enable consumer id propagation", | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package npm | ||
|
||
import ( | ||
"github.com/open-component-model/ocm/pkg/contexts/credentials/cpi" | ||
"github.com/open-component-model/ocm/pkg/contexts/datacontext" | ||
) | ||
|
||
type Cache struct { | ||
repos map[string]*Repository | ||
} | ||
|
||
func createCache(_ datacontext.Context) interface{} { | ||
return &Cache{ | ||
repos: map[string]*Repository{}, | ||
} | ||
} | ||
|
||
func (r *Cache) GetRepository(ctx cpi.Context, name string, prop bool) (*Repository, error) { | ||
var ( | ||
err error = nil | ||
repo *Repository | ||
) | ||
if name != "" { | ||
repo = r.repos[name] | ||
} | ||
if repo == nil { | ||
repo, err = NewRepository(ctx, name, prop) | ||
if err == nil { | ||
r.repos[name] = repo | ||
} | ||
} | ||
return repo, err | ||
} |
Oops, something went wrong.