cocoapods-hbh 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ce18e2b95339d2db022c65c616c7ca55fb29c372a3fa534ddd3fb7b4430e46d9
4
+ data.tar.gz: 4ad932b3d91390c27f7d9895e016a3ebdacbbe7146a8d5c2972e728d62138889
5
+ SHA512:
6
+ metadata.gz: 0edef73beae1ffcd658707c201e120eed4df01958c402db5ea92d61147648c824628ec3ba3a71f1adb71427af415d5e36c86921e246bc9115b2abbbbb56fb0b8
7
+ data.tar.gz: c44f0b8a99668bf891432d7a1edff04eb5f8c784837e30caf1eabcad8cb82797a0f5dad14b7af318f5a6d525077ef7f99958e8d99dfd067b4933025a080f920c
@@ -0,0 +1,38 @@
1
+ require 'cocoapods-hbh/helpers/git_depend'
2
+
3
+ module Pod
4
+ class Command
5
+ class Hbh < Command
6
+ class Install < Hbh
7
+ include Pod
8
+
9
+ self.summary = 'pod install 拦截器,DSL加载到原始Podfile文件中。'
10
+
11
+ self.description = <<-DESC
12
+ pod install 拦截器
13
+ 会通过DSL加载到原始Podfile文件中
14
+ 支持 pod 'xxx' 各种写法
15
+ 支持 post_install/pre_install钩子,采用覆盖做法
16
+ DESC
17
+ def self.options
18
+ [
19
+ ['--repo-update', 'Force running `pod repo update` before install'],
20
+ ['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
21
+ ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
22
+ 'applies to projects that have enabled incremental installation']
23
+ ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
24
+ end
25
+
26
+ def initialize(argv)
27
+ @update = argv.flag?('update')
28
+ super
29
+ @additional_args = argv.remainder!
30
+ end
31
+
32
+ def run
33
+ super.run
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-hbh/command/sub_module/add_submodule'
3
+
4
+
5
+ module Pod
6
+ class Podfile
7
+ # TREAT_DEVELOPMENTS_AS_NORMAL = 'treat_developments_as_normal'.freeze
8
+ include Pod::Podfile::DSL
9
+ module DSL
10
+ def pod_git(name = nil, *requirements)
11
+ unless name
12
+ raise StandardError, 'A dependency requires a name.'
13
+ end
14
+ add_sub_module = AddSubModule.new(@current_target_definition)
15
+ add_sub_module.pod_moudle(name, *requirements)
16
+ # current_target_definition.store_pod(name, *requirements)
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,41 @@
1
+ require 'cocoapods-hbh/config/config'
2
+
3
+ module Pod
4
+ class Command
5
+ class Repo < Command
6
+ class Push < Repo
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
+ def initialize(argv)
11
+ super
12
+ hbh_specs_env = HBHConfig.config.hbh_specs_env
13
+
14
+ @podspec = find_podspec if @podspec.blank?
15
+
16
+ # specification = Specification.from_file(@podspec)
17
+
18
+ @source_urls = [
19
+ "http://gitlab.jiehun.tech/App/iOS/Modularization/HBHSpecs",
20
+ "'https://github.com/CocoaPods/Specs.git'"] if @source_urls.blank?
21
+
22
+ @allow_warnings = true
23
+ end
24
+ #Dir.glob 可替代
25
+ def find_podspec
26
+ name = nil
27
+ Pathname.pwd.children.each do |child|
28
+ if File.file?(child)
29
+ if child.extname == ".podspec"
30
+ name = File.basename(child)
31
+ return name
32
+ end
33
+ end
34
+ end
35
+ return name
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1 @@
1
+ pod repo push HBHSpecs HBHNetwork.podspec --sources='http://gitlab.jiehun.tech/App/iOS/Modularization/HBHSpecs.git,https://github.com/CocoaPods/Specs' --allow-warnings
@@ -0,0 +1,48 @@
1
+ require 'cocoapods-hbh/command/common/install'
2
+ require 'cocoapods-hbh/command/common/podfile'
3
+ require 'cocoapods-hbh/command/common/push'
4
+
5
+ module Pod
6
+ class Command
7
+ # This is an example of a cocoapods plugin adding a top-level subcommand
8
+ # to the 'pod' command.
9
+ #
10
+ # You can also create subcommands of existing or new commands. Say you
11
+ # wanted to add a subcommand to `list` to show newly deprecated pods,
12
+ # (e.g. `pod list deprecated`), there are a few things that would need
13
+ # to change.
14
+ #
15
+ # - move this file to `lib/pod/command/list/deprecated.rb` and update
16
+ # the class to exist in the the Pod::Command::List namespace
17
+ # - change this class to extend from `List` instead of `Command`. This
18
+ # tells the plugin system that it is a subcommand of `list`.
19
+ # - edit `lib/cocoapods_plugins.rb` to require this file
20
+ #
21
+ # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
22
+ # in the `plugins.json` file, once your plugin is released.
23
+ #
24
+ class Hbh < Command
25
+ self.summary = '婚博会组件依赖管理插件'
26
+
27
+ self.description = <<-DESC
28
+ 婚博会组件依赖管理插件
29
+ DESC
30
+
31
+ self.arguments = 'hbhCocoapods插件'
32
+
33
+ def initialize(argv)
34
+ @name = argv.shift_argument
35
+ super
36
+ end
37
+
38
+ def validate!
39
+ super
40
+ help! 'A Pod name is required.' unless @name
41
+ end
42
+
43
+ def run
44
+ UI.puts "Add your implementation for the cocoapods-hbh plugin in #{__FILE__}"
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,109 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-hbh/config/config'
3
+ require 'cocoapods/user_interface'
4
+
5
+ module Pod
6
+ class Podfile
7
+ class AddSubModule
8
+ UI = Pod::UserInterface unless defined? UI
9
+ # @return [TargetDefinition] The current target definition to which the DSL
10
+ # commands apply.
11
+ #
12
+ attr_accessor :current_target_definition
13
+
14
+ def initialize(current_target_definition)
15
+ @current_target_definition = current_target_definition
16
+ end
17
+
18
+ # 从 info map里获取key的值,如果未获取到 返回 default
19
+ def get_info(info, key, default)
20
+ if info.respond_to?("has_key?") && info.has_key?(key)
21
+ return info[key]
22
+ else
23
+ return default
24
+ end
25
+ end
26
+
27
+
28
+ # 添加模块 模块名称为podspec的名称,路径默认为Module/下的模块,tag或者branch 优先使用tag,默认develop分支
29
+ # (moduleName, submodule: true, moduleTag: nil, moduleBranch: 'develop', appspecs: nil)
30
+ def pod_moudle (moduleName, *requirements)
31
+ info = requirements.last
32
+ # git = get_info(info, :git, nil)
33
+
34
+
35
+ # if git.blank?
36
+ # hbh_git = get_info(info, :hbh_git, nil)
37
+ # if moduleName.include?('/')
38
+ # name = moduleName.split('/').first
39
+ # requirements.last[:git] = "#{remoteUrl}/#{name}.git"
40
+ # else
41
+ # requirements.last[:git] = "#{remoteUrl}/#{moduleName}.git"
42
+ # end
43
+ # requirements.last.delete(:hbh_git)
44
+ # end
45
+
46
+ is_submodule = get_info(info, :submodule, true)
47
+ if is_submodule
48
+ if info.nil? then raise "请输入正确的参数" end
49
+ return requirements unless info.is_a?(Hash)
50
+
51
+ moduleTag = get_info(info, :tag, nil)
52
+ moduleBranch = get_info(info, :branch, "develop")
53
+ appspecs = get_info(info, :appspecs, nil)
54
+ sub_config = HBHConfig.config.submodule_env
55
+ remoteUrl = sub_config['sub_url']
56
+ if remoteUrl.blank?
57
+ Pod::UI.puts "请配置subModule的sub_url".red
58
+ raise "注意: 请配置subModule的sub_url"
59
+ end
60
+ moduleRoot = sub_config['sub_path'].blank? ? "Modules" : sub_config['sub_path']
61
+
62
+ path_module = "./#{moduleRoot}/#{moduleName}"
63
+ Pod::UI.puts "#{moduleName}使用本地Pod模块".yellow
64
+ if !File.exist?("#{path_module}/#{moduleName}.podspec")
65
+ `git submodule add #{remoteUrl}#{moduleName}.git ./Modules/#{moduleName}`
66
+ Pod::UI.puts "本地没有#{moduleName}模块,正在下载中..."
67
+ # 设置主项目`git pull`操作时,子git自动执行 `git pull`
68
+ `git config submodule.recurse true`
69
+
70
+ # 设置主项目`git push`操作时,子项目自动执行 `git push`
71
+ # `git config push.recurseSubmodules on-demand`
72
+
73
+ if system "git submodule update --init --recursive"
74
+ Pod::UI.puts "#{moduleName}模块下载完成...".yellow
75
+ end
76
+ end
77
+ if moduleTag != nil and !moduleTag.empty?
78
+ `cd #{path_module} && git fetch && git checkout #{moduleTag}`
79
+ else
80
+ `cd #{path_module} && git fetch && git checkout #{moduleBranch} && git pull origin #{moduleBranch}`
81
+ end
82
+ if appspecs != nil
83
+ sub_hash = {:path => path_module, :appspecs => ['Example']}
84
+ last_index = requirements.length-1
85
+ requirements[last_index] = requirements[last_index].merge(sub_hash)
86
+ current_target_definition.store_pod moduleName, *requirements
87
+ # pod moduleName,
88
+ else
89
+ sub_hash = {:path => path_module}
90
+ last_index = requirements.length-1
91
+ requirements[last_index] = requirements[last_index].merge(sub_hash)
92
+ current_target_definition.store_pod moduleName, *requirements
93
+ # pod moduleName,
94
+ end
95
+ else
96
+ Pod::UI.puts "#{moduleName}使用远程模块".yellow
97
+ current_target_definition.store_pod moduleName, *requirements
98
+
99
+ # if moduleTag != nil
100
+ # pod moduleName, :git => "#{remoteUrl}#{moduleName}.git", :tag => moduleTag
101
+ # else
102
+ # pod moduleName, :git => "#{remoteUrl}#{moduleName}.git", :branch => moduleBranch
103
+ # end
104
+ end
105
+ end
106
+
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,9 @@
1
+ require 'cocoapods-hbh/command/hbh'
2
+
3
+ require 'cocoapods'
4
+
5
+ module CocoapodsHbhHooks
6
+ Pod::HooksManager.register('cocoapods-hbhhooks', :pre_install) do |_context, _|
7
+
8
+ end
9
+ end
@@ -0,0 +1,91 @@
1
+ require 'yaml'
2
+
3
+
4
+ module HBHConfig
5
+ class Config
6
+
7
+ def config_file
8
+ config_file_with_configuration_env(configuration_env)
9
+ end
10
+
11
+ def template_hash
12
+ {
13
+ 'configuration_env' => { description: '编译环境', default: 'dev', selection: %w[dev debug_iphoneos release_iphoneos] },
14
+ }
15
+ end
16
+
17
+ def configuration_env
18
+ #如果是dev 再去 podfile的配置文件中获取,确保是正确的, pod update时会用到
19
+ if @configuration_env == "dev" || @configuration_env == nil
20
+ if Pod::Config.instance.podfile
21
+ configuration_env ||= Pod::Config.instance.podfile.configuration_env
22
+ end
23
+ configuration_env ||= "dev"
24
+ @configuration_env = configuration_env
25
+ end
26
+ @configuration_env
27
+ end
28
+
29
+ def config_file
30
+ "HBHConfig.yml"
31
+ end
32
+
33
+ def set_configuration_env(env)
34
+ @configuration_env = env
35
+ end
36
+
37
+ def config_file_with_configuration_env(configuration_env)
38
+ file = config_file
39
+ if configuration_env == "release_iphoneos"
40
+ file = config_release_iphoneos_file
41
+ puts "\n====== #{configuration_env} 环境 ========"
42
+ elsif configuration_env == "debug_iphoneos"
43
+ file = config_debug_iphoneos_file
44
+ puts "\n====== #{configuration_env} 环境 ========"
45
+ elsif configuration_env == "dev"
46
+ puts "\n====== #{configuration_env} 环境 ========"
47
+ else
48
+ raise "\n===== #{configuration_env} 参数有误,请检查%w[dev debug_iphoneos release_iphoneos]===="
49
+ end
50
+ file_path = "#{Pod::Config.instance.installation_root}/#{file}"
51
+ if file_path.blank?
52
+ file_path = "#{Pod::Config.instance.home_dir}/#{file}"
53
+ end
54
+
55
+ File.expand_path(file_path)
56
+ end
57
+
58
+ def load_config
59
+ if File.exist?(config_file)
60
+ YAML.load_file(config_file)
61
+ else
62
+ default_config
63
+ end
64
+ end
65
+
66
+ def initialize
67
+
68
+ end
69
+ # https://ruby-china.org/topics/21304
70
+ def method_missing(method, *args, &block)
71
+ if config.respond_to?(method)
72
+ config.send(method, *args)
73
+ elsif template_hash.keys.include?(method.to_s)
74
+ raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
75
+ else
76
+ super
77
+ end
78
+ end
79
+
80
+ def config
81
+ @config ||= begin
82
+ puts "====== cocoapods-hbh #{CocoapodsHbh::VERSION} 版本 ======== \n"
83
+ @config = OpenStruct.new load_config
84
+ @config
85
+ end
86
+ end
87
+ end
88
+ def self.config
89
+ @config ||= Config.new
90
+ end
91
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsHbh
2
+ VERSION = "0.0.1"
3
+ end
File without changes
@@ -0,0 +1 @@
1
+ require 'cocoapods-hbh/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-hbh/command'
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-hbh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - zanju
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: parallel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cocoapods
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: 自定义的cocoapod-hbh插件
70
+ email:
71
+ - zanju@jiehun.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - lib/cocoapods-hbh.rb
77
+ - lib/cocoapods-hbh/command.rb
78
+ - lib/cocoapods-hbh/command/common/install.rb
79
+ - lib/cocoapods-hbh/command/common/podfile.rb
80
+ - lib/cocoapods-hbh/command/common/push.rb
81
+ - lib/cocoapods-hbh/command/custom/pod_push.rb
82
+ - lib/cocoapods-hbh/command/hbh.rb
83
+ - lib/cocoapods-hbh/command/sub_module/add_submodule.rb
84
+ - lib/cocoapods-hbh/config/config.rb
85
+ - lib/cocoapods-hbh/gem_version.rb
86
+ - lib/cocoapods-hbh/helpers/git_depend.rb
87
+ - lib/cocoapods_plugin.rb
88
+ homepage: https://github.com/EXAMPLE/cocoapods-hbh
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubygems_version: 3.2.22
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: A longer description of cocoapods-hbh.
111
+ test_files: []