Module: Travis::Yaml

Extended by:
Yaml
Included in:
Yaml
Defined in:
lib/travis/yaml.rb,
lib/travis/yaml/nodes.rb,
lib/travis/yaml/matrix.rb,
lib/travis/yaml/parser.rb,
lib/travis/yaml/version.rb,
lib/travis/yaml/nodes/os.rb,
lib/travis/yaml/nodes/env.rb,
lib/travis/yaml/nodes/git.rb,
lib/travis/yaml/nodes/jdk.rb,
lib/travis/yaml/nodes/dist.rb,
lib/travis/yaml/nodes/node.rb,
lib/travis/yaml/nodes/root.rb,
lib/travis/yaml/nodes/ruby.rb,
lib/travis/yaml/serializer.rb,
lib/travis/yaml/nodes/cache.rb,
lib/travis/yaml/nodes/group.rb,
lib/travis/yaml/nodes/stage.rb,
lib/travis/yaml/parser/ruby.rb,
lib/travis/yaml/nodes/addons.rb,
lib/travis/yaml/nodes/deploy.rb,
lib/travis/yaml/nodes/matrix.rb,
lib/travis/yaml/nodes/scalar.rb,
lib/travis/yaml/parser/dummy.rb,
lib/travis/yaml/parser/psych.rb,
lib/travis/yaml/nodes/android.rb,
lib/travis/yaml/nodes/mapping.rb,
lib/travis/yaml/nodes/version.rb,
lib/travis/yaml/secure_string.rb,
lib/travis/yaml/nodes/branches.rb,
lib/travis/yaml/nodes/compiler.rb,
lib/travis/yaml/nodes/language.rb,
lib/travis/yaml/nodes/os_entry.rb,
lib/travis/yaml/nodes/sequence.rb,
lib/travis/yaml/serializer/json.rb,
lib/travis/yaml/serializer/ruby.rb,
lib/travis/yaml/serializer/yaml.rb,
lib/travis/yaml/nodes/fixed_value.rb,
lib/travis/yaml/nodes/virtual_env.rb,
lib/travis/yaml/serializer/legacy.rb,
lib/travis/yaml/nodes/bundler_args.rb,
lib/travis/yaml/nodes/deploy_entry.rb,
lib/travis/yaml/nodes/open_mapping.rb,
lib/travis/yaml/nodes/version_list.rb,
lib/travis/yaml/serializer/generic.rb,
lib/travis/yaml/nodes/notifications.rb,
lib/travis/yaml/nodes/compiler_entry.rb,
lib/travis/yaml/nodes/deploy_conditions.rb,
lib/travis/yaml/nodes/language_specific.rb

Defined Under Namespace

Modules: Nodes, Parser, Serializer Classes: Matrix, SecureString

Constant Summary collapse

VERSION =
'0.2.0'

Instance Method Summary collapse

Instance Method Details

#matrix(value) ⇒ Object



38
39
40
# File 'lib/travis/yaml.rb', line 38

def matrix(value)
  Matrix.new parse(value)
end

#matrix!(value, file_name = '.travis.yml') ⇒ Object



42
43
44
# File 'lib/travis/yaml.rb', line 42

def matrix!(value, file_name = '.travis.yml')
  Matrix.new parse!(value, file_name)
end

#new {|root| ... } ⇒ Object

Yields:



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

def new
  root = Nodes::Root.new
  yield root if block_given?
  root.deep_verify
  root
end

#parse(value) {|result| ... } ⇒ Object Also known as: load

Yields:

  • (result)


14
15
16
17
18
# File 'lib/travis/yaml.rb', line 14

def parse(value)
  result = Parser.parse(value)
  yield result if block_given?
  result
end

#parse!(value, file_name = '.travis.yml', &block) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/travis/yaml.rb', line 22

def parse!(value, file_name = '.travis.yml', &block)
  result = parse(value, &block)
  result.nested_warnings.each do |key, message|
    warn key.empty? ? "#{file_name}: #{message}" :
      "#{file_name}: #{key.join(?.)} section - #{message}"
  end
  result
end