class TYCiCore::ConfigModules
Attributes
advance_fields[RW]
config_path[RW]
pod_path[RW]
Public Class Methods
new(config_path="./config_modules.json", advance_fields="{}", pod_path="./Pods/")
click to toggle source
# File lib/tuya/ci/core/config/config_modules.rb, line 7 def initialize(config_path="./config_modules.json", advance_fields="{}", pod_path="./Pods/") @config_path = config_path @advance_fields = advance_fields @pod_path = pod_path end
Public Instance Methods
config_hash()
click to toggle source
# File lib/tuya/ci/core/config/config_modules.rb, line 13 def config_hash content = File.read @config_path hash = JSON content hash end
module?(name)
click to toggle source
# File lib/tuya/ci/core/config/config_modules.rb, line 46 def module?(name) # find_command = "find #{pod_path} -iname #{name}Impl.h" # # puts("find_command is #{find_command}") # find_command_result = Action.sh find_command # # puts("find_command_result is #{find_command_result}") # if find_command_result.length > 0 # return true # else # return module_lib?(name) # end commands = %W(#{pod_path} -iname #{name}Impl.h) result = EXE.exe('find', commands) if result.length > 0 true else module_lib?(name) end end
module_lib?(name)
click to toggle source
# File lib/tuya/ci/core/config/config_modules.rb, line 66 def module_lib?(name) puts "Name is #{name}".green lib_path = "#{@pod_path}#{name}/#{name}*/lib#{name}.a" puts "File_path is #{lib_path}".yellow libs_path_result = Dir.glob(lib_path) puts("The path is#{libs_path_result}") if libs_path_result.length > 0 file_path = libs_path_result[0] # find_command = "nm -gU #{file_path} | grep '_OBJC_CLASS_\\$_#{name}Impl'" # exists_impl = true # find_command_result = Action.sh( # find_command, # error_callback: ->(result) { # exists_impl = false # } # ) # TODO exist? commands = %W(-gU #{file_path} | grep '_OBJC_CLASS_\\$_#{name}Impl') find_result = EXE.exe('nm', commands) if exists_impl && !find_result.empty? puts "Static lib #{name} has #{name}mpl".green true else puts "Static lib #{name} can not find #{name}mpl".red false end end false end
modules_in_pods()
click to toggle source
# File lib/tuya/ci/core/config/config_modules.rb, line 19 def modules_in_pods result = [] pod_directories = Dir["#{@pod_path}*"].reject{|o| not File.directory?(o)} pod_directories.each do |folder| name = folder.gsub(/\s+/,'').split('/')[-1] if module?(name) && name!="Target Support Files" result.push(name) end end result end
setup_modules()
click to toggle source
# File lib/tuya/ci/core/config/config_modules.rb, line 31 def setup_modules puts "Setup #{@config_path} at #{@pod_path}".green modules = modules_in_pods advance_json = JSON.parse(@advance_fields) advance_json["modules"] = modules advance_json_pretty = JSON.pretty_generate(advance_json) fh = File.new(@config_path, "w") fh.puts advance_json_pretty fh.close end