Class: Vipergen::DirUtils
- Inherits:
-
Object
- Object
- Vipergen::DirUtils
- Defined in:
- lib/vipergen/dirutils.rb
Class Method Summary collapse
-
.directories_in(directory) ⇒ Object
Returns the directories inside a given one.
-
.gem_libdir ⇒ Object
Return a directory with the project libraries.
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) = File.(directory) return Dir.glob(File.join(,'*')).select {|f| File.directory? f} end |
.gem_libdir ⇒ Object
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.($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 |