plansheet 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +6 -1
- data/Gemfile.lock +1 -1
- data/lib/plansheet/project.rb +21 -2
- data/lib/plansheet/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9c1a116df170c31d73c29dce213b757743c0e49bbee8c86a47ce7ce09009730
|
4
|
+
data.tar.gz: 2baeb58d82c15823d9beb3e6504bb452e14cabded159f9931bf2300fdaed5d8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a87a4f7386a651ca82d385600f7b32ee78ff436406d596b6c2966ed721bdcee16f9bd4ad73b158be03305541dceda0d525e68ea2dc520a028fb603a6b5f0c1c0
|
7
|
+
data.tar.gz: d679906ef154e9b84e9282e1811ac0dff8da8b4dfb17c6e0e24d7f08226933346c4229468ddf51526e7532af7bdfd9a502557b64efc6439c128716a380e86d86
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-06-02 13:
|
3
|
+
# on 2022-06-02 13:59:36 UTC using RuboCop version 1.29.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -11,6 +11,11 @@
|
|
11
11
|
Metrics/CyclomaticComplexity:
|
12
12
|
Max: 8
|
13
13
|
|
14
|
+
# Offense count: 1
|
15
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 12
|
18
|
+
|
14
19
|
# Offense count: 1
|
15
20
|
# Configuration parameters: IgnoredMethods.
|
16
21
|
Metrics/PerceivedComplexity:
|
data/Gemfile.lock
CHANGED
data/lib/plansheet/project.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "yaml"
|
4
|
+
require "date"
|
4
5
|
|
5
6
|
module Plansheet
|
6
7
|
PROJECT_STATUS_PRIORITY = {
|
@@ -57,6 +58,12 @@ module Plansheet
|
|
57
58
|
"notes":
|
58
59
|
desc: Free-form notes string
|
59
60
|
type: str
|
61
|
+
"due":
|
62
|
+
desc: Due date of the task (WIP)
|
63
|
+
type: date
|
64
|
+
"defer":
|
65
|
+
desc: Defer task until this day (WIP)
|
66
|
+
type: date
|
60
67
|
"externals":
|
61
68
|
desc: List of external commitments, ie who else cares about project completion?
|
62
69
|
type: seq
|
@@ -91,9 +98,10 @@ module Plansheet
|
|
91
98
|
|
92
99
|
# NOTE: The order of these affects presentation!
|
93
100
|
STRING_PROPERTIES = %w[priority status location notes].freeze
|
101
|
+
DATE_PROPERTIES = %w[due defer].freeze
|
94
102
|
ARRAY_PROPERTIES = %w[externals urls tasks done].freeze
|
95
103
|
|
96
|
-
ALL_PROPERTIES = STRING_PROPERTIES + ARRAY_PROPERTIES
|
104
|
+
ALL_PROPERTIES = STRING_PROPERTIES + DATE_PROPERTIES + ARRAY_PROPERTIES
|
97
105
|
|
98
106
|
attr_reader :name, *ALL_PROPERTIES
|
99
107
|
|
@@ -146,6 +154,9 @@ module Plansheet
|
|
146
154
|
STRING_PROPERTIES.each do |o|
|
147
155
|
str << stringify_string_property(o)
|
148
156
|
end
|
157
|
+
DATE_PROPERTIES.each do |o|
|
158
|
+
str << stringify_string_property(o)
|
159
|
+
end
|
149
160
|
ARRAY_PROPERTIES.each do |o|
|
150
161
|
str << stringify_array_property(o)
|
151
162
|
end
|
@@ -160,6 +171,14 @@ module Plansheet
|
|
160
171
|
end
|
161
172
|
end
|
162
173
|
|
174
|
+
def stringify_date_property(prop)
|
175
|
+
if instance_variable_defined? "@#{prop}"
|
176
|
+
"#{prop}: #{instance_variable_get("@#{prop}")}\n"
|
177
|
+
else
|
178
|
+
""
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
163
182
|
def stringify_array_property(prop)
|
164
183
|
str = String.new
|
165
184
|
if instance_variable_defined? "@#{prop}"
|
@@ -188,7 +207,7 @@ module Plansheet
|
|
188
207
|
def initialize(path)
|
189
208
|
@path = path
|
190
209
|
# TODO: this won't GC, inline validation instead?
|
191
|
-
@raw = YAML.load_file(path)
|
210
|
+
@raw = YAML.load_file(path, permitted_classes: [Date])
|
192
211
|
validate_schema
|
193
212
|
@projects = @raw.map { |proj| Project.new proj }
|
194
213
|
end
|
data/lib/plansheet/version.rb
CHANGED