-
Notifications
You must be signed in to change notification settings - Fork 10
/
rakefile.rb
161 lines (131 loc) · 4.32 KB
/
rakefile.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
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
152
153
154
155
156
157
158
159
160
161
require_relative 'scripts/setup'
require_relative 'scripts/copy-dependencies'
require_relative 'scripts/utils'
require_relative 'scripts/coverage'
task :cover do
filter = []
filter << "+[MoBi.Core]*"
filter << "+[MoBi.Assets]*"
filter << "+[MoBi.Presentation]*"
targetProjects = [
"MoBi.Tests.csproj",
"MoBi.UI.Tests.csproj",
];
Coverage.cover(filter , targetProjects)
end
task :create_setup, [:product_version, :configuration] do |t, args|
src_dir = src_dir_for(args.configuration)
relative_src_dir = relative_src_dir_for(args.configuration)
#Ignore files from automatic harvesting that will be installed specifically
harvest_ignored_files = [
'MoBi.exe'
]
#Files required for setup creation only
setup_files = [
"#{relative_src_dir}/ChartLayouts/**/*.{wxs,xml}",
"#{relative_src_dir}/TeXTemplates/**/*.*",
'examples/**/*.{wxs,pkml,mbp3}',
'src/Data/**/*.*',
'src/MoBi.Assets/Resources/*.ico',
'documentation/*.pdf',
'dimensions/*.xml',
'pkparameters/*.xml',
'setup/setup.wxs',
'setup/**/*.{msm,rtf,bmp}',
'Open Systems Pharmacology Suite License.pdf'
]
Rake::Task['setup:create'].execute(OpenStruct.new(
solution_dir: solution_dir,
src_dir: src_dir,
setup_dir: setup_dir,
product_name: product_name,
product_version: args.product_version,
harvest_ignored_files: harvest_ignored_files,
suite_name: suite_name,
setup_files: setup_files,
manufacturer: manufacturer
))
end
task :create_portable_setup, [:product_version, :configuration, :package_name] do |t, args|
src_dir = src_dir_for(args.configuration)
relative_src_dir = relative_src_dir_for(args.configuration)
copy_templates_files src_dir
#Files required for setup creation only and that will not be harvested automatically
setup_files = [
'Open Systems Pharmacology Suite License.pdf',
'documentation/*.pdf',
'dimensions/*.xml',
'pkparameters/*.xml',
'src/Data/**/*.*',
'setup/**/*.{rtf}',
]
setup_folders = [
"#{setup_temp_dir}/**/*.*",
'examples/**/*.{pkml,mbp3}',
]
Rake::Task['setup:create_portable'].execute(OpenStruct.new(
solution_dir: solution_dir,
src_dir: src_dir,
setup_dir: setup_dir,
product_name: product_name,
product_version: args.product_version,
suite_name: suite_name,
setup_files: setup_files,
setup_folders: setup_folders,
package_name: args.package_name)
)
end
task :update_go_license, [:file_path, :license] do |t, args|
Utils.update_go_diagram_license args.file_path, args.license
end
def copy_templates_files(source_dir)
FileUtils.mkdir_p setup_temp_dir
FileUtils.copy_entry File.join(source_dir, 'TeXTemplates'), File.join(setup_temp_dir, 'TeXTemplates')
FileUtils.copy_entry File.join(source_dir, 'ChartLayouts'), File.join(setup_temp_dir, 'ChartLayouts')
FileUtils.copy_entry File.join(source_dir, 'Templates'), File.join(setup_temp_dir, 'Templates')
end
def relative_src_dir_for(configuration)
File.join('src', 'MoBi', 'bin', configuration, 'net472')
end
def src_dir_for(configuration)
File.join(solution_dir, relative_src_dir_for(configuration))
end
task :postclean do |t, args|
packages_dir = src_dir_for("Debug")
all_users_dir = ENV['ALLUSERSPROFILE']
all_users_application_dir = File.join(all_users_dir, manufacturer, product_name, '12.0')
copy_dependencies solution_dir, all_users_application_dir do
copy_files 'Data', ['xml', 'mbdt']
copy_file 'src/Data/AllCalculationMethods.pkml'
copy_dimensions_xml
copy_pkparameters_xml
end
copy_dependencies solution_dir, File.join(all_users_application_dir, 'Templates') do
copy_templates_pkml
end
copy_dependencies packages_dir, File.join(all_users_application_dir, 'ChartLayouts') do
copy_files 'ChartLayouts', 'xml'
end
copy_dependencies packages_dir, File.join(all_users_application_dir, 'TeXTemplates', 'StandardTemplate') do
copy_files 'StandardTemplate', '*'
end
end
private
def solution_dir
File.dirname(__FILE__)
end
def manufacturer
'Open Systems Pharmacology'
end
def product_name
'MoBi'
end
def suite_name
'Open Systems Pharmacology Suite'
end
def setup_dir
File.join(solution_dir, 'setup')
end
def setup_temp_dir
File.join(setup_dir, 'temp')
end