reversepoddependency 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 51c7c9f1c094a96c3d12fcdce4fc3e61c663eb7d
4
+ data.tar.gz: a682ad4db719a4b1ea23c26c08e1c6855c0a9a32
5
+ SHA512:
6
+ metadata.gz: 0bfa1954b42048622caff5fff04ce5c0bd7f3373c538b7f3bd6909415462e6b1a993a1419df553e32426c86ceed630af1922d569cae251fd3ca3a6ff5ed1fcdd
7
+ data.tar.gz: 9b51c2219d26eab5b70bd1ae90aca0e6bc80868a0ce73003dc984077a6c7b19dd885ded3e27438cab72f8196defaf0079af1036eefebace52463de32a6e60712
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.4
5
+ before_install: gem install bundler -v 1.14.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in reversepoddependency.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 乔志广
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # Reversepoddependency
2
+
3
+ cocoapods 辅助工具,用来分析 podspec 之间的依赖关系 ,目前只支持反向依赖的分析 ,
4
+ 以 AFNetworking 为例,specbackwarddependency ~/.cocoapods/repos/master AFNetworking 将会打印 master repo 中所有依赖了 AFNetworking 的podspec的名字
5
+ 默认会 update repo 库,如果在 cocoapods 官方的 master repo 中分析(podspec非常多),会耗时比较长
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'reversepoddependency'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install reversepoddependency
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ specbackwarddependency repopath podname
27
+ # 例如 specbackwarddependency ~/.cocoapods/repos/master AFNetworking
28
+ ```
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/乔志广/reversepoddependency.
39
+
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
44
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "reversepoddependency"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ require "reversepoddependency"
3
+
4
+ podSource = Reversepoddependency::SepcAnalyse.new(ARGV[0],ARGV[1])
5
+ resultHash = podSource.getAnalyseResult
6
+
7
+ puts "all Main Pods ,not contain Subspec"
8
+ puts "-----------------------------------"
9
+ resultHash.each {|key,value|
10
+ puts key
11
+ }
12
+ puts "\n"
13
+ puts "all pods ,contain Subspec"
14
+ puts "-----------------------------------"
15
+ resultHash.each {|key,value|
16
+ puts "#{key}->"
17
+ puts value
18
+ puts '---'
19
+ }
@@ -0,0 +1,6 @@
1
+ require "reversepoddependency/version"
2
+ require "reversepoddependency/specanalyse"
3
+
4
+ module Reversepoddependency
5
+
6
+ end
@@ -0,0 +1,52 @@
1
+ require 'cocoapods-core'
2
+
3
+ module Reversepoddependency
4
+
5
+ class SepcAnalyse
6
+ def initialize(repoPath,targetPodName)
7
+ @repoPath = repoPath
8
+ @targetPodName = targetPodName
9
+ @podSource = Pod::Source.new(repoPath)
10
+ end
11
+
12
+ def getAnalyseResult
13
+ if @podSource.git?
14
+ puts "update repo #{@podSource.name}"
15
+ @podSource.update(true)
16
+ end
17
+ puts "正在分析 #{@targetPodName} 在 #{@podSource.name} 中的被依赖列表 ...\n"
18
+ resultHasn = Hash.new
19
+ @podSource.pods.collect do |podName|
20
+ podspecHighV = self.getHighVersionSpec(podName)
21
+ tmpArr = []
22
+ if self.isSpecDependentTargetPod(podspecHighV) == 1
23
+ tmpArr.push(podName)
24
+ end
25
+
26
+ podspecHighV.subspecs.each do |subspec|
27
+ if self.isSpecDependentTargetPod(subspec) == 1
28
+ tmpArr.push(subspec.name)
29
+ end
30
+ end
31
+ if tmpArr.count > 0
32
+ resultHasn[podName] = tmpArr
33
+ end
34
+ end
35
+ return resultHasn
36
+ end
37
+
38
+ def getHighVersionSpec(podName)
39
+ highVersion = @podSource.versions(podName).first
40
+ return @podSource.specification(podName,highVersion)
41
+ end
42
+
43
+ def isSpecDependentTargetPod(spec)
44
+ spec.dependencies.each do |dependedPod|
45
+ if dependedPod.name.include?(@targetPodName)
46
+ return 1
47
+ end
48
+ end
49
+ return 0
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,3 @@
1
+ module Reversepoddependency
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,36 @@
1
+ #coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'reversepoddependency/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "reversepoddependency"
8
+ spec.version = Reversepoddependency::VERSION
9
+ spec.authors = ["乔志广"]
10
+ spec.email = ["qiaozhiguang@meituan.com"]
11
+
12
+ spec.summary = %q{反向依赖分析}
13
+ spec.description = %q{反向依赖分析,反向依赖分析}
14
+ spec.homepage = "https://www.meituan.com"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency 'cocoapods', '~>1.1'
33
+ spec.add_development_dependency "bundler", "~> 1.14"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reversepoddependency
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - 乔志广
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: 反向依赖分析,反向依赖分析
70
+ email:
71
+ - qiaozhiguang@meituan.com
72
+ executables:
73
+ - specbackwarddependency
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .rspec
79
+ - .travis.yml
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/specbackwarddependency
87
+ - lib/reversepoddependency.rb
88
+ - lib/reversepoddependency/specanalyse.rb
89
+ - lib/reversepoddependency/version.rb
90
+ - reversepoddependency.gemspec
91
+ homepage: https://www.meituan.com
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.0.14.1
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: 反向依赖分析
115
+ test_files: []