cocoapods-hipac 0.0.2 → 0.0.3

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: 3dc8a84d1a80fd4659c28c7b0653fed9cca0493e
4
- data.tar.gz: 971cb916671c86020e0d31ae1dac97bc2188d341
3
+ metadata.gz: 1fb11a7cb6a2d71811d6e26bb4ddfb914c5559d7
4
+ data.tar.gz: e33e7a586ebf129566178a90e55e0be48f4b980f
5
5
  SHA512:
6
- metadata.gz: 265c8333d5f688daf69575aef7ee5ccca8db10def324ae4990cf33d71b005a60875980bf96145a067c9ea4ae9752ef2fd7a99c0962938b36f87655f53fd903bf
7
- data.tar.gz: 5464b26a0057bd4ae3d51b0b9cd05991a93f1a4221710a161b15ae94fbf478b50e256e2f24b92bf8de67ce3fbd67fd309ddb59baea9db996f1b88edb2915a261
6
+ metadata.gz: f8adc7b7c13cd6a56e139242896f3be08507a6d27e8aeeeaf31abf0cca8726ef6f690e2d1078f4f342bbbdccc40d3e2f0341f3104cdbee56cc907687bdcb3fe7
7
+ data.tar.gz: 16180fdea911ef55f2a0dcf810fe7a54cc31b550e2b9d1b6250f99264e0abbefd60505360ddf4452eb815a6fb9f52e1d6074e85cf465e3245d915b22d337f593
@@ -13,7 +13,7 @@ module Pod
13
13
  end
14
14
 
15
15
  class Manager
16
- HIPAC_SOURCE_URL = 'git@git.hipac.cn:Wireless/iOS/HipacSpecs.git'.freeze
16
+ HIPAC_SOURCE_URL = 'git@ytgit.hipac.cn:Wireless/iOS/HipacSpecs.git'.freeze
17
17
 
18
18
  def last_specs_with_source_name_or_url(name_or_url)
19
19
  source = source_with_name_or_url(name_or_url)
@@ -1,4 +1,6 @@
1
1
  require 'cocoapods'
2
+ require 'cocoapods-hipac/command/cocoapods/pod_item'
3
+
2
4
 
3
5
  def reference_spec_list
4
6
  analyzer = Pod::Installer::Analyzer.new(@config.sandbox, @config.podfile, @config.lockfile)
@@ -16,3 +18,37 @@ def reference_spec_list
16
18
  puts 'Can`t fetch specs from project directory, fetch from private source cache'.yellow
17
19
  @config.sources_manager.default_source.last_specs
18
20
  end
21
+
22
+
23
+ def group_pods_dep(dev_dependency_list, reference_spec_list)
24
+ grouped_pods = []
25
+
26
+ dev_dependency_name_list = dev_dependency_list.map(&:name)
27
+
28
+ dev_specs = reference_spec_list.select do |spec|
29
+ dev_dependency_name_list.include?(spec.name)
30
+ end
31
+
32
+ while dev_specs.length > 0
33
+ pods = []
34
+ dev_specs.each do |spec|
35
+ dependency_names = spec.recursive_dependencies(reference_spec_list).map { |dep| dep.name }
36
+ dev_name = spec.name
37
+
38
+ if dev_specs.select { |spec| dependency_names.include?(spec.name) }.empty?
39
+ pod = PodItem.new(dev_name)
40
+ pod.spec = reference_spec_list.find { |spec| spec.name == dev_name }
41
+ pod.dependency = dev_dependency_list.find { |dep| dep.name == dev_name }
42
+ pod.external_dependency_names = dependency_names.select { |name| dev_dependency_name_list.include?(name) }
43
+ pods << pod
44
+ end
45
+ end
46
+ dev_specs = dev_specs.reject do |spec|
47
+ pods.select { |pod| pod.name == spec.name }.any?
48
+ end
49
+ grouped_pods << pods
50
+ end
51
+
52
+ grouped_pods
53
+
54
+ end
@@ -0,0 +1,78 @@
1
+ require 'cocoapods-hipac/command/cocoapods/podfile'
2
+ require 'cocoapods-hipac/command/cocoapods/source'
3
+ require 'cocoapods-hipac/command/cocoapods/specification'
4
+ require 'cocoapods-hipac/command/cocoapods/pod_item'
5
+ require 'cocoapods-hipac/command/cocoapods/tool'
6
+
7
+
8
+ module Pod
9
+ class Command
10
+ class Hipac < Command
11
+ class Deplist < Hipac
12
+ self.summary = '列出 pod 的所有依赖'
13
+
14
+ self.description = <<-DESC
15
+ 根据 Podfile 文件对 pod 依赖分析,列出 pod 的所有依赖
16
+ DESC
17
+
18
+ def self.options
19
+ [
20
+ ['--json', '将依赖以 json 格式输出']
21
+ ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
22
+ end
23
+
24
+ def initialize(argv)
25
+ @config = Pod::Config.instance
26
+ @json = argv.flag?('json')
27
+ help! 'No `Podfile` found in the project directory.' if Pathname.glob('Podfile').empty?
28
+ super
29
+ end
30
+
31
+ def validate!
32
+ super
33
+ end
34
+
35
+ def run
36
+ UI.puts "pod hipac deplist"
37
+
38
+ @grouped_pods = group_pods_dep(dependency_list(), reference_spec_list())
39
+
40
+ if @grouped_pods
41
+ json_pod = {}
42
+ str_pod = ""
43
+ @grouped_pods.each do |group|
44
+ group.each do |pod|
45
+ str_pod << pod.name.dup
46
+ dep_pods = []
47
+ if pod.external_dependency_names.any?
48
+ pod.external_dependency_names.each do |name|
49
+ str_pod << "\n- #{name}"
50
+ dep_pods << name
51
+ end
52
+ end
53
+ str_pod << "\n\n"
54
+ json_pod[pod.name.dup] = dep_pods
55
+ end
56
+ end
57
+
58
+ if @json
59
+ puts json_pod.to_json
60
+ else
61
+ puts str_pod
62
+ end
63
+ end
64
+ end
65
+
66
+ def dependency_list
67
+ list = []
68
+
69
+ list = @config.podfile.all_dependency_list
70
+
71
+ list
72
+ end
73
+
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -18,12 +18,14 @@ module Pod
18
18
  def self.options
19
19
  [
20
20
  ['--all', '所有依赖'],
21
+ ['--json', '将依赖以 json 格式输出']
21
22
  ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
22
23
  end
23
24
 
24
25
  def initialize(argv)
25
26
  @config = Pod::Config.instance
26
27
  @all = argv.flag?('all')
28
+ @json = argv.flag?('json')
27
29
  help! 'No `Podfile` found in the project directory.' if Pathname.glob('Podfile').empty?
28
30
  super
29
31
  end
@@ -35,21 +37,13 @@ module Pod
35
37
  def run
36
38
  UI.puts "pod hipac depsort"
37
39
 
38
- group_pods_dep(dependency_list(), reference_spec_list())
40
+ @grouped_pods = group_pods_dep(dependency_list(), reference_spec_list())
39
41
 
40
42
  if @grouped_pods
41
-
42
43
  sort_pods = []
43
44
  @grouped_pods.each do |group|
44
45
  group.each do |pod|
45
- display = pod.name.dup
46
- if pod.external_dependency_names.any?
47
- pod.external_dependency_names.each do |name|
48
- display << "\n- #{name}"
49
- end
50
- end
51
- display << "\n\n"
52
- puts display
46
+
53
47
  sort_pods << pod
54
48
  end
55
49
  end
@@ -58,6 +52,7 @@ module Pod
58
52
  pod.external_dependency_names.length
59
53
  end
60
54
 
55
+ UI.puts "\n\npod_dep_sort_result\n\n"
61
56
  UI.puts sort_pods
62
57
  else
63
58
  puts '没有未依赖正式版本组件.'
@@ -76,40 +71,6 @@ module Pod
76
71
  list
77
72
  end
78
73
 
79
- def group_pods_dep(dev_dependency_list, reference_spec_list)
80
- result = []
81
-
82
- dev_dependency_name_list = dev_dependency_list.map(&:name)
83
-
84
- dev_specs = reference_spec_list.select do |spec|
85
- dev_dependency_name_list.include?(spec.name)
86
- end
87
-
88
- while dev_specs.length > 0
89
- pods = []
90
- dev_specs.each do |spec|
91
- dependency_names = spec.recursive_dependencies(reference_spec_list).map { |dep| dep.name }
92
- dev_name = spec.name
93
-
94
- if dev_specs.select { |spec| dependency_names.include?(spec.name) }.empty?
95
- pod = PodItem.new(dev_name)
96
- pod.spec = reference_spec_list.find { |spec| spec.name == dev_name }
97
- pod.dependency = dev_dependency_list.find { |dep| dep.name == dev_name }
98
- pod.external_dependency_names = dependency_names.select { |name| dev_dependency_name_list.include?(name) }
99
- pods << pod
100
- end
101
- end
102
- dev_specs = dev_specs.reject do |spec|
103
- pods.select { |pod| pod.name == spec.name }.any?
104
- end
105
- result << pods
106
- end
107
-
108
- @grouped_pods = result
109
- @grouped_pods
110
-
111
- end
112
-
113
74
  end
114
75
 
115
76
  end
@@ -1,6 +1,7 @@
1
1
  require 'cocoapods-hipac/command/depsort'
2
2
  require 'cocoapods-hipac/command/pull'
3
3
  require 'cocoapods-hipac/command/tree'
4
+ require 'cocoapods-hipac/command/deplist'
4
5
 
5
6
 
6
7
  module Pod
@@ -15,8 +15,16 @@ module Pod
15
15
  根据 Podfile 文件对 pod 依赖分析
16
16
  DESC
17
17
 
18
+ def self.options
19
+ [
20
+ ['--own', '指定podfile中录入的库'],
21
+ ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
22
+ end
23
+
18
24
  def initialize(argv)
19
25
  @config = Pod::Config.instance
26
+ @own = argv.flag?('own')
27
+
20
28
  help! 'No `Podfile` found in the project directory.' if Pathname.glob('Podfile').empty?
21
29
  super
22
30
  end
@@ -29,6 +37,11 @@ module Pod
29
37
  all_dependency_name_list = all_dependency_list().map(&:name)
30
38
 
31
39
  all_spec_list = reference_spec_list()
40
+ if @own
41
+ all_spec_list = reference_spec_list().select { |spec|
42
+ all_dependency_name_list.include?(spec.name)
43
+ }
44
+ end
32
45
 
33
46
  private_dependency_list = all_spec_list.select do |spec|
34
47
  all_dependency_name_list.include?(spec.name)
@@ -1,3 +1,3 @@
1
1
  module CocoapodsHipac
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-hipac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - QiYa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,12 +45,6 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
49
- - Gemfile
50
- - LICENSE.txt
51
- - README.md
52
- - Rakefile
53
- - cocoapods-hipac.gemspec
54
48
  - lib/cocoapods-hipac.rb
55
49
  - lib/cocoapods-hipac/command.rb
56
50
  - lib/cocoapods-hipac/command/cocoapods/pod_item.rb
@@ -58,14 +52,13 @@ files:
58
52
  - lib/cocoapods-hipac/command/cocoapods/source.rb
59
53
  - lib/cocoapods-hipac/command/cocoapods/specification.rb
60
54
  - lib/cocoapods-hipac/command/cocoapods/tool.rb
55
+ - lib/cocoapods-hipac/command/deplist.rb
61
56
  - lib/cocoapods-hipac/command/depsort.rb
62
57
  - lib/cocoapods-hipac/command/hipac.rb
63
58
  - lib/cocoapods-hipac/command/pull.rb
64
59
  - lib/cocoapods-hipac/command/tree.rb
65
60
  - lib/cocoapods-hipac/gem_version.rb
66
61
  - lib/cocoapods_plugin.rb
67
- - spec/command/hipac_spec.rb
68
- - spec/spec_helper.rb
69
62
  homepage: https://github.com/EXAMPLE/cocoapods-hipac
70
63
  licenses:
71
64
  - MIT
@@ -90,6 +83,4 @@ rubygems_version: 2.6.13
90
83
  signing_key:
91
84
  specification_version: 4
92
85
  summary: A longer description of cocoapods-hipac.
93
- test_files:
94
- - spec/command/hipac_spec.rb
95
- - spec/spec_helper.rb
86
+ test_files: []
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- .DS_Store
2
- pkg
3
- .idea/
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in cocoapods-hipac.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'cocoapods'
8
-
9
- gem 'mocha'
10
- gem 'bacon'
11
- gem 'mocha-on-bacon'
12
- gem 'prettybacon'
13
- end
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2019 Demo <DEMO@JL.Local>
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,11 +0,0 @@
1
- # hipac cocoapods-plugin
2
- 为 pod 提供二级命令 hipac
3
- ## install
4
- `gem install cocoapods-hipac`
5
- ## usage
6
- * `pod hipac depsort` 根据 podFile 分析依赖
7
- * `pod hipac pull` 根据 podFile 将开发状态 pod 批量更新至本地
8
- 所有 pod 会 pull 至 podFile 所在目录的上一级
9
- 本地没有该 pod 仓库 执行git clone -b
10
- 本地有该 pod 仓库,且分支一致,执行 git stash & git pull
11
- 本地有该 pod 仓库,但分支不一致,执行 git stash & git checkout branch & git pull
data/Rakefile DELETED
@@ -1,13 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- def specs(dir)
4
- FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
- end
6
-
7
- desc 'Runs all the specs'
8
- task :specs do
9
- sh "bundle exec bacon #{specs('**')}"
10
- end
11
-
12
- task :default => :specs
13
-
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cocoapods-hipac/gem_version.rb'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'cocoapods-hipac'
8
- spec.version = CocoapodsHipac::VERSION
9
- spec.authors = ['QiYa']
10
- spec.email = ['jl.0130@hotmail.com']
11
- spec.description = %q{A short description of cocoapods-hipac.}
12
- spec.summary = %q{A longer description of cocoapods-hipac.}
13
- spec.homepage = 'https://github.com/EXAMPLE/cocoapods-hipac'
14
- spec.license = 'MIT'
15
-
16
- # spec.files = Dir['lib/**/*']
17
- spec.files = `git ls-files`.split($/)
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ['lib']
21
-
22
- spec.add_development_dependency 'bundler', '~> 1.3'
23
- spec.add_development_dependency 'rake'
24
- end
@@ -1,12 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Pod
4
- describe Command::Hipac do
5
- describe 'CLAide' do
6
- it 'registers it self' do
7
- Command.parse(%w{ hipac }).should.be.instance_of Command::Hipac
8
- end
9
- end
10
- end
11
- end
12
-
data/spec/spec_helper.rb DELETED
@@ -1,50 +0,0 @@
1
- require 'pathname'
2
- ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
- $:.unshift((ROOT + 'lib').to_s)
4
- $:.unshift((ROOT + 'spec').to_s)
5
-
6
- require 'bundler/setup'
7
- require 'bacon'
8
- require 'mocha-on-bacon'
9
- require 'pretty_bacon'
10
- require 'pathname'
11
- require 'cocoapods'
12
-
13
- Mocha::Configuration.prevent(:stubbing_non_existent_method)
14
-
15
- require 'cocoapods_plugin'
16
-
17
- #-----------------------------------------------------------------------------#
18
-
19
- module Pod
20
-
21
- # Disable the wrapping so the output is deterministic in the tests.
22
- #
23
- UI.disable_wrap = true
24
-
25
- # Redirects the messages to an internal store.
26
- #
27
- module UI
28
- @output = ''
29
- @warnings = ''
30
-
31
- class << self
32
- attr_accessor :output
33
- attr_accessor :warnings
34
-
35
- def puts(message = '')
36
- @output << "#{message}\n"
37
- end
38
-
39
- def warn(message = '', actions = [])
40
- @warnings << "#{message}\n"
41
- end
42
-
43
- def print(message)
44
- @output << message
45
- end
46
- end
47
- end
48
- end
49
-
50
- #-----------------------------------------------------------------------------#