lib/reap/project/log.rb in reap-9.3.5 vs lib/reap/project/log.rb in reap-9.4.0
- old
+ new
@@ -51,13 +51,15 @@
notes = log_notes_format(labels, records, (format=nil))
if records.empty?
puts "No #{labels.join(', ')} notes."
else
- log_notes_save(output, notes, labels)
+ files_saved = log_notes_save(output, notes, labels)
+ files_saved.each do |file|
+ puts "Updated #{file}"
+ end
puts counts.collect{|l,n| "#{n} #{l}s"}.join(', ')
- puts "Notes saved in #{output} folder."
end
end
private
@@ -113,11 +115,11 @@
recs.sort!{ |a,b| a['file'] <=> b['file'] }
recs.each do |record|
if last_file != record['file']
out << "\n"
last_file = record['file']
- out << "file://#{record['file']}\n"
+ out << "== file://#{record['file']}\n"
end
out << "* #{record['note'].rstrip} (#{record['line']})\n"
end
notes[label] = out
end
@@ -125,33 +127,36 @@
end
# Save notes.
def log_notes_save(dir, notes, labels)
+ files_saved = []
mkdir_p(dir)
# Remove empty note files.
(labels - notes.keys).each do |label|
file = File.join(dir,label)
rm(file) if File.file?(file)
end
# Create note files.
notes.each do |label, note|
- file = apply_naming_policy(label, 'txt')
+ file = apply_naming_policy(label, 'rdoc')
file = File.join(dir,file)
if dryrun?
puts "write #{file}"
else
- File.open(file,'w') do |f| f << note end
+ files_saved << file
+ File.open(file,'w') do |f| f << note end
end
end
+ return files_saved
end
#
def naming_policy
@naming_policy ||= (
- logconfig = configuration['log'] || {}
- policy = logconfig['policy'] || ['cap', 'ext']
+ logconfig = settings['log'] || {}
+ policy = logconfig['policy'] || ['down', 'ext']
list_option(policy)
)
end
# TODO: Naming policy needs to be apply to changelog too.