Skip to content

Commit 40b8a92

Browse files
committed
remove add / get by url
fix get via pastebin
1 parent 33d4724 commit 40b8a92

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ Download SCM with the following command:
1717
## add
1818
- `<name>`: Downloads a library from GitHub. Libraries always have the suffix `-lib` ([Naming Conventions](https://github.com/mc-cc-scripts/.github/blob/master/profile/README.md#naming-conventions)). The suffix should not be added to the name.
1919
- `<name>@<pastebin code>`: Downloads a library from Pastebin.
20-
- `<url>`: Downloads a library from an URL.
2120
## get
2221
- `<name>`: Downloads a program from GitHub. Programs always have the suffix `-prog` ([Naming Conventions](https://github.com/mc-cc-scripts/.github/blob/master/profile/README.md#naming-conventions)). The suffix should not be added to the name.
2322
- `<name>@<pastebin code>`: Downloads a program from Pastebin.
24-
- `<url>`: Downloads a program from an URL.
2523
## update
2624
By default, without parameters, `update` updates the SCM script.
2725
- `<name>`: Removes and downloads an installed script by name.

scm.lua

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Adds a library with all its dependencies.
3636
If only a name is given, it will try to download from the official GitHub repositories.
3737
$ add <name>
3838
$ add <name>@<pastebinCode>
39-
$ add <URL>
4039
]]
4140
},
4241
["get"] = {
@@ -49,7 +48,6 @@ Adds a program with all its dependencies.
4948
If only a name is given, it will try to download from the official GitHub repositories.
5049
$ get <name>
5150
$ get <name>@<pastebinCode>
52-
$ get <URL>
5351
]]
5452
},
5553
["update"] = {
@@ -175,12 +173,6 @@ function scm:download (target, fileType, updateObj)
175173
return scm:addScript(self:downloadPastebin(sourceObject, code, self.config[fileType .. "Directory"], updateObj))
176174
end
177175

178-
-- Check for URL
179-
local isURL = string.lower(string.sub(target, 0, 4)) == "http"
180-
if isURL then
181-
return scm:addScript(self:downloadURL(sourceObject, self.config[fileType .. "Directory"], updateObj))
182-
end
183-
184176
-- We assume it's Git
185177
-- The suffix is used to find the correct repository on GitHub
186178
local suffix
@@ -290,7 +282,12 @@ function scm:downloadPastebin (sourceObject, code, targetDirectory, updateObj)
290282
end
291283
end
292284

293-
shell.run("pastebin", "get", code, targetDirectory .. sourceObject.name)
285+
if sourceObject.type == "program" then
286+
shell.run("pastebin", "get", code, sourceObject.name)
287+
else
288+
shell.run("pastebin", "get", code, targetDirectory .. sourceObject.name)
289+
end
290+
294291
return sourceObject, true
295292
end
296293

@@ -301,7 +298,9 @@ end
301298
---@return boolean
302299
function scm:downloadURL (sourceObject, targetDirectory, updateObj)
303300
local sourceName = "default" or updateObj.sourceName
304-
sourceObject.name = sourceObject.name or updateObj.name
301+
if updateObj then
302+
sourceObject.name = sourceObject.name or updateObj.name
303+
end
305304

306305
if not sourceObject.name then
307306
sourceObject.name = self:getNameFromURL(sourceObject.source[sourceName])

0 commit comments

Comments
 (0)