Skip to content

Various PHP CLI scripts to automate tasks related to wowace.com.

Notifications You must be signed in to change notification settings

Adirelle/wowaceTools

Repository files navigation

wowaceUpdater.php

This script updates addons installed from the wowace and curseforge websites.

It requires PHP5 >= 5.2 and the following extension: cURL and ZIP.

(On debian-based linuxes, the packages php5-cli and php5-curl should be enough).

Global configuration

The global configuration is at the start of the script.

Installation path

$baseDir should point to the AddOns directory.

Backup path

$backupDir points to the directory where backup will be saved. By default this is "$baseDir/.backup". Old versions of the addons will be moved there. There is no pruning at this moment. All directories belonging to the same addon will be moved into a directory named “project-version”.

Default kind of installation

$defaultKind should be either "release", "beta" or "alpha". This used to selected the kind of release you want to install.

Per-addon configuration

The script will ignore any addon directory containing one of these file or directory :

  • .git
  • .svn
  • .freeze

Working data is stored in a file named “.addon-data.ini”. The typical values it contains are:

source="wowi" ; wowi=wowinterface, wowace=wowace/curseforge
name="Human-readable name"
project=15874 ; number for wowinterface, project slug for wowace
version="1.0-nolib" ; installed/detected version
kind="beta" ; optional, override default kind

If the script failed to identify an addon from the TOC headers, you could provide such file with at least the name, the project code and the source.

UpdateLocalization.php

This script perform 3 tasks related to localization:

  1. extract the strings to localize from source files,
  2. import them into the wowace localization system (if you provided your API key, see below),
  3. update the localization file from strings extracted at first step and from the wowace localization system.

The script should be run at the root directory of your addon, which also should contain the localization file.

Configuration

You can change the name of the localization file at the top of the script. By default it is Localization.lua.

To import the strings into the wowace localization system, your API key is required. By default the script tries to load it from a file named .wowaceApiKey in your home directory ; this file should only contains the raw API key. If you can get this key from this page. Ensure the file is readable only by you, as it is a kind of secret key (like SSH private keys). If the script can not find this key, it will not import the strings.

Addon setup

The addon should contain a localization file before running the script. This script should at least contains the following special tag:

%localization project_name [param1=value1 [param2=value2 [...]]]

The project name is required. It is the wowace addon “slug name” and is used to build the URLs. The parameters are optionals, and are used when exporting localized strings.

Any line after this tag will be deleted by the script.

Detail of string extraction

The script recursively looks for every .lua files in the addon directory, with the following exceptions:

  • It ignores any file or directory starting with a dot (hidden files à la Unix).
  • It ignores any file in the libs/ subdirectory.

Inside each file, it will looks for strings looking like L["some string"] or L["some string"] = "some other english string". In the second case, it will remember the value. The regex used to find these string is pretty rough, so it will likely ignore things like L[someVar] and will cause havoc with something like L["foo"..var.."bar"] (which is okay anyway as you must use string.format(L["foo%sbar"], var) for proper localization).

The script ignores any line containing @noloc. It also ignores block of lines enclosed in @noloc[[ and @noloc]].

The script does parse the content of lua comments, so you can use them to declare strings.

About

Various PHP CLI scripts to automate tasks related to wowace.com.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published