Class: Pod::Command::Xcprepare
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Xcprepare
- Defined in:
- lib/cocoapods-xccache/command/xcprepare.rb
Overview
Create a PR to add your plugin to CocoaPods/cocoapods.org in the ‘plugins.json` file, once your plugin is released.
This is an example of a cocoapods plugin adding a top-level subcommand to the ‘pod’ command.
You can also create subcommands of existing or new commands. Say you wanted to add a subcommand to ‘list` to show newly deprecated pods, (e.g. `pod list deprecated`), there are a few things that would need to change.
-
move this file to ‘lib/pod/command/list/deprecated.rb` and update the class to exist in the the Pod::Command::List namespace
-
change this class to extend from ‘List` instead of `Command`. This tells the plugin system that it is a subcommand of `list`.
-
edit ‘lib/cocoapods_plugins.rb` to require this file
Class Method Summary collapse
-
.options ⇒ Object
可选参数.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Xcprepare
constructor
A new instance of Xcprepare.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Xcprepare
Returns a new instance of Xcprepare.
41 42 43 44 45 46 47 |
# File 'lib/cocoapods-xccache/command/xcprepare.rb', line 41 def initialize(argv) #puts "xccache 初始化参数 #{argv.to_s}" #@name = argv.shift_argument @update = argv.flag?("update") @install = argv.flag?("install") super end |
Class Method Details
.options ⇒ Object
可选参数
34 35 36 37 38 39 |
# File 'lib/cocoapods-xccache/command/xcprepare.rb', line 34 def self. [ ['--update', 'need exec pod update'], ['--install', 'need exec pod install'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cocoapods-xccache/command/xcprepare.rb', line 54 def run UI.puts "开始进入准备阶段:" #system "bundle install" if @update UI.puts "pod update" # system "pod update" else UI.puts "pod install" # system "pod install" end end |
#validate! ⇒ Object
49 50 51 52 |
# File 'lib/cocoapods-xccache/command/xcprepare.rb', line 49 def validate! super #help! 'A Pod name is required.' unless @name end |