Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added help command. Usage pod help [COMMAND] #957

Merged
merged 4 commits into from Apr 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,9 @@
* CocoaPods now defines the deployment target of the Pods project computed as
the minimum deployment target of the Pods libraries.
[#556](https://github.com/CocoaPods/CocoaPods/issues/556)
* Added `pod help` command. You can still use the old format
with --help flag.
[#957](https://github.com/CocoaPods/CocoaPods/pull/957)

###### Bug fixes

Expand Down
1 change: 1 addition & 0 deletions lib/cocoapods/command.rb
Expand Up @@ -16,6 +16,7 @@ class Command < CLAide::Command
require 'cocoapods/command/search'
require 'cocoapods/command/setup'
require 'cocoapods/command/spec'
require 'cocoapods/command/help'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this functionality should go in CLAide directly. Not sure though, and we could move it later on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth it to create a ticket as reminder, but I’m still on the fence.

require 'cocoapods/command/inter_process_communication'

self.abstract_command = true
Expand Down
23 changes: 23 additions & 0 deletions lib/cocoapods/command/help.rb
@@ -0,0 +1,23 @@
module Pod
class Command
class Help < Command
self.summary = 'Show help for the given command.'
self.arguments = '[COMMAND]'

def initialize(argv)
@help_command = Pod::Command.parse(argv) unless argv.empty?
super
end

def run
help_command.help!
end

private

def help_command
@help_command || self
end
end
end
end
2 changes: 1 addition & 1 deletion spec/fixtures/spec-repos/master
Submodule master updated 923 files
22 changes: 22 additions & 0 deletions spec/functional/command/help_spec.rb
@@ -0,0 +1,22 @@
require File.expand_path('../../../spec_helper', __FILE__)

module Pod
describe "Command::Help" do
extend SpecHelper::Command

it "invokes the right command with --help flag" do
command = command('help', 'push')
command.send(:help_command).should.be.instance_of Pod::Command::Push
lambda { command.run }.should.raise CLAide::Help
end

it "raises help! if no other command is passed" do
lambda { command('help').run }.should.raise CLAide::Help
end

it "shows the right usage" do
Pod::Command::Help.arguments.should.equal '[COMMAND]'
end

end
end
1 change: 1 addition & 0 deletions spec/unit/command_spec.rb
Expand Up @@ -3,6 +3,7 @@
module Pod
describe Command do
it "returns the proper command class" do
Command.parse(%w{ help }).should.be.instance_of Command::Help
Command.parse(%w{ install }).should.be.instance_of Command::Install
Command.parse(%w{ list }).should.be.instance_of Command::List
Command.parse(%w{ outdated }).should.be.instance_of Command::Outdated
Expand Down
1 change: 1 addition & 0 deletions spec/unit/resolver_spec.rb
Expand Up @@ -121,6 +121,7 @@ module Pod
RestKit
RestKit/JSON
RestKit/Network
RestKit/ObjectMapping/Core
RestKit/ObjectMapping/CoreData
RestKit/ObjectMapping/JSON
RestKit/UI
Expand Down