standup_md 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,7 +67,18 @@
67
67
 
68
68
  </div>
69
69
 
70
-
70
+ <div id="includes-section" class="nav-section">
71
+ <h3>Included Modules</h3>
72
+
73
+ <ul class="link-list">
74
+
75
+
76
+ <li><a class="include" href="Cli/Helpers.html">StandupMD::Cli::Helpers</a>
77
+
78
+
79
+ </ul>
80
+ </div>
81
+
71
82
 
72
83
  <!-- Method Quickref -->
73
84
  <div id="method-list-section" class="nav-section">
@@ -75,39 +86,21 @@
75
86
 
76
87
  <ul class="link-list" role="directory">
77
88
 
78
- <li ><a href="#method-c-execute">::execute</a>
89
+ <li ><a href="#method-c-config">::config</a>
79
90
 
80
- <li ><a href="#method-c-new">::new</a>
91
+ <li ><a href="#method-c-echo">::echo</a>
81
92
 
82
- <li ><a href="#method-i-append_previous-3F">#append_previous?</a>
93
+ <li ><a href="#method-c-execute">::execute</a>
83
94
 
84
- <li ><a href="#method-i-append_to_previous_entry_tasks">#append_to_previous_entry_tasks</a>
95
+ <li ><a href="#method-c-new">::new</a>
85
96
 
86
97
  <li ><a href="#method-i-echo">#echo</a>
87
98
 
88
99
  <li ><a href="#method-i-edit">#edit</a>
89
100
 
90
- <li ><a href="#method-i-edit-3F">#edit?</a>
91
-
92
- <li ><a href="#method-i-editor">#editor</a>
93
-
94
- <li ><a href="#method-i-json-3F">#json?</a>
95
-
96
- <li ><a href="#method-i-print_all_entries">#print_all_entries</a>
97
-
98
- <li ><a href="#method-i-print_all_entries-3F">#print_all_entries?</a>
99
-
100
- <li ><a href="#method-i-print_current_entry">#print_current_entry</a>
101
-
102
- <li ><a href="#method-i-print_current_entry-3F">#print_current_entry?</a>
103
-
104
- <li ><a href="#method-i-should_append-3F">#should_append?</a>
105
-
106
- <li ><a href="#method-i-standup">#standup</a>
107
-
108
- <li ><a href="#method-i-verbose-3F">#verbose?</a>
101
+ <li ><a href="#method-i-load_preferences">#load_preferences</a>
109
102
 
110
- <li ><a href="#method-i-write-3F">#write?</a>
103
+ <li ><a href="#method-i-preference_file_loaded-3F">#preference_file_loaded?</a>
111
104
 
112
105
  <li ><a href="#method-i-write_file">#write_file</a>
113
106
 
@@ -135,20 +128,6 @@
135
128
 
136
129
 
137
130
 
138
- <section class="constants-list">
139
- <header>
140
- <h3>Constants</h3>
141
- </header>
142
- <dl>
143
-
144
- <dt id="PREFERENCE_FILE">PREFERENCE_FILE
145
-
146
- <dd><p>The user&#39;s preference file.</p>
147
-
148
-
149
- </dl>
150
- </section>
151
-
152
131
 
153
132
 
154
133
  <section class="attribute-method-details" class="method-section">
@@ -157,140 +136,65 @@
157
136
  </header>
158
137
 
159
138
 
160
- <div id="attribute-i-options" class="method-detail">
139
+ <div id="attribute-i-entry" class="method-detail">
161
140
  <div class="method-heading attribute-method-heading">
162
- <span class="method-name">options</span><span
141
+ <span class="method-name">entry</span><span
163
142
  class="attribute-access-type">[R]</span>
164
143
  </div>
165
144
 
166
145
  <div class="method-description">
167
146
 
168
- <p>Arguments passed at runtime.</p>
147
+ <p>The entry searched for, usually today.</p>
169
148
 
170
- <p>@return [Array] ARGV</p>
149
+ <p>@return [StandupMD::Entry]</p>
171
150
 
172
151
  </div>
173
152
  </div>
174
153
 
175
- <div id="attribute-i-preferences" class="method-detail">
154
+ <div id="attribute-i-file" class="method-detail">
176
155
  <div class="method-heading attribute-method-heading">
177
- <span class="method-name">preferences</span><span
156
+ <span class="method-name">file</span><span
178
157
  class="attribute-access-type">[R]</span>
179
158
  </div>
180
159
 
181
160
  <div class="method-description">
182
161
 
183
- <p>Preferences after reading config file and parsing ARGV.</p>
162
+ <p>The file loaded.</p>
184
163
 
185
- <p>@return [Array]</p>
164
+ <p>@return [StandupMD::File]</p>
186
165
 
187
166
  </div>
188
167
  </div>
189
168
 
190
- </section>
191
-
192
-
193
-
194
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
195
- <header>
196
- <h3>Public Class Methods</h3>
197
- </header>
198
-
199
-
200
- <div id="method-c-execute" class="method-detail ">
201
-
202
- <div class="method-heading">
203
- <span class="method-name">execute</span><span
204
- class="method-args">(options = [])</span>
205
-
206
- <span class="method-click-advice">click to toggle source</span>
207
-
169
+ <div id="attribute-i-options" class="method-detail">
170
+ <div class="method-heading attribute-method-heading">
171
+ <span class="method-name">options</span><span
172
+ class="attribute-access-type">[R]</span>
208
173
  </div>
209
-
210
174
 
211
175
  <div class="method-description">
212
-
213
- <p>Creates an instance of <code>StandupMD</code> and runs what the user requested.</p>
214
-
215
-
216
-
217
-
218
- <div class="method-source-code" id="execute-source">
219
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 17</span>
220
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">execute</span>(<span class="ruby-identifier">options</span> = [])
221
- <span class="ruby-identifier">exe</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
222
- <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">append_to_previous_entry_tasks</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">should_append?</span>
223
-
224
- <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">print_current_entry</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">print_current_entry?</span>
225
- <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">print_all_entries</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">print_all_entries?</span>
226
- <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">write_file</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">write?</span>
227
- <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">edit</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">edit?</span>
228
- <span class="ruby-keyword">end</span></pre>
229
- </div>
230
-
231
- </div>
232
-
233
176
 
177
+ <p>Arguments passed at runtime.</p>
234
178
 
179
+ <p>@return [Array] ARGV</p>
235
180
 
236
- </div>
237
-
238
-
239
- <div id="method-c-new" class="method-detail ">
240
-
241
- <div class="method-heading">
242
- <span class="method-name">new</span><span
243
- class="method-args">(options)</span>
244
-
245
- <span class="method-click-advice">click to toggle source</span>
246
-
247
- </div>
248
-
249
-
250
- <div class="method-description">
251
-
252
- <p>Constructor. Sets defaults.</p>
253
-
254
- <p>@param [Array] options</p>
255
-
256
-
257
-
258
-
259
- <div class="method-source-code" id="new-source">
260
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 43</span>
261
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">options</span>)
262
- <span class="ruby-ivar">@edit</span> = <span class="ruby-keyword">true</span>
263
- <span class="ruby-ivar">@write</span> = <span class="ruby-keyword">true</span>
264
- <span class="ruby-ivar">@append_previous</span> = <span class="ruby-keyword">true</span>
265
- <span class="ruby-ivar">@print_current_entry</span> = <span class="ruby-keyword">false</span>
266
- <span class="ruby-ivar">@json</span> = <span class="ruby-keyword">false</span>
267
- <span class="ruby-ivar">@verbose</span> = <span class="ruby-keyword">false</span>
268
- <span class="ruby-ivar">@print_all_entries</span> = <span class="ruby-keyword">false</span>
269
- <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
270
- <span class="ruby-ivar">@preferences</span> = <span class="ruby-identifier">get_preferences</span>
271
- <span class="ruby-keyword">end</span></pre>
272
- </div>
273
-
274
181
  </div>
275
-
276
-
277
-
278
-
279
182
  </div>
183
+
184
+ </section>
185
+
280
186
 
281
187
 
282
- </section>
283
-
284
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
188
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
285
189
  <header>
286
- <h3>Public Instance Methods</h3>
190
+ <h3>Public Class Methods</h3>
287
191
  </header>
288
192
 
289
193
 
290
- <div id="method-i-append_previous-3F" class="method-detail ">
194
+ <div id="method-c-config" class="method-detail ">
291
195
 
292
196
  <div class="method-heading">
293
- <span class="method-name">append_previous?</span><span
197
+ <span class="method-name">config</span><span
294
198
  class="method-args">()</span>
295
199
 
296
200
  <span class="method-click-advice">click to toggle source</span>
@@ -300,54 +204,17 @@
300
204
 
301
205
  <div class="method-description">
302
206
 
303
- <p>Should `previous_entry_tasks` be appended? If false, <code>previous_entry_tasks</code> will be overwritten.</p>
207
+ <p>Access to the class&#39;s configuration.</p>
304
208
 
305
- <p>@return [Boolean] Default is true</p>
209
+ <p>@return [StandupMD::Config::Cli]</p>
306
210
 
307
211
 
308
212
 
309
213
 
310
- <div class="method-source-code" id="append_previous-3F-source">
311
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 207</span>
312
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append_previous?</span>
313
- <span class="ruby-ivar">@append_previous</span>
314
- <span class="ruby-keyword">end</span></pre>
315
- </div>
316
-
317
- </div>
318
-
319
-
320
-
321
-
322
- </div>
323
-
324
-
325
- <div id="method-i-append_to_previous_entry_tasks" class="method-detail ">
326
-
327
- <div class="method-heading">
328
- <span class="method-name">append_to_previous_entry_tasks</span><span
329
- class="method-args">()</span>
330
-
331
- <span class="method-click-advice">click to toggle source</span>
332
-
333
- </div>
334
-
335
-
336
- <div class="method-description">
337
-
338
- <p>Appends entries passed at runtime to existing previous entries.</p>
339
-
340
- <p>@return [Hash]</p>
341
-
342
-
343
-
344
-
345
- <div class="method-source-code" id="append_to_previous_entry_tasks-source">
346
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 132</span>
347
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append_to_previous_entry_tasks</span>
348
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39;Appending previous entry tasks&#39;</span>
349
- <span class="ruby-identifier">additions</span> = <span class="ruby-identifier">preferences</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">&#39;previous_entry_tasks&#39;</span>)
350
- <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">previous_entry_tasks</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">additions</span>)
214
+ <div class="method-source-code" id="config-source">
215
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 17</span>
216
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">config</span>
217
+ <span class="ruby-ivar">@config</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">cli</span>
351
218
  <span class="ruby-keyword">end</span></pre>
352
219
  </div>
353
220
 
@@ -359,7 +226,7 @@
359
226
  </div>
360
227
 
361
228
 
362
- <div id="method-i-echo" class="method-detail ">
229
+ <div id="method-c-echo" class="method-detail ">
363
230
 
364
231
  <div class="method-heading">
365
232
  <span class="method-name">echo</span><span
@@ -380,9 +247,9 @@
380
247
 
381
248
 
382
249
  <div class="method-source-code" id="echo-source">
383
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 223</span>
384
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">echo</span>(<span class="ruby-identifier">msg</span>)
385
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose?</span>
250
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 25</span>
251
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">echo</span>(<span class="ruby-identifier">msg</span>)
252
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">verbose</span>
386
253
  <span class="ruby-keyword">end</span></pre>
387
254
  </div>
388
255
 
@@ -394,11 +261,11 @@
394
261
  </div>
395
262
 
396
263
 
397
- <div id="method-i-edit" class="method-detail ">
264
+ <div id="method-c-execute" class="method-detail ">
398
265
 
399
266
  <div class="method-heading">
400
- <span class="method-name">edit</span><span
401
- class="method-args">()</span>
267
+ <span class="method-name">execute</span><span
268
+ class="method-args">(options = [])</span>
402
269
 
403
270
  <span class="method-click-advice">click to toggle source</span>
404
271
 
@@ -407,51 +274,22 @@
407
274
 
408
275
  <div class="method-description">
409
276
 
410
- <p>Opens the file in an editor. Abandons the script.</p>
411
-
412
-
413
-
414
-
415
- <div class="method-source-code" id="edit-source">
416
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 140</span>
417
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">edit</span>
418
- <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Opening file in #{editor}&quot;</span>
419
- <span class="ruby-identifier">exec</span>(<span class="ruby-node">&quot;#{editor} #{standup.file}&quot;</span>)
420
- <span class="ruby-keyword">end</span></pre>
421
- </div>
422
-
423
- </div>
424
-
425
-
426
-
427
-
428
- </div>
429
-
430
-
431
- <div id="method-i-edit-3F" class="method-detail ">
432
-
433
- <div class="method-heading">
434
- <span class="method-name">edit?</span><span
435
- class="method-args">()</span>
436
-
437
- <span class="method-click-advice">click to toggle source</span>
277
+ <p>Creates an instance of <code>StandupMD</code> and runs what the user requested.</p>
438
278
 
439
- </div>
440
-
441
-
442
- <div class="method-description">
443
279
 
444
- <p>Should the standup file be opened in the editor?</p>
445
280
 
446
- <p>@return [Boolean] Default is true</p>
447
-
448
281
 
282
+ <div class="method-source-code" id="execute-source">
283
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 31</span>
284
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">execute</span>(<span class="ruby-identifier">options</span> = [])
285
+ <span class="ruby-identifier">exe</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
449
286
 
450
-
451
- <div class="method-source-code" id="edit-3F-source">
452
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 198</span>
453
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">edit?</span>
454
- <span class="ruby-ivar">@edit</span>
287
+ <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">write_file</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">write</span>
288
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">print</span>
289
+ <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">exe</span>.<span class="ruby-identifier">entry</span>)
290
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">edit</span>
291
+ <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">edit</span>
292
+ <span class="ruby-keyword">end</span>
455
293
  <span class="ruby-keyword">end</span></pre>
456
294
  </div>
457
295
 
@@ -463,11 +301,11 @@
463
301
  </div>
464
302
 
465
303
 
466
- <div id="method-i-editor" class="method-detail ">
304
+ <div id="method-c-new" class="method-detail ">
467
305
 
468
306
  <div class="method-heading">
469
- <span class="method-name">editor</span><span
470
- class="method-args">()</span>
307
+ <span class="method-name">new</span><span
308
+ class="method-args">(options = [], load_config = true)</span>
471
309
 
472
310
  <span class="method-click-advice">click to toggle source</span>
473
311
 
@@ -476,30 +314,24 @@
476
314
 
477
315
  <div class="method-description">
478
316
 
479
- <p>Tries to determine the editor, first by checking if the user has one set in their preferences. If not, the <code>VISUAL</code> and <code>EDITOR</code> environmental variables are checked. If none of the above are set, defaults to <code>vim</code>.</p>
317
+ <p>Constructor. Sets defaults.</p>
480
318
 
481
- <p>@return [String] The editor</p>
319
+ <p>@param [Array] options</p>
482
320
 
483
321
 
484
322
 
485
323
 
486
- <div class="method-source-code" id="editor-source">
487
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 80</span>
488
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">editor</span>
489
- <span class="ruby-ivar">@editor</span> <span class="ruby-operator">||=</span>
490
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">preferences</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-string">&#39;editor&#39;</span>)
491
- <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Editor set to [#{preferences.key(&#39;editor&#39;)}] via preferences&quot;</span>
492
- <span class="ruby-identifier">preferences</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">&#39;editor&#39;</span>)
493
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;VISUAL&#39;</span>]
494
- <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Editor set to [#{ENV[&#39;VISUAL&#39;]}] (ENV[&#39;VISUAL&#39;])&quot;</span>
495
- <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;VISUAL&#39;</span>]
496
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;EDITOR&#39;</span>]
497
- <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Editor set to [#{ENV[&#39;EDITOR&#39;]}] (ENV[&#39;EDITOR&#39;])&quot;</span>
498
- <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;EDITOR&#39;</span>]
499
- <span class="ruby-keyword">else</span>
500
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&quot;Editor set to [vim] (default)&quot;</span>
501
- <span class="ruby-string">&#39;vim&#39;</span>
502
- <span class="ruby-keyword">end</span>
324
+ <div class="method-source-code" id="new-source">
325
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 64</span>
326
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">options</span> = [], <span class="ruby-identifier">load_config</span> = <span class="ruby-keyword">true</span>)
327
+ <span class="ruby-ivar">@config</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">config</span>
328
+ <span class="ruby-ivar">@preference_file_loaded</span> = <span class="ruby-keyword">false</span>
329
+ <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
330
+ <span class="ruby-identifier">load_preferences</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">load_config</span>
331
+ <span class="ruby-identifier">set_preferences</span>(<span class="ruby-identifier">options</span>)
332
+ <span class="ruby-ivar">@file</span> = <span class="ruby-constant">StandupMD</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">find_by_date</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">date</span>)
333
+ <span class="ruby-ivar">@file</span>.<span class="ruby-identifier">load</span>
334
+ <span class="ruby-ivar">@entry</span> = <span class="ruby-identifier">set_entry</span>(<span class="ruby-ivar">@file</span>)
503
335
  <span class="ruby-keyword">end</span></pre>
504
336
  </div>
505
337
 
@@ -511,46 +343,19 @@
511
343
  </div>
512
344
 
513
345
 
514
- <div id="method-i-json-3F" class="method-detail ">
515
-
516
- <div class="method-heading">
517
- <span class="method-name">json?</span><span
518
- class="method-args">()</span>
519
-
520
- <span class="method-click-advice">click to toggle source</span>
521
-
522
- </div>
523
-
524
-
525
- <div class="method-description">
526
-
527
- <p>If printing an entry, should it be printed as json?</p>
528
-
529
- <p>@return [Boolean] Default is false</p>
530
-
531
-
532
-
533
-
534
- <div class="method-source-code" id="json-3F-source">
535
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 166</span>
536
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">json?</span>
537
- <span class="ruby-ivar">@json</span>
538
- <span class="ruby-keyword">end</span></pre>
539
- </div>
540
-
541
- </div>
542
-
543
-
544
-
545
-
546
- </div>
346
+ </section>
347
+
348
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
349
+ <header>
350
+ <h3>Public Instance Methods</h3>
351
+ </header>
547
352
 
548
353
 
549
- <div id="method-i-print_all_entries" class="method-detail ">
354
+ <div id="method-i-echo" class="method-detail ">
550
355
 
551
356
  <div class="method-heading">
552
- <span class="method-name">print_all_entries</span><span
553
- class="method-args">()</span>
357
+ <span class="method-name">echo</span><span
358
+ class="method-args">(msg)</span>
554
359
 
555
360
  <span class="method-click-advice">click to toggle source</span>
556
361
 
@@ -559,25 +364,17 @@
559
364
 
560
365
  <div class="method-description">
561
366
 
562
- <p>Prints all entries to the command line.</p>
367
+ <p>Quick access to <a href="Cli.html#method-c-echo"><code>Cli.echo</code></a>.</p>
563
368
 
564
369
  <p>@return [nil]</p>
565
370
 
566
371
 
567
372
 
568
373
 
569
- <div class="method-source-code" id="print_all_entries-source">
570
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 101</span>
571
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_all_entries</span>
572
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39;Display all entries&#39;</span>
573
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">json?</span>
574
- <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">all_entries</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span><span class="ruby-operator">|</span>
575
- <span class="ruby-identifier">print_entry</span>(<span class="ruby-identifier">head</span>, <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">all_entries</span>[<span class="ruby-identifier">head</span>])
576
- <span class="ruby-keyword">end</span>
577
- <span class="ruby-keyword">return</span>
578
- <span class="ruby-keyword">end</span>
579
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39; ...as json&#39;</span>
580
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">all_entries</span>.<span class="ruby-identifier">to_json</span>
374
+ <div class="method-source-code" id="echo-source">
375
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 118</span>
376
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">echo</span>(<span class="ruby-identifier">msg</span>)
377
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">echo</span>(<span class="ruby-identifier">msg</span>)
581
378
  <span class="ruby-keyword">end</span></pre>
582
379
  </div>
583
380
 
@@ -589,10 +386,10 @@
589
386
  </div>
590
387
 
591
388
 
592
- <div id="method-i-print_all_entries-3F" class="method-detail ">
389
+ <div id="method-i-edit" class="method-detail ">
593
390
 
594
391
  <div class="method-heading">
595
- <span class="method-name">print_all_entries?</span><span
392
+ <span class="method-name">edit</span><span
596
393
  class="method-args">()</span>
597
394
 
598
395
  <span class="method-click-advice">click to toggle source</span>
@@ -602,17 +399,18 @@
602
399
 
603
400
  <div class="method-description">
604
401
 
605
- <p>Should all entries be printed? If true, disables editing.</p>
402
+ <p>Opens the file in an editor. Abandons the script.</p>
606
403
 
607
- <p>@return [Boolean] Default is false</p>
404
+ <p>@return [nil]</p>
608
405
 
609
406
 
610
407
 
611
408
 
612
- <div class="method-source-code" id="print_all_entries-3F-source">
613
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 174</span>
614
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_all_entries?</span>
615
- <span class="ruby-ivar">@print_all_entries</span>
409
+ <div class="method-source-code" id="edit-source">
410
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 100</span>
411
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">edit</span>
412
+ <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Opening file in #{@config.editor}&quot;</span>
413
+ <span class="ruby-identifier">exec</span>(<span class="ruby-node">&quot;#{@config.editor} #{file.name}&quot;</span>)
616
414
  <span class="ruby-keyword">end</span></pre>
617
415
  </div>
618
416
 
@@ -624,10 +422,10 @@
624
422
  </div>
625
423
 
626
424
 
627
- <div id="method-i-print_current_entry" class="method-detail ">
425
+ <div id="method-i-load_preferences" class="method-detail ">
628
426
 
629
427
  <div class="method-heading">
630
- <span class="method-name">print_current_entry</span><span
428
+ <span class="method-name">load_preferences</span><span
631
429
  class="method-args">()</span>
632
430
 
633
431
  <span class="method-click-advice">click to toggle source</span>
@@ -637,175 +435,22 @@
637
435
 
638
436
  <div class="method-description">
639
437
 
640
- <p>Prints the current entry to the command line.</p>
438
+ <p>Load the preference file.</p>
641
439
 
642
440
  <p>@return [nil]</p>
643
441
 
644
442
 
645
443
 
646
444
 
647
- <div class="method-source-code" id="print_current_entry-source">
648
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 117</span>
649
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_current_entry</span>
650
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39;Print current entry&#39;</span>
651
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">json?</span>
652
- <span class="ruby-identifier">print_entry</span>(<span class="ruby-identifier">standup</span>.<span class="ruby-identifier">header</span>, <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">current_entry</span>)
653
- <span class="ruby-keyword">return</span>
445
+ <div class="method-source-code" id="load_preferences-source">
446
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 79</span>
447
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load_preferences</span>
448
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">preference_file</span>)
449
+ <span class="ruby-operator">::</span><span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">load_config_file</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">preference_file</span>)
450
+ <span class="ruby-ivar">@preference_file_loaded</span> = <span class="ruby-keyword">true</span>
451
+ <span class="ruby-keyword">else</span>
452
+ <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Preference file #{@config.preference_file} does not exist.&quot;</span>
654
453
  <span class="ruby-keyword">end</span>
655
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39; ...as json&#39;</span>
656
- <span class="ruby-identifier">entry</span> = {<span class="ruby-identifier">standup</span>.<span class="ruby-identifier">header</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">current_entry</span>}.<span class="ruby-identifier">to_json</span>
657
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">entry</span>
658
- <span class="ruby-keyword">end</span></pre>
659
- </div>
660
-
661
- </div>
662
-
663
-
664
-
665
-
666
- </div>
667
-
668
-
669
- <div id="method-i-print_current_entry-3F" class="method-detail ">
670
-
671
- <div class="method-heading">
672
- <span class="method-name">print_current_entry?</span><span
673
- class="method-args">()</span>
674
-
675
- <span class="method-click-advice">click to toggle source</span>
676
-
677
- </div>
678
-
679
-
680
- <div class="method-description">
681
-
682
- <p>Should current entry be printed? If true, disables editing.</p>
683
-
684
- <p>@return [Boolean] Default is false</p>
685
-
686
-
687
-
688
-
689
- <div class="method-source-code" id="print_current_entry-3F-source">
690
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 158</span>
691
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_current_entry?</span>
692
- <span class="ruby-ivar">@print_current_entry</span>
693
- <span class="ruby-keyword">end</span></pre>
694
- </div>
695
-
696
- </div>
697
-
698
-
699
-
700
-
701
- </div>
702
-
703
-
704
- <div id="method-i-should_append-3F" class="method-detail ">
705
-
706
- <div class="method-heading">
707
- <span class="method-name">should_append?</span><span
708
- class="method-args">()</span>
709
-
710
- <span class="method-click-advice">click to toggle source</span>
711
-
712
- </div>
713
-
714
-
715
- <div class="method-description">
716
-
717
- <p>Did the user pass <code>previous_entry_tasks</code>, and should we append?</p>
718
-
719
- <p>@return [Boolean]</p>
720
-
721
-
722
-
723
-
724
- <div class="method-source-code" id="should_append-3F-source">
725
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 215</span>
726
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">should_append?</span>
727
- <span class="ruby-identifier">preferences</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-string">&#39;previous_entry_tasks&#39;</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">append_previous?</span>
728
- <span class="ruby-keyword">end</span></pre>
729
- </div>
730
-
731
- </div>
732
-
733
-
734
-
735
-
736
- </div>
737
-
738
-
739
- <div id="method-i-standup" class="method-detail ">
740
-
741
- <div class="method-heading">
742
- <span class="method-name">standup</span><span
743
- class="method-args">()</span>
744
-
745
- <span class="method-click-advice">click to toggle source</span>
746
-
747
- </div>
748
-
749
-
750
- <div class="method-description">
751
-
752
- <p>Sets up an instance of <code>StandupMD</code> and passes all user preferences.</p>
753
-
754
- <p>@return [StandupMD]</p>
755
-
756
-
757
-
758
-
759
- <div class="method-source-code" id="standup-source">
760
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 59</span>
761
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">standup</span>
762
- <span class="ruby-identifier">cf</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-constant">PREFERENCE_FILE</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">PREFERENCE_FILE</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
763
- <span class="ruby-ivar">@standup</span> <span class="ruby-operator">||=</span> <span class="ruby-operator">::</span><span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cf</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
764
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">any?</span>
765
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39;Config options:&#39;</span>
766
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot; #{k} = #{v}&quot;</span> }
767
- <span class="ruby-keyword">end</span>
768
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39;Runtime options:&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">preferences</span>.<span class="ruby-identifier">any?</span>
769
- <span class="ruby-identifier">preferences</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
770
- <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot; #{k} = #{v}&quot;</span>
771
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{k}=&quot;</span>, <span class="ruby-identifier">v</span>)
772
- <span class="ruby-keyword">end</span>
773
- <span class="ruby-keyword">end</span>.<span class="ruby-identifier">load</span>
774
- <span class="ruby-keyword">end</span></pre>
775
- </div>
776
-
777
- </div>
778
-
779
-
780
-
781
-
782
- </div>
783
-
784
-
785
- <div id="method-i-verbose-3F" class="method-detail ">
786
-
787
- <div class="method-heading">
788
- <span class="method-name">verbose?</span><span
789
- class="method-args">()</span>
790
-
791
- <span class="method-click-advice">click to toggle source</span>
792
-
793
- </div>
794
-
795
-
796
- <div class="method-description">
797
-
798
- <p>Should debug info be printed?</p>
799
-
800
- <p>@return [Boolean] Default is false</p>
801
-
802
-
803
-
804
-
805
- <div class="method-source-code" id="verbose-3F-source">
806
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 182</span>
807
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">verbose?</span>
808
- <span class="ruby-ivar">@verbose</span>
809
454
  <span class="ruby-keyword">end</span></pre>
810
455
  </div>
811
456
 
@@ -817,10 +462,10 @@
817
462
  </div>
818
463
 
819
464
 
820
- <div id="method-i-write-3F" class="method-detail ">
465
+ <div id="method-i-preference_file_loaded-3F" class="method-detail ">
821
466
 
822
467
  <div class="method-heading">
823
- <span class="method-name">write?</span><span
468
+ <span class="method-name">preference_file_loaded?</span><span
824
469
  class="method-args">()</span>
825
470
 
826
471
  <span class="method-click-advice">click to toggle source</span>
@@ -830,17 +475,17 @@
830
475
 
831
476
  <div class="method-description">
832
477
 
833
- <p>Should the file be written?</p>
478
+ <p>Has the preference file been loaded?</p>
834
479
 
835
- <p>@return [Boolean] Default is true</p>
480
+ <p>@return boolean</p>
836
481
 
837
482
 
838
483
 
839
484
 
840
- <div class="method-source-code" id="write-3F-source">
841
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 190</span>
842
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">write?</span>
843
- <span class="ruby-ivar">@write</span>
485
+ <div class="method-source-code" id="preference_file_loaded-3F-source">
486
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 92</span>
487
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">preference_file_loaded?</span>
488
+ <span class="ruby-ivar">@preference_file_loaded</span>
844
489
  <span class="ruby-keyword">end</span></pre>
845
490
  </div>
846
491
 
@@ -873,10 +518,10 @@
873
518
 
874
519
 
875
520
  <div class="method-source-code" id="write_file-source">
876
- <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 149</span>
521
+ <pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 109</span>
877
522
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">write_file</span>
878
- <span class="ruby-identifier">echo</span> <span class="ruby-string">&#39;Writing file&#39;</span>
879
- <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">write</span>
523
+ <span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Writing file #{file.name}&quot;</span>
524
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span>
880
525
  <span class="ruby-keyword">end</span></pre>
881
526
  </div>
882
527