cocoapods-hbh 0.0.3 → 0.1.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
  SHA256:
3
- metadata.gz: 31f2592765405050041e12717abc2b09cfd47f330e051f4de48b50ebe20dc502
4
- data.tar.gz: 9cdb8ece30e50c8997e758a46acd773bc7bd6685ba4fbd5faa83bc54e63ecb28
3
+ metadata.gz: a99b63e2ae7aca677011d72c3b530e86baae6ce67ab013d20f7492be3c87ae5a
4
+ data.tar.gz: 1ae16580830fa55e0a235cb4f9ece28af8de44f6e2cb17c291b2ea03997f81b6
5
5
  SHA512:
6
- metadata.gz: 5047868bf505be88016941cd3b4966fa7c1e4be02af0e7db568a66ec02a7d873b4322c1988eb2d0a085b2c1da52ba329a1b143fc77a82c11f024c0625482f504
7
- data.tar.gz: 30d0a3e632d08d03bf9ea88bcb8259ee2d52e20cf4e74873d741d98a26be6dceafe0d4ad41c093aa3f64f1f71c7c44fc9571caf847aa93685c9555c1874b94ce
6
+ metadata.gz: f71687768d2449f2c478d4c9b659417ab83221c38d82fa83e2941dad14f2206095af344592043e4b9eeb0fe98f3ce4abafb13689cfa681c3e42a8c9d2871d448
7
+ data.tar.gz: 825677c58fa3882f65fb222d9acae3d797ed03bd08dbf2bf1c20d53f65aebe341ebfab81627299be7efc7b5042d20912ef7e8a962014952ed852ce30ed7ac2cc
@@ -15,14 +15,13 @@ module Pod
15
15
  add_sub_module.pod_submoudle(name, *requirements)
16
16
  end
17
17
 
18
- def pod_private(name = nil, *requirements)
18
+ def pod_hbh(name = nil, *requirements)
19
19
  unless name
20
20
  raise StandardError, 'A dependency requires a name.'
21
21
  end
22
22
  add_sub_module = AddModule.new(@current_target_definition)
23
23
  add_sub_module.pod_private(name, *requirements)
24
24
  end
25
-
26
25
  end
27
26
 
28
27
  end
@@ -5,8 +5,6 @@ module Pod
5
5
  class Repo < Command
6
6
  class Push < Repo
7
7
  class HBH < Push
8
- # pod repo push HBHSpecs HBHNetwork.podspec、
9
- # --sources='http://gitlab.jiehun.tech/App/iOS/Modularization/HBHSpecs.git,https://github.com/CocoaPods/Specs' --allow-warnings
10
8
  def initialize(argv)
11
9
  super
12
10
  hbh_specs_env = HBHConfig.config.hbh_specs_env
@@ -2,6 +2,8 @@ require 'cocoapods-hbh/command/common/install'
2
2
  require 'cocoapods-hbh/command/common/podfile'
3
3
  require 'cocoapods-hbh/command/common/push'
4
4
  require 'cocoapods-hbh/command/common/hbh_init'
5
+ require 'cocoapods-hbh/command/native/native_install'
6
+ require 'cocoapods-hbh/command/native/native_update'
5
7
 
6
8
  module Pod
7
9
  class Command
@@ -43,7 +43,7 @@ module Pod
43
43
 
44
44
 
45
45
  # 添加模块 模块名称为podspec的名称,路径默认为Module/下的模块,tag或者branch 优先使用tag,默认develop分支
46
- # (moduleName, submodule: true, moduleTag: nil, moduleBranch: 'develop', appspecs: nil)
46
+ # (moduleName, : true, moduleTag: nil, moduleBranch: 'develop', appspecs: nil)
47
47
  def pod_submoudle (moduleName, *requirements)
48
48
  info = requirements.last
49
49
  is_submodule = get_info(info, :submodule, true)
@@ -55,7 +55,7 @@ module Pod
55
55
  moduleBranch = get_info(info, :branch, nil)
56
56
  if moduleTag.nil? && moduleBranch.nil?
57
57
  Pod::UI.puts "请配置依赖tag或者branch".red
58
- raise "注意: 请配置依赖tag或者branch"
58
+ exit()
59
59
  end
60
60
 
61
61
  appspecs = get_info(info, :appspecs, nil)
@@ -63,7 +63,7 @@ module Pod
63
63
  remoteUrl = sub_config['sub_url']
64
64
  if remoteUrl.blank?
65
65
  Pod::UI.puts "请配置subModule的sub_url".red
66
- raise "注意: 请配置subModule的sub_url"
66
+ exit()
67
67
  end
68
68
  moduleRoot = sub_config['sub_path'].blank? ? "Modules" : sub_config['sub_path']
69
69
 
@@ -83,9 +83,11 @@ module Pod
83
83
  end
84
84
  end
85
85
  if moduleTag != nil and !moduleTag.empty?
86
- `cd #{path_module} && git fetch && git checkout #{moduleTag}`
86
+ `cd #{path_module} && git fetch && git checkout #{moduleTag}`
87
87
  else
88
- `cd #{path_module} && git fetch && git checkout #{moduleBranch} && git pull origin #{moduleBranch}`
88
+ pid, stdin, stdout, stderr = Open3::popen3 `cd #{path_module} && git fetch && git checkout #{moduleBranch} && git pull origin #{moduleBranch}`
89
+ Pod::UI.puts "发生错误#{stderr.value}".red
90
+ # `cd #{path_module} && git fetch && git checkout #{moduleBranch} && git pull origin #{moduleBranch}`
89
91
  end
90
92
  if appspecs != nil
91
93
  sub_hash = {:path => path_module, :appspecs => ['Example']}
@@ -0,0 +1,19 @@
1
+ require 'cocoapods'
2
+
3
+ module Pod
4
+ class Installer
5
+ alias old_prepare prepare
6
+ def prepare
7
+ if podfile.plugins.keys.include?('cocoapods-hbh')
8
+ Pod::UI.puts "使用cocoapods-hbh插件"
9
+ spec_version = HBHConfig.config.cocoapods_version
10
+ cocoapods_version = Pod::VERSION
11
+ if spec_version != cocoapods_version
12
+ Pod::UI.puts "注意: 你当前的pod版本和指定的版本不一致,当前指定版本为#{spec_version},您的版本为#{cocoapods_version}".red
13
+ exit()
14
+ end
15
+ end
16
+ old_prepare()
17
+ end
18
+ end
19
+ end
File without changes
@@ -1,7 +1,15 @@
1
1
  require 'cocoapods'
2
2
  require 'cocoapods-hbh/command/hbh'
3
+ require 'cocoapods-hbh/git_hooks/githooks_sync'
3
4
 
4
-
5
- Pod::HooksManager.register('cocoapods-hbhhooks', :pre_install) do |_context, _|
6
-
5
+ module CocoapodsHBHGitHooks
6
+ Pod::HooksManager.register('cocoapods-hbh', :post_install) do |context|
7
+ GitHooksSync.new.sync()
8
+ end
9
+ Pod::HooksManager.register('cocoapods-hbh', :post_update) do |context|
10
+ GitHooksSync.new.sync()
11
+ end
12
+ Pod::HooksManager.register('cocoapods-hbh', :post_install) do |context|
13
+ Pod::UI.puts "恭喜你, 你已经 `pod install` 结束了."
14
+ end
7
15
  end
@@ -4,37 +4,21 @@ require 'cocoapods-hbh/gem_version'
4
4
 
5
5
  module HBHConfig
6
6
  class Config
7
-
8
- def write_config ()
9
- {
10
- "hbh_specs_env" =>
11
- {
12
- "specs_name" => "私有仓库名称",
13
- "specs_url" => "私有仓库地址"
14
- },
15
- "submodule_env" =>
16
- {
17
- "sub_path" => "子模块存储路径",
18
- "sub_url" => "子模块远程厂库地址"
19
- }
20
- }
21
- end
22
-
23
- def template_hash
7
+
8
+ def template_hash
24
9
  {
25
- 'hbh_specs_env' => { description: '私有仓库环境',
26
- default: {
27
- 'specs_name' => { description: '私有仓库名称' },
28
- 'specs_url' => { description: '私有仓库地址' },
29
- }
10
+ 'hbh_specs_env' => {
11
+ 'description' => '私有仓库环境配置',
12
+ 'specs_name' => '私有仓库名称',
13
+ 'specs_url' => '私有仓库地址',
30
14
  },
31
-
32
- 'submodule_env' => { description: '子仓库环境',
33
- default: {
34
- 'sub_path' => { description: '子模块存储路径' },
35
- 'sub_url' => { description: '子模块厂库地址' },
36
- }
15
+ 'submodule_env' => {
16
+ 'description' => '子仓库环境配置',
17
+ 'sub_path' => '子模块存储路径' ,
18
+ 'sub_url' => '子模块厂库地址' ,
37
19
  },
20
+ 'is_git_hooks' => 'false',
21
+ 'cocoapods_version' => '1.10.1',
38
22
  }
39
23
  end
40
24
 
@@ -68,7 +52,11 @@ module HBHConfig
68
52
  if File.exist?(config_name)
69
53
  YAML.load_file(config_name)
70
54
  else
71
- default_config
55
+ aFile = File.new(config_name, "w+")
56
+ if aFile
57
+ aFile.syswrite(template_hash.to_yaml)
58
+ end
59
+ raise "请在你的根目录配置创建并配置HBHConfig.yml文件"
72
60
  end
73
61
  end
74
62
 
@@ -84,7 +72,11 @@ module HBHConfig
84
72
  if config.respond_to?(method)
85
73
  config.send(method, *args)
86
74
  elsif template_hash.keys.include?(method.to_s)
87
- raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_name} 中设置, 请执行 init 命令配置或手动修改配置文件".red
75
+ if method.to_s == "is_git_hooks"
76
+
77
+ else
78
+ raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_name} 中设置, 请手动修改配置文件".red
79
+ end
88
80
  else
89
81
  super
90
82
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsHbh
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -0,0 +1,42 @@
1
+ require 'cocoapods'
2
+ require 'fileutils'
3
+
4
+ module CocoapodsHBHGitHooks
5
+ class GitHooksSync
6
+ def sync
7
+
8
+ return unless HBHConfig.config.is_git_hooks
9
+
10
+ Pod::UI.puts "开始同步git拦截设置"
11
+ if !File.directory?(".git")
12
+ Pod::UI.puts "没有发现git工程"
13
+ return
14
+ end
15
+
16
+ # 在当前ruby项目的githook文件copy到项目里去做拦截
17
+ # 如果项目里配置了 .git-hooks 文件件,将把里面的内容copy到项目里去做拦截
18
+ # 项目里的.git-hooks 配置优先
19
+ git_hooks = "#{File.dirname(__FILE__)}/../../script_source/pre-commit"
20
+
21
+ # if File.directory?(".git-hooks")
22
+
23
+ # end
24
+
25
+ git_hooks = '.git-hooks/.' unless Dir['.git-hooks/*'].empty?
26
+
27
+ if !File.directory?(".git/hooks")
28
+ FileUtils.mkdir ".git/hooks"
29
+ end
30
+ FileUtils.cp_r(git_hooks, ".git/hooks/")
31
+ path = ".git/hooks/"
32
+ Dir.open(path).each do |p|
33
+ filename = File.basename(p, File.extname(p))
34
+ if File.extname(p) == ".sh"
35
+ FileUtils.mv("#{path}/#{p}", "#{path}/#{filename}")
36
+ end
37
+ FileUtils.chmod("+x", "#{path}/#{filename}")
38
+ end
39
+ Pod::UI.puts "结束同步git拦截设置"
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,37 @@
1
+ STAGE_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.swift')
2
+ swiftLintPath="./Pods/SwiftLint/swiftlint"
3
+ if test ${#STAGE_FILES} -gt 0
4
+ then
5
+ echo '检查提交的文件'
6
+ echo $(pwd)
7
+ if [ ! -e $swiftLintPath ]; then
8
+ echo '没安装SwiftLint'
9
+ exit 1
10
+ fi
11
+
12
+ PASS=true
13
+ PATH="./swiftLint"
14
+
15
+ for FILE in $STAGE_FILES
16
+ do
17
+ warning="*warning*"
18
+ $swiftLintPath lint --strict $FILE > $PATH
19
+ /bin/cat $PATH
20
+ Result=$(/bin/cat $PATH)
21
+ if [[ $Result == *$warning* ]]; then
22
+ PASS=false
23
+ fi
24
+ done
25
+ /bin/rm -rf $PATH
26
+ if ! $PASS; then
27
+ echo "SwiftLint检查没通过!"
28
+ exit 1
29
+ else
30
+ echo "SwiftLint检查完毕"
31
+ fi
32
+
33
+ else
34
+ echo '没有swift文件需要检查'
35
+ fi
36
+
37
+ exit 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-hbh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - zanju
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-14 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -96,11 +96,15 @@ files:
96
96
  - lib/cocoapods-hbh/command/custom/sync_githooks.rb
97
97
  - lib/cocoapods-hbh/command/hbh.rb
98
98
  - lib/cocoapods-hbh/command/module/add_module.rb
99
+ - lib/cocoapods-hbh/command/native/native_install.rb
100
+ - lib/cocoapods-hbh/command/native/native_update.rb
99
101
  - lib/cocoapods-hbh/config/config.rb
100
102
  - lib/cocoapods-hbh/config/config_asker.rb
101
103
  - lib/cocoapods-hbh/gem_version.rb
104
+ - lib/cocoapods-hbh/git_hooks/githooks_sync.rb
102
105
  - lib/cocoapods-hbh/helpers/git_depend.rb
103
106
  - lib/cocoapods_plugin.rb
107
+ - lib/script_source/pre-commit
104
108
  homepage: https://github.com/EXAMPLE/cocoapods-hbh
105
109
  licenses:
106
110
  - MIT