puppet-parse 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/puppet-parse CHANGED
@@ -4,6 +4,14 @@ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib
4
4
  require 'puppet-parse'
5
5
  require 'yaml'
6
6
 
7
- run = PuppetParse::Runner.new
8
- puts run.run(ARGV).to_yaml
7
+ abort 'puppet-parse: no arguments given ' if ARGV[0].nil?
9
8
 
9
+ runner = PuppetParse::Runner.new
10
+
11
+ path = ARGV[0]
12
+ if File.directory?(path)
13
+ puppet_files = Dir.glob("#{path}/**/*.pp")
14
+ puts runner.run(puppet_files.to_a).to_yaml
15
+ else
16
+ puts runner.run(ARGV).to_yaml
17
+ end
@@ -7,7 +7,7 @@ class PuppetParse
7
7
  if File.exists?(file)
8
8
  @file = File.expand_path(file)
9
9
  pparser.import(@file)
10
-
10
+
11
11
  # Find object in list of hostclasses
12
12
  pparser.environment.known_resource_types.hostclasses.each do |x|
13
13
  @object = x.last if x.last.file == @file
@@ -16,13 +16,13 @@ class PuppetParse
16
16
  pparser.environment.known_resource_types.definitions.each do |x|
17
17
  @object = x.last if x.last.file == @file
18
18
  end
19
-
19
+
20
20
  else
21
21
  'File does not exist'
22
- end
22
+ end
23
23
  end
24
24
 
25
- # Read parameters from parsed object, returns hash of parameters and default
25
+ # Read parameters from parsed object, returns hash of parameters and default
26
26
  # values
27
27
  def parameters
28
28
  result = (defined? @object.arguments) ? @object.arguments : {}
@@ -35,7 +35,7 @@ class PuppetParse
35
35
  end
36
36
 
37
37
  # Read RDOC contents from parsed object, returns hash of paragraph headings
38
- # and the following paragraph contents
38
+ # and the following paragraph contents
39
39
  #(i.e. parameter and parameter documentation)
40
40
  def docs
41
41
  if !@object.doc.nil?
@@ -54,10 +54,8 @@ class PuppetParse
54
54
  end # do item
55
55
  end # endif
56
56
  end # do parm
57
-
58
57
  docs
59
58
  end # if nil?
60
59
  end # def docs
61
-
62
60
  end # class Parser
63
61
  end # module PuppetParse
@@ -1,3 +1,3 @@
1
1
  class PuppetParse
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/puppet-parse.rb CHANGED
@@ -5,6 +5,7 @@ require 'puppet-parse/parser'
5
5
  require 'puppet-parse/runner'
6
6
  require 'puppet-parse/hash'
7
7
  require 'puppet-parse/configuration'
8
+ gem 'rdoc'
8
9
  require 'rdoc'
9
10
 
10
11
  class PuppetParse
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-parse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-14 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec