Commit 54a496dc authored by Olivier Halligon's avatar Olivier Halligon

Migrating to new CLAide::Command#arguments syntax (see CocoaPods/CLAide#26)

parent 686af4af
...@@ -2,7 +2,9 @@ module Pod ...@@ -2,7 +2,9 @@ module Pod
class Command class Command
class Help < Command class Help < Command
self.summary = 'Show help for the given command.' self.summary = 'Show help for the given command.'
self.arguments = '[COMMAND]' self.arguments = [
['COMMAND', :optional]
]
def initialize(argv) def initialize(argv)
@help_command = Pod::Command.parse(argv) @help_command = Pod::Command.parse(argv)
......
...@@ -17,7 +17,9 @@ module Pod ...@@ -17,7 +17,9 @@ module Pod
(test targets) files which should be stored in the (test targets) files which should be stored in the
`~/.cocoapods/templates` folder. `~/.cocoapods/templates` folder.
DESC DESC
self.arguments = '[XCODEPROJ]' self.arguments = [
['XCODEPROJ', :optional]
]
def initialize(argv) def initialize(argv)
@podfile_path = Pathname.pwd + "Podfile" @podfile_path = Pathname.pwd + "Podfile"
......
...@@ -15,7 +15,9 @@ module Pod ...@@ -15,7 +15,9 @@ module Pod
self.summary = 'Converts a podspec to JSON.' self.summary = 'Converts a podspec to JSON.'
self.description = 'Converts a podspec to JSON and prints it to STDOUT.' self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
self.arguments = 'PATH' self.arguments = [
['PATH', :required]
]
def initialize(argv) def initialize(argv)
@path = argv.shift_argument @path = argv.shift_argument
...@@ -40,7 +42,9 @@ module Pod ...@@ -40,7 +42,9 @@ module Pod
self.summary = 'Converts a Podfile to YAML.' self.summary = 'Converts a Podfile to YAML.'
self.description = 'Converts a Podfile to YAML and prints it to STDOUT.' self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
self.arguments = 'PATH' self.arguments = [
['PATH', :required]
]
def initialize(argv) def initialize(argv)
@path = argv.shift_argument @path = argv.shift_argument
......
...@@ -14,7 +14,10 @@ module Pod ...@@ -14,7 +14,10 @@ module Pod
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one. If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one.
DESC DESC
self.arguments = 'NAME [TEMPLATE_URL]' self.arguments = [
['NAME', :required],
['TEMPLATE_URL', :optional]
]
def initialize(argv) def initialize(argv)
@name = argv.shift_argument @name = argv.shift_argument
......
...@@ -85,7 +85,9 @@ module Pod ...@@ -85,7 +85,9 @@ module Pod
be used to install changes to the Podfile. be used to install changes to the Podfile.
DESC DESC
self.arguments = '[POD_NAMES...]' self.arguments = [
['POD_NAMES...', :optional]
]
def initialize(argv) def initialize(argv)
@pods = argv.arguments! unless argv.arguments.empty? @pods = argv.arguments! unless argv.arguments.empty?
......
...@@ -13,7 +13,10 @@ module Pod ...@@ -13,7 +13,10 @@ module Pod
directory, and finally it pushes REPO to its remote. directory, and finally it pushes REPO to its remote.
DESC DESC
self.arguments = 'REPO [NAME.podspec]' self.arguments = [
['REPO', :required],
['NAME.podspec', :optional]
]
def self.options def self.options
[ ["--allow-warnings", "Allows pushing even if there are warnings"], [ ["--allow-warnings", "Allows pushing even if there are warnings"],
......
...@@ -17,7 +17,11 @@ module Pod ...@@ -17,7 +17,11 @@ module Pod
remote can later be referred to by `NAME`. remote can later be referred to by `NAME`.
DESC DESC
self.arguments = 'NAME URL [BRANCH]' self.arguments = [
['NAME', :required],
['URL', :required],
['BRANCH', :optional]
]
def self.options def self.options
[ [
...@@ -63,7 +67,9 @@ module Pod ...@@ -63,7 +67,9 @@ module Pod
this will update all spec-repos in `~/.cocoapods/repos`. this will update all spec-repos in `~/.cocoapods/repos`.
DESC DESC
self.arguments = '[NAME]' self.arguments = [
['NAME', :optional]
]
def initialize(argv) def initialize(argv)
@name = argv.shift_argument @name = argv.shift_argument
...@@ -86,7 +92,9 @@ module Pod ...@@ -86,7 +92,9 @@ module Pod
will lint all the spec-repos known to CocoaPods. will lint all the spec-repos known to CocoaPods.
DESC DESC
self.arguments = '[ NAME | DIRECTORY ]' self.arguments = [
['NAME | DIRECTORY', :optional]
]
def self.options def self.options
[["--only-errors", "Lint presents only the errors"]].concat(super) [["--only-errors", "Lint presents only the errors"]].concat(super)
...@@ -152,7 +160,9 @@ module Pod ...@@ -152,7 +160,9 @@ module Pod
Deletes the remote named `NAME` from the local spec-repos directory at `~/.cocoapods/repos/.` Deletes the remote named `NAME` from the local spec-repos directory at `~/.cocoapods/repos/.`
DESC DESC
self.arguments = 'NAME' self.arguments = [
['NAME', :required]
]
def initialize(argv) def initialize(argv)
@name = argv.shift_argument @name = argv.shift_argument
......
...@@ -9,7 +9,9 @@ module Pod ...@@ -9,7 +9,9 @@ module Pod
description of the pods. description of the pods.
DESC DESC
self.arguments = 'QUERY' self.arguments = [
['QUERY', :required]
]
def self.options def self.options
[ [
......
...@@ -18,7 +18,9 @@ module Pod ...@@ -18,7 +18,9 @@ module Pod
If a GitHub url is passed the spec is prepopulated. If a GitHub url is passed the spec is prepopulated.
DESC DESC
self.arguments = '[ NAME | https://github.com/USER/REPO ]' self.arguments = [
['NAME | https://github.com/USER/REPO', :optional]
]
def initialize(argv) def initialize(argv)
@name_or_url, @url = argv.shift_argument, argv.shift_argument @name_or_url, @url = argv.shift_argument, argv.shift_argument
...@@ -56,7 +58,9 @@ module Pod ...@@ -56,7 +58,9 @@ module Pod
the argument is omitted, it defaults to the current working dir. the argument is omitted, it defaults to the current working dir.
DESC DESC
self.arguments = '[ NAME.podspec | DIRECTORY | http://PATH/NAME.podspec, ... ]' self.arguments = [
['NAME.podspec | DIRECTORY | http://PATH/NAME.podspec, ...', :optional]
]
def self.options def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"], [ ["--quick", "Lint skips checks that would require to download and build the spec"],
...@@ -148,7 +152,9 @@ module Pod ...@@ -148,7 +152,9 @@ module Pod
Prints the path of 'NAME.podspec' Prints the path of 'NAME.podspec'
DESC DESC
self.arguments = '[ NAME ]' self.arguments = [
['NAME', :optional]
]
def self.options def self.options
[["--show-all", "Print all versions of the given podspec"]].concat(super) [["--show-all", "Print all versions of the given podspec"]].concat(super)
...@@ -180,7 +186,9 @@ module Pod ...@@ -180,7 +186,9 @@ module Pod
Prints 'NAME.podspec' to standard output. Prints 'NAME.podspec' to standard output.
DESC DESC
self.arguments = '[ NAME ]' self.arguments = [
['NAME', :optional]
]
def self.options def self.options
[["--show-all", "Pick from all versions of the given podspec"]].concat(super) [["--show-all", "Pick from all versions of the given podspec"]].concat(super)
...@@ -220,7 +228,9 @@ module Pod ...@@ -220,7 +228,9 @@ module Pod
Opens 'NAME.podspec' to be edited. Opens 'NAME.podspec' to be edited.
DESC DESC
self.arguments = '[ NAME ]' self.arguments = [
['NAME', :optional]
]
def self.options def self.options
[["--show-all", "Pick which spec to edit from all available versions of the given podspec"]].concat(super) [["--show-all", "Pick which spec to edit from all available versions of the given podspec"]].concat(super)
......
...@@ -15,7 +15,7 @@ module Pod ...@@ -15,7 +15,7 @@ module Pod
end end
it "shows the right usage" do it "shows the right usage" do
Pod::Command::Help.arguments.should.equal '[COMMAND]' Pod::Command::Help.arguments.should.equal [['COMMAND', :optional]]
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment