File: plugin_depends.rb

package info (click to toggle)
mikutter 3.8.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,544 kB
  • sloc: ruby: 20,548; sh: 99; makefile: 19
file content (32 lines) | stat: -rw-r--r-- 872 bytes parent folder | download | duplicates (3)
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
# -*- coding: utf-8 -*-

miquire :boot, 'delayer'
miquire :core, 'miquire_plugin'

using Miquire::ToSpec

Miquire::Plugin.loadpath << Environment::PLUGIN_PATH << File.join(File.dirname(__FILE__), "..", "..", "plugin") << File.join(Environment::CONFROOT, 'plugin')

writer = lambda do |spec|
  depends = Miquire::Plugin.depended_plugins(spec)
  if (depends or []).empty?
    puts "  #{spec[:slug]};"
  else
    depends.each do |depend|
      puts "  #{spec[:slug]} -> #{depend[:slug]};"
    end
  end
end

puts 'digraph mikutter_plugin {'

if Array(Mopt.plugin).empty?
  Miquire::Plugin.each_spec(&writer)
else
  available = Array(Mopt.plugin).inject(Set.new(Array(Mopt.plugin))){|depends, depend_slug|
    depends + Miquire::Plugin.depended_plugins(depend_slug, recursive: true).
      map{|spec| spec[:slug] }}
  available.map{|x| x.to_spec }.each(&writer)
end

puts '}'