Class: BuildTool::Cfg::RepositoryDeclarationNodeVisitor

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

Instance Attribute Summary

Attributes inherited from MJ::VisitorBase

#configuration

Instance Method Summary collapse

Methods inherited from ListVisitor

#visit, #visit_nodes

Methods inherited from MJ::VisitorBase

#initialize, #visit_Object

Constructor Details

This class inherits a constructor from MJ::VisitorBase

Instance Method Details

#visit_RepositoryDeclarationNode(node) ⇒ Object



775
776
777
778
779
780
781
782
783
784
785
# File 'lib/build-tool/cfg/visitor.rb', line 775

def visit_RepositoryDeclarationNode( node )
    name = node.values[0]
    @repository = configuration.repository(name)
    if @repository.nil?
        @repository = BuildTool::Repository.new( name )
        configuration.add_repository( @repository )
    end
    stmts = node.values[1]
    visit_nodes( stmts )
    return @repository
end

#visit_RepositoryPathNode(node) ⇒ Object



787
788
789
# File 'lib/build-tool/cfg/visitor.rb', line 787

def visit_RepositoryPathNode( node )
    @repository.path = node.value
end

#visit_RepositoryUserNode(node) ⇒ Object



791
792
793
# File 'lib/build-tool/cfg/visitor.rb', line 791

def visit_RepositoryUserNode( node )
    @repository.user = node.value
end

#visit_ServerDeclarationNode(node) ⇒ Object



795
796
797
798
# File 'lib/build-tool/cfg/visitor.rb', line 795

def visit_ServerDeclarationNode( node )
    visitor = ServerDeclarationNodeVisitor.new( configuration )
    @repository.server = node.accept(visitor)
end

#visit_SshKeyDeclarationNode(node) ⇒ Object



800
801
802
# File 'lib/build-tool/cfg/visitor.rb', line 800

def visit_SshKeyDeclarationNode( node )
    @repository.sshkey = node.value
end

#visit_UseServerNode(node) ⇒ Object



804
805
806
807
808
809
# File 'lib/build-tool/cfg/visitor.rb', line 804

def visit_UseServerNode( node )
    @repository.server = configuration.server( node.value )
    if @repository.server.nil?
        raise ConfigurationError, "Unknown server #{node.value} configured for repository #{@repository.name}!"
    end
end

#visit_UseSshKeyNode(node) ⇒ Object

Raises:



811
812
813
814
815
# File 'lib/build-tool/cfg/visitor.rb', line 811

def visit_UseSshKeyNode( node )
    name = node.value
    @repository.sshkey = configuration.sshkey(name)
    raise ConfigurationError, "Unknown ssh-key #{name} configured for repository #{@repository.name}!" if @repository.sshkey.nil?
end