standup_md 0.2.1 → 0.3.4
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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +8 -2
- data/README.md +149 -117
- data/bin/standup +1 -1
- data/doc/README_md.html +141 -96
- data/doc/StandupMD.html +96 -1326
- data/doc/StandupMD/Cli.html +124 -479
- data/doc/StandupMD/Cli/Helpers.html +167 -0
- data/doc/StandupMD/Config.html +230 -0
- data/doc/StandupMD/Config/Cli.html +364 -0
- data/doc/StandupMD/Config/Entry.html +296 -0
- data/doc/StandupMD/Config/EntryList.html +212 -0
- data/doc/StandupMD/Config/File.html +613 -0
- data/doc/StandupMD/Entry.html +478 -0
- data/doc/StandupMD/EntryList.html +759 -0
- data/doc/StandupMD/File.html +614 -0
- data/doc/created.rid +15 -5
- data/doc/index.html +151 -94
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/table_of_contents.html +226 -72
- data/lib/standup_md.rb +28 -545
- data/lib/standup_md/cli.rb +63 -246
- data/lib/standup_md/cli/helpers.rb +167 -0
- data/lib/standup_md/config.rb +47 -0
- data/lib/standup_md/config/cli.rb +109 -0
- data/lib/standup_md/config/entry.rb +68 -0
- data/lib/standup_md/config/entry_list.rb +31 -0
- data/lib/standup_md/config/file.rb +209 -0
- data/lib/standup_md/entry.rb +122 -0
- data/lib/standup_md/entry_list.rb +166 -0
- data/lib/standup_md/file.rb +183 -0
- data/lib/standup_md/file/helpers.rb +62 -0
- data/lib/standup_md/version.rb +5 -5
- data/standup_md.gemspec +1 -0
- metadata +35 -2
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'config/cli'
|
4
|
+
require_relative 'config/file'
|
5
|
+
require_relative 'config/entry'
|
6
|
+
require_relative 'config/entry_list'
|
7
|
+
|
8
|
+
module StandupMD
|
9
|
+
|
10
|
+
##
|
11
|
+
# This class provides a connector from StandupMD to the configuration classes.
|
12
|
+
class Config
|
13
|
+
|
14
|
+
##
|
15
|
+
# Reader for Cli config.
|
16
|
+
#
|
17
|
+
# @return [StandupMD::Config::Cli]
|
18
|
+
attr_reader :cli
|
19
|
+
|
20
|
+
##
|
21
|
+
# Reader for File config.
|
22
|
+
#
|
23
|
+
# @return [StandupMD::Config::File]
|
24
|
+
attr_reader :file
|
25
|
+
|
26
|
+
##
|
27
|
+
# Reader for Entry config.
|
28
|
+
#
|
29
|
+
# @return [StandupMD::Config::Entry]
|
30
|
+
attr_reader :entry
|
31
|
+
|
32
|
+
##
|
33
|
+
# Reader for EntryList config.
|
34
|
+
#
|
35
|
+
# @return [StandupMD::Config::EntryList]
|
36
|
+
attr_reader :entry_list
|
37
|
+
|
38
|
+
##
|
39
|
+
# Builds the links to the configuration classes.
|
40
|
+
def initialize
|
41
|
+
@cli = StandupMD::Config::Cli.new
|
42
|
+
@file = StandupMD::Config::File.new
|
43
|
+
@entry = StandupMD::Config::Entry.new
|
44
|
+
@entry_list = StandupMD::Config::EntryList.new
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module StandupMD
|
6
|
+
class Config
|
7
|
+
|
8
|
+
##
|
9
|
+
# The configuration class for StandupMD::Cli
|
10
|
+
class Cli
|
11
|
+
|
12
|
+
##
|
13
|
+
# The default options.
|
14
|
+
#
|
15
|
+
# @return [Hash]
|
16
|
+
DEFAULTS = {
|
17
|
+
date: Date.today,
|
18
|
+
editor: ENV['VISUAL'] || ENV['EDITOR'] || 'vim',
|
19
|
+
verbose: false,
|
20
|
+
edit: true,
|
21
|
+
write: true,
|
22
|
+
print: false,
|
23
|
+
auto_fill_previous: true,
|
24
|
+
preference_file:
|
25
|
+
::File.expand_path(::File.join(ENV['HOME'], '.standuprc')),
|
26
|
+
}
|
27
|
+
|
28
|
+
##
|
29
|
+
# The editor to use when opening standup files. If one is not set, the
|
30
|
+
# first of $VISUAL, $EDITOR, or vim will be used, in that order.
|
31
|
+
#
|
32
|
+
# @param [String] editor
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :editor
|
36
|
+
|
37
|
+
##
|
38
|
+
# Should the cli print verbose output?
|
39
|
+
#
|
40
|
+
# @param [Boolean] verbose
|
41
|
+
#
|
42
|
+
# @return [Boolean]
|
43
|
+
attr_accessor :verbose
|
44
|
+
|
45
|
+
##
|
46
|
+
# Should the cli edit?
|
47
|
+
#
|
48
|
+
# @param [Boolean] edit
|
49
|
+
#
|
50
|
+
# @return [Boolean]
|
51
|
+
attr_accessor :edit
|
52
|
+
|
53
|
+
##
|
54
|
+
# Should the cli automatically write the new entry to the file?
|
55
|
+
#
|
56
|
+
# @param [Boolean] write
|
57
|
+
#
|
58
|
+
# @return [Boolean]
|
59
|
+
attr_accessor :write
|
60
|
+
|
61
|
+
##
|
62
|
+
# Should the cli print the entry to the command line?
|
63
|
+
#
|
64
|
+
# @param [Boolean] print
|
65
|
+
#
|
66
|
+
# @return [Boolean]
|
67
|
+
attr_accessor :print
|
68
|
+
|
69
|
+
##
|
70
|
+
# The date to use to find the entry.
|
71
|
+
#
|
72
|
+
# @param [Date] date
|
73
|
+
#
|
74
|
+
# @return [Date]
|
75
|
+
attr_accessor :date
|
76
|
+
|
77
|
+
##
|
78
|
+
# The preference file for Cli.
|
79
|
+
#
|
80
|
+
# @param [String] preference
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
attr_accessor :preference_file
|
84
|
+
|
85
|
+
##
|
86
|
+
# When writing a new entry, should 'previous' be pulled from the last
|
87
|
+
# entry?
|
88
|
+
#
|
89
|
+
# @param [Boolean] auto_fill_previous
|
90
|
+
#
|
91
|
+
# @return [Boolean]
|
92
|
+
attr_accessor :auto_fill_previous
|
93
|
+
|
94
|
+
##
|
95
|
+
# Initializes the config with default values.
|
96
|
+
def initialize
|
97
|
+
reset
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Sets all config values back to their defaults.
|
102
|
+
#
|
103
|
+
# @return [Hash]
|
104
|
+
def reset
|
105
|
+
DEFAULTS.each { |k, v| instance_variable_set("@#{k}", v) }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StandupMD
|
4
|
+
class Config
|
5
|
+
|
6
|
+
##
|
7
|
+
# The configuration class for StandupMD::Entry
|
8
|
+
class Entry
|
9
|
+
|
10
|
+
##
|
11
|
+
# The default options.
|
12
|
+
#
|
13
|
+
# @return [Hash]
|
14
|
+
DEFAULTS = {
|
15
|
+
current: ["<!-- ADD TODAY'S WORK HERE -->"],
|
16
|
+
previous: [],
|
17
|
+
impediments: ['None'],
|
18
|
+
notes: [],
|
19
|
+
}
|
20
|
+
|
21
|
+
##
|
22
|
+
# Tasks for "Current" section.
|
23
|
+
#
|
24
|
+
# @param [Array] current
|
25
|
+
#
|
26
|
+
# @return [Array]
|
27
|
+
attr_accessor :current
|
28
|
+
|
29
|
+
##
|
30
|
+
# Tasks for "Previous" section.
|
31
|
+
#
|
32
|
+
# @param [Array] previous
|
33
|
+
#
|
34
|
+
# @return [Array]
|
35
|
+
attr_accessor :previous
|
36
|
+
|
37
|
+
##
|
38
|
+
# Impediments for this entry.
|
39
|
+
#
|
40
|
+
# @param [Array] impediments
|
41
|
+
#
|
42
|
+
# @return [Array]
|
43
|
+
attr_accessor :impediments
|
44
|
+
|
45
|
+
##
|
46
|
+
# Notes for this entry.
|
47
|
+
#
|
48
|
+
# @param [Array] notes
|
49
|
+
#
|
50
|
+
# @return [Array]
|
51
|
+
attr_accessor :notes
|
52
|
+
|
53
|
+
##
|
54
|
+
# Initializes the config with default values.
|
55
|
+
def initialize
|
56
|
+
reset
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Sets all config values back to their defaults.
|
61
|
+
#
|
62
|
+
# @return [Hash]
|
63
|
+
def reset
|
64
|
+
DEFAULTS.each { |k, v| instance_variable_set("@#{k}", v) }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StandupMD
|
4
|
+
class Config
|
5
|
+
|
6
|
+
##
|
7
|
+
# The configuration class for StandupMD::EntryList
|
8
|
+
class EntryList
|
9
|
+
|
10
|
+
##
|
11
|
+
# The default options.
|
12
|
+
#
|
13
|
+
# @return [Hash]
|
14
|
+
DEFAULTS = {}
|
15
|
+
|
16
|
+
##
|
17
|
+
# Initializes the config with default values.
|
18
|
+
def initalize
|
19
|
+
reset
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Sets all config values back to their defaults.
|
24
|
+
#
|
25
|
+
# @return [Hash]
|
26
|
+
def reset
|
27
|
+
DEFAULTS.each { |k, v| instance_variable_set("@#{k}", v) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StandupMD
|
4
|
+
class Config
|
5
|
+
|
6
|
+
##
|
7
|
+
# The configuration class for StandupMD::File
|
8
|
+
class File
|
9
|
+
|
10
|
+
##
|
11
|
+
# The default options.
|
12
|
+
#
|
13
|
+
# @return [Hash]
|
14
|
+
DEFAULTS = {
|
15
|
+
header_date_format: '%Y-%m-%d',
|
16
|
+
header_depth: 1,
|
17
|
+
sub_header_depth: 2,
|
18
|
+
current_header: 'Current',
|
19
|
+
previous_header: 'Previous',
|
20
|
+
impediments_header: 'Impediments',
|
21
|
+
notes_header: 'Notes',
|
22
|
+
sub_header_order: %w[previous current impediments notes],
|
23
|
+
directory: ::File.join(ENV['HOME'], '.cache', 'standup_md'),
|
24
|
+
bullet_character: '-',
|
25
|
+
name_format: '%Y_%m.md',
|
26
|
+
create: true,
|
27
|
+
}
|
28
|
+
|
29
|
+
##
|
30
|
+
# Number of octothorps that should preface entry headers.
|
31
|
+
#
|
32
|
+
# @return [Integer] between 1 and 5
|
33
|
+
#
|
34
|
+
# @default 1
|
35
|
+
attr_reader :header_depth
|
36
|
+
|
37
|
+
##
|
38
|
+
# Number of octothorps that should preface sub-headers.
|
39
|
+
#
|
40
|
+
# @return [Integer] between 2 and 6
|
41
|
+
#
|
42
|
+
# @default 2
|
43
|
+
attr_reader :sub_header_depth
|
44
|
+
|
45
|
+
##
|
46
|
+
# The directory in which the files are located.
|
47
|
+
#
|
48
|
+
# @return [String]
|
49
|
+
#
|
50
|
+
# @default "~/.cache/standup_md"
|
51
|
+
attr_reader :directory
|
52
|
+
|
53
|
+
##
|
54
|
+
# Character used as bullets for list entries.
|
55
|
+
#
|
56
|
+
# @return [String] either - (dash) or * (asterisk)
|
57
|
+
#
|
58
|
+
# @default "-" (dash)
|
59
|
+
attr_reader :bullet_character
|
60
|
+
|
61
|
+
##
|
62
|
+
# String to be used as "Current" header.
|
63
|
+
#
|
64
|
+
# @param [String] header
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
# @default "Current"
|
69
|
+
attr_accessor :current_header
|
70
|
+
|
71
|
+
##
|
72
|
+
# String to be used as "Previous" header.
|
73
|
+
#
|
74
|
+
# @param [String] header
|
75
|
+
#
|
76
|
+
# @return [String]
|
77
|
+
#
|
78
|
+
# @default "Previous"
|
79
|
+
attr_accessor :previous_header
|
80
|
+
|
81
|
+
##
|
82
|
+
# String to be used as "Impediments" header.
|
83
|
+
#
|
84
|
+
# @param [String] header
|
85
|
+
#
|
86
|
+
# @return [String]
|
87
|
+
#
|
88
|
+
# @default "Impediments"
|
89
|
+
attr_accessor :impediments_header
|
90
|
+
|
91
|
+
##
|
92
|
+
# String to be used as "Notes" header.
|
93
|
+
#
|
94
|
+
# @param [String] header
|
95
|
+
#
|
96
|
+
# @return [String]
|
97
|
+
#
|
98
|
+
# @default "Notes"
|
99
|
+
attr_accessor :notes_header
|
100
|
+
|
101
|
+
##
|
102
|
+
# Preferred order for sub-headers.
|
103
|
+
#
|
104
|
+
# @param [Array] sub_header_order
|
105
|
+
#
|
106
|
+
# @return [Array]
|
107
|
+
#
|
108
|
+
# @default %w[previous current impediment notes]
|
109
|
+
attr_accessor :sub_header_order
|
110
|
+
|
111
|
+
##
|
112
|
+
# Format to be used for standup file names. Should be parse-able by
|
113
|
+
# strftime, and should be a monthly date.
|
114
|
+
#
|
115
|
+
# @param [String] name_format
|
116
|
+
#
|
117
|
+
# @return [String]
|
118
|
+
#
|
119
|
+
# @default "%Y_%m.md"
|
120
|
+
attr_accessor :name_format
|
121
|
+
|
122
|
+
##
|
123
|
+
# The date format for entry headers. Will be parsed by +strftime+.
|
124
|
+
#
|
125
|
+
# @param [String] format
|
126
|
+
#
|
127
|
+
# @return [String]
|
128
|
+
attr_accessor :header_date_format
|
129
|
+
|
130
|
+
##
|
131
|
+
# Should the file be created if it doesn't exist?
|
132
|
+
#
|
133
|
+
# @param [Boolean] create
|
134
|
+
#
|
135
|
+
# @return [boolean]
|
136
|
+
attr_accessor :create
|
137
|
+
|
138
|
+
##
|
139
|
+
# Initializes the config with default values.
|
140
|
+
def initialize
|
141
|
+
reset
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# Sets all config values back to their defaults.
|
146
|
+
#
|
147
|
+
# @return [Hash]
|
148
|
+
def reset
|
149
|
+
DEFAULTS.each { |k, v| instance_variable_set("@#{k}", v) }
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# Number of octothorps (#) to use before the main header.
|
154
|
+
#
|
155
|
+
# @param [Integer] depth
|
156
|
+
#
|
157
|
+
# @return [Integer]
|
158
|
+
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
|
164
|
+
@header_depth = depth
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Number of octothorps (#) to use before sub headers (Current, Previous,
|
169
|
+
# etc).
|
170
|
+
#
|
171
|
+
# @param [Integer] depth
|
172
|
+
#
|
173
|
+
# @return [Integer]
|
174
|
+
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
|
180
|
+
@sub_header_depth = depth
|
181
|
+
end
|
182
|
+
|
183
|
+
##
|
184
|
+
# Setter for bullet_character. Must be * (asterisk) or - (dash).
|
185
|
+
#
|
186
|
+
# @param [String] character
|
187
|
+
#
|
188
|
+
# @return [String]
|
189
|
+
def bullet_character=(char)
|
190
|
+
raise 'Must be "-" or "*"' unless %w[- *].include?(char)
|
191
|
+
@bullet_character = char
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
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.
|
198
|
+
#
|
199
|
+
# @param [String] directory
|
200
|
+
#
|
201
|
+
# @return [String]
|
202
|
+
def directory=(directory)
|
203
|
+
directory = ::File.expand_path(directory)
|
204
|
+
FileUtils.mkdir_p(directory) unless ::File.directory?(directory)
|
205
|
+
@directory = directory
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|