Method: #parse_specs

Defined in:
lib/cli.rb

#parse_specs(path) ⇒ Object

Helpers



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cli.rb', line 9

def parse_specs(path)

  # Paths
  paths = []
  if path
    if File.file?(path)
      paths = [path]
    elsif File.directory?(path)
      paths = Dir.glob("#{path}/*.yml")
    end
  end
  if !path
    if paths.empty?
      paths = Dir.glob('packspec.yml')
    end
    if paths.empty?
      paths = Dir.glob("packspec/*.yml")
    end
  end

  # Specs
  specs = []
  for path in paths
    spec = parse_spec(path)
    if spec
      specs.push(spec)
    end
  end

  return specs

end