Class: TuyaCIDSL::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/tuya/ci/DSL/analyzer/file_parse.rb

Instance Method Summary collapse

Constructor Details

#initialize(file = './CIFile') ⇒ Analyzer

Returns a new instance of Analyzer.



3
4
5
6
7
8
9
# File 'lib/tuya/ci/DSL/analyzer/file_parse.rb', line 3

def initialize(file='./CIFile')
	@file = file
	puts "Can not find: #{@file}".red unless File.exist? @file
	file_content = File.read @file
	file_content.gsub! /^\s*(#|\/\/).*$/,''
	@content = file_content
end

Instance Method Details

#p_monitorObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tuya/ci/DSL/analyzer/file_parse.rb', line 11

def p_monitor
	monitor_content = @content
	monitor = TuyaCIMonitor.new
	monitor.name = @file
	monitor.ci do
		begin
			eval monitor_content
		rescue Exception => e
			puts "Load trigger failed: #{e}".red
		ensure
		end
	end
	monitor
end