mvz-dnote 1.9.0 → 1.10.0
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/HISTORY.rdoc +5 -1
- data/lib/dnote/format.rb +11 -15
- data/lib/dnote/note.rb +8 -8
- data/lib/dnote/notes.rb +8 -8
- data/lib/dnote/rake/dnotetask.rb +11 -11
- data/lib/dnote/session.rb +9 -9
- data/lib/dnote/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f69fc38b3682fab8db2aa937fcde974c166e74e0a72c7ce3fef709f9660fde7
|
4
|
+
data.tar.gz: f26dac2be30677f1ce05be309e4b41f178988dd926512fe534168fe4a5e44702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df50e819949330f599cdd53ecba7ef7751f4908336e7c26d9be747ea33f3144e465c993e5318bc653aaee70ba8259b70d73c1f0dc0313eb5de2f6cf1bbbc665e
|
7
|
+
data.tar.gz: 69256f599091253c91a76f36681960160cf08c0e6a6eb8bfdf811750ee1a9bc9b681d69212998f220853581c93e846249a215b433a3f3349c92a99e4d15165ad
|
data/HISTORY.rdoc
CHANGED
data/lib/dnote/format.rb
CHANGED
@@ -14,7 +14,7 @@ module DNote
|
|
14
14
|
require "rexml/text"
|
15
15
|
require "dnote/core_ext"
|
16
16
|
|
17
|
-
EXTENSIONS = {
|
17
|
+
EXTENSIONS = {"text" => "txt", "soap" => "xml", "xoxo" => "xml"}.freeze
|
18
18
|
|
19
19
|
attr_reader :notes, :format, :output, :template, :title, :dryrun
|
20
20
|
|
@@ -24,17 +24,17 @@ module DNote
|
|
24
24
|
template: nil,
|
25
25
|
output: nil,
|
26
26
|
dryrun: false)
|
27
|
-
@notes
|
28
|
-
@format
|
29
|
-
@title
|
30
|
-
@dryrun
|
27
|
+
@notes = notes
|
28
|
+
@format = format
|
29
|
+
@title = title
|
30
|
+
@dryrun = dryrun
|
31
31
|
@template = template
|
32
|
-
@output
|
32
|
+
@output = output
|
33
33
|
end
|
34
34
|
|
35
35
|
def render
|
36
36
|
if notes.empty?
|
37
|
-
$stderr << "No #{notes.labels.join(
|
37
|
+
$stderr << "No #{notes.labels.join(", ")} notes.\n"
|
38
38
|
else
|
39
39
|
case format
|
40
40
|
when "custom"
|
@@ -75,13 +75,13 @@ module DNote
|
|
75
75
|
else
|
76
76
|
puts(result)
|
77
77
|
end
|
78
|
-
$stderr << "(#{notes.counts.map { |l, n| "#{n} #{l}s" }.join(
|
78
|
+
$stderr << "(#{notes.counts.map { |l, n| "#{n} #{l}s" }.join(", ")})\n"
|
79
79
|
end
|
80
80
|
|
81
81
|
def write(result, fname = nil)
|
82
82
|
if output.to_s[-1, 1] == "/" || File.directory?(output)
|
83
|
-
fmt
|
84
|
-
ext
|
83
|
+
fmt = format.split("/").first
|
84
|
+
ext = EXTENSIONS[fmt] || fmt
|
85
85
|
file = File.join(output, fname || "notes.#{ext}")
|
86
86
|
else
|
87
87
|
file = output
|
@@ -126,11 +126,7 @@ module DNote
|
|
126
126
|
|
127
127
|
def render(file)
|
128
128
|
contents = File.read(file)
|
129
|
-
erb =
|
130
|
-
ERB.new(contents, trim_mode: "<>")
|
131
|
-
else
|
132
|
-
ERB.new(contents, nil, "<>")
|
133
|
-
end
|
129
|
+
erb = ERB.new(contents, trim_mode: "<>")
|
134
130
|
erb.result(binding)
|
135
131
|
end
|
136
132
|
|
data/lib/dnote/note.rb
CHANGED
@@ -30,12 +30,12 @@ module DNote
|
|
30
30
|
|
31
31
|
# Initialize new Note instance.
|
32
32
|
def initialize(notes, file, label, line, text, mark)
|
33
|
-
@notes
|
34
|
-
@file
|
35
|
-
@label
|
36
|
-
@line
|
37
|
-
@text
|
38
|
-
@mark
|
33
|
+
@notes = notes
|
34
|
+
@file = file
|
35
|
+
@label = label
|
36
|
+
@line = line
|
37
|
+
@text = text.rstrip
|
38
|
+
@mark = mark
|
39
39
|
@capture = []
|
40
40
|
end
|
41
41
|
|
@@ -68,12 +68,12 @@ module DNote
|
|
68
68
|
# TODO: Add +code+? Problem is that xml needs code in CDATA.
|
69
69
|
#++
|
70
70
|
def to_h
|
71
|
-
{
|
71
|
+
{"label" => label, "text" => textline, "file" => file, "line" => line}
|
72
72
|
end
|
73
73
|
|
74
74
|
# Convert to Hash, leaving the note text verbatim.
|
75
75
|
def to_h_raw
|
76
|
-
{
|
76
|
+
{"label" => label, "text" => text, "file" => file, "line" => line, "code" => code}
|
77
77
|
end
|
78
78
|
|
79
79
|
# Convert to JSON.
|
data/lib/dnote/notes.rb
CHANGED
@@ -20,10 +20,10 @@ module DNote
|
|
20
20
|
#++
|
21
21
|
class Notes
|
22
22
|
# Default paths (all ruby scripts).
|
23
|
-
DEFAULT_PATHS
|
23
|
+
DEFAULT_PATHS = ["**/*.rb"].freeze
|
24
24
|
|
25
25
|
# Default note labels to look for in source code. (NOT CURRENTLY USED!)
|
26
|
-
DEFAULT_LABELS = %w
|
26
|
+
DEFAULT_LABELS = %w[TODO FIXME OPTIMIZE THINK DEPRECATE].freeze
|
27
27
|
|
28
28
|
# Files to search for notes.
|
29
29
|
attr_reader :files
|
@@ -45,13 +45,13 @@ module DNote
|
|
45
45
|
|
46
46
|
# New set of notes for give +files+ and optional special labels.
|
47
47
|
def initialize(files, options = {})
|
48
|
-
@files
|
49
|
-
@labels
|
50
|
-
@colon
|
51
|
-
@marker
|
52
|
-
@url
|
48
|
+
@files = [files].flatten
|
49
|
+
@labels = [options[:labels] || DEFAULT_LABELS].flatten.compact
|
50
|
+
@colon = options[:colon].nil? ? true : options[:colon]
|
51
|
+
@marker = options[:marker]
|
52
|
+
@url = options[:url]
|
53
53
|
@context = options[:context] || 0
|
54
|
-
@remark
|
54
|
+
@remark = {}
|
55
55
|
|
56
56
|
parse
|
57
57
|
end
|
data/lib/dnote/rake/dnotetask.rb
CHANGED
@@ -9,7 +9,7 @@ module DNote
|
|
9
9
|
require "rake/clean"
|
10
10
|
|
11
11
|
# Default note labels to looked for in source code.
|
12
|
-
DEFAULT_LABELS = %w
|
12
|
+
DEFAULT_LABELS = %w[TODO FIXME OPTIMIZE DEPRECATE].freeze
|
13
13
|
|
14
14
|
# File paths to search.
|
15
15
|
attr_accessor :files
|
@@ -40,10 +40,10 @@ module DNote
|
|
40
40
|
def init
|
41
41
|
require "dnote"
|
42
42
|
require "dnote/format"
|
43
|
-
@files
|
44
|
-
@output
|
43
|
+
@files = "**/*.rb"
|
44
|
+
@output = "log/dnote"
|
45
45
|
@formats = ["index"]
|
46
|
-
@labels
|
46
|
+
@labels = nil
|
47
47
|
end
|
48
48
|
|
49
49
|
def define
|
@@ -79,13 +79,13 @@ module DNote
|
|
79
79
|
|
80
80
|
def new_session
|
81
81
|
::DNote::Session.new do |s|
|
82
|
-
s.paths
|
82
|
+
s.paths = files
|
83
83
|
s.exclude = exclude
|
84
|
-
s.ignore
|
85
|
-
s.labels
|
86
|
-
s.title
|
87
|
-
s.output
|
88
|
-
s.dryrun
|
84
|
+
s.ignore = ignore
|
85
|
+
s.labels = labels
|
86
|
+
s.title = title
|
87
|
+
s.output = output
|
88
|
+
s.dryrun = application.options.dryrun # trial?
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -97,7 +97,7 @@ module DNote
|
|
97
97
|
session.format = format
|
98
98
|
end
|
99
99
|
session.run
|
100
|
-
report "Updated #{output.to_s.sub("#{Dir.pwd}/",
|
100
|
+
report "Updated #{output.to_s.sub("#{Dir.pwd}/", "")}" unless trial?
|
101
101
|
end
|
102
102
|
|
103
103
|
def clean_format(format)
|
data/lib/dnote/session.rb
CHANGED
@@ -80,15 +80,15 @@ module DNote
|
|
80
80
|
|
81
81
|
# Set default values for attributes.
|
82
82
|
def initialize_defaults
|
83
|
-
@paths
|
84
|
-
@labels
|
83
|
+
@paths = []
|
84
|
+
@labels = []
|
85
85
|
@exclude = []
|
86
|
-
@ignore
|
87
|
-
@format
|
88
|
-
@title
|
89
|
-
@dryrun
|
90
|
-
@marker
|
91
|
-
@url
|
86
|
+
@ignore = []
|
87
|
+
@format = DEFAULT_FORMAT
|
88
|
+
@title = DEFAULT_TITLE
|
89
|
+
@dryrun = false
|
90
|
+
@marker = nil
|
91
|
+
@url = nil
|
92
92
|
@context = 0
|
93
93
|
end
|
94
94
|
|
@@ -148,7 +148,7 @@ module DNote
|
|
148
148
|
|
149
149
|
# List availble format templates
|
150
150
|
def list_templates
|
151
|
-
tdir
|
151
|
+
tdir = File.join(DIR, "templates")
|
152
152
|
tfiles = Dir[File.join(tdir, "**/*.erb")]
|
153
153
|
tnames = tfiles.map { |tname| tname.sub("#{tdir}/", "").chomp(".erb") }
|
154
154
|
groups = tnames.group_by { |tname| tname.split("/").first }
|
data/lib/dnote/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mvz-dnote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Sawyer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aruba
|
@@ -101,14 +101,14 @@ dependencies:
|
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 1.
|
104
|
+
version: '1.26'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 1.
|
111
|
+
version: '1.26'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: rubocop-packaging
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,28 +129,28 @@ dependencies:
|
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 1.
|
132
|
+
version: '1.13'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 1.
|
139
|
+
version: '1.13'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: rubocop-rspec
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
146
|
+
version: '2.9'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: 2.
|
153
|
+
version: '2.9'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: simplecov
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +235,7 @@ metadata:
|
|
235
235
|
homepage_uri: https://github.com/mvz/dnote
|
236
236
|
source_code_uri: https://github.com/mvz/dnote
|
237
237
|
changelog_uri: https://github.com/mvz/dnote/blob/master/HISTORY.rdoc
|
238
|
+
rubygems_mfa_required: 'true'
|
238
239
|
post_install_message:
|
239
240
|
rdoc_options:
|
240
241
|
- "--main"
|
@@ -245,14 +246,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
245
246
|
requirements:
|
246
247
|
- - ">="
|
247
248
|
- !ruby/object:Gem::Version
|
248
|
-
version: 2.
|
249
|
+
version: 2.6.0
|
249
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
251
|
requirements:
|
251
252
|
- - ">="
|
252
253
|
- !ruby/object:Gem::Version
|
253
254
|
version: '0'
|
254
255
|
requirements: []
|
255
|
-
rubygems_version: 3.
|
256
|
+
rubygems_version: 3.3.7
|
256
257
|
signing_key:
|
257
258
|
specification_version: 4
|
258
259
|
summary: Extract developer's notes from source code.
|