dtf 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -1
- data/.travis.yml +7 -2
- data/Gemfile +3 -2
- data/README.md +105 -6
- data/Rakefile +2 -0
- data/app/models/analysis_case.rb +1 -1
- data/app/models/case_test.rb +1 -1
- data/app/models/user.rb +3 -2
- data/app/models/verification_suite.rb +1 -1
- data/bin/dtf +23 -20
- data/db/seeds.rb +4 -0
- data/doc/AnalysisCase.html +123 -0
- data/doc/CaseTest.html +123 -0
- data/doc/Dtf.html +129 -0
- data/doc/Dtf/DtfCommands.html +471 -0
- data/doc/User.html +123 -0
- data/doc/VerificationSuite.html +123 -0
- data/doc/_index.html +171 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +256 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +256 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +100 -0
- data/doc/top-level-namespace.html +274 -0
- data/dtf.gemspec +3 -1
- data/lib/config/environment.rb +1 -1
- data/lib/dtf.rb +85 -2
- data/lib/dtf/dtf_error_system.rb +16 -0
- data/lib/dtf/dtf_help_system.rb +55 -0
- data/lib/dtf/version.rb +2 -2
- data/lib/tasks/setup.thor +5 -3
- data/spec/acceptance/create_basic_associations.feature +13 -0
- data/spec/acceptance/implement_help_system.feature +16 -0
- data/spec/fabricators/analysis_case_fabricator.rb +1 -1
- data/spec/fabricators/case_test_fabricator.rb +1 -1
- data/spec/fabricators/user_fabricator.rb +4 -4
- data/spec/fabricators/verification_suite_fabricator.rb +1 -1
- data/spec/models/analysis_case_spec.rb +53 -11
- data/spec/models/case_test_spec.rb +57 -11
- data/spec/models/user_spec.rb +46 -11
- data/spec/models/verification_suite_spec.rb +52 -12
- data/spec/spec_helper.rb +21 -1
- data/spec/steps/feature_steps.rb +14 -12
- data/spec/support/custom_matchers/model_steps.rb +17 -18
- metadata +77 -18
- data/bin/dtf-create_user +0 -11
- data/bin/dtf-create_vs +0 -10
- data/bin/dtf-delete_user +0 -18
- data/bin/dtf-delete_vs +0 -14
- data/bin/dtf-setup +0 -7
- data/spec/acceptance/0001_create_basic_models.feature +0 -9
- data/spec/acceptance/0002_create_basic_associations.feature +0 -11
- data/spec/acceptance/0003_execute_help_switch.feature +0 -7
data/doc/Dtf.html
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Dtf
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (D)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Dtf</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Dtf
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/dtf.rb<span class="defines">,<br />
|
83
|
+
lib/dtf/version.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Defined Under Namespace</h2>
|
90
|
+
<p class="children">
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Dtf/DtfCommands.html" title="Dtf::DtfCommands (class)">DtfCommands</a></span>
|
96
|
+
|
97
|
+
|
98
|
+
</p>
|
99
|
+
|
100
|
+
<h2>Constant Summary</h2>
|
101
|
+
|
102
|
+
<dl class="constants">
|
103
|
+
|
104
|
+
<dt id="VERSION-constant" class="">VERSION =
|
105
|
+
|
106
|
+
</dt>
|
107
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.2.2</span><span class='tstring_end'>"</span></span></pre></dd>
|
108
|
+
|
109
|
+
</dl>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div id="footer">
|
123
|
+
Generated on Fri Sep 14 22:41:21 2012 by
|
124
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
125
|
+
0.8.2.1 (ruby-1.9.3).
|
126
|
+
</div>
|
127
|
+
|
128
|
+
</body>
|
129
|
+
</html>
|
@@ -0,0 +1,471 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Dtf::DtfCommands
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (D)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Dtf.html" title="Dtf (module)">Dtf</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">DtfCommands</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Dtf::DtfCommands
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Dtf::DtfCommands</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/dtf.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Class Method Summary
|
112
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#create_user-class_method" title="create_user (class method)">+ (Object) <strong>create_user</strong>(cmd_opts) </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#create_vs-class_method" title="create_vs (class method)">+ (Object) <strong>create_vs</strong>(cmd_opts) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="public ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#delete_user-class_method" title="delete_user (class method)">+ (Object) <strong>delete_user</strong>(cmd, cmd_opts) </a>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li class="public ">
|
184
|
+
<span class="summary_signature">
|
185
|
+
|
186
|
+
<a href="#delete_vs-class_method" title="delete_vs (class method)">+ (Object) <strong>delete_vs</strong>(cmd, cmd_opts) </a>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</span>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
</ul>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<div id="class_method_details" class="method_details_list">
|
211
|
+
<h2>Class Method Details</h2>
|
212
|
+
|
213
|
+
|
214
|
+
<div class="method_details first">
|
215
|
+
<h3 class="signature first" id="create_user-class_method">
|
216
|
+
|
217
|
+
+ (<tt>Object</tt>) <strong>create_user</strong>(cmd_opts)
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</h3><table class="source_code">
|
224
|
+
<tr>
|
225
|
+
<td>
|
226
|
+
<pre class="lines">
|
227
|
+
|
228
|
+
|
229
|
+
9
|
230
|
+
10
|
231
|
+
11
|
232
|
+
12
|
233
|
+
13
|
234
|
+
14
|
235
|
+
15
|
236
|
+
16
|
237
|
+
17
|
238
|
+
18
|
239
|
+
19
|
240
|
+
20
|
241
|
+
21
|
242
|
+
22
|
243
|
+
23
|
244
|
+
24
|
245
|
+
25
|
246
|
+
26
|
247
|
+
27
|
248
|
+
28
|
249
|
+
29
|
250
|
+
30</pre>
|
251
|
+
</td>
|
252
|
+
<td>
|
253
|
+
<pre class="code"><span class="info file"># File 'lib/dtf.rb', line 9</span>
|
254
|
+
|
255
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_user'>create_user</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='rparen'>)</span>
|
256
|
+
<span class='kw'>if</span> <span class='lbracket'>[</span><span class='symbol'>:user_name_given</span><span class='comma'>,</span> <span class='symbol'>:full_name_given</span><span class='comma'>,</span> <span class='symbol'>:email_address_given</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sym'>sym</span><span class='op'>|</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>then</span>
|
257
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>user_name:</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
258
|
+
<span class='label'>full_name:</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:full_name</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
259
|
+
<span class='label'>email_address:</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:email_address</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first_or_create'>first_or_create</span>
|
260
|
+
|
261
|
+
<span class='comment'># Check to make sure user was actually saved to the db
|
262
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_persisted?'>persisted?</span> <span class='kw'>then</span>
|
263
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Created user \'</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\' for \'</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:full_name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\'</span><span class='tstring_end'>"</span></span>
|
264
|
+
<span class='kw'>else</span>
|
265
|
+
<span class='comment'># Oops, it wasn't! Notify user and display any error message(s)
|
266
|
+
</span> <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ERROR: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'> was NOT created! Please fix the following errors and try again:</span><span class='tstring_end'>"</span></span>
|
267
|
+
<span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_messages'>messages</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
|
268
|
+
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_messages'>messages</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'>!</span><span class='tstring_end'>"</span></span>
|
269
|
+
<span class='kw'>end</span>
|
270
|
+
<span class='comment'># Now throw a proper error code to the system, while exiting the script
|
271
|
+
</span> <span class='id identifier rubyid_abort'>abort</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
272
|
+
<span class='kw'>end</span>
|
273
|
+
<span class='kw'>else</span>
|
274
|
+
<span class='id identifier rubyid_raise_error'>raise_error</span> <span class='comment'># This error here is thrown when not all params are provided
|
275
|
+
</span> <span class='kw'>end</span>
|
276
|
+
<span class='kw'>end</span></pre>
|
277
|
+
</td>
|
278
|
+
</tr>
|
279
|
+
</table>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div class="method_details ">
|
283
|
+
<h3 class="signature " id="create_vs-class_method">
|
284
|
+
|
285
|
+
+ (<tt>Object</tt>) <strong>create_vs</strong>(cmd_opts)
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
</h3><table class="source_code">
|
292
|
+
<tr>
|
293
|
+
<td>
|
294
|
+
<pre class="lines">
|
295
|
+
|
296
|
+
|
297
|
+
62
|
298
|
+
63
|
299
|
+
64
|
300
|
+
65
|
301
|
+
66
|
302
|
+
67
|
303
|
+
68
|
304
|
+
69
|
305
|
+
70
|
306
|
+
71
|
307
|
+
72
|
308
|
+
73
|
309
|
+
74
|
310
|
+
75</pre>
|
311
|
+
</td>
|
312
|
+
<td>
|
313
|
+
<pre class="code"><span class="info file"># File 'lib/dtf.rb', line 62</span>
|
314
|
+
|
315
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_vs'>create_vs</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='rparen'>)</span>
|
316
|
+
<span class='kw'>if</span> <span class='lbracket'>[</span><span class='symbol'>:user_name_given</span><span class='comma'>,</span> <span class='symbol'>:name_given</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sym'>sym</span><span class='op'>|</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>then</span>
|
317
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_user_name'>find_by_user_name</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
318
|
+
<span class='id identifier rubyid_vs'>vs</span> <span class='op'>=</span> <span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_verification_suites'>verification_suites</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>description:</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:description</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
319
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_vs'>vs</span><span class='period'>.</span><span class='id identifier rubyid_persisted?'>persisted?</span> <span class='kw'>then</span>
|
320
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>VS named \'</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\' allocated to user \'</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\'</span><span class='tstring_end'>"</span></span>
|
321
|
+
<span class='kw'>else</span>
|
322
|
+
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ERROR: Failed to save Verification Suite. Check DB logfile for errors</span><span class='tstring_end'>"</span></span>
|
323
|
+
<span class='id identifier rubyid_abort'>abort</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
324
|
+
<span class='kw'>end</span>
|
325
|
+
<span class='kw'>else</span>
|
326
|
+
<span class='id identifier rubyid_raise_error'>raise_error</span>
|
327
|
+
<span class='kw'>end</span>
|
328
|
+
<span class='kw'>end</span></pre>
|
329
|
+
</td>
|
330
|
+
</tr>
|
331
|
+
</table>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
<div class="method_details ">
|
335
|
+
<h3 class="signature " id="delete_user-class_method">
|
336
|
+
|
337
|
+
+ (<tt>Object</tt>) <strong>delete_user</strong>(cmd, cmd_opts)
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
</h3><table class="source_code">
|
344
|
+
<tr>
|
345
|
+
<td>
|
346
|
+
<pre class="lines">
|
347
|
+
|
348
|
+
|
349
|
+
32
|
350
|
+
33
|
351
|
+
34
|
352
|
+
35
|
353
|
+
36
|
354
|
+
37
|
355
|
+
38
|
356
|
+
39
|
357
|
+
40
|
358
|
+
41
|
359
|
+
42
|
360
|
+
43
|
361
|
+
44
|
362
|
+
45
|
363
|
+
46
|
364
|
+
47
|
365
|
+
48
|
366
|
+
49
|
367
|
+
50
|
368
|
+
51
|
369
|
+
52
|
370
|
+
53
|
371
|
+
54
|
372
|
+
55
|
373
|
+
56
|
374
|
+
57
|
375
|
+
58
|
376
|
+
59
|
377
|
+
60</pre>
|
378
|
+
</td>
|
379
|
+
<td>
|
380
|
+
<pre class="code"><span class="info file"># File 'lib/dtf.rb', line 32</span>
|
381
|
+
|
382
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_user'>delete_user</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd'>cmd</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='rparen'>)</span>
|
383
|
+
<span class='kw'>if</span> <span class='lbracket'>[</span><span class='symbol'>:user_name_given</span><span class='comma'>,</span> <span class='symbol'>:delete_all</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sym'>sym</span><span class='op'>|</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>then</span>
|
384
|
+
<span class='comment'># NOTE: :delete_all is 'true' by default. passing '--no-delete-all' sets it to false,
|
385
|
+
</span> <span class='comment'># and adds the :delete_all_given key to the cmd_opts hash, set to true.
|
386
|
+
</span> <span class='comment'># This means NOT to delete all VSs associated with this user. We delete them by default.
|
387
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:delete_all</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>false</span> <span class='op'>&&</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:delete_all_given</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>true</span>
|
388
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'> called with '--no-delete-all' set! NOT deleting all owned VSs!</span><span class='tstring_end'>"</span></span>
|
389
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Reassigning VSs to Library. New owner will be \'Library Owner\'</span><span class='tstring_end'>"</span></span>
|
390
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_user_name'>find_by_user_name</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
391
|
+
<span class='id identifier rubyid_lib_owner'>lib_owner</span> <span class='op'>=</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_user_name'>find_by_user_name</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>library_owner</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
392
|
+
<span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_verification_suites'>verification_suites</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_vs'>vs</span><span class='op'>|</span>
|
393
|
+
<span class='id identifier rubyid_vs'>vs</span><span class='period'>.</span><span class='id identifier rubyid_user_id'>user_id</span> <span class='op'>=</span> <span class='id identifier rubyid_lib_owner'>lib_owner</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
|
394
|
+
<span class='id identifier rubyid_vs'>vs</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span>
|
395
|
+
<span class='kw'>end</span>
|
396
|
+
<span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
|
397
|
+
<span class='kw'>else</span>
|
398
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'> called with '--delete-all' set or on by default! Deleting all VSs owned by </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
399
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_user_name'>find_by_user_name</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
400
|
+
<span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_verification_suites'>verification_suites</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_vs'>vs</span><span class='op'>|</span>
|
401
|
+
<span class='const'>VerificationSuite</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_vs'>vs</span><span class='rparen'>)</span>
|
402
|
+
<span class='kw'>end</span>
|
403
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_verification_suites'>verification_suites</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>then</span>
|
404
|
+
<span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
|
405
|
+
<span class='kw'>end</span>
|
406
|
+
<span class='kw'>end</span>
|
407
|
+
<span class='kw'>else</span>
|
408
|
+
<span class='id identifier rubyid_raise_error'>raise_error</span>
|
409
|
+
<span class='kw'>end</span>
|
410
|
+
<span class='kw'>end</span></pre>
|
411
|
+
</td>
|
412
|
+
</tr>
|
413
|
+
</table>
|
414
|
+
</div>
|
415
|
+
|
416
|
+
<div class="method_details ">
|
417
|
+
<h3 class="signature " id="delete_vs-class_method">
|
418
|
+
|
419
|
+
+ (<tt>Object</tt>) <strong>delete_vs</strong>(cmd, cmd_opts)
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
</h3><table class="source_code">
|
426
|
+
<tr>
|
427
|
+
<td>
|
428
|
+
<pre class="lines">
|
429
|
+
|
430
|
+
|
431
|
+
77
|
432
|
+
78
|
433
|
+
79
|
434
|
+
80
|
435
|
+
81
|
436
|
+
82
|
437
|
+
83
|
438
|
+
84
|
439
|
+
85
|
440
|
+
86</pre>
|
441
|
+
</td>
|
442
|
+
<td>
|
443
|
+
<pre class="code"><span class="info file"># File 'lib/dtf.rb', line 77</span>
|
444
|
+
|
445
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_vs'>delete_vs</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd'>cmd</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='rparen'>)</span>
|
446
|
+
<span class='kw'>if</span> <span class='lbracket'>[</span><span class='symbol'>:user_name_given</span><span class='comma'>,</span> <span class='symbol'>:id_given</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sym'>sym</span><span class='op'>|</span> <span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>then</span>
|
447
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rbrace'>}</span><span class='tstring_content'> called! Deleting </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\'s VS with ID \'</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\'</span><span class='tstring_end'>"</span></span>
|
448
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_user_name'>find_by_user_name</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:user_name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
449
|
+
<span class='id identifier rubyid_vs'>vs</span> <span class='op'>=</span> <span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_verification_suites'>verification_suites</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_opts'>cmd_opts</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
450
|
+
<span class='const'>VerificationSuite</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_vs'>vs</span><span class='rparen'>)</span>
|
451
|
+
<span class='kw'>else</span>
|
452
|
+
<span class='id identifier rubyid_raise_error'>raise_error</span>
|
453
|
+
<span class='kw'>end</span>
|
454
|
+
<span class='kw'>end</span></pre>
|
455
|
+
</td>
|
456
|
+
</tr>
|
457
|
+
</table>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
</div>
|
461
|
+
|
462
|
+
</div>
|
463
|
+
|
464
|
+
<div id="footer">
|
465
|
+
Generated on Fri Sep 14 22:41:21 2012 by
|
466
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
467
|
+
0.8.2.1 (ruby-1.9.3).
|
468
|
+
</div>
|
469
|
+
|
470
|
+
</body>
|
471
|
+
</html>
|