Skip to content

Commit

Permalink
version 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
osch committed Aug 22, 2021
1 parent 50f5958 commit e43a57a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package = "lpugl"
version = "0.0.1-1"
version = "0.0.2-1"
local versionNumber = version:gsub("^(.*)-.-$", "%1")
source = {
url = "https://github.com/osch/lua-lpugl/archive/v"..versionNumber..".zip",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package = "lpugl_cairo"
version = "0.0.1-1"
version = "0.0.2-1"
local versionNumber = version:gsub("^(.*)-.-$", "%1")
source = {
url = "https://github.com/osch/lua-lpugl/archive/v"..versionNumber..".zip",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package = "lpugl_opengl"
version = "0.0.1-1"
version = "0.0.2-1"
local versionNumber = version:gsub("^(.*)-.-$", "%1")
source = {
url = "https://github.com/osch/lua-lpugl/archive/v"..versionNumber..".zip",
Expand Down
40 changes: 40 additions & 0 deletions rockspecs/setversion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/lua

os.setlocale("C")

local format = string.format
local lfs = require("lfs")

local version = ...
assert(version:match("^%d+%.%d+%.%d+$"), format("invalid version %q", version))

for fileName in lfs.dir(".") do
local p1, v, p2 = fileName:match("^(lpugl.*%-)(%d+%.%d+%.%d+)(%-%d+%.rockspec)$")
if p1 then
local newName = p1..version..p2
print(format("%-30s -> %s", fileName, newName))
local out = {}
local matched = false
local inFile = io.open(fileName, "r")
for line in inFile:lines() do
local l1, l2 = line:match("^(%s*version%s*%=%s*\")%d+%.%d+%.%d+(%-%d+\"%s*)$")
if l1 then
assert(not matched)
matched = true
out[#out+1] = l1..version..l2
else
out[#out+1] = line
end
end
out[#out+1] = ""
inFile:close()
assert(matched)
local newFile, err = io.open(newName, "w")
assert(newFile, err)
newFile:write(table.concat(out, "\n"))
newFile:close()
if fileName ~= newName then
os.remove(fileName)
end
end
end

0 comments on commit e43a57a

Please sign in to comment.