Module | Facter::Macosx |
In: |
lib/facter/util/macosx.rb
|
macosx.rb Support methods for Apple OSX facts
Copyright (C) 2007 Jeff McCune Author: Jeff McCune <jeff.mccune@northstarlabs.net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License) This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA
JJM I‘d really like to dynamically generate these methods by looking at the _name key of the _items dict for each _dataType
# File lib/facter/util/macosx.rb, line 26 26: def self.hardware_overview 27: # JJM Perhaps we should cache the XML data in a "class" level object. 28: top_level_plist = Plist::parse_xml %x{/usr/sbin/system_profiler -xml SPHardwareDataType} 29: system_hardware = top_level_plist[0]['_items'][0] 30: system_hardware.delete '_name' 31: system_hardware 32: end