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
|
|
|
|
|
|
|
|
require_relative "devops-service"
|
2015-02-06 17:21:13 +03:00
|
|
|
require_relative "devops_config"
|
2015-06-25 11:13:46 +03:00
|
|
|
require_relative "devops-routes"
|
2014-05-08 15:34:26 +04:00
|
|
|
|
|
|
|
|
root = File.dirname(__FILE__)
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
2014-11-21 14:15:44 +03:00
|
|
|
config[:report_dir_v2] = File.expand_path(File.join(config[:devops_dir], "report", "v2")) unless config[:report_dir_v2]
|
2014-10-22 15:01:55 +04:00
|
|
|
[
|
2014-11-17 14:23:59 +03:00
|
|
|
:report_dir_v2
|
2014-10-22 15:01:55 +04:00
|
|
|
].each {|key| d = config[key]; FileUtils.mkdir_p(d) unless File.exists?(d) }
|
2015-01-26 15:02:58 +03:00
|
|
|
|
2015-02-06 17:21:13 +03:00
|
|
|
DevopsService.init
|
2015-06-25 11:13:46 +03:00
|
|
|
puts Devops::Routes.routes
|
|
|
|
|
Devops::Routes.routes.each do |p, c|
|
|
|
|
|
map(p) do
|
|
|
|
|
run c
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
#run Rack::URLMap.new(Devops::Routes.routes)
|