class Playgroundbook::ManifestLinter

A base inplementation of a linter for verifying the contents of manifest files.

Public Instance Methods

lint() click to toggle source

TODO: Should load manifest file in initialize instead of lazily.

# File lib/linter/manifest_linter.rb, line 12
def lint
  fail_lint "No Manifest file in #{Dir.pwd}" unless manifest_file_exists?
  fail_lint "Manifest file missing Name in #{Dir.pwd}" unless name?
end
manifest_file_exists?() click to toggle source
# File lib/linter/manifest_linter.rb, line 17
def manifest_file_exists?
  File.exist? MANIFEST_FILE_NAME
end
manifest_plist_contents() click to toggle source
# File lib/linter/manifest_linter.rb, line 21
def manifest_plist_contents
  return @manifest_plist_contents unless @manifest_plist_contents.nil?
  require "plist"
  @manifest_plist_contents = Plist.parse_xml(MANIFEST_FILE_NAME)
  @manifest_plist_contents
end
name?() click to toggle source
# File lib/linter/manifest_linter.rb, line 28
def name?
  value_defined_in_manifest?("Name")
end
value_defined_in_manifest?(key) click to toggle source
# File lib/linter/manifest_linter.rb, line 32
def value_defined_in_manifest?(key)
  return false if manifest_plist_contents.nil?
  return false if manifest_plist_contents[key].nil?
  return false if manifest_plist_contents[key].empty?
  true
end