Class: Pod::Command

Inherits:
CLAide::Command
  • Object
show all
Includes:
Pod::Config::Mixin
Defined in:
lib/cocoapods/command.rb,
lib/cocoapods/command/lib.rb,
lib/cocoapods/command/init.rb,
lib/cocoapods/command/list.rb,
lib/cocoapods/command/repo.rb,
lib/cocoapods/command/spec.rb,
lib/cocoapods/command/cache.rb,
lib/cocoapods/command/setup.rb,
lib/cocoapods/command/search.rb,
lib/cocoapods/command/project.rb,
lib/cocoapods/command/outdated.rb,
lib/cocoapods/command/repo/add.rb,
lib/cocoapods/command/spec/cat.rb,
lib/cocoapods/command/repo/lint.rb,
lib/cocoapods/command/repo/list.rb,
lib/cocoapods/command/repo/push.rb,
lib/cocoapods/command/spec/edit.rb,
lib/cocoapods/command/spec/lint.rb,
lib/cocoapods/command/cache/list.rb,
lib/cocoapods/command/spec/which.rb,
lib/cocoapods/command/cache/clean.rb,
lib/cocoapods/command/repo/remove.rb,
lib/cocoapods/command/repo/update.rb,
lib/cocoapods/command/spec/create.rb,
lib/cocoapods/command/inter_process_communication.rb

Direct Known Subclasses

Cache, IPC, Init, Install, Lib, List, Outdated, Repo, Search, Setup, Spec, Update

Defined Under Namespace

Modules: Project, ProjectDirectory Classes: Cache, IPC, Init, Install, Lib, List, Outdated, Repo, Search, Setup, Spec, Update

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Command

TODO:

If a command is run inside another one some settings which where true might return false.

TODO:

We should probably not even load colored unless needed.

TODO:

Move silent flag to CLAide.

Note:

It is important that the commands don’t override the default settings if their flag is missing (i.e. their value is nil)

Returns a new instance of Command.



80
81
82
83
84
85
86
87
# File 'lib/cocoapods/command.rb', line 80

def initialize(argv)
  super
  config.silent = argv.flag?('silent', config.silent)
  config.verbose = self.verbose? unless verbose.nil?
  unless self.ansi_output?
    String.send(:define_method, :colorize) { |string, _| string }
  end
end

Class Method Details

.optionsObject



38
39
40
41
42
# File 'lib/cocoapods/command.rb', line 38

def self.options
  [
    ['--silent',   'Show nothing'],
  ].concat(super)
end

.report_error(exception) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cocoapods/command.rb', line 53

def self.report_error(exception)
  case exception
  when Interrupt
    puts '[!] Cancelled'.red
    Config.instance.verbose? ? raise : exit(1)
  when SystemExit
    raise
  else
    if ENV['COCOA_PODS_ENV'] != 'development'
      puts UI::ErrorReport.report(exception)
      exit 1
    else
      raise exception
    end
  end
end

.run(argv) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/cocoapods/command.rb', line 44

def self.run(argv)
  help! 'You cannot run CocoaPods as root.' if Process.uid == 0
  verify_xcode_license_approved!

  super(argv)
ensure
  UI.print_warnings
end

Instance Method Details

#ensure_master_spec_repo_exists!void

This method returns an undefined value.

Ensure that the master spec repo exists



93
94
95
96
97
# File 'lib/cocoapods/command.rb', line 93

def ensure_master_spec_repo_exists!
  unless SourcesManager.master_repo_functional?
    Setup.new(CLAide::ARGV.new([])).run
  end
end