PodfileTool 0.0.6 → 0.0.7
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 +4 -4
- data/bin/podtool +37 -1
- data/lib/PodfileTool.rb +74 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e032d7bd9792cf66272148885c94bd239955db2d
|
4
|
+
data.tar.gz: c7a80e66f19967be4f290d730ccdca284f6b795f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f09977dbca75b928ea4dd6ab6b39ac98c22d05c612a8c06aa3d8a5ab71b19f76c29c1af079351defe6ab0b7917891fc3462ef097dbdadbd3ca4d6664e1a69039
|
7
|
+
data.tar.gz: 6c0b0bc6d495cf8b077baaa8af517194684e8e55e51b974dbbeb146cb4c677a056c004503a70bfe60aaf02b3b97a5c67795f19f6cdb3bf0e97b29f611b3976da
|
data/bin/podtool
CHANGED
@@ -5,7 +5,7 @@ require 'commander/import'
|
|
5
5
|
require 'PodfileTool'
|
6
6
|
|
7
7
|
program :name, 'podtool'
|
8
|
-
program :version, '0.0.
|
8
|
+
program :version, '0.0.2'
|
9
9
|
program :description, 'pod tools set'
|
10
10
|
|
11
11
|
command :parse do |c|
|
@@ -30,6 +30,17 @@ command :share do |c|
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
command :shareall do |c|
|
34
|
+
c.syntax = 'podtool shareall [options]'
|
35
|
+
c.summary = ''
|
36
|
+
c.description = ''
|
37
|
+
c.example 'description', 'command example'
|
38
|
+
c.option '--some-switch', 'Some switch that does something'
|
39
|
+
c.action do |args, options|
|
40
|
+
PodfileTool.shareAllPodScheme(ARGV[1])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
33
44
|
command :removetarget do |c|
|
34
45
|
c.syntax = 'podtool removetarget [options]'
|
35
46
|
c.summary = ''
|
@@ -41,6 +52,31 @@ command :removetarget do |c|
|
|
41
52
|
end
|
42
53
|
end
|
43
54
|
|
55
|
+
command :removeTargetFrameSearchPath do |c|
|
56
|
+
c.syntax = 'podtool removeTargetFrameSearchPath [options]'
|
57
|
+
c.summary = ''
|
58
|
+
c.description = ''
|
59
|
+
c.example 'description', 'command example'
|
60
|
+
c.option '--some-switch', 'Some switch that does something'
|
61
|
+
c.action do |args, options|
|
62
|
+
PodfileTool.removeTarget(args[0], args[1])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
command :removePhase do |c|
|
67
|
+
c.syntax = 'podtool removetarget [options]'
|
68
|
+
c.summary = ''
|
69
|
+
c.description = ''
|
70
|
+
c.example 'description', 'command example'
|
71
|
+
c.option '--some-switch', 'Some switch that does something'
|
72
|
+
c.action do |args, options|
|
73
|
+
PodfileTool.removePhase(args[0], args[1], args[2])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
44
80
|
|
45
81
|
|
46
82
|
|
data/lib/PodfileTool.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
require 'json'
|
3
|
+
require 'xcodeproj'
|
3
4
|
require 'cocoapods-core'
|
4
5
|
|
5
6
|
class PodfileTool
|
@@ -56,7 +57,7 @@ class PodfileTool
|
|
56
57
|
# pods_project_path:(pods_project_path)
|
57
58
|
# Example3:
|
58
59
|
# >> PodfileTool.sharePodScheme("/path_of_Pod_project")
|
59
|
-
# => {
|
60
|
+
# => "Success share #{pod_name}"
|
60
61
|
#
|
61
62
|
#
|
62
63
|
def self.sharePodScheme(pods_project_path)
|
@@ -69,6 +70,32 @@ class PodfileTool
|
|
69
70
|
"Success share #{pod_name}"
|
70
71
|
end
|
71
72
|
|
73
|
+
def self.shareAllPodScheme(pods_project_path)
|
74
|
+
project = Xcodeproj::Project.open(pods_project_path)
|
75
|
+
schemes = Xcodeproj::Project.schemes(pods_project_path)
|
76
|
+
project.targets.each { |e|
|
77
|
+
if e.product_type == 'com.apple.product-type.framework' && !e.name.start_with?('Pod')
|
78
|
+
begin
|
79
|
+
Xcodeproj::XCScheme.share_scheme(project.path, e.name)
|
80
|
+
puts "Success share #{e.name}"
|
81
|
+
rescue => err
|
82
|
+
puts "Fail share #{e.name}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
}
|
86
|
+
project.save
|
87
|
+
end
|
88
|
+
|
89
|
+
#
|
90
|
+
# remove a target of project
|
91
|
+
#Arguments:
|
92
|
+
# project_path:(project_path)
|
93
|
+
# target_to_remove:(target_to_remove)
|
94
|
+
# Example4:
|
95
|
+
# >> PodfileTool.removeTarget(args[0], args[1])
|
96
|
+
# => puts "#{target.name} did remove from project!!"
|
97
|
+
#
|
98
|
+
#
|
72
99
|
def self.removeTarget(project_path, target_to_remove)
|
73
100
|
project = Xcodeproj::Project.open(project_path)
|
74
101
|
project.targets.each do |target|
|
@@ -80,4 +107,50 @@ class PodfileTool
|
|
80
107
|
end
|
81
108
|
project.save
|
82
109
|
end
|
110
|
+
#
|
111
|
+
# remove a target frame_search_path of project
|
112
|
+
#Arguments:
|
113
|
+
# project_path:(project_path)
|
114
|
+
# target_to_remove:(target_to_remove)
|
115
|
+
# frame_search_path:(frame_search_path)
|
116
|
+
# Example4:
|
117
|
+
# >> PodfileTool.removeTargetFrameSearchPath(args[0], args[1], args[1])
|
118
|
+
# => puts search_paths
|
119
|
+
#
|
120
|
+
#
|
121
|
+
def self.removeTargetFrameSearchPath(project_path, target_to_remove, frame_search_path)
|
122
|
+
project = Xcodeproj::Project.open(project_path)
|
123
|
+
project.targets.each do |target|
|
124
|
+
if target.name == target_to_remove
|
125
|
+
puts target.name
|
126
|
+
target.build_configurations.each { |configuration|
|
127
|
+
search_paths = configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= '$(inherited)'
|
128
|
+
if search_paths.is_a? Array
|
129
|
+
search_paths.delete_if { |e| e == frame_search_path}
|
130
|
+
end
|
131
|
+
puts search_paths
|
132
|
+
}
|
133
|
+
end
|
134
|
+
end
|
135
|
+
project.save
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.removePhase(project_path, target_to_remove, p_toremove)
|
139
|
+
project = Xcodeproj::Project.open(project_path)
|
140
|
+
project.targets.each do |target|
|
141
|
+
# puts target.name
|
142
|
+
if target.name == target_to_remove
|
143
|
+
# puts target.methods
|
144
|
+
target.build_phases.each do |aP|
|
145
|
+
puts aP.display_name
|
146
|
+
if aP.display_name == p_toremove
|
147
|
+
aP.remove_from_project
|
148
|
+
puts "#{target.name} #{aP} did remove"
|
149
|
+
end
|
150
|
+
project.save
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
83
156
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PodfileTool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dacaiguoguo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: output Cocoapods Podfile to Json
|
14
14
|
email: dacaiguoguo@gmail.com
|