mirror of
https://github.com/TangentFoxy/love-release.git
synced 2025-07-28 02:52:20 +00:00
committed by
Antonin Décimo
parent
e6f8f7386a
commit
339cbe7b42
@@ -21,7 +21,7 @@ love-release can extract its informations from the environment: it guesses your
|
||||
```
|
||||
Usage: love-release [-D] [-M] [-a <author>] [-b] [-d <desc>]
|
||||
[-e <email>] [-l <love>] [-p <package>] [-t <title>] [-u <url>]
|
||||
[--uti <uti>] [-v <v>] [--version] [-h] [<release>] [<source>]
|
||||
[--uti <uti>] [-v <v>] [-X <exclude>] [--version] [-h] [<release>] [<source>]
|
||||
[-W [32|64]]
|
||||
|
||||
Makes LÖVE games releases easier !
|
||||
@@ -49,6 +49,8 @@ Options:
|
||||
Project title.
|
||||
-u <url>, --url <url> Project homepage url.
|
||||
--uti <uti> Project Uniform Type Identifier.
|
||||
-x <exclude_pattern>, --exclude <exclude_pattern>
|
||||
Exclude file patterns.
|
||||
-v <v> Project version.
|
||||
--version Show love-release version and exit.
|
||||
-h, --help Show this help message and exit.
|
||||
@@ -71,6 +73,7 @@ function love.conf(t)
|
||||
description = nil, -- The project description (string)
|
||||
homepage = nil, -- The project homepage (string)
|
||||
identifier = nil, -- The project Uniform Type Identifier (string)
|
||||
excludeFileList = {}, -- File patterns to exclude. (string list)
|
||||
releaseDirectory = nil, -- Where to store the project releases (string)
|
||||
}
|
||||
end
|
||||
|
@@ -50,6 +50,8 @@ function Args:initialize()
|
||||
parser:option("--uti", "Project Uniform Type Identifier.")
|
||||
parser:option("-v", "Project version.")
|
||||
:target("version")
|
||||
parser:option("-x --exclude", "Exclude file patterns."):count("*")
|
||||
:target("excludeFileList")
|
||||
|
||||
parser:flag("--version", "Show love-release version and exit.")
|
||||
:target("love_release")
|
||||
@@ -89,6 +91,7 @@ function Args:__call(project)
|
||||
if args.url then project:setHomepage(args.url) end
|
||||
if args.uti then project:setIdentifier(args.uti) end
|
||||
if args.version then project:setVersion(args.version) end
|
||||
if args.excludeFileList then project:setExcludeFileList(args.excludeFileList) end
|
||||
|
||||
if project.projectDirectory == project.releaseDirectory then
|
||||
project:setReleaseDirectory(project.releaseDirectory.."/releases")
|
||||
|
@@ -29,6 +29,12 @@ function pipe.pipe(project)
|
||||
end
|
||||
end
|
||||
|
||||
local function setTable(key, value)
|
||||
if type(value) == "table" then
|
||||
project["set"..key](project, value)
|
||||
end
|
||||
end
|
||||
|
||||
local function setLoveVersion(v)
|
||||
if type(v) == "string" and v ~= "" then
|
||||
local version = semver(v)
|
||||
@@ -65,6 +71,7 @@ function pipe.pipe(project)
|
||||
setString("Homepage", releases.homepage)
|
||||
setString("Identifier", releases.identifier)
|
||||
setString("ReleaseDirectory", releases.releaseDirectory)
|
||||
setTable("ExcludeFileList", releases.excludeFileList)
|
||||
end
|
||||
|
||||
return project
|
||||
|
@@ -37,6 +37,9 @@ Project.homepage = nil
|
||||
--- Uniform Type Identifier in reverse-DNS format.
|
||||
Project.identifier = nil
|
||||
|
||||
--- Sequential table of string patterns to exclude from the project.
|
||||
Project.excludeFileList = {}
|
||||
|
||||
--- Project directory, where to find the game sources.
|
||||
Project.projectDirectory = nil
|
||||
|
||||
@@ -75,6 +78,18 @@ _buildFileTree = function(dir)
|
||||
end
|
||||
end
|
||||
|
||||
--- Recursive function to check if file should be excluded based
|
||||
--- on a file name string pattern match.
|
||||
-- @local
|
||||
local function isExcluded(file, exclusionRule, ...)
|
||||
if exclusionRule == nil then return false end
|
||||
if file:find(exclusionRule) then
|
||||
return true
|
||||
else
|
||||
return isExcluded(file, ...)
|
||||
end
|
||||
end
|
||||
|
||||
--- Constructs the file tree.
|
||||
-- @return File tree. The table represents the root directory.
|
||||
-- Sub-directories are represented as sub-tables, indexed by the directory name.
|
||||
@@ -125,23 +140,13 @@ function Project:excludeFiles()
|
||||
"^"..utils.lua.escape_string_regex(self.projectDirectory).."/",
|
||||
"")
|
||||
if rm_dir > 0 then
|
||||
rm_dir = true
|
||||
dir = "^"..dir
|
||||
else
|
||||
rm_dir = false
|
||||
end
|
||||
|
||||
if rm_dir then
|
||||
local rm = false
|
||||
local file
|
||||
local n = #self._fileList
|
||||
for i = 1, n do
|
||||
file = self._fileList[i]
|
||||
if rm_dir then if file:find(dir) then rm = true end end
|
||||
if rm then
|
||||
self._fileList[i] = nil
|
||||
rm = false
|
||||
end
|
||||
local unpack = unpack or table.unpack
|
||||
for i=#self._fileList,1,-1 do
|
||||
if isExcluded(self._fileList[i], dir, unpack(self.excludeFileList)) then
|
||||
table.remove(self._fileList, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -183,6 +188,7 @@ function Project:__tostring()
|
||||
' description = '..escape(self.description)..',\n'..
|
||||
' homepage = '..escape(self.homepage)..',\n'..
|
||||
' identifier = '..escape(self.identifier)..',\n'..
|
||||
' excludeFileList = { '..escape(table.concat(self.excludeFileList, ', '))..'} ,\n'..
|
||||
' compile = '..escape(self.compile)..',\n'..
|
||||
' projectDirectory = '..escape(self.projectDirectory)..',\n'..
|
||||
' releaseDirectory = '..escape(self.releaseDirectory)..',\n'..
|
||||
@@ -261,6 +267,14 @@ function Project:setIdentifier(identifier)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sets the excludeFileList.
|
||||
-- @string excludeFileList the excludeFileList.
|
||||
-- @treturn project self.
|
||||
function Project:setExcludeFileList(excludeFileList)
|
||||
self.excludeFileList = excludeFileList
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sets the source directory. The path is normalized and absoluted.
|
||||
-- @string directory the directory.
|
||||
-- @treturn project self.
|
||||
|
Reference in New Issue
Block a user