cocoapods-hbh 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-hbh/command/common/podfile.rb +1 -1
- data/lib/cocoapods-hbh/command/common/push.rb +0 -2
- data/lib/cocoapods-hbh/command/hbh.rb +2 -0
- data/lib/cocoapods-hbh/command/module/add_module.rb +3 -3
- data/lib/cocoapods-hbh/command/native/native_install.rb +16 -0
- data/lib/cocoapods-hbh/command/native/native_update.rb +0 -0
- data/lib/cocoapods-hbh/command.rb +11 -3
- data/lib/cocoapods-hbh/config/config.rb +17 -29
- data/lib/cocoapods-hbh/gem_version.rb +1 -1
- data/lib/cocoapods-hbh/git_hooks/githooks_sync.rb +42 -0
- data/lib/script_source/pre-commit +37 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98a4059653f831ffeab457d1035fe2c7143c75c5d03075d5ca6c54726a9f3c6f
|
4
|
+
data.tar.gz: d75359becf0c555bd9ef48cf4015258cbcc0b87c224d4a4874139e4c2964e9e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43392b86ab6ab7f16f3b46e845270653db17c1463ce0ae95cd5da9eac7f3933a55f706a43257d08ae8d9b3e2d660b0d59513185e9a79afec03322b1a66771cb1
|
7
|
+
data.tar.gz: fdac187ae8d3e72687f0a65cd7b9b7cebb86e8f942d106b3fb75e29cce852208b179731dab22c8fae6fc1626702e9e7e8fb3613cba035148bec54bc124d47a1d
|
@@ -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,
|
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
|
-
|
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
|
-
|
66
|
+
exit()
|
67
67
|
end
|
68
68
|
moduleRoot = sub_config['sub_path'].blank? ? "Modules" : sub_config['sub_path']
|
69
69
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Installer
|
5
|
+
alias old_prepare prepare
|
6
|
+
def prepare
|
7
|
+
spec_version = HBHConfig.config.cocoapods_version
|
8
|
+
cocoapods_version = Pod::VERSION
|
9
|
+
if spec_version != cocoapods_version
|
10
|
+
Pod::UI.puts "注意: 你当前的pod版本和指定的版本不一致,当前指定版本为#{spec_version},您的版本为#{cocoapods_version}".red
|
11
|
+
exit()
|
12
|
+
end
|
13
|
+
old_prepare()
|
14
|
+
end
|
15
|
+
end
|
16
|
+
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-
|
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
|
-
|
9
|
-
{
|
10
|
-
"hbh_specs_env" =>
|
11
|
-
{
|
12
|
-
"specs_name" => "私有仓库名称",
|
13
|
-
"specs_url" => "私有仓库地址"
|
14
|
-
},
|
15
|
-
"submodule_env" =>
|
7
|
+
|
8
|
+
def template_hash
|
16
9
|
{
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def template_hash
|
24
|
-
{
|
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
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
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
|
|
@@ -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
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zanju
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-15 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
|