Class: Kender::Command
- Inherits:
-
Object
show all
- Defined in:
- lib/kender/command.rb
Overview
This class abstracts the shell commands we use
Direct Known Subclasses
Brakeman, BundleAudit, ConsistencyFail, Cucumber, FactoryGirlLint, I18nVerify, Jasmine, PBDuplicates, Rdlint, Reek, Rspec, Shamus, TestUnit
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.all ⇒ Object
37
38
39
|
# File 'lib/kender/command.rb', line 37
def all
@all ||= commands.select(&:available?)
end
|
.all_names ⇒ Object
33
34
35
|
# File 'lib/kender/command.rb', line 33
def all_names
all.map(&:name)
end
|
.commands ⇒ Object
25
26
27
|
# File 'lib/kender/command.rb', line 25
def commands
@commands ||= []
end
|
.inherited(klass) ⇒ Object
29
30
31
|
# File 'lib/kender/command.rb', line 29
def inherited(klass)
commands << klass.new
end
|
Instance Method Details
#available? ⇒ Boolean
9
10
11
|
# File 'lib/kender/command.rb', line 9
def available?
abort "Command failed: #{name}, availability status undefined."
end
|
#execute ⇒ Object
13
14
15
|
# File 'lib/kender/command.rb', line 13
def execute
abort "Command failed: #{command}" unless run.success?
end
|
#name ⇒ Object
5
6
7
|
# File 'lib/kender/command.rb', line 5
def name
self.class.name.split("::").last.downcase.to_sym
end
|
#run ⇒ Object
TODO: system reload all the gems again, avoid this.
18
19
20
21
|
# File 'lib/kender/command.rb', line 18
def run
system(command)
$?
end
|