class TuyaCIDSL::DSLExecute

Attributes

folder[RW]
folder_path[RW]
from_git[RW]
git[RW]
sh[RW]

Public Class Methods

new(sh) click to toggle source
# File lib/tuya/ci/DSL/exe/dsl_exe.rb, line 6
def initialize(sh)
        @sh = sh
        @git = ''
        @from_git = false
        @folder = ''
        @folder_path = ''
end

Public Instance Methods

download(git) click to toggle source
# 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
execute() click to toggle source
# 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

Private Instance Methods

delete() click to toggle source
# File lib/tuya/ci/DSL/exe/dsl_exe.rb, line 46
def delete
        if @from_git
                `rm -rf #{@folder}`
        end
end
run_shell() click to toggle source
# File lib/tuya/ci/DSL/exe/dsl_exe.rb, line 40
def run_shell
        puts "CI will execute: #{@sh}".yellow
        system @sh
        $?.exitstatus
end