cocoapods-modify-dependency-version 1.0.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 +7 -0
- data/.gitignore +4 -0
- data/.rakeTasks +7 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +31 -0
- data/RELEASING.md +11 -0
- data/Rakefile +7 -0
- data/cocoapods-modify-dependency-version.gemspec +25 -0
- data/lib/cocoapods_modify_dependency_version.rb +3 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/pod/command/modify_dependency_version.rb +102 -0
- data/spec/modify_dependency_version_spec.rb +8 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 979990a4070d18b98f2bc65e7220e5e3e1a32ffce4288a669c927095897910b1
|
4
|
+
data.tar.gz: ad713ee3af62bbad33712972048dbf439c62d55d32ed919c08f1d10443442d04
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4ca548427918ca013f6b64adfdd981f5b737704505c46eeffc1e4c4d80fc5fc935402947ef727e7af3b1260ce16022bfc17e2341a0d73f6016170e532eae40ab
|
7
|
+
data.tar.gz: 0e168d40458b743ad62f381aa9461af2cc44e2cae24da1ab77e5577df2fd37fd72ddb6ba25de5d237cabcef70ccdc078b8e7b71a5932b38150ed127b6cacfd93
|
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,31 @@
|
|
1
|
+
# cocoapods-modify-dependency-version
|
2
|
+
|
3
|
+
cocoapods-modify-dependency-version will try to modify specific dependency version by branch name or tag.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install cocoapods-modify-dependency-version
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
`pod modify-dependency-version` will display a list of Pods that changed by this command.
|
12
|
+
|
13
|
+
$ pod modify-dependency-version --name=SuiNetworking --branch=test
|
14
|
+
~SuiNetworking
|
15
|
+
|
16
|
+
The symbol before each Pod name indicates the status of the Pod. A `~` indicates specific dependency has been modified.
|
17
|
+
|
18
|
+
Verbose mode shows a bit more detail:
|
19
|
+
|
20
|
+
$ pod modify-dependency-version --name=SuiNetworking --branch=test --verbose
|
21
|
+
SuiNetworking current_branch: master -> modify_branch: test
|
22
|
+
|
23
|
+
If the specific dependency not in the Podfile, then the output looks like:
|
24
|
+
|
25
|
+
$ pod modify-dependency-version --name=FakeRepo --branch=test
|
26
|
+
FakeRepo not found.
|
27
|
+
|
28
|
+
## License
|
29
|
+
|
30
|
+
cocoapods-modify-dependency-version is under the MIT license. See the [LICENSE](LICENSE) file for details.
|
31
|
+
|
data/RELEASING.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
A checklist for releasing the Gem:
|
2
|
+
|
3
|
+
* Test: `rake`
|
4
|
+
* Bump version in lib/cocoapods_modify_dependency_version.rb
|
5
|
+
* Commit
|
6
|
+
* `git tag x.y.z`
|
7
|
+
* `git push`
|
8
|
+
* `git push --tags`
|
9
|
+
* `gem build cocoapods-modify-dependency-version.gemspec`
|
10
|
+
* `gem push cocoapods-modify-dependency-version-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_modify_dependency_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-modify-dependency-version'
|
8
|
+
spec.version = CocoapodsModifyDependencyVersion::VERSION
|
9
|
+
spec.authors = ['htxs']
|
10
|
+
spec.email = ['gzucm_tianjie@foxmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{'modify-dependency-version' plugin for CocoaPods}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/htxs/cocoapods-modify-dependency-version"
|
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/modify_dependency_version'
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# The CocoaPods modify-dependency-version command.
|
2
|
+
|
3
|
+
# The CocoaPods namespace
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class ModifyDependencyVersion < Command
|
7
|
+
self.summary = <<-SUMMARY
|
8
|
+
Try to modify specific dependency version by branch name or tag.
|
9
|
+
SUMMARY
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
Try to modify specific dependency version by branch name or tag.
|
13
|
+
In non-verbose mode, '~' indicates the Pod has been modified.
|
14
|
+
DESC
|
15
|
+
|
16
|
+
def self.options
|
17
|
+
[
|
18
|
+
['--verbose', 'Show change details.'],
|
19
|
+
['--name', 'dependency name'],
|
20
|
+
['--branch', 'use branch name'],
|
21
|
+
['--tag', 'use tag']
|
22
|
+
].concat(super)
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@check_command_verbose = argv.flag?('verbose')
|
27
|
+
@dependency_name = argv.option('name')
|
28
|
+
@dependency_branch = argv.option('branch')
|
29
|
+
@dependency_tag = argv.option('tag')
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
unless config.podfile
|
35
|
+
raise Informative, 'Missing Podfile!'
|
36
|
+
end
|
37
|
+
|
38
|
+
raise Informative, 'Missing dependency name!' if @dependency_name == nil
|
39
|
+
raise Informative, 'Missing branch name or tag!' if @dependency_branch == nil && @dependency_tag == nil
|
40
|
+
|
41
|
+
results = change_podfile(config)
|
42
|
+
print_results(results)
|
43
|
+
end
|
44
|
+
|
45
|
+
def change_podfile(config)
|
46
|
+
target_pods = {}
|
47
|
+
config.podfile.dependencies.each do |dependency|
|
48
|
+
if dependency.name == @dependency_name && dependency.external? && (dependency.external_source[:branch] != nil || dependency.external_source[:tag] != nil)
|
49
|
+
target_pods[dependency.name] = dependency.external_source.clone
|
50
|
+
break
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
target_pod_names = target_pods.keys
|
55
|
+
return [] if target_pod_names.empty?
|
56
|
+
|
57
|
+
target_pod_names.sort.uniq.map do |spec_name|
|
58
|
+
git_path = target_pods[spec_name][:git].gsub("/", '\/')
|
59
|
+
|
60
|
+
source_flag = target_pods[spec_name][:tag] != nil ? "tag" : "branch"
|
61
|
+
target_flag = @dependency_tag != nil ? "tag" : "branch"
|
62
|
+
source_value = target_pods[spec_name][:tag] != nil ? target_pods[spec_name][:tag] : target_pods[spec_name][:branch]
|
63
|
+
target_value = @dependency_tag != nil ? @dependency_tag : @dependency_branch
|
64
|
+
|
65
|
+
exp = "/#{git_path}/s/:#{source_flag}[ ]*=>[ ]*'[^']*'/:#{target_flag} => '#{target_value}'/"
|
66
|
+
current_version = "current_#{source_flag}: #{source_value}"
|
67
|
+
modify_version = "modify_#{target_flag}: #{target_value}"
|
68
|
+
|
69
|
+
next if exp.empty?
|
70
|
+
|
71
|
+
# sed command
|
72
|
+
command = %(sed -i '' -E "#{exp}" Podfile)
|
73
|
+
if @check_command_verbose
|
74
|
+
UI.puts "Command: #{command}"
|
75
|
+
end
|
76
|
+
`#{command}`
|
77
|
+
|
78
|
+
# cache changed result
|
79
|
+
changed_result(spec_name, current_version, modify_version)
|
80
|
+
end.compact
|
81
|
+
end
|
82
|
+
|
83
|
+
def changed_result(spec_name, current_version, modify_version)
|
84
|
+
if @check_command_verbose
|
85
|
+
"#{spec_name} #{current_version} -> #{modify_version}"
|
86
|
+
else
|
87
|
+
"~#{spec_name}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def print_results(results)
|
92
|
+
return UI.puts "#{@dependency_name} not found." if results.empty?
|
93
|
+
|
94
|
+
if @check_command_verbose
|
95
|
+
UI.puts results.join("\n")
|
96
|
+
else
|
97
|
+
UI.puts results.join(', ')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-modify-dependency-version
|
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-12-17 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: "'modify-dependency-version' 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-modify-dependency-version.gemspec
|
84
|
+
- lib/cocoapods_modify_dependency_version.rb
|
85
|
+
- lib/cocoapods_plugin.rb
|
86
|
+
- lib/pod/command/modify_dependency_version.rb
|
87
|
+
- spec/modify_dependency_version_spec.rb
|
88
|
+
homepage: https://github.com/htxs/cocoapods-modify-dependency-version
|
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
|
+
rubygems_version: 3.0.3
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: "'modify-dependency-version' plugin for CocoaPods"
|
110
|
+
test_files:
|
111
|
+
- spec/modify_dependency_version_spec.rb
|