depot3 0.0.0a1 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -1
- data/bin/d3 +323 -0
- data/bin/d3admin +1011 -0
- data/bin/d3helper +354 -0
- data/bin/puppytime +334 -0
- data/data/d3/com.pixar.d3.RepoMan.plist +23 -0
- data/data/d3/d3.conf.example +507 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftAppKit.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCore.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreData.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreGraphics.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreImage.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDarwin.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDispatch.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftFoundation.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftObjectiveC.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Info.plist +56 -0
- data/data/d3/d3RepoMan.app/Contents/MacOS/d3RepoMan +0 -0
- data/data/d3/d3RepoMan.app/Contents/PkgInfo +1 -0
- data/data/d3/d3RepoMan.app/Contents/Resources/Base.lproj/MainMenu.nib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Resources/last-foreground-times-template.plist +5 -0
- data/data/d3/d3RepoMan.app/Contents/_CodeSignature/CodeResources +214 -0
- data/data/d3/puppytime/ImageLicenses.txt +165 -0
- data/data/d3/puppytime/notification_image +1 -0
- data/data/d3/puppytime/opt_out_image +1 -0
- data/data/d3/puppytime/slideshow/2008-07-11_White_German_Shepherd_pup_chilling_at_the_Coker_Arboretum.jpg +0 -0
- data/data/d3/puppytime/slideshow/2009-04-21_APBT_pup_on_deck.jpg +0 -0
- data/data/d3/puppytime/slideshow/A_puppy_Yorkie.jpg +0 -0
- data/data/d3/puppytime/slideshow/Alert_Pug_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Australian_Cattle_Dog_puppies_04.JPG +0 -0
- data/data/d3/puppytime/slideshow/Beagle_puppy_Cadet.jpg +0 -0
- data/data/d3/puppytime/slideshow/Bernese_Mountain_Dog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Bloodhound_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Boston_terrier_with_toy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Boxer_puppy_fawn_portrai.jpg +0 -0
- data/data/d3/puppytime/slideshow/Caracal_kitten.jpg +0 -0
- data/data/d3/puppytime/slideshow/Chihuahua_&_Doberman_Pup.jpg +0 -0
- data/data/d3/puppytime/slideshow/Cuccioli_di_Margot_a_35_gg_Basenjis.jpg +0 -0
- data/data/d3/puppytime/slideshow/Dalmatian_puppy_03.jpg +0 -0
- data/data/d3/puppytime/slideshow/GoldenRetrieverPuppyDaisyParker.JPG +0 -0
- data/data/d3/puppytime/slideshow/Green_eyed_beige_Chihuahua.jpg +0 -0
- data/data/d3/puppytime/slideshow/Let_Sleeping_Dogs_Lie.jpg +0 -0
- data/data/d3/puppytime/slideshow/Meatball_-_French_Bulldog_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Oola_-_9_weeks.jpg +0 -0
- data/data/d3/puppytime/slideshow/Pancho0008.JPG +0 -0
- data/data/d3/puppytime/slideshow/Pomeranian_orange-sable_Coco.jpg +0 -0
- data/data/d3/puppytime/slideshow/Pug_puppy_001.jpg +0 -0
- data/data/d3/puppytime/slideshow/Puggle_puppy_6_weeks.JPG +0 -0
- data/data/d3/puppytime/slideshow/Puli_kan.jpg +0 -0
- data/data/d3/puppytime/slideshow/Puppy_French_Bulldog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Rocco_the_Bulldog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Rottweiler_Face.jpg +0 -0
- data/data/d3/puppytime/slideshow/Saint_Bernard_puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Scottish_froment.jpg +0 -0
- data/data/d3/puppytime/slideshow/Shar_pei_puppy_(age_2_months).jpg +0 -0
- data/data/d3/puppytime/slideshow/Shiba-Inu_beim_Spielen_im_Schnee.JPG +0 -0
- data/data/d3/puppytime/slideshow/Smooth-coat_Border_Collie_puppy..jpg +0 -0
- data/data/d3/puppytime/slideshow/Smooth_Dachshund_puppies.jpg +0 -0
- data/data/d3/puppytime/slideshow/Snow_dog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Taylor_the_Pembroke_Welsh_Corgi.png +0 -0
- data/data/d3/puppytime/slideshow/Weim_Pups_001.jpg +0 -0
- data/data/d3/puppytime/slideshow/Westie_pups.jpg +0 -0
- data/data/d3/puppytime/slideshow/Yellow_Labrador_puppies_(4165737325).jpg +0 -0
- data/lib/d3/admin/add.rb +451 -0
- data/lib/d3/admin/auth.rb +470 -0
- data/lib/d3/admin/edit.rb +297 -0
- data/lib/d3/admin/help.rb +396 -0
- data/lib/d3/admin/interactive.rb +972 -0
- data/lib/d3/admin/options.rb +454 -0
- data/lib/d3/admin/prefs.rb +204 -0
- data/lib/d3/admin/report.rb +727 -0
- data/lib/d3/admin/state.rb +42 -0
- data/lib/d3/admin/validate.rb +413 -0
- data/lib/d3/admin.rb +42 -0
- data/lib/d3/basename.rb +217 -0
- data/lib/d3/client/auth.rb +108 -0
- data/lib/d3/client/class_methods.rb +766 -0
- data/lib/d3/client/class_variables.rb +47 -0
- data/lib/d3/client/cli.rb +187 -0
- data/lib/d3/client/environment.rb +134 -0
- data/lib/d3/client/help.rb +110 -0
- data/lib/d3/client/lists.rb +314 -0
- data/lib/d3/client/receipt.rb +1173 -0
- data/lib/d3/client.rb +45 -0
- data/lib/d3/configuration.rb +319 -0
- data/lib/d3/constants.rb +60 -0
- data/lib/d3/database.rb +488 -0
- data/lib/d3/exceptions.rb +44 -0
- data/lib/d3/log.rb +271 -0
- data/lib/d3/package/aliases.rb +80 -0
- data/lib/d3/package/attributes.rb +97 -0
- data/lib/d3/package/class_methods.rb +817 -0
- data/lib/d3/package/class_variables.rb +46 -0
- data/lib/d3/package/client_actions.rb +293 -0
- data/lib/d3/package/constants.rb +58 -0
- data/lib/d3/package/constructor.rb +191 -0
- data/lib/d3/package/getters.rb +164 -0
- data/lib/d3/package/mixins.rb +39 -0
- data/lib/d3/package/private_methods.rb +227 -0
- data/lib/d3/package/questions.rb +95 -0
- data/lib/d3/package/server_actions.rb +683 -0
- data/lib/d3/package/setters.rb +326 -0
- data/lib/d3/package/validate.rb +448 -0
- data/lib/d3/package.rb +51 -0
- data/lib/d3/puppytime/pending_puppy.rb +108 -0
- data/lib/d3/puppytime/puppy_queue.rb +274 -0
- data/lib/d3/puppytime.rb +68 -0
- data/lib/d3/state.rb +105 -0
- data/lib/d3/utility.rb +325 -0
- data/lib/d3/version.rb +1 -1
- metadata +162 -9
@@ -0,0 +1,42 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
|
26
|
+
module D3
|
27
|
+
|
28
|
+
module Admin
|
29
|
+
|
30
|
+
@@debug = false
|
31
|
+
|
32
|
+
def self.debug= (newval)
|
33
|
+
@@debug = newval
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.debug
|
37
|
+
@@debug
|
38
|
+
end
|
39
|
+
|
40
|
+
end # module Admin
|
41
|
+
end # module D3
|
42
|
+
|
@@ -0,0 +1,413 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
module D3
|
26
|
+
module Admin
|
27
|
+
|
28
|
+
### This module contains methods for validating options given to d3admin
|
29
|
+
### either on the commandline or via a walkthru
|
30
|
+
###
|
31
|
+
### Each method takes an argument, and either raises an exception
|
32
|
+
### if the argument isn't valid for its destination, or
|
33
|
+
### converts it to the proper type for its destination.
|
34
|
+
###
|
35
|
+
### For options that set attributes of packages, the appropriate
|
36
|
+
### D3::Package::Validate method is called.
|
37
|
+
###
|
38
|
+
### For example, the {#validate_groups} takes either a comma-seprated String
|
39
|
+
### or an Array of computer group names, converts the String to an Array
|
40
|
+
### if needed, and then confirms that each group exists in the JSS
|
41
|
+
### If they all do, the Array is returned.
|
42
|
+
###
|
43
|
+
module Validate
|
44
|
+
extend self
|
45
|
+
|
46
|
+
### Check a value with a given 'validate_' method
|
47
|
+
### catching the excpetions and returning error messages
|
48
|
+
###
|
49
|
+
### @param value[String] the value from the user to check
|
50
|
+
###
|
51
|
+
### @param validate_method[Symbol] the method to use to check the value
|
52
|
+
###
|
53
|
+
### @return [Array<Boolean, Object>] A two-item array. The first item
|
54
|
+
### is a Boolean representing the success of failure of the check.
|
55
|
+
### The second item is the validated input, if the check was good,
|
56
|
+
### or the error message if not.
|
57
|
+
###
|
58
|
+
def validate (value, validate_method)
|
59
|
+
return [true, value] unless validate_method
|
60
|
+
begin
|
61
|
+
valid_value = self.send(validate_method, value)
|
62
|
+
return [true, valid_value]
|
63
|
+
rescue JSS::InvalidDataError, JSS::NoSuchItemError, JSS::AlreadyExistsError
|
64
|
+
return [false, $ERROR_INFO]
|
65
|
+
end # begin
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
### check that a given pkg id or display name exists in the JSS but not
|
70
|
+
### in d3, and if so, return the valid name or id
|
71
|
+
###
|
72
|
+
### @param pkg_to_check[String] a display name or JSS pkg id
|
73
|
+
###
|
74
|
+
### @return [D3::Package] the unsaved, imported package
|
75
|
+
###
|
76
|
+
def validate_package_for_import (pkg_to_check)
|
77
|
+
|
78
|
+
# an id, or a name?
|
79
|
+
if pkg_to_check.to_s =~ /^\d+$/
|
80
|
+
raise JSS::NoSuchItemError, "No package in the JSS with id #{pkg_to_check}" unless JSS::Package.all_ids.include? pkg_to_check.to_i
|
81
|
+
raise JSS::AlreadyExistsError, "JSS Package id #{pkg_to_check} is already in d3" if D3::Package.all_ids.include? pkg_to_check.to_i
|
82
|
+
return pkg_to_check.to_i
|
83
|
+
|
84
|
+
else
|
85
|
+
raise JSS::NoSuchItemError, "No package in the JSS with display-name #{pkg_to_check}" unless JSS::Package.all_names.include? pkg_to_check
|
86
|
+
raise JSS::AlreadyExistsError, "JSS Package named #{pkg_to_check} is already in d3" if D3::Package.all_names.include? pkg_to_check
|
87
|
+
return pkg_to_check
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
### Check that a given basename or edition exists in d3, and if
|
93
|
+
### so, return the package id
|
94
|
+
### If a basename is given, the currently live one is returned
|
95
|
+
### If there is no matching edition or live basename, an exception is raised
|
96
|
+
###
|
97
|
+
### @param pkg_to_check[String] a basename or edition
|
98
|
+
###
|
99
|
+
### @return [D3::Package] the matching package
|
100
|
+
###
|
101
|
+
def validate_existing_package (pkg_to_check)
|
102
|
+
# were we given an edition?
|
103
|
+
pkgid = D3::Package.ids_to_editions.invert[pkg_to_check]
|
104
|
+
# if not, were we given a basename?
|
105
|
+
pkgid ||= D3::Package.basenames_to_live_ids[pkg_to_check]
|
106
|
+
raise JSS::NoSuchItemError, "No edition or live-basename in d3 match '#{pkg_to_check}'" if pkgid.nil?
|
107
|
+
|
108
|
+
return pkgid
|
109
|
+
end
|
110
|
+
|
111
|
+
### check that the given package name doesn't already exist
|
112
|
+
###
|
113
|
+
### @see {JSS::Package.validate_package_name}
|
114
|
+
###
|
115
|
+
def validate_package_name(name)
|
116
|
+
D3::Package::Validate.validate_package_name name
|
117
|
+
end
|
118
|
+
|
119
|
+
### check that the given filename doesn't already exist
|
120
|
+
###
|
121
|
+
### @param name[String] the name to check
|
122
|
+
###
|
123
|
+
### @return [String] the valid new file name
|
124
|
+
###
|
125
|
+
# def self.validate_filename(name)
|
126
|
+
def validate_filename(name)
|
127
|
+
D3::Package::Validate.validate_filename name
|
128
|
+
end
|
129
|
+
|
130
|
+
### Check that a basename exists, and return it or raise an exception
|
131
|
+
###
|
132
|
+
### @param basename[String]
|
133
|
+
###
|
134
|
+
### @return [String] the valid basename
|
135
|
+
def validate_basename (basename)
|
136
|
+
raise JSS::NoSuchItemError, "There's no package in d3 with the basename '#{basename}'" unless D3::Package::Validate.basename_exist? basename.to_s
|
137
|
+
basename.to_s
|
138
|
+
end
|
139
|
+
|
140
|
+
### Check if an edition exists and raise an exception if so
|
141
|
+
### Also check that it contains at least two hyphens
|
142
|
+
###
|
143
|
+
### @param edition[String] the edition to check
|
144
|
+
###
|
145
|
+
### @return [String] the valid, unique edition
|
146
|
+
###
|
147
|
+
def validate_edition (edition)
|
148
|
+
D3::Package::Validate.validate_edition edition
|
149
|
+
end
|
150
|
+
|
151
|
+
### Confirm the validity of a version. Raise an exception if invalid.
|
152
|
+
###
|
153
|
+
### @param vers[String] the version to check
|
154
|
+
###
|
155
|
+
### @return [String] An error message, or true if the value is ok
|
156
|
+
###
|
157
|
+
def validate_version (vers)
|
158
|
+
D3::Package::Validate.validate_version vers
|
159
|
+
end
|
160
|
+
|
161
|
+
### Confirm the validity of a revision.
|
162
|
+
### Raise an exception if invalid.
|
163
|
+
###
|
164
|
+
### @param rev[Integer] the revision to check
|
165
|
+
###
|
166
|
+
### @return [Integer] the valid revision
|
167
|
+
###
|
168
|
+
def validate_revision (rev)
|
169
|
+
D3::Package::Validate.validate_revision rev
|
170
|
+
end
|
171
|
+
|
172
|
+
### Check the validity of the local source path
|
173
|
+
### Raises an exception if not valid
|
174
|
+
###
|
175
|
+
### @param src[Pathname, String] the path to check
|
176
|
+
###
|
177
|
+
### @return [Pathname] the valid, fully-expanded path
|
178
|
+
###
|
179
|
+
def validate_source_path (src)
|
180
|
+
raise JSS::InvalidDataError, "Source path cannot be empty" if src.to_s.empty?
|
181
|
+
src = Pathname.new(src.to_s).expand_path
|
182
|
+
raise JSS::NoSuchItemError, "'#{src}' doesn't exist" unless src.exist?
|
183
|
+
return src if src.to_s.end_with?(".dmg") or src.to_s =~ /\.m?pkg$/
|
184
|
+
|
185
|
+
# isn't a dmg or pkg, check that its a directory to use as a pkg root
|
186
|
+
raise JSS::InvalidDataError, "#{src} isn't a .dmg or .pkg, but isn't a folder,\ncan't use it for building packages." unless src.directory?
|
187
|
+
src
|
188
|
+
end
|
189
|
+
|
190
|
+
### check the validity of the pkg build type
|
191
|
+
###
|
192
|
+
### @param type[String] the string to check
|
193
|
+
###
|
194
|
+
### @return [Symbol] :pkg or :dmg
|
195
|
+
###
|
196
|
+
def validate_package_build_type(type)
|
197
|
+
case type.to_s.delete('.')
|
198
|
+
when /^p/i then :pkg
|
199
|
+
when /^d/i then :dmg
|
200
|
+
else raise JSS::InvalidDataError, "Package type must be 'pkg', 'dmg', 'p', or 'd'"
|
201
|
+
end # case
|
202
|
+
end
|
203
|
+
|
204
|
+
### Check the pkg identifier
|
205
|
+
###
|
206
|
+
### @param pkgid[String] the identifer
|
207
|
+
###
|
208
|
+
### @return [String] the valid identifier
|
209
|
+
###
|
210
|
+
def validate_package_identifier (pkgid)
|
211
|
+
raise JSS::InvalidDataError, "Package Identifier must be a String" unless pkgid.is_a? String
|
212
|
+
raise JSS::InvalidDataError, "Package Identifier cannot be empty" if pkgid.empty?
|
213
|
+
return pkgid
|
214
|
+
end
|
215
|
+
|
216
|
+
### Check the pkg identifier prefix
|
217
|
+
###
|
218
|
+
### @param pfx[String] the prefix for the identifer
|
219
|
+
###
|
220
|
+
### @return [String] the cleaned-up identifier
|
221
|
+
###
|
222
|
+
def validate_package_identifier_prefix (pfx)
|
223
|
+
return nil if pfx.to_s.empty?
|
224
|
+
raise JSS::InvalidDataError, "Package Identifier Prefix must be a String" unless pfx.is_a? String
|
225
|
+
return pfx
|
226
|
+
end
|
227
|
+
|
228
|
+
### Check the path given as a workspace for building pkgs
|
229
|
+
###
|
230
|
+
### @return [Pathname] the valid, full path to the workspace folder
|
231
|
+
###
|
232
|
+
def validate_workspace (wkspc)
|
233
|
+
wkspc = Pathname.new(wkspc).expand_path
|
234
|
+
raise JSS::NoSuchItemError, "Workspace folder '#{wkspc}' doesn't exist" unless wkspc.exist?
|
235
|
+
raise JSS::InvalidDataError, "Workspace folder '#{wkspc}' isn't a folder" unless wkspc.directory?
|
236
|
+
D3::Admin::Prefs.set_pref :workspace, wkspc
|
237
|
+
wkspc
|
238
|
+
end
|
239
|
+
|
240
|
+
### Check that a report type is valid
|
241
|
+
###
|
242
|
+
### @return [String] the valid report type.
|
243
|
+
###
|
244
|
+
def validate_report_type(type)
|
245
|
+
raise ArgumentError, "Report type must be one of: #{D3::Admin::Report::REPORT_TYPES.join(', ')}" unless D3::Admin::Report::REPORT_TYPES.include? type
|
246
|
+
type
|
247
|
+
end
|
248
|
+
|
249
|
+
### Check that a show type is valid
|
250
|
+
###
|
251
|
+
### @return [String] the valid show type.
|
252
|
+
###
|
253
|
+
def validate_show_type(type)
|
254
|
+
raise ArgumentError, "Package list must be one of: #{D3::Admin::Report::SHOW_TYPES.join(', ')}" unless D3::Admin::Report::SHOW_TYPES.include? type
|
255
|
+
type
|
256
|
+
end
|
257
|
+
|
258
|
+
### @see D3::Package::Validate.validate_groups
|
259
|
+
def validate_scoped_groups (groups)
|
260
|
+
D3::Package::Validate.validate_groups groups
|
261
|
+
end
|
262
|
+
|
263
|
+
### check that a computer name or id exists in casper
|
264
|
+
###
|
265
|
+
### @param [String,Integer] the name, id, serialnumber, macaaddress, or udid
|
266
|
+
### of a computer in the JSS
|
267
|
+
###
|
268
|
+
### @return [Integer] the valid computer id
|
269
|
+
###
|
270
|
+
def validate_computer(ident)
|
271
|
+
id = JSS::Computer.map_all_ids_to(:name).invert[ident]
|
272
|
+
id ||= JSS::Computer.map_all_ids_to(:serial_number).invert[ident]
|
273
|
+
id ||= JSS::Computer.map_all_ids_to(:mac_address).invert[ident]
|
274
|
+
id ||= JSS::Computer.map_all_ids_to(:udid).invert[ident]
|
275
|
+
return id if id
|
276
|
+
return ident.to_i if JSS::Computer.all_ids.include? ident.to_i
|
277
|
+
raise JSS::NoSuchItemError, "No computer in the JSS matches '#{ident}'"
|
278
|
+
end
|
279
|
+
|
280
|
+
### Check the validity of a pre_install script
|
281
|
+
###
|
282
|
+
### @see #validate_script
|
283
|
+
###
|
284
|
+
def validate_pre_install_script (script)
|
285
|
+
D3::Package::Validate.validate_script script
|
286
|
+
end
|
287
|
+
|
288
|
+
### Check the validity of a post_install script
|
289
|
+
###
|
290
|
+
### @see #validate_script
|
291
|
+
###
|
292
|
+
def validate_post_install_script (script)
|
293
|
+
D3::Package::Validate.validate_script script
|
294
|
+
end
|
295
|
+
|
296
|
+
### Check the validity of a pre_remove script
|
297
|
+
###
|
298
|
+
### @see #validate_script
|
299
|
+
###
|
300
|
+
def validate_pre_remove_script (script)
|
301
|
+
D3::Package::Validate.validate_script script
|
302
|
+
end
|
303
|
+
|
304
|
+
### Check the validity of a pre_remove script
|
305
|
+
###
|
306
|
+
### @see #validate_script
|
307
|
+
###
|
308
|
+
def validate_post_remove_script (script)
|
309
|
+
D3::Package::Validate.validate_script script
|
310
|
+
end
|
311
|
+
|
312
|
+
### @see #validate_groups
|
313
|
+
def validate_auto_groups (groups)
|
314
|
+
D3::Package::Validate.validate_auto_groups groups
|
315
|
+
end
|
316
|
+
|
317
|
+
### @see #validate_groups
|
318
|
+
def validate_excluded_groups (groups)
|
319
|
+
D3::Package::Validate.validate_groups groups
|
320
|
+
end
|
321
|
+
|
322
|
+
### Make sure auto and excluded groups don't have any
|
323
|
+
### members in common, raise an exception if they do.
|
324
|
+
###
|
325
|
+
### @param auto[Array] the array of auto groups
|
326
|
+
###
|
327
|
+
### @param excl[Array] the array of excluded groups
|
328
|
+
###
|
329
|
+
### @return [True] true if there are no groups in common
|
330
|
+
###
|
331
|
+
def validate_non_overlapping_groups (auto, excl)
|
332
|
+
D3::Package::Validate.validate_non_overlapping_groups auto, excl
|
333
|
+
end
|
334
|
+
|
335
|
+
### Check the validity of a list of OSes
|
336
|
+
### Raise an exception if not valid
|
337
|
+
###
|
338
|
+
### @param [String,Array] Array or comma-separated list of OSes to check
|
339
|
+
###
|
340
|
+
### @return [Array] the valid OS list
|
341
|
+
###
|
342
|
+
def validate_oses (os_list)
|
343
|
+
D3::Package::Validate.validate_oses os_list
|
344
|
+
end
|
345
|
+
|
346
|
+
### Check the validity of a CPU type
|
347
|
+
### Raise an exception if not valid
|
348
|
+
###
|
349
|
+
### @param [Symbol] the CPU type to check
|
350
|
+
###
|
351
|
+
### @return [Symbol] the valid CPU type
|
352
|
+
###
|
353
|
+
def validate_cpu_type (type)
|
354
|
+
D3::Package::Validate.validate_cpu_type type
|
355
|
+
end
|
356
|
+
|
357
|
+
### Check the validity of a category
|
358
|
+
### Raise an exception if not valid
|
359
|
+
###
|
360
|
+
### @param cat[String] the category to check
|
361
|
+
###
|
362
|
+
### @return [String] the valid category
|
363
|
+
###
|
364
|
+
def validate_category (cat)
|
365
|
+
D3::Package::Validate.validate_category cat
|
366
|
+
end
|
367
|
+
|
368
|
+
### Check the offered prohibiting process
|
369
|
+
###
|
370
|
+
### @param match_string[String] the data entered by the user
|
371
|
+
###
|
372
|
+
### @return [String, nil] the regexp used to do the match
|
373
|
+
###
|
374
|
+
def validate_prohibiting_process (match_string)
|
375
|
+
D3::Package::Validate.validate_prohibiting_process match_string
|
376
|
+
end
|
377
|
+
|
378
|
+
### check the validity of a yes/no true/false reply
|
379
|
+
###
|
380
|
+
### @param type[String,Boolean] the value to check
|
381
|
+
###
|
382
|
+
### @return [Boolean]
|
383
|
+
###
|
384
|
+
def validate_yes_no (yn)
|
385
|
+
D3::Package::Validate.validate_yes_no yn
|
386
|
+
end
|
387
|
+
|
388
|
+
### Confirm the validity of an expiration.
|
389
|
+
### Raise an exception if invalid.
|
390
|
+
###
|
391
|
+
### @param exp[Integer] the expiration to check
|
392
|
+
###
|
393
|
+
### @return [Integer] the valid expiration
|
394
|
+
###
|
395
|
+
def validate_expiration (exp)
|
396
|
+
D3::Package::Validate.validate_expiration exp
|
397
|
+
end
|
398
|
+
|
399
|
+
### Confirm the validity of an expiration path.
|
400
|
+
### any string that starts with a / is valid.
|
401
|
+
###
|
402
|
+
### @param path[Pathname, String] the path to check
|
403
|
+
###
|
404
|
+
### @return [Pathname, nil] the valid path
|
405
|
+
###
|
406
|
+
def validate_expiration_path (path)
|
407
|
+
D3::Package::Validate.validate_expiration_path path
|
408
|
+
end
|
409
|
+
|
410
|
+
|
411
|
+
end # module Validate
|
412
|
+
end # module Admin
|
413
|
+
end # module D3
|
data/lib/d3/admin.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
module D3
|
28
|
+
module Admin
|
29
|
+
|
30
|
+
end # module Admin
|
31
|
+
end # module D3
|
32
|
+
|
33
|
+
require "d3/admin/state"
|
34
|
+
require "d3/admin/help"
|
35
|
+
require "d3/admin/add"
|
36
|
+
require "d3/admin/auth"
|
37
|
+
require "d3/admin/edit"
|
38
|
+
require "d3/admin/interactive"
|
39
|
+
require "d3/admin/options"
|
40
|
+
require "d3/admin/prefs"
|
41
|
+
require "d3/admin/report"
|
42
|
+
require "d3/admin/validate"
|