forked from code-dot-org/code-dot-org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment.rb
81 lines (63 loc) · 1.43 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
$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 'cdo/git_utils'
require 'uri'
require 'cdo'
require 'cdo/aws/cdo_google_credentials'
####################################################################################################
##
## 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 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 pegasus_dir(*paths)
deploy_dir('pegasus', *paths)
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 shared_constants_dir(*dirs)
lib_dir('cdo', 'shared_constants', *dirs)
end
def shared_constants_file
lib_dir('cdo', 'shared_constants.rb')
end