forked from UncleRus/esp-idf-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
44 lines (37 loc) · 1.16 KB
/
Rakefile
1
2
3
4
5
6
7
8
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
41
42
43
44
# frozen_string_literal: true
task default: [:test]
desc "Run all tests"
task test: [:rubocop, :rspec]
desc "Run rubocop"
task :rubocop do
sh "rubocop"
end
desc "Run rspec"
task :rspec do
sh "rspec --format d"
end
desc "Update README.md"
task :readme do
require "erb"
require_relative "spec/group_list"
require_relative "spec/component"
template = File.read("README.md.erb")
groups = GroupList.new("groups.yml").all
# * select if it is a directory
# * make path to metadata file
# * read it
# * parse it as YAML
# * take all components under "components" key
# * flatten the list of components
# * create a Component from the item
all_components = Dir.children("components")
.select { |f| File.directory?(File.join("components", f)) }
.map { |c| File.join("components", c, ".eil.yml") }
.map { |f| File.read(f) }
.map { |f| YAML.safe_load(f) }
.map { |y| y["components"] }
.flatten
.map { |c| Component.new(c) }
markdown = ERB.new(template, trim_mode: "%-").result(binding)
puts markdown
end