Documentation
¶
Overview ¶
Package tools provides utilities for managing external tools used by Fuego.
Package tools provides utility functions for the Fuego CLI.
Index ¶
- Constants
- func CompareVersions(v1, v2 string) int
- func DefaultInputPath() string
- func DefaultOutputPath() string
- func HasStyles() bool
- func HasStylesIn(dir string) bool
- func NeedsInitialBuild() bool
- type Asset
- type ReleaseInfo
- type TailwindCLI
- func (t *TailwindCLI) BinaryPath() string
- func (t *TailwindCLI) Build(input, output string) error
- func (t *TailwindCLI) BuildWithOutput(input, output string) (string, error)
- func (t *TailwindCLI) CacheDir() string
- func (t *TailwindCLI) EnsureInstalled() error
- func (t *TailwindCLI) GetTailwindVersion() (string, error)
- func (t *TailwindCLI) IsInstalled() bool
- func (t *TailwindCLI) Version() string
- func (t *TailwindCLI) Watch(input, output string) (*exec.Cmd, error)
- type Updater
- func (u *Updater) BackupCurrent() error
- func (u *Updater) BackupPath() string
- func (u *Updater) CacheDir() string
- func (u *Updater) CheckForUpdate() (*ReleaseInfo, bool, error)
- func (u *Updater) Download(asset *Asset) (string, error)
- func (u *Updater) ExtractBinary(archivePath string) (string, error)
- func (u *Updater) GetAssetForPlatform(release *ReleaseInfo) (*Asset, error)
- func (u *Updater) GetBackupVersion() string
- func (u *Updater) GetLatestRelease() (*ReleaseInfo, error)
- func (u *Updater) GetSpecificRelease(targetVersion string) (*ReleaseInfo, error)
- func (u *Updater) HasBackup() bool
- func (u *Updater) Install(newBinaryPath string) error
- func (u *Updater) LastCheckPath() string
- func (u *Updater) Rollback() error
- func (u *Updater) SaveLastCheckTime() error
- func (u *Updater) ShouldCheckForUpdate() bool
- func (u *Updater) VerifyChecksum(archivePath string, release *ReleaseInfo) error
Constants ¶
const ( // TailwindVersion is the version of Tailwind CSS to use TailwindVersion = "4.0.0" // DefaultCacheDir is the default cache directory for tools DefaultCacheDir = ".cache/fuego/bin" )
const ( GitHubOwner = "abdul-hamid-achik" GitHubRepo = "fuego" ReleasesAPIURL = "https://api.github.com/repos/%s/%s/releases" CheckIntervalHours = 24 // Cache update check for 24h )
Constants for the update system
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶ added in v0.9.1
CompareVersions compares two semantic versions Returns: -1 if v1 < v2, 0 if equal, 1 if v1 > v2 Handles "dev" as always being older than any release
func DefaultInputPath ¶
func DefaultInputPath() string
DefaultInputPath returns the default input CSS path
func DefaultOutputPath ¶
func DefaultOutputPath() string
DefaultOutputPath returns the default output CSS path
func HasStyles ¶
func HasStyles() bool
HasStyles checks if the project has a styles directory with input.css
func HasStylesIn ¶
HasStylesIn checks if the project has a styles directory with input.css in a specific directory
func NeedsInitialBuild ¶
func NeedsInitialBuild() bool
NeedsInitialBuild checks if output.css needs to be built
Types ¶
type Asset ¶ added in v0.9.1
type Asset struct {
Name string `json:"name"`
DownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
}
Asset represents a release asset
type ReleaseInfo ¶ added in v0.9.1
type ReleaseInfo struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"` // Release notes
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
PublishedAt time.Time `json:"published_at"`
Assets []Asset `json:"assets"`
}
ReleaseInfo represents a GitHub release
type TailwindCLI ¶
type TailwindCLI struct {
// contains filtered or unexported fields
}
TailwindCLI manages the Tailwind CSS standalone binary
func NewTailwindCLI ¶
func NewTailwindCLI() *TailwindCLI
NewTailwindCLI creates a new TailwindCLI manager
func NewTailwindCLIWithCacheDir ¶
func NewTailwindCLIWithCacheDir(cacheDir string) *TailwindCLI
NewTailwindCLIWithCacheDir creates a TailwindCLI with a custom cache directory
func (*TailwindCLI) BinaryPath ¶
func (t *TailwindCLI) BinaryPath() string
BinaryPath returns the path to the Tailwind binary
func (*TailwindCLI) Build ¶
func (t *TailwindCLI) Build(input, output string) error
Build runs Tailwind to compile CSS
func (*TailwindCLI) BuildWithOutput ¶
func (t *TailwindCLI) BuildWithOutput(input, output string) (string, error)
BuildWithOutput runs Tailwind and captures output
func (*TailwindCLI) CacheDir ¶
func (t *TailwindCLI) CacheDir() string
CacheDir returns the cache directory
func (*TailwindCLI) EnsureInstalled ¶
func (t *TailwindCLI) EnsureInstalled() error
EnsureInstalled downloads Tailwind if not already present
func (*TailwindCLI) GetTailwindVersion ¶
func (t *TailwindCLI) GetTailwindVersion() (string, error)
GetTailwindVersion attempts to get the version of an installed Tailwind binary
func (*TailwindCLI) IsInstalled ¶
func (t *TailwindCLI) IsInstalled() bool
IsInstalled checks if Tailwind is already installed
func (*TailwindCLI) Version ¶
func (t *TailwindCLI) Version() string
Version returns the Tailwind version
type Updater ¶ added in v0.9.1
type Updater struct {
CurrentVersion string
IncludePrerelease bool
// contains filtered or unexported fields
}
Updater handles self-updates for the Fuego CLI
func NewUpdater ¶ added in v0.9.1
func NewUpdater() *Updater
NewUpdater creates a new Updater instance
func (*Updater) BackupCurrent ¶ added in v0.9.1
BackupCurrent backs up the current binary before replacement
func (*Updater) BackupPath ¶ added in v0.9.1
BackupPath returns the path to the backup binary
func (*Updater) CacheDir ¶ added in v0.9.1
CacheDir returns the cache directory path (~/.cache/fuego)
func (*Updater) CheckForUpdate ¶ added in v0.9.1
func (u *Updater) CheckForUpdate() (*ReleaseInfo, bool, error)
CheckForUpdate checks GitHub for newer releases Returns: (latestRelease, hasUpdate, error)
func (*Updater) Download ¶ added in v0.9.1
Download downloads the release asset to a temp file Returns the path to the downloaded archive
func (*Updater) ExtractBinary ¶ added in v0.9.1
ExtractBinary extracts the fuego binary from the downloaded archive Returns the path to the extracted binary
func (*Updater) GetAssetForPlatform ¶ added in v0.9.1
func (u *Updater) GetAssetForPlatform(release *ReleaseInfo) (*Asset, error)
GetAssetForPlatform finds the correct asset for current OS/arch
func (*Updater) GetBackupVersion ¶ added in v0.9.1
GetBackupVersion tries to get the version of the backup binary
func (*Updater) GetLatestRelease ¶ added in v0.9.1
func (u *Updater) GetLatestRelease() (*ReleaseInfo, error)
GetLatestRelease fetches the latest release (for direct calls)
func (*Updater) GetSpecificRelease ¶ added in v0.9.1
func (u *Updater) GetSpecificRelease(targetVersion string) (*ReleaseInfo, error)
GetSpecificRelease fetches a specific version
func (*Updater) Install ¶ added in v0.9.1
Install installs the new binary, replacing the current one
func (*Updater) LastCheckPath ¶ added in v0.9.1
LastCheckPath returns the path to the last check timestamp file
func (*Updater) SaveLastCheckTime ¶ added in v0.9.1
SaveLastCheckTime saves the current time as last check
func (*Updater) ShouldCheckForUpdate ¶ added in v0.9.1
ShouldCheckForUpdate returns true if enough time has passed since last check
func (*Updater) VerifyChecksum ¶ added in v0.9.1
func (u *Updater) VerifyChecksum(archivePath string, release *ReleaseInfo) error
VerifyChecksum verifies the downloaded archive against checksums.txt