lib/jim.rb in jim-0.1.2 vs lib/jim.rb in jim-0.2.0
- old
+ new
@@ -1,14 +1,16 @@
require 'downlow'
require 'logger'
require 'yajl'
+require 'version_sorter'
+require 'digest/md5'
-
module Jim
- VERSION = '0.1.2'
+ VERSION = '0.2.0'
class Error < RuntimeError; end
+ class InstallError < Error; end
class FileExists < Error; end
def self.logger=(logger)
@logger = logger
end
@@ -20,9 +22,24 @@
@logger.level = Logger::INFO
@logger.formatter = Proc.new {|s, t, n, msg| "#{msg}\n"}
@logger
end
@logger
+ end
+
+ def self.each_path_in_directories(directories, ext, ignore_directories = [], &block)
+ ignore_regexp = ignore_directories.empty? ? false : /(\/|^)(#{ignore_directories.join('|')})\//
+ directories.each do |dir|
+ dir = Pathname.new(dir).expand_path
+ Dir.glob(Pathname.new(dir) + '**' + "*#{ext}") do |filename|
+ next if File.directory?(filename)
+ if ignore_regexp
+ basepath = filename.to_s.gsub(dir.to_s, '/')
+ next if basepath =~ ignore_regexp
+ end
+ yield Pathname.new(filename)
+ end
+ end
end
autoload :Installer, 'jim/installer'
autoload :Index, 'jim/index'
autoload :Bundler, 'jim/bundler'
\ No newline at end of file