Class: Vipergen::DirUtils

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

Class Method Summary collapse

Class Method Details

.directories_in(directory) ⇒ Object

Returns the directories inside a given one



12
13
14
15
# File 'lib/vipergen/dirutils.rb', line 12

def self.directories_in(directory)
	expanded_dir = File.expand_path(directory)
	return Dir.glob(File.join(expanded_dir,'*')).select {|f| File.directory? f}
end

.gem_libdirObject

Return a directory with the project libraries.



4
5
6
7
8
9
# File 'lib/vipergen/dirutils.rb', line 4

def self.gem_libdir
  t = ["#{File.dirname(File.expand_path($0))}/../lib/#{Vipergen::NAME}",
       "#{Gem.dir}/gems/#{Vipergen::NAME}-#{Vipergen::VERSION}/lib/#{Vipergen::NAME}"]
  t.each {|i| return i if File.readable?(i) }
  raise "both paths are invalid: #{t}"
end