Class: Papers::LicenseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/papers/license_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLicenseValidator

Returns a new instance of LicenseValidator.



11
12
13
# File 'lib/papers/license_validator.rb', line 11

def initialize
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



9
10
11
# File 'lib/papers/license_validator.rb', line 9

def errors
  @errors
end

Instance Method Details

#manifestObject



24
25
26
# File 'lib/papers/license_validator.rb', line 24

def manifest
  @manifest ||= YAML.load_file(Papers.config.manifest_file)
end

#pretty_gem_listObject



28
29
30
# File 'lib/papers/license_validator.rb', line 28

def pretty_gem_list
  Gem.all_from_manifest(manifest).map(&:pretty_hash)
end

#pretty_js_listObject



32
33
34
# File 'lib/papers/license_validator.rb', line 32

def pretty_js_list
  Javascript.all_from_manifest(manifest).map(&:pretty_hash)
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'lib/papers/license_validator.rb', line 15

def valid?
  @errors = []

  validate_gems if Papers.config.validate_gems?
  validate_js   if Papers.config.validate_javascript?

  @errors.empty?
end