appydave-tools 0.2.0 → 0.3.0

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: 8286d4b7e2b48f01b4e30595bbcd36e13a34e4ab73d97001e7ad45271af7cefb
4
+ data.tar.gz: ef6a38bddb0a0c40a812d7ffc66750072771d12377dcf63518eaab43472b42ae
5
5
  SHA512:
6
- metadata.gz: d53f5bb5e624f3869da4d45901a145b9752ae490ea5fcf82cff902420bb1deb17113c5dd3d1e24671c7f57071c184023398c40be4ecc6c59f460c21a859591f3
7
- data.tar.gz: 488a91fa38b828e10bfeb4e70aace941a4814fcbb1b8d0fab3a6e7f7748383ffb8c67b94380197a31ea14192e702bd08471db15532f8b9490f4d64bbebb7c8c2
6
+ metadata.gz: 5db672453f1c471840a0d3eee7df1af36a58f1639b3d8351741c3c0d884fb44552472f1b999b0dac1f5bd2e0d77323a17844dca0148eebbb7d8e407f400ada97
7
+ data.tar.gz: fabecbfaa7e9a906479edeae8f29e49e14facc3eeceed148c9c04e15780b978891514e4b1c80f3690bfaf0106721fd8dad5547d50f54145f9378d54ee23ee292
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.2.0](https://github.com/klueless-io/appydave-tools/compare/v0.1.0...v0.2.0) (2024-05-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * gpt context gatherer ([00e2c34](https://github.com/klueless-io/appydave-tools/commit/00e2c343eb97a2c436b265861a912dccf803149d))
7
+
1
8
  # [0.1.0](https://github.com/klueless-io/appydave-tools/compare/v0.0.2...v0.1.0) (2024-05-08)
2
9
 
3
10
 
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
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/settings_config'
14
+ require 'appydave/tools/configuration/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.0",
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.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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.0
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,9 @@ files:
48
48
  - bin/gpt_context.rb
49
49
  - bin/setup
50
50
  - lib/appydave/tools.rb
51
+ - lib/appydave/tools/configuration/config.rb
52
+ - lib/appydave/tools/configuration/config_base.rb
53
+ - lib/appydave/tools/configuration/settings_config.rb
51
54
  - lib/appydave/tools/gpt_context/file_collector.rb
52
55
  - lib/appydave/tools/version.rb
53
56
  - package-lock.json