Class: MongoDbUtils::Tools::Restore
- Defined in:
- lib/mongo-db-utils/tools/commands.rb
Class Method Summary collapse
- .cmd(host_and_port, db, source_folder, username = "", password = "") ⇒ Object
- .run(host_and_port, db, source_folder, username = "", password = "") ⇒ Object
Class Method Details
.cmd(host_and_port, db, source_folder, username = "", password = "") ⇒ Object
59 60 61 62 63 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 59 def self.cmd(host_and_port,db,source_folder,username = "", password = "") = (host_and_port,db,username,password) params = () << " --drop #{source_folder}" "mongorestore #{params}" end |
.run(host_and_port, db, source_folder, username = "", password = "") ⇒ Object
65 66 67 68 69 70 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 65 def self.run(host_and_port,db,source_folder,username="", password ="") cmd_string = self.cmd(host_and_port,db,source_folder,username,password) puts "[Restore] run: #{cmd_string}" output = `#{cmd_string}` raise ToolsException.new("#{cmd_string}", output) unless $?.to_i == 0 end |