standup_md 0.1.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +9 -3
  4. data/README.md +183 -97
  5. data/Rakefile +11 -28
  6. data/bin/standup +1 -1
  7. data/doc/README_md.html +185 -78
  8. data/doc/StandupMD.html +102 -1227
  9. data/doc/StandupMD/Cli.html +124 -474
  10. data/doc/StandupMD/Cli/Helpers.html +167 -0
  11. data/doc/StandupMD/Config.html +230 -0
  12. data/doc/StandupMD/Config/Cli.html +355 -0
  13. data/doc/StandupMD/Config/Entry.html +284 -0
  14. data/doc/StandupMD/Config/EntryList.html +197 -0
  15. data/doc/StandupMD/Config/File.html +609 -0
  16. data/doc/StandupMD/Entry.html +478 -0
  17. data/doc/StandupMD/EntryList.html +759 -0
  18. data/doc/StandupMD/File.html +574 -0
  19. data/doc/created.rid +15 -8
  20. data/doc/index.html +192 -78
  21. data/doc/js/navigation.js.gz +0 -0
  22. data/doc/js/search_index.js +1 -1
  23. data/doc/js/search_index.js.gz +0 -0
  24. data/doc/js/searcher.js.gz +0 -0
  25. data/doc/table_of_contents.html +152 -247
  26. data/lib/standup_md.rb +29 -501
  27. data/lib/standup_md/cli.rb +63 -242
  28. data/lib/standup_md/cli/helpers.rb +165 -0
  29. data/lib/standup_md/config.rb +45 -0
  30. data/lib/standup_md/config/cli.rb +106 -0
  31. data/lib/standup_md/config/entry.rb +61 -0
  32. data/lib/standup_md/config/entry_list.rb +26 -0
  33. data/lib/standup_md/config/file.rb +199 -0
  34. data/lib/standup_md/entry.rb +121 -0
  35. data/lib/standup_md/entry_list.rb +166 -0
  36. data/lib/standup_md/file.rb +172 -0
  37. data/lib/standup_md/file/helpers.rb +62 -0
  38. data/lib/standup_md/version.rb +5 -3
  39. data/standup_md.gemspec +1 -0
  40. metadata +35 -4
  41. data/doc/TestHelper.html +0 -282
  42. data/doc/TestStandupMD.html +0 -1938
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5349ff6862de6991ec55e5437eb3249d75f519abc348d64737ae6936afe0f43a
4
- data.tar.gz: b16587755a18c42caf3b8bafbc270398db506bf60ebc069bd3281a5cbd8251e5
3
+ metadata.gz: 242a29dbf1c80aad455f52db138b1a8bae0f04d3d2fa7274800ec69d8b5b9b74
4
+ data.tar.gz: dbe432dfa8b42deb98d03bd3131bfdd8a79df77fd162a6a04af4f0c99837524b
5
5
  SHA512:
6
- metadata.gz: 4845700dde4c61e9c27252e8cf1f35cc1dd7896b3c2ee01e7f30818635d13f82ea5e59be0ebad9cf0f259c0c50b9344b197abd3774ed44a40e3df02843d75a6e
7
- data.tar.gz: '085bfef81572e551cdee0cca0260b4b9c40102696e8924a40faa961118e93a69649c5f4a41e1614d7ab29f4f5c5cbacf0bdda7616aba7d73c1228461e4ff79ca'
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.0)
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
 
@@ -15,9 +20,10 @@ PLATFORMS
15
20
  ruby
16
21
 
17
22
  DEPENDENCIES
18
- rake
23
+ rake (~> 13.0, >= 13.0.1)
24
+ simplecov
19
25
  standup_md!
20
- test-unit
26
+ test-unit (~> 3.3, >= 3.3.5)
21
27
 
22
28
  BUNDLED WITH
23
29
  2.1.4
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,10 +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
- - [API](#api)
20
- - [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)
21
32
  - [Reporting Bugs and Requesting Features](#reporting-bugs-and-requesting-features)
22
33
  - [Self-Promotion](#self-promotion)
23
34
 
@@ -27,17 +38,15 @@ chat client, such as Slack, Mattermost, or Riot. Typing out my standup every day
27
38
  became tedious, as I'd have to look up what I did the day before, copy and paste
28
39
  yesterday's work into a new entry, and add today's tasks. This gem automates
29
40
  most of this process, along with providing means of opening the file in your
30
- editor, and displaying entries from the command line.
31
-
32
- I wasn't sure that others would find this useful, but then the pandemic
33
- happened, which I assume made doing standups via chat much more common.
41
+ editor, and finding and displaying entries from the command line.
34
42
 
35
43
  In a nutshell, calling `standup` from the command line will open a standup file
36
44
  for the current month in your preferred editor. If an entry for today is already
37
45
  present, no text will be generated. If an entry for today doesn't exist, one
38
- will be generated, and if a previous entry exists, it will be added to today's
39
- entry as your previous day's work. See [example](#example). There's also an API
40
- 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.
41
50
 
42
51
  ## Installation
43
52
  ### Via RubyGems
@@ -47,15 +56,15 @@ Just install the gem!
47
56
  gem install standup_md
48
57
  ```
49
58
 
50
- If you don't have permission on your system to install ruby or gems, I recommend
51
- using
52
- [rbenv](http://www.rubyinside.com/rbenv-a-simple-new-ruby-version-management-tool-5302.html),
53
- or you can try the manual methods below.
59
+ To include in your project, add the following to your `Gemfile`.
54
60
 
61
+ ```ruby
62
+ gem 'standup_md'
63
+ ```
55
64
 
56
65
  ### Manual Installation
57
- From your terminal, clone the repository where you want it. From there, you have
58
- a couple of installation options.
66
+ From your terminal, clone the repository where you want it, and use `rake` to
67
+ install the gem.
59
68
 
60
69
  ```sh
61
70
  git clone https://github.com/evanthegrayt/standup_md.git
@@ -63,14 +72,11 @@ cd standup_md
63
72
 
64
73
  # Use rake to build and install the gem.
65
74
  rake install
66
-
67
- # OR manually link the executable somewhere. If you use this method, you cannot
68
- # move the repository after you link it!
69
- ln -s $PWD/bin/standup /usr/local/bin/standup
70
75
  ```
71
76
 
72
77
  ## Usage
73
- Call the executable.
78
+ ### Command Line
79
+ For the most basic usage, simplyt call the executable.
74
80
 
75
81
  ```sh
76
82
  standup
@@ -78,10 +84,13 @@ standup
78
84
 
79
85
  This opens the current month's standup file. If an entry already exists for
80
86
  today, nothing is added. If no entry exists for today, the previous "Current" is
81
- placed in the "Previous" section of a new entry. The format of this file is
82
- 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).
83
91
 
84
- ### Example
92
+ ### CLI Examples
93
+ #### Adding an entry for today via editor
85
94
  For example, if the standup entry from yesterday reads as follows:
86
95
 
87
96
  ```markdown
@@ -97,6 +106,7 @@ For example, if the standup entry from yesterday reads as follows:
97
106
 
98
107
  The following scaffolding will be added for current entry at the top of the
99
108
  file:
109
+
100
110
  ```markdown
101
111
  # 2020-04-14
102
112
  ## Previous
@@ -108,19 +118,36 @@ file:
108
118
  - None
109
119
  ```
110
120
 
121
+ #### Copy the entry for today to clipboard
111
122
  There are also flags that will print entries to the command line. There's a full
112
123
  list of features below, but as a quick example, you can copy today's entry to
113
124
  your clipboard without even opening your editor.
114
125
 
115
126
  ```sh
116
- standup -c | pbcopy
127
+ standup -p | pbcopy
117
128
  ```
118
129
 
119
- ## Customization and Runtime Options
120
- You can create a file in your home directory called `~/.standup_md.yml`.
121
- Settings located in this file will override default behavior. This file can also
122
- have settings overwritten at runtime by the use of options. You can view [my config
123
- file](https://github.com/evanthegrayt/dotfiles/blob/master/dotfiles/standup_md.yml)
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
144
+ ```
145
+
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)
124
151
  as an example. Any setting in this file can still be overridden at runtime by
125
152
  passing flags to the executable.
126
153
 
@@ -139,51 +166,62 @@ them in your configuration file after installation, and then try to not change
139
166
  them again.
140
167
 
141
168
 
142
- ### Available Config File Keys and Defaults
143
-
144
- ```yaml
145
- # Key: Default
146
- header_depth: 1
147
- header_date_format: '%Y-%m-%d'
148
- sub_header_depth: 2
149
- current_header: 'Current'
150
- previous_header: 'Previous'
151
- impediments_header: 'Impediments'
152
- file_name_format: '%Y_%m.md'
153
- bullet_character: '-' # (dash)
154
- directory: '~/.cache/standup_md'
155
- editor: # $VISUAL, $EDITOR or vim, in that order
156
- current_entry_tasks:
157
- - "<!-- ADD TODAY'S WORK HERE -->"
158
- previous_entry_tasks: # An array of the tasks from the previous entry
159
- impediments:
160
- - 'None'
161
- notes: null # If not null, must be array
162
- sub_header_order:
163
- - 'previous'
164
- - 'current'
165
- - 'impediments'
166
- - 'notes'
167
- ```
168
-
169
- ### Executable Flags
170
- ```
171
- The Standup Doctor
172
- --current-entry-tasks=ARRAY List of current entry's tasks
173
- --previous-entry-tasks=ARRAY List of yesterday's tasks
174
- --impediments=ARRAY List of impediments for current entry
175
- --notes=ARRAY List of notes for current entry
176
- --sub-header-order=ARRAY The order of the sub-headers when writing the file
177
- --[no-]append-previous Append previous tasks? Default is true
178
- -f, --file-name-format=STRING Date-formattable string to use for standup file name
179
- -e, --editor=EDITOR Editor to use for opening standup files
180
- -d, --directory=DIRECTORY The directories where standup files are located
181
- --[no-]write Write current entry if it doesn't exist. Default is true
182
- --[no-]edit Open the file in the editor. Default is true
183
- -j, --[no-]json Print output as formatted json. Default is false.
184
- -v, --[no-]verbose Verbose output. Default is false.
185
- -c, --current Print current entry. Disables editing
186
- -a, --all Print all previous entries. Disables editing
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
206
+ ```
207
+
208
+ #### Executable Flags
209
+ ```
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
187
225
  ```
188
226
 
189
227
  Any options not set in this file will retain their default values. Note that if
@@ -191,44 +229,92 @@ you change `file_name_format`, and don't use a month or year, there will only
191
229
  ever be one standup file. This could cause issues long-term, as the files will
192
230
  get large over time and possibly cause performance issues.
193
231
 
194
- If you wanted to add some tasks at runtime, and without opening the file in an
195
- editor, you could use the following:
232
+ #### Using Existing Standup Files
233
+ If you already have a directory of existing standup files, you can use them, but
234
+ they must be in a format that the parser can understand. The default is:
196
235
 
197
- ```bash
198
- standup --no-edit --current-entry-tasks="Work on this thing","And another thing!"
236
+ ```markdown
237
+ # 2020-05-01
238
+ ## Previous
239
+ - task
240
+ ## Current
241
+ - task
242
+ ## Impediments
243
+ - impediment
244
+ ## Notes
245
+ - notes, if any are present
246
+ ```
247
+
248
+ The order, words, date format, and header level are all customizable, but the
249
+ overall format must be the same. If customization is necessary, this must be
250
+ done in `~/.standuprc` before execution, or else the parser will error.
251
+
252
+ For example, if you wanted the format to be as follows:
253
+
254
+ ```markdown
255
+ ## 05/01/2020
256
+ ### Today
257
+ * task
258
+ ### Yesterday
259
+ * task
260
+ ### Hold-ups
261
+ * impediment
262
+ ### Notes
263
+ * notes, if any are present
264
+ ```
265
+
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
199
279
  ```
200
280
 
201
281
  ## API
202
- Below are some quick examples, but the API is fully documented in the
282
+ The API is fully documented in the
203
283
  [documentation](https://evanthegrayt.github.io/standup_md/doc/index.html).
204
284
 
205
- This was mainly written as a command line utility, but I made the API available
206
- for scripting. There are attribute accessors for most of the settings in the
207
- [customization table](#customization-and-runtime-options) above. To view all
208
- available methods, read the comments in the [source](lib/standup_md.rb). A
209
- quick-and-dirty example of how to write a new entry via code could look like the
210
- 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
211
290
 
212
291
  ```ruby
213
292
  require 'standup_md'
293
+ require 'date'
214
294
 
215
- standup = StandupMD.load(
216
- current_header: 'Today',
217
- current_entry_tasks: ['Thing to do today', 'Another thing to do today'],
218
- impediments: ['Not enough time in the day']
219
- )
295
+ StandupMD.configure do |c|
296
+ c.file.current_header = 'Today',
297
+ end
220
298
 
221
- 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
222
303
  ```
223
304
 
224
- 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.
225
307
 
226
308
  ```ruby
227
309
  require 'standup_md'
228
- require 'json'
310
+ require 'date'
311
+
312
+ StandupMD.configure do |c|
313
+ c.file.current_header = 'Today',
314
+ c.entry.current = ['Stuff I will do today']
315
+ end
229
316
 
230
- standup = StandupMD.load
231
- standup_entries_as_json = standup.all_entries.to_json
317
+ StandupMD::File.find_by_date(Date.today).load.write
232
318
  ```
233
319
 
234
320
  ## Reporting Bugs and Requesting Features
data/Rakefile CHANGED
@@ -1,36 +1,19 @@
1
1
  require_relative 'lib/standup_md'
2
+ require 'bundler/gem_tasks'
2
3
  require 'rdoc/task'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs = ['lib']
8
+ t.warning = true
9
+ t.verbose = true
10
+ t.test_files = FileList['test/**/*_test.rb']
11
+ end
3
12
 
4
13
  RDoc::Task.new do |rdoc|
5
- rdoc.main = "README.md"
14
+ rdoc.main = 'README.md'
6
15
  rdoc.rdoc_dir = 'doc'
7
- rdoc.rdoc_files.include("README.md", "**/*.rb")
16
+ rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
8
17
  end
9
18
 
10
19
  task :default => :test
11
-
12
- desc "Build the gem"
13
- task :build do
14
- system('gem build standup_md.gemspec')
15
- end
16
-
17
- desc "Build and install the gem"
18
- task install: [:dependencies, :build] do
19
- system("gem install standup_md-#{StandupMD::VERSION}.gem")
20
- end
21
-
22
- desc "Add dependencies"
23
- task :dependencies do
24
- system("gem install bundler")
25
- system("bundle install")
26
- end
27
-
28
- desc "Uninstall the gem"
29
- task :uninstall do
30
- system('gem uninstall standup')
31
- end
32
-
33
- desc "Run test suite"
34
- task :test do
35
- Dir.glob(File.join(__dir__, 'test', '**', '*_test.rb')).each { |f| ruby f }
36
- end