Fix repo generation
parent
5e71ab6395
commit
81c0c105ff
|
@ -1,6 +1,7 @@
|
|||
require 'yaml'
|
||||
require 'pathname'
|
||||
|
||||
root_dir = "#{File.dirname(__FILE__)}/.."
|
||||
root_dir = Pathname.new("#{File.dirname(__FILE__)}/..").cleanpath
|
||||
output_index_path = "#{root_dir}/output/index.yaml"
|
||||
|
||||
`mkdir -p #{root_dir}/output`
|
||||
|
@ -14,12 +15,12 @@ list.each do |filename|
|
|||
chart_versions = repo_index['entries'][chart_name] || []
|
||||
repo_index['entries'][chart_name] = chart_versions
|
||||
version_info = YAML.load_file(filename)
|
||||
existing_info = chart_versions.find{ |item| item.version == version_info['version'] }
|
||||
existing_info = chart_versions.find{ |item| item['version'] == version_info['version'] }
|
||||
if existing_info then
|
||||
chart_versions[chart_versions.index(existing_info)] = version_info
|
||||
else
|
||||
chart_versions.push version_info
|
||||
end
|
||||
`tar -zcvf #{root_dir}/output/#{chart_name}-#{version_info['version']}.tar.gz #{File.dirname(filename)}`
|
||||
`tar -cvzf #{root_dir}/output/#{chart_name}-#{version_info['version']}.tgz #{File.dirname(filename)} -C #{File.dirname(filename)} .`
|
||||
File.open(output_index_path, 'w') { |file| file.write(repo_index.to_yaml( :Indent => 4, :UseHeader => true, :UseVersion => true )) }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue