Class: Derrick::CLI
- Inherits:
-
Object
show all
- Defined in:
- lib/derrick/cli.rb
Defined Under Namespace
Classes: AggregateFormatter, Context, ProgressDisplay
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
98
99
100
101
|
# File 'lib/derrick/cli.rb', line 98
def initialize(args)
@context = Context.new
@command, *@arguments = parser.parse(args)
end
|
Class Method Details
.run(args) ⇒ Object
94
95
96
|
# File 'lib/derrick/cli.rb', line 94
def self.run(args)
new(args).run!
end
|
Instance Method Details
#command_inspect(database_url = nil) ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/derrick/cli.rb', line 108
def command_inspect(database_url=nil)
inspector = Derrick::Inspector.new(Redis.new(url: database_url), @context)
progress_display = ProgressDisplay.new(inspector.progress, STDERR)
progress_display.start
aggregate = inspector.report
progress_display.stop
AggregateFormatter.new(aggregate).each do |line|
puts line
end
end
|
#run! ⇒ Object
103
104
105
106
|
# File 'lib/derrick/cli.rb', line 103
def run!
abort! unless @command
public_send("command_#{@command}", *@arguments)
end
|