bundler-grep 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: 653879f7a3b60e0305f666c60f2b127a59bbff1f
4
- data.tar.gz: 9b120ecad0dd094cf1172800c71ee3cdf9587580
3
+ metadata.gz: 05312917e52c1f845a7d1e4346fa856ffd709418
4
+ data.tar.gz: 3a083ab387dc350a013b93afb9da8978ee7899d1
5
5
  SHA512:
6
- metadata.gz: 0c503b4b99b75e851687fad0f1713dc3dc3b65c1f9931d4baeacf40c16302bc62519bb60e6b7edcdc39fcfb7e09c7bdfd289a4d225cd4f457ddc3e333f1d5a80
7
- data.tar.gz: e5ddf5d51c1ed1e19e74d2be1d809e34f1251d7ed033c1b544a62687005a31e2139fd354b629bd1291456e98604aeaa53f05aa9d7663392f0b5cec6054ea67a6
6
+ metadata.gz: 1818b8bfb70cb18eff9a5ca88b0a57aee02d605ccec0f0c6e0e5380f34b5ecc3ae09e27b61feae5d085fe747af548a5e6534c39c2db66eb6c68c27c8c87600a9
7
+ data.tar.gz: cd7bdf85b523d845273d2b4d7bdf84fd721b3c4e47b5d3614e8520c7b0e0cfa6f7aaee2d9c88d3a79fd898377b90d78731feb5a4336fce961edb9c8f31b81cf0
data/README.md CHANGED
@@ -45,7 +45,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
45
45
 
46
46
  ## Contributing
47
47
 
48
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bundler-grep. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
48
+ Bug reports and pull requests are welcome on GitHub at https://github.com/takkanm/bundler-grep. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
49
49
 
50
50
 
51
51
  ## License
@@ -10,6 +10,9 @@ module Bundler
10
10
 
11
11
  class Command
12
12
  def initialize(argv)
13
+ @gems = []
14
+ @ignore_gems = []
15
+
13
16
  parse_argument!(argv)
14
17
  end
15
18
 
@@ -24,6 +27,9 @@ module Bundler
24
27
  opt.on('-g name1[,name2..]', '--gems name1[,name2..]', 'select target gems') do |gems|
25
28
  @gems = gems.split(',')
26
29
  end
30
+ opt.on('--ingore-gems name1[,name2..]', 'ignore grep gems') do |gems|
31
+ @ignore_gems = gems.split(',')
32
+ end
27
33
  opt.version = Bundler::Grep::VERSION
28
34
 
29
35
  opt.parse!(argv)
@@ -39,13 +45,23 @@ module Bundler
39
45
  end
40
46
 
41
47
  def selected_gem_paths
42
- if @gems
43
- Bundler.load.specs.find_all {|spec|
44
- @gems.include?(spec.name)
45
- }.map(&:full_gem_path)
46
- else
47
- Bundler.load.specs.map(&:full_gem_path)
48
- end
48
+ selected_gem_specs.map(&:full_gem_path)
49
+ end
50
+
51
+ def selected_gem_specs
52
+ return Bundler.load.specs if @gems.empty? && @ignore_gems.empty?
53
+
54
+ Bundler.load.specs.find_all {|spec|
55
+ collecte_gem?(spec.name) && not_ignored_gem?(spec.name)
56
+ }
57
+ end
58
+
59
+ def collecte_gem?(gem_name)
60
+ @gems.empty? || @gems.include?(gem_name)
61
+ end
62
+
63
+ def not_ignored_gem?(gem_name)
64
+ @ignore_gems.empty? || !@ignore_gems.include?(gem_name)
49
65
  end
50
66
  end
51
67
  end
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module Grep
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-grep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - takkanm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-08 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler