appydave-tools 0.2.0 → 0.3.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: 7f8d11a7aa2efb787554cb3146098cc7ab0885394420af910840424e8a70a544
4
- data.tar.gz: 4153b36add667b7d250bfb7932cea34b4324f856f3d9e2a0370e00c298b8ecce
3
+ metadata.gz: '09003bdfd4899328767437ec22a7bdd7cfd1b9189577f85f456acfaad20b0139'
4
+ data.tar.gz: 9756b51db5c99b451dcd73369c490ac0105b09efa3eaedd335adaa8fdd62a345
5
5
  SHA512:
6
- metadata.gz: d53f5bb5e624f3869da4d45901a145b9752ae490ea5fcf82cff902420bb1deb17113c5dd3d1e24671c7f57071c184023398c40be4ecc6c59f460c21a859591f3
7
- data.tar.gz: 488a91fa38b828e10bfeb4e70aace941a4814fcbb1b8d0fab3a6e7f7748383ffb8c67b94380197a31ea14192e702bd08471db15532f8b9490f4d64bbebb7c8c2
6
+ metadata.gz: fcc9d6983c76063bd4c26546ceefae814c8eaf704b098a36bdb5b6dc112394c8f9f0eb595df78fdf3e66d6a2b026f4b50687acf157fc5e951c7b512d64ad9da4
7
+ data.tar.gz: 557b0bd08e184cc23d16820a0ac65746307c560621e998c69c2f78dcc3ab08b1fff3a302bca4207b2fad6b9c6c8efb28260b360e6cb0b80e13d7cd5b358d6533
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.3.0](https://github.com/klueless-io/appydave-tools/compare/v0.2.0...v0.3.0) (2024-05-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * configuration component ([2bf26f6](https://github.com/klueless-io/appydave-tools/commit/2bf26f690da17b651977eab79e7a3cd37ed2a3b5))
7
+
8
+ # [0.2.0](https://github.com/klueless-io/appydave-tools/compare/v0.1.0...v0.2.0) (2024-05-14)
9
+
10
+
11
+ ### Features
12
+
13
+ * gpt context gatherer ([00e2c34](https://github.com/klueless-io/appydave-tools/commit/00e2c343eb97a2c436b265861a912dccf803149d))
14
+
1
15
  # [0.1.0](https://github.com/klueless-io/appydave-tools/compare/v0.0.2...v0.1.0) (2024-05-08)
2
16
 
3
17
 
@@ -0,0 +1,3 @@
1
+ # Configuration Component
2
+
3
+ [ChatGPT conversation](https://chatgpt.com/g/g-4dMsIRK3E-ruby-script-assistant/c/d8ea5960-071b-48aa-9fd9-554ca302c7dd)
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module Configuration
6
+ # Configuration class for handling multiple configurations
7
+ class Config
8
+ class << self
9
+ attr_accessor :config_path
10
+ attr_reader :configurations
11
+
12
+ def configure
13
+ yield self
14
+ ensure_config_directory
15
+ end
16
+
17
+ def register(key, klass)
18
+ @configurations ||= {}
19
+ @configurations[key] = klass.new(config_base_path: config_path)
20
+ end
21
+
22
+ def method_missing(method_name, *args, &block)
23
+ if @configurations.key?(method_name)
24
+ @configurations[method_name]
25
+ else
26
+ super
27
+ end
28
+ end
29
+
30
+ def respond_to_missing?(method_name, include_private = false)
31
+ @configurations.key?(method_name) || super
32
+ end
33
+
34
+ def save
35
+ configurations.each_value(&:save)
36
+ end
37
+
38
+ def load
39
+ configurations.each_value(&:load)
40
+ end
41
+
42
+ def edit
43
+ ensure_config_directory
44
+ puts "Edit configuration: #{config_path}"
45
+ open_vscode = "code --folder-uri '#{config_path}'" # --new-window
46
+ Open3.capture3(open_vscode)
47
+ end
48
+
49
+ private
50
+
51
+ def ensure_config_directory
52
+ FileUtils.mkdir_p(config_path) unless File.directory?(config_path)
53
+ end
54
+ end
55
+
56
+ self.config_path = File.expand_path('~/.config/appydave') # set default configuration path
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ # Configuration example usage
63
+ # Appydave::Tools::Configuration::Config.configure do |config|
64
+ # config.config_path = File.expand_path('~/.config/appydave') # optional, as this is already the default
65
+ # # config.register(:settings, SettingsConfig)
66
+ # # config.register(:gpt_context, GptContextConfig)
67
+ # # Additional configurations can be registered as needed.
68
+ # end
@@ -0,0 +1,32 @@
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
+ attr_reader :config_path, :data
12
+
13
+ def initialize(config_name)
14
+ @config_path = File.join(Config.config_path, "#{config_name}.json")
15
+ @data = load
16
+ end
17
+
18
+ def save
19
+ File.write(config_path, JSON.pretty_generate(data))
20
+ end
21
+
22
+ def load
23
+ return JSON.parse(File.read(config_path)) if File.exist?(config_path)
24
+
25
+ {}
26
+ rescue JSON::ParserError
27
+ {}
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'fileutils'
5
+
6
+ module Appydave
7
+ module Tools
8
+ module Configuration
9
+ # Specific configuration classes
10
+ class SettingsConfig < ConfigBase
11
+ def initialize
12
+ super('settings')
13
+ end
14
+ end
15
+
16
+ # class GptContextConfig < ConfigBase
17
+ # def initialize
18
+ # super('gpt_context')
19
+ # end
20
+ # end
21
+
22
+ # class ImageMoverConfig < ConfigBase
23
+ # def initialize
24
+ # super('image_mover')
25
+ # end
26
+ # end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
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 initialize
9
+ super('settings')
10
+ end
11
+
12
+ def set(key, value)
13
+ data[key] = value
14
+ end
15
+
16
+ def get(key, default = nil)
17
+ data.fetch(key, default)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.1'
6
6
  end
7
7
  end
@@ -1,12 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'optparse'
4
3
  require 'clipboard'
5
4
  require 'fileutils'
5
+ require 'json'
6
+ require 'open3'
7
+ require 'optparse'
6
8
 
7
9
  require 'appydave/tools/version'
8
10
  require 'appydave/tools/gpt_context/file_collector'
9
11
 
12
+ require 'appydave/tools/configuration/config_base'
13
+ require 'appydave/tools/configuration/config'
14
+ require 'appydave/tools/configuration/settings_config'
15
+
10
16
  module Appydave
11
17
  module Tools
12
18
  # raise Appydave::Tools::Error, 'Sample message'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appydave-tools",
9
- "version": "0.2.0",
9
+ "version": "0.3.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.2.0",
3
+ "version": "0.3.1",
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.2.0
4
+ version: 0.3.1
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-14 00:00:00.000000000 Z
11
+ date: 2024-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -48,6 +48,11 @@ files:
48
48
  - bin/gpt_context.rb
49
49
  - bin/setup
50
50
  - lib/appydave/tools.rb
51
+ - lib/appydave/tools/configuration/_doc.md
52
+ - lib/appydave/tools/configuration/config.rb
53
+ - lib/appydave/tools/configuration/config_base.rb
54
+ - lib/appydave/tools/configuration/settings_config copy.xrb
55
+ - lib/appydave/tools/configuration/settings_config.rb
51
56
  - lib/appydave/tools/gpt_context/file_collector.rb
52
57
  - lib/appydave/tools/version.rb
53
58
  - package-lock.json