Class: Prick::Build::BuildNode

Inherits:
Node
  • Object
show all
Defined in:
lib/prick/builder/node.rb

Overview

A build.yml file node

Direct Known Subclasses

RootBuildNode

Instance Attribute Summary collapse

Attributes inherited from Node

#args, #kind, #parent, #path, #phase

Instance Method Summary collapse

Methods inherited from Node

#dir, #lines, #name, #prefix_lines, #relpath, #schema, #schema=, #source, #source_lines, #to_s

Constructor Details

#initialize(parent, path) ⇒ BuildNode

Returns a new instance of BuildNode.



270
271
272
273
274
275
276
277
278
279
# File 'lib/prick/builder/node.rb', line 270

def initialize(parent, path)
  super(parent, nil, :yml, path)
  @init_nodes = []
  @decl_nodes = []
  @seed_nodes = []
  @auth_nodes = []
  @term_nodes = []
  @pg_graph_ignore_schema = false
  @refresh_schema = true
end

Instance Attribute Details

#auth_nodesObject (readonly)

Returns the value of attribute auth_nodes.



264
265
266
# File 'lib/prick/builder/node.rb', line 264

def auth_nodes
  @auth_nodes
end

#decl_nodesObject (readonly)

Returns the value of attribute decl_nodes.



262
263
264
# File 'lib/prick/builder/node.rb', line 262

def decl_nodes
  @decl_nodes
end

#has_schemaObject

True if the build file contains a ‘schema’ attribute



256
257
258
# File 'lib/prick/builder/node.rb', line 256

def has_schema
  @has_schema
end

#init_nodesObject (readonly)

Nodes are executed in this order:



261
262
263
# File 'lib/prick/builder/node.rb', line 261

def init_nodes
  @init_nodes
end

#pg_graph_ignore_schemaObject

Returns the value of attribute pg_graph_ignore_schema.



267
268
269
# File 'lib/prick/builder/node.rb', line 267

def pg_graph_ignore_schema
  @pg_graph_ignore_schema
end

#refresh_schemaObject

Returns the value of attribute refresh_schema.



268
269
270
# File 'lib/prick/builder/node.rb', line 268

def refresh_schema
  @refresh_schema
end

#seed_nodesObject (readonly)

Returns the value of attribute seed_nodes.



263
264
265
# File 'lib/prick/builder/node.rb', line 263

def seed_nodes
  @seed_nodes
end

#term_nodesObject (readonly)

Returns the value of attribute term_nodes.



265
266
267
# File 'lib/prick/builder/node.rb', line 265

def term_nodes
  @term_nodes
end

Instance Method Details

#dumpObject



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/prick/builder/node.rb', line 283

def dump
  puts "BuildNode #{path}"
  indent {
    puts "has_schema: #{has_schema}"
    puts "schema: #{@schema || 'nil'}"
    puts "refresh: #{refresh_schema.to_s}"
    puts "pg_graph_ignore_schema: #{pg_graph_ignore_schema}"
    decl_nodes.each(&:dump)
    for kind in [:init, :seed, :auth, :term]
      kind_nodes = self.send("#{kind}_nodes".to_sym)
      if !kind_nodes.empty?
        puts "#{kind}:"
        indent { kind_nodes.each(&:dump) }
      end
    end
  }
end

#inspectObject



281
# File 'lib/prick/builder/node.rb', line 281

def inspect() to_s end

#nodesObject



258
# File 'lib/prick/builder/node.rb', line 258

def nodes() @nodes ||= init_nodes + decl_nodes + seed_nodes + auth_nodes + term_nodes end