Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #258 from ZupIT/feature/repo
Browse files Browse the repository at this point in the history
Feature/repo
  • Loading branch information
Marcos Guimarães authored Jul 8, 2020
2 parents 829f6ec + 3680c1b commit b55f560
Show file tree
Hide file tree
Showing 116 changed files with 1,029 additions and 10,589 deletions.
48 changes: 37 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ jobs:
- run:
name: Running Functional tests for single
command: |
go mod download
make functional-test-single
unix_functional_test_team:
Expand All @@ -189,7 +188,6 @@ jobs:
- run:
name: Running Functional tests for team
command: |
go mod download
make functional-test-team
windows_functional_test_team:
Expand Down Expand Up @@ -234,7 +232,6 @@ jobs:
command: |
go test -v -count=1 -p 1 (go list ./functional/single/... | grep -v vendor/)
build:
executor: ritchie-executor
environment:
Expand All @@ -246,7 +243,6 @@ jobs:
name: Running build
command: |
. ./.circleci/scripts/version.sh
go mod download
make build-circle
- run:
name: Persist version file
Expand All @@ -264,6 +260,26 @@ jobs:
path: *TEST_RESULTS_DIR
- store_artifacts:
path: *TEST_RESULTS_DIR

sign-bin:
executor: ubuntu-executor
environment:
<<: *ENVIRONMENT
steps:
- checkout
- attach_workspace:
at: /workspace/dist
- run:
name: Install osslsigncode
command: |
sudo apt-get update -y
sudo apt-get install -y osslsigncode
osslsigncode sign -pkcs12 packaging/windows/ZupIT.pfx -pass "$SIGN_CODE" -n "Ritchie CLI ZupIT" -h sha256 -t http://timestamp.digicert.com/ -in dist/installer/ritchiecliteamzup.msi -out dist/installer/ritchiecliteamzup.msi
- persist_to_workspace:
root: dist
paths:
- installer

delivery:
executor: delivery-executor
environment:
Expand Down Expand Up @@ -504,14 +520,19 @@ workflows:
<<: *FILTERS_RELEASE
requires:
- build-code
- delivery:
name: delivery
- sign-bin:
filters:
<<: *FILTERS_RELEASE
requires:
- win-package
- deb-package
- rpm-package
- win-package
- delivery:
name: delivery
filters:
<<: *FILTERS_RELEASE
requires:
- sign-bin
- release:
name: release-publish
filters:
Expand All @@ -535,9 +556,7 @@ workflows:
filters:
<<: *FILTERS_DELIVERY
requires:
- deb-package
- rpm-package
- win-package
- sign-bin
- deb-package:
filters:
<<: *FILTERS_DELIVERY
Expand All @@ -552,4 +571,11 @@ workflows:
filters:
<<: *FILTERS_DELIVERY
requires:
- build-code
- build-code
- sign-bin:
filters:
<<: *FILTERS_DELIVERY
requires:
- win-package
- rpm-package
- deb-package
2 changes: 1 addition & 1 deletion .circleci/scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

if expr "$CIRCLE_BRANCH" : 'qa' >/dev/null; then
export RELEASE_VERSION="${CIRCLE_BUILD_NUM}.0.0-qa.1"
export RELEASE_VERSION="1.0.0-qa"
elif expr "$CIRCLE_BRANCH" : '^release-.*' >/dev/null; then
export RELEASE_VERSION=$(echo "$CIRCLE_BRANCH" | cut -d '-' -f 2-)
elif expr "$CIRCLE_BRANCH" : '^nightly' >/dev/null; then
Expand Down
31 changes: 14 additions & 17 deletions cmd/single/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,28 @@ func buildCommands() *cobra.Command {
inputPassword := prompt.NewSurveyPassword()
inputList := prompt.NewSurveyList()
inputURL := prompt.NewSurveyURL()
inputMultiline := prompt.NewSurveyMultiline()

// deps
fileManager := stream.NewFileManager()
dirManager := stream.NewDirManager(fileManager)

treeGen := tree.NewGenerator(dirManager, fileManager)
repoAdder := repo.NewAdder(ritchieHomeDir, http.DefaultClient, treeGen, dirManager, fileManager)
repoLister := repo.NewLister(ritchieHomeDir, fileManager)

sessionManager := session.NewManager(ritchieHomeDir)
workspaceManager := workspace.NewChecker(ritchieHomeDir)
ctxFinder := rcontext.NewFinder(ritchieHomeDir)
ctxSetter := rcontext.NewSetter(ritchieHomeDir, ctxFinder)
ctxRemover := rcontext.NewRemover(ritchieHomeDir, ctxFinder)
ctxFindSetter := rcontext.NewFindSetter(ritchieHomeDir, ctxFinder, ctxSetter)
ctxFindRemover := rcontext.NewFindRemover(ritchieHomeDir, ctxFinder, ctxRemover)
repoManager := repo.NewSingleRepoManager(ritchieHomeDir, http.DefaultClient, sessionManager)
repoLoader := repo.NewSingleLoader(cmd.CommonsRepoURL, repoManager)
sessionValidator := sesssingle.NewValidator(sessionManager)
passphraseManager := secsingle.NewPassphraseManager(sessionManager)
credSetter := credsingle.NewSetter(ritchieHomeDir, ctxFinder, sessionManager)
credFinder := credsingle.NewFinder(ritchieHomeDir, ctxFinder, sessionManager)
treeManager := tree.NewTreeManager(ritchieHomeDir, repoManager, api.SingleCoreCmds)
treeManager := tree.NewTreeManager(ritchieHomeDir, repoLister, api.SingleCoreCmds)
credSettings := credsingle.NewSingleSettings(fileManager)
autocompleteGen := autocomplete.NewGenerator(treeManager)
credResolver := envcredential.NewResolver(credFinder)
envResolvers := make(env.Resolvers)
Expand All @@ -92,9 +97,6 @@ func buildCommands() *cobra.Command {
defaultRunner := runner.NewDefaultRunner(defaultPreRunner, postRunner, inputManager)
dockerRunner := runner.NewDockerRunner(dockerPreRunner, postRunner, inputManager)

fileManager := stream.NewFileManager()
dirManager := stream.NewDirManager(fileManager)

formulaCreator := creator.NewCreator(treeManager, dirManager, fileManager)
formulaWorkspace := fworkspace.New(ritchieHomeDir, fileManager)
formulaBuilder := builder.New(ritchieHomeDir, dirManager, fileManager)
Expand All @@ -115,7 +117,7 @@ func buildCommands() *cobra.Command {
addCmd := cmd.NewAddCmd()
createCmd := cmd.NewCreateCmd()
deleteCmd := cmd.NewDeleteCmd()
initCmd := cmd.NewSingleInitCmd(inputPassword, passphraseManager, repoLoader)
initCmd := cmd.NewSingleInitCmd(inputPassword, passphraseManager)
listCmd := cmd.NewListCmd()
setCmd := cmd.NewSetCmd()
showCmd := cmd.NewShowCmd()
Expand All @@ -126,18 +128,15 @@ func buildCommands() *cobra.Command {
// level 2
setCredentialCmd := cmd.NewSingleSetCredentialCmd(
credSetter,
credSettings,
inputText,
inputBool,
inputList,
inputPassword,
inputMultiline)
inputPassword)
deleteCtxCmd := cmd.NewDeleteContextCmd(ctxFindRemover, inputBool, inputList)
setCtxCmd := cmd.NewSetContextCmd(ctxFindSetter, inputText, inputList)
showCtxCmd := cmd.NewShowContextCmd(ctxFinder)
addRepoCmd := cmd.NewAddRepoCmd(repoManager, inputText, inputURL, inputInt, inputBool)
deleteRepoCmd := cmd.NewDeleteRepoCmd(repoManager, inputList, inputBool)
listRepoCmd := cmd.NewListRepoCmd(repoManager)
updateRepoCmd := cmd.NewUpdateRepoCmd(repoManager)
addRepoCmd := cmd.NewAddRepoCmd(http.DefaultClient, repoAdder, inputText, inputPassword, inputURL, inputList, inputBool, inputInt)
autocompleteZsh := cmd.NewAutocompleteZsh(autocompleteGen)
autocompleteBash := cmd.NewAutocompleteBash(autocompleteGen)
autocompleteFish := cmd.NewAutocompleteFish(autocompleteGen)
Expand All @@ -149,11 +148,9 @@ func buildCommands() *cobra.Command {
autocompleteCmd.AddCommand(autocompleteZsh, autocompleteBash, autocompleteFish, autocompletePowerShell)
addCmd.AddCommand(addRepoCmd)
createCmd.AddCommand(createFormulaCmd)
deleteCmd.AddCommand(deleteRepoCmd, deleteCtxCmd)
listCmd.AddCommand(listRepoCmd)
deleteCmd.AddCommand(deleteCtxCmd)
setCmd.AddCommand(setCredentialCmd, setCtxCmd)
showCmd.AddCommand(showCtxCmd)
updateCmd.AddCommand(updateRepoCmd)
buildCmd.AddCommand(buildFormulaCmd)

formulaCmd := cmd.NewFormulaCommand(api.SingleCoreCmds, treeManager, defaultRunner, dockerRunner)
Expand Down
26 changes: 11 additions & 15 deletions cmd/team/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func buildCommands() *cobra.Command {
inputMultiline := prompt.NewSurveyMultiline()

// deps
fileManager := stream.NewFileManager()
dirManager := stream.NewDirManager(fileManager)

treeGen := tree.NewGenerator(dirManager, fileManager)
repoAdder := repo.NewAdder(ritchieHomeDir, http.DefaultClient, treeGen, dirManager, fileManager)
repoLister := repo.NewLister(ritchieHomeDir, fileManager)

sessionManager := session.NewManager(ritchieHomeDir)
workspaceManager := workspace.NewChecker(ritchieHomeDir)
ctxFinder := rcontext.NewFinder(ritchieHomeDir)
Expand All @@ -84,8 +91,6 @@ func buildCommands() *cobra.Command {
serverFindSetter := server.NewFindSetter(serverFinder, serverSetter)

httpClient := makeHttpClient(serverFinder)
repoManager := repo.NewTeamRepoManager(ritchieHomeDir, serverFinder, httpClient, sessionManager)
repoLoader := repo.NewTeamLoader(serverFinder, httpClient, sessionManager, repoManager)
sessionValidator := sessteam.NewValidator(sessionManager)
loginManager := secteam.NewLoginManager(
serverFinder,
Expand All @@ -95,7 +100,7 @@ func buildCommands() *cobra.Command {
credSetter := credteam.NewSetter(serverFinder, httpClient, sessionManager, ctxFinder)
credFinder := credteam.NewFinder(serverFinder, httpClient, sessionManager, ctxFinder)
credSettings := credteam.NewSettings(serverFinder, httpClient, sessionManager, ctxFinder)
treeManager := tree.NewTreeManager(ritchieHomeDir, repoManager, api.TeamCoreCmds)
treeManager := tree.NewTreeManager(ritchieHomeDir, repoLister, api.TeamCoreCmds)
autocompleteGen := autocomplete.NewGenerator(treeManager)
credResolver := envcredential.NewResolver(credFinder)
envResolvers := make(env.Resolvers)
Expand All @@ -111,9 +116,6 @@ func buildCommands() *cobra.Command {
defaultRunner := runner.NewDefaultRunner(defaultPreRunner, postRunner, inputManager)
dockerRunner := runner.NewDockerRunner(dockerPreRunner, postRunner, inputManager)

fileManager := stream.NewFileManager()
dirManager := stream.NewDirManager(fileManager)

formulaCreator := creator.NewCreator(treeManager, dirManager, fileManager)
formulaWorkspace := fworkspace.New(ritchieHomeDir, fileManager)
formulaBuilder := builder.New(ritchieHomeDir, dirManager, fileManager)
Expand Down Expand Up @@ -147,11 +149,10 @@ func buildCommands() *cobra.Command {
inputBool,
serverFindSetter,
loginManager,
repoLoader,
otpResolver,
)
listCmd := cmd.NewListCmd()
loginCmd := cmd.NewLoginCmd(inputText, inputPassword, loginManager, repoLoader, serverFinder, otpResolver)
loginCmd := cmd.NewLoginCmd(inputText, inputPassword, loginManager, serverFinder, otpResolver)
logoutCmd := cmd.NewLogoutCmd(logoutManager)
setCmd := cmd.NewSetCmd()
showCmd := cmd.NewShowCmd()
Expand All @@ -171,10 +172,7 @@ func buildCommands() *cobra.Command {
deleteCtxCmd := cmd.NewDeleteContextCmd(ctxFindRemover, inputBool, inputList)
setCtxCmd := cmd.NewSetContextCmd(ctxFindSetter, inputText, inputList)
showCtxCmd := cmd.NewShowContextCmd(ctxFinder)
addRepoCmd := cmd.NewAddRepoCmd(repoManager, inputText, inputURL, inputInt, inputBool)
deleteRepoCmd := cmd.NewDeleteRepoCmd(repoManager, inputList, inputBool)
listRepoCmd := cmd.NewListRepoCmd(repoManager)
updateRepoCmd := cmd.NewUpdateRepoCmd(repoManager)
addRepoCmd := cmd.NewAddRepoCmd(http.DefaultClient, repoAdder, inputText, inputPassword, inputURL, inputList, inputBool, inputInt)
autocompleteZsh := cmd.NewAutocompleteZsh(autocompleteGen)
autocompleteBash := cmd.NewAutocompleteBash(autocompleteGen)
autocompleteFish := cmd.NewAutocompleteFish(autocompleteGen)
Expand All @@ -186,11 +184,9 @@ func buildCommands() *cobra.Command {
autocompleteCmd.AddCommand(autocompleteZsh, autocompleteBash, autocompleteFish, autocompletePowerShell)
addCmd.AddCommand(addRepoCmd)
createCmd.AddCommand(createFormulaCmd)
deleteCmd.AddCommand(deleteRepoCmd, deleteCtxCmd)
listCmd.AddCommand(listRepoCmd)
deleteCmd.AddCommand(deleteCtxCmd)
setCmd.AddCommand(setCredentialCmd, setCtxCmd)
showCmd.AddCommand(showCtxCmd)
updateCmd.AddCommand(updateRepoCmd)
buildCmd.AddCommand(buildFormulaCmd)

formulaCmd := cmd.NewFormulaCommand(api.TeamCoreCmds, treeManager, defaultRunner, dockerRunner)
Expand Down
Binary file added packaging/windows/ZupIT.pfx
Binary file not shown.
9 changes: 5 additions & 4 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ var (

// Command type
type Command struct {
Parent string `json:"parent"`
Usage string `json:"usage"`
Help string `json:"help"`
Id string `json:"id"`
Parent string `json:"parent"`
Usage string `json:"usage"`
Help string `json:"help"`
Formula *Formula `json:"formula,omitempty"`
Repo string `json:"Repo,omitempty"`
Repo string `json:"Repo,omitempty"`
}

type Commands []Command
Expand Down
Loading

0 comments on commit b55f560

Please sign in to comment.