Skip to content

Commit

Permalink
feat: add pattern for rubygem
Browse files Browse the repository at this point in the history
  • Loading branch information
sontungexpt committed Feb 3, 2024
1 parent b9c5beb commit 9f8f4a5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/url-open/ from markdown link
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[main cc1e51e] fix: Remove trailing
1 file changed, 2 insertions(+), 2 deletions(-)
27 changes: 27 additions & 0 deletions lua/url-open/modules/patterns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ M.PATTERNS = {
}, pattern_found)
end,
},
{
pattern = "gem ['\"]([^%s]*)['\"]",
prefix = "https://rubygems.org/gems/",
suffix = "",
file_patterns = { "Gemfile", "gems.rb" },
excluded_file_patterns = nil,
},
-- Dockerfile images: unprefix, unnamespaced (the library images, like `ruby:3.2`)
-- results in: https://hub.docker.com/_/ruby/
{
pattern = "^FROM ([^:.]+):",
prefix = "https://hub.docker.com/_/",
suffix = "/",
file_patterns = { "Dockerfile%S*", "Containerfile%S*" },
excluded_file_patterns = nil,
extra_condition = function(matched_pattern) return not matched_pattern:match("/") end,
},
-- Dockerfile images: unprefixed but namespaced (like crystallang/crystal)
-- results in: https://hub.docker.com/r/crystallang/crystal
{
pattern = "FROM ([^:.]+):",
prefix = "https://hub.docker.com/r/",
suffix = "/",
file_patterns = { "Dockerfile%S*", "Containerfile%S*" },
excluded_file_patterns = nil,
extra_condition = function(matched_pattern) return matched_pattern:match("/") end,
},
}

return M

0 comments on commit 9f8f4a5

Please sign in to comment.