Class: TuyaCIDSL::Command::MonitorCreate

Inherits:
TuyaCIDSL::Command show all
Defined in:
lib/tuya/ci/DSL/command/create.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ MonitorCreate

Returns a new instance of MonitorCreate.



31
32
33
34
35
# File 'lib/tuya/ci/DSL/command/create.rb', line 31

def initialize(argv)
	super
	@name = argv.option('name')
	@file_name = @name
end

Class Method Details

.optionsObject



16
17
18
19
20
# File 'lib/tuya/ci/DSL/command/create.rb', line 16

def self.options
	[
		['--name=file_name', 'file name']
	].concat(super)
end

Instance Method Details

#runObject



37
38
39
40
41
42
# File 'lib/tuya/ci/DSL/command/create.rb', line 37

def run
	super

	dsl = TuyaCIDSL::TriggerCreator.new @file_name
	dsl.create
end

#validate!Object



22
23
24
25
26
27
28
29
# File 'lib/tuya/ci/DSL/command/create.rb', line 22

def validate!
	@file_name = 'CIFile' unless @name
	if @file_name == 'CIFile'
		if File.exist? './CIFile'
			@file_name = TYCiCore::TYAsk.ask 'File: CIFile is existed, please enter another file name'
		end
	end
end