jtag 0.1.21 → 0.1.25
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/CHANGELOG.md +8 -0
- data/Rakefile +13 -16
- data/bin/jtag +7 -2
- data/jtag.gemspec +7 -5
- data/lib/jtag/jekylltag.rb +39 -11
- data/lib/jtag/string.rb +3 -1
- data/lib/jtag/util.rb +14 -7
- data/lib/jtag/version.rb +1 -1
- metadata +30 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d12022a720e811093534ee136708507580b0ac4457e9b8f4a15574c93a8885a1
|
|
4
|
+
data.tar.gz: 0c9ac5e09cba24a9f4d0328a41cb4c82d52fcf759dedab963eaf7fdfc82b558e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34aa8fc078a66ea62a371cb92f55e96211235a461d0da2130c2e0c3cf7b8e82a74519378f9bd4999388012d6192dd6705d9edafef3b0e5598b70aa2cbc23c252
|
|
7
|
+
data.tar.gz: a8d8eb9a5e60aaf84b0fba8d88295c9374bf1897ade5d6fa6f944932206ddfa4ec73eff446a8a8746f5065c5350de634e985b1a623288a1e93837064eded1743
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
|
@@ -16,19 +16,15 @@ Gem::PackageTask.new(spec) do |pkg|
|
|
|
16
16
|
end
|
|
17
17
|
CUKE_RESULTS = 'results.html'
|
|
18
18
|
CLEAN << CUKE_RESULTS
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
opts
|
|
22
|
-
|
|
23
|
-
t.cucumber_opts = opts
|
|
19
|
+
Cucumber::Rake::Task.new(:features, 'Run features') do |t|
|
|
20
|
+
opts = ['features', '--format', 'html', '-o', CUKE_RESULTS, '--format', 'progress', '-x']
|
|
21
|
+
opts += ['--tags', ENV['TAGS']] if ENV['TAGS']
|
|
22
|
+
t.cucumber_opts = opts
|
|
24
23
|
t.fork = false
|
|
25
24
|
end
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
tag_opts = ' --tags ~@pending'
|
|
30
|
-
tag_opts = ' --tags @wip'
|
|
31
|
-
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
|
26
|
+
Cucumber::Rake::Task.new('features:wip', 'Run features tagged as work-in-progress (@wip)') do |t|
|
|
27
|
+
t.cucumber_opts = ['features', '--format', 'html', '-o', CUKE_RESULTS, '--format', 'pretty', '-x', '-s', '--tags', '@wip']
|
|
32
28
|
t.fork = false
|
|
33
29
|
end
|
|
34
30
|
|
|
@@ -67,11 +63,12 @@ task :bump, :type do |t, args|
|
|
|
67
63
|
version_file = "lib/#{spec.name}/version.rb"
|
|
68
64
|
raise "File not found" unless File.exist? version_file
|
|
69
65
|
content = IO.read(version_file)
|
|
70
|
-
content.sub!(/VERSION = '(\d+)\.(\d+)\.(\d+)(\.\S+)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
content.sub!(/VERSION = (['"])(\d+)\.(\d+)\.(\d+)(\.\S+)?\1/) {
|
|
67
|
+
quote = $1
|
|
68
|
+
major = $2.to_i
|
|
69
|
+
minor = $3.to_i
|
|
70
|
+
inc = $4.to_i
|
|
71
|
+
pre = $5
|
|
75
72
|
|
|
76
73
|
case args[:type]
|
|
77
74
|
when /^maj/
|
|
@@ -86,7 +83,7 @@ task :bump, :type do |t, args|
|
|
|
86
83
|
end
|
|
87
84
|
|
|
88
85
|
$stdout.puts "At version #{major}.#{minor}.#{inc}#{pre}"
|
|
89
|
-
"VERSION =
|
|
86
|
+
"VERSION = #{quote}#{major}.#{minor}.#{inc}#{pre}#{quote}"
|
|
90
87
|
}
|
|
91
88
|
File.open(version_file, 'w+') {|f|
|
|
92
89
|
f.puts content
|
data/bin/jtag
CHANGED
|
@@ -797,8 +797,11 @@ end
|
|
|
797
797
|
## @return [void]
|
|
798
798
|
##
|
|
799
799
|
def update_deprecated_config
|
|
800
|
+
@util = JekyllTag::Util.new
|
|
800
801
|
if File.exist?(File.expand_path("~/.jtag"))
|
|
801
|
-
FileUtils.
|
|
802
|
+
FileUtils.mkdir_p(File.expand_path("~/.config/jtag"))
|
|
803
|
+
FileUtils.cp_r(File.expand_path("~/.jtag"), File.expand_path("~/.config/jtag"), noop: true)
|
|
804
|
+
FileUtils.rm_rf(File.expand_path("~/.jtag"))
|
|
802
805
|
@util.console_log "Moved ~/.jtag to ~/.config/jtag", level: :info, err: true, log: false
|
|
803
806
|
end
|
|
804
807
|
end
|
|
@@ -862,8 +865,10 @@ post do |global, command, options, args|
|
|
|
862
865
|
end
|
|
863
866
|
|
|
864
867
|
on_error do |exception|
|
|
868
|
+
@util ||= JekyllTag::Util.new
|
|
865
869
|
if exception.is_a?(NoValidFile) || exception.is_a?(FileNotFound) || exception.is_a?(NoTagsFound)
|
|
866
|
-
@
|
|
870
|
+
prefix = @jt ? @jt.color(:red) : ""
|
|
871
|
+
@util.console_log "#{prefix}#{exception.message}", err: true, level: :error
|
|
867
872
|
return false
|
|
868
873
|
end
|
|
869
874
|
|
data/jtag.gemspec
CHANGED
|
@@ -6,6 +6,8 @@ spec = Gem::Specification.new do |s|
|
|
|
6
6
|
s.author = "Brett Terpstra"
|
|
7
7
|
s.email = "me@brettterpstra.com"
|
|
8
8
|
s.homepage = "http://brettterpstra.com"
|
|
9
|
+
s.license = nil
|
|
10
|
+
s.required_ruby_version = ">= 3.3"
|
|
9
11
|
s.platform = Gem::Platform::RUBY
|
|
10
12
|
s.summary = "Auto-tagging and tagging tools for Jekyll"
|
|
11
13
|
# Add your other files here if you make them
|
|
@@ -16,10 +18,10 @@ spec = Gem::Specification.new do |s|
|
|
|
16
18
|
s.rdoc_options << "--title" << "jtag" << "--main" << "README.rdoc"
|
|
17
19
|
s.bindir = "bin"
|
|
18
20
|
s.executables << "jtag"
|
|
19
|
-
s.add_development_dependency("rake")
|
|
20
|
-
s.add_development_dependency("rdoc")
|
|
21
|
-
s.add_development_dependency("aruba")
|
|
21
|
+
s.add_development_dependency("rake", "~> 13.0")
|
|
22
|
+
s.add_development_dependency("rdoc", "~> 6.6")
|
|
23
|
+
s.add_development_dependency("aruba", "~> 2.0")
|
|
22
24
|
s.add_runtime_dependency("gli", "= 2.20.0")
|
|
23
|
-
s.add_runtime_dependency("plist")
|
|
24
|
-
s.add_runtime_dependency("csv")
|
|
25
|
+
s.add_runtime_dependency("plist", "~> 3.7")
|
|
26
|
+
s.add_runtime_dependency("csv", "~> 3.2")
|
|
25
27
|
end
|
data/lib/jtag/jekylltag.rb
CHANGED
|
@@ -11,29 +11,31 @@ module JekyllTag
|
|
|
11
11
|
config = config.symbolize_keys
|
|
12
12
|
@support = support_dir
|
|
13
13
|
@util = JekyllTag::Util.new
|
|
14
|
+
@min_matches = config[:min_matches] || 2
|
|
15
|
+
@post_extension = (config[:post_extension] || "md").to_s.sub(/^\./, "")
|
|
16
|
+
@tags_key = config[:tags_key] || "tags"
|
|
17
|
+
@default_post_location = normalize_post_location(config[:default_post_location], config[:post_extension])
|
|
14
18
|
begin
|
|
15
19
|
if options[:files]
|
|
16
20
|
@tags_loc = :auto
|
|
17
21
|
files = options[:files].map(&:File.expand_path)
|
|
18
22
|
elsif config[:tags_location].to_s =~ /^(auto|posts?)$/
|
|
19
23
|
@tags_loc = :auto
|
|
20
|
-
files = Dir.glob(File.
|
|
24
|
+
files = Dir.glob(File.join(@default_post_location.to_s, "**", "*.#{@post_extension}"))
|
|
21
25
|
else
|
|
22
|
-
@tags_loc =
|
|
23
|
-
@tags_loc
|
|
26
|
+
@tags_loc = config[:tags_location]
|
|
27
|
+
if File.exist?(File.expand_path(@tags_loc))
|
|
28
|
+
@tags_loc = File.expand_path(@tags_loc)
|
|
29
|
+
else
|
|
30
|
+
@tags_loc.sub!(/^https?:\/\//, "")
|
|
31
|
+
end
|
|
24
32
|
files = nil
|
|
25
33
|
end
|
|
26
34
|
rescue StandardError => e
|
|
27
35
|
raise InvalidTagsFile, "Error reading configured tags locatio (#{e})"
|
|
28
36
|
end
|
|
29
|
-
@min_matches = config[:min_matches] || 2
|
|
30
|
-
@post_extension = config[:post_extension] || "md"
|
|
31
|
-
@post_extension.sub!(/^\./, "")
|
|
32
|
-
@tags_key = config[:tags_key] || "tags"
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
@default_post_location = File.expand_path(config[:default_post_location]) || false
|
|
36
|
-
else
|
|
38
|
+
unless config.has_key?(:default_post_location)
|
|
37
39
|
str = ["#{color("yellow")}No #{color("boldyellow")}default_post_location#{color("yellow")} set.",
|
|
38
40
|
"If you commonly work on the same posts you can add the path and extension",
|
|
39
41
|
"to these key in ~/.jtag/config.yml. Then, if you don't specify files",
|
|
@@ -54,6 +56,24 @@ module JekyllTag
|
|
|
54
56
|
}
|
|
55
57
|
end
|
|
56
58
|
|
|
59
|
+
# Older configs stored a glob (…/_posts/*.md). Commands expect a directory
|
|
60
|
+
# plus post_extension, so peel the glob off and keep the extension.
|
|
61
|
+
def normalize_post_location(location, explicit_extension)
|
|
62
|
+
return false if location.nil? || location.to_s.strip.empty?
|
|
63
|
+
|
|
64
|
+
raw = location.to_s.strip
|
|
65
|
+
if raw.match?(/[*?\[{]/)
|
|
66
|
+
unless explicit_extension
|
|
67
|
+
ext = raw[/\*\.([A-Za-z0-9]+)\z/, 1]
|
|
68
|
+
@post_extension = ext if ext
|
|
69
|
+
end
|
|
70
|
+
dir = File.expand_path(File.dirname(raw))
|
|
71
|
+
return File.directory?(dir) ? dir : false
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
File.expand_path(raw)
|
|
75
|
+
end
|
|
76
|
+
|
|
57
77
|
def tags(options = {})
|
|
58
78
|
blacklisted = options[:blacklisted] || false
|
|
59
79
|
counts = options[:counts] || false
|
|
@@ -140,7 +160,15 @@ module JekyllTag
|
|
|
140
160
|
begin
|
|
141
161
|
input = piped ? file.strip : IO.read(File.expand_path(file))
|
|
142
162
|
yaml = YAML::load(input)
|
|
143
|
-
|
|
163
|
+
tags = yaml.is_a?(Hash) ? yaml[@tags_key] : nil
|
|
164
|
+
case tags
|
|
165
|
+
when Array
|
|
166
|
+
tags.compact.map(&:to_s)
|
|
167
|
+
when String
|
|
168
|
+
[tags]
|
|
169
|
+
else
|
|
170
|
+
[]
|
|
171
|
+
end
|
|
144
172
|
rescue
|
|
145
173
|
return []
|
|
146
174
|
end
|
data/lib/jtag/string.rb
CHANGED
|
@@ -22,7 +22,7 @@ module JekyllTag
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
##
|
|
25
|
-
## Convert a string to a format symbol (:csv, :complete, :json, :plist, :yaml)
|
|
25
|
+
## Convert a string to a format symbol (:list, :csv, :complete, :json, :plist, :yaml)
|
|
26
26
|
##
|
|
27
27
|
## @return [Symbol] format symbol
|
|
28
28
|
##
|
|
@@ -38,6 +38,8 @@ module JekyllTag
|
|
|
38
38
|
:csv
|
|
39
39
|
when /^c/i
|
|
40
40
|
:complete
|
|
41
|
+
when /^l/i
|
|
42
|
+
:list
|
|
41
43
|
else
|
|
42
44
|
raise ArgumentError, "Invalid format string: #{self}"
|
|
43
45
|
end
|
data/lib/jtag/util.rb
CHANGED
|
@@ -17,6 +17,11 @@ module JekyllTag
|
|
|
17
17
|
|
|
18
18
|
CONFIG_FILES = %w{blacklist.txt config.yml stopwords.txt synonyms.yml}
|
|
19
19
|
|
|
20
|
+
def initialize
|
|
21
|
+
@debug_level = 3
|
|
22
|
+
@silent = false
|
|
23
|
+
end
|
|
24
|
+
|
|
20
25
|
##
|
|
21
26
|
## Output tags in the specified format
|
|
22
27
|
##
|
|
@@ -33,7 +38,8 @@ module JekyllTag
|
|
|
33
38
|
##
|
|
34
39
|
def output_tags(tags, options)
|
|
35
40
|
# Determine the format for output, defaulting to "yaml" if not specified
|
|
36
|
-
format = options[:format]
|
|
41
|
+
format = options[:format].respond_to?(:to_format) ? options[:format].to_format : (options[:format] || :yaml)
|
|
42
|
+
format = format.to_sym
|
|
37
43
|
# Determine if tags should be printed with a null delimiter
|
|
38
44
|
print0 = options[:print0] || false
|
|
39
45
|
# Determine the filename for output, if specified
|
|
@@ -45,7 +51,7 @@ module JekyllTag
|
|
|
45
51
|
tags.uniq!
|
|
46
52
|
|
|
47
53
|
case format
|
|
48
|
-
when
|
|
54
|
+
when :complete
|
|
49
55
|
if filename || content
|
|
50
56
|
content = filename ? IO.read(File.expand_path(filename)) : content
|
|
51
57
|
parts = content.split(/---\s*\n/)
|
|
@@ -64,19 +70,19 @@ module JekyllTag
|
|
|
64
70
|
else
|
|
65
71
|
console_log tags.join("\n"), level: :error, err: false
|
|
66
72
|
end
|
|
67
|
-
when
|
|
73
|
+
when :list
|
|
68
74
|
# Join tags with a null character delimiter
|
|
69
75
|
console_log tags.map(&:strip).join(print0 ? "\x00" : "\n"), level: :error, err: false, file: filename
|
|
70
|
-
when
|
|
76
|
+
when :csv
|
|
71
77
|
# Log the tags in CSV format
|
|
72
78
|
console_log tags.to_csv
|
|
73
|
-
when
|
|
79
|
+
when :json
|
|
74
80
|
# Create a hash with tags and optional filename, then log as JSON
|
|
75
81
|
out = {}
|
|
76
82
|
out["tags"] = tags
|
|
77
83
|
out["path"] = filename if filename
|
|
78
84
|
console_log out.to_json
|
|
79
|
-
when
|
|
85
|
+
when :plist
|
|
80
86
|
# Create a hash with optional filename, then log as plist
|
|
81
87
|
out = {}
|
|
82
88
|
out["path"] = filename if filename
|
|
@@ -139,7 +145,8 @@ module JekyllTag
|
|
|
139
145
|
err = options[:err] || false
|
|
140
146
|
options[:log] ||= false
|
|
141
147
|
|
|
142
|
-
|
|
148
|
+
threshold = @debug_level || 0
|
|
149
|
+
return unless DEBUG_LEVELS.fetch(level.to_sym, 0) < threshold
|
|
143
150
|
|
|
144
151
|
if options[:log]
|
|
145
152
|
if err
|
data/lib/jtag/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jtag
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.25
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brett Terpstra
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-11-04 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rake
|
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
|
15
16
|
requirements:
|
|
16
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
17
18
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '0'
|
|
19
|
+
version: '13.0'
|
|
19
20
|
type: :development
|
|
20
21
|
prerelease: false
|
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
23
|
requirements:
|
|
23
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
24
25
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '0'
|
|
26
|
+
version: '13.0'
|
|
26
27
|
- !ruby/object:Gem::Dependency
|
|
27
28
|
name: rdoc
|
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
|
29
30
|
requirements:
|
|
30
|
-
- - "
|
|
31
|
+
- - "~>"
|
|
31
32
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
+
version: '6.6'
|
|
33
34
|
type: :development
|
|
34
35
|
prerelease: false
|
|
35
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
37
|
requirements:
|
|
37
|
-
- - "
|
|
38
|
+
- - "~>"
|
|
38
39
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
40
|
+
version: '6.6'
|
|
40
41
|
- !ruby/object:Gem::Dependency
|
|
41
42
|
name: aruba
|
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
|
43
44
|
requirements:
|
|
44
|
-
- - "
|
|
45
|
+
- - "~>"
|
|
45
46
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
47
|
+
version: '2.0'
|
|
47
48
|
type: :development
|
|
48
49
|
prerelease: false
|
|
49
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
51
|
requirements:
|
|
51
|
-
- - "
|
|
52
|
+
- - "~>"
|
|
52
53
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
54
|
+
version: '2.0'
|
|
54
55
|
- !ruby/object:Gem::Dependency
|
|
55
56
|
name: gli
|
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -69,30 +70,31 @@ dependencies:
|
|
|
69
70
|
name: plist
|
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
|
71
72
|
requirements:
|
|
72
|
-
- - "
|
|
73
|
+
- - "~>"
|
|
73
74
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
75
|
+
version: '3.7'
|
|
75
76
|
type: :runtime
|
|
76
77
|
prerelease: false
|
|
77
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
79
|
requirements:
|
|
79
|
-
- - "
|
|
80
|
+
- - "~>"
|
|
80
81
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
82
|
+
version: '3.7'
|
|
82
83
|
- !ruby/object:Gem::Dependency
|
|
83
84
|
name: csv
|
|
84
85
|
requirement: !ruby/object:Gem::Requirement
|
|
85
86
|
requirements:
|
|
86
|
-
- - "
|
|
87
|
+
- - "~>"
|
|
87
88
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
89
|
+
version: '3.2'
|
|
89
90
|
type: :runtime
|
|
90
91
|
prerelease: false
|
|
91
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
93
|
requirements:
|
|
93
|
-
- - "
|
|
94
|
+
- - "~>"
|
|
94
95
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
96
|
+
version: '3.2'
|
|
97
|
+
description:
|
|
96
98
|
email: me@brettterpstra.com
|
|
97
99
|
executables:
|
|
98
100
|
- jtag
|
|
@@ -129,8 +131,10 @@ files:
|
|
|
129
131
|
- lib/jtag/version.rb
|
|
130
132
|
- mise.toml
|
|
131
133
|
homepage: http://brettterpstra.com
|
|
132
|
-
licenses:
|
|
134
|
+
licenses:
|
|
135
|
+
-
|
|
133
136
|
metadata: {}
|
|
137
|
+
post_install_message:
|
|
134
138
|
rdoc_options:
|
|
135
139
|
- "--title"
|
|
136
140
|
- jtag
|
|
@@ -143,14 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
143
147
|
requirements:
|
|
144
148
|
- - ">="
|
|
145
149
|
- !ruby/object:Gem::Version
|
|
146
|
-
version: '
|
|
150
|
+
version: '3.3'
|
|
147
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
152
|
requirements:
|
|
149
153
|
- - ">="
|
|
150
154
|
- !ruby/object:Gem::Version
|
|
151
155
|
version: '0'
|
|
152
156
|
requirements: []
|
|
153
|
-
rubygems_version: 3.
|
|
157
|
+
rubygems_version: 3.5.3
|
|
158
|
+
signing_key:
|
|
154
159
|
specification_version: 4
|
|
155
160
|
summary: Auto-tagging and tagging tools for Jekyll
|
|
156
161
|
test_files: []
|