diff options
| author | Luke Kanies <luke@madstop.com> | 2007-09-06 18:53:00 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-09-06 18:53:00 -0500 |
| commit | b7f42441b91c921cd31f3d8c7875ce98bdedf786 (patch) | |
| tree | 07ef5bf2d42027914704d0305a353741d191cc90 | |
| parent | 653c1514b613f27cb22d24b4bdd7b6c118047566 (diff) | |
| download | puppet-b7f42441b91c921cd31f3d8c7875ce98bdedf786.tar.gz puppet-b7f42441b91c921cd31f3d8c7875ce98bdedf786.tar.xz puppet-b7f42441b91c921cd31f3d8c7875ce98bdedf786.zip | |
Renaming some ast resource classes and files so they make a lot more sense.
| -rw-r--r-- | lib/puppet/parser/ast/astarray.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/ast/resource.rb (renamed from lib/puppet/parser/ast/resourcedef.rb) | 4 | ||||
| -rw-r--r-- | lib/puppet/parser/ast/resource_defaults.rb (renamed from lib/puppet/parser/ast/resourcedefaults.rb) | 0 | ||||
| -rw-r--r-- | lib/puppet/parser/ast/resource_override.rb (renamed from lib/puppet/parser/ast/resourceoverride.rb) | 4 | ||||
| -rw-r--r-- | lib/puppet/parser/ast/resource_reference.rb (renamed from lib/puppet/parser/ast/resourceref.rb) | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/grammar.ra | 14 | ||||
| -rw-r--r-- | lib/puppet/parser/parser.rb | 18 | ||||
| -rwxr-xr-x | test/language/ast/resource.rb (renamed from test/language/ast/resourcedef.rb) | 4 | ||||
| -rwxr-xr-x | test/language/ast/resource_reference.rb (renamed from test/language/ast/resourceref.rb) | 4 | ||||
| -rwxr-xr-x | test/language/parser.rb | 4 | ||||
| -rw-r--r-- | test/lib/puppettest/parsertesting.rb | 6 |
11 files changed, 31 insertions, 31 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb index 2a8f4d4c1..9a2dc286c 100644 --- a/lib/puppet/parser/ast/astarray.rb +++ b/lib/puppet/parser/ast/astarray.rb @@ -71,5 +71,5 @@ class Puppet::Parser::AST # Used for abstracting the grammar declarations. Basically unnecessary # except that I kept finding bugs because I had too many arrays that # meant completely different things. - class ResourceInst < ASTArray; end + class ResourceInstance < ASTArray; end end diff --git a/lib/puppet/parser/ast/resourcedef.rb b/lib/puppet/parser/ast/resource.rb index a432268f1..c53ab0a68 100644 --- a/lib/puppet/parser/ast/resourcedef.rb +++ b/lib/puppet/parser/ast/resource.rb @@ -1,9 +1,9 @@ -require 'puppet/parser/ast/resourceref' +require 'puppet/parser/ast/resource_reference' # Any normal puppet resource declaration. Can point to a definition or a # builtin type. class Puppet::Parser::AST -class ResourceDef < AST::ResourceRef +class Resource < AST::ResourceReference attr_accessor :title, :type, :exported, :virtual attr_reader :params diff --git a/lib/puppet/parser/ast/resourcedefaults.rb b/lib/puppet/parser/ast/resource_defaults.rb index 44ec146b0..44ec146b0 100644 --- a/lib/puppet/parser/ast/resourcedefaults.rb +++ b/lib/puppet/parser/ast/resource_defaults.rb diff --git a/lib/puppet/parser/ast/resourceoverride.rb b/lib/puppet/parser/ast/resource_override.rb index 4232737fc..46c930902 100644 --- a/lib/puppet/parser/ast/resourceoverride.rb +++ b/lib/puppet/parser/ast/resource_override.rb @@ -1,9 +1,9 @@ -require 'puppet/parser/ast/resourcedef' +require 'puppet/parser/ast/resource' class Puppet::Parser::AST # Set a parameter on a resource specification created somewhere else in the # configuration. The object is responsible for verifying that this is allowed. - class ResourceOverride < ResourceDef + class ResourceOverride < Resource attr_accessor :object attr_reader :params diff --git a/lib/puppet/parser/ast/resourceref.rb b/lib/puppet/parser/ast/resource_reference.rb index 02a19d88d..b8edff8f1 100644 --- a/lib/puppet/parser/ast/resourceref.rb +++ b/lib/puppet/parser/ast/resource_reference.rb @@ -2,7 +2,7 @@ require 'puppet/parser/ast/branch' class Puppet::Parser::AST # A reference to an object. Only valid as an rvalue. - class ResourceRef < AST::Branch + class ResourceReference < AST::Branch attr_accessor :title, :type # Is the type a builtin type? def builtintype?(type) diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index c7216186a..26cb42217 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -116,19 +116,19 @@ resourcerefs: resourceref resource: classname LBRACE resourceinstances endsemi RBRACE { array = val[2] - if array.instance_of?(AST::ResourceInst) + if array.instance_of?(AST::ResourceInstance) array = [array] end result = ast AST::ASTArray # this iterates across each specified resourceinstance array.each { |instance| - unless instance.instance_of?(AST::ResourceInst) + unless instance.instance_of?(AST::ResourceInstance) raise Puppet::Dev, "Got something that isn't an instance" end # now, i need to somehow differentiate between those things with # arrays in their names, and normal things - result.push ast(AST::ResourceDef, + result.push ast(AST::Resource, :type => val[0], :title => instance[0], :params => instance[1]) @@ -248,12 +248,12 @@ colllval: variable | name resourceinst: resourcename COLON params endcomma { - result = ast AST::ResourceInst, :children => [val[0],val[2]] + result = ast AST::ResourceInstance, :children => [val[0],val[2]] } resourceinstances: resourceinst | resourceinstances SEMIC resourceinst { - if val[0].instance_of?(AST::ResourceInst) + if val[0].instance_of?(AST::ResourceInstance) result = ast AST::ASTArray, :children => [val[0],val[2]] else val[0].push val[2] @@ -385,9 +385,9 @@ boolean: BOOLEAN { resourceref: NAME LBRACK rvalue RBRACK { Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") - result = ast AST::ResourceRef, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0], :title => val[2] } | classref LBRACK rvalue RBRACK { - result = ast AST::ResourceRef, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0], :title => val[2] } ifstatement: IF iftest LBRACE statements RBRACE else { diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index aaffa816e..907bddc0a 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -29,7 +29,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..idc3bb85ed76', 'grammar.ra', 640 +module_eval <<'..end grammar.ra modeval..id8b4fcf8e20', 'grammar.ra', 640 # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -41,7 +41,7 @@ require 'puppet/parser/parser_support' # $Id$ -..end grammar.ra modeval..idc3bb85ed76 +..end grammar.ra modeval..id8b4fcf8e20 ##### racc 1.4.5 generates ### @@ -929,19 +929,19 @@ module_eval <<'.,.,', 'grammar.ra', 115 module_eval <<'.,.,', 'grammar.ra', 136 def _reduce_34( val, _values, result ) array = val[2] - if array.instance_of?(AST::ResourceInst) + if array.instance_of?(AST::ResourceInstance) array = [array] end result = ast AST::ASTArray # this iterates across each specified resourceinstance array.each { |instance| - unless instance.instance_of?(AST::ResourceInst) + unless instance.instance_of?(AST::ResourceInstance) raise Puppet::Dev, "Got something that isn't an instance" end # now, i need to somehow differentiate between those things with # arrays in their names, and normal things - result.push ast(AST::ResourceDef, + result.push ast(AST::Resource, :type => val[0], :title => instance[0], :params => instance[1]) @@ -1115,7 +1115,7 @@ module_eval <<'.,.,', 'grammar.ra', 245 module_eval <<'.,.,', 'grammar.ra', 252 def _reduce_57( val, _values, result ) - result = ast AST::ResourceInst, :children => [val[0],val[2]] + result = ast AST::ResourceInstance, :children => [val[0],val[2]] result end .,., @@ -1124,7 +1124,7 @@ module_eval <<'.,.,', 'grammar.ra', 252 module_eval <<'.,.,', 'grammar.ra', 262 def _reduce_59( val, _values, result ) - if val[0].instance_of?(AST::ResourceInst) + if val[0].instance_of?(AST::ResourceInstance) result = ast AST::ASTArray, :children => [val[0],val[2]] else val[0].push val[2] @@ -1344,14 +1344,14 @@ module_eval <<'.,.,', 'grammar.ra', 384 module_eval <<'.,.,', 'grammar.ra', 389 def _reduce_105( val, _values, result ) Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") - result = ast AST::ResourceRef, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., module_eval <<'.,.,', 'grammar.ra', 391 def _reduce_106( val, _values, result ) - result = ast AST::ResourceRef, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., diff --git a/test/language/ast/resourcedef.rb b/test/language/ast/resource.rb index d79a02cfa..9ef5181af 100755 --- a/test/language/ast/resourcedef.rb +++ b/test/language/ast/resource.rb @@ -8,7 +8,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppettest' require 'puppettest/parsertesting' -class TestASTResourceDef < Test::Unit::TestCase +class TestASTResource< Test::Unit::TestCase include PuppetTest include PuppetTest::ParserTesting AST = Puppet::Parser::AST @@ -22,7 +22,7 @@ class TestASTResourceDef < Test::Unit::TestCase def newdef(type, title, params = nil) params ||= AST::ASTArray.new(:children => []) - AST::ResourceDef.new(:type => type, :title => AST::String.new(:value => title), :params => params) + AST::Resource.new(:type => type, :title => AST::String.new(:value => title), :params => params) end # Related to #806, make sure resources always look up the full path to the resource. diff --git a/test/language/ast/resourceref.rb b/test/language/ast/resource_reference.rb index 33a80ad40..e8883afb9 100755 --- a/test/language/ast/resourceref.rb +++ b/test/language/ast/resource_reference.rb @@ -8,13 +8,13 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppettest' require 'puppettest/parsertesting' -class TestASTResourceRef < Test::Unit::TestCase +class TestASTResourceReference < Test::Unit::TestCase include PuppetTest include PuppetTest::ParserTesting AST = Puppet::Parser::AST def newref(type, title) - AST::ResourceRef.new(:type => type, :title => AST::String.new(:value => title)) + AST::ResourceReference.new(:type => type, :title => AST::String.new(:value => title)) end def setup diff --git a/test/language/parser.rb b/test/language/parser.rb index ddf35e3e3..d50bdfe5a 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -475,7 +475,7 @@ file { "/tmp/yayness": assert_instance_of(AST::ASTArray, ret.classes[""].code) resdef = ret.classes[""].code[0] - assert_instance_of(AST::ResourceDef, resdef) + assert_instance_of(AST::Resource, resdef) assert_equal("/tmp/testing", resdef.title.value) # We always get an astarray back, so... check.call(resdef, "simple resource") @@ -486,7 +486,7 @@ file { "/tmp/yayness": end ret.classes[""].each do |res| - assert_instance_of(AST::ResourceDef, res) + assert_instance_of(AST::Resource, res) check.call(res, "multiresource") end diff --git a/test/lib/puppettest/parsertesting.rb b/test/lib/puppettest/parsertesting.rb index b8fd8bd83..c71508803 100644 --- a/test/lib/puppettest/parsertesting.rb +++ b/test/lib/puppettest/parsertesting.rb @@ -105,7 +105,7 @@ module PuppetTest::ParserTesting title = stringobj(title) end assert_nothing_raised("Could not create %s %s" % [type, title]) { - return AST::ResourceDef.new( + return AST::Resource.new( :file => __FILE__, :line => __LINE__, :title => title, @@ -135,7 +135,7 @@ module PuppetTest::ParserTesting def resourceref(type, title) assert_nothing_raised("Could not create %s %s" % [type, title]) { - return AST::ResourceRef.new( + return AST::ResourceReference.new( :file => __FILE__, :line => __LINE__, :type => type, @@ -191,7 +191,7 @@ module PuppetTest::ParserTesting params = hash.collect { |param, value| resourceparam(param, value) } - return AST::ResourceInst.new( + return AST::ResourceInstance.new( :file => tempfile(), :line => rand(100), :children => params |
