Class: BuildTool::Cfg::StatementVisitor

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

Overview

Statement Visitor

Direct Known Subclasses

ConfigurationFileVisitor

Instance Attribute Summary

Attributes inherited from VisitorBase

#configuration

Instance Method Summary collapse

Methods inherited from ListVisitor

#visit, #visit_nodes

Methods inherited from VisitorBase

#initialize, #visit_Object

Constructor Details

This class inherits a constructor from BuildTool::Cfg::VisitorBase

Instance Method Details

#visit_BuildSystemDeclarationNode(node) ⇒ Object

Raises:



94
95
96
97
98
99
100
101
102
# File 'lib/build-tool/cfg/visitor.rb', line 94

def visit_BuildSystemDeclarationNode( node )
    raise ArgumentsError if node.values.length != 2
    name  = node.values[0]
    bs = configuration.build_system_defaults( name )
    visitor = BuildSystemDeclarationNodeVisitor.new(
        configuration,
        bs )
    node.accept( visitor )
end

#visit_ConfigurationFileList(node) ⇒ Object



104
105
106
# File 'lib/build-tool/cfg/visitor.rb', line 104

def visit_ConfigurationFileList( node )
    self.visit(node)
end

#visit_DisableFeatureNode(node) ⇒ Object



122
123
124
125
126
127
128
129
# File 'lib/build-tool/cfg/visitor.rb', line 122

def visit_DisableFeatureNode( node )
    featureName = node.value
    feat = configuration.feature( featureName )
    if feat.nil?
        raise ConfigurationError, "Attempt to disable unknown feature '%s'!" % featureName
    end
    feat.active = false
end

#visit_DisableModuleNode(node) ⇒ Object



140
141
142
143
144
145
146
147
# File 'lib/build-tool/cfg/visitor.rb', line 140

def visit_DisableModuleNode( node )
    modName = node.value
    mod = configuration.module( modName )
    if mod.nil?
        raise ConfigurationError, "Attempt to disable unknown module '%s'!" % modName
    end
    mod.active = false
end

#visit_EnableFeatureNode(node) ⇒ Object



113
114
115
116
117
118
119
120
# File 'lib/build-tool/cfg/visitor.rb', line 113

def visit_EnableFeatureNode( node )
    featureName = node.value
    feat = configuration.feature( featureName )
    if feat.nil?
        raise ConfigurationError, "Attempt to enable unknown feature '%s'!" % featureName
    end
    feat.active = true
end

#visit_EnableModuleNode(node) ⇒ Object



131
132
133
134
135
136
137
138
# File 'lib/build-tool/cfg/visitor.rb', line 131

def visit_EnableModuleNode( node )
    modName = node.value
    mod = configuration.module( modName )
    if mod.nil?
        raise ConfigurationError, "Attempt to enable unknown module '%s'!" % modName
    end
    mod.active = true
end

#visit_EnvironmentDeclarationNode(node) ⇒ Object



108
109
110
111
# File 'lib/build-tool/cfg/visitor.rb', line 108

def visit_EnvironmentDeclarationNode( node )
    visitor = EnvironmentDeclarationNodeVisitor.new( configuration )
    node.accept( visitor )
end

#visit_FeatureNode(node) ⇒ Object



149
150
151
152
# File 'lib/build-tool/cfg/visitor.rb', line 149

def visit_FeatureNode( node )
    visitor = FeatureNodeVisitor.new( configuration )
    node.accept( visitor )
end

#visit_IncludeNode(node) ⇒ Object



154
155
156
157
# File 'lib/build-tool/cfg/visitor.rb', line 154

def visit_IncludeNode( node )
    visitor = IncludeNodeVisitor.new( configuration )
    node.accept( visitor )
end

#visit_ModuleDeclarationNode(node) ⇒ Object



159
160
161
162
# File 'lib/build-tool/cfg/visitor.rb', line 159

def visit_ModuleDeclarationNode( node )
    visitor = ModuleDeclarationNodeVisitor.new( configuration )
    node.accept( visitor )
end

#visit_RepositoryDeclarationNode(node) ⇒ Object



164
165
166
167
# File 'lib/build-tool/cfg/visitor.rb', line 164

def visit_RepositoryDeclarationNode( node )
    visitor = RepositoryDeclarationNodeVisitor.new( configuration )
    node.accept(visitor)
end

#visit_ServerDeclarationNode(node) ⇒ Object



169
170
171
172
# File 'lib/build-tool/cfg/visitor.rb', line 169

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

#visit_SshKeyDeclarationNode(node) ⇒ Object



174
175
176
177
# File 'lib/build-tool/cfg/visitor.rb', line 174

def visit_SshKeyDeclarationNode( node )
    visitor = SshKeyDeclarationNodeVisitor.new( configuration )
    node.accept(visitor)
end