class Kubes::Compiler::Shared::Helpers::Deprecated
Public Instance Methods
built_image()
click to toggle source
# File lib/kubes/compiler/shared/helpers/deprecated.rb, line 3 def built_image puts "DEPRECATED: built_image is deprecated, use docker_image helper instead.".color(:yellow) print_source end
error_info()
click to toggle source
# File lib/kubes/compiler/shared/helpers/deprecated.rb, line 8 def error_info error_info = caller.find { |l| l.include?('.kubes/resources') } path, line_number, _ = error_info.split(':') {path: path, line_number: line_number} end
print_source()
click to toggle source
# File lib/kubes/compiler/shared/helpers/deprecated.rb, line 14 def print_source info = error_info path = info[:path] line_number = info[:line_number].to_i pretty_path = path.sub("#{Kubes.root}/",'') puts "Here's the line in #{pretty_path} that calls built_image:\n\n" contents = IO.read(path) content_lines = contents.split("\n") context = 5 # lines of context top, bottom = [line_number-context-1, 0].max, line_number+context-1 lpad = content_lines.size.to_s.size content_lines[top..bottom].each_with_index do |line_content, index| current_line = top+index+1 if current_line == line_number printf("%#{lpad}d %s\n".color(:red), current_line, line_content) else printf("%#{lpad}d %s\n", current_line, line_content) end end end