cocoapods-deintegrate 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +71 -0
- data/LICENSE +23 -0
- data/README.md +56 -0
- data/Rakefile +19 -0
- data/cocoapods_deintegrate.gemspec +21 -0
- data/lib/cocoapods_deintegrate.rb +4 -0
- data/lib/cocoapods_plugin.rb +2 -0
- data/lib/pod/command/deintegrate.rb +141 -0
- data/spec/command/deintegrate_spec.rb +16 -0
- data/spec/spec_helper.rb +29 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d93e7480d54a9d5920c8f432f10cae8fc370ec89
|
4
|
+
data.tar.gz: 0d364b937714604d1a17ccf0992e2d6a120ba9f4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86c94958c7255c9c904f02acd600e81a2ed4e955933104a3a71db1a17160e3b667339fba1865f97a809fcb081e33c29a6d08725284bc7c0f4899995c85a7c22d
|
7
|
+
data.tar.gz: 89280f7f1df0844667e9aba3234e131682d278b5f42c3b881f6ac2ba00bf3cf9ae8c47b33d5e3f763af4f414d10dfa4bc568259a7741c6a9681be1f257ed917f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-deintegrate (0.1.0)
|
5
|
+
cocoapods
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
CFPropertyList (2.2.8)
|
11
|
+
activesupport (3.2.19)
|
12
|
+
i18n (~> 0.6, >= 0.6.4)
|
13
|
+
multi_json (~> 1.0)
|
14
|
+
bacon (1.2.0)
|
15
|
+
claide (0.7.0)
|
16
|
+
cocoapods (0.34.1)
|
17
|
+
activesupport (>= 3.2.15, < 4)
|
18
|
+
claide (~> 0.7.0)
|
19
|
+
cocoapods-core (= 0.34.1)
|
20
|
+
cocoapods-downloader (~> 0.7.1)
|
21
|
+
cocoapods-plugins (~> 0.3.1)
|
22
|
+
cocoapods-trunk (~> 0.2.0)
|
23
|
+
cocoapods-try (~> 0.4.1)
|
24
|
+
colored (~> 1.2)
|
25
|
+
escape (~> 0.0.4)
|
26
|
+
json_pure (~> 1.8)
|
27
|
+
nap (~> 0.8)
|
28
|
+
open4 (~> 1.3)
|
29
|
+
xcodeproj (~> 0.19.2)
|
30
|
+
cocoapods-core (0.34.1)
|
31
|
+
activesupport (>= 3.2.15)
|
32
|
+
fuzzy_match (~> 2.0.4)
|
33
|
+
json_pure (~> 1.8)
|
34
|
+
nap (~> 0.8.0)
|
35
|
+
cocoapods-downloader (0.7.1)
|
36
|
+
cocoapods-plugins (0.3.1)
|
37
|
+
nap
|
38
|
+
cocoapods-trunk (0.2.0)
|
39
|
+
json_pure (~> 1.8)
|
40
|
+
nap (>= 0.8)
|
41
|
+
netrc
|
42
|
+
cocoapods-try (0.4.1)
|
43
|
+
colored (1.2)
|
44
|
+
escape (0.0.4)
|
45
|
+
fuzzy_match (2.0.4)
|
46
|
+
i18n (0.6.11)
|
47
|
+
json_pure (1.8.1)
|
48
|
+
metaclass (0.0.4)
|
49
|
+
mocha (1.1.0)
|
50
|
+
metaclass (~> 0.0.1)
|
51
|
+
mocha-on-bacon (0.2.2)
|
52
|
+
mocha (>= 0.13.0)
|
53
|
+
multi_json (1.10.1)
|
54
|
+
nap (0.8.0)
|
55
|
+
netrc (0.7.7)
|
56
|
+
open4 (1.3.4)
|
57
|
+
rake (10.3.2)
|
58
|
+
xcodeproj (0.19.2)
|
59
|
+
CFPropertyList (~> 2.2)
|
60
|
+
activesupport (~> 3.0)
|
61
|
+
colored (~> 1.2)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bacon
|
68
|
+
cocoapods-deintegrate!
|
69
|
+
mocha
|
70
|
+
mocha-on-bacon
|
71
|
+
rake
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2014 Kyle Fuller <inbox@kylefuller.co.uk>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# cocoapods-deintegrate
|
2
|
+
|
3
|
+
A CocoaPods plugin to remove and deintegrate CocoaPods from your project.
|
4
|
+
Removing all traces of CocoaPods from an Xcode project.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```bash
|
9
|
+
$ gem install cocoapods-deintegrate
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Running `pod deintegrate` will deintegrate your Xcode project from
|
15
|
+
CocoaPods. Before running you should ensure you have a backup of your project.
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ pod deintegrate
|
19
|
+
Deintegrating Palaver.xcodeproj
|
20
|
+
Deintegrating target Palaver
|
21
|
+
Deleted 1 'Copy Pods Resources' build phases.
|
22
|
+
Deleted 1 'Check Pods Manifest.lock' build phases.
|
23
|
+
Removing Pod libraries from build phase:
|
24
|
+
- libPods-Palaver.a
|
25
|
+
Deleting Pod file references from project
|
26
|
+
- libPods-Palaver.a
|
27
|
+
- libPods-PalaverTests.a
|
28
|
+
- Pods-Palaver.debug.xcconfig
|
29
|
+
- Pods-Palaver.release.xcconfig
|
30
|
+
- Pods-Palaver.ad hoc.xcconfig
|
31
|
+
- Pods-PalaverTests.debug.xcconfig
|
32
|
+
- Pods-PalaverTests.release.xcconfig
|
33
|
+
- Pods-PalaverTests.ad hoc.xcconfig
|
34
|
+
Deleted 1 `Pod` groups from project.
|
35
|
+
Deintegrating target PalaverTests
|
36
|
+
Deleted 1 'Copy Pods Resources' build phases.
|
37
|
+
Deleted 1 'Check Pods Manifest.lock' build phases.
|
38
|
+
|
39
|
+
Project has been deintegrated. No traces of CocoaPods left in project.
|
40
|
+
Note: The workspace referencing the Pods project still remains.
|
41
|
+
```
|
42
|
+
|
43
|
+
The only things that will remains are as follows:
|
44
|
+
|
45
|
+
- Podfile, Podfile.lock
|
46
|
+
- Workspace
|
47
|
+
|
48
|
+
### Credits
|
49
|
+
|
50
|
+
This CocoaPods plugin was created by [Kyle Fuller](http://kylefuller.co.uk/)
|
51
|
+
([@kylefuller](https://twitter.com/kylefuller)).
|
52
|
+
|
53
|
+
### License
|
54
|
+
|
55
|
+
cocoapods-deintegrate is released under the MIT license. See [LICENSE](LICENSE).
|
56
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
|
3
|
+
task :default => :spec
|
4
|
+
|
5
|
+
task :spec do
|
6
|
+
title 'Running Specs'
|
7
|
+
files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
|
8
|
+
sh "bundle exec bacon #{files}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def title(title)
|
12
|
+
cyan_title = "\033[0;36m#{title}\033[0m"
|
13
|
+
puts
|
14
|
+
puts '-' * 80
|
15
|
+
puts cyan_title
|
16
|
+
puts '-' * 80
|
17
|
+
puts
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_deintegrate.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-deintegrate'
|
8
|
+
spec.version = CocoapodsDeintegrate::VERSION
|
9
|
+
spec.authors = ['Kyle Fuller']
|
10
|
+
spec.email = ['inbox@kylefuller.co.uk']
|
11
|
+
spec.summary = 'A CocoaPods plugin to remove and de-intergrate CocoaPods from your project.'
|
12
|
+
spec.homepage = 'https://github.com/kylef/cocoapods-deintergrate'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.test_files = spec.files.grep(%r{^spec/})
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
spec.add_dependency 'cocoapods'
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,141 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Deintegrate < Command
|
4
|
+
self.summary = 'Deintegrate CocoaPods from your project.'
|
5
|
+
self.description = <<-DESC
|
6
|
+
Deintegrate your project from CocoaPods. Removing all traces
|
7
|
+
of CocoaPods from your Xcode project.
|
8
|
+
|
9
|
+
If no xcodeproj is specified, then a search for an Xcode project
|
10
|
+
will be made in the current directory.
|
11
|
+
DESC
|
12
|
+
self.arguments = [
|
13
|
+
CLAide::Argument.new('XCODE_PROJECT', false)
|
14
|
+
]
|
15
|
+
|
16
|
+
def initialize(argv)
|
17
|
+
path = argv.shift_argument()
|
18
|
+
@project_path = Pathname.new(path) if path
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate!
|
23
|
+
super
|
24
|
+
|
25
|
+
unless @project_path
|
26
|
+
xcodeprojs = Pathname.glob('*.xcodeproj')
|
27
|
+
@project_path = xcodeprojs.first if xcodeprojs.size == 1
|
28
|
+
end
|
29
|
+
|
30
|
+
help! 'A valid Xcode project file is required.' unless @project_path
|
31
|
+
help! "#{@project_path} does not exist." unless @project_path.exist?
|
32
|
+
help! "#{@project_path} is not a valid Xcode project." unless @project_path.directory? && (@project_path + 'project.pbxproj').exist?
|
33
|
+
end
|
34
|
+
|
35
|
+
def run
|
36
|
+
# We don't traverse a Podfile and try to de-intergrate each target.
|
37
|
+
# Instead, we're just deintegrating anything CP could have done to a
|
38
|
+
# project. This is so that it will clean stale, and modified projects.
|
39
|
+
|
40
|
+
UI.puts("Deintegrating #{@project_path.basename}".green)
|
41
|
+
|
42
|
+
project = Xcodeproj::Project.open(@project_path)
|
43
|
+
deintegrate_project(project)
|
44
|
+
project.save()
|
45
|
+
|
46
|
+
pods_directory = Pathname.new('Pods')
|
47
|
+
if pods_directory.exist?
|
48
|
+
UI.puts('Removing `Pods/` directory.')
|
49
|
+
pods_directory.rmtree()
|
50
|
+
end
|
51
|
+
|
52
|
+
UI.puts('')
|
53
|
+
UI.puts('Project has been deintegrated. No traces of CocoaPods left in project.'.green)
|
54
|
+
UI.puts('Note: The workspace referencing the Pods project still remains.')
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def deintegrate_project(project)
|
60
|
+
project.targets.each do |target|
|
61
|
+
UI.section("Deintegrating target #{target.name}") do
|
62
|
+
deintegrate_target(target)
|
63
|
+
end
|
64
|
+
|
65
|
+
delete_pods_file_references(project)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def delete_pods_file_references(project)
|
70
|
+
# The following implementation goes for files and empty groups so it
|
71
|
+
# should catch cases where a user has changed the structure manually.
|
72
|
+
|
73
|
+
groups = project.main_group.recursive_children_groups
|
74
|
+
groups << project.main_group
|
75
|
+
|
76
|
+
pod_files = groups.map do |group|
|
77
|
+
group.files.select do |obj|
|
78
|
+
obj.name =~ /^Pods.*\.xcconfig$/i or obj.path =~ /^libPods.*\.a$/i
|
79
|
+
end
|
80
|
+
end.flatten
|
81
|
+
|
82
|
+
unless pod_files.empty?
|
83
|
+
UI.puts('Deleting Pod file references from project')
|
84
|
+
|
85
|
+
pod_files.each do |file_reference|
|
86
|
+
UI.puts("- #{file_reference.name || file_reference.path}")
|
87
|
+
file_reference.remove_from_project
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Delete empty `Pods` directory if exists
|
92
|
+
pod_groups = project.main_group.recursive_children_groups.select do |group|
|
93
|
+
group.name == 'Pods' && group.children.empty?
|
94
|
+
end
|
95
|
+
|
96
|
+
unless pod_groups.empty?
|
97
|
+
pod_groups.each(&:remove_from_project)
|
98
|
+
UI.puts "Deleted #{pod_groups.count} `Pod` groups from project."
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def deintegrate_target(target)
|
103
|
+
deintegrate_shell_script_phase(target, 'Copy Pods Resources')
|
104
|
+
deintegrate_shell_script_phase(target, 'Check Pods Manifest.lock')
|
105
|
+
deintegrate_pods_libraries(target)
|
106
|
+
end
|
107
|
+
|
108
|
+
def deintegrate_pods_libraries(target)
|
109
|
+
frameworks_build_phase = target.frameworks_build_phase
|
110
|
+
|
111
|
+
pods_build_files = frameworks_build_phase.files.select do |build_file|
|
112
|
+
build_file.display_name =~ /^libPods.*\.a$/i
|
113
|
+
end
|
114
|
+
|
115
|
+
unless pods_build_files.empty?
|
116
|
+
UI.puts('Removing Pod libraries from build phase:')
|
117
|
+
|
118
|
+
pods_build_files.each do |build_file|
|
119
|
+
UI.puts("- #{build_file.display_name}")
|
120
|
+
frameworks_build_phase.remove_build_file(build_file)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def deintegrate_shell_script_phase(target, phase_name)
|
126
|
+
phases = target.shell_script_build_phases.select do |phase|
|
127
|
+
phase.name == phase_name
|
128
|
+
end
|
129
|
+
|
130
|
+
unless phases.empty?
|
131
|
+
phases.each do |phase|
|
132
|
+
target.build_phases.delete(phase)
|
133
|
+
end
|
134
|
+
|
135
|
+
UI.puts("Deleted #{phases.count} '#{phase_name}' build phases.")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Deintegrate do
|
5
|
+
describe 'CLAide' do
|
6
|
+
it 'registers it self' do
|
7
|
+
Command.parse(['deintegrate']).should.be.instance_of Command::Deintegrate
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
before do
|
12
|
+
@command = Command.parse(['deintegrate'])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
2
|
+
$:.unshift((ROOT + 'lib').to_s)
|
3
|
+
|
4
|
+
require 'cocoapods'
|
5
|
+
require 'cocoapods_plugin'
|
6
|
+
|
7
|
+
require 'mocha'
|
8
|
+
require 'mocha-on-bacon'
|
9
|
+
|
10
|
+
module Pod
|
11
|
+
module UI
|
12
|
+
@output = ''
|
13
|
+
@warnings = ''
|
14
|
+
|
15
|
+
class << self
|
16
|
+
attr_accessor :output
|
17
|
+
attr_accessor :warnings
|
18
|
+
|
19
|
+
def puts(message = '')
|
20
|
+
@output << "#{message}\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
def warn(message = '', _actions = [])
|
24
|
+
@warnings << "#{message}\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-deintegrate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyle Fuller
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods
|
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
|
+
description:
|
28
|
+
email:
|
29
|
+
- inbox@kylefuller.co.uk
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- cocoapods_deintegrate.gemspec
|
41
|
+
- lib/cocoapods_deintegrate.rb
|
42
|
+
- lib/cocoapods_plugin.rb
|
43
|
+
- lib/pod/command/deintegrate.rb
|
44
|
+
- spec/command/deintegrate_spec.rb
|
45
|
+
- spec/spec_helper.rb
|
46
|
+
homepage: https://github.com/kylef/cocoapods-deintergrate
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata: {}
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.0.14
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: A CocoaPods plugin to remove and de-intergrate CocoaPods from your project.
|
70
|
+
test_files:
|
71
|
+
- spec/command/deintegrate_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
has_rdoc:
|