add library method to detect beta

This commit is contained in:
Jacob Zaval 2023-09-07 10:12:14 -07:00
Родитель 23c68439af
Коммит db6daaa77c
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -42,6 +42,10 @@ module MacOS
shell_out('defaults -currentHost read-type com.apple.screensaver idleTime', user: @user).stdout.chomp == 'Type is integer' shell_out('defaults -currentHost read-type com.apple.screensaver idleTime', user: @user).stdout.chomp == 'Type is integer'
end end
end end
def beta?
node['platform_version'].chars.last.match?(/0/) && node['platform_build'].chars.last.match?(/[[:alpha:]]/)
end
end end
end end
Chef::Resource.include(MacOS::System) Chef::Resource.include(MacOS::System)

Просмотреть файл

@ -3,13 +3,12 @@ unified_mode true
provides :command_line_tools provides :command_line_tools
property :name, String, default: '' property :name, String, default: ''
property :beta, [true, false], default: false
property :compile_time, [true, false], property :compile_time, [true, false],
description: 'Install the Xcode Command Line Tools at compile time.', description: 'Install the Xcode Command Line Tools at compile time.',
default: false, desired_state: false default: false, desired_state: false
action :install do action :install do
if new_resource.beta if MacOS.beta?
directory 'create CLT folder' do directory 'create CLT folder' do
path '/Library/Developer/CommandLineTools' path '/Library/Developer/CommandLineTools'
recursive true recursive true
@ -42,7 +41,7 @@ action :install do
end end
action :upgrade do action :upgrade do
if new_resource.beta if MacOS.beta?
file 'create CLT folder' do file 'create CLT folder' do
path '/Library/Developer/CommandLineTools' path '/Library/Developer/CommandLineTools'
recursive true recursive true