Importer tries to read long descriptions from translations file. Still buggy.
The description text is not properly split after the first line.
This commit is contained in:
parent
f741112818
commit
63e3c62356
1 changed files with 14 additions and 2 deletions
|
|
@ -133,10 +133,19 @@ namespace :debshots do
|
|||
repositories = Rails.configuration.package_sources
|
||||
Rails.logger = Logger.new(STDOUT)
|
||||
Rails.logger.level = Logger::INFO
|
||||
# Rails.logger.level = Logger::DEBUG
|
||||
Rails.logger.level = Logger::DEBUG
|
||||
|
||||
Rails.logger.info "Importing long descriptoin from Debian repository (i18n)"
|
||||
|
||||
# BUG
|
||||
# Description-en: autoconf like tool
|
||||
# ACR is an autoconf like tool that allows you to create configure scripts for
|
||||
# your programs. The main aim of this tool is to teach developers how to create
|
||||
# portable builds of their tools, just using generic functions wrapped by acr to
|
||||
# generate portable shellscript.
|
||||
|
||||
# Parses as "your programs. The ..."
|
||||
|
||||
repositories.each do |repository|
|
||||
Rails.logger.info "Fetching Release file for repository: #{repository[:url]} with components: #{repository[:components]}"
|
||||
release = DebImporter::Release.new(repository[:url], repository[:components])
|
||||
|
|
@ -146,10 +155,13 @@ namespace :debshots do
|
|||
Rails.logger.info "> Component: #{component}"
|
||||
release.i18n(component, 'en').each do |pkg|
|
||||
Rails.logger.debug "i18n information: #{pkg}"
|
||||
next unless pkg[:'Description-en']
|
||||
# See if we have that package in the database
|
||||
if db_pkg = Package.find_by(name: pkg[:Package])
|
||||
Rails.logger.info "Updating long description for package #{db_pkg.name}"
|
||||
db_pkg.long_description = pkg[:'Description-en']
|
||||
text = pkg[:'Description-en']
|
||||
short_description, long_description = text.split("\n", 2)
|
||||
db_pkg.long_description = long_description
|
||||
db_pkg.save
|
||||
end
|
||||
end # pkg.each
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue