Class: GitHub::Command

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

Defined Under Namespace

Classes: Shell

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Command

Returns a new instance of Command.



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

def initialize(block)
  (class << self;self end).send :define_method, :command, &block
end

Instance Method Details

#call(*args) ⇒ Object



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

def call(*args)
  arity = method(:command).arity
  args << nil while args.size < arity
  send :command, *args
end

#die(message) ⇒ Object



48
49
50
51
# File 'lib/github/command.rb', line 48

def die(message)
  puts "=> #{message}"
  exit!
end

#git(*command) ⇒ Object



36
37
38
# File 'lib/github/command.rb', line 36

def git(*command)
  sh ['git', command].flatten.join(' ')
end

#git_exec(*command) ⇒ Object



40
41
42
# File 'lib/github/command.rb', line 40

def git_exec(*command)
  exec ['git', command].flatten.join(' ')
end

#helperObject



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

def helper
  @helper ||= Helper.new
end

#optionsObject



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

def options
  GitHub.options
end

#pgit(*command) ⇒ Object



32
33
34
# File 'lib/github/command.rb', line 32

def pgit(*command)
  puts git(*command)
end

#sh(*command) ⇒ Object



44
45
46
# File 'lib/github/command.rb', line 44

def sh(*command)
  Shell.new(*command).run
end