appydave-tools 0.37.0 → 0.39.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 +4 -4
- data/CHANGELOG.md +27 -0
- data/docs/code-quality/README.md +177 -0
- data/docs/code-quality/implementation-plan.md +712 -0
- data/docs/code-quality/report-2025-01-21.md +342 -0
- data/lib/appydave/tools/dam/brand_resolver.rb +118 -0
- data/lib/appydave/tools/dam/config.rb +2 -25
- data/lib/appydave/tools/dam/errors.rb +31 -0
- data/lib/appydave/tools/dam/file_helper.rb +43 -0
- data/lib/appydave/tools/dam/git_helper.rb +89 -0
- data/lib/appydave/tools/dam/project_listing.rb +4 -25
- data/lib/appydave/tools/dam/project_resolver.rb +2 -2
- data/lib/appydave/tools/dam/repo_push.rb +2 -7
- data/lib/appydave/tools/dam/repo_status.rb +7 -24
- data/lib/appydave/tools/dam/s3_operations.rb +1 -5
- data/lib/appydave/tools/dam/status.rb +6 -19
- data/lib/appydave/tools/dam/sync_from_ssd.rb +1 -7
- data/lib/appydave/tools/version.rb +1 -1
- data/lib/appydave/tools.rb +4 -0
- data/package.json +1 -1
- metadata +8 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'find'
|
|
4
|
-
|
|
5
3
|
# rubocop:disable Style/FormatStringToken
|
|
6
4
|
# Disabled: Using simple unannotated tokens (%s) for straightforward string formatting
|
|
7
5
|
# Annotated tokens (%<foo>s) add unnecessary complexity for simple table formatting
|
|
@@ -69,7 +67,7 @@ module Appydave
|
|
|
69
67
|
# Gather project data
|
|
70
68
|
project_data = projects.map do |project|
|
|
71
69
|
project_path = Config.project_path(brand_arg, project)
|
|
72
|
-
size = calculate_directory_size(project_path)
|
|
70
|
+
size = FileHelper.calculate_directory_size(project_path)
|
|
73
71
|
modified = File.mtime(project_path)
|
|
74
72
|
|
|
75
73
|
{
|
|
@@ -113,7 +111,7 @@ module Appydave
|
|
|
113
111
|
# Gather project data
|
|
114
112
|
project_data = matches.map do |project|
|
|
115
113
|
project_path = Config.project_path(brand_arg, project)
|
|
116
|
-
size = calculate_directory_size(project_path)
|
|
114
|
+
size = FileHelper.calculate_directory_size(project_path)
|
|
117
115
|
modified = File.mtime(project_path)
|
|
118
116
|
|
|
119
117
|
{
|
|
@@ -146,23 +144,10 @@ module Appydave
|
|
|
146
144
|
# Calculate total size of all projects in a brand
|
|
147
145
|
def self.calculate_total_size(brand, projects)
|
|
148
146
|
projects.sum do |project|
|
|
149
|
-
calculate_directory_size(Config.project_path(brand, project))
|
|
147
|
+
FileHelper.calculate_directory_size(Config.project_path(brand, project))
|
|
150
148
|
end
|
|
151
149
|
end
|
|
152
150
|
|
|
153
|
-
# Calculate size of a directory in bytes
|
|
154
|
-
def self.calculate_directory_size(path)
|
|
155
|
-
return 0 unless Dir.exist?(path)
|
|
156
|
-
|
|
157
|
-
total = 0
|
|
158
|
-
Find.find(path) do |file_path|
|
|
159
|
-
total += File.size(file_path) if File.file?(file_path)
|
|
160
|
-
rescue StandardError
|
|
161
|
-
# Skip files we can't read
|
|
162
|
-
end
|
|
163
|
-
total
|
|
164
|
-
end
|
|
165
|
-
|
|
166
151
|
# Find the most recent modification time across all projects
|
|
167
152
|
def self.find_last_modified(brand, projects)
|
|
168
153
|
return Time.at(0) if projects.empty?
|
|
@@ -174,13 +159,7 @@ module Appydave
|
|
|
174
159
|
|
|
175
160
|
# Format size in human-readable format
|
|
176
161
|
def self.format_size(bytes)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
units = %w[B KB MB GB TB]
|
|
180
|
-
exp = (Math.log(bytes) / Math.log(1024)).to_i
|
|
181
|
-
exp = [exp, units.length - 1].min
|
|
182
|
-
|
|
183
|
-
format('%.1f %s', bytes.to_f / (1024**exp), units[exp])
|
|
162
|
+
FileHelper.format_size(bytes)
|
|
184
163
|
end
|
|
185
164
|
|
|
186
165
|
# Format date/time in readable format
|
|
@@ -116,9 +116,9 @@ module Appydave
|
|
|
116
116
|
# Check if we're inside a v-* directory
|
|
117
117
|
if current =~ %r{/(v-[^/]+)/([^/]+)/?}
|
|
118
118
|
brand_with_prefix = ::Regexp.last_match(1)
|
|
119
|
-
project = ::Regexp.last_match(2) # Capture BEFORE
|
|
119
|
+
project = ::Regexp.last_match(2) # Capture BEFORE normalize() which resets Regexp.last_match
|
|
120
120
|
# Strip 'v-' prefix to get brand key (e.g., 'v-supportsignal' → 'supportsignal')
|
|
121
|
-
brand_key =
|
|
121
|
+
brand_key = BrandResolver.normalize(brand_with_prefix)
|
|
122
122
|
return [brand_key, project] if project_exists?(brand_key, project)
|
|
123
123
|
end
|
|
124
124
|
|
|
@@ -105,16 +105,11 @@ module Appydave
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def uncommitted_changes?
|
|
108
|
-
|
|
109
|
-
!output.empty?
|
|
110
|
-
rescue StandardError
|
|
111
|
-
false
|
|
108
|
+
GitHelper.uncommitted_changes?(brand_path)
|
|
112
109
|
end
|
|
113
110
|
|
|
114
111
|
def commits_ahead
|
|
115
|
-
|
|
116
|
-
rescue StandardError
|
|
117
|
-
0
|
|
112
|
+
GitHelper.commits_ahead(brand_path)
|
|
118
113
|
end
|
|
119
114
|
|
|
120
115
|
def show_push_summary(output)
|
|
@@ -107,49 +107,32 @@ module Appydave
|
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def current_branch
|
|
110
|
-
|
|
111
|
-
rescue StandardError
|
|
112
|
-
'unknown'
|
|
110
|
+
GitHelper.current_branch(brand_path)
|
|
113
111
|
end
|
|
114
112
|
|
|
115
113
|
def remote_url
|
|
116
|
-
|
|
117
|
-
result.empty? ? nil : result
|
|
118
|
-
rescue StandardError
|
|
119
|
-
nil
|
|
114
|
+
GitHelper.remote_url(brand_path)
|
|
120
115
|
end
|
|
121
116
|
|
|
122
117
|
def modified_files_count
|
|
123
|
-
|
|
124
|
-
rescue StandardError
|
|
125
|
-
0
|
|
118
|
+
GitHelper.modified_files_count(brand_path)
|
|
126
119
|
end
|
|
127
120
|
|
|
128
121
|
def untracked_files_count
|
|
129
|
-
|
|
130
|
-
rescue StandardError
|
|
131
|
-
0
|
|
122
|
+
GitHelper.untracked_files_count(brand_path)
|
|
132
123
|
end
|
|
133
124
|
|
|
134
125
|
def commits_ahead
|
|
135
|
-
|
|
136
|
-
rescue StandardError
|
|
137
|
-
0
|
|
126
|
+
GitHelper.commits_ahead(brand_path)
|
|
138
127
|
end
|
|
139
128
|
|
|
140
129
|
def commits_behind
|
|
141
|
-
|
|
142
|
-
rescue StandardError
|
|
143
|
-
0
|
|
130
|
+
GitHelper.commits_behind(brand_path)
|
|
144
131
|
end
|
|
145
132
|
|
|
146
133
|
# Check if repo has uncommitted changes (matches old script: git diff-index --quiet HEAD --)
|
|
147
134
|
def uncommitted_changes?
|
|
148
|
-
|
|
149
|
-
system("git -C \"#{brand_path}\" diff-index --quiet HEAD -- 2>/dev/null")
|
|
150
|
-
!$CHILD_STATUS.success?
|
|
151
|
-
rescue StandardError
|
|
152
|
-
false
|
|
135
|
+
GitHelper.uncommitted_changes?(brand_path)
|
|
153
136
|
end
|
|
154
137
|
|
|
155
138
|
# Show file list using git status --short (matches old script)
|
|
@@ -768,11 +768,7 @@ module Appydave
|
|
|
768
768
|
|
|
769
769
|
# Calculate total size of a directory
|
|
770
770
|
def calculate_directory_size(dir_path)
|
|
771
|
-
|
|
772
|
-
Dir.glob(File.join(dir_path, '**', '*'), File::FNM_DOTMATCH).each do |file|
|
|
773
|
-
total += File.size(file) if File.file?(file)
|
|
774
|
-
end
|
|
775
|
-
total
|
|
771
|
+
FileHelper.calculate_directory_size(dir_path)
|
|
776
772
|
end
|
|
777
773
|
end
|
|
778
774
|
end
|
|
@@ -241,40 +241,27 @@ module Appydave
|
|
|
241
241
|
end
|
|
242
242
|
|
|
243
243
|
def current_branch
|
|
244
|
-
|
|
245
|
-
rescue StandardError
|
|
246
|
-
'unknown'
|
|
244
|
+
GitHelper.current_branch(brand_path)
|
|
247
245
|
end
|
|
248
246
|
|
|
249
247
|
def remote_url
|
|
250
|
-
|
|
251
|
-
result.empty? ? nil : result
|
|
252
|
-
rescue StandardError
|
|
253
|
-
nil
|
|
248
|
+
GitHelper.remote_url(brand_path)
|
|
254
249
|
end
|
|
255
250
|
|
|
256
251
|
def modified_files_count
|
|
257
|
-
|
|
258
|
-
rescue StandardError
|
|
259
|
-
0
|
|
252
|
+
GitHelper.modified_files_count(brand_path)
|
|
260
253
|
end
|
|
261
254
|
|
|
262
255
|
def untracked_files_count
|
|
263
|
-
|
|
264
|
-
rescue StandardError
|
|
265
|
-
0
|
|
256
|
+
GitHelper.untracked_files_count(brand_path)
|
|
266
257
|
end
|
|
267
258
|
|
|
268
259
|
def commits_ahead
|
|
269
|
-
|
|
270
|
-
rescue StandardError
|
|
271
|
-
0
|
|
260
|
+
GitHelper.commits_ahead(brand_path)
|
|
272
261
|
end
|
|
273
262
|
|
|
274
263
|
def commits_behind
|
|
275
|
-
|
|
276
|
-
rescue StandardError
|
|
277
|
-
0
|
|
264
|
+
GitHelper.commits_behind(brand_path)
|
|
278
265
|
end
|
|
279
266
|
end
|
|
280
267
|
end
|
|
@@ -268,13 +268,7 @@ module Appydave
|
|
|
268
268
|
|
|
269
269
|
# Format bytes into human-readable format
|
|
270
270
|
def format_bytes(bytes)
|
|
271
|
-
|
|
272
|
-
"#{bytes}B"
|
|
273
|
-
elsif bytes < 1024 * 1024
|
|
274
|
-
"#{(bytes / 1024.0).round(1)}KB"
|
|
275
|
-
else
|
|
276
|
-
"#{(bytes / 1024.0 / 1024.0).round(1)}MB"
|
|
277
|
-
end
|
|
271
|
+
FileHelper.format_size(bytes)
|
|
278
272
|
end
|
|
279
273
|
end
|
|
280
274
|
end
|
data/lib/appydave/tools.rb
CHANGED
|
@@ -52,6 +52,10 @@ require 'appydave/tools/prompt_tools/prompt_completion'
|
|
|
52
52
|
require 'appydave/tools/subtitle_processor/clean'
|
|
53
53
|
require 'appydave/tools/subtitle_processor/join'
|
|
54
54
|
|
|
55
|
+
require 'appydave/tools/dam/errors'
|
|
56
|
+
require 'appydave/tools/dam/file_helper'
|
|
57
|
+
require 'appydave/tools/dam/git_helper'
|
|
58
|
+
require 'appydave/tools/dam/brand_resolver'
|
|
55
59
|
require 'appydave/tools/dam/config'
|
|
56
60
|
require 'appydave/tools/dam/project_resolver'
|
|
57
61
|
require 'appydave/tools/dam/config_loader'
|
data/package.json
CHANGED
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
|
+
version: 0.39.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cruwys
|
|
@@ -250,6 +250,9 @@ files:
|
|
|
250
250
|
- docs/archive/test-coverage-quick-wins.md
|
|
251
251
|
- docs/archive/tool-discovery.md
|
|
252
252
|
- docs/archive/tool-documentation-analysis.md
|
|
253
|
+
- docs/code-quality/README.md
|
|
254
|
+
- docs/code-quality/implementation-plan.md
|
|
255
|
+
- docs/code-quality/report-2025-01-21.md
|
|
253
256
|
- docs/guides/configuration-setup.md
|
|
254
257
|
- docs/guides/platforms/windows/README.md
|
|
255
258
|
- docs/guides/platforms/windows/dam-testing-plan-windows-powershell.md
|
|
@@ -294,8 +297,12 @@ files:
|
|
|
294
297
|
- lib/appydave/tools/configuration/models/settings_config.rb
|
|
295
298
|
- lib/appydave/tools/configuration/models/youtube_automation_config.rb
|
|
296
299
|
- lib/appydave/tools/configuration/openai.rb
|
|
300
|
+
- lib/appydave/tools/dam/brand_resolver.rb
|
|
297
301
|
- lib/appydave/tools/dam/config.rb
|
|
298
302
|
- lib/appydave/tools/dam/config_loader.rb
|
|
303
|
+
- lib/appydave/tools/dam/errors.rb
|
|
304
|
+
- lib/appydave/tools/dam/file_helper.rb
|
|
305
|
+
- lib/appydave/tools/dam/git_helper.rb
|
|
299
306
|
- lib/appydave/tools/dam/manifest_generator.rb
|
|
300
307
|
- lib/appydave/tools/dam/project_listing.rb
|
|
301
308
|
- lib/appydave/tools/dam/project_resolver.rb
|