standup_md 0.3.13 → 0.3.14

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: e3f5c4b6db84361a2b6c0f14e40d01cc1337ce3bd22b614c4e0f43269cfda50a
4
- data.tar.gz: 13b47dcc48eaf4e30638dcb8d03a77bded4f7107d9e0aeb4f0413c5850796754
3
+ metadata.gz: e9e2449a7136b2b9b9633db530b2304ddc986050bb404c951cb0da1cb299330b
4
+ data.tar.gz: 52106b7870dee25cf07070fd6e6ff689c84e3142bdb1249077f8ea757d56eac1
5
5
  SHA512:
6
- metadata.gz: 19eb5efc0109250c152472b0830102c2d51791ea08e471bfcfab543756a83bb0e7e57d5c2a683a1e99a02e0d680198956b36f6bf616c53c19798a60f60ca0e44
7
- data.tar.gz: 8d3565a820c7de66ec398ab722fc7aab0aa9864b955918c2fec535353c3630ad8fdcf5bc1537999cbc88fb2563e1404faf1738298b3acfb6836d166a8c05cca4
6
+ metadata.gz: 27248294c5f4d85bb5b1c4ae5df44d4133bfbe968acc30aba3917df29424f00b56c56bb12ea1219fe0b0c2ce311699f912957f616526db5ee43939c11abf7def
7
+ data.tar.gz: dfc856d09518702f57bc7fdb2a1610ce5143c165340709e067a4509ca7fc7789bd247422f6ac3952a678006789dc939a8f8e12b7f318b3e63cec140dab5c82b3
@@ -12,10 +12,8 @@ module StandupMD
12
12
  #
13
13
  # @return [nil]
14
14
  def print(entry)
15
- if entry.nil?
16
- puts "No record found for #{config.cli.date}"
17
- return
18
- end
15
+ return puts "No record found for #{config.cli.date}" if entry.nil?
16
+
19
17
  puts header(entry)
20
18
  config.file.sub_header_order.each do |header_type|
21
19
  tasks = entry.public_send(header_type)
@@ -142,7 +140,6 @@ module StandupMD
142
140
  # @return [Array]
143
141
  def previous_entry(file)
144
142
  return config.entry.previous_entry unless config.cli.auto_fill_previous
145
-
146
143
  return prev_entry(prev_file.load.entries) if file.new? && prev_file
147
144
 
148
145
  prev_entry(file.entries)
@@ -155,9 +152,7 @@ module StandupMD
155
152
  #
156
153
  # @return [StandupMD::Entry]
157
154
  def prev_entry(entries)
158
- return [] if entries.empty?
159
-
160
- entries.last.current
155
+ entries.empty? ? [] : entries.last.current
161
156
  end
162
157
 
163
158
  ##
@@ -19,8 +19,9 @@ module StandupMD
19
19
  write: true,
20
20
  print: false,
21
21
  auto_fill_previous: true,
22
- preference_file:
23
- ::File.expand_path(::File.join(ENV['HOME'], '.standuprc'))
22
+ preference_file: ::File.expand_path(
23
+ ::File.join(ENV['HOME'], '.standuprc')
24
+ )
24
25
  }.freeze
25
26
 
26
27
  ##
@@ -2,11 +2,9 @@
2
2
 
3
3
  module StandupMD
4
4
  class Config
5
-
6
5
  ##
7
6
  # The configuration class for StandupMD::EntryList
8
7
  class EntryList
9
-
10
8
  ##
11
9
  # The default options.
12
10
  #
@@ -2,11 +2,9 @@
2
2
 
3
3
  module StandupMD
4
4
  class Config
5
-
6
5
  ##
7
6
  # The configuration class for StandupMD::File
8
7
  class File
9
-
10
8
  ##
11
9
  # The default options.
12
10
  #
@@ -156,11 +154,9 @@ module StandupMD
156
154
  #
157
155
  # @return [Integer]
158
156
  def header_depth=(depth)
159
- if !depth.between?(1, 5)
160
- raise 'Header depth out of bounds (1..5)'
161
- elsif depth >= sub_header_depth
162
- @sub_header_depth = depth + 1
163
- end
157
+ raise 'Header depth out of bounds (1..5)' if !depth.between?(1, 5)
158
+
159
+ @sub_header_depth = depth + 1 if depth >= sub_header_depth
164
160
  @header_depth = depth
165
161
  end
166
162
 
@@ -172,11 +168,9 @@ module StandupMD
172
168
  #
173
169
  # @return [Integer]
174
170
  def sub_header_depth=(depth)
175
- if !depth.between?(2, 6)
176
- raise 'Sub-header depth out of bounds (2..6)'
177
- elsif depth <= header_depth
178
- @header_depth = depth - 1
179
- end
171
+ raise 'Sub-header depth out of bounds (2..6)' if !depth.between?(2, 6)
172
+
173
+ @header_depth = depth - 1 if depth <= header_depth
180
174
  @sub_header_depth = depth
181
175
  end
182
176
 
@@ -188,13 +182,15 @@ module StandupMD
188
182
  # @return [String]
189
183
  def bullet_character=(char)
190
184
  raise 'Must be "-" or "*"' unless %w[- *].include?(char)
185
+
191
186
  @bullet_character = char
192
187
  end
193
188
 
194
189
  ##
195
- # Setter for directory. Must be expanded in case the user uses `~` for home.
196
- # If the directory doesn't exist, it will be created. To reset instance
197
- # variables after changing the directory, you'll need to call load.
190
+ # Setter for directory. Must be expanded in case the user uses `~` for
191
+ # home. If the directory doesn't exist, it will be created. To reset
192
+ # instance variables after changing the directory, you'll need to call
193
+ # load.
198
194
  #
199
195
  # @param [String] directory
200
196
  #
@@ -78,8 +78,8 @@ module StandupMD
78
78
  # @param [Array] notes
79
79
  def initialize(date, current, previous, impediments, notes = [])
80
80
  raise unless date.is_a?(Date)
81
- @config = self.class.config
82
81
 
82
+ @config = self.class.config
83
83
  @date = date
84
84
  @current = current
85
85
  @previous = previous
@@ -24,10 +24,9 @@ module StandupMD
24
24
  #
25
25
  # @return [StandupMD::EntryList]
26
26
  def initialize(*entries)
27
+ entries.each { |entry| validate_entry(entry) }
28
+
27
29
  @config = self.class.config
28
- unless entries.all? { |e| e.is_a?(StandupMD::Entry) }
29
- raise ArgumentError, 'Entry must be an instance of StandupMD::Entry'
30
- end
31
30
  @entries = entries
32
31
  end
33
32
 
@@ -38,9 +37,8 @@ module StandupMD
38
37
  #
39
38
  # @return [Array]
40
39
  def <<(entry)
41
- unless entry.is_a?(StandupMD::Entry)
42
- raise ArgumentError, 'Entry must be an instance of StandupMD::Entry'
43
- end
40
+ validate_entry(entry)
41
+
44
42
  @entries << entry
45
43
  end
46
44
 
@@ -145,5 +143,13 @@ module StandupMD
145
143
  #
146
144
  # +last+:: The last record in the list.
147
145
  def_delegators :@entries, :each, :empty?, :size, :first, :last
146
+
147
+ private
148
+
149
+ def validate_entry(entry)
150
+ return if entry.is_a?(StandupMD::Entry)
151
+
152
+ raise ArgumentError, 'Entry must be an instance of StandupMD::Entry'
153
+ end
148
154
  end
149
155
  end
@@ -40,7 +40,10 @@ module StandupMD
40
40
 
41
41
  def new_entry(record) # :nodoc:
42
42
  Entry.new(
43
- Date.strptime(record['header'], StandupMD.config.file.header_date_format),
43
+ Date.strptime(
44
+ record['header'],
45
+ StandupMD.config.file.header_date_format
46
+ ),
44
47
  record[StandupMD.config.file.current_header],
45
48
  record[StandupMD.config.file.previous_header],
46
49
  record[StandupMD.config.file.impediments_header],
@@ -49,7 +52,9 @@ module StandupMD
49
52
  end
50
53
 
51
54
  def header(date)
52
- '#' * StandupMD.config.file.header_depth + ' ' + date.strftime(StandupMD.config.file.header_date_format)
55
+ '#' * StandupMD.config.file.header_depth +
56
+ ' ' +
57
+ date.strftime(StandupMD.config.file.header_date_format)
53
58
  end
54
59
 
55
60
  def sub_header(subhead)
@@ -21,7 +21,7 @@ module StandupMD
21
21
  # Patch version.
22
22
  #
23
23
  # @return [Integer]
24
- PATCH = 13
24
+ PATCH = 14
25
25
 
26
26
  ##
27
27
  # Version as +[MAJOR, MINOR, PATCH]+
@@ -47,4 +47,6 @@ module StandupMD
47
47
  Hash[%i[major minor patch].zip(to_a)]
48
48
  end
49
49
  end
50
+
51
+ VERSION = StandupMD::Version.to_s
50
52
  end
data/standup_md.gemspec CHANGED
@@ -2,7 +2,7 @@ require_relative 'lib/standup_md/version'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'standup_md'
5
- spec.version = StandupMD::Version.to_s
5
+ spec.version = StandupMD::VERSION
6
6
  spec.authors = ['Evan Gray']
7
7
  spec.email = 'evanthegrayt@vivaldi.net'
8
8
  spec.license = 'MIT'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standup_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Gray
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-22 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake