Class: TuyaCIDSL::DSLExecute

Inherits:
Object
  • Object
show all
Defined in:
lib/tuya/ci/DSL/exe/dsl_exe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sh) ⇒ DSLExecute

Returns a new instance of DSLExecute.



6
7
8
9
10
11
12
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 6

def initialize(sh)
	@sh = sh
	@git = ''
	@from_git = false
	@folder = ''
	@folder_path = ''
end

Instance Attribute Details

#folderObject

Returns the value of attribute folder.



4
5
6
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 4

def folder
  @folder
end

#folder_pathObject

Returns the value of attribute folder_path.



4
5
6
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 4

def folder_path
  @folder_path
end

#from_gitObject

Returns the value of attribute from_git.



4
5
6
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 4

def from_git
  @from_git
end

#gitObject

Returns the value of attribute git.



4
5
6
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 4

def git
  @git
end

#shObject

Returns the value of attribute sh.



4
5
6
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 4

def sh
  @sh
end

Instance Method Details

#download(git) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 28

def download(git)

	@from_git = true
	git_downloader = TYCiCore::GitDownloader.new git
	@git = git
	@folder = git_downloader.folder
	git_downloader.download '.dsl'
	@folder_path = git_downloader.folder_path
end

#executeObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tuya/ci/DSL/exe/dsl_exe.rb', line 14

def execute
	if @from_git
		command_cp = "cp -a #{@folder_path} ./"
		puts "Trigger will copy shell by:#{command_cp}"
		system command_cp

		result = run_shell
		delete
	else
		result = run_shell
	end
	result
end