Module: Jim

Defined in:
lib/jim.rb,
lib/jim/cli.rb,
lib/jim/rack.rb,
lib/jim/index.rb,
lib/jim/bundler.rb,
lib/jim/installer.rb,
lib/jim/version_parser.rb

Defined Under Namespace

Classes: Bundler, CLI, Error, FileExists, Index, InstallError, Installer, Rack, VersionParser

Constant Summary collapse

VERSION =
'0.3.3'

Class Method Summary collapse

Class Method Details

.each_path_in_directories(directories, ext, ignore_directories = [], &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jim.rb', line 29

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

.loggerObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/jim.rb', line 18

def self.logger
  @logger ||= LOGGER if defined?(LOGGER)
  if !@logger
    @logger           = Logger.new(STDOUT)
    @logger.level     = Logger::INFO
    @logger.formatter = Proc.new {|s, t, n, msg| "#{msg}\n"}
    @logger
  end
  @logger
end

.logger=(logger) ⇒ Object



14
15
16
# File 'lib/jim.rb', line 14

def self.logger=(logger)
  @logger = logger
end