############### vmc extension require 'rubygems' version = ">= 0" if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then version = $1 ARGV.shift end gem 'vmc', version require 'time' FILE_PATH = "/tmp" LOG_FILE_PATH = FILE_PATH + "/cf_inspector.log" HTML_FILE_PATH = FILE_PATH + "/vmc_#{ARGV[0]}_#{Time.now.strftime("%Y%m%d_%H%M%S")}.html" CF_HOME = ENV["CF_HOME"] || "~/cloudfoundry" #clear log file File.open(LOG_FILE_PATH,'w') do |fd| fd.puts "" end $LOAD_PATH.push("#{CF_HOME}/vcap/common/lib") require Gem.bin_path('vmc', 'vmc', version).split('/')[0...-1].join('/') + "/../lib/cli" require "vcap/common" ############### class definition of html files generator require 'json' #load json object from log file class HtmlGenerator COMPONENTS = %w(vmc cloud_controller router dea services health_manager stager staging dev_setup) def initialize(file_path) @inspect_list = [] open(file_path) {|file| while line = file.gets begin @inspect_list << JSON.parse(line) rescue end end } @html = "" end def generate write_header write_body write_footer @html end def write_header @html += <<-"EOS"
#{component} | " end @html += "
---|