Class: GitHub::Command
Defined Under Namespace
Classes: Shell
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #die(message) ⇒ Object
- #git(*command) ⇒ Object
- #git_exec(*command) ⇒ Object
- #helper ⇒ Object
-
#initialize(block) ⇒ Command
constructor
A new instance of Command.
- #options ⇒ Object
- #pgit(*command) ⇒ Object
- #sh(*command) ⇒ Object
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() puts "=> #{}" 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 |
#helper ⇒ Object
24 25 26 |
# File 'lib/github/command.rb', line 24 def helper @helper ||= Helper.new end |
#pgit(*command) ⇒ Object
32 33 34 |
# File 'lib/github/command.rb', line 32 def pgit(*command) puts git(*command) end |