Module: VisualizePacks
- Extended by:
- T::Sig
- Defined in:
- lib/visualize_packs.rb
Defined Under Namespace
Classes: ArrowHead
Class Method Summary collapse
Class Method Details
.package_graph!(args, raw_config, packages) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/visualize_packs.rb', line 29 def self.package_graph!(args, raw_config, packages) = OptionsParser.parse(args) all_packages = filtered(packages, ).compact.sort_by {|x| x.name } all_packages = remove_nested_packs(all_packages, ) all_package_names = all_packages.map &:name show_edge = show_edge_builder(, all_package_names) node_color = node_color_builder() node_protection = package_based_todos_text_maker() max_todo_count = max_todo_count(all_packages, show_edge, ) title = diagram_title(args, , max_todo_count) layers = (raw_config['layers'] || []) + ["NotInLayer"] grouped_packages = layers.inject({}) do |result, key| result[key] = [] result end all_packages.each do |package| key = package.config['layer'] || "NotInLayer" if layers.include?(key) grouped_packages[key] << package else raise RuntimeError, "Package #{package.name} has layer key #{key}. Known layers are only #{layers.join(", ")}" end end all_team_names = all_packages.map { |p| code_owner(p) }.uniq file = File.open(File. File.dirname(__FILE__) + "/graph.dot.erb") templ = file.read.gsub(/^ *(<%.+%>) *$/, '\1') template = ERB.new(templ, trim_mode: "<>-") template.result(binding) end |