Class: Kanrisuru::Util::OsFamily

Inherits:
Object
  • Object
show all
Defined in:
lib/kanrisuru/util/os_family.rb

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object



216
217
218
# File 'lib/kanrisuru/util/os_family.rb', line 216

def self.[](name)
  @os_dict[name.to_sym] if !name.nil? && @os_dict.include?(name.to_sym)
end

.family_include_distribution?(family, dist) ⇒ Boolean

Returns:

  • (Boolean)


192
193
194
195
196
197
198
199
200
201
202
# File 'lib/kanrisuru/util/os_family.rb', line 192

def self.family_include_distribution?(family, dist)
  if OsFamily[dist].nil?
    false
  elsif OsFamily[dist][:type] == 'alias'
    family_include_distribution?(family, OsFamily[dist][:to])
  elsif OsFamily[dist][:os_family] == family
    true
  else
    family_include_distribution?(family, OsFamily[dist][:upstream])
  end
end

.upstream_include_distribution?(upstream, dist) ⇒ Boolean

Returns:

  • (Boolean)


204
205
206
207
208
209
210
211
212
213
214
# File 'lib/kanrisuru/util/os_family.rb', line 204

def self.upstream_include_distribution?(upstream, dist)
  if OsFamily[dist].nil?
    false
  elsif OsFamily[dist][:type] == 'alias'
    upstream_include_distribution?(upstream, OsFamily[dist][:to])
  elsif OsFamily[dist][:upstream] == upstream && OsFamily[dist][:type] == 'distribution'
    true
  else
    upstream_include_distribution?(upstream, OsFamily[dist][:upstream])
  end
end