1# Copyright (c) Meta Platforms, Inc. and affiliates. 2# 3# This source code is licensed under the MIT license found in the 4# LICENSE file in the root directory of this source tree. 5 6# Helper object to wrap the invocation of sysctl 7# This makes it easier to mock the behaviour in tests 8class SysctlChecker 9 def call_sysctl_arm64 10 return `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i 11 end 12end 13 14# Helper object to wrap system properties like RUBY_PLATFORM 15# This makes it easier to mock the behaviour in tests 16class Environment 17 def ruby_platform 18 return RUBY_PLATFORM 19 end 20end 21 22class Finder 23 def self.find_codegen_file(path) 24 js_files = '-name "Native*.js" -or -name "*NativeComponent.js"' 25 ts_files = '-name "Native*.ts" -or -name "*NativeComponent.ts"' 26 return `find #{path} -type f \\( #{js_files} -or #{ts_files} \\)`.split("\n").sort() 27 end 28end 29