Created
June 30, 2010 03:02
-
-
Save danlynn/458176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'pathname' | |
| require 'lib/database_utils' | |
| DatabaseUtils.establish_connection | |
| puts "--- Scanning filesystem to add missing files to db ---" | |
| puts " Total java files in db before sync = #{Source.count}" | |
| filesystem_src_count = 0 | |
| Pathname.new($config["root_src_dir"]).find do |f| | |
| if f.extname == ".java" | |
| Source.create_from_pathname(f) unless Source.find(:first, :conditions => ["path = ?", f]) | |
| filesystem_src_count += 1 | |
| puts " #{filesystem_src_count} files" if filesystem_src_count % 100 == 0 | |
| end | |
| end | |
| puts " Total java files in db after sync = #{Source.count}" | |
| puts " Total java files scanned = #{filesystem_src_count}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment