Class: Topaz::Contents

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

Class Method Summary collapse

Class Method Details

.contents(gem, version = '> 0.0.0') ⇒ Object

Lists all files associated with a gem.



12
13
14
15
16
17
18
19
20
21
# File 'lib/topaz.rb', line 12

def contents(gem, version = '> 0.0.0')
  s = Gem::SourceIndex.installed_spec_directories
  spec = Gem::SourceIndex.from_gems_in(*s).search(gem, version).last
  raise 'Gem provided could not be found' unless spec
  files = []
  spec.files.each do |f|
    files.push File.join(spec.full_gem_path, f)
  end
  files
end