ad_licenselint 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3865f9b58fea6e2da9af8009f08e8ad04b979c7c9b2b2974e3fba37aeb589509
4
- data.tar.gz: 7f7555f6efbc66a8af23cb5d851c341211669b07a1cc7e5f3846b847f9e9f278
3
+ metadata.gz: 1d724417a61b9cdd45734e80b872bd17fcaeebb0764365bdb72324c90c4707c9
4
+ data.tar.gz: b937d30a641e989a44449ca682bc14012d8557b6820d2e6cef9d9d3587381da3
5
5
  SHA512:
6
- metadata.gz: 90ca6ecf7176ef3bbefc45fe10450916356aeb9d08b1d57fb5e0080026d5ba50fb1f742242ef29b59fde41a890b78a815992d81162f1c7ff8361041757737110
7
- data.tar.gz: 76266a5595f2ed1482328a7c2a6c7be940eb48348a904486612e02e230ea7c6e4ed5ae4ec9e4f5cd5998b45fc9a56f82ef3ad8a6b16c6a4f838deeb617fc404e
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
- @options = options || OptionHandler.parse
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 run
26
- report = create_report
27
- return "" if report.empty?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad_licenselint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Felgines