Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some additional patterns you might be interested in #10

Open
nogweii opened this issue Dec 24, 2023 · 1 comment
Open

Some additional patterns you might be interested in #10

nogweii opened this issue Dec 24, 2023 · 1 comment

Comments

@nogweii
Copy link

nogweii commented Dec 24, 2023

Here are some patterns I've created after having this installed for only a few hours, it's been awesome!

To jump to Rubygems from a Gemfile (or it's alternative name, gems.rb):

{                                           
  pattern = "gem ['\"]([^%s]*)['\"]",       
  prefix = "https://rubygems.org/gems/",    
  suffix = "",                              
  file_patterns = { "Gemfile", "gems.rb" }, 
  excluded_file_patterns = nil,             
},                                          

Or to load the URL for a base image in Dockerhub:

-- 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,                                                                             
},
@sontungexpt
Copy link
Owner

Thanks for this, I will add it as the default setting for plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants