-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrakefile.rb
More file actions
151 lines (127 loc) · 3.78 KB
/
rakefile.rb
File metadata and controls
151 lines (127 loc) · 3.78 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# ------------------------------------------------------------------------------------------------------
# AUTHOR: Josh Coffman
# PURPOSE: Automate deployment including backup of files and database
#
# DEPENDENCIES: run check-deps.bat to ensure Ruby 1.9.2 and required gems are installed. This bat file
# will be run when you execute either of the deployment bat file to ensure it can complete
# ------------------------------------------------------------------------------------------------------
require 'rubygems'
require 'fileutils'
require 'albacore'
require './Classes'
require './Const'
task :default do
puts "rake [target]\n\n"
puts "targets are..."
puts "\t:default \t\t this task"
puts "\t:compile \t\t builds #{PROJ_NAME}.sln"
puts "\t:build \t\t\t builds #{PROJ_NAME}.sln"
puts "\t:devdeploy \t\t deploys local build to dev"
puts "\t:proddeploy \t\t deploys dev build to production"
puts "\t:backup_local_sql \t backs up #{LOCAL_SQL}.#{LOCAL_DB} database"
puts "\t:backup_dev_sql \t backs up #{DEV_SQL}.#{DEV_DB} database"
puts "\t:backup_prod_sql \t backs up #{PROD_SQL}.#{PROD_DB} database"
puts ""
end
task :compile => [:build]
task :clean do
FileUtils.rm_rf OUTPUT
end
task :notimplemented do
puts "\nnot implemented\n\n"
end
#---- util methods ----#
#----------------------#
def deployit(origin, dest, backup)
puts 'starting deployment...'
app = AppState.new(dest)
app.offline
puts 'deployment FAILED' and return false if not WebDeploy.new.deploy(origin, dest, backup)
app.online
puts 'DONE'
true
end
def backitup(source, backup)
puts 'starting backup...'
puts 'backup FAILED' and return false if not WebBackup.new.backup(source, backup)
# compressit backup
puts 'done'
true
end
def compressit(source)
puts 'starting zip...'
puts 'zip FAILED' and return false if not WebBackup.new.compress(source)
puts 'zip completed'
true
end
#---- test tasks ----#
#--------------------#
task :archpath do
puts LOCAL_COPY
puts "dir = " + File.directory?(LOCAL_COPY).to_s
end
task :testbackup do
backitup LOCAL_COPY, LOCAL_BACKUP
end
task :testdeploy do
deployit LOCAL_OUTPUT, LOCAL_COPY, LOCAL_BACKUP
end
task :testcompress do
compressit LOCAL_COPY
end
task :testoffline do
dest = LOCAL_PATH
app = AppState.new(dest)
app.offline
end
task :testonline do
dest = LOCAL_PATH
app = AppState.new(dest)
app.online
end
#---- deploy tasks ----#
#----------------------#
task :devdeploy => [:clean, :build, :backup_dev_sql, :deploy_dev_web]
task :proddeploy => [:backup_prod_sql, :deploy_prod_web]
task :deploy_dev_web do
deployit LOCAL_OUTPUT, DEVPORTAL_DEST, DEVPORTAL_BACKUP
end
task :deploy_prod_web do
deployit DEVPORTAL_DEST, PORTAL_DEST, PORTAL_BACKUP
end
#---- web backup tasks ----#
#--------------------------#
task :backup_dev_web do
backitup DEVPORTAL_DEST, DEVPORTAL_BACKUP
end
task :backup_prod_web do
backitup PORTAL_DEST, PORTAL_BACKUP
end
#---- sql backup tasks ----#
#--------------------------#
task :backup_local_sql do
puts 'running backup..'
backup = SqlBackup.new(LOCAL_SQL, LOCAL_DB, LOCAL_SQL_BACKUP)
backup.run_backup
puts 'complete.'
end
task :backup_dev_sql do
puts 'running backup..'
backup = SqlBackup.new(DEV_SQL, DEV_DB, DEV_SQL_BACKUP)
backup.run_backup
puts 'complete.'
end
task :backup_prod_sql do
puts 'running backup..'
backup = SqlBackup.new(PROD_SQL, PROD_DB, PROD_SQL_BACKUP)
backup.run_backup
puts 'complete.'
end
#---- compile/build tasks ----#
#-----------------------------#
msbuild :build do |msb|
msb.solution = SLN_FILE
msb.targets :clean, :build
msb.properties :configuration => :debug, :outdir => OUTPUT
msb.verbosity = 'quiet'
end