dsu 1.1.1 → 1.1.2

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: 01e8ee8331cd245ac664fd67acbc1cb3ffdab02f0693acdce44d73a9f9d7d161
4
- data.tar.gz: 1e83c417a55ccffe97b616ac907264dd589da4bafc333ff572f44574b4a671c2
3
+ metadata.gz: 17c91e41af3f1aff56de7740ccbc27cb9d024bb28c850216e198036b2b8ddac3
4
+ data.tar.gz: 1ebff03df51f1d98642181c3504b7f14ce28a5c3b9ec7fee983e999291fddf06
5
5
  SHA512:
6
- metadata.gz: 0d3c6832cbbea8cc42aef3d947d6040963fb182318578bd98e52a6c2be435767fb2d0a1755927657068a74ebec88003fbfcc17108072a41d2aabc5b6dd3f507c
7
- data.tar.gz: e0fc66db534b39c8fa72ef2bffaa49f3f3bcde9dc18d8facd5573462cf389188d3359f3501d11570529dd8ee1dee76b1c468ec6cb3aa3ec21ed44d26751d1b0c
6
+ metadata.gz: b2cd09f9407c7bd079f826f3e6450b6f092e2d19e9f1e0c5f6f81d77f338864e6f3617603e2f24d68d821cf23b1514d7e49b5efdb9de84acc098579b274180b6
7
+ data.tar.gz: 8a35fcaa5c4e376b8df795be462874cfa2fce1359c5b4c11fa7a251dd98d248ee0ab52150db99764405cd8a338e17f0358c4052ef2e2cd2c80f6a049975e67a6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.1.2] 2023-05-??
2
+ * Changes
3
+ - Various refactors.
4
+ - Add more test coverage.
1
5
  ## [1.1.1] - 2023-05-23
2
6
  * See previous alpha releases for changes.
3
7
  ## [1.1.1.alpha.2] - 2023-05-23
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dsu (1.1.1)
4
+ dsu (1.1.2)
5
5
  activemodel (~> 7.0, >= 7.0.4.3)
6
6
  activesupport (~> 7.0, >= 7.0.4)
7
7
  colorize (~> 0.8.1)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # `dsu` (alpha)
1
+ # `dsu`
2
2
 
3
3
  [![GitHub version](http://badge.fury.io/gh/gangelo%2Fdsu.svg)](https://badge.fury.io/gh/gangelo%2Fdsu)
4
4
  [![Gem Version](https://badge.fury.io/rb/dsu.svg)](https://badge.fury.io/rb/dsu)
@@ -7,7 +7,9 @@
7
7
  [![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
8
8
 
9
9
  ## About
10
- `dsu` is little gem that helps manage your Agile DSU (Daily Stand Up) participation. How? by providing a simple command line interface (CLI) which allows you to create, read, update, and delete (CRUD) noteworthy activities that you performed during your day. During your DSU, you can then easily recall and share these these activities with your team. Activities are grouped by day and can be viewed in simple text format from the command line. When viewing a particular day, `dsu` will automatically display the previous day's activities as well. This is useful for remembering what you did yesterday, so you can share your "Today" and "Yesterday" activities with your team during your DSU. If the day you are trying to view falls on a weekend or Monday, `dsu` will display back to, and including the weekend and previous Friday inclusive, so that you can share what you did over the weekend (if anything) and the previous Friday.
10
+ `dsu` is a simple, but powerful little gem I wrote for myself to help me manage my Agile DSU (Daily Stand Up) participation. How? by providing a simple command line interface (CLI) which allows me to create, read, update, and delete (CRUD) DSU entries on a daily basis. During my DSU, I'm then able to list, recall and share my DSU activities with my team. DSU entries are grouped by day and are viewed in simple text format from the command line, in a myriad of ways, to meet my personal needs. When viewing DSU entries for a particular day, `dsu` will automatically display the previous day's activities as well, using the typical "what I did yesterday", "What I'm doing today" DSU paradigm. If the DSU date I am trying to view falls on a weekend or Monday, `dsu` will automatically display back to and including the weekend and previous Friday (inclusive), so that I can share what I did over the weekend (if anything) and "last" Friday.
11
+
12
+ You may want to install it and give it a try. If you happen to find `dsu` helpful, give it a star and tell a friend `:)`
11
13
 
12
14
  ## Help
13
15
 
@@ -52,7 +54,10 @@ If you need to add a DSU entry for tomorrow, you can use the `-t`|`--tomorrow` o
52
54
 
53
55
  ### Miscellaneous Date
54
56
 
55
- `$ dsu add -d "2022-12-31" "Attend company New Years Coffee Meet & Greet"`
57
+ Both of the below examples will accomplish the same thing, assuming the current year is 2023; the current year is assumed if omitted:
58
+
59
+ `$ dsu add -d "12/31/2023" "Attend company New Years Coffee Meet & Greet"`
60
+ `$ dsu add -d "12/31" "Attend company New Years Coffee Meet & Greet"`
56
61
 
57
62
  See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
58
63
 
@@ -62,7 +67,13 @@ You can display DSU entries for a particular day or date (`date`) using any of t
62
67
  - `$ dsu list today|n`
63
68
  - `$ dsu list tomorrow|t`
64
69
  - `$ dsu list yesterday|y`
65
- - `$ dsu list date|d DATE`
70
+ - `$ dsu list date|d DATE|MNEUMONIC`
71
+ - `$ dsu list dates|dd OPTIONS`
72
+
73
+ See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
74
+ See the [Mneumonics](#mneumonics) section for more information on acceptable MNEUMONIC rules and formats used by `dsu`.
75
+
76
+ IMPORTANT: In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
66
77
 
67
78
  ### Examples
68
79
  The following displays the entries for "Today", where `Time.now == '2023-05-06 08:54:57.6861 -0400'`
@@ -78,9 +89,8 @@ Friday, (Yesterday) 2023-05-05
78
89
  2. Attend new hire meet & greet
79
90
  ```
80
91
 
81
- `$ dsu list date "2023-05-06"`
82
-
83
- See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
92
+ `$ dsu list date 5/6/2023`
93
+ `$ dsu list date 5/6`
84
94
 
85
95
  ```shell
86
96
  #=>
@@ -91,11 +101,45 @@ Friday, (Yesterday) 2023-05-05
91
101
  1. Pick up ticket IN-12345
92
102
  2. Attend new hire meet & greet
93
103
  ```
104
+
105
+ #### Listing Date Ranges
106
+ For more information, see the [Mneumonics](#mneumonics) section for more information on acceptable MNEUMONIC rules and formats used by `dsu`.
107
+
108
+ Output omitted for brevity...
109
+
110
+ Display the DSU entries for the last 3 days.
111
+
112
+ `dsu list dates --from yesterday --to -2`
113
+
114
+ Display the DSU entries for 1/1 to 1/4.
115
+
116
+ `dsu list dates --from 1/1 --to +3`
117
+
118
+ Display the DSU entries for 1/2 to 1/5.
119
+
120
+ `dsu list dates --from 1/5 --to -3`
121
+
122
+ Display the DSU entries for the last week.
123
+
124
+ `dsu list dates --from today --to -7`
125
+
126
+ Display the DSU entries back 1 week from yesterday's date. *This example is silly,* but it illustrates the fact that you can use relative mneumonics for both `--from` and `--to` options. While you *can* use relative mneumonics for both `--from` and `--to` options, there is always a more intuitive way.
127
+
128
+ `dsu list dates --from -7 --to +6`
129
+
130
+ The above can be accomplished MUCH easier by using the `yesterday` mneumonic. This will display the DSU entries back 1 week from yesterday's date.
131
+
132
+ `dsu list dates --from yesterday --to -6`
133
+
94
134
  ## Editing DSU Entries
95
135
 
96
- You can edit DSU entry groups by date. `dsu` will allow you to edit a DSU entry group using the `dsu edit SUBCOMMAND` date (today|tomorrow|yesterday|date DATE) you specify. `dsu edit` will open your DSU entry group entries in your editor, where you'll be able to perform editing functions against one or all of the entries. If no entries exist in the entry group the the date, the editor will allow you to add entries for that date. *NOTE: duplicate entries are not allowed; that is, the entry DESCRIPTION need to be unique within an entry group. Non-unique entries will not be added to the entry group. The same holds true for entries whose DESCRIPTION that do not pass validation (between 2 and 256 characters (inclusive) in length).*
136
+ You can edit DSU entry groups by date. `dsu` will allow you to edit a DSU entry group using the `dsu edit SUBCOMMAND` date (`n|today|t|tomorrow|y|yesterday|date DATE`) you specify. `dsu edit` will open your DSU entry group entries in your editor, where you'll be able to perform editing functions against one or all of the entries.
137
+
138
+ If no entries exist for the DSU date, the editor will open and allow you to add entries for that date. If you have the `:carry_over_entries_to_today` configuration option setting set to `true`, entries from the last DSU date will be copied into the editor for your convenience.
97
139
 
98
- Note: See the "[Customizing the `dsu` Configuration File](#customizing-the-dsu-configuration-file)"" section to configure `dsu` to use the editor of your choice.
140
+ *NOTE: duplicate entries are not allowed; that is, the entry DESCRIPTION need to be unique within an entry group. Non-unique entries will not be added to the entry group. The same holds true for entries whose DESCRIPTION that do not pass validation (between 2 and 256 characters (inclusive) in length).*
141
+
142
+ NOTE: See the "[Customizing the `dsu` Configuration File](#customizing-the-dsu-configuration-file)" section to configure `dsu` to use the editor of your choice and other configuration options to make editing more convenient.
99
143
 
100
144
  - `$ dsu edit today|n`
101
145
  - `$ dsu edit tomorrow|t`
@@ -111,15 +155,22 @@ The following will edit your DSU entry group entries for "Today", where `Time.no
111
155
 
112
156
  ```shell
113
157
  #=> In your editor, you will see...
114
- # Editing DSU Entries for Tuesday, (Today) 2023-05-09 EDT
115
- # [ENTRY DESCRIPTION]
158
+ ################################################################################
159
+ # Editing DSU Entries for Tuesday, (Today) 2023-05-23 EDT
160
+ ################################################################################
161
+
162
+ ################################################################################
163
+ # DSU ENTRIES
164
+ ################################################################################
116
165
 
117
166
  Interative planning meeting 11:00AM.
118
167
  Pair with Chad on ticket 31211.
119
168
  Investigate spike ticket 31255.
120
169
  Review Kelsey's PR ticket 30721.
121
170
 
122
- # INSTRUCTIONS:
171
+ ################################################################################
172
+ # INSTRUCTIONS
173
+ ################################################################################
123
174
  # ADD a DSU entry: type an ENTRY DESCRIPTION on a new line.
124
175
  # EDIT a DSU entry: change the existing ENTRY DESCRIPTION.
125
176
  # DELETE a DSU entry: delete the ENTRY DESCRIPTION.
@@ -128,6 +179,7 @@ Review Kelsey's PR ticket 30721.
128
179
  # REORDER a DSU entry: reorder the ENTRY DESCRIPTIONs in order preference.
129
180
  #
130
181
  # *** When you are done, save and close your editor ***
182
+ ################################################################################
131
183
  ```
132
184
 
133
185
  #### Edit an Entry
@@ -193,7 +245,9 @@ Config file (/Users/<whoami>/.dsu) contents:
193
245
  editor: nano
194
246
  entries_display_order: desc
195
247
  entries_file_name: "%Y-%m-%d.json"
196
- entries_folder: "/Users/<whoami>/dsu/entries"
248
+ entries_folder: "/Users/gangelo/dsu/entries"
249
+ carry_over_entries_to_today: false
250
+ include_all: false
197
251
  ```
198
252
 
199
253
  Where `<whoami>` would be your username (`$ whoami` on nix systems)
@@ -228,11 +282,34 @@ Default: `'/Users/<whoami>/dsu/entries'` on nix systems.
228
282
 
229
283
  Where `<whoami>` would be your username (`$ whoami` on nix systems)
230
284
 
285
+ ##### carry_over_entries_to_today
286
+ Applicable to the `dsu edit` command. Valid values are `true|false`. If `true`, when editing DSU entries *for the first time* on any given day (e.g. `dsu edit today`), DSU entries from the previous day will be copied into the editing session. If there are no DSU entries from the previous day, `dsu` will search backwards up to 7 days to find a DSU date that has entries to copy. If after searching back 7 days, no DSU entries are found, the editor session will simply start with no previous DSU entries.
287
+
288
+ Default: false
289
+
290
+ ##### include_all
291
+ Applicable to `dsu` commands that display DSU date lists (e.g. `dsu list` commands). Valid values are `true|false`. If `true`, all DSU dates within the specified range will be displayed. If `false`, DSU dates between the first and last DSU dates that have NO entries *will NOT be displayed*. The default is taken from the dsu configuration setting `:include_all`, see `dsu config info`.
292
+
293
+ Default: false
294
+
231
295
  ## Dates
232
296
 
233
297
  These notes apply to anywhere DATE is used...
234
298
 
235
- DATE may be any date string that can be parsed using `Time.parse`. Consequently, you may use also use '/' as date separators, as well as omit the year if the date you want to display is the current year (e.g. <month>/<day>, or 1/31). For example: `require 'time'; Time.parse('2023-01-02'); Time.parse('1/2') # etc.`
299
+ DATE may be any date string that can be parsed using `Time.parse`. Consequently, you may omit the year if the date you want to display is the current year (e.g. <month>/<day>, or 1/31). For example: `require 'time'; Time.parse('2023/01/02'); Time.parse('1/2/2023'); Time.parse('1/2') # etc.`
300
+
301
+ ## Mneumonics
302
+
303
+ These notes apply to anywhere MNEUMONIC is used...
304
+
305
+ A *mneumonic* may be any of the following: `n|today|t|tomorrow|y|yesterday|+n|-n`.
306
+
307
+ Where `n`, `t`, `y` are aliases for `today`, `tomorrow`, and `yesterday`, respectively.
308
+
309
+ Where `+n`, `-n` are relative date mneumonics (RDNs). Generally speaking, RDNs are relative to the current date. For example, a RDN of `+1` would be equal to `Time.now + 1.day` (or tomorrow), and a RDN of `-1` would be equal to `Time.now - 1.day` (or yesterday).
310
+
311
+ NOTE: In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
312
+
236
313
 
237
314
  ## Installation
238
315
 
@@ -16,8 +16,8 @@ module Dsu
16
16
  # This class represents a group of entries for a given day. IOW,
17
17
  # things someone might want to share at their daily standup (DSU).
18
18
  class EntryGroup
19
- include ActiveModel::Model
20
19
  extend Support::EntryGroupLoadable
20
+ include ActiveModel::Model
21
21
  include Support::TimeFormatable
22
22
 
23
23
  attr_accessor :time
@@ -58,10 +58,7 @@ module Dsu
58
58
  end
59
59
 
60
60
  def clone
61
- clone = super
62
-
63
- clone.entries = clone.entries.map(&:clone)
64
- clone
61
+ self.class.new(time: time, entries: entries.map(&:clone))
65
62
  end
66
63
 
67
64
  def entries=(entries)
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ module Dsu
7
+ module Services
8
+ module AI
9
+ # SERVICE_URI = URI('https://api.openai.com/v1/chat/completions').freeze
10
+
11
+ # class TenseTranslatorService
12
+ # def initialize(entries:, options: {})
13
+ # @entries = entries
14
+ # @options = options.merge({ tense: :past })
15
+ # end
16
+
17
+ # def call
18
+ # request = Net::HTTP::Post.new(SERVICE_URI.path)
19
+ # request['Content-Type'] = 'application/json'
20
+ # request['Authorization'] = "Bearer #{configuration[:ai_api_key]}"
21
+
22
+ # request.body = request_body
23
+
24
+ # response = http.request(request)
25
+ # JSON.parse(response.body)
26
+ # end
27
+
28
+ # private
29
+
30
+ # attr_reader :entries, :options
31
+
32
+ # def http
33
+ # Net::HTTP.new(SERVICE_URI.host, SERVICE_URI.port).tap do |http|
34
+ # http.use_ssl = true
35
+ # end
36
+ # end
37
+
38
+ # def request_body
39
+ # {
40
+ # messages: [
41
+ # {
42
+ # role: 'system',
43
+ # content: 'You are a helpful assistant.'
44
+ # },
45
+ # {
46
+ # role: 'user',
47
+ # content: message
48
+ # }
49
+ # ]
50
+ # }.to_json
51
+ # end
52
+
53
+ # def instructions
54
+ # @instructions ||= "Please translate the following sentences into the past #{options[:tense]}:\n\n"
55
+ # end
56
+
57
+ # def message
58
+ # @message ||= "#{instructions}\n\n#{entries.map(&:description).join("\n")}"
59
+ # end
60
+ # end
61
+ end
62
+ end
63
+ end
@@ -8,58 +8,36 @@ module Dsu
8
8
  # TODO: I hate this module; refactor it!!!
9
9
  # This module expects the following attributes to be defined: :time, :options
10
10
  module EntryGroupFileable
11
- extend Support::Configurable
12
-
13
- class << self
14
- def entry_group_file_exists?(time:)
15
- File.exist?(entry_group_file_path(time: time))
16
- end
17
-
18
- def entry_group_file_path(time:)
19
- File.join(entries_folder, entries_file_name(time: time))
20
- end
21
-
22
- def entries_folder
23
- configuration[:entries_folder]
24
- end
25
-
26
- def entries_file_name(time:)
27
- time.strftime(configuration[:entries_file_name])
28
- end
29
-
30
- # def configuration
31
- # Services::ConfigurationLoaderService.new.call
32
- # end
33
- end
11
+ include Support::Configurable
34
12
 
35
13
  def entry_group_file_exists?
36
- EntryGroupFileable.entry_group_file_exists?(time: time)
14
+ File.exist?(entry_group_file_path)
37
15
  end
38
16
 
17
+ private
18
+
39
19
  def entry_group_path_exists?
40
20
  Dir.exist?(entries_folder)
41
21
  end
42
22
 
43
23
  def entry_group_file_path
44
- EntryGroupFileable.entry_group_file_path(time: time)
24
+ File.join(entries_folder, entries_file_name)
45
25
  end
46
26
 
47
27
  def entries_folder
48
- @entries_folder ||= EntryGroupFileable.entries_folder
28
+ @entries_folder ||= configuration_or_options_configuration[:entries_folder]
49
29
  end
50
30
 
51
31
  def entries_file_name
52
- @entries_file_name ||= EntryGroupFileable.entries_file_name(time: time)
32
+ @entries_file_name ||= time.strftime(configuration_or_options_configuration[:entries_file_name])
53
33
  end
54
34
 
55
35
  def create_entry_group_path_if!
56
36
  FileUtils.mkdir_p(entries_folder) unless entry_group_path_exists?
57
37
  end
58
38
 
59
- private
60
-
61
- def configuration
62
- @configuration ||= options[:configuration] || EntryGroupFileable.configuration
39
+ def configuration_or_options_configuration
40
+ @configuration_or_options_configuration ||= options[:configuration] || configuration
63
41
  end
64
42
  end
65
43
  end
@@ -12,8 +12,8 @@ module Dsu
12
12
  end
13
13
 
14
14
  unless description.is_a?(String)
15
- record.errors.add(field, 'is the wrong object type. ' \
16
- "\"String\" was expected, but \"#{description.class}\" was received.")
15
+ record.errors.add(:description, 'is the wrong object type. ' \
16
+ "\"String\" was expected, but \"#{description.class}\" was received.")
17
17
  return
18
18
  end
19
19
 
data/lib/dsu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dsu
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
data/lib/dsu.rb CHANGED
@@ -7,10 +7,6 @@ require 'pry-byebug' if ENV['DEV_ENV']
7
7
  require 'thor'
8
8
  require 'time'
9
9
 
10
- Dir.glob("#{__dir__}/lib/core/**/*.rb").each do |file|
11
- require file
12
- end
13
-
14
10
  Dir.glob("#{__dir__}/dsu/**/*.rb").each do |file|
15
11
  require file
16
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gene M. Angelo, Jr.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -158,6 +158,7 @@ files:
158
158
  - lib/dsu/core/ruby/not_today.rb
159
159
  - lib/dsu/models/entry.rb
160
160
  - lib/dsu/models/entry_group.rb
161
+ - lib/dsu/services/ai/tense_translator_service.rb
161
162
  - lib/dsu/services/configuration_loader_service.rb
162
163
  - lib/dsu/services/entry_group_deleter_service.rb
163
164
  - lib/dsu/services/entry_group_editor_service.rb