Class: Travis::Yaml::Nodes::Root

Inherits:
Mapping show all
Includes:
LanguageSpecific
Defined in:
lib/travis/yaml/nodes/root.rb

Direct Known Subclasses

Matrix::Entry

Constant Summary collapse

FEATURE_KEYS =
[:dist, :group]

Constants included from LanguageSpecific

LanguageSpecific::LANGUAGE_SPECIFIC

Instance Attribute Summary

Attributes inherited from Mapping

#mapping

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods included from LanguageSpecific

#verify_language

Methods inherited from Mapping

#==, #[], #[]=, #accept_key?, aliases, auto_prefix, #deep_verify, define_map_accessor, drop_empty, #drop_empty?, #each_scalar, #empty?, experimental, #include?, map, #mapped_key, mapping, prefix_scalar, prefix_sequence, #prepare, required, subnode_for, #subnode_for, #verify_empty, #verify_errors, #verify_experimental, #verify_required, #visit_key_value, #visit_mapping, #visit_pair, #with_value!

Methods inherited from Node

#decrypt, #decrypted?, #deep_verify, #dup, #encrypt, #encrypted?, #error, #errors, #errors?, has_default?, #method_missing, #nested_warning, #prepare, #respond_to_missing?, #serialize, #to_json, #to_legacy_ruby, #to_ruby, #to_s, #to_yaml, #verify_language, #visit_child, #visit_mapping, #visit_pair, #visit_scalar, #visit_sequence, #visit_unexpected, #warngings?, #warning, #warnings, #with_value

Constructor Details

#initializeRoot

Returns a new instance of Root.



27
28
29
# File 'lib/travis/yaml/nodes/root.rb', line 27

def initialize
  super(nil)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::Yaml::Nodes::Node

Instance Method Details

#inspectObject



59
60
61
# File 'lib/travis/yaml/nodes/root.rb', line 59

def inspect
  "#<Travis::Yaml:#{super}>"
end

#nested_warningsObject



55
56
57
# File 'lib/travis/yaml/nodes/root.rb', line 55

def nested_warnings(*)
  super.uniq
end

#to_matrixObject



63
64
65
# File 'lib/travis/yaml/nodes/root.rb', line 63

def to_matrix
  Travis::Yaml.matrix(self)
end

#verifyObject



31
32
33
34
35
36
# File 'lib/travis/yaml/nodes/root.rb', line 31

def verify
  super
  verify_os
  verify_language(language)
  FEATURE_KEYS.each {|feature| warn_on_feature feature}
end

#verify_osObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/travis/yaml/nodes/root.rb', line 38

def verify_os
  self.os = language.default_os unless include? :os
  warning 'your repository must be feature flagged for the "os" setting to be used' if os and os != language.default_os

  if os.include? 'osx' and jdk
    # https://github.com/travis-ci/travis-ci/issues/2317
    warning 'dropping "jdk" section: currently not supported on "osx"'
    @mapping.delete('jdk')
  end
end

#warn_on_feature(feature) ⇒ Object



49
50
51
52
53
# File 'lib/travis/yaml/nodes/root.rb', line 49

def warn_on_feature(feature)
  if include? feature
    warning 'your repository must be feature flagged for the "%s" setting to be used', feature
  end
end