Class: DeployMongo::DeltaProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/deploy_mongo/delta_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, delta) ⇒ DeltaProcessor

Returns a new instance of DeltaProcessor.



4
5
6
7
# File 'lib/deploy_mongo/delta_processor.rb', line 4

def initialize(config,delta)
  @delta = delta
  @config = config
end

Instance Method Details

#applyObject



9
10
11
12
13
# File 'lib/deploy_mongo/delta_processor.rb', line 9

def apply
  user_command = @delta.command.gsub("'","''")
  shell = MongoShell.new(@config.database,@config.mongo_shell_path)
  shell.execute(user_command)
end

#rollbackObject



15
16
17
18
19
# File 'lib/deploy_mongo/delta_processor.rb', line 15

def rollback
  user_rollback_command = @delta.rollback_command.gsub("'","''")
  shell = MongoShell.new(@config.database,@config.mongo_shell_path)
  shell.execute(user_rollback_command)
end