Module: Proteus::Commands::Graph

Defined in:
lib/proteus/commands/graph.rb

Class Method Summary collapse

Class Method Details

.included(thor_class) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/proteus/commands/graph.rb', line 4

def self.included(thor_class)
  thor_class.class_eval do

    desc "graph", "Creates a graph showing the resources and their relations."
    def graph
      say "Generating graph. This might take a while"
      graph_command = <<~GRAPH_COMMAND
        cd #{context_path(context)} \
        && terraform graph -draw-cycles -module-depth=1 | dot -Tpng > graph.png \
        && open graph.png
      GRAPH_COMMAND
      `#{graph_command}`
    end

  end
end