dsu 1.1.2 → 1.2.1

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: 17c91e41af3f1aff56de7740ccbc27cb9d024bb28c850216e198036b2b8ddac3
4
- data.tar.gz: 1ebff03df51f1d98642181c3504b7f14ce28a5c3b9ec7fee983e999291fddf06
3
+ metadata.gz: 6ce3877d498ca52f9395b713e062dd3448ef447028823b880d5a3e514009d8a9
4
+ data.tar.gz: 3c3a7ea5fd481d5d1e2ff409a812d5581d779d9061c736a8bd1994276c67e343
5
5
  SHA512:
6
- metadata.gz: b2cd09f9407c7bd079f826f3e6450b6f092e2d19e9f1e0c5f6f81d77f338864e6f3617603e2f24d68d821cf23b1514d7e49b5efdb9de84acc098579b274180b6
7
- data.tar.gz: 8a35fcaa5c4e376b8df795be462874cfa2fce1359c5b4c11fa7a251dd98d248ee0ab52150db99764405cd8a338e17f0358c4052ef2e2cd2c80f6a049975e67a6
6
+ metadata.gz: e25b5428fa6779df05b47b37323e5ae25ae776dfa9eb78463f79c2332d84e338b3f668f805ac5c9f24e5702db4d2802e46ee8439fa94d01ffafc6e15093f650a
7
+ data.tar.gz: 46aa0bbd606a025f9ffc458c98cc59d0070caac1d89d73eafec90d57da7cc7aedc552ece986fbede7bf7f7977d9afbbd314027f61c371d637d5187ae2968cbd2
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- ## [1.1.2] 2023-05-??
1
+ ## [1.2.1] 2023-06-02
2
+ * Bug fixes
3
+ - Fixed a bug that raises an error `NoMethodError` for `entry_group_file_exists?` if the `carry_over_entries_to_today` configuration option is set to true, and attempting to edit today's dsu entries.
4
+ ## [1.2.0] 2023-05-26
5
+ * Changes
6
+ - Various refactors.
7
+ - Bring test coverage to >= 85%.
8
+ ## [1.1.2] 2023-05-26
2
9
  * Changes
3
10
  - Various refactors.
4
11
  - Add more test coverage.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dsu (1.1.2)
4
+ dsu (1.2.1)
5
5
  activemodel (~> 7.0, >= 7.0.4.3)
6
6
  activesupport (~> 7.0, >= 7.0.4)
7
7
  colorize (~> 0.8.1)
@@ -14,6 +14,11 @@ module Dsu
14
14
  File.exist?(entry_group_file_path)
15
15
  end
16
16
 
17
+ def entry_group_file_exists_for?(time:)
18
+ entries_file_name = time.strftime(configuration_or_options_configuration[:entries_file_name])
19
+ File.join(entries_folder, entries_file_name)
20
+ end
21
+
17
22
  private
18
23
 
19
24
  def entry_group_path_exists?
@@ -11,12 +11,14 @@ module Dsu
11
11
 
12
12
  def validate(record)
13
13
  unless record.entries.is_a?(Array)
14
- record.errors.add(:entries_entry, 'is the wrong object type. ' \
15
- "\"Array\" was expected, but \"#{record.entries.class}\" was received.")
14
+ record.errors.add(:entries, 'is the wrong object type. ' \
15
+ "\"Array\" was expected, but \"#{record.entries.class}\" was received.")
16
+ return
16
17
  end
17
18
 
18
- validate_entry_types record
19
- validate_unique_entry record
19
+ return if validate_entry_types record
20
+ return if validate_unique_entry record
21
+
20
22
  validate_entries record
21
23
  end
22
24
 
@@ -26,10 +28,12 @@ module Dsu
26
28
  record.entries.each do |entry|
27
29
  next if entry.is_a? Dsu::Models::Entry
28
30
 
29
- record.errors.add(:entries_entry, 'entry Array element is the wrong object type. ' \
30
- "\"Entry\" was expected, but \"#{entry.class}\" was received.",
31
+ record.errors.add(:entries, 'Array element is the wrong object type. ' \
32
+ "\"Entry\" was expected, but \"#{entry.class}\" was received.",
31
33
  type: Support::FieldErrors::FIELD_TYPE_ERROR)
32
34
  end
35
+
36
+ record.errors.any?
33
37
  end
34
38
 
35
39
  def validate_unique_entry(record)
@@ -42,10 +46,12 @@ module Dsu
42
46
 
43
47
  non_unique_descriptions = descriptions.select { |description| descriptions.count(description) > 1 }.uniq
44
48
  if non_unique_descriptions.any?
45
- record.errors.add(:entries_entry, 'contains a duplicate entry: ' \
46
- "#{format_non_unique_descriptions(non_unique_descriptions)}.",
49
+ record.errors.add(:entries, 'Array contains a duplicate entry: ' \
50
+ "#{format_non_unique_descriptions(non_unique_descriptions)}.",
47
51
  type: Support::FieldErrors::FIELD_DUPLICATE_ERROR)
48
52
  end
53
+
54
+ record.errors.any?
49
55
  end
50
56
 
51
57
  def validate_entries(record)
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.2'
4
+ VERSION = '1.2.1'
5
5
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../../models/entry_group'
4
- require_relative '../../support/configurable'
4
+ require_relative '../../support/entry_group_fileable'
5
5
 
6
6
  module Dsu
7
7
  module Views
8
8
  module EntryGroup
9
9
  class Edit
10
- include Support::Configurable
10
+ include Support::EntryGroupFileable
11
11
 
12
12
  def initialize(entry_group:, options: {})
13
13
  raise ArgumentError, 'entry_group is nil' if entry_group.nil?
@@ -100,7 +100,7 @@ module Dsu
100
100
  end
101
101
 
102
102
  def previous_entry_group?
103
- previous_entry_group.present?
103
+ previous_entry_group.entries.present?
104
104
  end
105
105
 
106
106
  def previous_entry_group
@@ -108,13 +108,13 @@ module Dsu
108
108
  # TODO: Make this configurable or accept an option?
109
109
  @previous_entry_group ||= (1..7).each do |days|
110
110
  t = time.days_ago(days)
111
- return Models::EntryGroup.load(time: t) if Support::EntryGroupFileable.entry_group_file_exists?(time: t)
111
+ return Models::EntryGroup.load(time: t) if entry_group_file_exists_for?(time: t)
112
112
  end
113
113
  nil
114
114
  end
115
115
 
116
116
  def carry_over_entries_to_today?
117
- configuration[:carry_over_entries_to_today]
117
+ configuration.merge(options)[:carry_over_entries_to_today]
118
118
  end
119
119
  end
120
120
  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.2
4
+ version: 1.2.1
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-26 00:00:00.000000000 Z
11
+ date: 2023-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -118,18 +118,25 @@ dependencies:
118
118
  - - "~>"
119
119
  - !ruby/object:Gem::Version
120
120
  version: '1.0'
121
- description: " dsu is little gem that helps manage your Agile DSU (Daily Stand
122
- Up) participation. How? by providing a simple command line interface (CLI) which
123
- allows you to create, read, update, and delete (CRUD) noteworthy activities that
124
- you performed during your day. During your DSU, you can then easily recall and share
125
- these these activities with your team. Activities are grouped by day and can be
126
- viewed in simple text format from the command line. When displaying DSU entries
127
- for a particular day or date (date), dsu will display the given day or date's (date)
128
- DSU entries, as well as the DSU entries for the previous day, relative to the given
129
- day or date. If the date or day you are trying to view falls on a weekend or Monday,
130
- dsu will display back to, and including the weekend and previous Friday inclusive;
131
- this is so that you can share what you did over the weekend (if anything) and the
132
- previous Friday at your DSU.\n"
121
+ description: ' dsu is a small, but powerful gem that helps manage your Agile DSU
122
+ (Daily Stand Up) participation. How? by providing a simple command-line interface
123
+ (CLI) which allows you to create, read, update, and delete (CRUD) your DSU entries
124
+ (activities). During your DSU, you can use dsu''s CLI to list and share what you
125
+ did "yesterday" and what you plan on doing "Today" with your team. DSU entries are
126
+ grouped by day and can be viewed in simple text format from the command-line. When
127
+ displaying DSU entries for a particular day, dsu will also display DSU entries for
128
+ the previous day. If the day you are trying to display falls on a weekend or Monday,
129
+ dsu will automatically search back to include the weekend and previous Friday dates
130
+ and display the entries; this is so that you can share what you did over the weekend
131
+ (if anything) and the previous Friday with your team. When searching for "Yesterday''s"
132
+ DSU entries, dsu will automatically search back a maximimum of 7 days to find DSU
133
+ entries to share. This could be helpful if, for example, if you are sharing what
134
+ you plan to do today (Wednesday), but were sick yesterday (Tuesday); dsu in this
135
+ case will display the last DSU entries it can find searching backwards a maximum
136
+ of 7 days. dsu does a LOT more and is perfect for command-line junkies and those
137
+ who LOVE simplicity. Give it a try and a star if you like it!
138
+
139
+ '
133
140
  email:
134
141
  - public.gma@gmail.com
135
142
  executables: