appydave-tools 0.3.1 → 0.3.3

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: '09003bdfd4899328767437ec22a7bdd7cfd1b9189577f85f456acfaad20b0139'
4
- data.tar.gz: 9756b51db5c99b451dcd73369c490ac0105b09efa3eaedd335adaa8fdd62a345
3
+ metadata.gz: 99c323bf20ff261cb8bc480f62755bd2bcf3329f71757336a860ae012519c756
4
+ data.tar.gz: 77adbb57ab140ae8edd305b99145d015e60bab9c66193ec221b02dd284619dfe
5
5
  SHA512:
6
- metadata.gz: fcc9d6983c76063bd4c26546ceefae814c8eaf704b098a36bdb5b6dc112394c8f9f0eb595df78fdf3e66d6a2b026f4b50687acf157fc5e951c7b512d64ad9da4
7
- data.tar.gz: 557b0bd08e184cc23d16820a0ac65746307c560621e998c69c2f78dcc3ab08b1fff3a302bca4207b2fad6b9c6c8efb28260b360e6cb0b80e13d7cd5b358d6533
6
+ metadata.gz: f553305dd9de4407a078f6c3cb8a1aa73263ab96e7bfe534283b81dfa742ea7c65287480da31f03f549364ca5743b0b49ddffe277592b24b2df3541ff7da0713
7
+ data.tar.gz: c631a73481020791d0221dc997332f09163eabbdbf38e03dbfea8198d680ecbf45cf74f18b38df234feaefd530a498aeaac5a2ef29aa0a1fdc73aeb654fcbf68
data/.rubocop.yml CHANGED
@@ -95,9 +95,6 @@ Layout/SpaceBeforeComma:
95
95
  # My Preferences - End
96
96
 
97
97
  # RSpec Cops
98
- RSpec/NestedGroups:
99
- Max: 5
100
-
101
98
  RSpec/FilePath:
102
99
  Exclude:
103
100
  - "**/spec/**/*"
@@ -109,3 +106,5 @@ RSpec/NamedSubject:
109
106
  RSpec/MultipleExpectations:
110
107
  Max: 5
111
108
 
109
+ RSpec/NestedGroups:
110
+ Max: 8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [0.3.2](https://github.com/klueless-io/appydave-tools/compare/v0.3.1...v0.3.2) (2024-05-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * updating settings configuration and tests ([18bdf2b](https://github.com/klueless-io/appydave-tools/commit/18bdf2bb2605f51a5779dfe649c40e98c2bd77ef))
7
+ * updating settings configuration and tests ([487ce36](https://github.com/klueless-io/appydave-tools/commit/487ce366b857ce38ed91b35e4b6cc15a8ef56d35))
8
+
9
+ ## [0.3.1](https://github.com/klueless-io/appydave-tools/compare/v0.3.0...v0.3.1) (2024-05-16)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * add settings config to configuration component ([2c8afd1](https://github.com/klueless-io/appydave-tools/commit/2c8afd164fd6aa00fa47a01c9007c784a8adf820))
15
+
1
16
  # [0.3.0](https://github.com/klueless-io/appydave-tools/compare/v0.2.0...v0.3.0) (2024-05-16)
2
17
 
3
18
 
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module Configuration
6
+ # Channel projects configuration
7
+ class ChannelProjectsConfig < ConfigBase
8
+ def initialize
9
+ super('channel_projects')
10
+ end
11
+
12
+ # Retrieve channel information by channel name (string or symbol)
13
+ def get_channel_info(channel_name)
14
+ channel_name = channel_name.to_s
15
+ ChannelInfo.new(data['channel_projects'][channel_name] || default_channel_info)
16
+ end
17
+
18
+ # Set channel information
19
+ def set_channel_info(channel_name, channel_info)
20
+ data['channel_projects'] ||= {}
21
+ data['channel_projects'][channel_name.to_s] = channel_info.to_h
22
+ end
23
+
24
+ # Retrieve a list of all channel projects
25
+ def channel_projects
26
+ data['channel_projects'].map do |_name, info|
27
+ ChannelInfo.new(info)
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def default_data
34
+ { 'channel_projects' => {} }
35
+ end
36
+
37
+ def default_channel_info
38
+ {
39
+ 'content_projects' => '',
40
+ 'video_projects' => '',
41
+ 'published_projects' => '',
42
+ 'abandoned_projects' => ''
43
+ }
44
+ end
45
+
46
+ # Type-safe class to access channel info properties
47
+ class ChannelInfo
48
+ attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
49
+
50
+ def initialize(data)
51
+ @content_projects = data['content_projects']
52
+ @video_projects = data['video_projects']
53
+ @published_projects = data['published_projects']
54
+ @abandoned_projects = data['abandoned_projects']
55
+ end
56
+
57
+ def to_h
58
+ {
59
+ 'content_projects' => @content_projects,
60
+ 'video_projects' => @video_projects,
61
+ 'published_projects' => @published_projects,
62
+ 'abandoned_projects' => @abandoned_projects
63
+ }
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module Configuration
6
+ # Channels configuration
7
+ class ChannelsConfig < ConfigBase
8
+ def initialize
9
+ super('channels')
10
+ end
11
+
12
+ # Retrieve channel information by channel code (string or symbol)
13
+ def get_channel(channel_key)
14
+ channel_key = channel_key.to_s
15
+ info = data['channels'][channel_key] || default_channel_info
16
+ ChannelInfo.new(channel_key, info)
17
+ end
18
+
19
+ # Set channel information
20
+ def set_channel(channel_key, channel_info)
21
+ data['channels'] ||= {}
22
+ data['channels'][channel_key.to_s] = channel_info.to_h
23
+ end
24
+
25
+ # Retrieve a list of all channels
26
+ def channels
27
+ data['channels'].map do |key, info|
28
+ ChannelInfo.new(key, info)
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def default_data
35
+ { 'channels' => {} }
36
+ end
37
+
38
+ def default_channel_info
39
+ {
40
+ 'code' => '',
41
+ 'name' => '',
42
+ 'youtube_handle' => ''
43
+ }
44
+ end
45
+
46
+ # Type-safe class to access channel properties
47
+ class ChannelInfo
48
+ attr_accessor :key, :code, :name, :youtube_handle
49
+
50
+ def initialize(key, data)
51
+ @key = key
52
+ @code = data['code']
53
+ @name = data['name']
54
+ @youtube_handle = data['youtube_handle']
55
+ end
56
+
57
+ def to_h
58
+ {
59
+ 'code' => @code,
60
+ 'name' => @name,
61
+ 'youtube_handle' => @youtube_handle
62
+ }
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -16,7 +16,7 @@ module Appydave
16
16
 
17
17
  def register(key, klass)
18
18
  @configurations ||= {}
19
- @configurations[key] = klass.new(config_base_path: config_path)
19
+ @configurations[key] = klass.new
20
20
  end
21
21
 
22
22
  def method_missing(method_name, *args, &block)
@@ -10,7 +10,7 @@ module Appydave
10
10
  class ConfigBase
11
11
  attr_reader :config_path, :data
12
12
 
13
- def initialize(config_name)
13
+ def initialize(config_name = 'unknown')
14
14
  @config_path = File.join(Config.config_path, "#{config_name}.json")
15
15
  @data = load
16
16
  end
@@ -22,8 +22,12 @@ module Appydave
22
22
  def load
23
23
  return JSON.parse(File.read(config_path)) if File.exist?(config_path)
24
24
 
25
- {}
25
+ default_data
26
26
  rescue JSON::ParserError
27
+ default_data
28
+ end
29
+
30
+ def default_data
27
31
  {}
28
32
  end
29
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.3.1'
5
+ VERSION = '0.3.3'
6
6
  end
7
7
  end
@@ -12,6 +12,8 @@ require 'appydave/tools/gpt_context/file_collector'
12
12
  require 'appydave/tools/configuration/config_base'
13
13
  require 'appydave/tools/configuration/config'
14
14
  require 'appydave/tools/configuration/settings_config'
15
+ require 'appydave/tools/configuration/channel_projects_config'
16
+ require 'appydave/tools/configuration/channels_config'
15
17
 
16
18
  module Appydave
17
19
  module Tools
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appydave-tools",
9
- "version": "0.3.1",
9
+ "version": "0.3.3",
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.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appydave-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-16 00:00:00.000000000 Z
11
+ date: 2024-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -49,6 +49,8 @@ files:
49
49
  - bin/setup
50
50
  - lib/appydave/tools.rb
51
51
  - lib/appydave/tools/configuration/_doc.md
52
+ - lib/appydave/tools/configuration/channel_projects_config.rb
53
+ - lib/appydave/tools/configuration/channels_config.rb
52
54
  - lib/appydave/tools/configuration/config.rb
53
55
  - lib/appydave/tools/configuration/config_base.rb
54
56
  - lib/appydave/tools/configuration/settings_config copy.xrb