bdgtr-cli 0.1.0 → 0.2
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/README.md +3 -3
- data/bin/bdgtr +7 -12
- data/data/bdgtr.sqlite +0 -0
- data/lib/bdgtr/cli/gem_home.rb +0 -25
- data/lib/bdgtr/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: e3b14aafd13b319d5d6ebd1f0f2d2b33006913d90280a681b35d43ede253ba54
|
|
4
|
+
data.tar.gz: 6e28475797d841adb890ca7d7b603191f7c7e44337add49291fb5d57210da016
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0a52dea168f388ac5871b77d4cf50db548a428fadb25cd629088784c6df67e0c6bf0e2bd44ca22c2a8c4bcab447d3e1601b68d2829ac3690371a77b605f9bb6
|
|
7
|
+
data.tar.gz: '0878e0509c2823a9bfef330428a44e4f5b7b96f4ae5142c710c8a5bacfa104ead4f7cd36b41a50288fa9a83a717c7c62d763eb00705ee8737b73a1007f8f2480'
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# bdgtr-cli
|
|
2
2
|
|
|
3
|
-
Command line for bdgtr.
|
|
3
|
+
Command line for bdgtr. Installing the gem creates `~/.bdgtr/config.yml` and `~/.bdgtr/bdgtr.sqlite` when they are missing, and leaves an existing ledger file in place.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`bdgtr version` prints the gem version. `bdgtr ledger:reset` replaces `~/.bdgtr/bdgtr.sqlite` with the empty ledger after you type `yes`.
|
|
6
6
|
|
|
7
|
-
Release from the
|
|
7
|
+
Release from the app root: `bin/release-cli`
|
data/bin/bdgtr
CHANGED
|
@@ -5,23 +5,18 @@ require "bdgtr_cli"
|
|
|
5
5
|
|
|
6
6
|
Bdgtr::Cli::GemHome.install!
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
command = ARGV[0].to_s
|
|
9
|
+
|
|
10
|
+
if %w[--version -v version].include?(command)
|
|
9
11
|
puts "bdgtr-cli #{Bdgtr::Version::VERSION}"
|
|
10
12
|
exit 0
|
|
11
13
|
end
|
|
12
14
|
|
|
13
|
-
if
|
|
15
|
+
if command == "ledger:reset"
|
|
14
16
|
Bdgtr::Cli::GemHome.reset_with_confirmation!
|
|
15
17
|
exit 0
|
|
16
18
|
end
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exit 1
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
ENV["BUNDLE_GEMFILE"] ||= File.join(root, "Gemfile")
|
|
25
|
-
ENV["BDGTR_ROOT"] ||= root
|
|
26
|
-
require File.join(root, "config/environment")
|
|
27
|
-
Bdgtr::Cli.start(ARGV)
|
|
20
|
+
warn "unknown command #{command}" unless command.empty? || %w[help --help -h].include?(command)
|
|
21
|
+
warn "bdgtr-cli #{Bdgtr::Version::VERSION}"
|
|
22
|
+
exit command.empty? || %w[help --help -h].include?(command) ? 0 : 1
|
data/data/bdgtr.sqlite
CHANGED
|
Binary file
|
data/lib/bdgtr/cli/gem_home.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "fileutils"
|
|
4
|
-
require "yaml"
|
|
5
4
|
|
|
6
5
|
module Bdgtr
|
|
7
6
|
class Cli
|
|
@@ -61,16 +60,6 @@ module Bdgtr
|
|
|
61
60
|
output.puts "Replaced #{path} with an empty ledger."
|
|
62
61
|
end
|
|
63
62
|
|
|
64
|
-
def app_root
|
|
65
|
-
env = ENV["BDGTR_ROOT"].to_s.strip
|
|
66
|
-
return env if rails_app?(env)
|
|
67
|
-
|
|
68
|
-
configured = config_root
|
|
69
|
-
return configured if rails_app?(configured)
|
|
70
|
-
|
|
71
|
-
nil
|
|
72
|
-
end
|
|
73
|
-
|
|
74
63
|
def blank_ledger_path
|
|
75
64
|
packaged("data/bdgtr.sqlite")
|
|
76
65
|
end
|
|
@@ -90,20 +79,6 @@ module Bdgtr
|
|
|
90
79
|
|
|
91
80
|
File.expand_path("../../../../lib/bdgtr/cli/config.sample.yml", __dir__) if File.file?(File.expand_path("../../../../lib/bdgtr/cli/config.sample.yml", __dir__))
|
|
92
81
|
end
|
|
93
|
-
|
|
94
|
-
def rails_app?(path)
|
|
95
|
-
!path.to_s.empty? && File.file?(File.join(path, "config/environment.rb"))
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def config_root
|
|
99
|
-
return unless File.file?(config_path)
|
|
100
|
-
|
|
101
|
-
data = YAML.safe_load_file(config_path, aliases: false) || {}
|
|
102
|
-
text = data.dig("bdgtr", "root").to_s.strip
|
|
103
|
-
return if text.empty?
|
|
104
|
-
|
|
105
|
-
File.expand_path(text)
|
|
106
|
-
end
|
|
107
82
|
end
|
|
108
83
|
end
|
|
109
84
|
end
|
data/lib/bdgtr/version.rb
CHANGED