ad_licenselint 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ad_licenselint/constant.rb +7 -1
- data/lib/ad_licenselint/option_handler.rb +5 -5
- data/lib/ad_licenselint/runner.rb +15 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d724417a61b9cdd45734e80b872bd17fcaeebb0764365bdb72324c90c4707c9
|
4
|
+
data.tar.gz: b937d30a641e989a44449ca682bc14012d8557b6820d2e6cef9d9d3587381da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ad331fcf8166a73f4ffa825593db9034fa19676abd57684b385547ee482a945bbafed7f61b752f77ba44ce5fdbd9098294f4ab73bffeea8adc51749b67d2c9
|
7
|
+
data.tar.gz: f3dc44e8915c811ffdc6d094d2dc54985e263e6d95e87bfdbe6f7d67616e112e5d12ad7528e1627af62f8541df3dccd4f253a267a301657a9f61cfa65a62302b
|
@@ -3,6 +3,12 @@ module ADLicenseLint
|
|
3
3
|
MARKDOWN_FORMAT_OPTION = "md"
|
4
4
|
TERMINAL_FORMAT_OPTION = "term"
|
5
5
|
AVAILABLE_OPTIONS = [MARKDOWN_FORMAT_OPTION, TERMINAL_FORMAT_OPTION]
|
6
|
-
ACCEPTED_LICENSES = ["MIT", "Apache", "BSD"]
|
6
|
+
ACCEPTED_LICENSES = ["MIT", "Apache", "Apache 2.0", "BSD"]
|
7
|
+
DEFAULT_OPTIONS = {
|
8
|
+
format: TERMINAL_FORMAT_OPTION,
|
9
|
+
path: ".",
|
10
|
+
all: false,
|
11
|
+
only: nil
|
12
|
+
}
|
7
13
|
end
|
8
14
|
end
|
@@ -4,11 +4,7 @@ module ADLicenseLint
|
|
4
4
|
|
5
5
|
def self.parse
|
6
6
|
|
7
|
-
options =
|
8
|
-
format: ADLicenseLint::Constant::TERMINAL_FORMAT_OPTION,
|
9
|
-
path: ".",
|
10
|
-
all: false
|
11
|
-
}
|
7
|
+
options = ADLicenseLint::Constant::DEFAULT_OPTIONS
|
12
8
|
available_formats = ADLicenseLint::Constant::AVAILABLE_OPTIONS
|
13
9
|
|
14
10
|
parser = OptionParser.new do |p|
|
@@ -26,6 +22,10 @@ module ADLicenseLint
|
|
26
22
|
options[:all] = true
|
27
23
|
end
|
28
24
|
|
25
|
+
p.on("-o", "--only [PODS]", Array, "[Optional] Display licenses for pods in argument. E.g -o Pod1,Pod2.") do |arg|
|
26
|
+
options[:only] = arg
|
27
|
+
end
|
28
|
+
|
29
29
|
p.on("-h", "--help", "Prints this help") do
|
30
30
|
puts p
|
31
31
|
exit
|
@@ -6,7 +6,11 @@ module ADLicenseLint
|
|
6
6
|
POD_SOURCE = Pod::Source.new("~/.cocoapods/repos/master")
|
7
7
|
|
8
8
|
def initialize(options = nil)
|
9
|
-
|
9
|
+
if options.nil?
|
10
|
+
@options = OptionHandler.parse
|
11
|
+
else
|
12
|
+
@options = ADLicenseLint::Constant::DEFAULT_OPTIONS.merge(options)
|
13
|
+
end
|
10
14
|
@path = File.expand_path(@options[:path])
|
11
15
|
end
|
12
16
|
|
@@ -22,9 +26,11 @@ module ADLicenseLint
|
|
22
26
|
Report.new(displayed_entries)
|
23
27
|
end
|
24
28
|
|
25
|
-
def
|
26
|
-
report
|
27
|
-
|
29
|
+
def format(report)
|
30
|
+
if report.empty?
|
31
|
+
LOGGER.log(:info, :green, "No warnings found.")
|
32
|
+
return ""
|
33
|
+
end
|
28
34
|
|
29
35
|
case options[:format]
|
30
36
|
when ADLicenseLint::Constant::MARKDOWN_FORMAT_OPTION
|
@@ -34,6 +40,10 @@ module ADLicenseLint
|
|
34
40
|
end
|
35
41
|
end
|
36
42
|
|
43
|
+
def run
|
44
|
+
format create_report
|
45
|
+
end
|
46
|
+
|
37
47
|
private
|
38
48
|
|
39
49
|
def acknowledgement_json(plist_file)
|
@@ -54,6 +64,7 @@ module ADLicenseLint
|
|
54
64
|
.flatten
|
55
65
|
.select(&:is_valid)
|
56
66
|
.select { |e| pod_names.include?(e.pod_name) }
|
67
|
+
.select { |e| options[:only].nil? ? true : options[:only].include?(e.pod_name) }
|
57
68
|
.uniq(&:pod_name)
|
58
69
|
entries.each { |e| e.source_url = source_url(e.pod_name) }
|
59
70
|
entries
|