Skip to content

Commit

Permalink
Use 2-digit year for ReaClassical version
Browse files Browse the repository at this point in the history
  • Loading branch information
chmaha committed Dec 14, 2024
1 parent b97437b commit f0b9495
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 30 deletions.
30 changes: 4 additions & 26 deletions Installers/ReaClassical-Windows-Go-Installer/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,33 +234,11 @@ func getReaperVersion() (string, error) {
}

func getReaClassicalMajorVersion() (string, error) {
// Fetch the content of the online file
resp, err := http.Get("https://raw.githubusercontent.com/chmaha/ReaClassical/main/ReaClassical/ReaClassical.lua")
if err != nil {
return "", err
}
defer resp.Body.Close()

// Read the body of the response
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}

// Define a regular expression pattern to extract the major version number
pattern := `@version\s*(\d+)\.\d+`

// Compile the regular expression
re := regexp.MustCompile(pattern)
// Get the current year and extract the last two digits
currentYear := time.Now().Year() % 100

// Find the major version number in the content
matches := re.FindStringSubmatch(string(body))
if len(matches) < 2 {
return "", fmt.Errorf("major version number not found")
}

// Return the major version number
return matches[1], nil
// Convert the year to a string and return it
return fmt.Sprintf("%02d", currentYear), nil
}

func replaceKeyInFile(filePath string) error {
Expand Down
5 changes: 3 additions & 2 deletions Installers/ReaClassical_Linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ check_internet
ver_txt="https://raw.githubusercontent.com/chmaha/ReaClassical/main/tested_reaper_ver.txt"
ver=$(curl -sS "$ver_txt" | awk '/====/{getline; print}')

rcver_txt="https://raw.githubusercontent.com/chmaha/ReaClassical/main/ReaClassical/ReaClassical.lua"
rcver=$(curl -sS "$rcver_txt" | awk '/@version/{split($2, version, "."); print version[1]}')
# rcver_txt="https://raw.githubusercontent.com/chmaha/ReaClassical/main/ReaClassical/ReaClassical.lua"
# rcver=$(curl -sS "$rcver_txt" | awk '/@version/{split($2, version, "."); print version[1]}')
rcver = $(date +%y)

major=$(echo $ver | awk -F. '{print $1}')
minor=$(echo $ver | awk -F. '{print $2}')
Expand Down
Binary file modified Installers/ReaClassical_Win32.exe
Binary file not shown.
Binary file modified Installers/ReaClassical_Win64.exe
Binary file not shown.
5 changes: 3 additions & 2 deletions Installers/ReaClassical_macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ check_internet
ver_txt="https://raw.githubusercontent.com/chmaha/ReaClassical/main/tested_reaper_ver.txt"
ver=$(curl -sS "$ver_txt" | awk '/====/{getline; print}')

rcver_txt="https://raw.githubusercontent.com/chmaha/ReaClassical/main/ReaClassical/ReaClassical.lua"
rcver=$(curl -sS "$rcver_txt" | awk '/@version/{split($2, version, "."); print version[1]}')
# rcver_txt="https://raw.githubusercontent.com/chmaha/ReaClassical/main/ReaClassical/ReaClassical.lua"
# rcver=$(curl -sS "$rcver_txt" | awk '/@version/{split($2, version, "."); print version[1]}')
rcver = $(date +%y)

rcfolder="ReaClassical_${rcver}"
arch=`uname -m`
Expand Down

0 comments on commit f0b9495

Please sign in to comment.