Skip to content

Commit 0e1da23

Browse files
authored
Merge pull request #41 from gnodet/fix-tool-manager-singleton
2 parents 50494b2 + 00c2840 commit 0e1da23

36 files changed

+2528
-2402
lines changed

.github/workflows/deploy-website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
echo "SITE_URL=$SITE_URL" >> $GITHUB_ENV
3939
echo "SITE_PATH=$SITE_PATH" >> $GITHUB_ENV
4040
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY SITE_DIR=$SITE_DIR SITE_URL=$SITE_URL SITE_PATH=$SITE_PATH"
41-
QUARKUS_ROQ_GENERATOR_BATCH=true ./mvx website build \
41+
QUARKUS_ROQ_GENERATOR_BATCH=true ./mvx website-build \
4242
-Dquarkus.http.root-path=$SITE_PATH \
4343
-Dsite.url=$SITE_URL
4444

.mvx/config.json5

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444

4545
build: {
4646
description: "Build mvx binary with platform-optimized settings",
47-
script: "go build -o mvx-dev . && echo 'Installing global development binary...' && mkdir -p ~/.mvx/dev && cp mvx-dev ~/.mvx/dev/mvx && chmod +x ~/.mvx/dev/mvx && echo '✅ Global development binary installed at ~/.mvx/dev/mvx' && echo ' All projects using mvxVersion=dev will now use this binary automatically'",
48-
override: true
47+
script: "go build -o mvx-dev . && echo 'Installing global development binary...' && mkdir -p ~/.mvx/dev && cp mvx-dev ~/.mvx/dev/mvx && chmod +x ~/.mvx/dev/mvx && echo '✅ Global development binary installed at ~/.mvx/dev/mvx' && echo ' All projects using mvxVersion=dev will now use this binary automatically'"
4948
},
5049

5150
fmt: {
@@ -60,25 +59,22 @@
6059

6160
test: {
6261
description: "Run all tests",
63-
script: "go test -v ./...",
64-
override: true
62+
script: "go test -v ./..."
6563
},
6664

6765
"test-integration": {
6866
description: "Run integration tests",
6967
script: "cd test && go test -v -timeout=5m ./..."
7068
},
7169

72-
"website build": {
70+
"website-build": {
7371
description: "Build the website using ROQ",
74-
script: "cd website && QUARKUS_ROQ_GENERATOR_BATCH=true mvn clean package quarkus:run -DskipTests --no-transfer-progress",
75-
override: true
72+
script: "cd website && QUARKUS_ROQ_GENERATOR_BATCH=true mvn clean package quarkus:run -DskipTests --no-transfer-progress"
7673
},
7774

78-
"website serve": {
75+
"website-serve": {
7976
description: "Serve the website using ROQ dev mode",
80-
script: "cd website && mvn quarkus:dev -Dquarkus.http.port=8081 --no-transfer-progress",
81-
override: true
77+
script: "cd website && mvn quarkus:dev -Dquarkus.http.port=8081 --no-transfer-progress"
8278
},
8379

8480
"build-all": {
@@ -93,8 +89,7 @@
9389

9490
clean: {
9591
description: "Clean build artifacts",
96-
script: "rm -f mvx-dev && rm -rf dist/ && rm -f ~/.mvx/dev/mvx && echo '🧹 Cleaned local and global dev binaries'",
97-
override: true
92+
script: "rm -f mvx-dev && rm -rf dist/ && rm -f ~/.mvx/dev/mvx && echo '🧹 Cleaned local and global dev binaries'"
9893
},
9994

10095
changelog: {

.mvx/mvx.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ mvxVersion=0.8.0
1313
# Checksum validation (future feature)
1414
# mvxChecksumUrl=https://github.com/gnodet/mvx/releases/download/v{version}/checksums.txt
1515
# mvxValidateChecksum=true
16+

cmd/build.go

Lines changed: 0 additions & 90 deletions
This file was deleted.

cmd/mvn.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ Examples:
114114
if err != nil {
115115
return err
116116
}
117-
mvnExe := filepath.Join(bin, "mvn")
118-
if isWindows() {
119-
mvnExe += ".cmd"
120-
}
117+
mvnExe := filepath.Join(bin, mvnTool.GetBinaryName())
121118

122119
c := exec.Command(mvnExe, mavenArgs...)
123120
c.Dir = projectRoot

cmd/root.go

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ func init() {
9292
// Add subcommands
9393
rootCmd.AddCommand(versionCmd)
9494
rootCmd.AddCommand(setupCmd)
95-
rootCmd.AddCommand(buildCmd)
96-
rootCmd.AddCommand(testCmd)
9795
rootCmd.AddCommand(initCmd)
9896
rootCmd.AddCommand(updateBootstrapCmd)
9997
}
@@ -247,17 +245,13 @@ func setupGlobalEnvironment(cfg *config.Config, manager *tools.Manager) error {
247245
resolvedConfig := toolConfig
248246
resolvedConfig.Version = resolvedVersion
249247

250-
// Check if tool is installed
251-
if tool.IsInstalled(resolvedVersion, resolvedConfig) {
252-
binPath, err := tool.GetPath(resolvedVersion, resolvedConfig)
253-
if err != nil {
254-
printVerbose("Skipping tool %s: failed to get bin path: %v", toolName, err)
255-
continue
256-
}
248+
// Try to get tool path - if successful, tool is installed and we can add it to PATH
249+
binPath, err := tool.GetPath(resolvedVersion, resolvedConfig)
250+
if err != nil {
251+
printVerbose("Tool %s version %s is not installed or path unavailable, skipping PATH setup: %v", toolName, resolvedVersion, err)
252+
} else {
257253
printVerbose("Adding %s bin path to global PATH: %s", toolName, binPath)
258254
pathDirs = append(pathDirs, binPath)
259-
} else {
260-
printVerbose("Tool %s version %s is not installed, skipping PATH setup", toolName, resolvedVersion)
261255
}
262256
}
263257

@@ -353,8 +347,9 @@ func addCustomCommands() error {
353347

354348
// Add each custom command as a top-level command
355349
for cmdName, cmdConfig := range cfg.Commands {
356-
// Skip built-in commands unless they have override flag
357-
if isBuiltinCommand(cmdName) && !cmdConfig.Override {
350+
// Skip commands with spaces (they're subcommands, handled by their parent command)
351+
if strings.Contains(cmdName, " ") {
352+
printVerbose("Skipping custom command with space: %s (handled by parent command)", cmdName)
358353
continue
359354
}
360355

@@ -469,21 +464,3 @@ Examples:
469464
},
470465
}
471466
}
472-
473-
// isBuiltinCommand checks if a command name is a built-in mvx command
474-
func isBuiltinCommand(commandName string) bool {
475-
builtinCommands := map[string]bool{
476-
"build": true,
477-
"test": true,
478-
"setup": true,
479-
"init": true,
480-
"tools": true,
481-
"version": true,
482-
"help": true,
483-
"completion": true,
484-
"info": true,
485-
"update-bootstrap": true,
486-
"run": true, // Don't override the run command itself
487-
}
488-
return builtinCommands[commandName]
489-
}

cmd/run.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ func runCustomCommand(commandName string, args []string) error {
142142
// Create executor
143143
exec := executor.NewExecutor(cfg, manager, projectRoot)
144144

145-
// Validate command exists and requirements are met
146-
if err := exec.ValidateCommand(commandName); err != nil {
147-
return err
148-
}
149-
150-
// Execute command
145+
// Execute command (tools are auto-installed via EnsureTool)
151146
return exec.ExecuteCommand(commandName, args)
152147
}

cmd/test.go

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)