Class: BuildTool::Cfg::ServerDeclarationNodeVisitor
- Inherits:
-
ListVisitor
- Object
- VisitorBase
- ListVisitor
- BuildTool::Cfg::ServerDeclarationNodeVisitor
- Defined in:
- lib/build-tool/cfg/visitor.rb
Instance Attribute Summary
Attributes inherited from VisitorBase
Instance Method Summary collapse
-
#initialize(configuration) ⇒ ServerDeclarationNodeVisitor
constructor
A new instance of ServerDeclarationNodeVisitor.
- #visit_ServerDeclarationNode(node) ⇒ Object
- #visit_ServerHostNode(node) ⇒ Object
- #visit_ServerPathNode(node) ⇒ Object
- #visit_ServerProtocolNode(node) ⇒ Object
- #visit_ServerStatementList(node) ⇒ Object
- #visit_SshKeyDeclarationNode(node) ⇒ Object
- #visit_UseSshKeyNode(node) ⇒ Object
Methods inherited from ListVisitor
Methods inherited from VisitorBase
Constructor Details
#initialize(configuration) ⇒ ServerDeclarationNodeVisitor
Returns a new instance of ServerDeclarationNodeVisitor.
658 659 660 661 |
# File 'lib/build-tool/cfg/visitor.rb', line 658 def initialize( configuration ) super( configuration ) @server = nil end |
Instance Method Details
#visit_ServerDeclarationNode(node) ⇒ Object
663 664 665 666 667 668 669 670 671 672 673 |
# File 'lib/build-tool/cfg/visitor.rb', line 663 def visit_ServerDeclarationNode( node ) name = node.values[0] # Check if a server with that name already exists @server = configuration.server(name) # Create a new one if not @server = Server.new( name ) if @server.nil? statements = node.values[1] self.visit_nodes(statements.values) configuration.add_server( @server ) return @server end |
#visit_ServerHostNode(node) ⇒ Object
675 676 677 |
# File 'lib/build-tool/cfg/visitor.rb', line 675 def visit_ServerHostNode( node ) @server.host = node.value end |
#visit_ServerPathNode(node) ⇒ Object
679 680 681 |
# File 'lib/build-tool/cfg/visitor.rb', line 679 def visit_ServerPathNode( node ) @server.path = node.value end |
#visit_ServerProtocolNode(node) ⇒ Object
683 684 685 |
# File 'lib/build-tool/cfg/visitor.rb', line 683 def visit_ServerProtocolNode( node ) @server.protocol = node.value end |
#visit_ServerStatementList(node) ⇒ Object
687 688 689 |
# File 'lib/build-tool/cfg/visitor.rb', line 687 def visit_ServerStatementList( node ) self.visit( node ) end |
#visit_SshKeyDeclarationNode(node) ⇒ Object
691 692 693 |
# File 'lib/build-tool/cfg/visitor.rb', line 691 def visit_SshKeyDeclarationNode( node ) @server.sshkey = node.value end |
#visit_UseSshKeyNode(node) ⇒ Object
695 696 697 698 699 |
# File 'lib/build-tool/cfg/visitor.rb', line 695 def visit_UseSshKeyNode( node ) name = node.value @server.sshkey = configuration.sshkey(name) raise ConfigurationError, "Unknown ssh-key #{name} configured for server #{@server.name}!" if @server.sshkey.nil? end |