cocoapods-ack_filter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc95f8b3127969a89227ee4645ad238d565551da
4
- data.tar.gz: 6267f08025ee182fff33c9cbdbc5720967aec128
3
+ metadata.gz: e3121d72234207b0c876d5069d0ac48d4d437746
4
+ data.tar.gz: 6cb316801996565b1fa0ea7ecb12c1ace7f54966
5
5
  SHA512:
6
- metadata.gz: df8449ca452e73af175ded9779628f59684786128b705ec3c4663f2e64dbc8a83a4d71651830ef74c7d8112021e990175cbdd253511444ceabc0d3b9539c9ace
7
- data.tar.gz: ddd71ac11cbcda0805206beb8aa73335565c3d65ab6dab87d0f2b29ba25a1a5ae6953529aed506530ec05bd5177e7c75b49fe869345a3c2c04c88c5283900c75
6
+ metadata.gz: 4e13f001e555f2bd5b6ff3f2e368139ff13b678938ad4a281605298b5161c21162a1d4e34fcd77b6c795bd3b8f7e0e4e394b226a4d6809a709ad8b9ef5f4f7c1
7
+ data.tar.gz: 3dfdca779b407884ba36ba6ee5a3c2bbba951ffc96172891ec7f9925db17f6243099493bc7ec2da29a505f98db853a279c7645de67ecf0aa3f75eabc2e97ed2a
data/README.md CHANGED
@@ -39,6 +39,24 @@ pod ack-filter MyCompany --output=Filtered.plist
39
39
  # => Licenses which includes "MyCompany" are filtered out and output to "Filtered.plist"
40
40
  ```
41
41
 
42
+ Also, you can use ack_filter within Podfile.
43
+
44
+ ```
45
+ post_install do
46
+ Pod::Command::AckFilter.filter(pattern: /MyCompany/, output: 'Filtered.plist')
47
+ end
48
+ ```
49
+
50
+ For complex condition, you can use block to define filter.
51
+
52
+ ```
53
+ post_install do
54
+ Pod::Command::AckFilter.filter(output: 'Filtered.plist') do |text|
55
+ text =~ /MyCompany/ && text !~ /Foobar/
56
+ end
57
+ end
58
+ ```
59
+
42
60
  ## Contributing
43
61
 
44
62
  1. Fork it ( https://github.com/[my-github-username]/cocoapods-ack_filter/fork )
@@ -1,5 +1,5 @@
1
1
  module Cocoapods
2
2
  module AckFilter
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -12,21 +12,27 @@ module Pod
12
12
  [['--output=FILENAME', 'Output filtered acknowledgements to FILENAME']]
13
13
  end
14
14
 
15
- def self.filter(pattern, filename = nil)
16
- args = [pattern]
17
- args << "--output=#{filename}" if filename
18
- self.new(CLAide::ARGV.new(args)).run
15
+ def self.filter(args, &block)
16
+ self.new(args, &block).run
19
17
  end
20
18
 
21
- def initialize(argv)
22
- @pattern = argv.shift_argument
23
- @filename = argv.option('output')
24
- super
19
+ def initialize(argv, &block)
20
+ if argv.kind_of?(CLAide::ARGV)
21
+ @pattern = Regexp.new(argv.shift_argument) unless argv.empty?
22
+ @filename = argv.option('output')
23
+ super
24
+ else
25
+ if argv[:pattern]
26
+ @pattern = argv[:pattern].kind_of?(Regexp) ? argv[:pattern] : Regexp.new(argv[:pattern])
27
+ end
28
+ @filename = argv[:output]
29
+ @filter_block = block
30
+ end
25
31
  end
26
32
 
27
33
  def validate!
28
34
  super
29
- help! 'Specify filtering pattern' unless @pattern
35
+ help! 'Specify filtering pattern' if !@pattern && !@filter_block
30
36
  end
31
37
 
32
38
  def output_filename
@@ -37,7 +43,11 @@ module Pod
37
43
  plist = CFPropertyList::List.new(file: ACKNOWLEDGEMENTS_FILE)
38
44
  specs = plist.value.value['PreferenceSpecifiers']
39
45
  specs.value.reject! do |spec|
40
- spec.value['FooterText'].value =~ /#{@pattern}/
46
+ if @filter_block
47
+ @filter_block.call(spec.value['FooterText'].value)
48
+ else
49
+ spec.value['FooterText'].value =~ @pattern
50
+ end
41
51
  end
42
52
  plist.save(output_filename, CFPropertyList::List::FORMAT_XML)
43
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-ack_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Mito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods