Compare commits
8 Commits
v0.1.0
...
bf00b68ac7
| Author | SHA1 | Date | |
|---|---|---|---|
| bf00b68ac7 | |||
| 7322e58dfe | |||
| 9512dcd28e | |||
| 4da5c93c02 | |||
| e461245ca6 | |||
| 6a73506161 | |||
| 999de90942 | |||
| 5a3f29344b |
25
.gitea/workflows/create-release.yml
Normal file
25
.gitea/workflows/create-release.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Create Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
jobs:
|
||||||
|
create-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: build release archives
|
||||||
|
run: make
|
||||||
|
- name: create release and upload assets
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
name: LibFreeMedia ${{ github.ref_name }}
|
||||||
|
body: LibFreeMedia ${{ github.ref_name }}
|
||||||
|
files: |
|
||||||
|
release/LibFreeMedia-embed.zip
|
||||||
|
release/LibFreeMedia-embed.tar.gz
|
||||||
|
release/LibFreeMedia-embed.tar.xz
|
||||||
|
release/LibFreeMedia-standalone.zip
|
||||||
|
release/LibFreeMedia-standalone.tar.gz
|
||||||
|
release/LibFreeMedia-standalone.tar.xz
|
||||||
15
.gitea/workflows/test-commits.yml
Normal file
15
.gitea/workflows/test-commits.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: Test Commit
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: install dependencies
|
||||||
|
run: apt-get update && apt-get install -y p7zip-full
|
||||||
|
- name: build release archives
|
||||||
|
run: make
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
stages:
|
|
||||||
- test
|
|
||||||
- package
|
|
||||||
- release
|
|
||||||
|
|
||||||
# Run the tests only on commits, never on tags for now this just builds the
|
|
||||||
# release archives to make sure that works
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH
|
|
||||||
image: alpine:3
|
|
||||||
before_script:
|
|
||||||
- echo PACKAGE_JOB_ID=$CI_JOB_ID >> package.env
|
|
||||||
- apk add xz 7zip make
|
|
||||||
script:
|
|
||||||
- make
|
|
||||||
|
|
||||||
# Build the release archives and keep them forever as an artifact. Only runs on
|
|
||||||
# tag pushes
|
|
||||||
package:
|
|
||||||
stage: package
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
image: alpine:3
|
|
||||||
before_script:
|
|
||||||
- echo PACKAGE_JOB_ID=$CI_JOB_ID >> package.env
|
|
||||||
- apk add xz 7zip make
|
|
||||||
script:
|
|
||||||
- make
|
|
||||||
image: alpine:3
|
|
||||||
before_script:
|
|
||||||
- echo PACKAGE_JOB_ID=$CI_JOB_ID >> package.env
|
|
||||||
- apk add xz 7zip make
|
|
||||||
script:
|
|
||||||
- make
|
|
||||||
artifacts:
|
|
||||||
expire_in: never
|
|
||||||
paths:
|
|
||||||
- release/LibFreeMedia-embed.tar.gz
|
|
||||||
- release/LibFreeMedia-embed.tar.xz
|
|
||||||
- release/LibFreeMedia-embed.zip
|
|
||||||
- release/LibFreeMedia-standalone.tar.gz
|
|
||||||
- release/LibFreeMedia-standalone.tar.xz
|
|
||||||
- release/LibFreeMedia-standalone.zip
|
|
||||||
reports:
|
|
||||||
dotenv: package.env
|
|
||||||
|
|
||||||
# Create a release with the previously generated artifacts. Only runs on tag
|
|
||||||
# pushes
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
||||||
script:
|
|
||||||
- echo 'Creating release'
|
|
||||||
needs:
|
|
||||||
- job: package
|
|
||||||
artifacts: true
|
|
||||||
release:
|
|
||||||
tag_name: $CI_COMMIT_TAG
|
|
||||||
name: 'LibFreeMedia $CI_COMMIT_TAG'
|
|
||||||
description: 'LibFreeMedia $CI_COMMIT_TAG'
|
|
||||||
assets:
|
|
||||||
links:
|
|
||||||
- name: 'LibFreeMedia embedable release'
|
|
||||||
url: 'https://gitlab.com/omicron-oss/wow/libfreemedia/-/jobs/${PACKAGE_JOB_ID}/artifacts/raw/release/LibFreeMedia-embed.zip'
|
|
||||||
filepath: '/archive/freemedia-embed-zip'
|
|
||||||
- name: 'LibFreeMedia embedable release (tar.xz archive)'
|
|
||||||
url: 'https://gitlab.com/omicron-oss/wow/libfreemedia/-/jobs/${PACKAGE_JOB_ID}/artifacts/raw/release/LibFreeMedia-embed.tar.xz'
|
|
||||||
filepath: '/archive/freemedia-embed-tarxz'
|
|
||||||
- name: 'LibFreeMedia embedable release (tar.gz archive)'
|
|
||||||
url: 'https://gitlab.com/omicron-oss/wow/libfreemedia/-/jobs/${PACKAGE_JOB_ID}/artifacts/raw/release/LibFreeMedia-embed.tar.gz'
|
|
||||||
filepath: '/archive/freemedia-embed-targz'
|
|
||||||
- name: 'LibFreeMedia standalone addon'
|
|
||||||
url: 'https://gitlab.com/omicron-oss/wow/libfreemedia/-/jobs/${PACKAGE_JOB_ID}/artifacts/raw/release/LibFreeMedia-standalone.zip'
|
|
||||||
filepath: '/archive/freemedia-standalone-zip'
|
|
||||||
- name: 'LibFreeMedia standalone addon (tar.xz archive)'
|
|
||||||
url: 'https://gitlab.com/omicron-oss/wow/libfreemedia/-/jobs/${PACKAGE_JOB_ID}/artifacts/raw/release/LibFreeMedia-standalone.tar.xz'
|
|
||||||
filepath: '/archive/freemedia-standalone-tarxz'
|
|
||||||
- name: 'LibFreeMedia standalone addon (tar.gz archive)'
|
|
||||||
url: 'https://gitlab.com/omicron-oss/wow/libfreemedia/-/jobs/${PACKAGE_JOB_ID}/artifacts/raw/release/LibFreeMedia-standalone.tar.gz'
|
|
||||||
filepath: '/archive/freemedia-standalone-targz'
|
|
||||||
3
.stylua.toml
Normal file
3
.stylua.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 4
|
||||||
|
column_width = 120
|
||||||
@@ -1,22 +1,23 @@
|
|||||||
local lib = LibStub:NewLibrary("LibFreeMedia", 100)
|
local lib = LibStub:NewLibrary("LibFreeMedia", 101)
|
||||||
if not lib then
|
if not lib then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- stylua: ignore
|
||||||
local DEFAULT_MEDIA_TABLE = {
|
local DEFAULT_MEDIA_TABLE = {
|
||||||
background = {
|
background = {
|
||||||
["Blizzard Dialog Background"] = "Interfacee\\DialogFrame\\UI-DialogBox-Background",
|
["Blizzard Dialog Background"] = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
||||||
["Blizzard Dialog Background Dark"] = "Interfacee\\DialogFrame\\UI-DialogBox-Background-Dark",
|
["Blizzard Dialog Background Dark"] = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
|
||||||
["Blizzard Dialog Background Gold"] = "Interfacee\\DialogFrame\\UI-DialogBox-Gold-Background",
|
["Blizzard Dialog Background Gold"] = "Interface\\DialogFrame\\UI-DialogBox-Gold-Background",
|
||||||
["Blizzard Low Health"] = "Interfacee\\FullScreenTextures\\LowHealth",
|
["Blizzard Low Health"] = "Interface\\FullScreenTextures\\LowHealth",
|
||||||
["Blizzard Marble"] = "Interfacee\\FrameGeneral\\UI-Background-Marble",
|
["Blizzard Marble"] = "Interface\\FrameGeneral\\UI-Background-Marble",
|
||||||
["Blizzard Out of Control"] = "Interfacee\\FullScreenTextures\\OutOfControl",
|
["Blizzard Out of Control"] = "Interface\\FullScreenTextures\\OutOfControl",
|
||||||
["Blizzard Parchment"] = "Interfacee\\AchievementFrame\\UI-Achievement-Parchment-Horizontal",
|
["Blizzard Parchment"] = "Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal",
|
||||||
["Blizzard Parchment 2"] = "Interfacee\\AchievementFrame\\UI-GuildAchievement-Parchment-Horizontal",
|
["Blizzard Parchment 2"] = "Interface\\AchievementFrame\\UI-GuildAchievement-Parchment-Horizontal",
|
||||||
["Blizzard Rock"] = "Interfacee\\FrameGeneral\\UI-Background-Rock",
|
["Blizzard Rock"] = "Interface\\FrameGeneral\\UI-Background-Rock",
|
||||||
["Blizzard Tabard Background"] = "Interfacee\\TabardFrame\\TabardFrameBackground",
|
["Blizzard Tabard Background"] = "Interface\\TabardFrame\\TabardFrameBackground",
|
||||||
["Blizzard Tooltip"] = "Interfacee\\Tooltips\\UI-Tooltip-Background",
|
["Blizzard Tooltip"] = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||||
["Solid"] = "Interfacee\\Buttons\\WHITE8X8",
|
["Solid"] = "Interface\\Buttons\\WHITE8X8",
|
||||||
},
|
},
|
||||||
font = {
|
font = {
|
||||||
["Arial Narrow"] = "Fonts\\ARIALN.TTF",
|
["Arial Narrow"] = "Fonts\\ARIALN.TTF",
|
||||||
@@ -42,6 +43,7 @@ local DEFAULT_MEDIA_TABLE = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Build default media lists from the default media table
|
||||||
local function MakeDefaultList()
|
local function MakeDefaultList()
|
||||||
local lists = {}
|
local lists = {}
|
||||||
for kind, media in pairs(DEFAULT_MEDIA_TABLE) do
|
for kind, media in pairs(DEFAULT_MEDIA_TABLE) do
|
||||||
@@ -57,7 +59,6 @@ end
|
|||||||
|
|
||||||
local DEFAULT_MEDIA_LIST = MakeDefaultList()
|
local DEFAULT_MEDIA_LIST = MakeDefaultList()
|
||||||
|
|
||||||
|
|
||||||
-- Interopability with a proprietary alternative is contained in this block
|
-- Interopability with a proprietary alternative is contained in this block
|
||||||
do
|
do
|
||||||
local libsm = LibStub:GetLibrary("LibSharedMedia-3.0", true)
|
local libsm = LibStub:GetLibrary("LibSharedMedia-3.0", true)
|
||||||
@@ -66,6 +67,18 @@ do
|
|||||||
libsm = LibStub:NewLibrary("LibSharedMedia-3.0", 0)
|
libsm = LibStub:NewLibrary("LibSharedMedia-3.0", 0)
|
||||||
libsm.MediaTable = DEFAULT_MEDIA_TABLE
|
libsm.MediaTable = DEFAULT_MEDIA_TABLE
|
||||||
libsm.MediaList = DEFAULT_MEDIA_LIST
|
libsm.MediaList = DEFAULT_MEDIA_LIST
|
||||||
|
else
|
||||||
|
-- Ensure the lists match the tables if we didn't create them
|
||||||
|
for kind, media in pairs(libsm.MediaTable) do
|
||||||
|
if libsm.MediaList[kind] == nil then
|
||||||
|
local mediaList = {}
|
||||||
|
for identifier, _ in pairs(media) do
|
||||||
|
table.insert(mediaList, identifier)
|
||||||
|
end
|
||||||
|
table.sort(mediaList)
|
||||||
|
libsm.MediaList[kind] = mediaList
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type table<string, table<string, any>>
|
---@type table<string, table<string, any>>
|
||||||
@@ -74,7 +87,6 @@ do
|
|||||||
lib.mediaList = libsm.MediaList
|
lib.mediaList = libsm.MediaList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---@param kind string The kind of media you are registering. E.g. "font" or "background"
|
---@param kind string The kind of media you are registering. E.g. "font" or "background"
|
||||||
---@param identifier string Named identifier for the media
|
---@param identifier string Named identifier for the media
|
||||||
---@param data any
|
---@param data any
|
||||||
@@ -94,11 +106,10 @@ local function RegisterOne(kind, identifier, data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
media[identifier] = data
|
media[identifier] = data
|
||||||
table.insert(lib.mediaList[kind], identifier)
|
table.insert(mediaList, identifier)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---@param kind string The kind of media you are registering. E.g. "font" or "background"
|
---@param kind string The kind of media you are registering. E.g. "font" or "background"
|
||||||
---@param identifier string Named identifier for the media
|
---@param identifier string Named identifier for the media
|
||||||
---@param data any
|
---@param data any
|
||||||
@@ -111,7 +122,6 @@ function lib:Register(kind, identifier, data)
|
|||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---Return the media that matches the given kind and identifier. May return nil if the media does not exist.
|
---Return the media that matches the given kind and identifier. May return nil if the media does not exist.
|
||||||
---@param kind string The kind of media you are requesting. E.g. "font" or "background"
|
---@param kind string The kind of media you are requesting. E.g. "font" or "background"
|
||||||
---@param identifier string Named identifier for the media
|
---@param identifier string Named identifier for the media
|
||||||
@@ -123,7 +133,6 @@ function lib:Get(kind, identifier)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---Return a sorted list of identifiers. May return nil if there is no media of that kind.
|
---Return a sorted list of identifiers. May return nil if there is no media of that kind.
|
||||||
---@param kind string The kind of media you are requesting. E.g. "font" or "background"
|
---@param kind string The kind of media you are requesting. E.g. "font" or "background"
|
||||||
---@return string[] | nil
|
---@return string[] | nil
|
||||||
@@ -131,7 +140,6 @@ function lib:GetList(kind)
|
|||||||
return self.mediaList[kind]
|
return self.mediaList[kind]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---Return a table with identifier keys and media data values
|
---Return a table with identifier keys and media data values
|
||||||
---@param kind string The kind of media you are requesting. E.g. "font" or "background"
|
---@param kind string The kind of media you are requesting. E.g. "font" or "background"
|
||||||
---@return table<string,any> | nil
|
---@return table<string,any> | nil
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## Interface: 100100
|
## Interface: 100100
|
||||||
## Title: LibFreeMedia
|
## Title: LibFreeMedia
|
||||||
## Notes: Freely share media between addons
|
## Notes: Freely share media between addons
|
||||||
## Version: 0.1.0
|
## Version: 0.1.1
|
||||||
|
|
||||||
libs/LibStub.lua
|
libs/LibStub.lua
|
||||||
LibFreeMedia.lua
|
LibFreeMedia.lua
|
||||||
|
|||||||
7
src/LibFreeMedia_TBC.toc
Normal file
7
src/LibFreeMedia_TBC.toc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## Interface: 20505
|
||||||
|
## Title: LibFreeMedia
|
||||||
|
## Notes: Freely share media between addons
|
||||||
|
## Version: 0.1.1
|
||||||
|
|
||||||
|
libs/LibStub.lua
|
||||||
|
LibFreeMedia.lua
|
||||||
Reference in New Issue
Block a user