Class: Kettle::Jem::GemSpecReader

Inherits:
Object
  • Object
show all
Defined in:
lib/kettle/jem.rb

Constant Summary collapse

DEFAULT_MINIMUM_RUBY =
Gem::Version.new("1.8").freeze

Class Method Summary collapse

Class Method Details

.clear_cache! ⇒ Object



1296
1297
1298
# File 'lib/kettle/jem.rb', line 1296

def clear_cache!
  CACHE.mutex.synchronize { CACHE.entries.clear }
end

.load(root) ⇒ Object



1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
# File 'lib/kettle/jem.rb', line 1280

def load(root)
  cache_key = File.expand_path(root.to_s)
  CACHE.mutex.synchronize do
    return CACHE.entries[cache_key] if CACHE.entries.key?(cache_key)
  end

  gemspec_path = Dir.glob(File.join(root.to_s, "*.gemspec")).first
  spec = load_gemspec(gemspec_path)
  result = (root: root, gemspec_path: gemspec_path, spec: spec)

  CACHE.mutex.synchronize do
    CACHE.entries[cache_key] = result
  end
  result
end