Class: MGit::CloneCommand
Instance Method Summary
collapse
Methods inherited from Command
execute, instance_each, list, register_alias, register_command
Methods included from Output
#perror, #pinfo, #ptable, #pwarn
Instance Method Details
#arity ⇒ Object
11
12
13
|
# File 'lib/mgit/commands/clone.rb', line 11
def arity
[1, nil]
end
|
#description ⇒ Object
19
20
21
|
# File 'lib/mgit/commands/clone.rb', line 19
def description
'clone repository and add to mgit'
end
|
#execute(args) ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/mgit/commands/clone.rb', line 3
def execute(args)
log = `git clone #{args.join(' ')}`
raise GitError.new('Clone command failed.') if $?.exitstatus != 0
m = /Cloning into '(.*)'/.match(log.split("\n").first)
Command.execute('add', [m[1]])
end
|
#usage ⇒ Object
15
16
17
|
# File 'lib/mgit/commands/clone.rb', line 15
def usage
'clone [options] <url> [<directory>]'
end
|