standup_md 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/doc/index.html CHANGED
@@ -94,6 +94,8 @@
94
94
 
95
95
  <li><a href="./StandupMD/File.html">StandupMD::File</a>
96
96
 
97
+ <li><a href="./StandupMD/Version.html">StandupMD::Version</a>
98
+
97
99
  </ul>
98
100
  </div>
99
101
 
@@ -104,7 +106,7 @@
104
106
 
105
107
 
106
108
  <h1 id="label-The+Standup+Doctor">The Standup Doctor<span><a href="#label-The+Standup+Doctor">&para;</a> <a href="#top">&uarr;</a></span></h1>
107
-
109
+ <!-- vi: set ts=4 sw=4 : -->
108
110
  <p><a href="https://actions-badge.atrox.dev/evanthegrayt/standup_md/goto?ref=master"><img src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fevanthegrayt%2Fstandup_md%2Fbadge%3Fref%3Dmaster&style=flat"></a> <a href="https://badge.fury.io/rb/standup_md"><img src="https://badge.fury.io/rb/standup_md.svg"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg"></a></p>
109
111
 
110
112
  <blockquote>
@@ -115,56 +117,11 @@
115
117
 
116
118
  <p>View on: <a href="https://github.com/evanthegrayt/standup_md">Github</a> | <a href="https://evanthegrayt.github.io/standup_md/">GitHub Pages</a> | <a href="https://rubygems.org/gems/standup_md">RubyGems</a></p>
117
119
 
118
- <h2 id="label-Table+of+Contents">Table of Contents<span><a href="#label-Table+of+Contents">&para;</a> <a href="#top">&uarr;</a></span></h2>
119
- <ul><li>
120
- <p><a href="#about">About</a></p>
121
- </li><li>
122
- <p><a href="#Installation">Installation</a></p>
123
- </li><li>
124
- <p><a href="#via-rubygems">Via RubyGems</a></p>
125
- </li><li>
126
- <p><a href="#manual-installation">Manual Installation</a></p>
127
- </li><li>
128
- <p><a href="#usage">Usage</a></p>
129
- </li><li>
130
- <p><a href="#command-line">Command Line</a></p>
131
- <ul><li>
132
- <p><a href="#cli-examples">CLI Examples</a></p>
133
- </li><li>
134
- <p><a href="#adding-an-entry-for-today-via-editor">Adding an entry for today via editor</a></p>
135
- </li><li>
136
- <p><a href="#copy-the-entry-for-today-to-clipboard">Copy the entry for today to clipboard</a></p>
137
- </li><li>
138
- <p><a href="#add-entry-to-file-without-opening-it">Add entry to file without opening it</a></p>
139
- </li><li>
140
- <p><a href="#find-an-entry-by-date-and-print-it">Find an entry by date and print it</a></p>
141
- </li><li>
142
- <p><a href="#customization-and-runtime-options">Customization and Runtime Options</a></p>
143
- </li><li>
144
- <p><a href="#using-existing-standup-files">Using existing standup files</a></p>
145
- </li></ul>
146
- </li><li>
147
- <p><a href="#api">API</a></p>
148
- <ul><li>
149
- <p><a href="#api-examples">API Examples</a></p>
150
- </li><li>
151
- <p><a href="#adding-an-entry-for-today">Adding an entry for today</a></p>
152
- </li><li>
153
- <p><a href="#finding-a-past-entry">Finding a past entry</a></p>
154
- </li><li>
155
- <p><a href="https://evanthegrayt.github.io/standup_md/doc/index.html">Documentation</a></p>
156
- </li></ul>
157
- </li><li>
158
- <p><a href="#reporting-bugs-and-requesting-features">Reporting Bugs and Requesting Features</a></p>
159
- </li><li>
160
- <p><a href="#self-promotion">Self-Promotion</a></p>
161
- </li></ul>
162
-
163
120
  <h2 id="label-About">About<span><a href="#label-About">&para;</a> <a href="#top">&uarr;</a></span></h2>
164
121
 
165
122
  <p>I&#39;ve now been at two separate companies where we post our daily standups in a chat client, such as Slack, Mattermost, or Riot. Typing out my standup every day became tedious, as I&#39;d have to look up what I did the day before, copy and paste yesterday&#39;s work into a new entry, and add today&#39;s tasks. This gem automates most of this process, along with providing means of opening the file in your editor, and finding and displaying entries from the command line.</p>
166
123
 
167
- <p>In a nutshell, calling <code>standup</code> from the command line will open a standup file for the current month in your preferred editor. If an entry for today is already present, no text will be generated. If an entry for today doesn&#39;t exist, one will be generated with your preferred values. When generating, if a previous entry exists, it will be added to today&#39;s entry as your previous day&#39;s work. See <a href="#example">example</a>. There&#39;s also a very robust API if you&#39;d like to use this in your own code somehow.</p>
124
+ <p>In a nutshell, calling <code>standup</code> from the command line will open a standup file for the current month in your preferred editor. If an entry for today is already present, no text will be generated. If an entry for today doesn&#39;t exist, one will be generated with your preferred values. When generating, if a previous entry exists, it will be added to today&#39;s entry as your previous day&#39;s work. See <a href="#cli-examples">example</a>. There&#39;s also a very robust API if you&#39;d like to use this in your own code somehow.</p>
168
125
 
169
126
  <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
170
127
 
@@ -300,7 +257,23 @@ rake install</pre>
300
257
 
301
258
  <h4 id="label-Executable+Flags">Executable Flags<span><a href="#label-Executable+Flags">&para;</a> <a href="#top">&uarr;</a></span></h4>
302
259
 
303
- <p>Some of these options can be changed at runtime. They are as follows. <code> --current ARRAY List of current entry&#39;s tasks --previous ARRAY List of precious entry&#39;s tasks --impediments ARRAY List of impediments for current entry --notes ARRAY List of notes for current entry --sub-header-order ARRAY The order of the sub-headers when writing the file -f, --file-name-format STRING Date-formattable string to use for standup file name -E, --editor EDITOR Editor to use for opening standup files -d, --directory DIRECTORY The directories where standup files are located -w --[no-]write Write current entry if it doesn&#39;t exist. Default is true -a --[no-]auto-fill-previous Auto-generate &#39;previous&#39; tasks for new entries -e --[no-]edit Open the file in the editor. Default is true -v, --[no-]verbose Verbose output. Default is false. -p, --print [DATE] Print current entry. If DATE is passed, will print entry for DATE, if it exists. DATE must be in the same format as file-name-format </code></p>
260
+ <p>Some of these options can be changed at runtime. They are as follows.</p>
261
+
262
+ <pre>--current ARRAY List of current entry&#39;s tasks
263
+ --previous ARRAY List of precious entry&#39;s tasks
264
+ --impediments ARRAY List of impediments for current entry
265
+ --notes ARRAY List of notes for current entry
266
+ --sub-header-order ARRAY The order of the sub-headers when writing the file
267
+ -f, --file-name-format STRING Date-formattable string to use for standup file name
268
+ -E, --editor EDITOR Editor to use for opening standup files
269
+ -d, --directory DIRECTORY The directories where standup files are located
270
+ -w --[no-]write Write current entry if it doesn&#39;t exist. Default is true
271
+ -a --[no-]auto-fill-previous Auto-generate &#39;previous&#39; tasks for new entries
272
+ -e --[no-]edit Open the file in the editor. Default is true
273
+ -v, --[no-]verbose Verbose output. Default is false.
274
+ -p, --print [DATE] Print current entry.
275
+ If DATE is passed, will print entry for DATE, if it exists.
276
+ DATE must be in the same format as file-name-format</pre>
304
277
 
305
278
  <h4 id="label-Using+Existing+Standup+Files">Using Existing Standup Files<span><a href="#label-Using+Existing+Standup+Files">&para;</a> <a href="#top">&uarr;</a></span></h4>
306
279
 
@@ -387,6 +360,34 @@ rake install</pre>
387
360
  <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">date</span>)
388
361
  </pre>
389
362
 
363
+ <h2 id="label-Vim">Vim<span><a href="#label-Vim">&para;</a> <a href="#top">&uarr;</a></span></h2>
364
+
365
+ <p>While there&#39;s no official support for vim, you can add this to your <code>vimrc</code> file, or something like <code>~/.vim/plugin/standup.vim</code>.</p>
366
+
367
+ <pre>if executable(&#39;standup&#39;)
368
+ command! -complete=custom,s:StandupCompletion -nargs=? -bang Standup
369
+ \ call s:OpenStandupFile(&lt;bang&gt;0, &lt;f-args&gt;)
370
+ endif
371
+
372
+ function! s:StandupCompletion(...) abort
373
+ let l:dir = get(g:, &#39;standup_dir&#39;, $HOME . &#39;/.cache/standup_md&#39;) . &#39;/&#39;
374
+ if !isdirectory(l:dir) | return &#39;&#39; | endif
375
+ let l:list = glob(l:dir . &#39;*.md&#39;, 0, 1)
376
+ return join(map(l:list, &quot;substitute(v:val, l:dir, &#39;&#39;, &#39;&#39;)&quot;), &quot;\n&quot;)
377
+ endfunction
378
+
379
+ function! s:OpenStandupFile(split, ...)
380
+ let l:dir = get(g:, &#39;standup_dir&#39;, $HOME . &#39;/.cache/standup_md&#39;) . &#39;/&#39;
381
+ let l:file = a:0 ? a:1 : get(g:, &#39;standup_file&#39;, strftime(&#39;%Y_%m.md&#39;))
382
+ call system(&#39;standup --no-edit&#39;)
383
+ execute a:split ? &#39;vsplit&#39; : &#39;split&#39; l:dir . l:file
384
+ endfunction</pre>
385
+
386
+ <p>This makes the <code>:Standup</code> command, which opens the standup file in a split, while <code>:Standup!</code> opens it in a vertical split. If a file is passed to the command, that file will be opened. There&#39;s tab completion for this. Lastly, it allows for a few variables to be set for customization.</p>
387
+
388
+ <pre>g:standup_dir = $HOME . &#39;/.cache/standup_md&#39; &quot; the directory where your file are
389
+ g:standup_file = strftime(&#39;%Y_%m.md&#39;) &quot; the file format to use</pre>
390
+
390
391
  <h2 id="label-Reporting+Bugs+and+Requesting+Features">Reporting Bugs and Requesting Features<span><a href="#label-Reporting+Bugs+and+Requesting+Features">&para;</a> <a href="#top">&uarr;</a></span></h2>
391
392
 
392
393
  <p>If you have an idea or find a bug, please <a href="https://github.com/evanthegrayt/standup_md/issues/new">create an issue</a>. Just make sure the topic doesn&#39;t already exist. Better yet, you can always submit a Pull Request.</p>
Binary file
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["standupmd","cli","helpers","config","cli","entry","entrylist","file","entry","entrylist","file","<<()","<=>()","@entries()","bullet_character=()","config()","config()","config()","config()","config()","config_file_loaded?()","configure()","create()","directory=()","echo()","echo()","edit()","execute()","exist?()","filter()","filter!()","find()","find()","find_by_date()","header_depth=()","initalize()","load()","load()","load_config_file()","load_preferences()","loaded?()","new()","new()","new()","new()","new()","new()","new()","new()","new?()","preference_file_loaded?()","print()","reset()","reset()","reset()","reset()","reset_config()","sort()","sort!()","sort_reverse()","sub_header_depth=()","to_h()","to_h()","to_json()","to_json()","write()","write_file()","readme"],"longSearchIndex":["standupmd","standupmd::cli","standupmd::cli::helpers","standupmd::config","standupmd::config::cli","standupmd::config::entry","standupmd::config::entrylist","standupmd::config::file","standupmd::entry","standupmd::entrylist","standupmd::file","standupmd::entrylist#<<()","standupmd::entry#<=>()","standupmd::entrylist#@entries()","standupmd::config::file#bullet_character=()","standupmd::config()","standupmd::cli::config()","standupmd::entry::config()","standupmd::entrylist::config()","standupmd::file::config()","standupmd::config_file_loaded?()","standupmd::configure()","standupmd::entry::create()","standupmd::config::file#directory=()","standupmd::cli#echo()","standupmd::cli::echo()","standupmd::cli#edit()","standupmd::cli::execute()","standupmd::file#exist?()","standupmd::entrylist#filter()","standupmd::entrylist#filter!()","standupmd::entrylist#find()","standupmd::file::find()","standupmd::file::find_by_date()","standupmd::config::file#header_depth=()","standupmd::config::entrylist#initalize()","standupmd::file::load()","standupmd::file#load()","standupmd::load_config_file()","standupmd::cli#load_preferences()","standupmd::file#loaded?()","standupmd::cli::new()","standupmd::config::new()","standupmd::config::cli::new()","standupmd::config::entry::new()","standupmd::config::file::new()","standupmd::entry::new()","standupmd::entrylist::new()","standupmd::file::new()","standupmd::file#new?()","standupmd::cli#preference_file_loaded?()","standupmd::cli::helpers#print()","standupmd::config::cli#reset()","standupmd::config::entry#reset()","standupmd::config::entrylist#reset()","standupmd::config::file#reset()","standupmd::reset_config()","standupmd::entrylist#sort()","standupmd::entrylist#sort!()","standupmd::entrylist#sort_reverse()","standupmd::config::file#sub_header_depth=()","standupmd::entry#to_h()","standupmd::entrylist#to_h()","standupmd::entry#to_json()","standupmd::entrylist#to_json()","standupmd::file#write()","standupmd::cli#write_file()",""],"info":[["StandupMD","","StandupMD.html","","<p>The main module for the gem. Provides access to configuration classes.\n"],["StandupMD::Cli","","StandupMD/Cli.html","","<p>Class for handing the command-line interface.\n"],["StandupMD::Cli::Helpers","","StandupMD/Cli/Helpers.html","","<p>Module responsible for reading and writing standup files.\n"],["StandupMD::Config","","StandupMD/Config.html","","<p>This class provides a connector from StandupMD to the configuration classes.\n"],["StandupMD::Config::Cli","","StandupMD/Config/Cli.html","","<p>The configuration class for StandupMD::Cli\n"],["StandupMD::Config::Entry","","StandupMD/Config/Entry.html","","<p>The configuration class for StandupMD::Entry\n"],["StandupMD::Config::EntryList","","StandupMD/Config/EntryList.html","","<p>The configuration class for StandupMD::EntryList\n"],["StandupMD::Config::File","","StandupMD/Config/File.html","","<p>The configuration class for StandupMD::File\n"],["StandupMD::Entry","","StandupMD/Entry.html","","<p>Class for handling single entries. Includes the comparable module, and compares by date.\n"],["StandupMD::EntryList","","StandupMD/EntryList.html","","<p>Enumerable list of entries.\n"],["StandupMD::File","","StandupMD/File.html","","<p>Class for handling reading and writing standup files.\n"],["<<","StandupMD::EntryList","StandupMD/EntryList.html#method-i-3C-3C","(entry)","<p>Appends entries to list.\n<p>@param [StandupMD::Entry] entry\n<p>@return [Array]\n"],["<=>","StandupMD::Entry","StandupMD/Entry.html#method-i-3C-3D-3E","(other)","<p>Sorting method for Comparable. Entries are compared by date.\n"],["@entries","StandupMD::EntryList","StandupMD/EntryList.html#method-i-40entries","","<p>The following are forwarded to @entries, which is the underly array of entries.\n<p><code>each</code> &mdash; Iterate over each …\n"],["bullet_character=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-bullet_character-3D","(char)","<p>Setter for bullet_character. Must be * (asterisk) or - (dash).\n<p>@param [String] character\n<p>@return [String] …\n"],["config","StandupMD","StandupMD.html#method-c-config","()","<p>Method for accessing the configuration.\n<p>@return [StanupMD::Cli]\n"],["config","StandupMD::Cli","StandupMD/Cli.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::Cli]\n"],["config","StandupMD::Entry","StandupMD/Entry.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::Entry]\n"],["config","StandupMD::EntryList","StandupMD/EntryList.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::EntryList]\n"],["config","StandupMD::File","StandupMD/File.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::EntryList]\n"],["config_file_loaded?","StandupMD","StandupMD.html#method-c-config_file_loaded-3F","()","<p>Has a config file been loaded?\n<p>@return [Boolean]\n"],["configure","StandupMD","StandupMD.html#method-c-configure","()","<p>Allows for configuration via a block. Useful when making config files.\n<p>@example\n\n<pre>StandupMD.configure { |s| ...</pre>\n"],["create","StandupMD::Entry","StandupMD/Entry.html#method-c-create","()","<p>Creates a generic entry. Default values can be set via configuration. Yields the entry if a block is …\n"],["directory=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-directory-3D","(directory)","<p>Setter for directory. Must be expanded in case the user uses `~` for home. If the directory doesn&#39;t …\n"],["echo","StandupMD::Cli","StandupMD/Cli.html#method-i-echo","(msg)","<p>Quick access to Cli.echo.\n<p>@return [nil]\n"],["echo","StandupMD::Cli","StandupMD/Cli.html#method-c-echo","(msg)","<p>Prints output if <code>verbose</code> is true.\n<p>@return [nil]\n"],["edit","StandupMD::Cli","StandupMD/Cli.html#method-i-edit","()","<p>Opens the file in an editor. Abandons the script.\n<p>@return [nil]\n"],["execute","StandupMD::Cli","StandupMD/Cli.html#method-c-execute","(options = [])","<p>Creates an instance of <code>StandupMD</code> and runs what the user requested.\n"],["exist?","StandupMD::File","StandupMD/File.html#method-i-exist-3F","()","<p>Does the file exist?\n<p>@return [Boolean] true if exists\n"],["filter","StandupMD::EntryList","StandupMD/EntryList.html#method-i-filter","(start_date, end_date)","<p>Returns entries that are between the start and end date. This method assumes the list has already been …\n"],["filter!","StandupMD::EntryList","StandupMD/EntryList.html#method-i-filter-21","(start_date, end_date)","<p>Replaces entries with results of filter.\n<p>@param [Date] start_date\n<p>@param [Date] end_date\n"],["find","StandupMD::EntryList","StandupMD/EntryList.html#method-i-find","(date)","<p>Finds an entry based on date. This method assumes the list has already been sorted.\n<p>@param [Date] date …\n"],["find","StandupMD::File","StandupMD/File.html#method-c-find","(file_name)","<p>Find standup file in directory by file name.\n<p>@param [String] File_naem\n"],["find_by_date","StandupMD::File","StandupMD/File.html#method-c-find_by_date","(date)","<p>Find standup file in directory by Date object.\n<p>@param [Date] date\n"],["header_depth=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-header_depth-3D","(depth)","<p>Number of octothorps (#) to use before the main header.\n<p>@param [Integer] depth\n<p>@return [Integer]\n"],["initalize","StandupMD::Config::EntryList","StandupMD/Config/EntryList.html#method-i-initalize","()","<p>Initializes the config with default values.\n"],["load","StandupMD::File","StandupMD/File.html#method-c-load","(file_name)","<p>Convenience method for calling File.find(file_name).load\n<p>@param [String] file_name\n<p>@return [StandupMD::File] …\n"],["load","StandupMD::File","StandupMD/File.html#method-i-load","()","<p>Loads the file&#39;s contents. TODO clean up this method.\n<p>@return [StandupMD::FileList]\n"],["load_config_file","StandupMD","StandupMD.html#method-c-load_config_file","(file)","<p>Loads a config file.\n<p>@param [String] file\n"],["load_preferences","StandupMD::Cli","StandupMD/Cli.html#method-i-load_preferences","()","<p>Load the preference file.\n<p>@return [nil]\n"],["loaded?","StandupMD::File","StandupMD/File.html#method-i-loaded-3F","()","<p>Has the file been loaded?\n<p>@return [Boolean] true if loaded\n"],["new","StandupMD::Cli","StandupMD/Cli.html#method-c-new","(options = [], load_config = true)","<p>Constructor. Sets defaults.\n<p>@param [Array] options\n"],["new","StandupMD::Config","StandupMD/Config.html#method-c-new","()","<p>Builds the links to the configuration classes.\n"],["new","StandupMD::Config::Cli","StandupMD/Config/Cli.html#method-c-new","()","<p>Initializes the config with default values.\n"],["new","StandupMD::Config::Entry","StandupMD/Config/Entry.html#method-c-new","()","<p>Initializes the config with default values.\n"],["new","StandupMD::Config::File","StandupMD/Config/File.html#method-c-new","()","<p>Initializes the config with default values.\n"],["new","StandupMD::Entry","StandupMD/Entry.html#method-c-new","(date, current, previous, impediments, notes = [])","<p>Constructs instance of <code>StandupMD::Entry</code>.\n<p>@param [Date] date\n<p>@param [Array] current\n"],["new","StandupMD::EntryList","StandupMD/EntryList.html#method-c-new","(*entries)","<p>Contruct a list. Can pass any amount of <code>StandupMD::Entry</code> instances.\n<p>@param [Entry] entries\n<p>@return [StandupMD::EntryList] …\n"],["new","StandupMD::File","StandupMD/File.html#method-c-new","(file_name)","<p>Constructs the instance.\n<p>@param [String] file_name\n<p>@return [StandupMP::File]\n"],["new?","StandupMD::File","StandupMD/File.html#method-i-new-3F","()","<p>Was the file just now created?\n<p>@return [Boolean] true if new\n"],["preference_file_loaded?","StandupMD::Cli","StandupMD/Cli.html#method-i-preference_file_loaded-3F","()","<p>Has the preference file been loaded?\n<p>@return boolean\n"],["print","StandupMD::Cli::Helpers","StandupMD/Cli/Helpers.html#method-i-print","(entry)","<p>Print an entry to the command line.\n<p>@param [StandupMD::Entry] entry\n<p>@return [nil]\n"],["reset","StandupMD::Config::Cli","StandupMD/Config/Cli.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset","StandupMD::Config::Entry","StandupMD/Config/Entry.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset","StandupMD::Config::EntryList","StandupMD/Config/EntryList.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset","StandupMD::Config::File","StandupMD/Config/File.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset_config","StandupMD","StandupMD.html#method-c-reset_config","()","<p>Reset all configuration values to their defaults.\n<p>@return [StandupMD::Config]\n"],["sort","StandupMD::EntryList","StandupMD/EntryList.html#method-i-sort","()","<p>Returns a copy of self sorted by date.\n<p>@return [StandupMD::EntryList]\n"],["sort!","StandupMD::EntryList","StandupMD/EntryList.html#method-i-sort-21","()","<p>Replace entries with sorted entries by date.\n<p>@return [StandupMD::EntryList]\n"],["sort_reverse","StandupMD::EntryList","StandupMD/EntryList.html#method-i-sort_reverse","()","<p>Returns a copy of self sorted by date.\n<p>@return [StandupMD::EntryList]\n"],["sub_header_depth=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-sub_header_depth-3D","(depth)","<p>Number of octothorps (#) to use before sub headers (Current, Previous, etc).\n<p>@param [Integer] depth\n<p>@return …\n"],["to_h","StandupMD::Entry","StandupMD/Entry.html#method-i-to_h","()","<p>Entry as a hash .\n<p>@return [Hash]\n"],["to_h","StandupMD::EntryList","StandupMD/EntryList.html#method-i-to_h","()","<p>The list as a hash, with the dates as keys.\n<p>@return [Hash]\n"],["to_json","StandupMD::Entry","StandupMD/Entry.html#method-i-to_json","()","<p>Entry as a json object.\n<p>@return [String]\n"],["to_json","StandupMD::EntryList","StandupMD/EntryList.html#method-i-to_json","()","<p>The entry list as a json object.\n<p>@return [String]\n"],["write","StandupMD::File","StandupMD/File.html#method-i-write","(dates = {})","<p>Writes a new entry to the file if the first entry in the file isn&#39;t today. This method is destructive; …\n"],["write_file","StandupMD::Cli","StandupMD/Cli.html#method-i-write_file","()","<p>Writes entries to the file.\n<p>@return [Boolean] true if file was written\n"],["README","","README_md.html","","<p>The Standup Doctor\n<p><img src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fevanthegrayt%2Fstandup_md%2Fbadge%3Fref%3Dmaster&style=flat\"> …\n\n<blockquote>"]]}}
1
+ var search_data = {"index":{"searchIndex":["standupmd","cli","helpers","config","cli","entry","entrylist","file","entry","entrylist","file","version","<<()","<=>()","@entries()","bullet_character=()","config()","config()","config()","config()","config()","config_file_loaded?()","configure()","create()","directory=()","echo()","echo()","edit()","execute()","exist?()","filter()","filter!()","find()","find()","find_by_date()","header_depth=()","initalize()","load()","load()","load_config_file()","load_preferences()","loaded?()","new()","new()","new()","new()","new()","new()","new()","new()","new?()","preference_file_loaded?()","print()","reset()","reset()","reset()","reset()","reset_config()","sort()","sort!()","sort_reverse()","sub_header_depth=()","to_h()","to_h()","to_json()","to_json()","to_s()","write()","write_file()","readme"],"longSearchIndex":["standupmd","standupmd::cli","standupmd::cli::helpers","standupmd::config","standupmd::config::cli","standupmd::config::entry","standupmd::config::entrylist","standupmd::config::file","standupmd::entry","standupmd::entrylist","standupmd::file","standupmd::version","standupmd::entrylist#<<()","standupmd::entry#<=>()","standupmd::entrylist#@entries()","standupmd::config::file#bullet_character=()","standupmd::config()","standupmd::cli::config()","standupmd::entry::config()","standupmd::entrylist::config()","standupmd::file::config()","standupmd::config_file_loaded?()","standupmd::configure()","standupmd::entry::create()","standupmd::config::file#directory=()","standupmd::cli#echo()","standupmd::cli::echo()","standupmd::cli#edit()","standupmd::cli::execute()","standupmd::file#exist?()","standupmd::entrylist#filter()","standupmd::entrylist#filter!()","standupmd::entrylist#find()","standupmd::file::find()","standupmd::file::find_by_date()","standupmd::config::file#header_depth=()","standupmd::config::entrylist#initalize()","standupmd::file#load()","standupmd::file::load()","standupmd::load_config_file()","standupmd::cli#load_preferences()","standupmd::file#loaded?()","standupmd::cli::new()","standupmd::config::new()","standupmd::config::cli::new()","standupmd::config::entry::new()","standupmd::config::file::new()","standupmd::entry::new()","standupmd::entrylist::new()","standupmd::file::new()","standupmd::file#new?()","standupmd::cli#preference_file_loaded?()","standupmd::cli::helpers#print()","standupmd::config::cli#reset()","standupmd::config::entry#reset()","standupmd::config::entrylist#reset()","standupmd::config::file#reset()","standupmd::reset_config()","standupmd::entrylist#sort()","standupmd::entrylist#sort!()","standupmd::entrylist#sort_reverse()","standupmd::config::file#sub_header_depth=()","standupmd::entry#to_h()","standupmd::entrylist#to_h()","standupmd::entry#to_json()","standupmd::entrylist#to_json()","standupmd::version::to_s()","standupmd::file#write()","standupmd::cli#write_file()",""],"info":[["StandupMD","","StandupMD.html","","<p>The main module for the gem. Provides access to configuration classes.\n"],["StandupMD::Cli","","StandupMD/Cli.html","","<p>Class for handing the command-line interface.\n"],["StandupMD::Cli::Helpers","","StandupMD/Cli/Helpers.html","","<p>Module responsible for reading and writing standup files.\n"],["StandupMD::Config","","StandupMD/Config.html","","<p>This class provides a connector from StandupMD to the configuration classes.\n"],["StandupMD::Config::Cli","","StandupMD/Config/Cli.html","","<p>The configuration class for StandupMD::Cli\n"],["StandupMD::Config::Entry","","StandupMD/Config/Entry.html","","<p>The configuration class for StandupMD::Entry\n"],["StandupMD::Config::EntryList","","StandupMD/Config/EntryList.html","","<p>The configuration class for StandupMD::EntryList\n"],["StandupMD::Config::File","","StandupMD/Config/File.html","","<p>The configuration class for StandupMD::File\n"],["StandupMD::Entry","","StandupMD/Entry.html","","<p>Class for handling single entries. Includes the comparable module, and compares by date.\n"],["StandupMD::EntryList","","StandupMD/EntryList.html","","<p>Enumerable list of entries.\n"],["StandupMD::File","","StandupMD/File.html","","<p>Class for handling reading and writing standup files.\n"],["StandupMD::Version","","StandupMD/Version.html","","<p>Module that contains all gem version information. Follows semantic versioning. Read: semver.org/\n"],["<<","StandupMD::EntryList","StandupMD/EntryList.html#method-i-3C-3C","(entry)","<p>Appends entries to list.\n<p>@param [StandupMD::Entry] entry\n<p>@return [Array]\n"],["<=>","StandupMD::Entry","StandupMD/Entry.html#method-i-3C-3D-3E","(other)","<p>Sorting method for Comparable. Entries are compared by date.\n"],["@entries","StandupMD::EntryList","StandupMD/EntryList.html#method-i-40entries","","<p>The following are forwarded to @entries, which is the underly array of entries.\n<p><code>each</code> &mdash; Iterate over each …\n"],["bullet_character=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-bullet_character-3D","(char)","<p>Setter for bullet_character. Must be * (asterisk) or - (dash).\n<p>@param [String] character\n<p>@return [String] …\n"],["config","StandupMD","StandupMD.html#method-c-config","()","<p>Method for accessing the configuration.\n<p>@return [StanupMD::Cli]\n"],["config","StandupMD::Cli","StandupMD/Cli.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::Cli]\n"],["config","StandupMD::Entry","StandupMD/Entry.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::Entry]\n"],["config","StandupMD::EntryList","StandupMD/EntryList.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::EntryList]\n"],["config","StandupMD::File","StandupMD/File.html#method-c-config","()","<p>Access to the class&#39;s configuration.\n<p>@return [StandupMD::Config::EntryList]\n"],["config_file_loaded?","StandupMD","StandupMD.html#method-c-config_file_loaded-3F","()","<p>Has a config file been loaded?\n<p>@return [Boolean]\n"],["configure","StandupMD","StandupMD.html#method-c-configure","()","<p>Allows for configuration via a block. Useful when making config files.\n<p>@example\n\n<pre>StandupMD.configure { |s| ...</pre>\n"],["create","StandupMD::Entry","StandupMD/Entry.html#method-c-create","()","<p>Creates a generic entry. Default values can be set via configuration. Yields the entry if a block is …\n"],["directory=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-directory-3D","(directory)","<p>Setter for directory. Must be expanded in case the user uses `~` for home. If the directory doesn&#39;t …\n"],["echo","StandupMD::Cli","StandupMD/Cli.html#method-i-echo","(msg)","<p>Quick access to Cli.echo.\n<p>@return [nil]\n"],["echo","StandupMD::Cli","StandupMD/Cli.html#method-c-echo","(msg)","<p>Prints output if <code>verbose</code> is true.\n<p>@return [nil]\n"],["edit","StandupMD::Cli","StandupMD/Cli.html#method-i-edit","()","<p>Opens the file in an editor. Abandons the script.\n<p>@return [nil]\n"],["execute","StandupMD::Cli","StandupMD/Cli.html#method-c-execute","(options = [])","<p>Creates an instance of <code>StandupMD</code> and runs what the user requested.\n"],["exist?","StandupMD::File","StandupMD/File.html#method-i-exist-3F","()","<p>Does the file exist?\n<p>@return [Boolean] true if exists\n"],["filter","StandupMD::EntryList","StandupMD/EntryList.html#method-i-filter","(start_date, end_date)","<p>Returns entries that are between the start and end date. This method assumes the list has already been …\n"],["filter!","StandupMD::EntryList","StandupMD/EntryList.html#method-i-filter-21","(start_date, end_date)","<p>Replaces entries with results of filter.\n<p>@param [Date] start_date\n<p>@param [Date] end_date\n"],["find","StandupMD::EntryList","StandupMD/EntryList.html#method-i-find","(date)","<p>Finds an entry based on date. This method assumes the list has already been sorted.\n<p>@param [Date] date …\n"],["find","StandupMD::File","StandupMD/File.html#method-c-find","(file_name)","<p>Find standup file in directory by file name.\n<p>@param [String] File_naem\n"],["find_by_date","StandupMD::File","StandupMD/File.html#method-c-find_by_date","(date)","<p>Find standup file in directory by Date object.\n<p>@param [Date] date\n"],["header_depth=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-header_depth-3D","(depth)","<p>Number of octothorps (#) to use before the main header.\n<p>@param [Integer] depth\n<p>@return [Integer]\n"],["initalize","StandupMD::Config::EntryList","StandupMD/Config/EntryList.html#method-i-initalize","()","<p>Initializes the config with default values.\n"],["load","StandupMD::File","StandupMD/File.html#method-i-load","()","<p>Loads the file&#39;s contents. TODO clean up this method.\n<p>@return [StandupMD::FileList]\n"],["load","StandupMD::File","StandupMD/File.html#method-c-load","(file_name)","<p>Convenience method for calling File.find(file_name).load\n<p>@param [String] file_name\n<p>@return [StandupMD::File] …\n"],["load_config_file","StandupMD","StandupMD.html#method-c-load_config_file","(file)","<p>Loads a config file.\n<p>@param [String] file\n"],["load_preferences","StandupMD::Cli","StandupMD/Cli.html#method-i-load_preferences","()","<p>Load the preference file.\n<p>@return [nil]\n"],["loaded?","StandupMD::File","StandupMD/File.html#method-i-loaded-3F","()","<p>Has the file been loaded?\n<p>@return [Boolean] true if loaded\n"],["new","StandupMD::Cli","StandupMD/Cli.html#method-c-new","(options = [], load_config = true)","<p>Constructor. Sets defaults.\n<p>@param [Array] options\n"],["new","StandupMD::Config","StandupMD/Config.html#method-c-new","()","<p>Builds the links to the configuration classes.\n"],["new","StandupMD::Config::Cli","StandupMD/Config/Cli.html#method-c-new","()","<p>Initializes the config with default values.\n"],["new","StandupMD::Config::Entry","StandupMD/Config/Entry.html#method-c-new","()","<p>Initializes the config with default values.\n"],["new","StandupMD::Config::File","StandupMD/Config/File.html#method-c-new","()","<p>Initializes the config with default values.\n"],["new","StandupMD::Entry","StandupMD/Entry.html#method-c-new","(date, current, previous, impediments, notes = [])","<p>Constructs instance of <code>StandupMD::Entry</code>.\n<p>@param [Date] date\n<p>@param [Array] current\n"],["new","StandupMD::EntryList","StandupMD/EntryList.html#method-c-new","(*entries)","<p>Contruct a list. Can pass any amount of <code>StandupMD::Entry</code> instances.\n<p>@param [Entry] entries\n<p>@return [StandupMD::EntryList] …\n"],["new","StandupMD::File","StandupMD/File.html#method-c-new","(file_name)","<p>Constructs the instance.\n<p>@param [String] file_name\n<p>@return [StandupMP::File]\n"],["new?","StandupMD::File","StandupMD/File.html#method-i-new-3F","()","<p>Was the file just now created?\n<p>@return [Boolean] true if new\n"],["preference_file_loaded?","StandupMD::Cli","StandupMD/Cli.html#method-i-preference_file_loaded-3F","()","<p>Has the preference file been loaded?\n<p>@return boolean\n"],["print","StandupMD::Cli::Helpers","StandupMD/Cli/Helpers.html#method-i-print","(entry)","<p>Print an entry to the command line.\n<p>@param [StandupMD::Entry] entry\n<p>@return [nil]\n"],["reset","StandupMD::Config::Cli","StandupMD/Config/Cli.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset","StandupMD::Config::Entry","StandupMD/Config/Entry.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset","StandupMD::Config::EntryList","StandupMD/Config/EntryList.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset","StandupMD::Config::File","StandupMD/Config/File.html#method-i-reset","()","<p>Sets all config values back to their defaults.\n<p>@return [Hash]\n"],["reset_config","StandupMD","StandupMD.html#method-c-reset_config","()","<p>Reset all configuration values to their defaults.\n<p>@return [StandupMD::Config]\n"],["sort","StandupMD::EntryList","StandupMD/EntryList.html#method-i-sort","()","<p>Returns a copy of self sorted by date.\n<p>@return [StandupMD::EntryList]\n"],["sort!","StandupMD::EntryList","StandupMD/EntryList.html#method-i-sort-21","()","<p>Replace entries with sorted entries by date.\n<p>@return [StandupMD::EntryList]\n"],["sort_reverse","StandupMD::EntryList","StandupMD/EntryList.html#method-i-sort_reverse","()","<p>Returns a copy of self sorted by date.\n<p>@return [StandupMD::EntryList]\n"],["sub_header_depth=","StandupMD::Config::File","StandupMD/Config/File.html#method-i-sub_header_depth-3D","(depth)","<p>Number of octothorps (#) to use before sub headers (Current, Previous, etc).\n<p>@param [Integer] depth\n<p>@return …\n"],["to_h","StandupMD::Entry","StandupMD/Entry.html#method-i-to_h","()","<p>Entry as a hash .\n<p>@return [Hash]\n"],["to_h","StandupMD::EntryList","StandupMD/EntryList.html#method-i-to_h","()","<p>The list as a hash, with the dates as keys.\n<p>@return [Hash]\n"],["to_json","StandupMD::Entry","StandupMD/Entry.html#method-i-to_json","()","<p>Entry as a json object.\n<p>@return [String]\n"],["to_json","StandupMD::EntryList","StandupMD/EntryList.html#method-i-to_json","()","<p>The entry list as a json object.\n<p>@return [String]\n"],["to_s","StandupMD::Version","StandupMD/Version.html#method-c-to_s","()","<p>Version as <code>MAJOR.MINOR.PATCH</code>\n"],["write","StandupMD::File","StandupMD/File.html#method-i-write","(**dates)","<p>Writes a new entry to the file if the first entry in the file isn&#39;t today. This method is destructive; …\n"],["write_file","StandupMD::Cli","StandupMD/Cli.html#method-i-write_file","()","<p>Writes entries to the file.\n<p>@return [Boolean] true if file was written\n"],["README","","README_md.html","","<p>The Standup Doctor\n<p><img src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fevanthegrayt%2Fstandup_md%2Fbadge%3Fref%3Dmaster&style=flat\"> …\n\n<blockquote>"]]}}
Binary file
Binary file
@@ -39,8 +39,6 @@
39
39
 
40
40
  <li><a href="README_md.html#label-The+Standup+Doctor">The Standup Doctor</a>
41
41
 
42
- <li><a href="README_md.html#label-Table+of+Contents">Table of Contents</a>
43
-
44
42
  <li><a href="README_md.html#label-About">About</a>
45
43
 
46
44
  <li><a href="README_md.html#label-Installation">Installation</a>
@@ -79,6 +77,8 @@
79
77
 
80
78
  <li><a href="README_md.html#label-Finding+a+past+entry">Finding a past entry</a>
81
79
 
80
+ <li><a href="README_md.html#label-Vim">Vim</a>
81
+
82
82
  <li><a href="README_md.html#label-Reporting+Bugs+and+Requesting+Features">Reporting Bugs and Requesting Features</a>
83
83
 
84
84
  <li><a href="README_md.html#label-Self-Promotion">Self-Promotion</a>
@@ -156,20 +156,25 @@
156
156
 
157
157
  </li>
158
158
 
159
+ <li class="module">
160
+ <a href="StandupMD/Version.html">StandupMD::Version</a>
161
+
162
+ </li>
163
+
159
164
  </ul>
160
165
 
161
166
  <h2 id="methods">Methods</h2>
162
167
  <ul>
163
168
 
164
169
  <li class="method">
165
- <a href="StandupMD/Entry.html#method-c-config">::config</a>
170
+ <a href="StandupMD/EntryList.html#method-c-config">::config</a>
166
171
  &mdash;
167
- <span class="container">StandupMD::Entry</span>
172
+ <span class="container">StandupMD::EntryList</span>
168
173
 
169
174
  <li class="method">
170
- <a href="StandupMD/EntryList.html#method-c-config">::config</a>
175
+ <a href="StandupMD/Entry.html#method-c-config">::config</a>
171
176
  &mdash;
172
- <span class="container">StandupMD::EntryList</span>
177
+ <span class="container">StandupMD::Entry</span>
173
178
 
174
179
  <li class="method">
175
180
  <a href="StandupMD/Cli.html#method-c-config">::config</a>
@@ -177,14 +182,14 @@
177
182
  <span class="container">StandupMD::Cli</span>
178
183
 
179
184
  <li class="method">
180
- <a href="StandupMD.html#method-c-config">::config</a>
185
+ <a href="StandupMD/File.html#method-c-config">::config</a>
181
186
  &mdash;
182
- <span class="container">StandupMD</span>
187
+ <span class="container">StandupMD::File</span>
183
188
 
184
189
  <li class="method">
185
- <a href="StandupMD/File.html#method-c-config">::config</a>
190
+ <a href="StandupMD.html#method-c-config">::config</a>
186
191
  &mdash;
187
- <span class="container">StandupMD::File</span>
192
+ <span class="container">StandupMD</span>
188
193
 
189
194
  <li class="method">
190
195
  <a href="StandupMD.html#method-c-config_file_loaded-3F">::config_file_loaded?</a>
@@ -232,19 +237,19 @@
232
237
  <span class="container">StandupMD</span>
233
238
 
234
239
  <li class="method">
235
- <a href="StandupMD/Config/File.html#method-c-new">::new</a>
240
+ <a href="StandupMD/Config/Cli.html#method-c-new">::new</a>
236
241
  &mdash;
237
- <span class="container">StandupMD::Config::File</span>
242
+ <span class="container">StandupMD::Config::Cli</span>
238
243
 
239
244
  <li class="method">
240
- <a href="StandupMD/File.html#method-c-new">::new</a>
245
+ <a href="StandupMD/Config.html#method-c-new">::new</a>
241
246
  &mdash;
242
- <span class="container">StandupMD::File</span>
247
+ <span class="container">StandupMD::Config</span>
243
248
 
244
249
  <li class="method">
245
- <a href="StandupMD/Config.html#method-c-new">::new</a>
250
+ <a href="StandupMD/Config/File.html#method-c-new">::new</a>
246
251
  &mdash;
247
- <span class="container">StandupMD::Config</span>
252
+ <span class="container">StandupMD::Config::File</span>
248
253
 
249
254
  <li class="method">
250
255
  <a href="StandupMD/Config/Entry.html#method-c-new">::new</a>
@@ -252,30 +257,35 @@
252
257
  <span class="container">StandupMD::Config::Entry</span>
253
258
 
254
259
  <li class="method">
255
- <a href="StandupMD/Cli.html#method-c-new">::new</a>
260
+ <a href="StandupMD/File.html#method-c-new">::new</a>
256
261
  &mdash;
257
- <span class="container">StandupMD::Cli</span>
262
+ <span class="container">StandupMD::File</span>
258
263
 
259
264
  <li class="method">
260
- <a href="StandupMD/EntryList.html#method-c-new">::new</a>
265
+ <a href="StandupMD/Cli.html#method-c-new">::new</a>
261
266
  &mdash;
262
- <span class="container">StandupMD::EntryList</span>
267
+ <span class="container">StandupMD::Cli</span>
263
268
 
264
269
  <li class="method">
265
- <a href="StandupMD/Config/Cli.html#method-c-new">::new</a>
270
+ <a href="StandupMD/Entry.html#method-c-new">::new</a>
266
271
  &mdash;
267
- <span class="container">StandupMD::Config::Cli</span>
272
+ <span class="container">StandupMD::Entry</span>
268
273
 
269
274
  <li class="method">
270
- <a href="StandupMD/Entry.html#method-c-new">::new</a>
275
+ <a href="StandupMD/EntryList.html#method-c-new">::new</a>
271
276
  &mdash;
272
- <span class="container">StandupMD::Entry</span>
277
+ <span class="container">StandupMD::EntryList</span>
273
278
 
274
279
  <li class="method">
275
280
  <a href="StandupMD.html#method-c-reset_config">::reset_config</a>
276
281
  &mdash;
277
282
  <span class="container">StandupMD</span>
278
283
 
284
+ <li class="method">
285
+ <a href="StandupMD/Version.html#method-c-to_s">::to_s</a>
286
+ &mdash;
287
+ <span class="container">StandupMD::Version</span>
288
+
279
289
  <li class="method">
280
290
  <a href="StandupMD/EntryList.html#method-i-3C-3C">#&lt;&lt;</a>
281
291
  &mdash;
@@ -372,9 +382,9 @@
372
382
  <span class="container">StandupMD::Cli::Helpers</span>
373
383
 
374
384
  <li class="method">
375
- <a href="StandupMD/Config/Entry.html#method-i-reset">#reset</a>
385
+ <a href="StandupMD/Config/Cli.html#method-i-reset">#reset</a>
376
386
  &mdash;
377
- <span class="container">StandupMD::Config::Entry</span>
387
+ <span class="container">StandupMD::Config::Cli</span>
378
388
 
379
389
  <li class="method">
380
390
  <a href="StandupMD/Config/File.html#method-i-reset">#reset</a>
@@ -387,9 +397,9 @@
387
397
  <span class="container">StandupMD::Config::EntryList</span>
388
398
 
389
399
  <li class="method">
390
- <a href="StandupMD/Config/Cli.html#method-i-reset">#reset</a>
400
+ <a href="StandupMD/Config/Entry.html#method-i-reset">#reset</a>
391
401
  &mdash;
392
- <span class="container">StandupMD::Config::Cli</span>
402
+ <span class="container">StandupMD::Config::Entry</span>
393
403
 
394
404
  <li class="method">
395
405
  <a href="StandupMD/EntryList.html#method-i-sort">#sort</a>
data/lib/standup_md.rb CHANGED
@@ -34,7 +34,7 @@ module StandupMD
34
34
  # @example
35
35
  # StandupMD.configure { |s| s.cli.editor = 'mate' }
36
36
  def self.configure
37
- yield self.config
37
+ yield config
38
38
  end
39
39
 
40
40
  ##
@@ -52,6 +52,7 @@ module StandupMD
52
52
  def self.load_config_file(file)
53
53
  file = ::File.expand_path(file)
54
54
  raise "File #{file} does not exist." unless ::File.file?(file)
55
+
55
56
  @config_file_loaded = true
56
57
  load file
57
58
  end
@@ -4,7 +4,6 @@ require 'optparse'
4
4
  require_relative 'cli/helpers'
5
5
 
6
6
  module StandupMD
7
-
8
7
  ##
9
8
  # Class for handing the command-line interface.
10
9
  class Cli
@@ -66,10 +65,10 @@ module StandupMD
66
65
  @preference_file_loaded = false
67
66
  @options = options
68
67
  load_preferences if load_config
69
- set_preferences(options)
68
+ load_runtime_preferences(options)
70
69
  @file = StandupMD::File.find_by_date(@config.date)
71
70
  @file.load
72
- @entry = set_entry(@file)
71
+ @entry = new_entry(@file)
73
72
  end
74
73
 
75
74
  ##
@@ -2,11 +2,9 @@
2
2
 
3
3
  module StandupMD
4
4
  class Cli
5
-
6
5
  ##
7
6
  # Module responsible for reading and writing standup files.
8
7
  module Helpers
9
-
10
8
  ##
11
9
  # Print an entry to the command line.
12
10
  #
@@ -15,99 +13,108 @@ module StandupMD
15
13
  # @return [nil]
16
14
  def print(entry)
17
15
  if entry.nil?
18
- puts "No record found for #{StandupMD.config.cli.date}"
16
+ puts "No record found for #{config.cli.date}"
19
17
  return
20
18
  end
21
19
  puts header(entry)
22
- StandupMD.config.file.sub_header_order.each do |header_type|
20
+ config.file.sub_header_order.each do |header_type|
23
21
  tasks = entry.public_send(header_type)
24
22
  next if !tasks || tasks.empty?
23
+
25
24
  puts sub_header(header_type)
26
- tasks.each { |task| puts StandupMD.config.file.bullet_character + ' ' + task }
25
+ tasks.each { |task| puts config.file.bullet_character + ' ' + task }
27
26
  end
28
27
  puts
29
28
  end
30
29
 
31
30
  private
32
31
 
32
+ ##
33
+ # Helper for accessing config.
34
+ #
35
+ # @return [StandupMD::Config]
36
+ def config # :nodoc:
37
+ StandupMD.config
38
+ end
39
+
33
40
  ##
34
41
  # Parses options passed at runtime and concatenates them with the options
35
42
  # in the user's preferences file. Reveal source to see options.
36
43
  #
37
44
  # @return [Hash]
38
- def set_preferences(options)
45
+ def load_runtime_preferences(options)
39
46
  OptionParser.new do |opts|
40
47
  opts.banner = 'The Standup Doctor'
41
- opts.version = "[StandupMD] #{::StandupMD::VERSION}"
48
+ opts.version = "[StandupMD] #{::StandupMD::Version}"
42
49
  opts.on(
43
50
  '--current ARRAY', Array,
44
51
  "List of current entry's tasks"
45
- ) { |v| StandupMD.config.entry.current = v }
52
+ ) { |v| config.entry.current = v }
46
53
 
47
54
  opts.on(
48
55
  '--previous ARRAY', Array,
49
56
  "List of precious entry's tasks"
50
- ) { |v| StandupMD.config.entry.previous = v }
57
+ ) { |v| config.entry.previous = v }
51
58
 
52
59
  opts.on(
53
60
  '--impediments ARRAY', Array,
54
61
  'List of impediments for current entry'
55
- ) { |v| StandupMD.config.entry.impediments = v }
62
+ ) { |v| config.entry.impediments = v }
56
63
 
57
64
  opts.on(
58
65
  '--notes ARRAY', Array,
59
66
  'List of notes for current entry'
60
- ) { |v| StandupMD.config.entry.notes = v }
67
+ ) { |v| config.entry.notes = v }
61
68
 
62
69
  opts.on(
63
70
  '--sub-header-order ARRAY', Array,
64
71
  'The order of the sub-headers when writing the file'
65
- ) { |v| StandupMD.config.file.sub_header_order = v }
72
+ ) { |v| config.file.sub_header_order = v }
66
73
 
67
74
  opts.on(
68
75
  '-f', '--file-name-format STRING',
69
76
  'Date-formattable string to use for standup file name'
70
- ) { |v| StandupMD.config.file.name_format = v }
77
+ ) { |v| config.file.name_format = v }
71
78
 
72
79
  opts.on(
73
80
  '-E', '--editor EDITOR',
74
81
  'Editor to use for opening standup files'
75
- ) { |v| StandupMD.config.cli.editor = v }
82
+ ) { |v| config.cli.editor = v }
76
83
 
77
84
  opts.on(
78
85
  '-d', '--directory DIRECTORY',
79
86
  'The directories where standup files are located'
80
- ) { |v| StandupMD.config.file.directory = v }
87
+ ) { |v| config.file.directory = v }
81
88
 
82
89
  opts.on(
83
90
  '-w', '--[no-]write',
84
91
  "Write current entry if it doesn't exist. Default is true"
85
- ) { |v| StandupMD.config.cli.write = v }
92
+ ) { |v| config.cli.write = v }
86
93
 
87
94
  opts.on(
88
95
  '-a', '--[no-]auto-fill-previous',
89
96
  "Auto-generate 'previous' tasks for new entries. Default is true"
90
- ) { |v| StandupMD.config.cli.auto_fill_previous = v }
97
+ ) { |v| config.cli.auto_fill_previous = v }
91
98
 
92
99
  opts.on(
93
100
  '-e', '--[no-]edit',
94
101
  'Open the file in the editor. Default is true'
95
- ) { |v| StandupMD.config.cli.edit = v }
102
+ ) { |v| config.cli.edit = v }
96
103
 
97
104
  opts.on(
98
105
  '-v', '--[no-]verbose',
99
106
  'Verbose output. Default is false.'
100
- ) { |v| StandupMD.config.cli.verbose = v }
107
+ ) { |v| config.cli.verbose = v }
101
108
 
102
109
  opts.on(
103
110
  '-p', '--print [DATE]',
104
111
  'Print current entry.',
105
112
  'If DATE is passed, will print entry for DATE, if it exists.',
106
- 'DATE must be in the same format as file-name-format',
113
+ 'DATE must be in the same format as file-name-format'
107
114
  ) do |v|
108
- StandupMD.config.cli.print = true
109
- StandupMD.config.cli.date =
110
- v.nil? ? Date.today : Date.strptime(v, StandupMD.config.file.header_date_format)
115
+ config.cli.print = true
116
+ config.cli.date =
117
+ v.nil? ? Date.today : Date.strptime(v, config.file.header_date_format)
111
118
  end
112
119
  end.parse!(options)
113
120
  end
@@ -116,16 +123,16 @@ module StandupMD
116
123
  # The entry for today.
117
124
  #
118
125
  # @return [StandupMD::Entry]
119
- def set_entry(file)
120
- entry = file.entries.find(StandupMD.config.cli.date)
121
- if entry.nil? && StandupMD.config.cli.date == Date.today
126
+ def new_entry(file)
127
+ entry = file.entries.find(config.cli.date)
128
+ if entry.nil? && config.cli.date == Date.today
122
129
  previous_entry = set_previous_entry(file)
123
130
  entry = StandupMD::Entry.new(
124
- StandupMD.config.cli.date,
125
- StandupMD.config.entry.current,
131
+ config.cli.date,
132
+ config.entry.current,
126
133
  previous_entry,
127
- StandupMD.config.entry.impediments,
128
- StandupMD.config.entry.notes
134
+ config.entry.impediments,
135
+ config.entry.notes
129
136
  )
130
137
  file.entries << entry
131
138
  end
@@ -137,10 +144,10 @@ module StandupMD
137
144
  #
138
145
  # @return [Array]
139
146
  def set_previous_entry(file)
140
- unless StandupMD.config.cli.auto_fill_previous
141
- return Standup.config.entry.previous_entry
142
- end
147
+ return config.entry.previous_entry unless config.cli.auto_fill_previous
148
+
143
149
  return prev_entry(prev_file.load.entries) if file.new? && prev_file
150
+
144
151
  prev_entry(file.entries)
145
152
  end
146
153
 
@@ -152,6 +159,7 @@ module StandupMD
152
159
  # @return [StandupMD::Entry]
153
160
  def prev_entry(entries)
154
161
  return [] if entries.empty?
162
+
155
163
  entries.last.current
156
164
  end
157
165
 
@@ -170,8 +178,8 @@ module StandupMD
170
178
  #
171
179
  # @return [String]
172
180
  def header(entry)
173
- '#' * StandupMD.config.file.header_depth + ' ' +
174
- entry.date.strftime(StandupMD.config.file.header_date_format)
181
+ '#' * config.file.header_depth + ' ' +
182
+ entry.date.strftime(config.file.header_date_format)
175
183
  end
176
184
 
177
185
  ##
@@ -181,8 +189,8 @@ module StandupMD
181
189
  #
182
190
  # @return [String]
183
191
  def sub_header(header_type)
184
- '#' * StandupMD.config.file.sub_header_depth + ' ' +
185
- StandupMD.config.file.public_send("#{header_type}_header").capitalize
192
+ '#' * config.file.sub_header_depth + ' ' +
193
+ config.file.public_send("#{header_type}_header").capitalize
186
194
  end
187
195
  end
188
196
  end