Class: Pod::Command::Bin
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Bin
- Includes:
- CBin::SourcesHelper, CBin::SpecFilesHelper
- Defined in:
- lib/cocoapods-tdf-bin/command/bin.rb,
lib/cocoapods-tdf-bin/command/bin/auto.rb,
lib/cocoapods-tdf-bin/command/bin/code.rb,
lib/cocoapods-tdf-bin/command/bin/init.rb,
lib/cocoapods-tdf-bin/command/bin/batch.rb,
lib/cocoapods-tdf-bin/command/bin/archive.rb,
lib/cocoapods-tdf-bin/command/bin/lib/lint.rb,
lib/cocoapods-tdf-bin/command/bin/spec/push.rb,
lib/cocoapods-tdf-bin/command/bin/repo/update.rb,
lib/cocoapods-tdf-bin/command/bin/spec/create.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
Defined Under Namespace
Classes: Archive, Auto, Batch, Code, Init, Lib, Repo, Spec
Instance Method Summary collapse
-
#initialize(argv) ⇒ Bin
constructor
A new instance of Bin.
- #validate! ⇒ Object
Methods included from CBin::SpecFilesHelper
#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files
Methods included from CBin::SourcesHelper
#binary_source, #code_source, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(argv) ⇒ Bin
Returns a new instance of Bin.
38 39 40 41 42 43 |
# File 'lib/cocoapods-tdf-bin/command/bin.rb', line 38 def initialize(argv) require 'cocoapods-tdf-bin/native' @help = argv.flag?('help') super end |
Instance Method Details
#validate! ⇒ Object
45 46 47 48 49 50 |
# File 'lib/cocoapods-tdf-bin/command/bin.rb', line 45 def validate! super # 这里由于 --help 是在 validate! 方法中提取的,会导致 --help 失效 # pod lib create 也有这个问题 if @help end |