gkd_push_pod 0.1.0

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: '075821972828793145c7b7b4a268fbf5e45ca7c1ea0648a6175b3b274aeddb31'
4
+ data.tar.gz: b04a84239a7c27512447a22e49d897f9bf9cab4d4b61b850679542b098a55a30
5
+ SHA512:
6
+ metadata.gz: e518ef7699534a3b4ace14a7dbb50196d84b109bdcea76061e626f6d05285d017939cbc30e1f3e6564ff0d8b520cd15ab510e9c74d8b09d05bd0a8ac02a9f36f
7
+ data.tar.gz: 8b274dd684bf7537e8b604808e82d060eedb14e07f76b3ecd5b46637879047c38bdcc69e4899ab65bbd6ad60eff7fccf179025eeea59f21de86c8d06ecfbc904
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.6.3) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.6.3) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.6.3) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.6.3) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.6.3) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.6.3) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.6.3) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="terminal-notifier (v2.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
24
+ </component>
25
+ <component name="RakeTasksCache">
26
+ <option name="myRootTask">
27
+ <RakeTaskImpl id="rake">
28
+ <subtasks>
29
+ <RakeTaskImpl description="Build gkd_push_pod-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
30
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
31
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
32
+ <RakeTaskImpl description="Build and install gkd_push_pod-0.1.0.gem into system gems" fullCommand="install" id="install" />
33
+ <RakeTaskImpl id="install">
34
+ <subtasks>
35
+ <RakeTaskImpl description="Build and install gkd_push_pod-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
36
+ </subtasks>
37
+ </RakeTaskImpl>
38
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push gkd_push_pod-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
39
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
40
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
41
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
42
+ <RakeTaskImpl id="release">
43
+ <subtasks>
44
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
45
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
46
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
47
+ </subtasks>
48
+ </RakeTaskImpl>
49
+ </subtasks>
50
+ </RakeTaskImpl>
51
+ </option>
52
+ </component>
53
+ </module>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.3
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at yun.chen@sojex.cn. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gkd_push_pod.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 chenyun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # GkdPushPod
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gkd_push_pod`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gkd_push_pod'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gkd_push_pod
22
+
23
+ ## Usage
24
+
25
+ 1.cd .podspec所在目录
26
+
27
+ 2.gkd_push_pod -v 版本号 -m 提交信息
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gkd_push_pod. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/gkd_push_pod/blob/master/CODE_OF_CONDUCT.md).
38
+
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
43
+
44
+ ## Code of Conduct
45
+
46
+ Everyone interacting in the GkdPushPod project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gkd_push_pod/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gkd_push_pod"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/gkd_push_pod ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # lib = File.expand_path("../../lib", __FILE__)
4
+ # $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+
7
+ require 'gkd_push_pod'
8
+ require 'optparse'
9
+
10
+ options = {}
11
+ option_parser = OptionParser.new do |opts|
12
+
13
+ opts.banner = 'here is help messages of the command line tool for \'pod_updater\''
14
+
15
+ options[:version] = nil
16
+ opts.on('-v', '--version [version]', String, 'the podspec\'s new version') do |version|
17
+ options[:version] = version
18
+ end
19
+
20
+ options[:cp_path] = nil
21
+ opts.on('-c', '--cp_path [cp_path]', String, 'the path where the podspec file need to copy') do |cp_path|
22
+ options[:cp_path] = cp_path
23
+ end
24
+
25
+ options[:message] = nil
26
+ opts.on('-m', '--message [message]', String, 'the message to descrie your pod for this version') do |message|
27
+ options[:message] = message
28
+ end
29
+
30
+ end.parse!
31
+
32
+ unless options[:version]
33
+
34
+ abort("ABORTED! You forgot pass a version value with command \'-v [version]\'")
35
+ exit
36
+ end
37
+
38
+ GkdPushPod.run(options[:version], options[:cp_path], options[:message])
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ require_relative 'lib/gkd_push_pod/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "gkd_push_pod"
5
+ spec.version = GkdPushPod::VERSION
6
+ spec.authors = ["chenyun"]
7
+ spec.email = ["yun.chen@sojex.cn"]
8
+
9
+ spec.summary = "自动推送私有库"
10
+ spec.description = "自动推送私有库"
11
+ spec.homepage = "http://gitlab.sojex.net/iOSClient/GKDPushPod"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "http://gitlab.sojex.net/iOSClient/GKDPushPod"
18
+ spec.metadata["changelog_uri"] = "http://gitlab.sojex.net/iOSClient/GKDPushPod"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "bin"
26
+ spec.executables = ["gkd_push_pod"]
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_runtime_dependency "colorize"
30
+ spec.add_runtime_dependency "terminal-notifier"
31
+
32
+ spec.add_development_dependency "bundler", "~> 2.1.4"
33
+ spec.add_development_dependency "rake", "~> 10.0"
34
+
35
+ end
@@ -0,0 +1,41 @@
1
+ require "fileutils"
2
+ require 'gkd_push_pod/ui'
3
+
4
+ module GkdPushPod
5
+
6
+ module_function
7
+ # desc:将podspec文件拷贝到备份的文件目录
8
+ def copy_podspec(from_path, distination, pod_version)
9
+
10
+ return unless distination
11
+
12
+ unless File.exist?(distination)
13
+ UI.msg("cp_path:#{distination}不存在,请提供正确的路径:")
14
+ distination = gets.to_s.chomp
15
+ copy_podspec(from_path, distination, pod_version)
16
+ return
17
+ end
18
+ unless File.directory?(distination)
19
+ UI.msg("cp_path:#{distination}不是目录,请提供正确的路径")
20
+ distination = gets.to_s.chomp
21
+ copy_podspec(from_path, distination, pod_version)
22
+ return
23
+ end
24
+
25
+ pod_name = File.basename(from_path, '.podspec')
26
+ destination_path = destination_path_from(distination, pod_name, pod_version)
27
+
28
+ unless destination_path
29
+ UI.err('无法计算出正确的copy路径,podspec文件复制失败')
30
+ else
31
+ FileUtils.cp(from_path, destination_path)
32
+ end
33
+
34
+ end
35
+
36
+ # desc:负责对cp路径进行检查修正,保证目的路径是包含了以库名为名称的目录,并且在下面新建一个对应版本的文件夹
37
+ def destination_path_from(to_path, pod_name, pod_version)
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,38 @@
1
+ require 'gkd_push_pod/ui'
2
+
3
+ module GkdPushPod
4
+
5
+ # 提供路径,然后将项目打包上git,标记tag
6
+ def git_tag_flow(path,msg,tag_version)
7
+
8
+ cmd = []
9
+
10
+ cmd << %(cd #{path})
11
+ cmd << 'git add .'
12
+ cmd << %(git commit -m "#{msg}")
13
+ cmd << 'git push'
14
+
15
+ UI.log_cmd(cmd)
16
+ IO.popen(cmd.join(" && ")) do |io|
17
+ io.each do |line|
18
+ UI.msg line
19
+ end
20
+ io.close
21
+ end
22
+
23
+ tag_cmd = []
24
+ tag_cmd << %(git tag -f #{tag_version} -m "#{msg}")
25
+ tag_cmd << 'git push --tags -f'
26
+
27
+ UI.log_cmd(tag_cmd)
28
+ IO.popen(tag_cmd.join(" && ")) do |io|
29
+ io.each do |line|
30
+ UI.msg line
31
+ end
32
+ io.close
33
+ end
34
+
35
+ end
36
+
37
+ module_function :git_tag_flow
38
+ end
@@ -0,0 +1,83 @@
1
+ require 'gkd_push_pod/ui'
2
+
3
+ module GkdPushPod
4
+
5
+ # 修改podspec的s.verison的值
6
+ def modifyPodspec(path:"",version:"0.0.0")
7
+
8
+ if version == "0.0.0"
9
+ UI.msg "请指定版本好的值,如 modifyPodspec version:#{version}"
10
+ return
11
+ end
12
+ unless version =~ /^\d{1,}.\d.\d$|^\d{1,}.\d$|^\d{1,}$/
13
+ UI.msg "version:#{version}的格式不对"
14
+ return 
15
+ end
16
+ unless File.exist?path
17
+ UI.err "路径不存在"
18
+ return
19
+ end
20
+
21
+ UI.msg "***修改podspec文件***"
22
+ File.open(path, "r+") do |f|
23
+ s = ""
24
+ f.each_line do |line|
25
+ # puts "#{line}"
26
+ if line.to_s =~ /[s|spec]\.version\s*=\s*["|'](\d{1,}.\d{1,}.\d{1,})["|']/
27
+ line = line.sub(/\d{1,}.\d{1,}.\d{1,}/) do |match|
28
+ version.to_s
29
+ end
30
+ end
31
+ s += line
32
+ end
33
+ UI.msg "#{s}"
34
+ File.open(path, "w+") do |f| f.write(s) end
35
+ end
36
+
37
+ end
38
+
39
+ # 找到指定路径下的podspec文件名
40
+ def pathWithPodspecSuffix(path)
41
+
42
+ path = File.expand_path(path)
43
+ return nil unless File.exist?(path)
44
+
45
+ unless path =~ /.podspec$/
46
+
47
+ if File.directory?(path)
48
+ podfiles = Dir.glob("#{path}/*.podspec")
49
+
50
+ if podfiles.length == 0
51
+ UI.err %(#{path} 路径下无法找到'.podspec'文件)
52
+ return nil
53
+ elsif podfiles.length == 1
54
+ path = podfiles.first
55
+ else
56
+ UI.msg "目录下找到多个podspec文件!"
57
+ podfiles.each_with_index do |elem, index|
58
+ basename = File.basename(elem)
59
+ puts %(#{index}.#{basename} )
60
+ end
61
+ UI.msg "请指定您当前需要的操作的文件,输入它的序号:"
62
+ i = gets.to_i
63
+
64
+ case i
65
+ when 0 .. (podfiles.length-1)
66
+ path = podfiles[i.to_i]
67
+ else
68
+ UI.err "输入错误❌"
69
+ path = nil
70
+ end
71
+
72
+ end
73
+ end
74
+ end
75
+
76
+ path
77
+
78
+ end
79
+
80
+ module_function :pathWithPodspecSuffix
81
+ module_function :modifyPodspec
82
+
83
+ end
@@ -0,0 +1,73 @@
1
+ require 'gkd_push_pod/git_tag_flow'
2
+ require 'gkd_push_pod/modify_podspec'
3
+ require 'gkd_push_pod/ui'
4
+ require 'gkd_push_pod/cp_podspec'
5
+ require 'gkd_push_pod/pod_updater_file'
6
+
7
+ module GkdPushPod
8
+
9
+ # 给定pod库项目的路径,以及新版pod库的版本,将自己的pod提交到git,然后打上tag,再push trunk到pod服务器去,如果cp_path存在则将最后的podspec文件拷贝到cp_path下
10
+ def pushPodToSevice(path, version, cp_path, message)
11
+
12
+ # 在路径中找到.podspec文件
13
+ podFilePath = pathWithPodspecSuffix(path)
14
+
15
+ unless podFilePath
16
+ return # 未找到相应的podspec文件
17
+ end
18
+
19
+ # pod lib lint 检查
20
+ lib_cmd = %(pod lib lint #{podFilePath} --allow-warnings --skip-import-validation --sources='http://gitlab.sojex.net/iOSClient/GKDSpecs.git,https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git')
21
+ output = ""
22
+ UI.log_cmd(lib_cmd)
23
+ IO.popen(lib_cmd) do |io|
24
+ io.each do |line|
25
+ UI.msg(line)
26
+ output += line.to_s
27
+ end
28
+ end
29
+
30
+ if output =~ %r(ERROR|error)
31
+ UI.err("pod lib lint 发生错误")
32
+ return
33
+ end
34
+
35
+ msg = "for pod version:#{version} #{message}"
36
+
37
+ modifyPodspec(path:podFilePath,version:version) #将podspec文件的版本号进行修改
38
+
39
+ if cp_path
40
+ copy_podspec(podFilePath, cp_path,version)
41
+ end
42
+
43
+ pod_updater_file = PodUpdaterFile.new(File.dirname(podFilePath))
44
+ if pod_updater_file.paths
45
+ pod_updater_file.paths.each_with_index do |elem, index|
46
+ copy_podspec(podFilePath,elem.to_s, version)
47
+ end
48
+ end
49
+
50
+ git_tag_flow(path,msg,version)
51
+
52
+ cmd = []
53
+ cmd << %(pod repo push sojex-iosclient-gkdspecs #{podFilePath} --use-libraries --allow-warnings --skip-import-validation --sources='http://gitlab.sojex.net/iOSClient/GKDSpecs.git,https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git')
54
+ push_cmd_output = ""
55
+ UI.log_cmd(cmd)
56
+ IO.popen(cmd.join('')) do |io|
57
+ io.each do |line|
58
+ UI.msg(line)
59
+ push_cmd_output += line.to_s
60
+ end
61
+ end
62
+
63
+ if push_cmd_output =~ %r(ERROR|error)
64
+ UI.err("pod lib lint push 发生错误")
65
+ else
66
+ UI.notification(title: "上传完成✅")
67
+ end
68
+
69
+ end
70
+
71
+ module_function :pushPodToSevice
72
+
73
+ end
@@ -0,0 +1,72 @@
1
+ require 'gkd_push_pod/ui'
2
+
3
+ module GkdPushPod
4
+
5
+ class PodUpdaterFile
6
+ attr_accessor :paths
7
+
8
+ def initialize(path)
9
+ _path = File.expand_path(path)
10
+ return nil unless File.exist?(_path)
11
+
12
+ pod_updater_path = PodUpdaterFile.find_podupdater_file_path(_path)
13
+ if pod_updater_path
14
+ self.paths = PodUpdaterFile.parser_podupdater_file(pod_updater_path)
15
+ end
16
+ end
17
+
18
+ def self.find_podupdater_file_path(path)
19
+ _path = File.expand_path(path)
20
+ return nil unless File.exist?(_path)
21
+
22
+ pod_updater_path = _path
23
+ unless _path =~ /\/podUpdater$/
24
+ if File.directory?(_path)
25
+ pod_updater_paths = Dir.glob("#{_path}/podUpdater")
26
+ if pod_updater_paths.length == 0
27
+ pod_updater_path = nil
28
+ elsif pod_updater_paths.length == 1
29
+ pod_updater_path = pod_updater_paths.first
30
+ else
31
+ UI.msg "目录下找到多个podUpdater文件!"
32
+ pod_updater_paths.each_with_index do |elem, index|
33
+ basename = File.basename(elem)
34
+ UI.msg %(#{index}.#{basename} )
35
+ end
36
+ puts "请指定您当前需要的操作的文件,输入它的序号:"
37
+ i = gets.to_i
38
+ case i
39
+ when 0 .. (podfiles.length-1)
40
+ pod_updater_path = podfiles[i.to_i]
41
+ else
42
+ UI.err "输入错误❌"
43
+ pod_updater_path = nil
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ pod_updater_path
50
+ end
51
+
52
+ def self.parser_podupdater_file(filePath)
53
+ if !filePath || !(filePath =~ /\/podUpdater$/)
54
+ return nil
55
+ end
56
+
57
+ paths = []
58
+ File.open(filePath, "r") do |f|
59
+ f.each_line do |line|
60
+ if line.to_s =~ /["']path["']\s*,\s*["'](.*)["']/
61
+ paths << $1.to_s
62
+ end
63
+ end
64
+ end
65
+
66
+ paths
67
+ end
68
+
69
+
70
+ end
71
+
72
+ end
@@ -0,0 +1,39 @@
1
+ require 'colorize'
2
+
3
+ module GkdPushPod
4
+
5
+ class UI
6
+ def self.err(msg)
7
+ puts msg.colorize(:red)
8
+ self.notification(title: 'pod_updater get error', message: msg)
9
+ end
10
+
11
+ def self.success(msg)
12
+ puts msg.colorize(:green)
13
+ end
14
+
15
+ def self.msg(msg)
16
+ puts msg.colorize(:green)
17
+ end
18
+
19
+ def self.warning(msg)
20
+ puts msg.colorize(:yellow)
21
+ end
22
+
23
+ def self.log_cmd(msg)
24
+ if msg.kind_of?(Array)
25
+ msg = msg.join(' && ')
26
+ end
27
+ puts msg.to_s.colorize(:blue)
28
+ end
29
+
30
+ def self.notification(title: "", message: "", **args)
31
+ `terminal-notifier -title '#{title}' -message '#{message}' -activate 'com.apple.Terminal'`
32
+ end
33
+
34
+ def self.notification_openurl(title: "", message: "", url: "", **args)
35
+ `terminal-notifier -title '#{title}' -message '#{message}' -open '#{url}'`
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,3 @@
1
+ module GkdPushPod
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,9 @@
1
+ require "gkd_push_pod/version"
2
+ require "gkd_push_pod/pod_push"
3
+
4
+ module GkdPushPod
5
+ def self.run(version, cp_path, message)
6
+ path = File.expand_path(Dir.pwd)
7
+ pushPodToSevice(path, version, cp_path, message)
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gkd_push_pod
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - chenyun
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-03-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
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: terminal-notifier
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: 2.1.4
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.1.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: 自动推送私有库
70
+ email:
71
+ - yun.chen@sojex.cn
72
+ executables:
73
+ - gkd_push_pod
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".idea/gkd_push_pod.iml"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - CODE_OF_CONDUCT.md
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/gkd_push_pod
87
+ - bin/setup
88
+ - gkd_push_pod.gemspec
89
+ - lib/gkd_push_pod.rb
90
+ - lib/gkd_push_pod/cp_podspec.rb
91
+ - lib/gkd_push_pod/git_tag_flow.rb
92
+ - lib/gkd_push_pod/modify_podspec.rb
93
+ - lib/gkd_push_pod/pod_push.rb
94
+ - lib/gkd_push_pod/pod_updater_file.rb
95
+ - lib/gkd_push_pod/ui.rb
96
+ - lib/gkd_push_pod/version.rb
97
+ homepage: http://gitlab.sojex.net/iOSClient/GKDPushPod
98
+ licenses:
99
+ - MIT
100
+ metadata:
101
+ homepage_uri: http://gitlab.sojex.net/iOSClient/GKDPushPod
102
+ source_code_uri: http://gitlab.sojex.net/iOSClient/GKDPushPod
103
+ changelog_uri: http://gitlab.sojex.net/iOSClient/GKDPushPod
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 2.3.0
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubygems_version: 3.0.9
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: 自动推送私有库
123
+ test_files: []