This will accept a number of manifests as arguments and check their syntax. If
no filenames are specified, it will check the default 'manifest' setting.

Paired-With: Jesse Wolfe

Signed-off-by: Nick Lewis <[email protected]>
---
Local-branch: ticket/next/6928
 lib/puppet/application/parser.rb           |    5 +++++
 lib/puppet/face/parser.rb                  |   17 +++++++++++++++++
 lib/puppet/resource/type_collection.rb     |    1 +
 spec/unit/resource/type_collection_spec.rb |    5 +++++
 4 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 lib/puppet/application/parser.rb
 create mode 100644 lib/puppet/face/parser.rb

diff --git a/lib/puppet/application/parser.rb b/lib/puppet/application/parser.rb
new file mode 100644
index 0000000..b6ec3c1
--- /dev/null
+++ b/lib/puppet/application/parser.rb
@@ -0,0 +1,5 @@
+require 'puppet/application/face_base'
+require 'puppet/face'
+
+class Puppet::Application::Parser < Puppet::Application::FaceBase
+end
diff --git a/lib/puppet/face/parser.rb b/lib/puppet/face/parser.rb
new file mode 100644
index 0000000..c44810b
--- /dev/null
+++ b/lib/puppet/face/parser.rb
@@ -0,0 +1,17 @@
+require 'puppet/face'
+require 'puppet/parser'
+
+Puppet::Face.define(:parser, '0.0.1') do
+ action :validate do
+   when_invoked do |*args|
+     args.pop
+     files = args
+     files << Puppet[:manifest] if files.empty?
+     files.each do |file|
+       Puppet[:manifest] = file
+       
Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types.clear
+     end
+     nil
+   end
+ end
+end
diff --git a/lib/puppet/resource/type_collection.rb 
b/lib/puppet/resource/type_collection.rb
index 9fe7cdd..89b0a16 100644
--- a/lib/puppet/resource/type_collection.rb
+++ b/lib/puppet/resource/type_collection.rb
@@ -6,6 +6,7 @@ class Puppet::Resource::TypeCollection
     @hostclasses.clear
     @definitions.clear
     @nodes.clear
+    @watched_files.clear
   end
 
   def initialize(env)
diff --git a/spec/unit/resource/type_collection_spec.rb 
b/spec/unit/resource/type_collection_spec.rb
index b5f0a0e..0c997c2 100755
--- a/spec/unit/resource/type_collection_spec.rb
+++ b/spec/unit/resource/type_collection_spec.rb
@@ -5,6 +5,8 @@ require 'puppet/resource/type_collection'
 require 'puppet/resource/type'
 
 describe Puppet::Resource::TypeCollection do
+  include PuppetSpec::Files
+
   before do
     @instance = Puppet::Resource::Type.new(:hostclass, "foo")
     @code = Puppet::Resource::TypeCollection.new("env")
@@ -81,11 +83,14 @@ describe Puppet::Resource::TypeCollection do
     loader.add Puppet::Resource::Type.new(:hostclass, "class")
     loader.add Puppet::Resource::Type.new(:definition, "define")
     loader.add Puppet::Resource::Type.new(:node, "node")
+    watched_file = tmpfile('watched_file')
+    loader.watch_file(watched_file)
 
     loader.clear
     loader.hostclass("class").should be_nil
     loader.definition("define").should be_nil
     loader.node("node").should be_nil
+    loader.should_not be_watching_file(watched_file)
   end
 
   describe "when resolving namespaces" do
-- 
1.7.4.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to