Class: Pod::Command
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- Pod::Command
- 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/push.rb,
lib/cocoapods/command/repo.rb,
lib/cocoapods/command/spec.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/push.rb,
lib/cocoapods/command/inter_process_communication.rb
Direct Known Subclasses
IPC, Init, Install, Lib, List, Outdated, Push, Repo, Search, Setup, Spec, Update
Defined Under Namespace
Modules: Project, ProjectDirectory Classes: IPC, Init, Install, Lib, List, Outdated, Push, Repo, Search, Setup, Spec, Update
Class Method Summary collapse
- .options ⇒ Object
- .parse(argv) ⇒ Object
- .report_error(exception) ⇒ Object
- .run(argv) ⇒ Object
- .verify_git_version! ⇒ Object
Instance Method Summary collapse
-
#initialize(argv) ⇒ Command
constructor
A new instance of Command.
Methods included from Pod::Config::Mixin
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.
81 82 83 84 85 86 87 88 |
# File 'lib/cocoapods/command.rb', line 81 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
.options ⇒ Object
32 33 34 35 36 |
# File 'lib/cocoapods/command.rb', line 32 def self. [ ['--silent', 'Show nothing'], ].concat(super) end |
.parse(argv) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/cocoapods/command.rb', line 38 def self.parse(argv) command = super unless SourcesManager.master_repo_functional? || command.is_a?(Setup) || command.is_a?(Repo::Add) || ENV['SKIP_SETUP'] Setup.new(CLAide::ARGV.new([])).run end command end |
.report_error(exception) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cocoapods/command.rb', line 54 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
46 47 48 49 50 51 52 |
# File 'lib/cocoapods/command.rb', line 46 def self.run(argv) help! 'You cannot run CocoaPods as root.' if Process.uid == 0 verify_git_version! super(argv) UI.print_warnings end |
.verify_git_version! ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/cocoapods/command.rb', line 120 def self.verify_git_version! begin git_version = `git version`.strip rescue Errno::ENOENT help! 'CocoaPods requires you to have `git` installed.' end git_version = Version.new(git_version.split[2]) if git_version < Pod::Version.new('1.7.5') help! 'CocoaPods requires git version 1.7.5 or newer. Please update git.' end end |