appydave-tools 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38e915f4af00415a837d3951bf3b678b881617d820c57cf0842caf1751c272c0
4
- data.tar.gz: 3ec4f4c1093872fd73fe77fa7758ab8ae0926f80c180fc29a6ca0715a26529a2
3
+ metadata.gz: 2822e09cd6989d2fc8576f8d6b842e6ad40429d9931ae6bbdb557d4bb3a2991c
4
+ data.tar.gz: 4a9bc9044bcde2bd179a66349b5544430fb9fc8cb1a7b7a656fc5ed3ba8bd405
5
5
  SHA512:
6
- metadata.gz: '08f2ed9f573f47a57b19ff3b26c1f141ec42bd4965062fa5b53953a493fb6aaea57b4480c3dc3a53fe920ed24ecf6addbd217ad731adedb0f1d5b32cdec034fd'
7
- data.tar.gz: 26c0225c9185ccca543d3afa56b338bedeb88149989ed4b3e1440e9a9afbf234511401330d5b5d30b955f223382c2b34d724dbb103de0e092cda5023cc48ed17
6
+ metadata.gz: 4c619668264809fc3be5b5bab73f360dc0480b7dde5b9e232e336edd62a3f416110dbf59ba705174b6b5f8f158819b01817ccacbb123498ad2e17af1330bcaef
7
+ data.tar.gz: 4f4c8c4ffbce01ac24a7860939b13f403e9e729d75cb3d7bd68e17a9c37580f2605db3b9667ab4f43a5236ff5803639721ce2452580884c2fe23a3414f031fd9
data/.rubocop.yml CHANGED
@@ -105,7 +105,7 @@ RSpec/NamedSubject:
105
105
  - "**/spec/**/*"
106
106
 
107
107
  RSpec/MultipleExpectations:
108
- Max: 5
108
+ Max: 8
109
109
 
110
110
  RSpec/NestedGroups:
111
111
  Max: 8
@@ -115,3 +115,6 @@ RSpec/DescribeClass:
115
115
 
116
116
  RSpec/PendingWithoutReason:
117
117
  Enabled: false
118
+
119
+ Metrics/AbcSize:
120
+ Max: 25
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.6.0](https://github.com/klueless-io/appydave-tools/compare/v0.5.0...v0.6.0) (2024-05-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * refactor channels with locations, removed channel projects ([6b64574](https://github.com/klueless-io/appydave-tools/commit/6b645742b0029a001792c8d405dcae0b1036f2c0))
7
+
8
+ # [0.5.0](https://github.com/klueless-io/appydave-tools/compare/v0.4.1...v0.5.0) (2024-05-26)
9
+
10
+
11
+ ### Features
12
+
13
+ * add configuration support for bank_reconciliation tool ([cfd6909](https://github.com/klueless-io/appydave-tools/commit/cfd6909d7c1de4c1acd9b84aaea28c9c7a07cc3f))
14
+
1
15
  ## [0.4.1](https://github.com/klueless-io/appydave-tools/compare/v0.4.0...v0.4.1) (2024-05-26)
2
16
 
3
17
 
@@ -61,7 +75,7 @@
61
75
 
62
76
  ### Bug Fixes
63
77
 
64
- * updating configuration with channels and channel_projects ([d4f54aa](https://github.com/klueless-io/appydave-tools/commit/d4f54aa0f455f535b6e265f23e6fba123d099d26))
78
+ * updating configuration with channels and channel_folders ([d4f54aa](https://github.com/klueless-io/appydave-tools/commit/d4f54aa0f455f535b6e265f23e6fba123d099d26))
65
79
 
66
80
  ## [0.3.2](https://github.com/klueless-io/appydave-tools/compare/v0.3.1...v0.3.2) (2024-05-16)
67
81
 
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Example of a simple command line tool to manage configuration files
5
+ # ad_config -p settings,channels
6
+ # ad_config -p
7
+ # ad_config -l
8
+ # ad_config -c
9
+ # ad_config -e
10
+
11
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
12
+
13
+ require 'pry'
14
+ require 'appydave/tools'
15
+
16
+ options = { keys: [] }
17
+
18
+ OptionParser.new do |opts|
19
+ opts.banner = 'Usage: config_tool.rb [options]'
20
+
21
+ opts.on('-e', '--edit', 'Edit configuration in Visual Studio Code') do
22
+ options[:command] = :edit
23
+ end
24
+
25
+ opts.on('-l', '--list', 'List all configurations') do
26
+ options[:command] = :list
27
+ end
28
+
29
+ opts.on('-c', '--create', 'Create missing configurations') do
30
+ options[:command] = :create
31
+ end
32
+
33
+ opts.on('-p', '--print [KEYS]', Array, 'Print configuration details for specified keys') do |keys|
34
+ options[:command] = :print
35
+ options[:keys] = keys
36
+ end
37
+
38
+ opts.on_tail('-h', '--help', 'Show this message') do
39
+ puts opts
40
+ exit
41
+ end
42
+ end.parse!
43
+
44
+ case options[:command]
45
+ when :edit
46
+ Appydave::Tools::Configuration::Config.edit
47
+ when :list
48
+ Appydave::Tools::Configuration::Config.configure
49
+ configurations = Appydave::Tools::Configuration::Config.configurations.map do |name, config|
50
+ { name: name, path: config.config_path, exists: File.exist?(config.config_path) }
51
+ end
52
+ tp configurations, :name, :exists, { path: { width: 150 } }
53
+ when :create
54
+ Appydave::Tools::Configuration::Config.configure
55
+ Appydave::Tools::Configuration::Config.save
56
+ when :print
57
+ Appydave::Tools::Configuration::Config.configure
58
+ Appydave::Tools::Configuration::Config.print(*options[:keys])
59
+ else
60
+ puts 'No valid command provided. Use --help for usage information.'
61
+ 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 Projects Schema
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,27 @@ 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
+
71
+ def print(*keys)
72
+ if keys.empty?
73
+ keys = configurations.keys
74
+ else
75
+ keys.map!(&:to_sym)
76
+ end
77
+
78
+ keys.each do |key|
79
+ if configurations[key]
80
+ configurations[key].print
81
+ else
82
+ log.error "Configuration not available: #{key}"
83
+ end
84
+ end
85
+ end
86
+
66
87
  private
67
88
 
68
89
  def ensure_config_directory
@@ -75,11 +96,3 @@ module Appydave
75
96
  end
76
97
  end
77
98
  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
@@ -33,6 +33,16 @@ module Appydave
33
33
  ChartOfAccount.new(entry_data) if entry_data
34
34
  end
35
35
 
36
+ def print
37
+ log.subheading 'Bank Reconciliation - Accounts'
38
+
39
+ tp bank_accounts, :account_number, :bsb, :name, :bank
40
+
41
+ log.subheading 'Bank Reconciliation - Chart of Accounts'
42
+
43
+ tp chart_of_accounts, :code, :narration
44
+ end
45
+
36
46
  private
37
47
 
38
48
  def default_data
@@ -36,8 +36,33 @@ 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
+ print_channels = channels.map do |channel|
43
+ {
44
+ key: channel.key,
45
+ code: channel.code,
46
+ name: channel.name,
47
+ youtube_handle: channel.youtube_handle,
48
+ content_projects: print_location(channel.locations.content_projects),
49
+ video_projects: print_location(channel.locations.video_projects),
50
+ published_projects: print_location(channel.locations.published_projects),
51
+ abandoned_projects: print_location(channel.locations.abandoned_projects)
52
+ }
53
+ end
54
+
55
+ tp print_channels, :key, :code, :name, :youtube_handle, :content_projects, :video_projects, :published_projects, :abandoned_projects
56
+ end
57
+
39
58
  private
40
59
 
60
+ def print_location(location)
61
+ return 'Not Set' unless location
62
+
63
+ File.exist?(location) ? 'TRUE' : 'false'
64
+ end
65
+
41
66
  def default_data
42
67
  { 'channels' => {} }
43
68
  end
@@ -46,26 +71,55 @@ module Appydave
46
71
  {
47
72
  'code' => '',
48
73
  'name' => '',
49
- 'youtube_handle' => ''
74
+ 'youtube_handle' => '',
75
+ 'locations' => {
76
+ 'content_projects' => '',
77
+ 'video_projects' => '',
78
+ 'published_projects' => '',
79
+ 'abandoned_projects' => ''
80
+ }
50
81
  }
51
82
  end
52
83
 
53
84
  # Type-safe class to access channel properties
54
85
  class ChannelInfo
55
- attr_accessor :key, :code, :name, :youtube_handle
86
+ attr_accessor :key, :code, :name, :youtube_handle, :locations
56
87
 
57
88
  def initialize(key, data)
58
89
  @key = key
59
90
  @code = data['code']
60
91
  @name = data['name']
61
92
  @youtube_handle = data['youtube_handle']
93
+ @locations = ChannelLocation.new(data['locations'] || {})
62
94
  end
63
95
 
64
96
  def to_h
65
97
  {
66
98
  'code' => @code,
67
99
  'name' => @name,
68
- 'youtube_handle' => @youtube_handle
100
+ 'youtube_handle' => @youtube_handle,
101
+ 'locations' => locations.to_h
102
+ }
103
+ end
104
+ end
105
+
106
+ # Type-safe class to access channel location properties
107
+ class ChannelLocation
108
+ attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
109
+
110
+ def initialize(data)
111
+ @content_projects = data['content_projects']
112
+ @video_projects = data['video_projects']
113
+ @published_projects = data['published_projects']
114
+ @abandoned_projects = data['abandoned_projects']
115
+ end
116
+
117
+ def to_h
118
+ {
119
+ 'content_projects' => @content_projects,
120
+ 'video_projects' => @video_projects,
121
+ 'published_projects' => @published_projects,
122
+ 'abandoned_projects' => @abandoned_projects
69
123
  }
70
124
  end
71
125
  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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.1'
6
6
  end
7
7
  end
@@ -17,7 +17,6 @@ require 'appydave/tools/configuration/config'
17
17
  require 'appydave/tools/configuration/models/config_base'
18
18
  require 'appydave/tools/configuration/models/settings_config'
19
19
  require 'appydave/tools/configuration/models/bank_reconciliation_config'
20
- require 'appydave/tools/configuration/models/channel_projects_config'
21
20
  require 'appydave/tools/configuration/models/channels_config'
22
21
  require 'appydave/tools/name_manager/project_name'
23
22
 
@@ -25,8 +24,7 @@ Appydave::Tools::Configuration::Config.set_default do |config|
25
24
  config.config_path = File.expand_path('~/.config/appydave')
26
25
  config.register(:settings, Appydave::Tools::Configuration::Models::SettingsConfig)
27
26
  config.register(:bank_reconciliation, Appydave::Tools::Configuration::Models::BankReconciliationConfig)
28
- config.register(:channels, Appydave::Tools::Configuration::ChannelsConfig)
29
- config.register(:channel_projects, Appydave::Tools::Configuration::ChannelProjectsConfig)
27
+ config.register(:channels, Appydave::Tools::Configuration::Models::ChannelsConfig)
30
28
  end
31
29
 
32
30
  module Appydave
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appydave-tools",
9
- "version": "0.5.0",
9
+ "version": "0.6.1",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.5.0
4
+ version: 0.6.1
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
@@ -95,7 +96,6 @@ files:
95
96
  - lib/appydave/tools/configuration/config.rb
96
97
  - lib/appydave/tools/configuration/configurable.rb
97
98
  - lib/appydave/tools/configuration/models/bank_reconciliation_config.rb
98
- - lib/appydave/tools/configuration/models/channel_projects_config.rb
99
99
  - lib/appydave/tools/configuration/models/channels_config.rb
100
100
  - lib/appydave/tools/configuration/models/config_base.rb
101
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