Class: BiblioTech::CommandRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/bibliotech/command_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#generatorObject (readonly)

Returns the value of attribute generator.



4
5
6
# File 'lib/bibliotech/command_runner.rb', line 4

def generator
  @generator
end

#shellObject

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