Class: BuildTool::Cfg::GitDeclarationNodeVisitor

Inherits:
GitRemoteDeclarationNodeVisitor show all
Defined in:
lib/build-tool/cfg/visitor.rb

Direct Known Subclasses

GitSvnDeclarationNodeVisitor

Instance Attribute Summary

Attributes inherited from VisitorBase

#configuration

Instance Method Summary collapse

Methods inherited from GitRemoteDeclarationNodeVisitor

#visit_GitRemotePushNode, #visit_GitRemoteUrlNode

Methods inherited from ListVisitor

#visit, #visit_nodes

Methods inherited from VisitorBase

#visit_Object

Constructor Details

#initialize(configuration, vcs = BuildTool::VCS::GitConfiguration.new) ⇒ GitDeclarationNodeVisitor

Returns a new instance of GitDeclarationNodeVisitor.



360
361
362
363
364
365
# File 'lib/build-tool/cfg/visitor.rb', line 360

def initialize( configuration, vcs = BuildTool::VCS::GitConfiguration.new )
    super( configuration )
    @remote = BuildTool::VCS::GitRemote.new( "origin" )
    @vcs = vcs
    @vcs.remote[@remote.name] = @remote
end

Instance Method Details

#visit_GitDeclarationNode(node) ⇒ Object



367
368
369
370
371
372
373
# File 'lib/build-tool/cfg/visitor.rb', line 367

def visit_GitDeclarationNode( node )
    visit_nodes( node.values )
    if @remote.server.nil? and @remote.path.nil?
        @vcs.remote.delete( "origin" )
    end
    return @vcs
end

#visit_GitRemoteDeclarationNode(node) ⇒ Object



375
376
377
378
379
# File 'lib/build-tool/cfg/visitor.rb', line 375

def visit_GitRemoteDeclarationNode( node )
    visitor = GitRemoteDeclarationNodeVisitor.new( configuration )
    remote = node.accept(visitor)
    @vcs.remote[remote.name] = remote
end

#visit_GitTrackNode(node) ⇒ Object



381
382
383
# File 'lib/build-tool/cfg/visitor.rb', line 381

def visit_GitTrackNode( node )
    @vcs.track = node.values
end