Class: Pod::Command::Install

Inherits:
Pod::Command show all
Defined in:
lib/cocoapods/command/install.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command

parse, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Install

Returns a new instance of Install.



22
23
24
25
26
27
28
29
# File 'lib/cocoapods/command/install.rb', line 22

def initialize(argv)
  config.clean = !argv.option('--no-clean')
  projpath = argv.shift_argument
  projpath =~ /\.xcodeproj\/?$/ ? @projpath = projpath : podspec = projpath
  @podspec = Pathname.new(podspec) if podspec
  @projpath ||= argv.shift_argument
  super unless argv.empty?
end

Class Method Details



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cocoapods/command/install.rb', line 4

def self.banner
%{Installing dependencies of a pod spec:

    $ pod install [NAME] [PROJECT]

Downloads all dependencies of the specified podspec file `NAME',
creates an Xcode Pods library project in `./Pods', and sets up `PROJECT' 
to use the specified pods (if `PROJECT' is given). In case `NAME' is
omitted it defaults to either `Podfile' or `*.podspec' in the current
working directory.
}
end

.optionsObject



17
18
19
20
# File 'lib/cocoapods/command/install.rb', line 17

def self.options
  "    --no-clean  Leave SCM dirs like `.git' and `.svn' in tact after downloading\n" +
  super
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cocoapods/command/install.rb', line 31

def run
  spec = nil
  if @podspec
    if @podspec.exist?
      spec = Specification.from_file(@podspec)
    else
      raise Informative, "The specified podspec `#{@podspec}' doesn't exist."
    end
  else
    unless spec = config.rootspec
      raise Informative, "No `Podfile' or `.podspec' file found in the current working directory."
    end
  end
  installer = Installer.new(spec)
  installer.install!
  installer.configure_project(@projpath) if @projpath
end