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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20569023fb9af1020141d0441447f5a5a590e0296cd975cd14962f173ddc4d7c
4
- data.tar.gz: d5929692daa4c73f203d75ffa2c221e4620640648a695412acbc9669d933a923
3
+ metadata.gz: e3b14aafd13b319d5d6ebd1f0f2d2b33006913d90280a681b35d43ede253ba54
4
+ data.tar.gz: 6e28475797d841adb890ca7d7b603191f7c7e44337add49291fb5d57210da016
5
5
  SHA512:
6
- metadata.gz: 45f1a71a7b9f6dd0240fc2fd9aec733a763312199e674a8c3fafb91275e60d76a34a3e2f713c4e64527e828776db3fd6f83364af86db63ab935652490325ed42
7
- data.tar.gz: 8883bee82f9d4f97f636dac4f43e65e6d0dee80be058df668f9587c2e8376b35c2eede6a1efa36c40a141b3ec3af1d538edc70188940f952070997ea9c75fd71
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. The gem keeps `~/.bdgtr/config.yml` and `~/.bdgtr/bdgtr.sqlite`. Installing the gem creates both when they are missing, and leaves an existing ledger file in place.
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
- Account, transaction, and ledger commands load the Rails app from `BDGTR_ROOT` or from `bdgtr.root` in the config file.
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 Rails app root: `bin/release-cli`
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
- if %w[--version -v].include?(ARGV[0]) && defined?(Bdgtr::Version)
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 ARGV[0] == "ledger:reset"
15
+ if command == "ledger:reset"
14
16
  Bdgtr::Cli::GemHome.reset_with_confirmation!
15
17
  exit 0
16
18
  end
17
19
 
18
- root = Bdgtr::Cli::GemHome.app_root
19
- unless root
20
- warn "Set BDGTR_ROOT, or bdgtr.root in #{Bdgtr::Cli::GemHome.config_path}, to the bdgtr app."
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
@@ -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
@@ -3,7 +3,7 @@
3
3
  module Bdgtr
4
4
  # Kept for Zeitwerk (`lib/bdgtr/version.rb` → Bdgtr::Version).
5
5
  module Version
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2"
7
7
 
8
8
  def self.to_s
9
9
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bdgtr-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Molinari