Class: Pod::Command::Xccache
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Xccache
- Defined in:
- lib/cocoapods-xccache/command/xccache.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) ⇒ Xccache
constructor
A new instance of Xccache.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Xccache
Returns a new instance of Xccache.
41 42 43 44 45 46 47 |
# File 'lib/cocoapods-xccache/command/xccache.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/xccache.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 |
# File 'lib/cocoapods-xccache/command/xccache.rb', line 54 def run UI.puts "[XCCACHE/I] 开始执行pod xccache 流程:" Zabel.zabel_post({}) end |
#validate! ⇒ Object
49 50 51 52 |
# File 'lib/cocoapods-xccache/command/xccache.rb', line 49 def validate! super #help! 'A Pod name is required.' unless @name end |