Class: BiblioTech::CommandRunner
- Inherits:
-
Object
- Object
- BiblioTech::CommandRunner
- Defined in:
- lib/bibliotech/command_runner.rb
Instance Attribute Summary collapse
-
#generator ⇒ Object
readonly
Returns the value of attribute generator.
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
- #export(filepath) ⇒ Object
- #import(filepath) ⇒ Object
-
#initialize(config) ⇒ CommandRunner
constructor
A new instance of CommandRunner.
-
#run(command) ⇒ Object
end.
Constructor Details
#initialize(config) ⇒ CommandRunner
Returns a new instance of CommandRunner.
7 8 9 10 11 |
# File 'lib/bibliotech/command_runner.rb', line 7 def initialize(config) @config = config @generator = CommandGenerator.for(config.db_config) @shell = Caliph.new end |
Instance Attribute Details
#generator ⇒ Object (readonly)
Returns the value of attribute generator.
4 5 6 |
# File 'lib/bibliotech/command_runner.rb', line 4 def generator @generator end |
#shell ⇒ Object
Returns the value of attribute shell.
5 6 7 |
# File 'lib/bibliotech/command_runner.rb', line 5 def shell @shell end |
Instance Method Details
#export(filepath) ⇒ Object
13 14 15 |
# File 'lib/bibliotech/command_runner.rb', line 13 def export(filepath) run decorate_for_compression(generator, filepath).export(filepath) end |
#import(filepath) ⇒ Object
17 18 19 |
# File 'lib/bibliotech/command_runner.rb', line 17 def import(filepath) run decorate_for_compression(generator, filepath).import(filepath) end |
#run(command) ⇒ Object
end
26 27 28 |
# File 'lib/bibliotech/command_runner.rb', line 26 def run(command) @shell.run(command) end |