standup_md 0.2.0 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9e0d3fe8970730c7b8b0762560546f3a7656db61d3c11ff5ac8523db1aaf7ea
4
- data.tar.gz: 5532bc9cb33dbc14c9b6689ce50c0ad6c0e8edfa95d5092023f9745a93936057
3
+ metadata.gz: 49f9ad4ada41c9372b1d3ffebb4f44fff6cb96249224c9b62c5063e1836a4c8f
4
+ data.tar.gz: da5aa3a5e2cfc882372ef5899694941d32702049323d615acc36644733dabe12
5
5
  SHA512:
6
- metadata.gz: 45fc54d5e6265b73ea39b0f0fa5e9431a721a1a8dbb6dae9999996388b950d3239ed65c8542b770a1bd4267fdd05620a97c7bbbf2e1ade05060d530415da9c31
7
- data.tar.gz: c3dd89557155580a7c619bf2c65033b35da91094e63c5ab2502a58f537083593fd1111181ac897a2e739132ac68f9ed0bd4d737392b356d4caeb9cdab4962d37
6
+ metadata.gz: 35587b73b6ec5d9d2388ce4d4b95185b982486414f3c5a5874fd7c73ee84dfcab6ba4b0109fcac33bf89576517a48f3a9730e85238ee53557f3b0047e6548c19
7
+ data.tar.gz: d772849128665813f3326fa41a684607e1231cd7065828f933dc5b50e51b0f909ef24862020d08af39f2bb2cd07e749c02c0347c00d923fb9ee38f14c69808c3
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  standup_md-*.gem
2
+ coverage/*
@@ -1,13 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standup_md (0.1.3)
4
+ standup_md (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ docile (1.3.2)
9
10
  power_assert (1.2.0)
10
11
  rake (13.0.1)
12
+ simplecov (0.18.5)
13
+ docile (~> 1.1)
14
+ simplecov-html (~> 0.11)
15
+ simplecov-html (0.12.2)
11
16
  test-unit (3.3.5)
12
17
  power_assert
13
18
 
@@ -16,6 +21,7 @@ PLATFORMS
16
21
 
17
22
  DEPENDENCIES
18
23
  rake (~> 13.0, >= 13.0.1)
24
+ simplecov
19
25
  standup_md!
20
26
  test-unit (~> 3.3, >= 3.3.5)
21
27
 
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # The Standup Doctor
2
+ [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fevanthegrayt%2Fstandup_md%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/evanthegrayt/standup_md/goto?ref=master)
3
+ [![Gem Version](https://badge.fury.io/rb/standup_md.svg)](https://badge.fury.io/rb/standup_md)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
2
6
  > The cure for all your standup woes.
3
7
 
4
8
  A highly customizable and automated way to keep track of daily standups in
@@ -14,11 +18,17 @@ View on: [Github](https://github.com/evanthegrayt/standup_md) |
14
18
  - [Via RubyGems](#via-rubygems)
15
19
  - [Manual Installation](#manual-installation)
16
20
  - [Usage](#usage)
17
- - [Example](#example)
18
- - [Customization and Runtime Options](#customization-and-runtime-options)
19
- - [Using existing standup files](#using-existing-standup-files)
20
- - [API](#api)
21
- - [Documentation](https://evanthegrayt.github.io/standup_md/doc/index.html)
21
+ - [Command Line](#command-line)
22
+ - [CLI Examples](#cli-examples)
23
+ - [Adding an entry for today via editor](#adding-an-entry-for-today-via-editor)
24
+ - [Copy the entry for today to clipboard](#copy-the-entry-for-today-to-clipboard)
25
+ - [Add entry to file without opening it](#add-entry-to-file-without-opening-it)
26
+ - [Find an entry by date and print it](#find-an-entry-by-date-and-print-it)
27
+ - [Customization and Runtime Options](#customization-and-runtime-options)
28
+ - [Using existing standup files](#using-existing-standup-files)
29
+ - [API](#api)
30
+ - [API Examples](#api-examples)
31
+ - [Documentation](https://evanthegrayt.github.io/standup_md/doc/index.html)
22
32
  - [Reporting Bugs and Requesting Features](#reporting-bugs-and-requesting-features)
23
33
  - [Self-Promotion](#self-promotion)
24
34
 
@@ -28,17 +38,15 @@ chat client, such as Slack, Mattermost, or Riot. Typing out my standup every day
28
38
  became tedious, as I'd have to look up what I did the day before, copy and paste
29
39
  yesterday's work into a new entry, and add today's tasks. This gem automates
30
40
  most of this process, along with providing means of opening the file in your
31
- editor, and displaying entries from the command line.
32
-
33
- I wasn't sure that others would find this useful, but then the pandemic
34
- happened, which I assume made doing standups via chat much more common.
41
+ editor, and finding and displaying entries from the command line.
35
42
 
36
43
  In a nutshell, calling `standup` from the command line will open a standup file
37
44
  for the current month in your preferred editor. If an entry for today is already
38
45
  present, no text will be generated. If an entry for today doesn't exist, one
39
- will be generated, and if a previous entry exists, it will be added to today's
40
- entry as your previous day's work. See [example](#example). There's also an API
41
- if you'd like to use this in your own code somehow.
46
+ will be generated with your preferred values. When generating, if a previous
47
+ entry exists, it will be added to today's entry as your previous day's work. See
48
+ [example](#example). There's also a very robust API if you'd like to use this
49
+ in your own code somehow.
42
50
 
43
51
  ## Installation
44
52
  ### Via RubyGems
@@ -48,15 +56,15 @@ Just install the gem!
48
56
  gem install standup_md
49
57
  ```
50
58
 
51
- If you don't have permission on your system to install ruby or gems, I recommend
52
- using
53
- [rbenv](http://www.rubyinside.com/rbenv-a-simple-new-ruby-version-management-tool-5302.html),
54
- or you can try the manual methods below.
59
+ To include in your project, add the following to your `Gemfile`.
55
60
 
61
+ ```ruby
62
+ gem 'standup_md'
63
+ ```
56
64
 
57
65
  ### Manual Installation
58
- From your terminal, clone the repository where you want it. From there, you have
59
- a couple of installation options.
66
+ From your terminal, clone the repository where you want it, and use `rake` to
67
+ install the gem.
60
68
 
61
69
  ```sh
62
70
  git clone https://github.com/evanthegrayt/standup_md.git
@@ -64,14 +72,11 @@ cd standup_md
64
72
 
65
73
  # Use rake to build and install the gem.
66
74
  rake install
67
-
68
- # OR manually link the executable somewhere. If you use this method, you cannot
69
- # move the repository after you link it!
70
- ln -s $PWD/bin/standup /usr/local/bin/standup
71
75
  ```
72
76
 
73
77
  ## Usage
74
- Call the executable.
78
+ ### Command Line
79
+ For the most basic usage, simply call the executable.
75
80
 
76
81
  ```sh
77
82
  standup
@@ -79,10 +84,13 @@ standup
79
84
 
80
85
  This opens the current month's standup file. If an entry already exists for
81
86
  today, nothing is added. If no entry exists for today, the previous "Current" is
82
- placed in the "Previous" section of a new entry. The format of this file is
83
- very important; do not change anything, except for adding entries for today.
87
+ placed in the "Previous" section of a new entry. The format of this file is very
88
+ important; you may add new entries, but don't change any of the headers. Doing
89
+ so will cause the parser to break. If you want to customize the headers, you can
90
+ do so in the [configuration file](#available-config-file-options-and-defaults).
84
91
 
85
- ### Example
92
+ ### CLI Examples
93
+ #### Adding an entry for today via editor
86
94
  For example, if the standup entry from yesterday reads as follows:
87
95
 
88
96
  ```markdown
@@ -98,6 +106,7 @@ For example, if the standup entry from yesterday reads as follows:
98
106
 
99
107
  The following scaffolding will be added for current entry at the top of the
100
108
  file:
109
+
101
110
  ```markdown
102
111
  # 2020-04-14
103
112
  ## Previous
@@ -109,19 +118,36 @@ file:
109
118
  - None
110
119
  ```
111
120
 
121
+ #### Copy the entry for today to clipboard
112
122
  There are also flags that will print entries to the command line. There's a full
113
123
  list of features below, but as a quick example, you can copy today's entry to
114
124
  your clipboard without even opening your editor.
115
125
 
116
126
  ```sh
117
- standup -c | pbcopy
127
+ standup -p | pbcopy
128
+ ```
129
+
130
+ If you wanted to add today's entry without opening your editor, and print the
131
+ result to the command line, you could use the following.
132
+
133
+ #### Add entry to file without opening it
134
+ ```sh
135
+ standup --no-edit --current "Work on this thing","And another thing"
136
+ ```
137
+
138
+ #### Find an entry by date and print it.
139
+ If you wanted to find and print the entry for March 2nd, 2020, you could use the
140
+ following.
141
+
142
+ ```sh
143
+ standup -p 2020-03-02
118
144
  ```
119
145
 
120
- ## Customization and Runtime Options
121
- You can create a file in your home directory called `~/.standup_md.yml`.
122
- Settings located in this file will override default behavior. This file can also
123
- have settings overwritten at runtime by the use of options. You can view [my config
124
- file](https://github.com/evanthegrayt/dotfiles/blob/master/dotfiles/standup_md.yml)
146
+ ### Customization and Runtime Options
147
+ You can create a file in your home directory called `~/.standuprc`. Settings
148
+ located in this file will override default behavior. This file can also have
149
+ settings overwritten at runtime by the use of options. You can view [my config
150
+ file](https://github.com/evanthegrayt/dotfiles/blob/master/dotfiles/standuprc)
125
151
  as an example. Any setting in this file can still be overridden at runtime by
126
152
  passing flags to the executable.
127
153
 
@@ -140,51 +166,62 @@ them in your configuration file after installation, and then try to not change
140
166
  them again.
141
167
 
142
168
 
143
- ### Available Config File Keys and Defaults
144
-
145
- ```yaml
146
- # Key: Default
147
- header_depth: 1
148
- header_date_format: '%Y-%m-%d'
149
- sub_header_depth: 2
150
- current_header: 'Current'
151
- previous_header: 'Previous'
152
- impediments_header: 'Impediments'
153
- file_name_format: '%Y_%m.md'
154
- bullet_character: '-' # (dash)
155
- directory: '~/.cache/standup_md'
156
- editor: # $VISUAL, $EDITOR or vim, in that order
157
- current_entry_tasks:
158
- - "<!-- ADD TODAY'S WORK HERE -->"
159
- previous_entry_tasks: # An array of the tasks from the previous entry
160
- impediments:
161
- - 'None'
162
- notes: null # If not null, must be array
163
- sub_header_order:
164
- - 'previous'
165
- - 'current'
166
- - 'impediments'
167
- - 'notes'
169
+ #### Available Config File Options and Defaults
170
+
171
+ ```ruby
172
+ StandupMD.configure do |c|
173
+ # Defaults for how the file is formatted.
174
+ # See https://evanthegrayt.github.io/standup_md/doc/StandupMD/Config/Cli.html
175
+ c.file.header_date_format = '%Y-%m-%d'
176
+ c.file.header_depth = 1
177
+ c.file.sub_header_depth = 2
178
+ c.file.current_header = 'Current'
179
+ c.file.previous_header = 'Previous'
180
+ c.file.impediments_header = 'Impediments'
181
+ c.file.notes_header = 'Notes'
182
+ c.file.sub_header_order = %w[previous current impediments notes]
183
+ c.file.directory = ::File.join(ENV['HOME'], '.cache', 'standup_md')
184
+ c.file.bullet_character = '-'
185
+ c.file.name_format = '%Y_%m.md'
186
+ c.file.create = true
187
+
188
+ # Defaults for entries
189
+ # See https://evanthegrayt.github.io/standup_md/doc/StandupMD/Config/Entry.html
190
+ c.entry.current = ["<!-- ADD TODAY'S WORK HERE -->"]
191
+ c.entry.previous = []
192
+ c.entry.impediments = ['None']
193
+ c.entry.notes = []
194
+
195
+ # Defaults for executable runtime behavior.
196
+ # See https://evanthegrayt.github.io/standup_md/doc/StandupMD/Config/Cli.html
197
+ c.cli.date = Date.today
198
+ c.cli.editor = 'vim' # Checks $VISUAL and $EDITOR first, in that order
199
+ c.cli.verbose = false
200
+ c.cli.edit = true
201
+ c.cli.write = true
202
+ c.cli.print = false
203
+ c.cli.auto_fill_previous = true
204
+ c.cli.preference_file = ::File.expand_path(::File.join(ENV['HOME'], '.standuprc'))
205
+ end
168
206
  ```
169
207
 
170
- ### Executable Flags
208
+ #### Executable Flags
171
209
  ```
172
- The Standup Doctor
173
- --current-entry-tasks=ARRAY List of current entry's tasks
174
- --previous-entry-tasks=ARRAY List of yesterday's tasks
175
- --impediments=ARRAY List of impediments for current entry
176
- --notes=ARRAY List of notes for current entry
177
- --sub-header-order=ARRAY The order of the sub-headers when writing the file
178
- --[no-]append-previous Append previous tasks? Default is true
179
- -f, --file-name-format=STRING Date-formattable string to use for standup file name
180
- -e, --editor=EDITOR Editor to use for opening standup files
181
- -d, --directory=DIRECTORY The directories where standup files are located
182
- --[no-]write Write current entry if it doesn't exist. Default is true
183
- --[no-]edit Open the file in the editor. Default is true
184
- -j, --[no-]json Print output as formatted json. Default is false.
185
- -v, --[no-]verbose Verbose output. Default is false.
186
- -c, --current Print current entry. Disables editing
187
- -a, --all Print all previous entries. Disables editing
210
+ --current ARRAY List of current entry's tasks
211
+ --previous ARRAY List of precious entry's tasks
212
+ --impediments ARRAY List of impediments for current entry
213
+ --notes ARRAY List of notes for current entry
214
+ --sub-header-order ARRAY The order of the sub-headers when writing the file
215
+ -f, --file-name-format STRING Date-formattable string to use for standup file name
216
+ -E, --editor EDITOR Editor to use for opening standup files
217
+ -d, --directory DIRECTORY The directories where standup files are located
218
+ -w --[no-]write Write current entry if it doesn't exist. Default is true
219
+ -a --[no-]auto-fill-previous Auto-generate 'previous' tasks for new entries
220
+ -e --[no-]edit Open the file in the editor. Default is true
221
+ -v, --[no-]verbose Verbose output. Default is false.
222
+ -p, --print [DATE] Print current entry.
223
+ If DATE is passed, will print entry for DATE, if it exists.
224
+ DATE must be in the same format as file-name-format
188
225
  ```
189
226
 
190
227
  Any options not set in this file will retain their default values. Note that if
@@ -192,14 +229,7 @@ you change `file_name_format`, and don't use a month or year, there will only
192
229
  ever be one standup file. This could cause issues long-term, as the files will
193
230
  get large over time and possibly cause performance issues.
194
231
 
195
- If you wanted to add some tasks at runtime, and without opening the file in an
196
- editor, you could use the following:
197
-
198
- ```bash
199
- standup --no-edit --current-entry-tasks="Work on this thing","And another thing!"
200
- ```
201
-
202
- ### Using Existing Standup Files
232
+ #### Using Existing Standup Files
203
233
  If you already have a directory of existing standup files, you can use them, but
204
234
  they must be in a format that the parser can understand. The default is:
205
235
 
@@ -217,72 +247,72 @@ they must be in a format that the parser can understand. The default is:
217
247
 
218
248
  The order, words, date format, and header level are all customizable, but the
219
249
  overall format must be the same. If customization is necessary, this must be
220
- done in `~/.standup_md.yml` before execution, or else the parser will error.
250
+ done in `~/.standuprc` before execution, or else the parser will error.
221
251
 
222
252
  For example, if you wanted the format to be as follows:
223
253
 
224
254
  ```markdown
225
255
  ## 05/01/2020
226
256
  ### Today
227
- - task
257
+ * task
228
258
  ### Yesterday
229
- - task
259
+ * task
230
260
  ### Hold-ups
231
- - impediment
261
+ * impediment
232
262
  ### Notes
233
- - notes, if any are present
263
+ * notes, if any are present
234
264
  ```
235
265
 
236
- Your `~/.standup_md.yml` should contain:
237
-
238
- ```yaml
239
- sub_header_depth: 3
240
- header_depth: 2
241
- current_header: Today
242
- previous_header: Yesterday
243
- impediments_header: Hold-ups
244
- header_date_format: '%m/%d/%Y'
245
- sub_header_order:
246
- - current
247
- - previous
248
- - impediments
249
- - notes
266
+ Your `~/.standuprc` should contain:
250
267
 
268
+ ```ruby
269
+ StandupMD.configure do |c|
270
+ c.file.header_depth = 2
271
+ c.file.sub_header_depth = 3
272
+ c.file.current_header = 'Today'
273
+ c.file.previous_header = 'Yesterday'
274
+ c.file.impediments_header = 'Hold-ups'
275
+ c.file.bullet_character = '*'
276
+ c.file.header_date_format = '%m/%d/%Y'
277
+ c.file.sub_header_order = %w[current previous impediments notes]
278
+ end
251
279
  ```
252
280
 
253
281
  ## API
254
- Below are some quick examples, but the API is fully documented in the
255
- [documentation](https://evanthegrayt.github.io/standup_md/doc/index.html).
282
+ The API is fully documented in the
283
+ [RDoc Documentation](https://evanthegrayt.github.io/standup_md/doc/index.html).
284
+
285
+ This was mainly written as a command line utility, but the API is ridiculously
286
+ robust, and is available for use in your own projects. A quick example of how
287
+ to write a new entry via code could look like the following:
256
288
 
257
- This was mainly written as a command line utility, but I made the API available
258
- for scripting. There are attribute accessors for most of the settings in the
259
- [customization table](#customization-and-runtime-options) above. A
260
- quick example of how to write a new entry via code could look like the
261
- following:
289
+ ### API Examples
262
290
 
263
291
  ```ruby
264
292
  require 'standup_md'
265
293
 
266
- standup = StandupMD.load do |s|
267
- s.current_header = 'Today',
268
- s.current_entry_tasks = ['Thing to do today', 'Another thing to do today'],
269
- s.impediments = ['Not enough time in the day']
294
+ StandupMD.configure do |c|
295
+ c.file.current_header = 'Today',
270
296
  end
271
297
 
272
- standup.write
298
+ file = StandupMD::File.find_by_date(Date.today)
299
+ entry = StandupMD::Entry.create { |e| e.current = ['Stuff I will do today'] }
300
+ file.entries << entry
301
+ file.write
273
302
  ```
274
- Note: `StandupMD::load() { ... }` just is a quick way to call `StandupMD::new
275
- { ... }.load`.
276
303
 
277
- Entries are just hashes, so you can easily transform them to `json` objects.
304
+ The above example was written as such to show how the different pieces of the
305
+ API fit together. The code can actually be simplified to the following.
278
306
 
279
307
  ```ruby
280
308
  require 'standup_md'
281
- require 'json'
282
309
 
283
- standup = StandupMD.load
310
+ StandupMD.configure do |c|
311
+ c.file.current_header = 'Today',
312
+ c.entry.current = ['Stuff I will do today']
313
+ end
284
314
 
285
- standup_json = standup.all_entries.to_json
315
+ StandupMD::File.find_by_date(Date.today).load.write
286
316
  ```
287
317
 
288
318
  ## Reporting Bugs and Requesting Features
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/standup_md/cli'
3
+ require_relative '../lib/standup_md'
4
4
 
5
5
  StandupMD::Cli.execute(ARGV)
@@ -67,12 +67,18 @@
67
67
  <li><a href="#label-Via+RubyGems">Via RubyGems</a>
68
68
  <li><a href="#label-Manual+Installation">Manual Installation</a>
69
69
  <li><a href="#label-Usage">Usage</a>
70
- <li><a href="#label-Example">Example</a>
70
+ <li><a href="#label-Command+Line">Command Line</a>
71
+ <li><a href="#label-CLI+Examples">CLI Examples</a>
72
+ <li><a href="#label-Adding+an+entry+for+today+via+editor">Adding an entry for today via editor</a>
73
+ <li><a href="#label-Copy+the+entry+for+today+to+clipboard">Copy the entry for today to clipboard</a>
74
+ <li><a href="#label-Add+entry+to+file+without+opening+it">Add entry to file without opening it</a>
75
+ <li><a href="#label-Find+an+entry+by+date+and+print+it.">Find an entry by date and print it.</a>
71
76
  <li><a href="#label-Customization+and+Runtime+Options">Customization and Runtime Options</a>
72
- <li><a href="#label-Available+Config+File+Keys+and+Defaults">Available Config File Keys and Defaults</a>
77
+ <li><a href="#label-Available+Config+File+Options+and+Defaults">Available Config File Options and Defaults</a>
73
78
  <li><a href="#label-Executable+Flags">Executable Flags</a>
74
79
  <li><a href="#label-Using+Existing+Standup+Files">Using Existing Standup Files</a>
75
80
  <li><a href="#label-API">API</a>
81
+ <li><a href="#label-API+Examples">API Examples</a>
76
82
  <li><a href="#label-Reporting+Bugs+and+Requesting+Features">Reporting Bugs and Requesting Features</a>
77
83
  <li><a href="#label-Self-Promotion">Self-Promotion</a>
78
84
  </ul>
@@ -97,6 +103,8 @@
97
103
 
98
104
  <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>
99
105
 
106
+ <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>
107
+
100
108
  <blockquote>
101
109
  <p>The cure for all your standup woes.</p>
102
110
  </blockquote>
@@ -117,15 +125,29 @@
117
125
  </li><li>
118
126
  <p><a href="#usage">Usage</a></p>
119
127
  </li><li>
120
- <p><a href="#example">Example</a></p>
128
+ <p><a href="#command-line">Command Line</a></p>
129
+ <ul><li>
130
+ <p><a href="#cli-examples">CLI Examples</a></p>
131
+ </li><li>
132
+ <p><a href="#adding-an-entry-for-today-via-editor">Adding an entry for today via editor</a></p>
133
+ </li><li>
134
+ <p><a href="#copy-the-entry-for-today-to-clipboard">Copy the entry for today to clipboard</a></p>
135
+ </li><li>
136
+ <p><a href="#add-entry-to-file-without-opening-it">Add entry to file without opening it</a></p>
137
+ </li><li>
138
+ <p><a href="#find-an-entry-by-date-and-print-it">Find an entry by date and print it</a></p>
121
139
  </li><li>
122
140
  <p><a href="#customization-and-runtime-options">Customization and Runtime Options</a></p>
123
141
  </li><li>
124
142
  <p><a href="#using-existing-standup-files">Using existing standup files</a></p>
143
+ </li></ul>
125
144
  </li><li>
126
145
  <p><a href="#api">API</a></p>
146
+ <ul><li>
147
+ <p><a href="#api-examples">API Examples</a></p>
127
148
  </li><li>
128
149
  <p><a href="https://evanthegrayt.github.io/standup_md/doc/index.html">Documentation</a></p>
150
+ </li></ul>
129
151
  </li><li>
130
152
  <p><a href="#reporting-bugs-and-requesting-features">Reporting Bugs and Requesting Features</a></p>
131
153
  </li><li>
@@ -134,11 +156,9 @@
134
156
 
135
157
  <h2 id="label-About">About<span><a href="#label-About">&para;</a> <a href="#top">&uarr;</a></span></h2>
136
158
 
137
- <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 displaying entries from the command line.</p>
159
+ <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>
138
160
 
139
- <p>I wasn&#39;t sure that others would find this useful, but then the pandemic happened, which I assume made doing standups via chat much more common.</p>
140
-
141
- <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, and 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 an API if you&#39;d like to use this in your own code somehow.</p>
161
+ <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>
142
162
 
143
163
  <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
144
164
 
@@ -149,32 +169,35 @@
149
169
  <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-identifier">install</span> <span class="ruby-identifier">standup_md</span>
150
170
  </pre>
151
171
 
152
- <p>If you don&#39;t have permission on your system to install ruby or gems, I recommend using <a href="http://www.rubyinside.com/rbenv-a-simple-new-ruby-version-management-tool-5302.html">rbenv</a>, or you can try the manual methods below.</p>
172
+ <p>To include in your project, add the following to your <code>Gemfile</code>.</p>
173
+
174
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">&#39;standup_md&#39;</span>
175
+ </pre>
153
176
 
154
177
  <h3 id="label-Manual+Installation">Manual Installation<span><a href="#label-Manual+Installation">&para;</a> <a href="#top">&uarr;</a></span></h3>
155
178
 
156
- <p>From your terminal, clone the repository where you want it. From there, you have a couple of installation options.</p>
179
+ <p>From your terminal, clone the repository where you want it, and use <code>rake</code> to install the gem.</p>
157
180
 
158
181
  <pre>git clone https://github.com/evanthegrayt/standup_md.git
159
182
  cd standup_md
160
183
 
161
184
  # Use rake to build and install the gem.
162
- rake install
163
-
164
- # OR manually link the executable somewhere. If you use this method, you cannot
165
- # move the repository after you link it!
166
- ln -s $PWD/bin/standup /usr/local/bin/standup</pre>
185
+ rake install</pre>
167
186
 
168
187
  <h2 id="label-Usage">Usage<span><a href="#label-Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>
169
188
 
170
- <p>Call the executable.</p>
189
+ <h3 id="label-Command+Line">Command Line<span><a href="#label-Command+Line">&para;</a> <a href="#top">&uarr;</a></span></h3>
190
+
191
+ <p>For the most basic usage, simply call the executable.</p>
171
192
 
172
193
  <pre class="ruby"><span class="ruby-identifier">standup</span>
173
194
  </pre>
174
195
 
175
- <p>This opens the current month&#39;s standup file. If an entry already exists for today, nothing is added. If no entry exists for today, the previous “Current” is placed in the “Previous” section of a new entry. The format of this file is very important; do not change anything, except for adding entries for today.</p>
196
+ <p>This opens the current month&#39;s standup file. If an entry already exists for today, nothing is added. If no entry exists for today, the previous “Current” is placed in the “Previous” section of a new entry. The format of this file is very important; you may add new entries, but don&#39;t change any of the headers. Doing so will cause the parser to break. If you want to customize the headers, you can do so in the <a href="#available-config-file-options-and-defaults">configuration file</a>.</p>
197
+
198
+ <h3 id="label-CLI+Examples">CLI Examples<span><a href="#label-CLI+Examples">&para;</a> <a href="#top">&uarr;</a></span></h3>
176
199
 
177
- <h3 id="label-Example">Example<span><a href="#label-Example">&para;</a> <a href="#top">&uarr;</a></span></h3>
200
+ <h4 id="label-Adding+an+entry+for+today+via+editor">Adding an entry for today via editor<span><a href="#label-Adding+an+entry+for+today+via+editor">&para;</a> <a href="#top">&uarr;</a></span></h4>
178
201
 
179
202
  <p>For example, if the standup entry from yesterday reads as follows:</p>
180
203
 
@@ -187,72 +210,103 @@ ln -s $PWD/bin/standup /usr/local/bin/standup
187
210
  ## Impediments
188
211
  - None</pre>
189
212
 
190
- <p>The following scaffolding will be added for current entry at the top of the file: <code>markdown # 2020-04-14 ## Previous - Write new feature for `standup_md` - Fix bug in `standup_md` ## Current - &lt;!-- ADD TODAY&#39;S WORK HERE --&gt; ## Impediments - None </code></p>
213
+ <p>The following scaffolding will be added for current entry at the top of the file:</p>
214
+
215
+ <pre># 2020-04-14
216
+ ## Previous
217
+ - Write new feature for `standup_md`
218
+ - Fix bug in `standup_md`
219
+ ## Current
220
+ - &lt;!-- ADD TODAY&#39;S WORK HERE --&gt;
221
+ ## Impediments
222
+ - None</pre>
223
+
224
+ <h4 id="label-Copy+the+entry+for+today+to+clipboard">Copy the entry for today to clipboard<span><a href="#label-Copy+the+entry+for+today+to+clipboard">&para;</a> <a href="#top">&uarr;</a></span></h4>
191
225
 
192
226
  <p>There are also flags that will print entries to the command line. There&#39;s a full list of features below, but as a quick example, you can copy today&#39;s entry to your clipboard without even opening your editor.</p>
193
227
 
194
- <pre class="ruby"><span class="ruby-identifier">standup</span> <span class="ruby-operator">-</span><span class="ruby-identifier">c</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pbcopy</span>
228
+ <pre class="ruby"><span class="ruby-identifier">standup</span> <span class="ruby-operator">-</span><span class="ruby-identifier">p</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pbcopy</span>
195
229
  </pre>
196
230
 
197
- <h2 id="label-Customization+and+Runtime+Options">Customization and Runtime Options<span><a href="#label-Customization+and+Runtime+Options">&para;</a> <a href="#top">&uarr;</a></span></h2>
231
+ <p>If you wanted to add today&#39;s entry without opening your editor, and print the result to the command line, you could use the following.</p>
198
232
 
199
- <p>You can create a file in your home directory called <code>~/.standup_md.yml</code>. Settings located in this file will override default behavior. This file can also have settings overwritten at runtime by the use of options. You can view <a href="https://github.com/evanthegrayt/dotfiles/blob/master/dotfiles/standup_md.yml">my config file</a> as an example. Any setting in this file can still be overridden at runtime by passing flags to the executable.</p>
233
+ <h4 id="label-Add+entry+to+file+without+opening+it">Add entry to file without opening it<span><a href="#label-Add+entry+to+file+without+opening+it">&para;</a> <a href="#top">&uarr;</a></span></h4>
234
+
235
+ <pre>standup --no-edit --current &quot;Work on this thing&quot;,&quot;And another thing&quot;</pre>
236
+
237
+ <h4 id="label-Find+an+entry+by+date+and+print+it.">Find an entry by date and print it.<span><a href="#label-Find+an+entry+by+date+and+print+it.">&para;</a> <a href="#top">&uarr;</a></span></h4>
238
+
239
+ <p>If you wanted to find and print the entry for March 2nd, 2020, you could use the following.</p>
240
+
241
+ <pre>standup -p 2020-03-02</pre>
242
+
243
+ <h3 id="label-Customization+and+Runtime+Options">Customization and Runtime Options<span><a href="#label-Customization+and+Runtime+Options">&para;</a> <a href="#top">&uarr;</a></span></h3>
244
+
245
+ <p>You can create a file in your home directory called <code>~/.standuprc</code>. Settings located in this file will override default behavior. This file can also have settings overwritten at runtime by the use of options. You can view <a href="https://github.com/evanthegrayt/dotfiles/blob/master/dotfiles/standuprc">my config file</a> as an example. Any setting in this file can still be overridden at runtime by passing flags to the executable.</p>
200
246
 
201
247
  <p>You&#39;ll notice, a lot of settings don&#39;t have the ability to be changed at runtime when calling the executable. This is because the file structure is very important, and changing values that affect formatting will cause problems with the file parser. If you don&#39;t want to use a default, make the change in your config file before you start editing standups. There is an <a href="https://github.com/evanthegrayt/standup_md/issues/16">open issue</a> for handling this for the user, but they&#39;re not available yet.</p>
202
248
 
203
249
  <p>There are no options to change the headers at runtime because it uses the headers to detect tasks from previous entries. If changed at runtime, this would cause errors. For this reason, if you don&#39;t like the default headers, change them in your configuration file after installation, and then try to not change them again.</p>
204
250
 
205
- <h3 id="label-Available+Config+File+Keys+and+Defaults">Available Config File Keys and Defaults<span><a href="#label-Available+Config+File+Keys+and+Defaults">&para;</a> <a href="#top">&uarr;</a></span></h3>
206
-
207
- <pre># Key: Default
208
- header_depth: 1
209
- header_date_format: &#39;%Y-%m-%d&#39;
210
- sub_header_depth: 2
211
- current_header: &#39;Current&#39;
212
- previous_header: &#39;Previous&#39;
213
- impediments_header: &#39;Impediments&#39;
214
- file_name_format: &#39;%Y_%m.md&#39;
215
- bullet_character: &#39;-&#39; # (dash)
216
- directory: &#39;~/.cache/standup_md&#39;
217
- editor: # $VISUAL, $EDITOR or vim, in that order
218
- current_entry_tasks:
219
- - &quot;&lt;!-- ADD TODAY&#39;S WORK HERE --&gt;&quot;
220
- previous_entry_tasks: # An array of the tasks from the previous entry
221
- impediments:
222
- - &#39;None&#39;
223
- notes: null # If not null, must be array
224
- sub_header_order:
225
- - &#39;previous&#39;
226
- - &#39;current&#39;
227
- - &#39;impediments&#39;
228
- - &#39;notes&#39;</pre>
229
-
230
- <h3 id="label-Executable+Flags">Executable Flags<span><a href="#label-Executable+Flags">&para;</a> <a href="#top">&uarr;</a></span></h3>
231
-
232
- <pre>The Standup Doctor
233
- --current-entry-tasks=ARRAY List of current entry&#39;s tasks
234
- --previous-entry-tasks=ARRAY List of yesterday&#39;s tasks
235
- --impediments=ARRAY List of impediments for current entry
236
- --notes=ARRAY List of notes for current entry
237
- --sub-header-order=ARRAY The order of the sub-headers when writing the file
238
- --[no-]append-previous Append previous tasks? Default is true
239
- -f, --file-name-format=STRING Date-formattable string to use for standup file name
240
- -e, --editor=EDITOR Editor to use for opening standup files
241
- -d, --directory=DIRECTORY The directories where standup files are located
242
- --[no-]write Write current entry if it doesn&#39;t exist. Default is true
243
- --[no-]edit Open the file in the editor. Default is true
244
- -j, --[no-]json Print output as formatted json. Default is false.
245
- -v, --[no-]verbose Verbose output. Default is false.
246
- -c, --current Print current entry. Disables editing
247
- -a, --all Print all previous entries. Disables editing</pre>
248
-
249
- <p>Any options not set in this file will retain their default values. Note that if you change <code>file_name_format</code>, and don&#39;t use a month or year, there will only ever be one standup file. This could cause issues long-term, as the files will get large over time and possibly cause performance issues.</p>
251
+ <h4 id="label-Available+Config+File+Options+and+Defaults">Available Config File Options and Defaults<span><a href="#label-Available+Config+File+Options+and+Defaults">&para;</a> <a href="#top">&uarr;</a></span></h4>
252
+
253
+ <pre class="ruby"><span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">configure</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
254
+ <span class="ruby-comment"># Defaults for how the file is formatted.</span>
255
+ <span class="ruby-comment"># See https://evanthegrayt.github.io/standup_md/doc/StandupMD/Config/Cli.html</span>
256
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">header_date_format</span> = <span class="ruby-string">&#39;%Y-%m-%d&#39;</span>
257
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">header_depth</span> = <span class="ruby-value">1</span>
258
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub_header_depth</span> = <span class="ruby-value">2</span>
259
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">current_header</span> = <span class="ruby-string">&#39;Current&#39;</span>
260
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">previous_header</span> = <span class="ruby-string">&#39;Previous&#39;</span>
261
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">impediments_header</span> = <span class="ruby-string">&#39;Impediments&#39;</span>
262
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">notes_header</span> = <span class="ruby-string">&#39;Notes&#39;</span>
263
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub_header_order</span> = <span class="ruby-node">%w[previous current impediments notes]</span>
264
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">directory</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;HOME&#39;</span>], <span class="ruby-string">&#39;.cache&#39;</span>, <span class="ruby-string">&#39;standup_md&#39;</span>)
265
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">bullet_character</span> = <span class="ruby-string">&#39;-&#39;</span>
266
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">name_format</span> = <span class="ruby-string">&#39;%Y_%m.md&#39;</span>
267
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">create</span> = <span class="ruby-keyword">true</span>
268
+
269
+ <span class="ruby-comment"># Defaults for entries</span>
270
+ <span class="ruby-comment"># See https://evanthegrayt.github.io/standup_md/doc/StandupMD/Config/Entry.html</span>
271
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">current</span> = [<span class="ruby-string">&quot;&lt;!-- ADD TODAY&#39;S WORK HERE --&gt;&quot;</span>]
272
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">previous</span> = []
273
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">impediments</span> = [<span class="ruby-string">&#39;None&#39;</span>]
274
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">notes</span> = []
275
+
276
+ <span class="ruby-comment"># Defaults for executable runtime behavior.</span>
277
+ <span class="ruby-comment"># See https://evanthegrayt.github.io/standup_md/doc/StandupMD/Config/Cli.html</span>
278
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">date</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span>
279
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">editor</span> = <span class="ruby-string">&#39;vim&#39;</span> <span class="ruby-comment"># Checks $VISUAL and $EDITOR first, in that order</span>
280
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">verbose</span> = <span class="ruby-keyword">false</span>
281
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">edit</span> = <span class="ruby-keyword">true</span>
282
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">write</span> = <span class="ruby-keyword">true</span>
283
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">print</span> = <span class="ruby-keyword">false</span>
284
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">auto_fill_previous</span> = <span class="ruby-keyword">true</span>
285
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">cli</span>.<span class="ruby-identifier">preference_file</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;HOME&#39;</span>], <span class="ruby-string">&#39;.standuprc&#39;</span>))
286
+ <span class="ruby-keyword">end</span>
287
+ </pre>
250
288
 
251
- <p>If you wanted to add some tasks at runtime, and without opening the file in an editor, you could use the following:</p>
289
+ <h4 id="label-Executable+Flags">Executable Flags<span><a href="#label-Executable+Flags">&para;</a> <a href="#top">&uarr;</a></span></h4>
290
+
291
+ <pre>--current ARRAY List of current entry&#39;s tasks
292
+ --previous ARRAY List of precious entry&#39;s tasks
293
+ --impediments ARRAY List of impediments for current entry
294
+ --notes ARRAY List of notes for current entry
295
+ --sub-header-order ARRAY The order of the sub-headers when writing the file
296
+ -f, --file-name-format STRING Date-formattable string to use for standup file name
297
+ -E, --editor EDITOR Editor to use for opening standup files
298
+ -d, --directory DIRECTORY The directories where standup files are located
299
+ -w --[no-]write Write current entry if it doesn&#39;t exist. Default is true
300
+ -a --[no-]auto-fill-previous Auto-generate &#39;previous&#39; tasks for new entries
301
+ -e --[no-]edit Open the file in the editor. Default is true
302
+ -v, --[no-]verbose Verbose output. Default is false.
303
+ -p, --print [DATE] Print current entry.
304
+ If DATE is passed, will print entry for DATE, if it exists.
305
+ DATE must be in the same format as file-name-format</pre>
252
306
 
253
- <pre>standup --no-edit --current-entry-tasks=&quot;Work on this thing&quot;,&quot;And another thing!&quot;</pre>
307
+ <p>Any options not set in this file will retain their default values. Note that if you change <code>file_name_format</code>, and don&#39;t use a month or year, there will only ever be one standup file. This could cause issues long-term, as the files will get large over time and possibly cause performance issues.</p>
254
308
 
255
- <h3 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></h3>
309
+ <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>
256
310
 
257
311
  <p>If you already have a directory of existing standup files, you can use them, but they must be in a format that the parser can understand. The default is:</p>
258
312
 
@@ -266,61 +320,64 @@ sub_header_order:
266
320
  ## Notes
267
321
  - notes, if any are present</pre>
268
322
 
269
- <p>The order, words, date format, and header level are all customizable, but the overall format must be the same. If customization is necessary, this must be done in <code>~/.standup_md.yml</code> before execution, or else the parser will error.</p>
323
+ <p>The order, words, date format, and header level are all customizable, but the overall format must be the same. If customization is necessary, this must be done in <code>~/.standuprc</code> before execution, or else the parser will error.</p>
270
324
 
271
325
  <p>For example, if you wanted the format to be as follows:</p>
272
326
 
273
327
  <pre>## 05/01/2020
274
328
  ### Today
275
- - task
329
+ * task
276
330
  ### Yesterday
277
- - task
331
+ * task
278
332
  ### Hold-ups
279
- - impediment
333
+ * impediment
280
334
  ### Notes
281
- - notes, if any are present</pre>
282
-
283
- <p>Your <code>~/.standup_md.yml</code> should contain:</p>
284
-
285
- <pre>sub_header_depth: 3
286
- header_depth: 2
287
- current_header: Today
288
- previous_header: Yesterday
289
- impediments_header: Hold-ups
290
- header_date_format: &#39;%m/%d/%Y&#39;
291
- sub_header_order:
292
- - current
293
- - previous
294
- - impediments
295
- - notes</pre>
335
+ * notes, if any are present</pre>
336
+
337
+ <p>Your <code>~/.standuprc</code> should contain:</p>
338
+
339
+ <pre class="ruby"><span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">configure</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
340
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">header_depth</span> = <span class="ruby-value">2</span>
341
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub_header_depth</span> = <span class="ruby-value">3</span>
342
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">current_header</span> = <span class="ruby-string">&#39;Today&#39;</span>
343
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">previous_header</span> = <span class="ruby-string">&#39;Yesterday&#39;</span>
344
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">impediments_header</span> = <span class="ruby-string">&#39;Hold-ups&#39;</span>
345
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">bullet_character</span> = <span class="ruby-string">&#39;*&#39;</span>
346
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">header_date_format</span> = <span class="ruby-string">&#39;%m/%d/%Y&#39;</span>
347
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub_header_order</span> = <span class="ruby-node">%w[current previous impediments notes]</span>
348
+ <span class="ruby-keyword">end</span>
349
+ </pre>
296
350
 
297
351
  <h2 id="label-API">API<span><a href="#label-API">&para;</a> <a href="#top">&uarr;</a></span></h2>
298
352
 
299
- <p>Below are some quick examples, but the API is fully documented in the <a href="https://evanthegrayt.github.io/standup_md/doc/index.html">documentation</a>.</p>
353
+ <p>The API is fully documented in the <a href="https://evanthegrayt.github.io/standup_md/doc/index.html">RDoc Documentation</a>.</p>
354
+
355
+ <p>This was mainly written as a command line utility, but the API is ridiculously robust, and is available for use in your own projects. A quick example of how to write a new entry via code could look like the following:</p>
300
356
 
301
- <p>This was mainly written as a command line utility, but I made the API available for scripting. There are attribute accessors for most of the settings in the <a href="#customization-and-runtime-options">customization table</a> above. A quick example of how to write a new entry via code could look like the following:</p>
357
+ <h3 id="label-API+Examples">API Examples<span><a href="#label-API+Examples">&para;</a> <a href="#top">&uarr;</a></span></h3>
302
358
 
303
359
  <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;standup_md&#39;</span>
304
360
 
305
- <span class="ruby-identifier">standup</span> = <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">load</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
306
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">current_header</span> = <span class="ruby-string">&#39;Today&#39;</span>,
307
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">current_entry_tasks</span> = [<span class="ruby-string">&#39;Thing to do today&#39;</span>, <span class="ruby-string">&#39;Another thing to do today&#39;</span>],
308
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">impediments</span> = [<span class="ruby-string">&#39;Not enough time in the day&#39;</span>]
361
+ <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">configure</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
362
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">current_header</span> = <span class="ruby-string">&#39;Today&#39;</span>,
309
363
  <span class="ruby-keyword">end</span>
310
364
 
311
- <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">write</span>
365
+ <span class="ruby-identifier">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-constant">Date</span>.<span class="ruby-identifier">today</span>)
366
+ <span class="ruby-identifier">entry</span> = <span class="ruby-constant">StandupMD</span><span class="ruby-operator">::</span><span class="ruby-constant">Entry</span>.<span class="ruby-identifier">create</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">current</span> = [<span class="ruby-string">&#39;Stuff I will do today&#39;</span>] }
367
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">entries</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">entry</span>
368
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span>
312
369
  </pre>
313
370
 
314
- <p>Note: <code>StandupMD::load() { ... }</code> just is a quick way to call <code>StandupMD::new { ... }.load</code>.</p>
315
-
316
- <p>Entries are just hashes, so you can easily transform them to <code>json</code> objects.</p>
371
+ <p>The above example was written as such to show how the different pieces of the API fit together. The code can actually be simplified to the following.</p>
317
372
 
318
373
  <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;standup_md&#39;</span>
319
- <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;json&#39;</span>
320
374
 
321
- <span class="ruby-identifier">standup</span> = <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">load</span>
375
+ <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">configure</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
376
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">current_header</span> = <span class="ruby-string">&#39;Today&#39;</span>,
377
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">current</span> = [<span class="ruby-string">&#39;Stuff I will do today&#39;</span>]
378
+ <span class="ruby-keyword">end</span>
322
379
 
323
- <span class="ruby-identifier">standup_json</span> = <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">all_entries</span>.<span class="ruby-identifier">to_json</span>
380
+ <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-constant">Date</span>.<span class="ruby-identifier">today</span>).<span class="ruby-identifier">load</span>.<span class="ruby-identifier">write</span>
324
381
  </pre>
325
382
 
326
383
  <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>