summaryrefslogtreecommitdiffstats
path: root/lib/facter/macosx.rb
blob: 7c8562d4bd0f776758b74490010944bc708c72dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Fact: macosx
#
# Purpose:
#   Returns a number of Mac specific facts, from system profiler and
#   sw_vers.
#
# Resolution:
#   Uses util/macosx.rb to do the fact reconnaissance, then outputs them
#   preceded by 'sp_'
#
# Caveats:
#

#
# macosx.rb
# Additional Facts coming from Mac OS X system_profiler command
#
# Copyright (C) 2007 Jeff McCune
# Author: Jeff McCune <jeff.mccune@northstarlabs.net>
#
# Jeff McCune
# There's a lot more information coming out of system_profiler -xml
# We could add quite a bit more, but I didn't want to overload facter
# at this point in time.
# In particular, Installed Software might be an interesting addition.

require 'facter/util/macosx'

if Facter.value(:kernel) == "Darwin"
    Facter::Util::Macosx.hardware_overview.each do |fact, value|
        Facter.add("sp_#{fact}") do
            confine :kernel => :darwin
            setcode do
                value.to_s
            end
        end
    end

    Facter::Util::Macosx.os_overview.each do |fact, value|
        Facter.add("sp_#{fact}") do
            confine :kernel => :darwin
            setcode do
                value.to_s
            end
        end
    end

    Facter::Util::Macosx.sw_vers.each do |fact, value|
        Facter.add(fact) do
            confine :kernel => :darwin
            setcode do
                value
            end
        end
    end
end