From f645673bae0f18dc1ad9cb4a99a41cbd05a34a66 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 4 Jun 2015 12:23:38 +0200 Subject: APIDump: Added timestamp to all generated HTML pages. Ref.: #2204 --- MCServer/Plugins/APIDump/main.css | 2 +- MCServer/Plugins/APIDump/main_APIDump.lua | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'MCServer/Plugins/APIDump') diff --git a/MCServer/Plugins/APIDump/main.css b/MCServer/Plugins/APIDump/main.css index 8041e0d01..e5685caab 100644 --- a/MCServer/Plugins/APIDump/main.css +++ b/MCServer/Plugins/APIDump/main.css @@ -61,7 +61,7 @@ footer font-family: Segoe UI Light, Helvetica; } -#content +#content, #timestamp { padding: 0px 25px 25px 25px; } diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua index e841922b6..f1966d013 100644 --- a/MCServer/Plugins/APIDump/main_APIDump.lua +++ b/MCServer/Plugins/APIDump/main_APIDump.lua @@ -153,6 +153,16 @@ end +--- Returns the timestamp in HTML format +-- The timestamp will be inserted to all generated HTML files +local function GetHtmlTimestamp() + return string.format("
Generated on %s
", os.date("%Y-%m-%d %H:%M:%S")) +end + + + + + local function WriteArticles(f) f:write([[

Articles

@@ -296,7 +306,9 @@ local function WriteHtmlHook(a_Hook, a_HookNav) f:write("

", (example.Desc or "missing Desc"), "

\n"); f:write("
", (example.Code or "missing Code"), "\n
\n\n"); end - f:write([[]]); + f:write([[]]) + f:write(GetHtmlTimestamp()) + f:write([[]]) f:close(); end @@ -941,8 +953,10 @@ local function WriteHtmlClass(a_ClassAPI, a_ClassMenu) end end - cf:write([[]]); - cf:close(); + cf:write([[]]) + cf:write(GetHtmlTimestamp()) + cf:write([[]]) + cf:close() end @@ -1320,11 +1334,10 @@ local function DumpAPIHtml(a_API) WriteStats(f); - f:write([[ - - -]]); - f:close(); + f:write([[]]) + f:write(GetHtmlTimestamp()) + f:write([[]]) + f:close() LOG("API subfolder written"); end -- cgit v1.2.3 From 99b182b4bea0e845ca4c207f4ba6aad7ebbe626a Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Jun 2015 10:34:13 +0200 Subject: Added Build info to the cRoot API. --- MCServer/Plugins/APIDump/APIDesc.lua | 10 +++++++--- MCServer/Plugins/APIDump/main_APIDump.lua | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins/APIDump') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 4af01c0a4..f2b5d1ce8 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2036,7 +2036,7 @@ a_Player:OpenWindow(Window); BroadcastChat = { { Params = "MessageText, MessageType", Return = "", Notes = "Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom)." }, - { Params = "{{cCompositeChat|CompositeChat}}", Return = "", Notes = "Broadcasts a {{cCompositeChat|composite chat message} to all players." }, + { Params = "{{cCompositeChat|CompositeChat}}", Return = "", Notes = "Broadcasts a {{cCompositeChat|composite chat message}} to all players." }, }, BroadcastChatDeath = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died." }, BroadcastChatFailure = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtFailure. Use for a command that failed to run because of insufficient permissions, etc." }, @@ -2046,12 +2046,16 @@ a_Player:OpenWindow(Window); BroadcastChatLeave = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server." }, BroadcastChatSuccess = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages." }, BroadcastChatWarning = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc." }, - CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil.

NOTEThis function is currently unsafe, do not use!" }, + CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil.

NOTE: This function is currently unsafe, do not use!" }, FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.
This function is case-insensitive and will match partial names.
Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature:
function Callback({{cPlayer|Player}})
" }, DoWithPlayerByUUID = { Params = "PlayerUUID, CallbackFunction", Return = "bool", Notes = "If there is the player with the uuid, calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature:
function Callback({{cPlayer|Player}})
The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." }, ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature:
function Callback({{cPlayer|cPlayer}})
" }, ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature:
function Callback({{cWorld|cWorld}})
" }, - Get = { Params = "", Return = "Root object", Notes = "(STATIC)This function returns the cRoot object." }, + Get = { Params = "", Return = "Root object", Notes = "(STATIC) This function returns the cRoot object." }, + GetBuildCommitID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: <CommitHash>\"." }, + GetBuildDateTime = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: <DateTime-iso8601>\"." }, + GetBuildID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." }, + GetBuildSeriesName = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the series name of the build (for example \"MCServer Windows x64 Master\"). For unofficial local builds, returns the string \"local build\"." }, GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" }, GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." }, GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", Notes = "(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." }, diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua index f1966d013..543a299af 100644 --- a/MCServer/Plugins/APIDump/main_APIDump.lua +++ b/MCServer/Plugins/APIDump/main_APIDump.lua @@ -156,7 +156,10 @@ end --- Returns the timestamp in HTML format -- The timestamp will be inserted to all generated HTML files local function GetHtmlTimestamp() - return string.format("
Generated on %s
", os.date("%Y-%m-%d %H:%M:%S")) + return string.format("
Generated on %s, Build ID %s, Commit %s
", + os.date("%Y-%m-%d %H:%M:%S"), + cRoot:GetBuildID(), cRoot:GetBuildCommitID() + ) end -- cgit v1.2.3