appydave-tools 0.1.0 → 0.2.0

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: 6ee42ce5c9044d5a983fc3498d31ec92ccff797f79085f81ca041c83e5372f48
4
- data.tar.gz: '014092b8684629253bcc8241e618272ccec12bc664d158c954a736da72534637'
3
+ metadata.gz: 7f8d11a7aa2efb787554cb3146098cc7ab0885394420af910840424e8a70a544
4
+ data.tar.gz: 4153b36add667b7d250bfb7932cea34b4324f856f3d9e2a0370e00c298b8ecce
5
5
  SHA512:
6
- metadata.gz: ab3343f90930a9c5a6dfcc38abaf6ed909ae2b4470ed676c423d6d790a3f6e1fd38c9d131a3e540788becc8b915a730ebe44cef871ebb5f00001024b9da06d12
7
- data.tar.gz: 47cd64a4281c46cd07c63c785862e98cb04911f8805788667b3860c7d50f9f415cf8fb626c3b59318e0c3b9e729d30ed66de6e71349f340716d7a4dd1e3e7632
6
+ metadata.gz: d53f5bb5e624f3869da4d45901a145b9752ae490ea5fcf82cff902420bb1deb17113c5dd3d1e24671c7f57071c184023398c40be4ecc6c59f460c21a859591f3
7
+ data.tar.gz: 488a91fa38b828e10bfeb4e70aace941a4814fcbb1b8d0fab3a6e7f7748383ffb8c67b94380197a31ea14192e702bd08471db15532f8b9490f4d64bbebb7c8c2
data/.rubocop.yml CHANGED
@@ -105,3 +105,7 @@ RSpec/FilePath:
105
105
  RSpec/NamedSubject:
106
106
  Exclude:
107
107
  - "**/spec/**/*"
108
+
109
+ RSpec/MultipleExpectations:
110
+ Max: 5
111
+
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [0.1.0](https://github.com/klueless-io/appydave-tools/compare/v0.0.2...v0.1.0) (2024-05-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * gpt context gatherer ([0c8089c](https://github.com/klueless-io/appydave-tools/commit/0c8089c60258a6032ea2b1fa0796a43cdd8f28c2))
7
+ * gpt context gatherer ([fe07156](https://github.com/klueless-io/appydave-tools/commit/fe0715699ad40379a1f0a1a99193d191a74e500b))
8
+
1
9
  ## [0.0.2](https://github.com/klueless-io/appydave-tools/compare/v0.0.1...v0.0.2) (2024-05-07)
2
10
 
3
11
 
data/bin/gpt_context.rb CHANGED
@@ -7,15 +7,15 @@
7
7
  #
8
8
  # Get GPT Context Gatherer code
9
9
  # ./bin/gpt_context.rb -i 'bin/**/*gather*.rb' -i 'lib/openai_101/tools/**/*gather*.rb'
10
- require 'optparse'
11
- require 'clipboard'
12
- require_relative '../lib/appydave/tools/gpt_context/file_collector'
10
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
11
+
12
+ require 'appydave/tools'
13
13
 
14
14
  options = {
15
15
  include_patterns: [],
16
16
  exclude_patterns: [],
17
17
  format: nil,
18
- debug: false
18
+ debug: 'none'
19
19
  }
20
20
 
21
21
  OptionParser.new do |opts|
@@ -33,8 +33,12 @@ OptionParser.new do |opts|
33
33
  options[:format] = format
34
34
  end
35
35
 
36
- opts.on('-d', '--debug', 'Enable debug mode') do
37
- options[:debug] = true
36
+ # None - No debug output
37
+ # Output - Output the content to the console, this is the same as found in the clipboard
38
+ # Params - Output the options that were passed to the script
39
+ # Debug - Output content, options and debug information
40
+ opts.on('-d', '--debug [MODE]', 'Enable debug mode [none, output, params, debug]', 'none', 'output', 'params', 'debug') do |debug|
41
+ options[:debug] = debug || 'output'
38
42
  end
39
43
 
40
44
  opts.on_tail('-h', '--help', 'Show this message') do
@@ -58,20 +62,23 @@ if options[:include_patterns].empty? && options[:exclude_patterns].empty? && opt
58
62
  exit
59
63
  end
60
64
 
61
- pp options if options[:debug]
65
+ pp options if options[:debug] == 'params'
62
66
 
63
67
  gatherer = Appydave::Tools::GptContext::FileCollector.new(
64
68
  include_patterns: options[:include_patterns],
65
69
  exclude_patterns: options[:exclude_patterns],
66
- format: options[:format]
70
+ format: options[:format],
71
+ working_directory: Dir.pwd
67
72
  )
68
73
 
69
74
  content = gatherer.build
70
75
 
71
- if options[:debug]
76
+ if %w[output debug].include?(options[:debug])
72
77
  puts '-' * 80
73
78
  puts content
74
79
  puts '-' * 80
75
80
  end
76
81
 
82
+ pp options if options[:debug] == 'debug'
83
+
77
84
  Clipboard.copy(content)
@@ -6,21 +6,28 @@ module Appydave
6
6
  module GptContext
7
7
  # Gathers file names and content based on include and exclude patterns
8
8
  class FileCollector
9
- attr_reader :include_patterns, :exclude_patterns, :format
9
+ attr_reader :include_patterns, :exclude_patterns, :format, :working_directory
10
10
 
11
- def initialize(include_patterns: [], exclude_patterns: [], format: nil)
11
+ def initialize(include_patterns: [], exclude_patterns: [], format: nil, working_directory: nil)
12
12
  @include_patterns = include_patterns
13
13
  @exclude_patterns = exclude_patterns
14
14
  @format = format
15
+ @working_directory = working_directory
15
16
  end
16
17
 
17
18
  def build
18
- case format
19
- when 'tree'
20
- build_tree
21
- else
22
- build_content
23
- end
19
+ FileUtils.cd(working_directory) if working_directory && Dir.exist?(working_directory)
20
+
21
+ result = case format
22
+ when 'tree'
23
+ build_tree
24
+ else
25
+ build_content
26
+ end
27
+
28
+ FileUtils.cd(Dir.home) if working_directory
29
+
30
+ result
24
31
  end
25
32
 
26
33
  private
@@ -74,7 +81,7 @@ module Appydave
74
81
  end
75
82
 
76
83
  def excluded?(file_path)
77
- exclude_patterns.any? { |pattern| File.fnmatch(pattern, file_path) }
84
+ exclude_patterns.any? { |pattern| File.fnmatch(pattern, file_path, File::FNM_PATHNAME | File::FNM_DOTMATCH) }
78
85
  end
79
86
  end
80
87
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'appydave/tools/version'
3
+ require 'optparse'
4
+ require 'clipboard'
5
+ require 'fileutils'
4
6
 
7
+ require 'appydave/tools/version'
5
8
  require 'appydave/tools/gpt_context/file_collector'
6
9
 
7
10
  module Appydave
@@ -14,8 +17,7 @@ module Appydave
14
17
  end
15
18
 
16
19
  if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
17
- namespace = 'AppydaveTools::Version'
18
- file_path = $LOADED_FEATURES.find { |f| f.include?('appydave/tools/version') }
19
- version = Appydave::Tools::VERSION.ljust(9)
20
- puts "#{namespace.ljust(35)} : #{version.ljust(9)} : #{file_path}"
20
+ $LOADED_FEATURES.find { |f| f.include?('appydave/tools/version') }
21
+ Appydave::Tools::VERSION.ljust(9)
22
+ # puts "#{namespace.ljust(35)} : #{version.ljust(9)} : #{file_path}"
21
23
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appydave-tools",
9
- "version": "0.1.0",
9
+ "version": "0.2.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.1.0",
3
+ "version": "0.2.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.1.0
4
+ version: 0.2.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-08 00:00:00.000000000 Z
11
+ date: 2024-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard