This commit is contained in:
Mark John Merin 2022-03-04 15:07:50 -08:00
Родитель 550cc0dae9
Коммит c87dfdc9cd
4 изменённых файлов: 8 добавлений и 8 удалений

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

@ -25,7 +25,6 @@ module MacOS
end end
def convert_array_to_string(value) def convert_array_to_string(value)
end end
def convert_to_string_from_data_type(value) def convert_to_string_from_data_type(value)
@ -39,11 +38,11 @@ module MacOS
when TrueClass when TrueClass
"-bool #{value}" "-bool #{value}"
when Hash when Hash
"-dict #{value.map { |key,value| Shellwords.shellescape(key) + ' ' + convert_to_string_from_data_type(value)}.join(' ')}" "-dict #{value.map { |key, value| Shellwords.shellescape(key) + ' ' + convert_to_string_from_data_type(value) }.join(' ')}"
when String when String
"-string #{Shellwords.shellescape(value)}" "-string #{Shellwords.shellescape(value)}"
when Float when Float
"-float #{value}" "-float #{value}"
else else
raise "Unknown or unsupported data type: #{value} of #{value.class}" raise "Unknown or unsupported data type: #{value} of #{value.class}"
end end

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

@ -147,15 +147,15 @@ describe MacOS::PlistHelpers, '#convert_to_string_from_data_type' do
end end
it 'returns the required dictionary entry' do it 'returns the required dictionary entry' do
expect(convert_to_string_from_data_type({'a' => 'b', 'c' => 'd'})).to eq '-dict a -string b c -string d' expect(convert_to_string_from_data_type({ 'a' => 'b', 'c' => 'd' })).to eq '-dict a -string b c -string d'
end end
it 'returns the required dictionary entry with embedded quotes and numbers' do it 'returns the required dictionary entry with embedded quotes and numbers' do
expect(convert_to_string_from_data_type({'a' => 3, 'c' => '"d"'})).to eq '-dict a -integer 3 c -string \"d\"' expect(convert_to_string_from_data_type({ 'a' => 3, 'c' => '"d"' })).to eq '-dict a -integer 3 c -string \"d\"'
end end
it 'returns the required array entry' do it 'returns the required array entry' do
expect(convert_to_string_from_data_type(['a', 'b', 'c'])).to eq '-array -string a -string b -string c' expect(convert_to_string_from_data_type(%w(a b c))).to eq '-array -string a -string b -string c'
end end
it 'returns the required array entry with embedded quotes' do it 'returns the required array entry with embedded quotes' do

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

@ -16,7 +16,7 @@ describe 'xcode' do
'4.3.2 for Lion', '4.3.2 for Lion',
'4.3.3 for Lion', '4.3.3 for Lion',
'4.4', '4.4',
'4.4.1', '4.4.1',
'4.5', '4.5',
'4.5.1', '4.5.1',
'4.5.2', '4.5.2',

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

@ -3,7 +3,8 @@ user_home = File.join('/', 'Users', user)
if Gem::Version.new(node['platform_version']) >= Gem::Version.new('10.13') if Gem::Version.new(node['platform_version']) >= Gem::Version.new('10.13')
admin_credentials = ['-adminUser', node['macos']['admin_user'], '-adminPassword', node['macos']['admin_password']] admin_credentials = ['-adminUser', node['macos']['admin_user'], '-adminPassword', node['macos']['admin_password']]
else '' else
''
end end
execute "add user #{user}" do execute "add user #{user}" do