spltty 0.1.0 → 0.1.1
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/lib/spltty_cli/commands/add.rb +1 -1
- data/lib/spltty_cli/commands/install.rb +12 -5
- data/lib/spltty_cli/config.rb +1 -1
- data/lib/spltty_cli/discovery.rb +1 -1
- data/lib/spltty_cli/notes.rb +1 -1
- data/lib/spltty_cli/notes_sync.rb +1 -1
- data/lib/spltty_cli/totals.rb +1 -1
- data/lib/spltty_cli/version.rb +1 -1
- data/lib/spltty_cli.rb +6 -0
- 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: cda46c6bf3b96b0fc361678123afa2b6a99ee9499925c1c9218f5d2cdc1bdad2
|
|
4
|
+
data.tar.gz: c53c93595eb48159d85dd8179a69e5e81c6e9ffde392c57474f68496111bbea6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15887da426206c6d5449cd6ea1d849cdff176cc2df67bb0a56473a97d4a077e178f526adea6010f0f846b8ddaf46696e6745c3bc7d1d165e7ba2833489c72812
|
|
7
|
+
data.tar.gz: f343cfb690de8f8adadbf66b8763e5521f2b6e29e93dec9817d383f5f0387c596a16b9645f48c5c20eabbf9937b20198e287c1d0d8dda4b9760f35a6fabd8c3d
|
|
@@ -66,7 +66,7 @@ module SplttyCLI
|
|
|
66
66
|
path = Ledger.target_path(@config, name, entry, date)
|
|
67
67
|
ensure_file(name, entry, path, date)
|
|
68
68
|
|
|
69
|
-
text = File.read(path)
|
|
69
|
+
text = File.read(path, encoding: "UTF-8")
|
|
70
70
|
parsed = Table.parse(text)
|
|
71
71
|
row = Table.format_row(parsed, values)
|
|
72
72
|
|
|
@@ -292,7 +292,7 @@ module SplttyCLI
|
|
|
292
292
|
return if File.exist?(path)
|
|
293
293
|
|
|
294
294
|
FileUtils.mkdir_p(File.dirname(path))
|
|
295
|
-
File.write(path,
|
|
295
|
+
File.write(path, read_template("sources-INDEX.md"))
|
|
296
296
|
end
|
|
297
297
|
|
|
298
298
|
# Render the workspace guide. An existing CLAUDE.md is never clobbered —
|
|
@@ -316,7 +316,7 @@ module SplttyCLI
|
|
|
316
316
|
skill = File.join(@root, ".claude", "skills", "ingest", "SKILL.md")
|
|
317
317
|
unless File.exist?(skill)
|
|
318
318
|
FileUtils.mkdir_p(File.dirname(skill))
|
|
319
|
-
File.write(skill,
|
|
319
|
+
File.write(skill, read_template("skills", "ingest", "SKILL.md"))
|
|
320
320
|
end
|
|
321
321
|
path
|
|
322
322
|
end
|
|
@@ -340,7 +340,7 @@ module SplttyCLI
|
|
|
340
340
|
|
|
341
341
|
gitignore = File.join(@root, ".gitignore")
|
|
342
342
|
unless File.exist?(gitignore)
|
|
343
|
-
File.write(gitignore,
|
|
343
|
+
File.write(gitignore, read_template("gitignore"))
|
|
344
344
|
end
|
|
345
345
|
system("git", "init", "--quiet", @root) || warn("spltty install: git init failed — skipping")
|
|
346
346
|
end
|
|
@@ -372,9 +372,16 @@ module SplttyCLI
|
|
|
372
372
|
# --- helpers ------------------------------------------------------------
|
|
373
373
|
|
|
374
374
|
def render(template, **vars)
|
|
375
|
-
src = File.read(File.join(SplttyCLI::TEMPLATES_DIR, template))
|
|
376
375
|
scope = TemplateScope.new(vars)
|
|
377
|
-
ERB.new(
|
|
376
|
+
ERB.new(read_template(template), trim_mode: "-").result(scope.binding_for)
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
# Templates ship as UTF-8. Read them explicitly rather than through the
|
|
380
|
+
# locale's default_external: under LC_ALL=C (Docker, cron, CI, `brew test`)
|
|
381
|
+
# Ruby would tag them US-ASCII and ERB would refuse to compile the em dashes
|
|
382
|
+
# with "invalid multibyte character".
|
|
383
|
+
def read_template(*parts)
|
|
384
|
+
File.read(File.join(SplttyCLI::TEMPLATES_DIR, *parts), encoding: "UTF-8")
|
|
378
385
|
end
|
|
379
386
|
|
|
380
387
|
def split_list(str)
|
data/lib/spltty_cli/config.rb
CHANGED
data/lib/spltty_cli/discovery.rb
CHANGED
|
@@ -52,7 +52,7 @@ module SplttyCLI
|
|
|
52
52
|
def detect_schema(file)
|
|
53
53
|
return "standard" unless file && File.exist?(file)
|
|
54
54
|
|
|
55
|
-
File.foreach(file) do |line|
|
|
55
|
+
File.foreach(file, encoding: "UTF-8") do |line|
|
|
56
56
|
next unless line.strip.start_with?("|")
|
|
57
57
|
|
|
58
58
|
return line.include?("Orig. Value") ? "montreal" : "standard"
|
data/lib/spltty_cli/notes.rb
CHANGED
|
@@ -20,7 +20,7 @@ module SplttyCLI
|
|
|
20
20
|
def parse(path)
|
|
21
21
|
return { frontmatter: {}, body: "", mtime: nil } unless File.exist?(path)
|
|
22
22
|
|
|
23
|
-
raw = File.read(path)
|
|
23
|
+
raw = File.read(path, encoding: "UTF-8")
|
|
24
24
|
mtime = File.mtime(path)
|
|
25
25
|
fm, body = split(raw)
|
|
26
26
|
{ frontmatter: fm, body: body, mtime: mtime }
|
data/lib/spltty_cli/totals.rb
CHANGED
data/lib/spltty_cli/version.rb
CHANGED
data/lib/spltty_cli.rb
CHANGED
|
@@ -37,6 +37,12 @@ module SplttyCLI
|
|
|
37
37
|
# --paid-responsible option, supporting both `-pr X` and `-pr=X`.
|
|
38
38
|
def self.run(argv = ARGV)
|
|
39
39
|
$PROGRAM_NAME = "spltty"
|
|
40
|
+
|
|
41
|
+
# Ledgers, notes and templates are UTF-8 whatever the caller's locale is. Under
|
|
42
|
+
# LC_ALL=C (Docker, cron, CI) default_external is US-ASCII, so every File.read
|
|
43
|
+
# comes back mistagged and an em dash or accented name derails the command.
|
|
44
|
+
Encoding.default_external = Encoding::UTF_8
|
|
45
|
+
|
|
40
46
|
normalized = argv.map do |arg|
|
|
41
47
|
if arg == "-pr"
|
|
42
48
|
"--paid-responsible"
|