appydave-tools 0.4.1 → 0.6.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/.rubocop.yml +1 -1
- data/CHANGELOG.md +15 -1
- data/bin/configuration.rb +53 -0
- data/lib/appydave/tools/configuration/_doc.md +1 -4
- data/lib/appydave/tools/configuration/config.rb +5 -8
- data/lib/appydave/tools/configuration/models/bank_reconciliation_config.rb +90 -0
- data/lib/appydave/tools/configuration/models/channels_config.rb +38 -3
- data/lib/appydave/tools/configuration/models/settings_config.rb +8 -0
- data/lib/appydave/tools/version.rb +1 -1
- data/lib/appydave/tools.rb +3 -3
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +3 -2
- data/lib/appydave/tools/configuration/models/channel_projects_config.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697361623a5f429c2a7c06047d5669c8a9fcf27ebfb2b7f15ebf6037a4f4e39f
|
4
|
+
data.tar.gz: a612fe3a884667a7961b3b1306758e405a8988afdddd06ec9f1550b6b50b92c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 055b7a37ab1651f8650635f5ea84b9b0df06c91600e92cad505255dd3ed2702c5113b837ddd68cf82d312621591c8a3a4d076db91111b30a0cf565c1c651278c
|
7
|
+
data.tar.gz: 6bbd3a0a492d0a8a55eee674fd2655b89e9f52953da0357d07cbaf938654009fb1ecf678fa8a432bf41f935001e37840cf92d3a5776f2c736092296e74caa19b
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [0.5.0](https://github.com/klueless-io/appydave-tools/compare/v0.4.1...v0.5.0) (2024-05-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add configuration support for bank_reconciliation tool ([cfd6909](https://github.com/klueless-io/appydave-tools/commit/cfd6909d7c1de4c1acd9b84aaea28c9c7a07cc3f))
|
7
|
+
|
8
|
+
## [0.4.1](https://github.com/klueless-io/appydave-tools/compare/v0.4.0...v0.4.1) (2024-05-26)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* move configuration models in to own namespace ([0a8dc48](https://github.com/klueless-io/appydave-tools/commit/0a8dc486c3f610a91dac1941bc986a1d5b05e24e))
|
14
|
+
|
1
15
|
# [0.4.0](https://github.com/klueless-io/appydave-tools/compare/v0.3.8...v0.4.0) (2024-05-26)
|
2
16
|
|
3
17
|
|
@@ -54,7 +68,7 @@
|
|
54
68
|
|
55
69
|
### Bug Fixes
|
56
70
|
|
57
|
-
* updating configuration with channels and
|
71
|
+
* updating configuration with channels and channel_folders ([d4f54aa](https://github.com/klueless-io/appydave-tools/commit/d4f54aa0f455f535b6e265f23e6fba123d099d26))
|
58
72
|
|
59
73
|
## [0.3.2](https://github.com/klueless-io/appydave-tools/compare/v0.3.1...v0.3.2) (2024-05-16)
|
60
74
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
5
|
+
|
6
|
+
require 'pry'
|
7
|
+
require 'appydave/tools'
|
8
|
+
|
9
|
+
options = {}
|
10
|
+
|
11
|
+
OptionParser.new do |opts|
|
12
|
+
opts.banner = 'Usage: config_tool.rb [options]'
|
13
|
+
|
14
|
+
opts.on('-e', '--edit', 'Edit configuration in Visual Studio Code') do
|
15
|
+
options[:command] = :edit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('-l', '--list', 'List all configurations') do
|
19
|
+
options[:command] = :list
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on('-c', '--create', 'Create missing configurations') do
|
23
|
+
options[:command] = :create
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-p', '--print', 'Print configuration details') do
|
27
|
+
options[:command] = :print
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
31
|
+
puts opts
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
end.parse!
|
35
|
+
|
36
|
+
case options[:command]
|
37
|
+
when :edit
|
38
|
+
Appydave::Tools::Configuration::Config.edit
|
39
|
+
when :list
|
40
|
+
Appydave::Tools::Configuration::Config.configure
|
41
|
+
configurations = Appydave::Tools::Configuration::Config.configurations.map do |name, config|
|
42
|
+
{ name: name, path: config.config_path, exists: File.exist?(config.config_path) }
|
43
|
+
end
|
44
|
+
tp configurations, :name, :exists, { config_path => { column_width: 150 } }
|
45
|
+
when :create
|
46
|
+
Appydave::Tools::Configuration::Config.configure
|
47
|
+
Appydave::Tools::Configuration::Config.save
|
48
|
+
when :print
|
49
|
+
Appydave::Tools::Configuration::Config.configure
|
50
|
+
Appydave::Tools::Configuration::Config.print
|
51
|
+
else
|
52
|
+
puts 'No valid command provided. Use --help for usage information.'
|
53
|
+
end
|
@@ -3,9 +3,6 @@
|
|
3
3
|
[ChatGPT conversation](https://chatgpt.com/g/g-4dMsIRK3E-ruby-script-assistant/c/d8ea5960-071b-48aa-9fd9-554ca302c7dd)
|
4
4
|
[ChatGPT conversation for Schema](https://chatgpt.com/c/bb93e7ac-f139-44f9-8b9c-4e74ac2fa461)
|
5
5
|
|
6
|
-
attr_accessor :code,
|
7
|
-
:narration
|
8
|
-
|
9
6
|
|
10
7
|
## Schema
|
11
8
|
|
@@ -39,7 +36,7 @@
|
|
39
36
|
}
|
40
37
|
```
|
41
38
|
|
42
|
-
### Channel
|
39
|
+
### Channel Folders Schema
|
43
40
|
|
44
41
|
- **content_projects**: Path to the shared folder for content creation (e.g., `"/user/Library/CloudStorage/Dropbox/team-appydave"`).
|
45
42
|
- **video_projects**: Path to the local storage folder for active video projects (e.g., `"/user/tube-channels/appy-dave/active"`).
|
@@ -63,6 +63,11 @@ module Appydave
|
|
63
63
|
configurations.each_value(&:debug)
|
64
64
|
end
|
65
65
|
|
66
|
+
def print
|
67
|
+
log.kv 'Configuration Path', config_path
|
68
|
+
configurations.each_value(&:print)
|
69
|
+
end
|
70
|
+
|
66
71
|
private
|
67
72
|
|
68
73
|
def ensure_config_directory
|
@@ -75,11 +80,3 @@ module Appydave
|
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
78
|
-
|
79
|
-
# Configuration example usage
|
80
|
-
# Appydave::Tools::Configuration::Config.configure do |config|
|
81
|
-
# config.config_path = File.expand_path('~/.config/appydave') # optional, as this is already the default
|
82
|
-
# # config.register(:settings, SettingsConfig)
|
83
|
-
# # config.register(:gpt_context, GptContextConfig)
|
84
|
-
# # Additional configurations can be registered as needed.
|
85
|
-
# end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appydave
|
4
|
+
module Tools
|
5
|
+
module Configuration
|
6
|
+
module Models
|
7
|
+
# Bank reconciliation configuration
|
8
|
+
class BankReconciliationConfig < ConfigBase
|
9
|
+
# Retrieve all bank accounts
|
10
|
+
def bank_accounts
|
11
|
+
data['bank_accounts'].map do |account|
|
12
|
+
BankAccount.new(account)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def chart_of_accounts
|
17
|
+
data['chart_of_accounts'].map do |entry|
|
18
|
+
ChartOfAccount.new(entry)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_bank_account(account_number, bsb = nil)
|
23
|
+
account_data = data['bank_accounts'].find do |account|
|
24
|
+
account['account_number'] == account_number && (account['bsb'].nil? || account['bsb'] == bsb)
|
25
|
+
end
|
26
|
+
|
27
|
+
BankAccount.new(account_data) if account_data
|
28
|
+
end
|
29
|
+
|
30
|
+
# Retrieve a chart of account entry by code
|
31
|
+
def get_chart_of_account(code)
|
32
|
+
entry_data = data['chart_of_accounts'].find { |entry| entry['code'] == code }
|
33
|
+
ChartOfAccount.new(entry_data) if entry_data
|
34
|
+
end
|
35
|
+
|
36
|
+
def print
|
37
|
+
log.heading 'Bank Reconciliation Configuration'
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def default_data
|
43
|
+
{
|
44
|
+
'bank_accounts' => [],
|
45
|
+
'chart_of_accounts' => []
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Inner class to represent a bank account
|
50
|
+
class BankAccount
|
51
|
+
attr_accessor :account_number, :bsb, :name, :bank
|
52
|
+
|
53
|
+
def initialize(data)
|
54
|
+
@account_number = data['account_number']
|
55
|
+
@bsb = data['bsb']
|
56
|
+
@name = data['name']
|
57
|
+
@bank = data['bank']
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_h
|
61
|
+
{
|
62
|
+
'account_number' => @account_number,
|
63
|
+
'bsb' => @bsb,
|
64
|
+
'name' => @name,
|
65
|
+
'bank' => @bank
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Inner class to represent a chart of account entry
|
71
|
+
class ChartOfAccount
|
72
|
+
attr_accessor :code, :narration
|
73
|
+
|
74
|
+
def initialize(data)
|
75
|
+
@code = data['code']
|
76
|
+
@narration = data['narration']
|
77
|
+
end
|
78
|
+
|
79
|
+
def to_h
|
80
|
+
{
|
81
|
+
'code' => @code,
|
82
|
+
'narration' => @narration
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -36,6 +36,12 @@ module Appydave
|
|
36
36
|
data['channels'].values.any? { |info| info['code'] == code }
|
37
37
|
end
|
38
38
|
|
39
|
+
def print
|
40
|
+
log.heading 'Channel Configuration'
|
41
|
+
|
42
|
+
tp channels, :key, :code, :name, :youtube_handle
|
43
|
+
end
|
44
|
+
|
39
45
|
private
|
40
46
|
|
41
47
|
def default_data
|
@@ -46,26 +52,55 @@ module Appydave
|
|
46
52
|
{
|
47
53
|
'code' => '',
|
48
54
|
'name' => '',
|
49
|
-
'youtube_handle' => ''
|
55
|
+
'youtube_handle' => '',
|
56
|
+
'locations' => {
|
57
|
+
'content_projects' => '',
|
58
|
+
'video_projects' => '',
|
59
|
+
'published_projects' => '',
|
60
|
+
'abandoned_projects' => ''
|
61
|
+
}
|
50
62
|
}
|
51
63
|
end
|
52
64
|
|
53
65
|
# Type-safe class to access channel properties
|
54
66
|
class ChannelInfo
|
55
|
-
attr_accessor :key, :code, :name, :youtube_handle
|
67
|
+
attr_accessor :key, :code, :name, :youtube_handle, :locations
|
56
68
|
|
57
69
|
def initialize(key, data)
|
58
70
|
@key = key
|
59
71
|
@code = data['code']
|
60
72
|
@name = data['name']
|
61
73
|
@youtube_handle = data['youtube_handle']
|
74
|
+
@locations = ChannelLocation.new(data['locations'] || {})
|
62
75
|
end
|
63
76
|
|
64
77
|
def to_h
|
65
78
|
{
|
66
79
|
'code' => @code,
|
67
80
|
'name' => @name,
|
68
|
-
'youtube_handle' => @youtube_handle
|
81
|
+
'youtube_handle' => @youtube_handle,
|
82
|
+
'locations' => locations.to_h
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Type-safe class to access channel location properties
|
88
|
+
class ChannelLocation
|
89
|
+
attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
|
90
|
+
|
91
|
+
def initialize(data)
|
92
|
+
@content_projects = data['content_projects']
|
93
|
+
@video_projects = data['video_projects']
|
94
|
+
@published_projects = data['published_projects']
|
95
|
+
@abandoned_projects = data['abandoned_projects']
|
96
|
+
end
|
97
|
+
|
98
|
+
def to_h
|
99
|
+
{
|
100
|
+
'content_projects' => @content_projects,
|
101
|
+
'video_projects' => @video_projects,
|
102
|
+
'published_projects' => @published_projects,
|
103
|
+
'abandoned_projects' => @abandoned_projects
|
69
104
|
}
|
70
105
|
end
|
71
106
|
end
|
@@ -27,6 +27,14 @@ module Appydave
|
|
27
27
|
def download_image_folder
|
28
28
|
get('download-image-folder') || download_folder
|
29
29
|
end
|
30
|
+
|
31
|
+
def print
|
32
|
+
log.subheading 'Settings Configuration'
|
33
|
+
|
34
|
+
data.each do |key, value|
|
35
|
+
log.kv key, value
|
36
|
+
end
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
32
40
|
end
|
data/lib/appydave/tools.rb
CHANGED
@@ -16,15 +16,15 @@ require 'appydave/tools/configuration/configurable'
|
|
16
16
|
require 'appydave/tools/configuration/config'
|
17
17
|
require 'appydave/tools/configuration/models/config_base'
|
18
18
|
require 'appydave/tools/configuration/models/settings_config'
|
19
|
-
require 'appydave/tools/configuration/models/
|
19
|
+
require 'appydave/tools/configuration/models/bank_reconciliation_config'
|
20
20
|
require 'appydave/tools/configuration/models/channels_config'
|
21
21
|
require 'appydave/tools/name_manager/project_name'
|
22
22
|
|
23
23
|
Appydave::Tools::Configuration::Config.set_default do |config|
|
24
24
|
config.config_path = File.expand_path('~/.config/appydave')
|
25
25
|
config.register(:settings, Appydave::Tools::Configuration::Models::SettingsConfig)
|
26
|
-
config.register(:
|
27
|
-
config.register(:
|
26
|
+
config.register(:bank_reconciliation, Appydave::Tools::Configuration::Models::BankReconciliationConfig)
|
27
|
+
config.register(:channels, Appydave::Tools::Configuration::Models::ChannelsConfig)
|
28
28
|
end
|
29
29
|
|
30
30
|
module Appydave
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "appydave-tools",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.6.0",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "appydave-tools",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.6.0",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.3",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appydave-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- LICENSE.txt
|
87
87
|
- README.md
|
88
88
|
- Rakefile
|
89
|
+
- bin/configuration.rb
|
89
90
|
- bin/console
|
90
91
|
- bin/gpt_context.rb
|
91
92
|
- bin/setup
|
@@ -94,7 +95,7 @@ files:
|
|
94
95
|
- lib/appydave/tools/configuration/_doc.md
|
95
96
|
- lib/appydave/tools/configuration/config.rb
|
96
97
|
- lib/appydave/tools/configuration/configurable.rb
|
97
|
-
- lib/appydave/tools/configuration/models/
|
98
|
+
- lib/appydave/tools/configuration/models/bank_reconciliation_config.rb
|
98
99
|
- lib/appydave/tools/configuration/models/channels_config.rb
|
99
100
|
- lib/appydave/tools/configuration/models/config_base.rb
|
100
101
|
- lib/appydave/tools/configuration/models/settings_config copy.xrb
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appydave
|
4
|
-
module Tools
|
5
|
-
module Configuration
|
6
|
-
module Models
|
7
|
-
# Channel projects configuration
|
8
|
-
class ChannelProjectsConfig < ConfigBase
|
9
|
-
# Retrieve channel information by channel name (string or symbol)
|
10
|
-
def get_channel_info(channel_name)
|
11
|
-
channel_name = channel_name.to_s
|
12
|
-
ChannelInfo.new(data['channel_projects'][channel_name] || default_channel_info)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Set channel information
|
16
|
-
def set_channel_info(channel_name, channel_info)
|
17
|
-
data['channel_projects'] ||= {}
|
18
|
-
data['channel_projects'][channel_name.to_s] = channel_info.to_h
|
19
|
-
end
|
20
|
-
|
21
|
-
# Retrieve a list of all channel projects
|
22
|
-
def channel_projects
|
23
|
-
data['channel_projects'].map do |_name, info|
|
24
|
-
ChannelInfo.new(info)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def default_data
|
31
|
-
{ 'channel_projects' => {} }
|
32
|
-
end
|
33
|
-
|
34
|
-
def default_channel_info
|
35
|
-
{
|
36
|
-
'content_projects' => '',
|
37
|
-
'video_projects' => '',
|
38
|
-
'published_projects' => '',
|
39
|
-
'abandoned_projects' => ''
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# Type-safe class to access channel info properties
|
44
|
-
class ChannelInfo
|
45
|
-
attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
|
46
|
-
|
47
|
-
def initialize(data)
|
48
|
-
@content_projects = data['content_projects']
|
49
|
-
@video_projects = data['video_projects']
|
50
|
-
@published_projects = data['published_projects']
|
51
|
-
@abandoned_projects = data['abandoned_projects']
|
52
|
-
end
|
53
|
-
|
54
|
-
def to_h
|
55
|
-
{
|
56
|
-
'content_projects' => @content_projects,
|
57
|
-
'video_projects' => @video_projects,
|
58
|
-
'published_projects' => @published_projects,
|
59
|
-
'abandoned_projects' => @abandoned_projects
|
60
|
-
}
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|