Class: PuppetValidator
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- PuppetValidator
- Defined in:
- lib/puppet-validator.rb
Instance Method Summary collapse
-
#initialize(app = nil) ⇒ PuppetValidator
constructor
A new instance of PuppetValidator.
Constructor Details
#initialize(app = nil) ⇒ PuppetValidator
Returns a new instance of PuppetValidator.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/puppet-validator.rb', line 31 def initialize(app=nil) super(app) Puppet.initialize_settings if Puppet.version.to_i == 3 and Puppet.settings[:confdir].nil? # there must be a better way if settings.respond_to? :disabled_lint_checks # can pass in an array, a filename, or a list of checks if settings.disabled_lint_checks.class == String path = File.(settings.disabled_lint_checks) if File.file? path data = File.readlines(path).map {|line| line.chomp } data.reject! {|line| line.empty? or line.start_with? '#' } settings.disabled_lint_checks = data else settings.disabled_lint_checks = settings.disabled_lint_checks.split(',') end end else # this seems... gross, but I don't know a better way to make sure this # option exists whether it was passed in or not. def settings.disabled_lint_checks [] end end if settings.respond_to? :puppet_versions # put our supported versions in reverse semver order settings.puppet_versions = settings.puppet_versions.sort_by { |v| Gem::Version.new(v) }.reverse else def settings.puppet_versions [] end end end |