| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | # To run devops you can use command | 
					
						
							|  |  |  | # `bundle exec thin -R $devops_home/config.ru -e $env -d -p $port -t 600 -u $user --pid $pid_file --log $log_file start` | 
					
						
							| 
									
										
										
										
											2015-01-26 15:02:58 +03:00
										 |  |  | require "rubygems" | 
					
						
							|  |  |  | require "bundler/setup" | 
					
						
							| 
									
										
										
										
											2015-02-12 13:30:49 +03:00
										 |  |  | require 'byebug' | 
					
						
							| 
									
										
										
										
											2015-01-26 15:02:58 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | root = File.dirname(__FILE__) | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  | $:.push root | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require_relative "core/devops-service" | 
					
						
							|  |  |  | require_relative "core/devops-config" | 
					
						
							|  |  |  | require_relative "core/devops-routes" | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Read configuration file | 
					
						
							| 
									
										
										
										
											2015-02-06 17:21:13 +03:00
										 |  |  | DevopsConfig.read | 
					
						
							|  |  |  | config = DevopsConfig.config | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-26 15:02:58 +03:00
										 |  |  | puts "Devops home: #{config[:devops_dir]}" | 
					
						
							|  |  |  | unless File.exists?(config[:devops_dir]) | 
					
						
							|  |  |  |   FileUtils.mkdir_p config[:devops_dir] | 
					
						
							|  |  |  |   puts "Directory '#{config[:devops_dir]}' has been created" | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2014-10-22 15:01:55 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-02 11:38:58 +03:00
										 |  |  | [:report_dir_v2, :project_info_dir].each do |key| | 
					
						
							| 
									
										
										
										
											2015-09-01 16:31:31 +03:00
										 |  |  |   directory = config[key] | 
					
						
							|  |  |  |   FileUtils.mkdir_p(directory) unless File.exists?(directory) | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2015-01-26 15:02:58 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-06 17:21:13 +03:00
										 |  |  | DevopsService.init | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  | if Devops::Routes.routes.empty? | 
					
						
							|  |  |  |   puts "No applications" | 
					
						
							|  |  |  |   exit -1 | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2018-04-04 22:44:39 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | require "providers/static" | 
					
						
							|  |  |  | require "providers/aws" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-25 11:13:46 +03:00
										 |  |  | Devops::Routes.routes.each do |p, c| | 
					
						
							|  |  |  |   map(p) do | 
					
						
							|  |  |  |     run c | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2018-04-04 22:44:39 +03:00
										 |  |  | 
 |