Permalink
Browse files

Keep a log of generated types.conf files

And allow to clean them up!
  • Loading branch information...
1 parent a96729a commit de1c7813f651d9e8f3c212618d622829d9a08a7a @terceiro terceiro committed Oct 2, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 gen/Rakefile
View
@@ -3,15 +3,28 @@ require 'fileutils'
require 'ffi'
require 'ffi/platform'
require 'ffi/tools/types_generator'
-types_conf = File.join(FFI::Platform::CONF_DIR, 'types.conf')
+types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf'))
+
+logfile = File.join(File.dirname(__FILE__), 'log')
file types_conf do |task|
options = {}
FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
f.puts FFI::TypesGenerator.generate(options)
end
+ File.open(logfile, 'w') do |log|
+ log.puts(types_conf)
+ end
end
task :default => types_conf do
end
+
+task :clean do
+ File.readlines(logfile).each do |file|
+ file.strip!
+ rm_f file
+ end
+ rm_f logfile
+end

0 comments on commit de1c781

Please sign in to comment.