-
Notifications
You must be signed in to change notification settings - Fork 0
/
isetbioLocalHook.m
125 lines (115 loc) · 4.93 KB
/
isetbioLocalHook.m
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
function isetbioLocalHookTemplate
% Method to set ISETBIO-specific preferences.
%
% Syntax:
% isetbioLocalHookTemplate
%
% Description:
% Generally, this function should be edited for your website and then
% run once.
%
% You should be able just to use this template version without editing
% for both full and fast validations -- it pulls its data off a server
% we have set up via the RemoteDataToolbox facility.
%
% Note that you still want to have the remoteDataToolboxConfig set up
% even if you aren't using the RemoteDataToolbox for validations.
%
% If you are using the ToolboxToolbox, the copy this file to your local
% hooks folder and delete "Template" from the filename. The TbTb will
% then run it when you deploy isetbio.
%
% Inputs:
% None.
%
% Outputs:
% None.
%
% Optional key/value pairs:
% None.
%
% Specify project-specific preferences for unit test toolbox
% 'projectName' - String. The project's name (also the
% preferences group name). Default 'isetbio'
% 'validationRootDir' - String. The directory location where the
% 'scripts' subdirectory resides. Default
% fullfile(isetbioRootPath, 'validation')
% 'alternateFastDataDir' - String. An alternate FAST (hash) data
% directory location. Specify '' to use the
% default location, i.e.,
% $validationRootDir/data/fast. Default ''.
% 'alternateFullDataDir' - String. An alternate FULL data directory
% location. Specify '' to use the default
% location, i.e., $validationRootDir/data/full.
% Default ''.
% 'useRemoteDataToolbox' - Boolean. If true use the Remote Data Toolbox
% to fetch full validation data on demand.
% Default false.
% 'remoteDataToolboxConfig' - String. The struct, file path, or project
% name with Remote Data Toolbox configuration.
% Default 'isetbio'.
% 'githubRepoURL' - String. The Github URL for the project. This
% is only used for publishing tutorials.
% Default 'http://isetbio.github.io/isetbio'.
% 'generateGroundTruthDataIfNotFound'
% - Boolean. Flag indicating whether or not to
% generate the ground truth if one is not
% found. Default false.
% 'listingScript' - String. The listing script name. Default
% 'ieValidateListAllValidationDirs'.
% 'coreListingScript' - String. The core listing script name. Default
% 'ieValidateListCoreValidationFiles'.
% 'numericTolerance' - Numeric. Numeric tolerance for comparisons
% with validation data. Default 1e-11.
% Get Dropbox Validation RootDir location
computerInfo = GetComputerInfo();
switch (computerInfo.localHostName)
case 'Ithaka'
% Nicolas' M1 Macbook Pro
dropboxValidationRootDirPath = '/Volumes/SSDdisk/Aguirre-Brainard Lab Dropbox/Nicolas Cottaris';
case 'Crete'
% Nicolas' M1 MacStudio Ultra
dropboxValidationRootDirPath = '/Volumes/SSDdisk/Aguirre-Brainard Lab Dropbox/Nicolas Cottaris';
otherwise
error('Dropbox validation root directory location not available for computer named: ''%s''.', computerInfo.localHostName);
end
p = struct(...
'projectName', 'isetbio', ...
'validationRootDir', fullfile(isetbioRootPath, 'validation'), ...
'alternateFastDataDir', '', ...
'alternateFullDataDir', fullfile(dropboxValidationRootDirPath, 'ISETBioValidationFiles/gradleFiles/validationFull'), ...
'useRemoteDataToolbox', ~true, ...
'remoteDataToolboxConfig', 'isetbio', ...
'githubRepoURL', 'http://isetbio.github.io/isetbio', ...
'generateGroundTruthDataIfNotFound', ~true, ...
'listingScript', 'ieValidateListAllValidationDirs', ...
'coreListingScript', 'ieValidateListCoreValidationFiles', ...
'numericTolerance', 1e-11);
% Add to the path the Dropbox Validation RootDir location
addpath(genpath(p.alternateFullDataDir));
generatePreferenceGroup(p);
UnitTest.usePreferencesForProject(p.projectName);
end
function generatePreferenceGroup(p)
% Remove any existing preferences for this project
%
% Syntax:
% generatePreferenceGroup(p)
%
% Description:
% Remove existing preferences for the provided project p.
%
% Inputs:
% p - Object. A project object.
%
% Outputs:
% None.
%
% Optional key/value pairs:
% None.
%
if ispref(p.projectName), rmpref(p.projectName); end
% generate and save the project-specific preferences
setpref(p.projectName, 'projectSpecificPreferences', p);
fprintf('Generated and saved preferences specific to the %s project.\n', p.projectName);
end