standup_md 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47e0efce596a788d69ac8f7faeadc54532bb1ff1995b52c56ad2e0dc707c5472
4
- data.tar.gz: b3cdb0c4cef322a5b1020ce073bd325a046abee1a7926b73200f0b302ffe8703
3
+ metadata.gz: 242a29dbf1c80aad455f52db138b1a8bae0f04d3d2fa7274800ec69d8b5b9b74
4
+ data.tar.gz: dbe432dfa8b42deb98d03bd3131bfdd8a79df77fd162a6a04af4f0c99837524b
5
5
  SHA512:
6
- metadata.gz: dab3f3fa03a6c1635274dd7545bfb959ea961d9c8868f6062af0a4a7d2d00d760c0ccec4cc65d30bb8ca24702ed2773741da91254f3a0bdc6a57717d63ccfa05
7
- data.tar.gz: a00498bcc03da2e7867c7c0bcdf1b53791f37f5f8d5707624ebd433ae3e30e8e4bc600f3593a32d9814b9e9f47229a3322aac6f854cf40abe46f969060137a57
6
+ metadata.gz: 7d3014ead364eea9aa5584207fd1a3cf8ae099b18b0f7b0afef3642adb20565c4741d010b92d104d191405fc7b05a929f05d0af089d0a9544325f490b0f74277
7
+ data.tar.gz: 63f257db8bd154170580ee1379dbe2942c412438fce6879b685cd3d236b9fee3edb6df985499284dd2000bc712ae81305712d20f9ec50dc1b8d1567e1698a2b6
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
@@ -18,11 +18,17 @@ View on: [Github](https://github.com/evanthegrayt/standup_md) |
18
18
  - [Via RubyGems](#via-rubygems)
19
19
  - [Manual Installation](#manual-installation)
20
20
  - [Usage](#usage)
21
- - [Example](#example)
22
- - [Customization and Runtime Options](#customization-and-runtime-options)
23
- - [Using existing standup files](#using-existing-standup-files)
24
- - [API](#api)
25
- - [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)
26
32
  - [Reporting Bugs and Requesting Features](#reporting-bugs-and-requesting-features)
27
33
  - [Self-Promotion](#self-promotion)
28
34
 
@@ -32,17 +38,15 @@ chat client, such as Slack, Mattermost, or Riot. Typing out my standup every day
32
38
  became tedious, as I'd have to look up what I did the day before, copy and paste
33
39
  yesterday's work into a new entry, and add today's tasks. This gem automates
34
40
  most of this process, along with providing means of opening the file in your
35
- editor, and displaying entries from the command line.
36
-
37
- I wasn't sure that others would find this useful, but then the pandemic
38
- happened, which I assume made doing standups via chat much more common.
41
+ editor, and finding and displaying entries from the command line.
39
42
 
40
43
  In a nutshell, calling `standup` from the command line will open a standup file
41
44
  for the current month in your preferred editor. If an entry for today is already
42
45
  present, no text will be generated. If an entry for today doesn't exist, one
43
- will be generated, and if a previous entry exists, it will be added to today's
44
- entry as your previous day's work. See [example](#example). There's also an API
45
- 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.
46
50
 
47
51
  ## Installation
48
52
  ### Via RubyGems
@@ -52,15 +56,15 @@ Just install the gem!
52
56
  gem install standup_md
53
57
  ```
54
58
 
55
- If you don't have permission on your system to install ruby or gems, I recommend
56
- using
57
- [rbenv](http://www.rubyinside.com/rbenv-a-simple-new-ruby-version-management-tool-5302.html),
58
- or you can try the manual methods below.
59
+ To include in your project, add the following to your `Gemfile`.
59
60
 
61
+ ```ruby
62
+ gem 'standup_md'
63
+ ```
60
64
 
61
65
  ### Manual Installation
62
- From your terminal, clone the repository where you want it. From there, you have
63
- a couple of installation options.
66
+ From your terminal, clone the repository where you want it, and use `rake` to
67
+ install the gem.
64
68
 
65
69
  ```sh
66
70
  git clone https://github.com/evanthegrayt/standup_md.git
@@ -68,14 +72,11 @@ cd standup_md
68
72
 
69
73
  # Use rake to build and install the gem.
70
74
  rake install
71
-
72
- # OR manually link the executable somewhere. If you use this method, you cannot
73
- # move the repository after you link it!
74
- ln -s $PWD/bin/standup /usr/local/bin/standup
75
75
  ```
76
76
 
77
77
  ## Usage
78
- Call the executable.
78
+ ### Command Line
79
+ For the most basic usage, simplyt call the executable.
79
80
 
80
81
  ```sh
81
82
  standup
@@ -83,10 +84,13 @@ standup
83
84
 
84
85
  This opens the current month's standup file. If an entry already exists for
85
86
  today, nothing is added. If no entry exists for today, the previous "Current" is
86
- placed in the "Previous" section of a new entry. The format of this file is
87
- 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).
88
91
 
89
- ### Example
92
+ ### CLI Examples
93
+ #### Adding an entry for today via editor
90
94
  For example, if the standup entry from yesterday reads as follows:
91
95
 
92
96
  ```markdown
@@ -114,19 +118,36 @@ file:
114
118
  - None
115
119
  ```
116
120
 
121
+ #### Copy the entry for today to clipboard
117
122
  There are also flags that will print entries to the command line. There's a full
118
123
  list of features below, but as a quick example, you can copy today's entry to
119
124
  your clipboard without even opening your editor.
120
125
 
121
126
  ```sh
122
- 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" -p
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
123
144
  ```
124
145
 
125
- ## Customization and Runtime Options
126
- You can create a file in your home directory called `~/.standup_md.yml`.
127
- Settings located in this file will override default behavior. This file can also
128
- have settings overwritten at runtime by the use of options. You can view [my config
129
- 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)
130
151
  as an example. Any setting in this file can still be overridden at runtime by
131
152
  passing flags to the executable.
132
153
 
@@ -145,51 +166,62 @@ them in your configuration file after installation, and then try to not change
145
166
  them again.
146
167
 
147
168
 
148
- ### Available Config File Keys and Defaults
149
-
150
- ```yaml
151
- # Key: Default
152
- header_depth: 1
153
- header_date_format: '%Y-%m-%d'
154
- sub_header_depth: 2
155
- current_header: 'Current'
156
- previous_header: 'Previous'
157
- impediments_header: 'Impediments'
158
- file_name_format: '%Y_%m.md'
159
- bullet_character: '-' # (dash)
160
- directory: '~/.cache/standup_md'
161
- editor: # $VISUAL, $EDITOR or vim, in that order
162
- current_entry_tasks:
163
- - "<!-- ADD TODAY'S WORK HERE -->"
164
- previous_entry_tasks: # An array of the tasks from the previous entry
165
- impediments:
166
- - 'None'
167
- notes: null # If not null, must be array
168
- sub_header_order:
169
- - 'previous'
170
- - 'current'
171
- - 'impediments'
172
- - '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
173
206
  ```
174
207
 
175
- ### Executable Flags
208
+ #### Executable Flags
176
209
  ```
177
- The Standup Doctor
178
- --current-entry-tasks=ARRAY List of current entry's tasks
179
- --previous-entry-tasks=ARRAY List of yesterday's tasks
180
- --impediments=ARRAY List of impediments for current entry
181
- --notes=ARRAY List of notes for current entry
182
- --sub-header-order=ARRAY The order of the sub-headers when writing the file
183
- --[no-]append-previous Append previous tasks? Default is true
184
- -f, --file-name-format=STRING Date-formattable string to use for standup file name
185
- -e, --editor=EDITOR Editor to use for opening standup files
186
- -d, --directory=DIRECTORY The directories where standup files are located
187
- --[no-]write Write current entry if it doesn't exist. Default is true
188
- --[no-]edit Open the file in the editor. Default is true
189
- -j, --[no-]json Print output as formatted json. Default is false.
190
- -v, --[no-]verbose Verbose output. Default is false.
191
- -c, --current Print current entry. Disables editing
192
- -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
193
225
  ```
194
226
 
195
227
  Any options not set in this file will retain their default values. Note that if
@@ -197,14 +229,7 @@ you change `file_name_format`, and don't use a month or year, there will only
197
229
  ever be one standup file. This could cause issues long-term, as the files will
198
230
  get large over time and possibly cause performance issues.
199
231
 
200
- If you wanted to add some tasks at runtime, and without opening the file in an
201
- editor, you could use the following:
202
-
203
- ```bash
204
- standup --no-edit --current-entry-tasks="Work on this thing","And another thing!"
205
- ```
206
-
207
- ### Using Existing Standup Files
232
+ #### Using Existing Standup Files
208
233
  If you already have a directory of existing standup files, you can use them, but
209
234
  they must be in a format that the parser can understand. The default is:
210
235
 
@@ -222,7 +247,7 @@ they must be in a format that the parser can understand. The default is:
222
247
 
223
248
  The order, words, date format, and header level are all customizable, but the
224
249
  overall format must be the same. If customization is necessary, this must be
225
- 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.
226
251
 
227
252
  For example, if you wanted the format to be as follows:
228
253
 
@@ -238,57 +263,58 @@ For example, if you wanted the format to be as follows:
238
263
  * notes, if any are present
239
264
  ```
240
265
 
241
- Your `~/.standup_md.yml` should contain:
242
-
243
- ```yaml
244
- header_depth: 2
245
- sub_header_depth: 3
246
- current_header: Today
247
- previous_header: Yesterday
248
- impediments_header: Hold-ups
249
- bullet_character: '*'
250
- header_date_format: '%m/%d/%Y'
251
- sub_header_order:
252
- - current
253
- - previous
254
- - impediments
255
- - notes
266
+ Your `~/.standuprc` should contain:
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
256
279
  ```
257
280
 
258
281
  ## API
259
- Below are some quick examples, but the API is fully documented in the
282
+ The API is fully documented in the
260
283
  [documentation](https://evanthegrayt.github.io/standup_md/doc/index.html).
261
284
 
262
- This was mainly written as a command line utility, but I made the API available
263
- for scripting. There are attribute accessors for most of the settings in the
264
- [customization table](#customization-and-runtime-options) above. A
265
- quick example of how to write a new entry via code could look like the
266
- following:
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:
288
+
289
+ ### API Examples
267
290
 
268
291
  ```ruby
269
292
  require 'standup_md'
293
+ require 'date'
270
294
 
271
- standup = StandupMD.load do |s|
272
- s.current_header = 'Today',
273
- s.current_entry_tasks = ['Thing to do today', 'Another thing to do today'],
274
- s.impediments = ['Not enough time in the day']
295
+ StandupMD.configure do |c|
296
+ c.file.current_header = 'Today',
275
297
  end
276
298
 
277
- standup.write
299
+ file = StandupMD::File.find_by_date(Date.today)
300
+ entry = StandupMD::Entry.create { |e| e.current = ['Stuff I will do today'] }
301
+ file.entries << entry
302
+ file.write
278
303
  ```
279
304
 
280
- Note: `StandupMD.load { ... }` just is a quick way to call `StandupMD.new {
281
- ... }.load`
282
-
283
- Entries are just hashes, so you can easily transform them to `json` objects.
305
+ The above example was written as such to show how the different pieces of the
306
+ API fit together. The code can actually be simplified to the following.
284
307
 
285
308
  ```ruby
286
309
  require 'standup_md'
287
- require 'json'
310
+ require 'date'
288
311
 
289
- standup = StandupMD.load
312
+ StandupMD.configure do |c|
313
+ c.file.current_header = 'Today',
314
+ c.entry.current = ['Stuff I will do today']
315
+ end
290
316
 
291
- standup_json = standup.all_entries.to_json
317
+ StandupMD::File.find_by_date(Date.today).load.write
292
318
  ```
293
319
 
294
320
  ## 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>
@@ -119,15 +125,29 @@
119
125
  </li><li>
120
126
  <p><a href="#usage">Usage</a></p>
121
127
  </li><li>
122
- <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>
123
139
  </li><li>
124
140
  <p><a href="#customization-and-runtime-options">Customization and Runtime Options</a></p>
125
141
  </li><li>
126
142
  <p><a href="#using-existing-standup-files">Using existing standup files</a></p>
143
+ </li></ul>
127
144
  </li><li>
128
145
  <p><a href="#api">API</a></p>
146
+ <ul><li>
147
+ <p><a href="#api-examples">API Examples</a></p>
129
148
  </li><li>
130
149
  <p><a href="https://evanthegrayt.github.io/standup_md/doc/index.html">Documentation</a></p>
150
+ </li></ul>
131
151
  </li><li>
132
152
  <p><a href="#reporting-bugs-and-requesting-features">Reporting Bugs and Requesting Features</a></p>
133
153
  </li><li>
@@ -136,11 +156,9 @@
136
156
 
137
157
  <h2 id="label-About">About<span><a href="#label-About">&para;</a> <a href="#top">&uarr;</a></span></h2>
138
158
 
139
- <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>
140
160
 
141
- <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>
142
-
143
- <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>
144
162
 
145
163
  <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
146
164
 
@@ -151,32 +169,35 @@
151
169
  <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-identifier">install</span> <span class="ruby-identifier">standup_md</span>
152
170
  </pre>
153
171
 
154
- <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>
155
176
 
156
177
  <h3 id="label-Manual+Installation">Manual Installation<span><a href="#label-Manual+Installation">&para;</a> <a href="#top">&uarr;</a></span></h3>
157
178
 
158
- <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>
159
180
 
160
181
  <pre>git clone https://github.com/evanthegrayt/standup_md.git
161
182
  cd standup_md
162
183
 
163
184
  # Use rake to build and install the gem.
164
- rake install
165
-
166
- # OR manually link the executable somewhere. If you use this method, you cannot
167
- # move the repository after you link it!
168
- ln -s $PWD/bin/standup /usr/local/bin/standup</pre>
185
+ rake install</pre>
169
186
 
170
187
  <h2 id="label-Usage">Usage<span><a href="#label-Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>
171
188
 
172
- <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, simplyt call the executable.</p>
173
192
 
174
193
  <pre class="ruby"><span class="ruby-identifier">standup</span>
175
194
  </pre>
176
195
 
177
- <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>
178
199
 
179
- <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>
180
201
 
181
202
  <p>For example, if the standup entry from yesterday reads as follows:</p>
182
203
 
@@ -200,70 +221,92 @@ ln -s $PWD/bin/standup /usr/local/bin/standup
200
221
  ## Impediments
201
222
  - None</pre>
202
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>
225
+
203
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>
204
227
 
205
- <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>
206
229
  </pre>
207
230
 
208
- <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>
232
+
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>
209
234
 
210
- <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>
235
+ <pre>standup --no-edit --current &quot;Work on this thing&quot;,&quot;And another thing&quot; -p</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>
211
246
 
212
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>
213
248
 
214
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>
215
250
 
216
- <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>
217
-
218
- <pre># Key: Default
219
- header_depth: 1
220
- header_date_format: &#39;%Y-%m-%d&#39;
221
- sub_header_depth: 2
222
- current_header: &#39;Current&#39;
223
- previous_header: &#39;Previous&#39;
224
- impediments_header: &#39;Impediments&#39;
225
- file_name_format: &#39;%Y_%m.md&#39;
226
- bullet_character: &#39;-&#39; # (dash)
227
- directory: &#39;~/.cache/standup_md&#39;
228
- editor: # $VISUAL, $EDITOR or vim, in that order
229
- current_entry_tasks:
230
- - &quot;&lt;!-- ADD TODAY&#39;S WORK HERE --&gt;&quot;
231
- previous_entry_tasks: # An array of the tasks from the previous entry
232
- impediments:
233
- - &#39;None&#39;
234
- notes: null # If not null, must be array
235
- sub_header_order:
236
- - &#39;previous&#39;
237
- - &#39;current&#39;
238
- - &#39;impediments&#39;
239
- - &#39;notes&#39;</pre>
240
-
241
- <h3 id="label-Executable+Flags">Executable Flags<span><a href="#label-Executable+Flags">&para;</a> <a href="#top">&uarr;</a></span></h3>
242
-
243
- <pre>The Standup Doctor
244
- --current-entry-tasks=ARRAY List of current entry&#39;s tasks
245
- --previous-entry-tasks=ARRAY List of yesterday&#39;s tasks
246
- --impediments=ARRAY List of impediments for current entry
247
- --notes=ARRAY List of notes for current entry
248
- --sub-header-order=ARRAY The order of the sub-headers when writing the file
249
- --[no-]append-previous Append previous tasks? Default is true
250
- -f, --file-name-format=STRING Date-formattable string to use for standup file name
251
- -e, --editor=EDITOR Editor to use for opening standup files
252
- -d, --directory=DIRECTORY The directories where standup files are located
253
- --[no-]write Write current entry if it doesn&#39;t exist. Default is true
254
- --[no-]edit Open the file in the editor. Default is true
255
- -j, --[no-]json Print output as formatted json. Default is false.
256
- -v, --[no-]verbose Verbose output. Default is false.
257
- -c, --current Print current entry. Disables editing
258
- -a, --all Print all previous entries. Disables editing</pre>
259
-
260
- <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>
261
288
 
262
- <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>
263
306
 
264
- <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>
265
308
 
266
- <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>
267
310
 
268
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>
269
312
 
@@ -277,7 +320,7 @@ sub_header_order:
277
320
  ## Notes
278
321
  - notes, if any are present</pre>
279
322
 
280
- <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>
281
324
 
282
325
  <p>For example, if you wanted the format to be as follows:</p>
283
326
 
@@ -291,48 +334,52 @@ sub_header_order:
291
334
  ### Notes
292
335
  * notes, if any are present</pre>
293
336
 
294
- <p>Your <code>~/.standup_md.yml</code> should contain:</p>
295
-
296
- <pre>header_depth: 2
297
- sub_header_depth: 3
298
- current_header: Today
299
- previous_header: Yesterday
300
- impediments_header: Hold-ups
301
- bullet_character: &#39;*&#39;
302
- header_date_format: &#39;%m/%d/%Y&#39;
303
- sub_header_order:
304
- - current
305
- - previous
306
- - impediments
307
- - notes</pre>
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-constant">Today</span>
343
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">previous_header</span> <span class="ruby-constant">Yesterday</span>
344
+ <span class="ruby-identifier">c</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">impediments_header</span> <span class="ruby-constant">Hold</span><span class="ruby-operator">-</span><span class="ruby-identifier">ups</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>
308
350
 
309
351
  <h2 id="label-API">API<span><a href="#label-API">&para;</a> <a href="#top">&uarr;</a></span></h2>
310
352
 
311
- <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">documentation</a>.</p>
312
354
 
313
- <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>
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>
356
+
357
+ <h3 id="label-API+Examples">API Examples<span><a href="#label-API+Examples">&para;</a> <a href="#top">&uarr;</a></span></h3>
314
358
 
315
359
  <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;standup_md&#39;</span>
360
+ <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;date&#39;</span>
316
361
 
317
- <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>
318
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">current_header</span> = <span class="ruby-string">&#39;Today&#39;</span>,
319
- <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>],
320
- <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>]
362
+ <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>
363
+ <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>,
321
364
  <span class="ruby-keyword">end</span>
322
365
 
323
- <span class="ruby-identifier">standup</span>.<span class="ruby-identifier">write</span>
366
+ <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>)
367
+ <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>] }
368
+ <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>
369
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span>
324
370
  </pre>
325
371
 
326
- <p>Note: <code>StandupMD.load { ... }</code> just is a quick way to call <code>StandupMD.new { ... }.load</code></p>
327
-
328
- <p>Entries are just hashes, so you can easily transform them to <code>json</code> objects.</p>
372
+ <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>
329
373
 
330
374
  <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;standup_md&#39;</span>
331
- <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;json&#39;</span>
375
+ <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;date&#39;</span>
332
376
 
333
- <span class="ruby-identifier">standup</span> = <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">load</span>
377
+ <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>
378
+ <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>,
379
+ <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>]
380
+ <span class="ruby-keyword">end</span>
334
381
 
335
- <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>
382
+ <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>
336
383
  </pre>
337
384
 
338
385
  <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>