Skip to content

Commit dd08792

Browse files
authored
Merge pull request #33 from nvim-lua/protocol
add additional source protocol
2 parents a14c335 + 161d6b6 commit dd08792

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ The Neovim package specification supports a single, top-level package metadata f
3030
* `git+ssh://` - for the Git source control manager when using repositories that need SSH login, such as [email protected]/myrepo
3131
* `http://` - for HTTP URLs
3232
* `https://` - for HTTPS URLs
33+
* `luarocks://` - for Luarocks packages
3334

3435
* `description` (Table) the description is a table that includes the following nested fields:
3536
* `summary` (String) a short description of the package, typically less than 100 character long.

lua/packspec/schema.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ local pat_range = [[((==|~=|<|>|<=|>=|~>)\s*)?]]..pat_version
33

44
local PAT_VERSION = "^"..pat_version.."$"
55
local PAT_RANGE = "^"..pat_range..[[(\s*,\s*]]..pat_range..[[)*$]]
6-
local PAT_URL = [[^(file|git(\+(https?|ssh))?|https?)://]]
6+
local PAT_URL = [[^\w+://]]
77

88
local function dedent(s)
99
local lines = {}
@@ -73,6 +73,7 @@ return {
7373
"git://github.com/keplerproject/wsapi.git". Different protocols are
7474
supported:
7575
76+
* `luarocks://` - for luarocks packages
7677
* `file://` - for URLs in the local filesystem (note that for Unix
7778
paths, the root slash is the third slash, resulting in paths like
7879
"file:///full/path/filename"
@@ -84,6 +85,10 @@ return {
8485
* `http://` - for HTTP URLs
8586
* `https://` - for HTTPS URLs
8687
]],
88+
examples = {
89+
"luarocks://argparse",
90+
"git://github.com/nvim-lua/plenary.nvim"
91+
},
8792
type = "string",
8893
pattern = PAT_URL,
8994
},

schema/packspec_schema.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"source": {
3030
"type": "string",
3131
"description": "Source of the dependency. See previous `source` description.",
32-
"pattern": "^(file|git(\\+(https?|ssh))?|https?):\/\/"
32+
"pattern": "^\\w+:\/\/"
3333
}
3434
}
3535
}
@@ -84,9 +84,13 @@
8484
"additionalProperties": false
8585
},
8686
"source": {
87+
"pattern": "^\\w+:\/\/",
8788
"type": "string",
88-
"description": "The URL of the package source archive. Examples:\n\"http:\/\/github.com\/downloads\/keplerproject\/wsapi\/wsapi-1.3.4.tar.gz\",\n\"git:\/\/github.com\/keplerproject\/wsapi.git\". Different protocols are\nsupported:\n\n * `file:\/\/` - for URLs in the local filesystem (note that for Unix\n paths, the root slash is the third slash, resulting in paths like\n \"file:\/\/\/full\/path\/filename\"\n * `git:\/\/` - for the Git source control manager\n * `git+https:\/\/` - for the Git source control manager when using\n repositories that need https:\/\/ URLs.\n * `git+ssh:\/\/` - for the Git source control manager when using\n repositories that need SSH login, such as [email protected]\/myrepo.\n * `http:\/\/` - for HTTP URLs\n * `https:\/\/` - for HTTPS URLs",
89-
"pattern": "^(file|git(\\+(https?|ssh))?|https?):\/\/"
89+
"description": "The URL of the package source archive. Examples:\n\"http:\/\/github.com\/downloads\/keplerproject\/wsapi\/wsapi-1.3.4.tar.gz\",\n\"git:\/\/github.com\/keplerproject\/wsapi.git\". Different protocols are\nsupported:\n\n * `luarocks:\/\/` - for luarocks packages\n * `file:\/\/` - for URLs in the local filesystem (note that for Unix\n paths, the root slash is the third slash, resulting in paths like\n \"file:\/\/\/full\/path\/filename\"\n * `git:\/\/` - for the Git source control manager\n * `git+https:\/\/` - for the Git source control manager when using\n repositories that need https:\/\/ URLs.\n * `git+ssh:\/\/` - for the Git source control manager when using\n repositories that need SSH login, such as [email protected]\/myrepo.\n * `http:\/\/` - for HTTP URLs\n * `https:\/\/` - for HTTPS URLs",
90+
"examples": [
91+
"luarocks:\/\/argparse",
92+
"git:\/\/github.com\/nvim-lua\/plenary.nvim"
93+
]
9094
},
9195
"$schema": {
9296
"description": "The optional json schema URI for validation with json-language-server.",

0 commit comments

Comments
 (0)