appydave-tools 0.34.1 → 0.36.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: 21d326bbe0f9c09a524773b3dbc83fb9e6e337642262e4168ce220f39fd2f4a5
4
- data.tar.gz: fee26064c4c28c05f63ae5143b98d19f875947f5bf08b5916d24346ab204ba92
3
+ metadata.gz: c9081147c515c93a4c3a45f8ca2f8f94dfc4c69b8025d78212a121dde8b70927
4
+ data.tar.gz: 88e44bc2c634968665123e1dcedda8bf57c415b524c14c78752f456439df712e
5
5
  SHA512:
6
- metadata.gz: 6705b5f5acf0f21078a8250b63b6fe6236ace4148beb3dd26f0af0f423e0f2d260f6f7cb3c0ba6715295ac5e6a53b408343241dd7ea0c3dc15fc85d4675a6e5a
7
- data.tar.gz: abb73404e467b4ead3c886ad7e43b2b4a3e0e9e029551d599cca2e13805f6565cffcc51eaecd440086f97846932e018e337d971bab74bac6122e83303d6f686a
6
+ metadata.gz: 418d0e01e3773faeb31c966e7875fa6d985d9fc4af9a697f48b15658a10bb55efdfc8d5f8c8c88df62854d9b8189b0d6a4df0761421db90fb4f5fda671b13086
7
+ data.tar.gz: 7bef2c885d0d89df18b6c9ebd91fe2c9821f91973ddb7421a6184db13e1db7f8ec4289ff4a755b3b6930be28549f7bd4786bc018f08f6b096dfc140cb167c4ab
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.35.0](https://github.com/appydave/appydave-tools/compare/v0.34.1...v0.35.0) (2025-11-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * improve s3-discover UX with table format showing file sizes, last modified, total summary, and quick action commands for share/download/cleanup ([3aa5edc](https://github.com/appydave/appydave-tools/commit/3aa5edcd70ca238c084021e0ef264d46b74557dc))
7
+
8
+ ## [0.34.1](https://github.com/appydave/appydave-tools/compare/v0.34.0...v0.34.1) (2025-11-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add nil project validation to prevent cryptic include? error when project argument is missing ([a205319](https://github.com/appydave/appydave-tools/commit/a2053192fb1533f96db4e990945836f71ceb7c9e))
14
+
1
15
  # [0.34.0](https://github.com/appydave/appydave-tools/compare/v0.33.0...v0.34.0) (2025-11-21)
2
16
 
3
17
 
data/bin/dam CHANGED
@@ -515,25 +515,68 @@ class VatCLI
515
515
  true
516
516
  end
517
517
 
518
+ # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
518
519
  def display_s3_files(files, brand_key, project_id, shareable)
520
+ brand_display = Appydave::Tools::Dam::Config.expand_brand(brand_key)
521
+
519
522
  puts ''
520
- puts "📁 Files in S3: #{brand_key}/#{project_id}"
523
+ puts "🔍 S3 Discovery: #{brand_display}/#{project_id}"
521
524
  puts ''
522
525
 
526
+ if shareable
527
+ # Legacy --shareable mode: just list share commands
528
+ files.each do |file_info|
529
+ s3_key = file_info['Key']
530
+ filename = File.basename(s3_key)
531
+ puts "dam s3-share #{brand_key} #{project_id} #{filename}"
532
+ end
533
+ puts ''
534
+ return
535
+ end
536
+
537
+ # Table format
538
+ puts 'FILES SIZE LAST MODIFIED'
539
+ puts '-' * 72
540
+
541
+ total_bytes = 0
523
542
  files.each do |file_info|
524
- # list_s3_files returns array of hashes with 'Key', 'Size', 'ETag'
525
543
  s3_key = file_info['Key']
526
544
  filename = File.basename(s3_key)
545
+ size = file_info['Size']
546
+ last_modified = file_info['LastModified']
527
547
 
528
- if shareable
529
- puts "dam s3-share #{brand_key} #{project_id} #{filename}"
530
- else
531
- puts filename
532
- end
548
+ total_bytes += size
549
+
550
+ # Format columns
551
+ file_col = filename.ljust(40)
552
+ size_col = format_bytes(size).rjust(10)
553
+ date_col = last_modified ? last_modified.strftime('%Y-%m-%d %H:%M') : 'N/A'.ljust(16)
554
+
555
+ puts "#{file_col} #{size_col} #{date_col}"
556
+ end
557
+
558
+ puts '-' * 72
559
+ puts "Total: #{files.size} #{files.size == 1 ? 'file' : 'files'}, #{format_bytes(total_bytes)}"
560
+
561
+ # Quick actions section
562
+ puts ''
563
+ puts '📋 Quick Actions:'
564
+
565
+ # Share first file (most likely the video)
566
+ if files.any?
567
+ first_file = File.basename(files.first['Key'])
568
+ puts " dam s3-share #{brand_key} #{project_id} #{first_file} # Share first file (7-day link)"
533
569
  end
534
570
 
571
+ # Download all files
572
+ puts " dam s3-down #{brand_key} #{project_id} # Download all files"
573
+
574
+ # Cleanup preview
575
+ puts " dam s3-cleanup-remote #{brand_key} #{project_id} --dry-run # Preview cleanup"
576
+
535
577
  puts ''
536
578
  end
579
+ # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
537
580
 
538
581
  # Help text methods
539
582
  # rubocop:disable Metrics/MethodLength
@@ -10,10 +10,27 @@ module Appydave
10
10
  def get_brand(brand_key)
11
11
  brand_key_str = brand_key.to_s
12
12
 
13
+ log.info "Looking up brand: '#{brand_key_str}'" if debug_mode?
14
+
15
+ # Validate data structure
16
+ unless data.is_a?(Hash)
17
+ log.error "Config data is not a Hash: #{data.class}"
18
+ raise "Invalid brands config: data is #{data.class}, expected Hash"
19
+ end
20
+
21
+ unless data['brands'].is_a?(Hash)
22
+ log.error "Config data['brands'] is #{data['brands'].class}, expected Hash"
23
+ log.error "Available keys in data: #{data.keys.inspect}"
24
+ raise "Invalid brands config: 'brands' key is #{data['brands'].class}, expected Hash"
25
+ end
26
+
27
+ log.info "Available brands: #{data['brands'].keys.inspect}" if debug_mode?
28
+
13
29
  # Try direct key lookup first (case-insensitive)
14
30
  brand_entry = data['brands'].find { |key, _info| key.downcase == brand_key_str.downcase }
15
31
  if brand_entry
16
32
  actual_key = brand_entry[0]
33
+ log.info "Found brand by key: '#{actual_key}'" if debug_mode?
17
34
  return BrandInfo.new(actual_key, brand_entry[1])
18
35
  end
19
36
 
@@ -21,10 +38,12 @@ module Appydave
21
38
  brand_entry = data['brands'].find { |_key, info| info['shortcut']&.downcase == brand_key_str.downcase }
22
39
  if brand_entry
23
40
  actual_key = brand_entry[0]
41
+ log.info "Found brand by shortcut: '#{actual_key}'" if debug_mode?
24
42
  return BrandInfo.new(actual_key, brand_entry[1])
25
43
  end
26
44
 
27
45
  # Return default if not found (use normalized lowercase key)
46
+ log.warn "Brand not found: '#{brand_key_str}', returning default" if debug_mode?
28
47
  BrandInfo.new(brand_key_str.downcase, default_brand_info)
29
48
  end
30
49
 
@@ -30,11 +30,31 @@ module Appydave
30
30
  end
31
31
 
32
32
  def load
33
- return JSON.parse(File.read(config_path)) if File.exist?(config_path)
33
+ if debug_mode?
34
+ log.info "Loading config: #{config_name}"
35
+ log.info "Config path: #{config_path}"
36
+ log.info "File exists: #{File.exist?(config_path)}"
37
+ end
38
+
39
+ unless File.exist?(config_path)
40
+ log.warn "Config file not found: #{config_path}" if debug_mode?
41
+ return default_data
42
+ end
34
43
 
44
+ content = File.read(config_path)
45
+ log.info "Config file size: #{content.bytesize} bytes" if debug_mode?
46
+
47
+ data = JSON.parse(content)
48
+ log.info "Config loaded successfully: #{config_name}" if debug_mode?
49
+ log.json data if debug_mode?
50
+ data
51
+ rescue JSON::ParserError => e
52
+ log.error "JSON parse error in #{config_path}: #{e.message}"
53
+ log.error "File content preview: #{content[0..200]}" if content
35
54
  default_data
36
- rescue JSON::ParserError
37
- # log.exception e
55
+ rescue StandardError => e
56
+ log.error "Error loading #{config_path}: #{e.message}"
57
+ log.error e.backtrace.first(3).join("\n") if debug_mode?
38
58
  default_data
39
59
  end
40
60
 
@@ -55,6 +75,10 @@ module Appydave
55
75
 
56
76
  private
57
77
 
78
+ def debug_mode?
79
+ ENV['DAM_DEBUG'] == 'true' || ENV['DEBUG'] == 'true'
80
+ end
81
+
58
82
  def default_data
59
83
  {}
60
84
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.34.1'
5
+ VERSION = '0.36.0'
6
6
  end
7
7
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.34.1",
3
+ "version": "0.36.0",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.34.1
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys