Class: GitHub::Command
- Inherits:
-
Object
- Object
- GitHub::Command
- Defined in:
- lib/github/command.rb
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.
16 17 18 |
# File 'lib/github/command.rb', line 16 def initialize(block) (class << self;self end).send :define_method, :command, &block end |
Instance Method Details
#call(*args) ⇒ Object
20 21 22 23 24 |
# File 'lib/github/command.rb', line 20 def call(*args) arity = method(:command).arity args << nil while args.size < arity send :command, *args end |
#die(message) ⇒ Object
50 51 52 53 |
# File 'lib/github/command.rb', line 50 def die() puts "=> #{message}" exit! end |
#git(*command) ⇒ Object
38 39 40 |
# File 'lib/github/command.rb', line 38 def git(*command) sh ['git', command].flatten.join(' ') end |
#git_exec(*command) ⇒ Object
42 43 44 |
# File 'lib/github/command.rb', line 42 def git_exec(*command) exec ['git', command].flatten.join(' ') end |
#helper ⇒ Object
26 27 28 |
# File 'lib/github/command.rb', line 26 def helper @helper ||= Helper.new end |
#options ⇒ Object
30 31 32 |
# File 'lib/github/command.rb', line 30 def GitHub. end |
#pgit(*command) ⇒ Object
34 35 36 |
# File 'lib/github/command.rb', line 34 def pgit(*command) puts git(*command) end |
#sh(*command) ⇒ Object
46 47 48 |
# File 'lib/github/command.rb', line 46 def sh(*command) Shell.new(*command).run end |