standup_md 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5b3c3f8fe55eadcdc0ae76de9cb745bfe0c557c2c715884fd1056403fba31f1
4
- data.tar.gz: d7191750ade93198d7a432762eb3327425a0dcb632389dc90ba6216735b941f2
3
+ metadata.gz: d76ddd28cf3a01f84583cb1a9a03ac2b4731b0e5f977e400e88bfa382f456582
4
+ data.tar.gz: a227c637b17cbc82a32b3d98cb0dc2de93c23861c41635049681e489515a87f3
5
5
  SHA512:
6
- metadata.gz: 1cc3f477255e687f122e018ce1e4d31e6ca0ca7d9c16a003c463324230e68e528a97fc08a52194fa98965ae9ca82bfd963d0343f3b38f12526b5f8bb276b832b
7
- data.tar.gz: c0291b6fabd240ac6b292b4e97c2e5c97ed74afd8675b0274295129625326b94ae2a866ff1dabf89a5e91678537b09b572ab677cc6c87bdbb80d8a2e6e36d401
6
+ metadata.gz: ebc8045842abc5356997c8fa38f5cff05350946cb854528f68ec88714e15b7853cfbcf1a5c6663dae138de0c26b14ec007fca0c62a11279217b35dcda1ae8af3
7
+ data.tar.gz: 2eefdcfae08a7e983a0b9d232795ab501b19ada60c159ad7c5c6fbda9956f1b51d4c521f20bf6ab669be1871199376362b5d05303a303b5bcf2802b08193d6cc
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 4.0.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standup_md (2.0.1)
4
+ standup_md (2.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -49,6 +49,7 @@ GEM
49
49
  rubocop (>= 1.75.0, < 2.0)
50
50
  rubocop-ast (>= 1.47.1, < 2.0)
51
51
  ruby-progressbar (1.13.0)
52
+ semverve (0.1.0)
52
53
  simplecov (0.22.0)
53
54
  docile (~> 1.1)
54
55
  simplecov-html (~> 0.11)
@@ -82,6 +83,7 @@ PLATFORMS
82
83
  DEPENDENCIES
83
84
  rake (~> 13.0, >= 13.0.1)
84
85
  rdoc
86
+ semverve
85
87
  simplecov
86
88
  standard (~> 1.54.0)
87
89
  standup_md!
@@ -109,13 +111,14 @@ CHECKSUMS
109
111
  rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
110
112
  rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
111
113
  ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
114
+ semverve (0.1.0) sha256=cda51f2cc148af0a163ac5b25616ff3c3d20fc5aa9f036a7f2910e20ee3058b6
112
115
  simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
113
116
  simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
114
117
  simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
115
118
  standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100
116
119
  standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
117
120
  standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
118
- standup_md (2.0.1)
121
+ standup_md (2.1.0)
119
122
  stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
120
123
  test-unit (3.7.8) sha256=689d1ca53f4d46f678b4e5d68d8e4294f87fc5e8b9238cc4de7c5727e8d65943
121
124
  tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # The Standup Doctor
2
2
  <!-- vi: set ts=4 sw=4 : -->
3
3
  [![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)
4
+ [![Language: Ruby](https://img.shields.io/static/v1?label=language&message=Ruby&color=CC342D&style=flat&logo=ruby&logoColor=CC342D)](https://www.ruby-lang.org/)
4
5
  [![Gem Version](https://img.shields.io/gem/v/standup_md.svg)](https://rubygems.org/gems/standup_md)
5
- ![Language: Ruby](https://img.shields.io/static/v1?label=language&message=Ruby&color=CC342D&style=flat&logo=ruby&logoColor=CC342D)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
8
  > The cure for all your standup woes.
@@ -126,6 +126,13 @@ file:
126
126
  - None
127
127
  ```
128
128
 
129
+ Impediments are not carried forward by default. To copy the previous entry's
130
+ impediments into a new entry, pass `-i` or `--carry-forward-impediments`.
131
+
132
+ ```sh
133
+ standup -i
134
+ ```
135
+
129
136
  #### Copy the entry for today to clipboard
130
137
  There are also flags that will print entries to the command line. There's a full
131
138
  list of features below, but as a quick example, you can copy today's entry to
@@ -220,6 +227,7 @@ StandupMD.configure do |c|
220
227
  c.cli.post_adapter = nil
221
228
  c.cli.post_channel = nil
222
229
  c.cli.auto_fill_previous = true
230
+ c.cli.carry_forward_impediments = false
223
231
  c.cli.preference_file = ::File.expand_path(::File.join(ENV["HOME"], ".standuprc"))
224
232
 
225
233
  # Defaults for posting standups to chat clients.
@@ -252,6 +260,8 @@ follows.
252
260
  -d, --directory DIRECTORY The directory where standup files are located
253
261
  -w, --[no-]write Write current entry if it doesn't exist. Default is true
254
262
  -a, --[no-]auto-fill-previous Auto-generate 'previous' tasks for new entries
263
+ -i, --[no-]carry-forward-impediments
264
+ Carry impediments forward for new entries
255
265
  -e, --[no-]edit Open the file in the editor. Default is true
256
266
  -v, --[no-]verbose Verbose output. Default is false.
257
267
  --zsh-completion Print zsh completion setup instructions
@@ -430,11 +440,11 @@ markdown = parser.render(entries, start_date: entries.first.date, end_date: entr
430
440
  runtime = StandupMD.config.copy
431
441
  runtime.file.directory = "/tmp/request-standups"
432
442
  runtime.entry.current = ["Work scoped to this request"]
443
+ runtime.cli.carry_forward_impediments = true
433
444
 
434
- file = StandupMD::File.find_by_date(Date.today, config: runtime.file).load
435
- entry = StandupMD::Entry.create(config: runtime.entry)
436
- file.entries << entry
437
- file.write
445
+ cli = StandupMD::Cli.new(["--no-edit"], config: runtime)
446
+ entry = cli.entry
447
+ cli.write_file
438
448
  ```
439
449
 
440
450
  ### API Examples
data/Rakefile CHANGED
@@ -2,13 +2,18 @@
2
2
 
3
3
  $LOAD_PATH.unshift(File.expand_path("lib", __dir__))
4
4
 
5
- require "standup_md"
6
5
  require "bundler/gem_tasks"
7
6
  require "rdoc/task"
8
7
  require "rake/testtask"
8
+ require "semverve/task"
9
+ require "standup_md"
9
10
 
10
11
  STANDARD_FILES = ["lib", "test"].freeze
11
12
 
13
+ Semverve::Task.new do |t|
14
+ t.bundle_lock = true
15
+ end
16
+
12
17
  Rake::TestTask.new do |t|
13
18
  t.libs = ["lib"]
14
19
  t.warning = true
@@ -22,6 +27,8 @@ RDoc::Task.new do |rdoc|
22
27
  rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
23
28
  end
24
29
 
30
+ task default: :test
31
+
25
32
  desc "Lint with the Standard Ruby style guide"
26
33
  task :standard do
27
34
  require "standard"
@@ -37,50 +44,3 @@ task :"standard:fix" do
37
44
  exit_code = Standard::Cli.new(STANDARD_FILES + ["--fix"]).run
38
45
  fail unless exit_code.zero?
39
46
  end
40
-
41
- task default: :test
42
-
43
- namespace :version do
44
- desc "Print the current version from the version.rb file"
45
- task :current do
46
- puts StandupMD::VERSION
47
- end
48
-
49
- namespace :increment do
50
- desc "Increment the version's PATCH level"
51
- task :patch do
52
- File.join(__dir__, "lib", "standup_md", "version.rb").then do |version_file|
53
- File.write(
54
- version_file,
55
- File.read(version_file).sub(/(PATCH\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
56
- )
57
- end
58
- system("bundle lock")
59
- end
60
- desc "Increment the version's MINOR level"
61
- task :minor do
62
- File.join(__dir__, "lib", "standup_md", "version.rb").then do |version_file|
63
- File.write(
64
- version_file,
65
- File.read(version_file)
66
- .sub(/(PATCH\s=\s)(\d+)/) { "#{$1}0" }
67
- .sub(/(MINOR\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
68
- )
69
- end
70
- system("bundle lock")
71
- end
72
- desc "Increment the version's MAJOR level"
73
- task :major do
74
- File.join(__dir__, "lib", "standup_md", "version.rb").then do |version_file|
75
- File.write(
76
- version_file,
77
- File.read(version_file)
78
- .sub(/(PATCH\s=\s)(\d+)/) { "#{$1}0" }
79
- .sub(/(MINOR\s=\s)(\d+)/) { "#{$1}0" }
80
- .sub(/(MAJOR\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
81
- )
82
- end
83
- system("bundle lock")
84
- end
85
- end
86
- end
@@ -66,6 +66,8 @@ _arguments -s -S \
66
66
  '(-w --write --no-write)--no-write[do not write current entry if it does not exist]' \
67
67
  '(-a --auto-fill-previous --no-auto-fill-previous)'{-a,--auto-fill-previous}'[auto-generate previous tasks for new entries]' \
68
68
  '(-a --auto-fill-previous --no-auto-fill-previous)--no-auto-fill-previous[do not auto-generate previous tasks for new entries]' \
69
+ '(-i --carry-forward-impediments --no-carry-forward-impediments)'{-i,--carry-forward-impediments}'[carry impediments forward for new entries]' \
70
+ '(-i --carry-forward-impediments --no-carry-forward-impediments)--no-carry-forward-impediments[do not carry impediments forward for new entries]' \
69
71
  '(-e --edit --no-edit)'{-e,--edit}'[open the file in the editor]' \
70
72
  '(-e --edit --no-edit)--no-edit[do not open the file in the editor]' \
71
73
  '(-v --verbose --no-verbose)'{-v,--verbose}'[use verbose output]' \
@@ -101,6 +101,11 @@ module StandupMD
101
101
  "Auto-generate 'previous' tasks for new entries. Default is true"
102
102
  ) { |v| config.cli.auto_fill_previous = v }
103
103
 
104
+ opts.on(
105
+ "-i", "--[no-]carry-forward-impediments",
106
+ "Carry impediments forward for new entries. Default is false"
107
+ ) { |v| config.cli.carry_forward_impediments = v }
108
+
104
109
  opts.on(
105
110
  "-e", "--[no-]edit",
106
111
  "Open the file in the editor. Default is true"
@@ -170,7 +175,7 @@ module StandupMD
170
175
  config.cli.date,
171
176
  config.entry.current,
172
177
  previous_entry(file),
173
- config.entry.impediments,
178
+ impediments_entry(file),
174
179
  config.entry.notes
175
180
  ).tap { |e| file.entries << e }
176
181
  end
@@ -181,12 +186,20 @@ module StandupMD
181
186
  # @return [Array]
182
187
  def previous_entry(file)
183
188
  return config.entry.previous unless config.cli.auto_fill_previous
184
- if file.new?
185
- previous_file = prev_file_exists?
186
- return prev_entry_tasks(previous_file.load.entries) if previous_file
187
- end
188
189
 
189
- prev_entry_tasks(file.entries)
190
+ carry_forward_tasks(file, fallback: []) { |entry| entry.current_tasks }
191
+ end
192
+
193
+ ##
194
+ # The "impediments" tasks.
195
+ #
196
+ # @return [Array]
197
+ def impediments_entry(file)
198
+ return config.entry.impediments unless config.cli.carry_forward_impediments
199
+
200
+ carry_forward_tasks(file, fallback: config.entry.impediments) do |entry|
201
+ entry.impediments_tasks
202
+ end
190
203
  end
191
204
 
192
205
  def append_current_entry(entry)
@@ -217,14 +230,19 @@ module StandupMD
217
230
  raise OptionParser::InvalidArgument, value
218
231
  end
219
232
 
220
- ##
221
- # The previous entry's current tasks.
222
- #
223
- # @param [StandupMD::EntryList] entries
224
- #
225
- # @return [Array<StandupMD::Task>]
226
- def prev_entry_tasks(entries)
227
- entries.empty? ? [] : entries.last.current_tasks
233
+ def carry_forward_tasks(file, fallback:)
234
+ entry = carry_forward_entry(file)
235
+ entry.nil? ? fallback : yield(entry)
236
+ end
237
+
238
+ def carry_forward_entry(file)
239
+ carry_forward_entries(file).last
240
+ end
241
+
242
+ def carry_forward_entries(file)
243
+ return file.entries unless file.new?
244
+
245
+ find_previous_month_file&.load&.entries || file.entries
228
246
  end
229
247
 
230
248
  ##
@@ -233,14 +251,27 @@ module StandupMD
233
251
  # @param [StandupMD::Config::File] config
234
252
  #
235
253
  # @return [StandupMD::File]
236
- def prev_file(config: self.config.file)
254
+ def previous_month_file(config: self.config.file)
237
255
  StandupMD::File.find_by_date(Date.today.prev_month, config: config)
238
256
  end
239
257
 
240
- def prev_file_exists?
241
- without_file_creation { |file_config| prev_file(config: file_config) }
242
- rescue StandupMD::File::NotFoundError
243
- nil
258
+ def previous_month_file?
259
+ ::File.file?(previous_month_file_path)
260
+ end
261
+
262
+ def find_previous_month_file
263
+ return nil unless previous_month_file?
264
+
265
+ without_file_creation do |file_config|
266
+ previous_month_file(config: file_config)
267
+ end
268
+ end
269
+
270
+ def previous_month_file_path
271
+ ::File.join(
272
+ config.file.directory,
273
+ Date.today.prev_month.strftime(config.file.name_format)
274
+ )
244
275
  end
245
276
 
246
277
  ##
@@ -127,7 +127,11 @@ module StandupMD
127
127
  # Constructor. Sets defaults.
128
128
  #
129
129
  # @param [Array] options
130
- def initialize(options = [], load_config: true)
130
+ #
131
+ # @param [Boolean] load_config
132
+ #
133
+ # @param [StandupMD::Config, nil] config
134
+ def initialize(options = [], load_config: true, config: nil)
131
135
  @config = nil
132
136
  @preference_file_loaded = false
133
137
  @file_date_argument = false
@@ -136,8 +140,8 @@ module StandupMD
136
140
  @options = options
137
141
  return if load_zsh_completion_request(options)
138
142
 
139
- load_preferences if load_config
140
- @config = StandupMD.config.copy
143
+ load_preferences if load_config && config.nil?
144
+ @config = config.nil? ? StandupMD.config.copy : config.copy
141
145
  load_runtime_preferences(options)
142
146
  return if zsh_completion_requested?
143
147
 
@@ -22,6 +22,7 @@ module StandupMD
22
22
  post_adapter: nil,
23
23
  post_channel: nil,
24
24
  auto_fill_previous: true,
25
+ carry_forward_impediments: false,
25
26
  preference_file: ::File.expand_path(
26
27
  ::File.join(ENV["HOME"], ".standuprc")
27
28
  )
@@ -123,6 +124,15 @@ module StandupMD
123
124
  # @return [Boolean]
124
125
  attr_accessor :auto_fill_previous
125
126
 
127
+ ##
128
+ # When writing a new entry, should impediments be pulled from the last
129
+ # entry?
130
+ #
131
+ # @param [Boolean] carry_forward_impediments
132
+ #
133
+ # @return [Boolean]
134
+ attr_accessor :carry_forward_impediments
135
+
126
136
  ##
127
137
  # Initializes the config with default values.
128
138
  def initialize
@@ -15,13 +15,13 @@ module StandupMD
15
15
  # Minor version.
16
16
  #
17
17
  # @return [Integer]
18
- MINOR = 0
18
+ MINOR = 1
19
19
 
20
20
  ##
21
21
  # Patch version.
22
22
  #
23
23
  # @return [Integer]
24
- PATCH = 1
24
+ PATCH = 0
25
25
 
26
26
  ##
27
27
  # Version as +[MAJOR, MINOR, PATCH]+
data/standup_md.gemspec CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ["lib"]
33
33
  spec.add_development_dependency "rake", "~> 13.0", ">= 13.0.1"
34
34
  spec.add_development_dependency "rdoc"
35
+ spec.add_development_dependency "semverve"
35
36
  spec.add_development_dependency "simplecov"
36
37
  spec.add_development_dependency "standard", "~> 1.54.0"
37
38
  spec.add_development_dependency "test-unit", "~> 3.3", ">= 3.3.5"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standup_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Gray
@@ -43,6 +43,20 @@ dependencies:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: semverve
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
46
60
  - !ruby/object:Gem::Dependency
47
61
  name: simplecov
48
62
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +114,7 @@ extra_rdoc_files: []
100
114
  files:
101
115
  - ".github/workflows/ruby.yml"
102
116
  - ".gitignore"
117
+ - ".ruby-version"
103
118
  - Gemfile
104
119
  - Gemfile.lock
105
120
  - LICENSE