Module: Puppet::Cleaner

Defined in:
lib/puppet-cleaner/workers/trailingwhitespaceincomments.rb,
lib/puppet-cleaner/workers/trailingwhitespace.rb,
lib/puppet-cleaner/workers/multilinecomments.rb,
lib/puppet-cleaner/workers/unneededquotes.rb,
lib/puppet-cleaner/workers/resourcetitles.rb,
lib/puppet-cleaner/workers/quotedbooleans.rb,
lib/puppet-cleaner/workers/ensurefirst.rb,
lib/puppet-cleaner/workers/alignfarrow.rb,
lib/puppet-cleaner/workers/octalmode.rb,
lib/puppet-cleaner/workers/softtabs.rb,
lib/puppet-cleaner/workers/symlink.rb,
lib/puppet-cleaner/workers.rb,
lib/puppet-cleaner/inspect.rb,
lib/puppet-cleaner/parts.rb,
lib/puppet-cleaner/line.rb,
lib/puppet-cleaner.rb

Defined Under Namespace

Classes: AlignFarrow, Class, Comment, Dqmid, Dqpost, Dqpre, EnsureFirst, Line, Mlcomment, MultilineComments, OctalMode, Part, QuotedBooleans, Regex, ResourceTitles, SoftTabs, String, Symlink, TrailingWhitespace, TrailingWhitespaceInComments, UnneededQuotes, Variable, Worker

Constant Summary collapse

NoPart =
Part.new([:NOPART, {:value => ""}])

Class Method Summary collapse

Class Method Details

.inspect(filename) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/puppet-cleaner/inspect.rb', line 4

def self.inspect(filename)
  Puppet[:manifest] = filename
  tc = Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types
  catalog = [:nodes, :hostclasses, :definitions].collect {|meth| tc.send(meth) }
  tc.clear
  catalog
end

.open(filename) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/puppet-cleaner.rb', line 29

def self.open(filename)
  lexer = Puppet::Parser::Lexer.new
  lexer.file = filename
  tokens = lexer.fullscan
  lexer.clear
  Line.new(tokens[0..-2])
end