cocoapods-hipac 0.0.4 → 0.0.5

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
- SHA1:
3
- metadata.gz: 15f7295aabc3ba1e3e579c0cec944ab9b7ec9460
4
- data.tar.gz: f8db89d29f5344973ba107fd9816ef4e9b0a5f31
2
+ SHA256:
3
+ metadata.gz: cb260d705e93b9dd370decc4360d3884843b4a320a8f889aea145f3d74056190
4
+ data.tar.gz: 20511161237a93403711e4f21d1d82b96cc467c583651372846b33960a1cf05c
5
5
  SHA512:
6
- metadata.gz: 655b310c3395f05eb6b0ded2157c5c06d28fbe7b6ff8905a35d2b353d68124b334fa33295783339fb03e34d36fc280158610164c45269b4e1e03374fa9f00abf
7
- data.tar.gz: 68a42136df90eb681a8e4ff35115f04fc65652e2973de585872e9f2fdfb4c798184ad14aedbee6c89139abf8c1a524b5404d824d4058b7f46c86b2d63f506294
6
+ metadata.gz: 461314ee3f2513e100dea0400d603817efa0f2bd5af2e95a026cc5355921b973a233c3ab725c7c289acf78dc4ad9e273fe84021f3c422266c623450c371ddf04
7
+ data.tar.gz: 10bf75f9cfcb385a0031e2f4bfdaf3f64d46d5f4b92a4aa1318e9d7b05b3956ff9c2fced9e7a77cf8a216d11502589ef9009c0b1abfd347d5cf6978db0b10c27
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
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 ADDED
@@ -0,0 +1,22 @@
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 ADDED
@@ -0,0 +1,13 @@
1
+ # hipac cocoapods-plugin
2
+ 为 pod 提供二级命令 hipac
3
+ ## install
4
+ `gem install cocoapods-hipac`
5
+ ## usage
6
+ * `pod hipac deplist` 根据 Podfile 文件对 pod 依赖分析,列出 pod 的所有依赖
7
+ * `pod hipac deptree` 根据 Podfile 文件对 pod 依赖分析,输出 podfile.lock 格式的带层级依赖
8
+ * `pod hipac depsort` 根据 Podfile 文件对 pod 依赖分析并排序,默认只对处于开发状态的 pod 排序
9
+ * `pod hipac pull` 根据 podFile 将开发状态 pod 批量更新至本地
10
+ 所有 pod 会 pull 至 podFile 所在目录的上一级
11
+ 本地没有该 pod 仓库 执行git clone -b
12
+ 本地有该 pod 仓库,且分支一致,执行 git stash & git pull
13
+ 本地有该 pod 仓库,但分支不一致,执行 git stash & git checkout branch & git pull
data/Rakefile ADDED
@@ -0,0 +1,13 @@
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
+
@@ -0,0 +1,24 @@
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
@@ -9,7 +9,7 @@ module Pod
9
9
  class Command
10
10
  class Hipac < Command
11
11
  class Deplist < Hipac
12
- self.summary = '列出 pod 的所有依赖'
12
+ self.summary = '递归解析,列出每个 pod 的所有依赖'
13
13
 
14
14
  self.description = <<-DESC
15
15
  根据 Podfile 文件对 pod 依赖分析,列出 pod 的所有依赖
@@ -37,39 +37,60 @@ module Pod
37
37
 
38
38
  @grouped_pods = group_pods_dep(dependency_list(), reference_spec_list())
39
39
 
40
+ if @json
41
+ output_json()
42
+ else
43
+ output_default()
44
+ end
45
+
46
+ end
47
+
48
+ def dependency_list
49
+ list = []
50
+
51
+ list = @config.podfile.all_dependency_list
52
+
53
+ list
54
+ end
55
+
56
+ def output_default
40
57
  if @grouped_pods
41
- json_pod = {}
42
58
  str_pod = ""
43
59
  @grouped_pods.each do |group|
44
60
  group.each do |pod|
45
61
  str_pod << pod.name.dup
46
- dep_pods = []
47
62
  if pod.external_dependency_names.any?
48
63
  pod.external_dependency_names.each do |name|
49
64
  str_pod << "\n- #{name}"
50
- dep_pods << name
51
65
  end
52
66
  end
53
67
  str_pod << "\n\n"
54
- json_pod[pod.name.dup] = dep_pods
55
68
  end
56
69
  end
57
70
 
58
- if @json
59
- puts json_pod.to_json
60
- else
61
- puts str_pod
62
- end
71
+ puts str_pod
63
72
  end
64
73
  end
65
74
 
66
- def dependency_list
67
- list = []
75
+ def output_json
76
+ if @grouped_pods
77
+ json_pod = {}
78
+ @grouped_pods.each do |group|
79
+ group.each do |pod|
80
+ dep_pods = []
81
+ if pod.external_dependency_names.any?
82
+ pod.external_dependency_names.each do |name|
83
+ dep_pods << name
84
+ end
85
+ end
86
+ json_pod[pod.name.dup] = dep_pods
87
+ end
88
+ end
68
89
 
69
- list = @config.podfile.all_dependency_list
90
+ puts json_pod.to_json
70
91
 
71
- list
72
- end
92
+ end
93
+ end
73
94
 
74
95
  end
75
96
 
@@ -9,7 +9,7 @@ module Pod
9
9
  class Command
10
10
  class Hipac < Command
11
11
  class Depsort < Hipac
12
- self.summary = '根据 Podfile 文件对 pod 依赖分析'
12
+ self.summary = '根据 Podfile 文件对 pod 依赖进行排序'
13
13
 
14
14
  self.description = <<-DESC
15
15
  根据 Podfile 文件对 pod 依赖分析,默认只对处于开发状态的 pod 排序
@@ -18,14 +18,12 @@ module Pod
18
18
  def self.options
19
19
  [
20
20
  ['--all', '所有依赖'],
21
- ['--json', '将依赖以 json 格式输出']
22
21
  ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
23
22
  end
24
23
 
25
24
  def initialize(argv)
26
25
  @config = Pod::Config.instance
27
26
  @all = argv.flag?('all')
28
- @json = argv.flag?('json')
29
27
  help! 'No `Podfile` found in the project directory.' if Pathname.glob('Podfile').empty?
30
28
  super
31
29
  end
@@ -53,15 +51,42 @@ module Pod
53
51
 
54
52
  UI.puts "\n\npod_dep_sort_result\n\n"
55
53
  UI.puts "========="
56
- sort_pods.each { |pod|
57
- UI.puts pod.name.lstrip.rstrip
58
- }
54
+ if @all
55
+ output_all_dep(sort_pods)
56
+ else
57
+ output_default(sort_pods)
58
+ end
59
59
  UI.puts "========="
60
+
60
61
  else
61
62
  puts '没有未依赖正式版本组件.'
62
63
  end
63
64
  end
64
65
 
66
+ def output_all_dep(sort_pods)
67
+ temp_dev_dep_list = @config.podfile.dev_dependency_list
68
+
69
+ sort_pods.each { |pod|
70
+ info = ''
71
+ info << pod.name.lstrip.rstrip
72
+ info << '|'
73
+ dev = temp_dev_dep_list.find { |s| s.name.eql?(pod.name) }
74
+ if dev.nil?
75
+ info << '0'
76
+ else
77
+ info << '1'
78
+ end
79
+ UI.puts info
80
+ }
81
+
82
+ end
83
+
84
+ def output_default(sort_pods)
85
+ sort_pods.each { |pod|
86
+ UI.puts pod.name.lstrip.rstrip
87
+ }
88
+ end
89
+
65
90
  def dependency_list
66
91
  list = []
67
92
 
@@ -8,8 +8,8 @@ require 'cocoapods-hipac/command/cocoapods/tool'
8
8
  module Pod
9
9
  class Command
10
10
  class Hipac < Command
11
- class Tree < Hipac
12
- self.summary = '输出 podfile.lock 格式的带层级依赖'
11
+ class Deptree < Hipac
12
+ self.summary = '递归解析每个 pod 的全部依赖,输出 podfile.lock 格式的带层级依赖'
13
13
 
14
14
  self.description = <<-DESC
15
15
  根据 Podfile 文件对 pod 依赖分析,输出 podfile.lock 格式的带层级依赖
@@ -1,6 +1,6 @@
1
1
  require 'cocoapods-hipac/command/depsort'
2
2
  require 'cocoapods-hipac/command/pull'
3
- require 'cocoapods-hipac/command/tree'
3
+ require 'cocoapods-hipac/command/deptree'
4
4
  require 'cocoapods-hipac/command/deplist'
5
5
 
6
6
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsHipac
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,12 @@
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
+
@@ -0,0 +1,50 @@
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
+ #-----------------------------------------------------------------------------#
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.4
4
+ version: 0.0.5
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-19 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,6 +45,12 @@ 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
48
54
  - lib/cocoapods-hipac.rb
49
55
  - lib/cocoapods-hipac/command.rb
50
56
  - lib/cocoapods-hipac/command/cocoapods/pod_item.rb
@@ -54,11 +60,13 @@ files:
54
60
  - lib/cocoapods-hipac/command/cocoapods/tool.rb
55
61
  - lib/cocoapods-hipac/command/deplist.rb
56
62
  - lib/cocoapods-hipac/command/depsort.rb
63
+ - lib/cocoapods-hipac/command/deptree.rb
57
64
  - lib/cocoapods-hipac/command/hipac.rb
58
65
  - lib/cocoapods-hipac/command/pull.rb
59
- - lib/cocoapods-hipac/command/tree.rb
60
66
  - lib/cocoapods-hipac/gem_version.rb
61
67
  - lib/cocoapods_plugin.rb
68
+ - spec/command/hipac_spec.rb
69
+ - spec/spec_helper.rb
62
70
  homepage: https://github.com/EXAMPLE/cocoapods-hipac
63
71
  licenses:
64
72
  - MIT
@@ -79,8 +87,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
87
  version: '0'
80
88
  requirements: []
81
89
  rubyforge_project:
82
- rubygems_version: 2.6.13
90
+ rubygems_version: 2.7.7
83
91
  signing_key:
84
92
  specification_version: 4
85
93
  summary: A longer description of cocoapods-hipac.
86
- test_files: []
94
+ test_files:
95
+ - spec/command/hipac_spec.rb
96
+ - spec/spec_helper.rb