The documents is broken? #238

Closed
aereal opened this Issue Sep 29, 2012 · 1 comment

Comments

Projects
None yet
2 participants

aereal commented Sep 29, 2012

In lib/hub/commands.rb:L12-,

  1. The Hub class is initialized:

    hub = Hub.new('clone', 'rtomayko/tilt')

but fail to initialize the Hub class because Hub is a Module.

There are sentences such as:

  1. The method representing the git subcommand is executed with the full args:

    Commands.clone('clone', 'rtomayko/tilt')

but fail to run this and raise ArgumentError: wrong number of arguments (2 for 1) error.

I try to extend hub clone and learn hub's commands execution.

Please tell me actual information about hub's implementation or my misunderstanding.

@mislav mislav closed this in 71f78b4 Sep 29, 2012

Member

mislav commented Sep 29, 2012

Hey, thanks for pointing me to outdated documentation. I've updated the false statements.

The Hub::Runner gets initialized, not Hub.new. The Commands.clone method (and all similar methods) accept a single argument which is an array of all arguments. Note that this array is an instance of Args.

To learn how Hub works, you only need to read how Runner works and then study Commands.run method. It's not a lot of code. Most of the tricky code deals with parsing out global git flags and handling help page scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment