Project

General

Profile

« Previous | Next » 

Revision 3b073279

Added by Evgeni Golov over 1 year ago

only accept full package names in update_package.rb

otherwise it might match substrings that we do not want.
examples:
  • `infoblox` matches both the plugin and the dependency gem
  • `puppet-strings` matches both the plugin and the dependency gem

View differences:

scripts/update_package.rb
raise "missing --name" if options[:name].nil?
raise "missing --version" if options[:version].nil?
# Try and find operating directories, prefer an exact match
# Try and find operating directories
def find_directories(name)
dirs = if File.exist?("plugins/#{name}")
Dir["plugins/#{name}"]
else
Dir["plugins/*#{name}*"]
end
if dirs.size > 1
raise "Ambiguous name given, multiple packages match: #{dirs.inspect}"
elsif dirs.empty?
# dependencies will have multiple directories, one per OS
dirs = Dir["dependencies/*/#{name}"]
if dirs.empty?
dirs = Dir["dependencies/*/*#{name}*"]
if dirs.empty?
raise "Cannot find a package with the name #{name}"
end
end
end
dirs = Dir["plugins/#{name}"] + Dir["dependencies/*/#{name}"]
raise "Cannot find a package with the name #{name}" if dirs.empty?
dirs
end

Also available in: Unified diff