-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment.rb
97 lines (75 loc) · 1.75 KB
/
deployment.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift File.expand_path('../shared/middleware', __FILE__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require_relative 'harnessless_shims'
require 'cdo/git_utils'
require 'uri'
require 'cdo'
####################################################################################################
##
## Helpers
##
##########
def rack_env
CDO.rack_env.to_sym
end
def rack_env?(*env)
e = *env
e.include? rack_env.to_sym
end
def with_rack_env(temporary_env)
require 'mocha/api'
CDO.stubs(rack_env: temporary_env)
yield
CDO.unstub(:rack_env)
end
def deploy_dir(*dirs)
CDO.dir(*dirs)
end
def aws_dir(*dirs)
deploy_dir('aws', *dirs)
end
def apps_dir(*dirs)
deploy_dir('apps', *dirs)
end
def python_dir(*dirs)
deploy_dir('python', *dirs)
end
def tools_dir(*dirs)
deploy_dir('tools', *dirs)
end
def cookbooks_dir(*dirs)
deploy_dir('cookbooks', *dirs)
end
def dashboard_dir(*dirs)
deploy_dir('dashboard', *dirs)
end
def locale_dir(*dirs)
File.join(ENV['LOCALE_CONTENT_DIR'] || CDO.locale_content_dir, *dirs)
end
def curriculum_dir(*dirs)
File.join(ENV['CURRICULUM_CONTENT_DIR'] || CDO.locale_content_dir, *dirs)
end
def dashboard_legacy_dir(*dirs)
deploy_dir('dashboard', 'legacy', *dirs)
end
def shared_dir(*dirs)
deploy_dir('shared', *dirs)
end
def shared_js_dir(*dirs)
deploy_dir('shared/js', *dirs)
end
def lib_dir(*dirs)
deploy_dir('lib', *dirs)
end
def bin_dir(*dirs)
deploy_dir('bin', *dirs)
end
def shared_constants_dir(*dirs)
lib_dir('cdo', 'shared_constants', *dirs)
end
def shared_constants_file
lib_dir('cdo', 'shared_constants.rb')
end