metadata-json-lint 0.0.6 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +5 -13
  2. data/lib/metadata_json_lint.rb +15 -7
  3. metadata +23 -9
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTcyZGJkMmRhYjQ4YzU5NjYyODc3MmQ4MDcyOGQ5NWVlODA5NjFkNQ==
5
- data.tar.gz: !binary |-
6
- OWQ4YmQzYjQ2ZDkxNzA2MDA2NzVhZjczODg0ZWQ3OTk5YjA1OTk5ZA==
2
+ SHA1:
3
+ metadata.gz: cc99aac134e5318ffd0f79339b1f972cc554e024
4
+ data.tar.gz: 3fd67ef0b5c0fcd45867a8a9f8d0f7b57d9c3dc4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjUzZmVlNGExZjU2ZjA1ZjFmZmU5MWU3NmNjZTc1YTNhMDNmOGIyYjM2MmFk
10
- YWZmMjZlYjY1MzgzYzJlZDA4Yzg3ZTUyMWI0Mjk5MTUyMTU5ZTE1YzIxYjE0
11
- N2M4MjE5MGZlZTYxNDVmMDI2ODU1OTQ3YzA0NWE3YzZiNDRhMzk=
12
- data.tar.gz: !binary |-
13
- NzAxYjEwZjEzOTIyZjgzNzg4ZWRkZThjMDZhZDYwMTNjNDgxMTZlYzNhMzc4
14
- MmZlZDNkNGUzMWNmYWNiN2JmMTE2ZjJjN2Q0NDExZDA1NDA3ZTI4N2MxODFl
15
- ZjMwNDI5ZDhlMDA2ZWY2OTA4MjExNjIyM2FjZGQ3YjllOTU3MTY=
6
+ metadata.gz: a67148113bdbd5eb661fe21ce0c8264d44a81d16c5a3d5a80e8ff015d41f767a17ccfd114587ccd7770c79827f36034d63f5e69899195dd9e7201f5ae8bb8632
7
+ data.tar.gz: 99294678081f996adf170dc0a9cb06bf96671eb4a9d542e6f6fc23a63ff92492e2d514e9f38ef2713e8569996b5299e7270fae2c73349186350bb6b505d31723
@@ -3,12 +3,15 @@ require 'spdx-licenses'
3
3
  require 'optparse'
4
4
 
5
5
  module MetadataJsonLint
6
- def run
7
- options = {
6
+ def options
7
+ @options ||= {
8
8
  :fail_on_warnings => true,
9
9
  :strict_license => true
10
10
  }
11
+ end
12
+ module_function :options
11
13
 
14
+ def run
12
15
  OptionParser.new do |opts|
13
16
  opts.banner = "Usage: metadata-json-lint [options] metadata.json"
14
17
 
@@ -21,8 +24,6 @@ module MetadataJsonLint
21
24
  end
22
25
  end.parse!
23
26
 
24
- @options = options
25
-
26
27
  if ARGV[0].nil?
27
28
  abort("Error: Must provide a metadata.json file to parse")
28
29
  end
@@ -75,16 +76,23 @@ module MetadataJsonLint
75
76
  end
76
77
  end
77
78
 
79
+ # Summary can not be over 144 characters:
80
+ # From: https://forge.puppetlabs.com/razorsedge/snmp/3.3.1/scores
81
+ if !parsed['summary'].nil? && parsed['summary'].size > 144
82
+ puts "Error: summary exceeds 144 characters in metadata.json."
83
+ error_state = true
84
+ end
85
+
78
86
  # Shoulds/recommendations
79
87
  # From: https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html#write-a-metadatajson-file
80
88
 
81
- if !parsed['license'].nil? && !SpdxLicenses.exist?(parsed['license'])
89
+ if !parsed['license'].nil? && !SpdxLicenses.exist?(parsed['license']) && parsed['license'] != "proprietary"
82
90
  puts "Warning: License identifier #{parsed['license']} is not in the SPDX list: http://spdx.org/licenses/"
83
- error_state = true if @options[:strict_license]
91
+ error_state = true if options[:strict_license]
84
92
  end
85
93
 
86
94
  if error_state
87
- if @options[:fail_on_warnings] == true
95
+ if options[:fail_on_warnings] == true
88
96
  abort("Errors found in #{metadata}")
89
97
  else
90
98
  puts "Errors found in #{metadata}"
metadata CHANGED
@@ -1,42 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metadata-json-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spencer Krum
8
- - HP Development Corporation LP
8
+ - In August
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-08 00:00:00.000000000 Z
12
+ date: 2015-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spdx-licenses
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
42
56
  description: Utility to verify Puppet metadata.json files
@@ -59,12 +73,12 @@ require_paths:
59
73
  - lib
60
74
  required_ruby_version: !ruby/object:Gem::Requirement
61
75
  requirements:
62
- - - ! '>='
76
+ - - ">="
63
77
  - !ruby/object:Gem::Version
64
78
  version: '0'
65
79
  required_rubygems_version: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ! '>='
81
+ - - ">="
68
82
  - !ruby/object:Gem::Version
69
83
  version: '0'
70
84
  requirements: []