makit 0.0.163 → 0.0.164

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: 599b26976cbb6cc29f17237f53aa31d334594eb637425b0d534c0eaf53cc215c
4
- data.tar.gz: 953a603a359bd3e2535cad44b76eaac2d590761b831b3c3367ff8a67c21f8da0
3
+ metadata.gz: 5aa415801dae9c081791596f59c00947878f6ee7d76d3bb7515f6ea8e2a8e958
4
+ data.tar.gz: 12983cf08ef21f336c22bf3903a0e336acc0860cc201f55c5c742814c4e1c8e7
5
5
  SHA512:
6
- metadata.gz: 95d25294ff19b0a8dfaa611f0a45e471423555b95f1ced18b04b6945b2ece3e5279a9d77df3e0b370d239d4ebf30e87cc0f91598c0e0a33ae1ca16b6b4ecd9f1
7
- data.tar.gz: 2fd32bc4994feb7492182ad20becea5f3a4bcb0d946e6bf939925a3921986c455abb0bc1b3378d75e6318b311c534e629af30824c17764e67fbcd5b89e447932
6
+ metadata.gz: 79310ac260f739a81bb2a2fec375133a6e61635a0b936b27fc1f3d223755c1024e76f6bca5e5134b008adf700cf2808bf54672647f7fdaede6fb9b4094ed7dee
7
+ data.tar.gz: 3677481dfedddfbd200f5adc024477ea74fc8044c9caf0f643d913e0b868a633c4ad90438469b11f7e2dcc5c9a1fc8112aaa442457f1a95019ec6c1165103f61
data/lib/makit/nuget.rb CHANGED
@@ -276,20 +276,17 @@ module Makit
276
276
  source_path = source_info[:url]
277
277
  destination_path = destination_info[:url]
278
278
 
279
- # Check if sources are local directory feeds (not URLs)
279
+ # Source must be a local directory feed (not a URL)
280
280
  unless source_path && !source_path.match?(/^https?:\/\//)
281
281
  Makit::Logging.default_logger.error("Source '#{source_name}' is not a local directory feed (URL: #{source_path})")
282
282
  return -1
283
283
  end
284
284
 
285
- unless destination_path && !destination_path.match?(/^https?:\/\//)
286
- Makit::Logging.default_logger.error("Destination source '#{destination_name}' is not a local directory feed (URL: #{destination_path})")
287
- return -1
288
- end
289
-
290
285
  # Expand and normalize the source path
291
286
  source_path = File.expand_path(source_path)
292
- destination_path = File.expand_path(destination_path)
287
+
288
+ # Destination can be either local directory feed or remote feed (Azure DevOps, NuGet.org, etc.)
289
+ is_remote_destination = destination_path && destination_path.match?(/^https?:\/\//)
293
290
 
294
291
  # Ensure source directory exists
295
292
  unless Dir.exist?(source_path)
@@ -298,9 +295,12 @@ module Makit
298
295
  end
299
296
 
300
297
  Makit::Logging.default_logger.info("Searching for packages matching '#{package_pattern}' in source '#{source_name}' (#{source_path})")
298
+ Makit::Logging.default_logger.info("Destination: #{destination_name} (#{destination_path}) - #{is_remote_destination ? 'Remote feed' : 'Local directory feed'}")
301
299
 
302
- # Ensure destination directory exists
303
- FileUtils.mkdir_p(destination_path) unless Dir.exist?(destination_path)
300
+ # Ensure destination directory exists (only for local feeds)
301
+ unless is_remote_destination
302
+ FileUtils.mkdir_p(destination_path) unless Dir.exist?(destination_path)
303
+ end
304
304
 
305
305
  # Find all .nupkg files matching the pattern
306
306
  # Simply search recursively for all .nupkg files and match package names
@@ -368,51 +368,76 @@ module Makit
368
368
 
369
369
  Makit::Logging.default_logger.info("Migrating #{package_name}.#{version} from '#{source_name}' to '#{destination_name}'...")
370
370
 
371
- # Determine target path in organized structure: {package_name}/{version}/{package_name}.{version}.nupkg
372
- # Use lowercase for directory structure to match NuGet conventions
373
- target_package_dir = File.join(destination_path, package_name.downcase, version)
374
- target_package_path = File.join(target_package_dir, File.basename(nupkg_path).downcase)
375
-
376
- if File.exist?(target_package_path)
377
- Makit::Logging.default_logger.info(" Package already exists in destination, skipping: #{package_name}.#{version}")
378
- migrated_count += 1
379
- next
380
- end
381
-
382
- # For local directory feeds, use 'nuget add' which automatically organizes packages
383
- # into the hierarchical structure: {packageID}/{version}/packageID.version.nupkg
384
- # This is the recommended command for local feeds as it handles organization and metadata
385
- stdout, stderr, status = Open3.capture3("nuget", "add", nupkg_path, "-Source", destination_path)
386
-
387
- if status.success?
388
- Makit::Logging.default_logger.info(" Successfully migrated and organized #{package_name}.#{version}")
389
- migrated_count += 1
390
- else
391
- # Fallback to dotnet nuget push if nuget.exe is not available
392
- # Check if nuget.exe exists, otherwise try dotnet nuget push
393
- nuget_exe = Makit::Environment.which("nuget")
394
- if nuget_exe.nil? || nuget_exe.empty?
395
- Makit::Logging.default_logger.info(" nuget.exe not found, falling back to dotnet nuget push")
396
-
397
- # Manually organize package into proper directory structure
398
- Makit::Logging.default_logger.info(" Organizing package into directory structure: #{target_package_dir}")
399
- FileUtils.mkdir_p(target_package_dir)
400
- FileUtils.cp(nupkg_path, target_package_path)
401
-
402
- # Push using dotnet nuget push from the organized location
403
- stdout, stderr, status = Open3.capture3("dotnet", "nuget", "push", target_package_path, "--source", destination_path)
404
-
405
- if status.success?
406
- Makit::Logging.default_logger.info(" Successfully migrated and organized #{package_name}.#{version}")
371
+ if is_remote_destination
372
+ # For remote feeds (Azure DevOps, NuGet.org, etc.), use dotnet nuget push
373
+ # Azure DevOps requires --api-key az (placeholder) and --skip-duplicate
374
+ Makit::Logging.default_logger.info(" Pushing #{package_name}.#{version} to remote feed...")
375
+
376
+ args = ["dotnet", "nuget", "push", nupkg_path, "--source", destination_path, "--skip-duplicate"]
377
+
378
+ # For Azure DevOps feeds, add --api-key az (required placeholder)
379
+ if destination_path.include?("dev.azure.com") || destination_path.include?("pkgs.dev.azure.com")
380
+ args << "--api-key" << "az"
381
+ end
382
+
383
+ stdout, stderr, status = Open3.capture3(*args)
384
+
385
+ if status.success?
386
+ Makit::Logging.default_logger.info(" Successfully migrated #{package_name}.#{version} to remote feed")
387
+ migrated_count += 1
388
+ else
389
+ # Check if it's a duplicate (which is okay with --skip-duplicate)
390
+ if stderr.include?("already exists") || stderr.include?("duplicate")
391
+ Makit::Logging.default_logger.info(" Package already exists in destination, skipping: #{package_name}.#{version}")
407
392
  migrated_count += 1
408
393
  else
409
- Makit::Logging.default_logger.warn(" Package copied to organized structure but dotnet nuget push failed: #{stderr}")
410
- Makit::Logging.default_logger.warn(" Package is available at #{target_package_path} but may need manual indexing")
411
- migrated_count += 1
394
+ Makit::Logging.default_logger.error(" Failed to migrate #{package_name}.#{version}: #{stderr}")
395
+ failed_count += 1
412
396
  end
397
+ end
398
+ else
399
+ # For local directory feeds, use 'nuget add' which automatically organizes packages
400
+ # into the hierarchical structure: {packageID}/{version}/packageID.version.nupkg
401
+ target_package_dir = File.join(destination_path, package_name.downcase, version)
402
+ target_package_path = File.join(target_package_dir, File.basename(nupkg_path).downcase)
403
+
404
+ if File.exist?(target_package_path)
405
+ Makit::Logging.default_logger.info(" Package already exists in destination, skipping: #{package_name}.#{version}")
406
+ migrated_count += 1
407
+ next
408
+ end
409
+
410
+ stdout, stderr, status = Open3.capture3("nuget", "add", nupkg_path, "-Source", destination_path)
411
+
412
+ if status.success?
413
+ Makit::Logging.default_logger.info(" Successfully migrated and organized #{package_name}.#{version}")
414
+ migrated_count += 1
413
415
  else
414
- Makit::Logging.default_logger.error(" Failed to migrate #{package_name}.#{version}: #{stderr}")
415
- failed_count += 1
416
+ # Fallback to dotnet nuget push if nuget.exe is not available
417
+ nuget_exe = Makit::Environment.which("nuget")
418
+ if nuget_exe.nil? || nuget_exe.empty?
419
+ Makit::Logging.default_logger.info(" nuget.exe not found, falling back to dotnet nuget push")
420
+
421
+ # Manually organize package into proper directory structure
422
+ Makit::Logging.default_logger.info(" Organizing package into directory structure: #{target_package_dir}")
423
+ FileUtils.mkdir_p(target_package_dir)
424
+ FileUtils.cp(nupkg_path, target_package_path)
425
+
426
+ # Push using dotnet nuget push from the organized location
427
+ stdout, stderr, status = Open3.capture3("dotnet", "nuget", "push", target_package_path, "--source", destination_path)
428
+
429
+ if status.success?
430
+ Makit::Logging.default_logger.info(" Successfully migrated and organized #{package_name}.#{version}")
431
+ migrated_count += 1
432
+ else
433
+ Makit::Logging.default_logger.warn(" Package copied to organized structure but dotnet nuget push failed: #{stderr}")
434
+ Makit::Logging.default_logger.warn(" Package is available at #{target_package_path} but may need manual indexing")
435
+ migrated_count += 1
436
+ end
437
+ else
438
+ Makit::Logging.default_logger.error(" Failed to migrate #{package_name}.#{version}: #{stderr}")
439
+ failed_count += 1
440
+ end
416
441
  end
417
442
  end
418
443
  end
data/lib/makit/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Makit
4
4
  # Static version for now to avoid circular dependency issues
5
- #VERSION = "0.0.163"
5
+ #VERSION = "0.0.164"
6
6
 
7
7
  # Version management utilities for various file formats
8
8
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.163
4
+ version: 0.0.164
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow