๐Ÿ“ฆ mattbalvin / kcap

๐Ÿ“„ install.ps1 ยท 95 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95# Remote Window Controller Installation Script
# PowerShell version for Windows

Write-Host "Installing Remote Window Controller with mise and uv..." -ForegroundColor Green
Write-Host ""

# Check if mise is installed
try {
    $miseVersion = mise --version 2>$null
    if ($LASTEXITCODE -eq 0) {
        Write-Host "โœ“ mise found: $miseVersion" -ForegroundColor Green
    } else {
        throw "mise not found"
    }
} catch {
    Write-Host "mise is not installed. Installing mise..." -ForegroundColor Yellow
    try {
        Invoke-RestMethod https://mise.jdx.dev/install.ps1 | Invoke-Expression
        Write-Host "โœ“ mise installed successfully!" -ForegroundColor Green
        Write-Host "Please restart your terminal and run this script again." -ForegroundColor Yellow
        Read-Host "Press Enter to exit"
        exit 0
    } catch {
        Write-Host "โœ— Error: Failed to install mise" -ForegroundColor Red
        Write-Host "Please install mise manually from https://mise.jdx.dev/getting-started/installation/" -ForegroundColor Yellow
        Read-Host "Press Enter to exit"
        exit 1
    }
}

# Install Python and tools with mise
Write-Host "Installing Python and tools with mise..." -ForegroundColor Yellow
try {
    mise install
    if ($LASTEXITCODE -eq 0) {
        Write-Host "โœ“ mise install completed successfully!" -ForegroundColor Green
    } else {
        throw "mise install failed"
    }
} catch {
    Write-Host "โœ— Error: Failed to install tools with mise" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit 1
}

# Check if uv is installed
try {
    $uvVersion = uv --version 2>$null
    if ($LASTEXITCODE -eq 0) {
        Write-Host "โœ“ uv found: $uvVersion" -ForegroundColor Green
    } else {
        throw "uv not found"
    }
} catch {
    Write-Host "uv is not installed. Installing uv with mise..." -ForegroundColor Yellow
    try {
        mise use uv@latest
        Write-Host "โœ“ uv installed successfully!" -ForegroundColor Green
    } catch {
        Write-Host "โœ— Error: Failed to install uv" -ForegroundColor Red
        Write-Host "Please install uv manually from https://docs.astral.sh/uv/getting-started/installation/" -ForegroundColor Yellow
        Read-Host "Press Enter to exit"
        exit 1
    }
}

# Install dependencies
Write-Host "Installing dependencies..." -ForegroundColor Yellow
try {
    uv sync
    if ($LASTEXITCODE -eq 0) {
        Write-Host "โœ“ Installation completed successfully!" -ForegroundColor Green
    } else {
        throw "uv sync failed"
    }
} catch {
    Write-Host "โœ— Error: Failed to install dependencies" -ForegroundColor Red
    Write-Host "Please check your internet connection and try again" -ForegroundColor Yellow
    Read-Host "Press Enter to exit"
    exit 1
}

Write-Host ""
Write-Host "Installation completed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "To test the installation, run:" -ForegroundColor Cyan
Write-Host "  uv run python test_installation.py" -ForegroundColor White
Write-Host ""
Write-Host "To run the application, run:" -ForegroundColor Cyan
Write-Host "  uv run python -m remote_window_controller" -ForegroundColor White
Write-Host "  or" -ForegroundColor White
Write-Host "  .\run.bat" -ForegroundColor White
Write-Host ""
Read-Host "Press Enter to exit"