| 
									
										
										
										
											2016-06-22 18:17:03 +03:00
										 |  |  | require "db/mongo/models/mongo_model" | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  | require "db/mongo/mongo_connector" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-06 17:21:13 +03:00
										 |  |  | module Devops | 
					
						
							|  |  |  |   class Db | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @@db = nil | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class << self | 
					
						
							|  |  |  |       def init | 
					
						
							|  |  |  |         config = DevopsConfig.config | 
					
						
							|  |  |  |         mongo_db = config[:mongo_db] || "devops" | 
					
						
							|  |  |  |         mongo_host = config[:mongo_host] || "localhost" | 
					
						
							|  |  |  |         mongo_port = config[:mongo_port] || 27017
 | 
					
						
							|  |  |  |         mongo_user = config[:mongo_user] | 
					
						
							|  |  |  |         mongo_password = config[:mongo_password] | 
					
						
							|  |  |  |         @@db = MongoConnector.new(mongo_db, mongo_host, mongo_port, mongo_user, mongo_password) | 
					
						
							| 
									
										
										
										
											2015-09-15 14:27:06 +03:00
										 |  |  |         @@db.create_indexes | 
					
						
							| 
									
										
										
										
											2015-02-06 17:21:13 +03:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       def connector | 
					
						
							|  |  |  |         @@db | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |