cocoapods-depend 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 +7 -0
- data/.gitignore +36 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_cocoapods.yml +121 -0
- data/.rubocop_todo.yml +12 -0
- data/Gemfile +19 -0
- data/LICENSE +22 -0
- data/README.md +26 -0
- data/Rakefile +8 -0
- data/cocoapods_depend.gemspec +24 -0
- data/install.sh +4 -0
- data/lib/cocoapods_depend.rb +7 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/converter.rb +31 -0
- data/lib/pod/command/depend/add.rb +106 -0
- data/lib/pod/command/depend/list.rb +54 -0
- data/lib/pod/command/depend/remove.rb +56 -0
- data/lib/pod/command/depend.rb +16 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f62d1e2ed6781919fd56c20928ffff4d2a0d104
|
4
|
+
data.tar.gz: dc478e4c1e89ef12997834f1f3e0de4c6e607814
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 19a74c3e79dbc05cadfddd1860a0c83de613c48d1e62b9cd0a65a9208823378ab44f3ed8b039e35582a0586eba1ac32a9f6eb37eb48a47d032ff8f9ca5477f38
|
7
|
+
data.tar.gz: f615384acda61388b59fa628c9330a9d41a0ff8094dc25c87ac80cc2b29f00f849cbbe5dbeccfc4e992ff0a22510533cd6452e3a7b0a07d900903ab053a7ad02
|
data/.gitignore
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
.DS_Store
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalisation:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
# Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- ./Rakefile
|
4
|
+
- ./Gemfile
|
5
|
+
- ./*.gemspec
|
6
|
+
Exclude:
|
7
|
+
- ./spec/fixtures/**/*
|
8
|
+
- ./vendor/bundle/**/*
|
9
|
+
|
10
|
+
# At the moment not ready to be used
|
11
|
+
# https://github.com/bbatsov/rubocop/issues/947
|
12
|
+
Documentation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
#- CocoaPods -----------------------------------------------------------------#
|
16
|
+
|
17
|
+
# We adopted raise instead of fail.
|
18
|
+
SignalException:
|
19
|
+
EnforcedStyle: only_raise
|
20
|
+
|
21
|
+
# They are idiomatic
|
22
|
+
AssignmentInCondition:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# Allow backticks
|
26
|
+
AsciiComments:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Indentation clarifies logic branches in implementations
|
30
|
+
IfUnlessModifier:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
# No enforced convention here.
|
34
|
+
SingleLineBlockParams:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# We only add the comment when needed.
|
38
|
+
Encoding:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# Having these make it easier to *not* forget to add one when adding a new
|
42
|
+
# value and you can simply copy the previous line.
|
43
|
+
TrailingComma:
|
44
|
+
EnforcedStyleForMultiline: comma
|
45
|
+
|
46
|
+
Style/MultilineOperationIndentation:
|
47
|
+
EnforcedStyle: indented
|
48
|
+
|
49
|
+
# Clashes with CLAide Command#validate!
|
50
|
+
GuardClause:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
# Not always desirable: lib/claide/command/plugins_helper.rb:12:15
|
54
|
+
Next:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
# Arbitrary max lengths for classes simply do not work and enabling this will
|
58
|
+
# lead to a never ending stream of annoyance and changes.
|
59
|
+
Metrics/ClassLength:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
# Arbitrary max lengths for modules simply do not work and enabling this will
|
63
|
+
# lead to a never ending stream of annoyance and changes.
|
64
|
+
Metrics/ModuleLength:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Arbitrary max lengths for methods simply do not work and enabling this will
|
68
|
+
# lead to a never ending stream of annoyance and changes.
|
69
|
+
Metrics/MethodLength:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# No enforced convention here.
|
73
|
+
Metrics/BlockNesting:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
77
|
+
# rules for us.
|
78
|
+
Metrics/AbcSize:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
82
|
+
# rules for us.
|
83
|
+
Metrics/CyclomaticComplexity:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
|
87
|
+
|
88
|
+
HashSyntax:
|
89
|
+
EnforcedStyle: hash_rockets
|
90
|
+
|
91
|
+
Lambda:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
DotPosition:
|
95
|
+
EnforcedStyle: trailing
|
96
|
+
|
97
|
+
EachWithObject:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Style/SpecialGlobalVars:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
#- CocoaPods specs -----------------------------------------------------------#
|
104
|
+
|
105
|
+
# Allow for `should.match /regexp/`.
|
106
|
+
AmbiguousRegexpLiteral:
|
107
|
+
Exclude:
|
108
|
+
- spec/**/*
|
109
|
+
|
110
|
+
# Allow `object.should == object` syntax.
|
111
|
+
Void:
|
112
|
+
Exclude:
|
113
|
+
- spec/**/*
|
114
|
+
|
115
|
+
ClassAndModuleChildren:
|
116
|
+
Exclude:
|
117
|
+
- spec/**/*
|
118
|
+
|
119
|
+
UselessComparison:
|
120
|
+
Exclude:
|
121
|
+
- spec/**/*
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2015-08-14 22:12:21 -0700 using RuboCop version 0.33.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 20
|
10
|
+
# Configuration parameters: AllowURI, URISchemes.
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 108
|
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'cocoapods', :git => 'https://github.com/CocoaPods/CocoaPods.git', :branch => 'master'
|
7
|
+
gem 'cocoapods-core', :git => 'https://github.com/CocoaPods/Core.git', :branch => 'master'
|
8
|
+
gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master'
|
9
|
+
|
10
|
+
gem 'bacon'
|
11
|
+
gem 'mocha'
|
12
|
+
gem 'mocha-on-bacon'
|
13
|
+
gem 'prettybacon'
|
14
|
+
|
15
|
+
if RUBY_VERSION >= '1.9.3'
|
16
|
+
gem 'codeclimate-test-reporter', :require => nil
|
17
|
+
gem 'rubocop'
|
18
|
+
end
|
19
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 liuyan
|
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.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Cocoapods::Depend
|
2
|
+
|
3
|
+
CocoaPods Plugin which allows to quickly manage your Podfile
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install cocoapods-depend
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Show podspec dependencies like this:
|
12
|
+
|
13
|
+
pod depend list
|
14
|
+
|
15
|
+
Add a podspec dependency like this:
|
16
|
+
|
17
|
+
pod depend add AFNetworking
|
18
|
+
|
19
|
+
Add a podspec dependency to a specific target like this:
|
20
|
+
|
21
|
+
pod depend add KIF --target=UITest
|
22
|
+
|
23
|
+
Remove a podspec dependency like this:
|
24
|
+
|
25
|
+
pod depend remove AFNetworking
|
26
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_depend.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "cocoapods-depend"
|
8
|
+
s.version = CocoapodsDepend::VERSION
|
9
|
+
s.authors = ["Candyan"]
|
10
|
+
s.email = "liuyanhp@gmail.com"
|
11
|
+
s.homepage = "https://github.com/candyan/cocoapods-depend"
|
12
|
+
s.summary = %q{CocooPods plugin which allows to quickly manage your Podfile}
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split($/)
|
16
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
s.add_development_dependency "rake", "~> 10.0"
|
22
|
+
|
23
|
+
s.required_ruby_version = '>= 2.0.0'
|
24
|
+
end
|
data/install.sh
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'pod/command/depend'
|
data/lib/converter.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'cocoapods-core'
|
2
|
+
|
3
|
+
module CocoapodsDepend
|
4
|
+
class Converter
|
5
|
+
def self.dependency_to_ruby(dependency)
|
6
|
+
base_code = "pod '#{dependency.name}'"
|
7
|
+
requirement_code = dependency.requirement.to_s
|
8
|
+
extrnal_code = dependency.external_source.to_s.gsub(/[{}]/, "").gsub(/["]/, "'")
|
9
|
+
|
10
|
+
base_code += ", '#{requirement_code}'" unless requirement_code == ">= 0"
|
11
|
+
base_code += ", #{dependency.head.to_s}" if dependency.head
|
12
|
+
base_code += ", #{extrnal_code}" unless extrnal_code.empty?
|
13
|
+
|
14
|
+
base_code
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.target_dependencies_to_ruby(target_name, dependencies)
|
18
|
+
target_code = "target '#{target_name}' do\n\n"
|
19
|
+
|
20
|
+
dependencies.each do |dependency|
|
21
|
+
target_code += "#{dependency_to_ruby(dependency)}\n"
|
22
|
+
end
|
23
|
+
|
24
|
+
target_code + "\nend"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.target_definition_to_ruby(target_definition)
|
28
|
+
target_dependencies_to_ruby(target_definition.name, target_definition.dependencies)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Depend
|
4
|
+
class Add < Depend
|
5
|
+
self.summary = "Add podspec dependency"
|
6
|
+
self.description = <<-DESC
|
7
|
+
Add a podspec dependency to all targets or a target in working Podfile.
|
8
|
+
|
9
|
+
Examples:
|
10
|
+
|
11
|
+
$ pod depend add AFNetworking
|
12
|
+
$ pod depend add AFNetworking --target=AppleWatch
|
13
|
+
$ pod depend add AFNetworking "~> 1.0.0"
|
14
|
+
$ pod depend add AFNetworking https://github.com/gowalla/AFNetworking.git --tag=1.0.0
|
15
|
+
$ pod depend add AFNetworking ~/Documents/AFNetworking
|
16
|
+
$ pod depend add JSONKit https://example.com/JSONKit.podspec
|
17
|
+
DESC
|
18
|
+
|
19
|
+
self.arguments = [
|
20
|
+
CLAide::Argument.new('NAME', true),
|
21
|
+
CLAide::Argument.new(%w(REQUIREMENT GIT-URL SPEC-URL LOCALPATH), false),
|
22
|
+
]
|
23
|
+
|
24
|
+
def self.options
|
25
|
+
[
|
26
|
+
['--target=TARGET', 'The target where you want to add the dependency'],
|
27
|
+
['--tag=TAG', 'The git tag you want to depend'],
|
28
|
+
['--commit=COMMIT', 'The git commit you want to depend'],
|
29
|
+
['--branch=BRANCH', 'The git branch you want to depend'],
|
30
|
+
].concat(super)
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(argv)
|
34
|
+
@git_tag = argv.option('tag')
|
35
|
+
@git_commit = argv.option('commit')
|
36
|
+
@git_branch = argv.option('branch')
|
37
|
+
@target = argv.option('target')
|
38
|
+
@name = argv.shift_argument
|
39
|
+
@source = argv.shift_argument
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate!
|
44
|
+
super
|
45
|
+
help! 'A Pod name is required.' unless @name
|
46
|
+
end
|
47
|
+
|
48
|
+
require 'converter'
|
49
|
+
def run
|
50
|
+
verify_podfile_exists!
|
51
|
+
|
52
|
+
podfile_path = Pathname.pwd + 'Podfile'
|
53
|
+
podfile = Podfile.from_file(podfile_path)
|
54
|
+
contents ||= File.open(podfile_path, 'r:utf-8') { |f| f.read }
|
55
|
+
|
56
|
+
dependency = Dependency.new(@name, self.requirements)
|
57
|
+
|
58
|
+
podfile.target_definitions.each do |name, definition|
|
59
|
+
if name != "Pods" && (@target == nil || @target == name)
|
60
|
+
newTargetContents = CocoapodsDepend::Converter.target_dependencies_to_ruby(definition.name, definition.dependencies.push(dependency))
|
61
|
+
contents = contents.gsub(/^target\s[\"|']#{name}[\"|'].+?end\n[\n]?/m, (newTargetContents + "\n\n"))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
podfile_path.open('w') { |f| f << contents}
|
65
|
+
end
|
66
|
+
|
67
|
+
def requirements
|
68
|
+
if not @source
|
69
|
+
requirements = nil
|
70
|
+
elsif git_url?(@source)
|
71
|
+
requirements = {:git => @source}
|
72
|
+
requirements[:tag] = @git_tag if @git_tag
|
73
|
+
requirements[:commit] = @git_commit if @git_commit
|
74
|
+
requirements[:branch] = @git_branch if @git_branch
|
75
|
+
elsif podspec_url?(@source)
|
76
|
+
requirements = {:podspec => @source}
|
77
|
+
elsif local_path?(@source)
|
78
|
+
requirements = {:path => @source}
|
79
|
+
else
|
80
|
+
requirements = @source
|
81
|
+
end
|
82
|
+
requirements
|
83
|
+
end
|
84
|
+
|
85
|
+
def http_url?(name)
|
86
|
+
prefixs = ['http://', 'https://']
|
87
|
+
prefixs.any? { |prefix| name.start_with?(prefix) }
|
88
|
+
end
|
89
|
+
|
90
|
+
def git_url?(name)
|
91
|
+
http_url?(name) && name.end_with?('.git')
|
92
|
+
end
|
93
|
+
|
94
|
+
def podspec_url?(name)
|
95
|
+
http_url?(name) && name.end_with?('.podspec')
|
96
|
+
end
|
97
|
+
|
98
|
+
def local_path?(name)
|
99
|
+
prefixs = ['/', '~/', './']
|
100
|
+
prefixs.any? { |prefix| name.start_with?(prefix) }
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Depend
|
4
|
+
class List < Depend
|
5
|
+
self.summary = "list dependencies"
|
6
|
+
|
7
|
+
self.description = <<-DESC
|
8
|
+
List all dependencies in working podfile
|
9
|
+
DESC
|
10
|
+
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
['--target=TARGET', 'list all dependencies in `TARGET`'],
|
14
|
+
].concat(super)
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(argv)
|
18
|
+
@target = argv.option('target')
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
verify_podfile_exists!
|
24
|
+
|
25
|
+
pod_file_path = Pathname.pwd + 'Podfile'
|
26
|
+
target_definitions = Podfile.from_file(Pathname.pwd + 'Podfile').target_definitions
|
27
|
+
if @target
|
28
|
+
unless target_definitions.has_key?(@target)
|
29
|
+
help! 'The target is not exist'
|
30
|
+
else
|
31
|
+
print_target_dependencies(target_definitions[@target])
|
32
|
+
end
|
33
|
+
else
|
34
|
+
target_definitions.each do |name, definition|
|
35
|
+
unless name == 'Pods'
|
36
|
+
print_target_dependencies(definition)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def print_target_dependencies(target_definition)
|
43
|
+
UI.title "Target #{target_definition.name}" do
|
44
|
+
target_definition.dependencies.each do |dependency|
|
45
|
+
UI.puts "- #{dependency.to_s}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
UI.puts "\n"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Depend
|
4
|
+
class Remove < Depend
|
5
|
+
self.summary = "Remove podspec dependency"
|
6
|
+
self.description = <<-DESC
|
7
|
+
Remove a podspec dependency at all targets or a target in working Podfile.
|
8
|
+
|
9
|
+
Examples:
|
10
|
+
|
11
|
+
$ pod depend remove AFNetworking
|
12
|
+
$ pod depend remove AFNetworking --target=AppleWatch
|
13
|
+
DESC
|
14
|
+
|
15
|
+
self.arguments = [
|
16
|
+
CLAide::Argument.new('NAME', true),
|
17
|
+
]
|
18
|
+
|
19
|
+
def self.options
|
20
|
+
[
|
21
|
+
['--target=TARGET', 'The target where you want to remove the dependency.'],
|
22
|
+
].concat(super)
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@target = argv.option('target')
|
27
|
+
@name = argv.shift_argument
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def validate!
|
32
|
+
super
|
33
|
+
help! 'A Pod name is required.' unless @name
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'converter'
|
37
|
+
def run
|
38
|
+
verify_podfile_exists!
|
39
|
+
|
40
|
+
podfile_path = Pathname.pwd + 'Podfile'
|
41
|
+
podfile = Podfile.from_file(podfile_path)
|
42
|
+
contents ||= File.open(podfile_path, 'r:utf-8') { |f| f.read }
|
43
|
+
|
44
|
+
podfile.target_definitions.each do |name, definition|
|
45
|
+
if name != "Pods" && (@target == nil || @target == name)
|
46
|
+
newTargetDependencies = definition.dependencies.delete_if { |d| d.name == @name }
|
47
|
+
newTargetContents = CocoapodsDepend::Converter.target_dependencies_to_ruby(definition.name, newTargetDependencies)
|
48
|
+
contents = contents.gsub(/^target\s[\"|']#{name}[\"|'].+?end\n[\n]?/m, (newTargetContents + "\n\n"))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
podfile_path.open('w') { |f| f << contents}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Depend < Command
|
4
|
+
self.abstract_command = true
|
5
|
+
|
6
|
+
require 'pod/command/depend/add'
|
7
|
+
require 'pod/command/depend/remove'
|
8
|
+
require 'pod/command/depend/update'
|
9
|
+
require 'pod/command/depend/list'
|
10
|
+
|
11
|
+
self.summary = 'Manage Podfile dependencies'
|
12
|
+
self.default_subcommand = 'list'
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-depend
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Candyan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-23 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
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
|
+
description:
|
42
|
+
email: liuyanhp@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- .rubocop.yml
|
49
|
+
- .rubocop_cocoapods.yml
|
50
|
+
- .rubocop_todo.yml
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- cocoapods_depend.gemspec
|
56
|
+
- install.sh
|
57
|
+
- lib/cocoapods_depend.rb
|
58
|
+
- lib/cocoapods_plugin.rb
|
59
|
+
- lib/converter.rb
|
60
|
+
- lib/pod/command/depend.rb
|
61
|
+
- lib/pod/command/depend/add.rb
|
62
|
+
- lib/pod/command/depend/list.rb
|
63
|
+
- lib/pod/command/depend/remove.rb
|
64
|
+
homepage: https://github.com/candyan/cocoapods-depend
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.0.0
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.0.14
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: CocooPods plugin which allows to quickly manage your Podfile
|
88
|
+
test_files: []
|