cocoapods-use-latest-tag 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rakeTasks +7 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +38 -0
- data/RELEASING.md +11 -0
- data/Rakefile +7 -0
- data/cocoapods-use-latest-tag.gemspec +25 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/cocoapods_use_latest_tag.rb +3 -0
- data/lib/pod/command/use_latest_tag.rb +109 -0
- data/spec/checksui_spec.rb +8 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 369e6f4241903fdcdb2b66d636ab7be61ac6cd3c
|
4
|
+
data.tar.gz: f7ca5835be8fab4090ad7f34969579145c154df7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84997240908102a5a46d450e4148b883f7a24d4cc0008fa42c5b46fa3794388f57b9015abf8bd7b5d6e95f074e4adfd68e004f643a405502f8c07ca789d64589
|
7
|
+
data.tar.gz: f98e7287e6ca21352fc46366fdbd5b1ef9a38148b9883eea2c8ce32ac5732cb4d2df2c8b9f34e464d0184ae29806cad9c6dbd006a9f90f12f1f03c7ffb5257d7
|
data/.gitignore
ADDED
data/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 田杰
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# cocoapods-use-latest-tag
|
2
|
+
|
3
|
+
cocoapods-use-latest-tag will one key to change Podfile, check and use the latest tag for this Pod. It will save your time when you want to change every Pod to use the latest tag for release your main project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install cocoapods-use-latest-tag
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
`pod use-latest-tag` will display a list of Pods that changed by this command.
|
12
|
+
|
13
|
+
$ pod use-latest-tag
|
14
|
+
~KNConvergeBill, ~SuiNetworking
|
15
|
+
[!] 2 Pods has been changed to use the latest tag. Please double check the Podfile's changes.
|
16
|
+
|
17
|
+
The symbol before each Pod name indicates the status of the Pod. A `~` indicates there is newest tag can be used. Pods that don't require an update will not be listed.
|
18
|
+
|
19
|
+
Verbose mode shows a bit more detail:
|
20
|
+
|
21
|
+
$ pod use-latest-tag --verbose
|
22
|
+
KNConvergeBill preview_branch: master -> latest_tag: 2.0.3
|
23
|
+
SuiNetworking preview_tag: 3.1.0 -> latest_tag: 3.1.3
|
24
|
+
[!] 2 Pods has been changed to use the latest tag. Please double check the Podfile's changes.
|
25
|
+
|
26
|
+
If no Pods are out of date, then the output looks like:
|
27
|
+
|
28
|
+
$ pod use-latest-tag
|
29
|
+
The Podfile's dependencies all use latest tag.
|
30
|
+
|
31
|
+
## Exit Code
|
32
|
+
|
33
|
+
If any Pods are out of date, `pod use-latest-tag` will exit with a non-zero exit code. Otherwise it will exit with an exit code of zero.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
cocoapods-use-latest-tag is under the MIT license. See the [LICENSE](LICENSE) file for details.
|
38
|
+
|
data/RELEASING.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
A checklist for releasing the Gem:
|
2
|
+
|
3
|
+
* Test: `rake`
|
4
|
+
* Bump version in lib/cocoapod_use_latest_tag.rb
|
5
|
+
* Commit
|
6
|
+
* `git tag x.y.z`
|
7
|
+
* `git push`
|
8
|
+
* `git push --tags`
|
9
|
+
* `gem build cocoapods-use-latest-tag.gemspec`
|
10
|
+
* `gem push cocoapods-use-latest-tag-x.y.z.gem`
|
11
|
+
* Create release on GitHub from tag
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_use_latest_tag.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-use-latest-tag'
|
8
|
+
spec.version = CocoapodsUseLatestTag::VERSION
|
9
|
+
spec.authors = ['htxs']
|
10
|
+
spec.email = ['gzucm_tianjie@foxmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{'use-latest-tag' plugin for CocoaPods}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/htxs/cocoapods-use-latest-tag"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
21
|
+
spec.add_development_dependency "rake", '~> 10.0'
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
|
24
|
+
spec.add_dependency 'cocoapods', '~> 1.0'
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pod/command/use_latest_tag'
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# The CocoaPods use-latest-tag command.
|
2
|
+
|
3
|
+
# The CocoaPods namespace
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class UseLatestTag < Command
|
7
|
+
self.summary = <<-SUMMARY
|
8
|
+
Try to change Podfile to use the latest tag.
|
9
|
+
SUMMARY
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
One key to change Pod to use the latest tag.
|
13
|
+
In non-verbose mode, '~' indicates the Pod has been changed to use the latest tag.
|
14
|
+
DESC
|
15
|
+
|
16
|
+
self.arguments = []
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
['--verbose', 'Show change details.']
|
21
|
+
].concat(super)
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(argv)
|
25
|
+
@check_command_verbose = argv.flag?('verbose')
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
unless config.podfile
|
31
|
+
raise Informative, 'Missing Podfile!'
|
32
|
+
end
|
33
|
+
|
34
|
+
results = change_podfile(config)
|
35
|
+
print_results(results)
|
36
|
+
end
|
37
|
+
|
38
|
+
def change_podfile(config)
|
39
|
+
target_pods = {}
|
40
|
+
config.podfile.dependencies.each do |dependency|
|
41
|
+
if dependency.external? && (dependency.external_source[:branch] != nil || dependency.external_source[:tag] != nil)
|
42
|
+
target_pods[dependency.name] = dependency.external_source.clone
|
43
|
+
end
|
44
|
+
end
|
45
|
+
target_pod_names = target_pods.keys
|
46
|
+
|
47
|
+
target_pod_names.sort.uniq.map do |spec_name|
|
48
|
+
git_path = target_pods[spec_name][:git].gsub("/", '\/')
|
49
|
+
# get latest tag for spec
|
50
|
+
latest_tag = get_latest_tag(target_pods[spec_name])
|
51
|
+
next if latest_tag.empty?
|
52
|
+
|
53
|
+
exp = ""
|
54
|
+
preview_version = ""
|
55
|
+
latest_version = "latest_tag: #{latest_tag}"
|
56
|
+
if target_pods[spec_name][:tag] != nil && target_pods[spec_name][:tag] != latest_tag
|
57
|
+
# preview use tag
|
58
|
+
exp = "/#{git_path}/s/:tag[ ]*=>[ ]*'[^']*'/:tag => '#{latest_tag}'/"
|
59
|
+
preview_version = "preview_tag: #{target_pods[spec_name][:tag]}"
|
60
|
+
elsif target_pods[spec_name][:branch] != nil
|
61
|
+
# preview use branch
|
62
|
+
exp = %(/#{git_path}/s/:branch[ ]*=>[ ]*'[^']*'/:tag => '#{latest_tag}'/)
|
63
|
+
preview_version = "preview_branch: #{target_pods[spec_name][:branch]}"
|
64
|
+
end
|
65
|
+
next if exp.empty?
|
66
|
+
|
67
|
+
# sed command
|
68
|
+
command = %(sed -i '' -E "#{exp}" Podfile)
|
69
|
+
if @check_command_verbose
|
70
|
+
UI.puts "Command: #{command}"
|
71
|
+
end
|
72
|
+
`#{command}`
|
73
|
+
|
74
|
+
# cache changed result
|
75
|
+
changed_result(spec_name, preview_version, latest_version)
|
76
|
+
end.compact
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_latest_tag(external_source)
|
80
|
+
command = "git ls-remote --tags --refs --sort='v:refname' #{external_source[:git]} | tail -n1 | sed 's/.*\\///'"
|
81
|
+
latest_tag = (`#{command}` || '').strip
|
82
|
+
if @check_command_verbose
|
83
|
+
UI.puts "Fetch latest tag for #{external_source[:git]} -> #{latest_tag}"
|
84
|
+
end
|
85
|
+
return latest_tag
|
86
|
+
end
|
87
|
+
|
88
|
+
def changed_result(spec_name, preview_version, latest_version)
|
89
|
+
if @check_command_verbose
|
90
|
+
"#{spec_name} #{preview_version} -> #{latest_version}"
|
91
|
+
else
|
92
|
+
"~#{spec_name}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def print_results(results)
|
97
|
+
return UI.puts "The Podfile's dependencies all use latest tag." if results.empty?
|
98
|
+
|
99
|
+
if @check_command_verbose
|
100
|
+
UI.puts results.join("\n")
|
101
|
+
else
|
102
|
+
UI.puts results.join(', ')
|
103
|
+
end
|
104
|
+
|
105
|
+
raise Informative, "#{results.length} Pod#{'s' if results.length > 1} has been changed to use the latest tag. Please double check the Podfile's changes."
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-use-latest-tag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- htxs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cocoapods
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
description: "'use-latest-tag' plugin for CocoaPods"
|
70
|
+
email:
|
71
|
+
- gzucm_tianjie@foxmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rakeTasks"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- RELEASING.md
|
82
|
+
- Rakefile
|
83
|
+
- cocoapods-use-latest-tag.gemspec
|
84
|
+
- lib/cocoapods_plugin.rb
|
85
|
+
- lib/cocoapods_use_latest_tag.rb
|
86
|
+
- lib/pod/command/use_latest_tag.rb
|
87
|
+
- spec/checksui_spec.rb
|
88
|
+
homepage: https://github.com/htxs/cocoapods-use-latest-tag
|
89
|
+
licenses: []
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.5.2.3
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: "'use-latest-tag' plugin for CocoaPods"
|
111
|
+
test_files:
|
112
|
+
- spec/checksui_spec.rb
|