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
def convert_array_to_string(value)
end
def convert_to_string_from_data_type(value)
@ -39,11 +38,11 @@ module MacOS
when TrueClass
"-bool #{value}"
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
"-string #{Shellwords.shellescape(value)}"
when Float
"-float #{value}"
"-float #{value}"
else
raise "Unknown or unsupported data type: #{value} of #{value.class}"
end

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

@ -147,15 +147,15 @@ describe MacOS::PlistHelpers, '#convert_to_string_from_data_type' do
end
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
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
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
it 'returns the required array entry with embedded quotes' do

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

@ -16,7 +16,7 @@ describe 'xcode' do
'4.3.2 for Lion',
'4.3.3 for Lion',
'4.4',
'4.4.1',
'4.4.1',
'4.5',
'4.5.1',
'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')
admin_credentials = ['-adminUser', node['macos']['admin_user'], '-adminPassword', node['macos']['admin_password']]
else ''
else
''
end
execute "add user #{user}" do