-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
### Lua ### | ||
# LDoc | ||
/doc | ||
|
||
# Compiled Lua sources | ||
luac.out | ||
|
||
# luarocks build files | ||
*.src.rock | ||
*.zip | ||
*.tar.gz | ||
|
||
# Object files | ||
*.o | ||
*.os | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
*.def | ||
*.exp | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# love-release | ||
[![License](http://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE) | ||
|
||
[Lua][lua] 5.1 script that makes [LÖVE][love] game release easier (previously Bash script). | ||
Automates LÖVE [Game Distribution][game_dist]. | ||
LÖVE [forum topic][forum_topic]. | ||
Available as a [LuaRocks][luarocks] [package][package]. | ||
|
||
## Features | ||
love-release makes your LÖVE game release easier. It can create from your sources Windows executables, MacOS X applications, Debian packages and simple LÖVE files. | ||
|
||
love-release creates only one LÖVE file in a release directory and keeps it synced with your sources. | ||
|
||
love-release can extract its informations from the environment: it guesses your game's title from the directory where it's stored, selects by default the latest LÖVE version from the web or uses its latest bundled LÖVE version, then parses the `conf.lua` file to extract even more informations such as the real LÖVE version your project uses. | ||
|
||
### Configuration | ||
love-release prints to the command-line a Lua table containing the informations it uses to generate your project. These informations can be stored in your `conf.lua` file to be used later. | ||
|
||
```lua | ||
function love.conf(t) | ||
t.releases = { | ||
title = nil, -- The project title (string) | ||
package = nil, -- The project command and package name (string) | ||
loveVersion = nil, -- The project LÖVE version | ||
version = nil, -- The project version | ||
author = nil, -- Your name (string) | ||
email = nil, -- Your email (string) | ||
description = nil, -- The project description (string) | ||
homepage = nil, -- The project homepage (string) | ||
identifier = nil, -- The project Uniform Type Identifier (string) | ||
releaseDirectory = nil, -- Where to store the project releases (string) | ||
} | ||
end | ||
``` | ||
|
||
## Installation | ||
|
||
### Dependencies | ||
love-release is only installable through LuaRocks and highly depends on LuaRocks internal API. love-release is currently build on LuaRocks 2.3.0. LuaRocks API is not meant to be stable, and a future update could break love-release. As love-release is made for LÖVE, it is written for Lua 5.1. | ||
|
||
#### Required | ||
- [libzip][libzip] headers for lua-zip. | ||
- [lua-zip][lua-zip] has no official stable version, thus while available on LuaRocks it must be installed manually. | ||
- Other libraries are automatically installed, but let's give them some credit: [luafilesystem][lfs], [loadconf][loadconf], [middleclass][middleclass], [semver][semver]. | ||
|
||
#### Optional | ||
- `love` can be used to determine your system LÖVE version. | ||
- `fakeroot` and `dpkg-deb` are required to create Debian packages. | ||
|
||
### Install | ||
|
||
```sh | ||
# sudo | ||
luarocks install --server=http://luarocks.org/dev lua-zip | ||
luarocks install --server=http://luarocks.org/dev love-release | ||
``` | ||
|
||
### Remove Bash version | ||
You may have previously installed the Bash version of love-release. You can remove it with the following piece of code. Take the time to assure yourself that the paths are correct and match your installation of love-release. | ||
|
||
```sh | ||
rm -rf '/usr/bin/love-release' | ||
rm -rf '/usr/share/love-release' | ||
rm -rf '/usr/share/man/man1/love-release.1.gz' | ||
rm -rf '/usr/share/bash-completion/completions/love-release' '/etc/bash_completion.d/love-release' | ||
``` | ||
|
||
## Contribute | ||
The documentation of love-release internals is written with [LDoc][ldoc]. Generate it by running `ldoc .`. | ||
I do not plan to keep developing the Bash script, not even fixing it. If there appears to be any need for it, let me know and I might consider doing so. | ||
Every bug report or feature request is gladly welcome ! | ||
|
||
[forum_topic]: https://love2d.org/forums/viewtopic.php?t=75387 | ||
[game_dist]: https://www.love2d.org/wiki/Game_Distribution | ||
[ldoc]: https://github.com/stevedonovan/LDoc | ||
[lfs]: https://github.com/keplerproject/luafilesystem | ||
[libzip]: http://www.nih.at/libzip/ | ||
[love]: https://www.love2d.org/ | ||
[lua]: http://www.lua.org/ | ||
[luarocks]: https://luarocks.org/ | ||
[lua-zip]: https://github.com/brimworks/lua-zip | ||
[loadconf]: https://github.com/Alloyed/loadconf | ||
[middleclass]: https://github.com/kikito/middleclass | ||
[package]: https://luarocks.org/modules/rucikir/love-release | ||
[semver]: https://github.com/kikito/semver.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
file = "src" | ||
project = "love-release" | ||
description = [[ | ||
love-release - a Lua script to make LÖVE games releases easier | ||
]] | ||
readme = "README.md" | ||
format = "discount" | ||
title = "love-release documentation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package = "love-release" | ||
version = "scm-1" | ||
source = { | ||
url = "git://github.com/MisterDA/love-release.git", | ||
branch = "lua", | ||
} | ||
description = { | ||
summary = "Make LÖVE games releases easier", | ||
detailed = [[ | ||
love-release make LÖVE games releases easier. | ||
It automates LÖVE Game Distribution. | ||
]], | ||
license = "MIT", | ||
homepage = "https://github.com/MisterDA/love-release", | ||
} | ||
dependencies = { | ||
"loadconf", | ||
"lua ~> 5.1", | ||
"luafilesystem", | ||
"lua-zip", | ||
"middleclass", | ||
"semver", | ||
} | ||
build = { | ||
type = "builtin", | ||
modules = { | ||
["love-release.scripts.debian"] = "src/scripts/debian.lua", | ||
["love-release.scripts.love"] = "src/scripts/love.lua", | ||
["love-release.scripts.macosx"] = "src/scripts/macosx.lua", | ||
["love-release.scripts.windows"] = "src/scripts/windows.lua", | ||
["love-release.pipes.conf"] = "src/pipes/conf.lua", | ||
["love-release.pipes.env"] = "src/pipes/env.lua", | ||
["love-release.project"] = "src/project.lua", | ||
["love-release.script"] = "src/script.lua", | ||
["love-release.utils"] = "src/utils.lua", | ||
}, | ||
install = { | ||
bin = { | ||
["love-release"] = "src/main.lua" | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- love-release main. | ||
-- @script love-release | ||
|
||
local conf = require 'love-release.pipes.conf' | ||
local env = require 'love-release.pipes.env' | ||
local Project = require 'love-release.project' | ||
local p = Project:new() | ||
conf(env(p)) | ||
|
||
print(p) | ||
|
||
local script | ||
script = require 'love-release.scripts.love' | ||
script(p) | ||
script = require 'love-release.scripts.macosx' | ||
script(p) | ||
script = require 'love-release.scripts.windows' | ||
script(p) | ||
script = require 'love-release.scripts.debian' | ||
script(p) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- Gather informations from the LÖVE conf.lua file. | ||
-- @module conf | ||
-- @usage conf(project) | ||
|
||
local fs = require 'luarocks.fs' | ||
local loadconf = require 'loadconf' | ||
local semver = require 'semver' | ||
|
||
local utils = require 'love-release.utils' | ||
|
||
|
||
local pipe = {} | ||
|
||
function pipe.pipe(project) | ||
local err = utils.io.err | ||
|
||
-- checks for a conf.lua file | ||
fs.change_dir(project.projectDirectory) | ||
if not fs.exists("conf.lua") then | ||
err("CONF: No conf.lua provided.\n") | ||
return project | ||
end | ||
local conf = assert(loadconf.parse_file("conf.lua")) | ||
fs.pop_dir() | ||
|
||
local function setString(key, value) | ||
if type(value) == "string" then | ||
project["set"..key](project, value) | ||
end | ||
end | ||
|
||
local function setLoveVersion(v) | ||
if type(v) == "string" and v ~= "" then | ||
local version = semver(v) | ||
if not utils.love.isSupported(version) then | ||
local scriptLoveVersion = project.loveVersion | ||
err("CONF: Your LÖVE conf version ("..v | ||
.. ") is not supported by love-release ("..tostring(scriptLoveVersion) | ||
.. ").\n") | ||
if version > scriptLoveVersion then | ||
err(" You should update love-release.\n") | ||
elseif version < scriptLoveVersion then | ||
err(" You should update your project.\n") | ||
end | ||
end | ||
project:setLoveVersion(version) | ||
end | ||
end | ||
|
||
-- extract LÖVE standard fields | ||
setString("Title", conf.title) | ||
setString("Package", conf.package) | ||
setLoveVersion(conf.version) | ||
|
||
-- extract love-release fields | ||
local releases = conf.releases | ||
if type(releases) == "table" then | ||
setString("Title", releases.title) | ||
setString("Package", releases.package) | ||
setLoveVersion(releases.loveVersion) | ||
setString("Version", releases.version) | ||
setString("Author", releases.author) | ||
setString("Email", releases.email) | ||
setString("Description", releases.description) | ||
setString("Homepage", releases.homepage) | ||
setString("Identifier", releases.identifier) | ||
setString("ReleaseDirectory", releases.releaseDirectory) | ||
end | ||
|
||
return project | ||
end | ||
|
||
|
||
setmetatable(pipe, { | ||
__call = function(_, project) return pipe.pipe(project) end, | ||
}) | ||
|
||
return pipe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- Gather informations from the environment. | ||
-- @module env | ||
-- @usage env(project) | ||
|
||
local fs = require 'luarocks.fs' | ||
local semver = require 'semver' | ||
local utils = require 'love-release.utils' | ||
|
||
local pipe = {} | ||
|
||
|
||
--- Gets the version of the installed LÖVE. | ||
-- @treturn semver LÖVE version. | ||
-- @local | ||
local function getSystemLoveVersion() | ||
local handle = io.popen('love --version') | ||
local result = handle:read("*a") | ||
handle:close() | ||
local version = result:match('%d+%.%d+%.%d+') | ||
if version then | ||
return semver(version) | ||
end | ||
end | ||
|
||
--- Gets the latest LÖVE version from the web. | ||
-- @treturn semver LÖVE version. | ||
-- @local | ||
local function getWebLoveVersion() | ||
local releasesPath = utils.cache.."/releases.xml" | ||
|
||
local ok, err = fs.download("https://love2d.org/releases.xml", | ||
releasesPath, | ||
true) | ||
if ok then | ||
local releasesXml = io.open(releasesPath, "rb") | ||
local version = releasesXml:read("*a"):match("<title>(%d+%.%d+%.%d+)") | ||
releasesXml:close() | ||
return semver(version) | ||
else | ||
return nil, err | ||
end | ||
end | ||
|
||
--- Gets the latest LÖVE version from the script, the system and the web. | ||
-- @tparam semver script script version. | ||
-- @tparam semver system system version. | ||
-- @tparam semver web web version. | ||
-- @treturn semver the latest version. | ||
-- @local | ||
local function getLatestLoveVersion(script, system, web) | ||
local version = script | ||
if system and system >= script then | ||
version = system | ||
end | ||
if web and web > version then | ||
version = web | ||
end | ||
return version | ||
end | ||
|
||
function pipe.pipe(project) | ||
local err = utils.io.err | ||
|
||
-- checks for a main.lua file | ||
fs.change_dir(project.projectDirectory) | ||
if not fs.exists("main.lua") then | ||
err("ENV: No main.lua provided.\n") | ||
os.exit(1) | ||
end | ||
fs.pop_dir() | ||
|
||
-- title | ||
project:setTitle(project.projectDirectory:match("[^/]+$")) | ||
|
||
-- package | ||
project:setPackage(project.title:gsub("%W", "-"):lower()) | ||
|
||
-- LÖVE version | ||
|
||
local systemLoveVersion = getSystemLoveVersion() | ||
local webLoveVersion = getWebLoveVersion() | ||
local scriptLoveVersion = utils.love.lastVersion() | ||
local isSupported = utils.love.isSupported | ||
|
||
if systemLoveVersion and not isSupported(systemLoveVersion) then | ||
err("ENV: Your LÖVE installed version (" .. tostring(systemLoveVersion) .. | ||
") is not supported by love-release (" .. tostring(scriptLoveVersion) .. | ||
").\n") | ||
if systemLoveVersion > scriptLoveVersion then | ||
err(" You should update love-release.\n") | ||
elseif systemLoveVersion < scriptLoveVersion then | ||
err(" You should update LÖVE.\n") | ||
end | ||
end | ||
|
||
if webLoveVersion and not isSupported(webLoveVersion) then | ||
err("ENV: The upstream LÖVE version (" .. tostring(webLoveVersion) .. | ||
") is not supported by love-release (" .. tostring(scriptLoveVersion) .. | ||
").\n") | ||
err(" You should update love-release.\n") | ||
end | ||
|
||
project:setLoveVersion(getLatestLoveVersion(scriptLoveVersion, | ||
systemLoveVersion, | ||
webLoveVersion)) | ||
|
||
return project | ||
end | ||
|
||
|
||
setmetatable(pipe, { | ||
__call = function(_, project) return pipe.pipe(project) end, | ||
}) | ||
|
||
return pipe |
Oops, something went wrong.