appydave-tools 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 460c13d4f34c24b621d28cd677bc2682a7e402b6829e668148532e3745c2f1d2
4
- data.tar.gz: 3fb21998fd595b476dde7a89e85b5db1454eebe9e8f9116e68a59f7e10879611
3
+ metadata.gz: adaf87989c7386fc11d7e2b29a9578b7920a913232e606169b67406f0ddb819a
4
+ data.tar.gz: af6c9502a2b8a66bbe26a0f483109f417c168eeb8c26d8805549e439dff0d437
5
5
  SHA512:
6
- metadata.gz: c6b483e278c8550a21caffe2aa7a41dc09662e86bff1676713a98102b118bae09765162b22e5ecdcaa63b4182e6ed523b0b65d533146d89f46cc31af77bf86ef
7
- data.tar.gz: 47c6de40aa8f3fe86acc72d137cae0218e6b6f1d269b62853a73b3f72a20a0a85bd0cbe63218105e667e74249d0eb1168c135d0a7a46db19f9dc35d7a6708d38
6
+ metadata.gz: 6334c9279ca5e2f6fd5cf1de4973470dd4dfb2e74e5346e0b0f86a9b1a7fb5594940236e22785123887e6df03a2f009feb677ebb975be3f59606522f23ea1ac0
7
+ data.tar.gz: 5856609b0464a50f23e1ab700a8995ff86cde4f00dc4c75b9fd81f13d0dfd5dc89cac09c04d72f4026e888bd884009156bb110e1e5bf0e41510ee81dd0b5d54f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.4.0](https://github.com/klueless-io/appydave-tools/compare/v0.3.8...v0.4.0) (2024-05-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove from ci for now ([e4c9e22](https://github.com/klueless-io/appydave-tools/commit/e4c9e225e6fe35a00a7b4d83ff9f2795da737589))
7
+ * remove from ci for now ([30a114c](https://github.com/klueless-io/appydave-tools/commit/30a114c7cd0085ab92aeb906e1962ca3618631e8))
8
+ * remove from ci for now ([7062c3d](https://github.com/klueless-io/appydave-tools/commit/7062c3d69634ab281107b755533f3332b708eb56))
9
+
10
+
11
+ ### Features
12
+
13
+ * Add line limit option and update default format handling ([a0eb426](https://github.com/klueless-io/appydave-tools/commit/a0eb426329ee2a997081cf1a5c219c05d07ff824))
14
+
1
15
  ## [0.3.8](https://github.com/klueless-io/appydave-tools/compare/v0.3.7...v0.3.8) (2024-05-25)
2
16
 
3
17
 
@@ -1,7 +1,11 @@
1
1
  # Configuration Component
2
2
 
3
3
  [ChatGPT conversation](https://chatgpt.com/g/g-4dMsIRK3E-ruby-script-assistant/c/d8ea5960-071b-48aa-9fd9-554ca302c7dd)
4
- [ChatGPT confersation for Schema](https://chatgpt.com/c/bb93e7ac-f139-44f9-8b9c-4e74ac2fa461)
4
+ [ChatGPT conversation for Schema](https://chatgpt.com/c/bb93e7ac-f139-44f9-8b9c-4e74ac2fa461)
5
+
6
+ attr_accessor :code,
7
+ :narration
8
+
5
9
 
6
10
  ## Schema
7
11
 
@@ -29,6 +29,7 @@ module Appydave
29
29
  end
30
30
 
31
31
  def method_missing(method_name, *_args)
32
+ raise Appydave::Tools::Error, 'Configuration has never been registered' if @configurations.nil?
32
33
  raise Appydave::Tools::Error, "Configuration not available: #{method_name}" unless @configurations.key?(method_name)
33
34
 
34
35
  @configurations[method_name]
@@ -0,0 +1,67 @@
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
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module Configuration
6
+ module Models
7
+ # Channels configuration
8
+ class ChannelsConfig < ConfigBase
9
+ # Retrieve channel information by channel code (string or symbol)
10
+ def get_channel(channel_key)
11
+ channel_key = channel_key.to_s
12
+ info = data['channels'][channel_key] || default_channel_info
13
+ ChannelInfo.new(channel_key, info)
14
+ end
15
+
16
+ # Set channel information
17
+ def set_channel(channel_key, channel_info)
18
+ data['channels'] ||= {}
19
+ data['channels'][channel_key.to_s] = channel_info.to_h
20
+ end
21
+
22
+ # Retrieve a list of all channels
23
+ def channels
24
+ data['channels'].map do |key, info|
25
+ ChannelInfo.new(key, info)
26
+ end
27
+ end
28
+
29
+ def key?(key)
30
+ key = key.to_s
31
+ data['channels'].key?(key)
32
+ end
33
+
34
+ def code?(code)
35
+ code = code.to_s
36
+ data['channels'].values.any? { |info| info['code'] == code }
37
+ end
38
+
39
+ private
40
+
41
+ def default_data
42
+ { 'channels' => {} }
43
+ end
44
+
45
+ def default_channel_info
46
+ {
47
+ 'code' => '',
48
+ 'name' => '',
49
+ 'youtube_handle' => ''
50
+ }
51
+ end
52
+
53
+ # Type-safe class to access channel properties
54
+ class ChannelInfo
55
+ attr_accessor :key, :code, :name, :youtube_handle
56
+
57
+ def initialize(key, data)
58
+ @key = key
59
+ @code = data['code']
60
+ @name = data['name']
61
+ @youtube_handle = data['youtube_handle']
62
+ end
63
+
64
+ def to_h
65
+ {
66
+ 'code' => @code,
67
+ 'name' => @name,
68
+ 'youtube_handle' => @youtube_handle
69
+ }
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'fileutils'
5
+
6
+ module Appydave
7
+ module Tools
8
+ module Configuration
9
+ module Models
10
+ # Base class for handling common configuration tasks
11
+ class ConfigBase
12
+ include KLog::Logging
13
+
14
+ attr_reader :config_path, :data
15
+
16
+ def initialize
17
+ @config_path = File.join(Config.config_path, "#{config_name}.json")
18
+ @data = load
19
+ end
20
+
21
+ def save
22
+ File.write(config_path, JSON.pretty_generate(data))
23
+ end
24
+
25
+ def load
26
+ return JSON.parse(File.read(config_path)) if File.exist?(config_path)
27
+
28
+ default_data
29
+ rescue JSON::ParserError
30
+ # log.exception e
31
+ default_data
32
+ end
33
+
34
+ def name
35
+ self.class.name.split('::')[-1].gsub(/Config$/, '')
36
+ end
37
+
38
+ def config_name
39
+ name.gsub(/([a-z])([A-Z])/, '\1-\2').downcase
40
+ end
41
+
42
+ def debug
43
+ log.kv 'Config', name
44
+ log.kv 'Path', config_path
45
+
46
+ log.json data
47
+ end
48
+
49
+ private
50
+
51
+ def default_data
52
+ {}
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module Configuration
6
+ module Models
7
+ # Global settings that can be referenced by other configurations or tools
8
+ class SettingsConfig < ConfigBase
9
+ def set(key, value)
10
+ data[key] = value
11
+ end
12
+
13
+ def get(key, default = nil)
14
+ data.fetch(key, default)
15
+ end
16
+
17
+ # Well known settings
18
+
19
+ def ecamm_recording_folder
20
+ get('ecamm-recording-folder')
21
+ end
22
+
23
+ def download_folder
24
+ get('download-folder')
25
+ end
26
+
27
+ def download_image_folder
28
+ get('download-image-folder') || download_folder
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
@@ -13,16 +13,16 @@ require 'appydave/tools/gpt_context/file_collector'
13
13
 
14
14
  require 'appydave/tools/configuration/openai'
15
15
  require 'appydave/tools/configuration/configurable'
16
- require 'appydave/tools/configuration/config_base'
17
16
  require 'appydave/tools/configuration/config'
18
- require 'appydave/tools/configuration/settings_config'
19
- require 'appydave/tools/configuration/channel_projects_config'
20
- require 'appydave/tools/configuration/channels_config'
17
+ require 'appydave/tools/configuration/models/config_base'
18
+ require 'appydave/tools/configuration/models/settings_config'
19
+ require 'appydave/tools/configuration/models/channel_projects_config'
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
- config.register(:settings, Appydave::Tools::Configuration::SettingsConfig)
25
+ config.register(:settings, Appydave::Tools::Configuration::Models::SettingsConfig)
26
26
  config.register(:channels, Appydave::Tools::Configuration::ChannelsConfig)
27
27
  config.register(:channel_projects, Appydave::Tools::Configuration::ChannelProjectsConfig)
28
28
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appydave-tools",
9
- "version": "0.4.0",
9
+ "version": "0.4.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.4.0",
3
+ "version": "0.4.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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -92,14 +92,14 @@ files:
92
92
  - images.log
93
93
  - lib/appydave/tools.rb
94
94
  - lib/appydave/tools/configuration/_doc.md
95
- - lib/appydave/tools/configuration/channel_projects_config.rb
96
- - lib/appydave/tools/configuration/channels_config.rb
97
95
  - lib/appydave/tools/configuration/config.rb
98
- - lib/appydave/tools/configuration/config_base.rb
99
96
  - lib/appydave/tools/configuration/configurable.rb
97
+ - lib/appydave/tools/configuration/models/channel_projects_config.rb
98
+ - lib/appydave/tools/configuration/models/channels_config.rb
99
+ - lib/appydave/tools/configuration/models/config_base.rb
100
+ - lib/appydave/tools/configuration/models/settings_config copy.xrb
101
+ - lib/appydave/tools/configuration/models/settings_config.rb
100
102
  - lib/appydave/tools/configuration/openai.rb
101
- - lib/appydave/tools/configuration/settings_config copy.xrb
102
- - lib/appydave/tools/configuration/settings_config.rb
103
103
  - lib/appydave/tools/gpt_context/_doc.md
104
104
  - lib/appydave/tools/gpt_context/file_collector.rb
105
105
  - lib/appydave/tools/name_manager/_doc.md
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Appydave
4
- module Tools
5
- module Configuration
6
- # Channel projects configuration
7
- class ChannelProjectsConfig < ConfigBase
8
- # Retrieve channel information by channel name (string or symbol)
9
- def get_channel_info(channel_name)
10
- channel_name = channel_name.to_s
11
- ChannelInfo.new(data['channel_projects'][channel_name] || default_channel_info)
12
- end
13
-
14
- # Set channel information
15
- def set_channel_info(channel_name, channel_info)
16
- data['channel_projects'] ||= {}
17
- data['channel_projects'][channel_name.to_s] = channel_info.to_h
18
- end
19
-
20
- # Retrieve a list of all channel projects
21
- def channel_projects
22
- data['channel_projects'].map do |_name, info|
23
- ChannelInfo.new(info)
24
- end
25
- end
26
-
27
- private
28
-
29
- def default_data
30
- { 'channel_projects' => {} }
31
- end
32
-
33
- def default_channel_info
34
- {
35
- 'content_projects' => '',
36
- 'video_projects' => '',
37
- 'published_projects' => '',
38
- 'abandoned_projects' => ''
39
- }
40
- end
41
-
42
- # Type-safe class to access channel info properties
43
- class ChannelInfo
44
- attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
45
-
46
- def initialize(data)
47
- @content_projects = data['content_projects']
48
- @video_projects = data['video_projects']
49
- @published_projects = data['published_projects']
50
- @abandoned_projects = data['abandoned_projects']
51
- end
52
-
53
- def to_h
54
- {
55
- 'content_projects' => @content_projects,
56
- 'video_projects' => @video_projects,
57
- 'published_projects' => @published_projects,
58
- 'abandoned_projects' => @abandoned_projects
59
- }
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Appydave
4
- module Tools
5
- module Configuration
6
- # Channels configuration
7
- class ChannelsConfig < ConfigBase
8
- # Retrieve channel information by channel code (string or symbol)
9
- def get_channel(channel_key)
10
- channel_key = channel_key.to_s
11
- info = data['channels'][channel_key] || default_channel_info
12
- ChannelInfo.new(channel_key, info)
13
- end
14
-
15
- # Set channel information
16
- def set_channel(channel_key, channel_info)
17
- data['channels'] ||= {}
18
- data['channels'][channel_key.to_s] = channel_info.to_h
19
- end
20
-
21
- # Retrieve a list of all channels
22
- def channels
23
- data['channels'].map do |key, info|
24
- ChannelInfo.new(key, info)
25
- end
26
- end
27
-
28
- def key?(key)
29
- key = key.to_s
30
- data['channels'].key?(key)
31
- end
32
-
33
- def code?(code)
34
- code = code.to_s
35
- data['channels'].values.any? { |info| info['code'] == code }
36
- end
37
-
38
- private
39
-
40
- def default_data
41
- { 'channels' => {} }
42
- end
43
-
44
- def default_channel_info
45
- {
46
- 'code' => '',
47
- 'name' => '',
48
- 'youtube_handle' => ''
49
- }
50
- end
51
-
52
- # Type-safe class to access channel properties
53
- class ChannelInfo
54
- attr_accessor :key, :code, :name, :youtube_handle
55
-
56
- def initialize(key, data)
57
- @key = key
58
- @code = data['code']
59
- @name = data['name']
60
- @youtube_handle = data['youtube_handle']
61
- end
62
-
63
- def to_h
64
- {
65
- 'code' => @code,
66
- 'name' => @name,
67
- 'youtube_handle' => @youtube_handle
68
- }
69
- end
70
- end
71
- end
72
- end
73
- end
74
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
- require 'fileutils'
5
-
6
- module Appydave
7
- module Tools
8
- module Configuration
9
- # Base class for handling common configuration tasks
10
- class ConfigBase
11
- include KLog::Logging
12
-
13
- attr_reader :config_path, :data
14
-
15
- def initialize
16
- @config_path = File.join(Config.config_path, "#{config_name}.json")
17
- @data = load
18
- end
19
-
20
- def save
21
- File.write(config_path, JSON.pretty_generate(data))
22
- end
23
-
24
- def load
25
- return JSON.parse(File.read(config_path)) if File.exist?(config_path)
26
-
27
- default_data
28
- rescue JSON::ParserError
29
- # log.exception e
30
- default_data
31
- end
32
-
33
- def name
34
- self.class.name.split('::')[-1].gsub(/Config$/, '')
35
- end
36
-
37
- def config_name
38
- name.gsub(/([a-z])([A-Z])/, '\1-\2').downcase
39
- end
40
-
41
- def debug
42
- log.kv 'Config', name
43
- log.kv 'Path', config_path
44
-
45
- log.json data
46
- end
47
-
48
- private
49
-
50
- def default_data
51
- {}
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Appydave
4
- module Tools
5
- module Configuration
6
- # Global settings that can be referenced by other configurations or tools
7
- class SettingsConfig < ConfigBase
8
- def set(key, value)
9
- data[key] = value
10
- end
11
-
12
- def get(key, default = nil)
13
- data.fetch(key, default)
14
- end
15
-
16
- # Well known settings
17
-
18
- def ecamm_recording_folder
19
- get('ecamm-recording-folder')
20
- end
21
-
22
- def download_folder
23
- get('download-folder')
24
- end
25
-
26
- def download_image_folder
27
- get('download-image-folder') || download_folder
28
- end
29
- end
30
- end
31
- end
32
- end