Class: Nu::LibTools

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

Instance Method Summary collapse

Instance Method Details

#folder_for(spec, lib, long_name = false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nu/lib_tools.rb', line 6

def folder_for(spec, lib, long_name=false)
	lib = File.expand_path(lib)
    if long_name
      name = spec.full_name
    else
      name = spec.name
    end

    to = "#{lib}/#{name}"
	if Dir[to] == [] #may need a smarter guy here
     FileUtils.mkpath to
    end

	return to
end

#read_specs_from_lib(lib) ⇒ Object



22
23
24
25
26
27
# File 'lib/nu/lib_tools.rb', line 22

def read_specs_from_lib(lib)
	lib = File.expand_path(lib)
	glob = "#{lib}/**/nu_spec.yaml"
	files = Dir.glob(glob)
	files.map{|file| YAML::load_file(file)}
end