Class: Pod::Command::Repopush
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Repopush
- Extended by:
- Executable
- Defined in:
- lib/cocoapods-RepoPush/command/RepoPush.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
Instance Method Summary collapse
-
#initialize(argv) ⇒ Repopush
constructor
A new instance of Repopush.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Repopush
Returns a new instance of Repopush.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/cocoapods-RepoPush/command/RepoPush.rb', line 61 def initialize(argv) @quick = argv.flag?('quick') @allow_warnings = argv.flag?('allow-warnings') @local_only = argv.flag?('local-only') @repo = argv.shift_argument @source = source_for_repo @source_urls = argv.option('sources', config.sources_manager.all.map(&:url).append(Pod::TrunkSource::TRUNK_REPO_URL).uniq.join(',')).split(',') @update_sources = argv.flag?('update-sources') @podspec = argv.shift_argument @use_frameworks = !argv.flag?('use-libraries') @use_modular_headers = argv.flag?('use-modular-headers', false) @private = argv.flag?('private', true) = argv.option('commit-message') = argv.flag?('commit-message', false) @use_json = argv.flag?('use-json') @swift_version = argv.option('swift-version', nil) @skip_import_validation = argv.flag?('skip-import-validation', false) @skip_tests = argv.flag?('skip-tests', false) @allow_overwrite = argv.flag?('overwrite', true) super end |
Class Method Details
.options ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cocoapods-RepoPush/command/RepoPush.rb', line 39 def self. [ ['--quick', 'Lint skips checks that would require to download and build the spec'], ['--allow-warnings', 'Allows pushing even if there are warnings'], ['--use-libraries', 'Linter uses static libraries to install the spec'], ['--use-modular-headers', 'Lint uses modular headers during installation'], ["--sources=#{Pod::TrunkSource::TRUNK_REPO_URL}", 'The sources from which to pull dependent pods ' \ '(defaults to all available repos). Multiple sources must be comma-delimited'], ['--local-only', 'Does not perform the step of pushing REPO to its remote'], ['--no-private', 'Lint includes checks that apply only to public repos'], ['--skip-import-validation', 'Lint skips validating that the pod can be imported'], ['--skip-tests', 'Lint skips building and running tests during validation'], ['--commit-message="Fix bug in pod"', 'Add custom commit message. Opens default editor if no commit ' \ 'message is specified'], ['--use-json', 'Convert the podspec to JSON before pushing it to the repo'], ['--swift-version=VERSION', 'The `SWIFT_VERSION` that should be used when linting the spec. ' \ 'This takes precedence over the Swift versions specified by the spec or a `.swift-version` file'], ['--no-overwrite', 'Disallow pushing that would overwrite an existing spec'], ['--update-sources', 'Make sure sources are up-to-date before a push'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/cocoapods-RepoPush/command/RepoPush.rb', line 93 def run open_editor if && .nil? check_if_push_allowed update_sources if @update_sources validate_podspec_files check_repo_status update_repo add_specs_to_repo push_repo unless @local_only end |
#validate! ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'lib/cocoapods-RepoPush/command/RepoPush.rb', line 83 def validate! super help! 'A spec-repo name or url is required.' unless @repo unless @source && @source.repo.directory? raise Informative, "Unable to find the `#{@repo}` repo. " \ 'If it has not yet been cloned, add it via `pod repo add`.' end end |