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"
|
|
|
|
|
|
|
|
|
|
require_relative "devops-service"
|
|
|
|
|
require_relative "devops_loader"
|
|
|
|
|
require_relative "routes"
|
2014-05-08 15:34:26 +04:00
|
|
|
|
|
|
|
|
root = File.dirname(__FILE__)
|
|
|
|
|
|
|
|
|
|
# Read configuration file
|
|
|
|
|
config_file = File.join(root, "config.rb")
|
|
|
|
|
config = {}
|
|
|
|
|
if File.exists? config_file
|
|
|
|
|
eval File.read config_file
|
|
|
|
|
else
|
|
|
|
|
raise "No config file '#{config_file}' found"
|
|
|
|
|
end
|
|
|
|
|
|
2014-11-21 14:15:44 +03:00
|
|
|
config[:devops_dir] = File.join(ENV["HOME"], ".devops") if config[:devops_dir].nil?
|
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
|
|
|
|
|
|
|
|
DevopsService.init(config)
|
|
|
|
|
run Rack::URLMap.new(Devops::Routes.routes)
|