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



1277
1278
1279
# File 'lib/kettle/jem.rb', line 1277

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

.load(root) ⇒ Object



1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
# File 'lib/kettle/jem.rb', line 1261

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