forked from CocoaPods/CocoaPods
/
install.rb
50 lines (44 loc) · 1.6 KB
/
install.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module Pod
class Command
class Install < Command
def self.banner
%{Installing dependencies of a project:
$ pod install [PROJECT]
Downloads all dependencies defined in `Podfile' and creates an Xcode
Pods library project in `./Pods'.
In case `PROJECT' is given, it configures it to use the specified Pods
and generates a workspace with the Pods project and `PROJECT'. (It is
important that once you have run this you open the workspace instead of
`PROJECT'.) You usually specify `PROJECT' only the first time that you
run `pod install'.
}
end
def self.options
" --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading\n" +
" --no-update Skip running `pod repo update` before install\n" +
super
end
def initialize(argv)
config.clean = !argv.option('--no-clean')
@update_repo = !argv.option('--no-update')
@projpath = argv.shift_argument
config.source_root = Pathname.new(@projpath) if @projpath
super unless argv.empty?
end
def run
unless podfile = config.rootspec
raise Informative, "No `Podfile' found in the current working directory."
end
if @projpath && !File.exist?(@projpath)
raise Informative, "The specified project `#{@projpath}' does not exist."
end
if @update_repo
Repo.new(ARGV.new(["update"])).run
end
installer = Installer.new(podfile)
installer.install!
installer.configure_project(@projpath) if @projpath
end
end
end
end