Class: Moron::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/moron/command.rb

Defined Under Namespace

Classes: Options, ShellError, UsageError

Constant Summary collapse

COMMANDS_RE =
/^(git-(?:receive|upload)-pack) '(.*)'$/o
SSH_COMMAND =
'SSH_ORIGINAL_COMMAND'

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Command

Returns a new instance of Command.



13
14
15
16
# File 'lib/moron/command.rb', line 13

def initialize(*args)
  parse_args(*args)
  parse_ssh_original_command
end

Instance Method Details

#command_lineObject



28
29
30
# File 'lib/moron/command.rb', line 28

def command_line
  [@command, full_path]
end

#full_pathObject



24
25
26
# File 'lib/moron/command.rb', line 24

def full_path
  @options.chroot ? File.join(@options.chroot, @path) : @path
end

#runObject



18
19
20
21
22
# File 'lib/moron/command.rb', line 18

def run
  create_git_archive(full_path) if git_archive_needed?(full_path)
  exec *command_line
  STDERR.puts "Exec sucked!"
end