class Docker2plantuml::Command

Public Class Methods

new(argv) click to toggle source
# File lib/docker2plantuml/command.rb, line 11
def initialize(argv)
  @argv = argv
end
run(argv) click to toggle source
# File lib/docker2plantuml/command.rb, line 7
def self.run(argv)
  new(argv).run
end

Public Instance Methods

run() click to toggle source
# File lib/docker2plantuml/command.rb, line 15
def run
  json_data = if stdin?
                JSON.parse(STDIN.read)
              else
                JSON.parse(File.read(@argv[0]))
              end
  containers = Docker2plantuml::DockerJsonParser.new(json_data).parse
  w = Docker2plantuml::PlantUMLWriter.new(containers)
  puts Docker2plantuml::HEADER
  puts w.to_plant_uml
end
stdin?() click to toggle source
# File lib/docker2plantuml/command.rb, line 27
def stdin?
  File.pipe?(STDIN) || !File.select([STDIN], [], [], 0).nil?
end