lib/boson/repo_index.rb in boson-more-0.3.0 vs lib/boson/repo_index.rb in boson-more-0.3.1

- old
+ new

@@ -32,15 +32,11 @@ end # Reads and initializes index. def read return if @read - @libraries, @commands, @lib_hashes = exists? ? - File.open(marshal_file, 'rb') do |f| - f.flock(File::LOCK_EX) - Marshal.load(f) - end : [[], [], {}] + @libraries, @commands, @lib_hashes = exists? ? load_index_from_file : [[], [], {}] delete_stale_libraries_and_commands set_command_namespaces @read = true end @@ -127,9 +123,16 @@ repo.all_libraries.inject({}) {|h, e| lib_file = FileLibrary.library_file(e, repo.dir) h[e] = Digest::MD5.hexdigest(File.read(lib_file)) if File.exists?(lib_file) h } + end + + def load_index_from_file + File.open(marshal_file, 'rb') do |f| + f.flock(File::LOCK_EX) + Marshal.load(f) + end end #:startdoc: end end