@@ -384,83 +384,81 @@ abstract class PublishTestDefinitions(val scalaVersionOpt: Option[String])
384384 " some_email"
385385 ).call(cwd = root, env = extraEnv)
386386
387- TestCase .testInputs.fromRoot { root =>
388- os.proc(
389- TestUtil .cli,
390- " --power" ,
391- " publish" ,
392- extraOptions,
393- " --signer" ,
394- " bc" ,
395- " project" ,
396- " -R" ,
397- " test-repo"
398- ).call(
399- cwd = root,
400- stdin = os.Inherit ,
401- stdout = os.Inherit ,
402- env = extraEnv
403- )
387+ os.proc(
388+ TestUtil .cli,
389+ " --power" ,
390+ " publish" ,
391+ extraOptions,
392+ " --signer" ,
393+ " bc" ,
394+ " project" ,
395+ " -R" ,
396+ " test-repo"
397+ ).call(
398+ cwd = root,
399+ stdin = os.Inherit ,
400+ stdout = os.Inherit ,
401+ env = extraEnv
402+ )
404403
405- val files = os.walk(root / " test-repo" )
406- .filter(os.isFile(_))
407- .map(_.relativeTo(root / " test-repo" ))
408- val notInDir = files.filter(! _.startsWith(TestCase .expectedArtifactsDir))
409- expect(notInDir.isEmpty)
410-
411- val files0 = files.map(_.relativeTo(TestCase .expectedArtifactsDir)).toSet
412-
413- expect((files0 -- expectedArtifacts).isEmpty)
414- expect((expectedArtifacts -- files0).isEmpty)
415- expect(files0 == expectedArtifacts) // just in case…
416-
417- val repoArgs =
418- Seq [os.Shellable ](
419- " -r" ,
420- " !central" ,
421- " -r" ,
422- (root / " test-repo" ).toNIO.toUri.toASCIIString
423- )
424- val dep = s " org.virtuslab.scalacli.test:simple ${TestCase .scalaSuffix}:0.2.0-SNAPSHOT "
425- val res = os.proc(TestUtil .cs, " launch" , repoArgs, dep).call(cwd = root)
426- val output = res.out.trim()
427- expect(output == " Hello" )
428-
429- val sourceJarViaCsStr =
430- os.proc(TestUtil .cs, " fetch" , repoArgs, " --sources" , " --intransitive" , dep)
431- .call(cwd = root)
432- .out.trim()
433- val sourceJarViaCs = os.Path (sourceJarViaCsStr, os.pwd)
434- val zf = new ZipFile (sourceJarViaCs.toIO)
435- val entries = zf.entries().asScala.toVector.map(_.getName).toSet
436- expect(entries == expectedSourceEntries)
437-
438- val publicKey = os.proc(
439- TestUtil .cli,
440- " --power" ,
441- " config" ,
442- " pgp.public-key"
443- ).call(cwd = root, env = extraEnv)
444- .out.trim()
445- .stripPrefix(" value:" )
446-
447- os.write(os.Path (" key.pub" , root), publicKey)
448-
449- val signatures = expectedArtifacts.filter(_.last.endsWith(" .asc" ))
450- assert(signatures.nonEmpty)
451- val verifyProc = os.proc(
452- TestUtil .cli,
453- " --power" ,
454- " pgp" ,
455- " verify" ,
456- " --key" ,
457- s " key.pub " ,
458- signatures.map(os.rel / " test-repo" / TestCase .expectedArtifactsDir / _)
404+ val files = os.walk(root / " test-repo" )
405+ .filter(os.isFile(_))
406+ .map(_.relativeTo(root / " test-repo" ))
407+ val notInDir = files.filter(! _.startsWith(TestCase .expectedArtifactsDir))
408+ expect(notInDir.isEmpty)
409+
410+ val files0 = files.map(_.relativeTo(TestCase .expectedArtifactsDir)).toSet
411+
412+ expect((files0 -- expectedArtifacts).isEmpty)
413+ expect((expectedArtifacts -- files0).isEmpty)
414+ expect(files0 == expectedArtifacts) // just in case…
415+
416+ val repoArgs =
417+ Seq [os.Shellable ](
418+ " -r" ,
419+ " !central" ,
420+ " -r" ,
421+ (root / " test-repo" ).toNIO.toUri.toASCIIString
459422 )
460- .call(cwd = root, env = extraEnv, mergeErrIntoOut = true )
423+ val dep = s " org.virtuslab.scalacli.test:simple ${TestCase .scalaSuffix}:0.2.0-SNAPSHOT "
424+ val res = os.proc(TestUtil .cs, " launch" , repoArgs, dep).call(cwd = root)
425+ val output = res.out.trim()
426+ expect(output == " Hello" )
427+
428+ val sourceJarViaCsStr =
429+ os.proc(TestUtil .cs, " fetch" , repoArgs, " --sources" , " --intransitive" , dep)
430+ .call(cwd = root)
431+ .out.trim()
432+ val sourceJarViaCs = os.Path (sourceJarViaCsStr, os.pwd)
433+ val zf = new ZipFile (sourceJarViaCs.toIO)
434+ val entries = zf.entries().asScala.toVector.map(_.getName).toSet
435+ expect(entries == expectedSourceEntries)
436+
437+ val publicKey = os.proc(
438+ TestUtil .cli,
439+ " --power" ,
440+ " config" ,
441+ " pgp.public-key"
442+ ).call(cwd = root, env = extraEnv)
443+ .out.trim()
444+ .stripPrefix(" value:" )
445+
446+ os.write(os.Path (" key.pub" , root), publicKey)
447+
448+ val signatures = expectedArtifacts.filter(_.last.endsWith(" .asc" ))
449+ assert(signatures.nonEmpty)
450+ val verifyProc = os.proc(
451+ TestUtil .cli,
452+ " --power" ,
453+ " pgp" ,
454+ " verify" ,
455+ " --key" ,
456+ s " key.pub " ,
457+ signatures.map(os.rel / " test-repo" / TestCase .expectedArtifactsDir / _)
458+ )
459+ .call(cwd = root, env = extraEnv, mergeErrIntoOut = true )
461460
462- expect(! verifyProc.out.text().contains(s " invalid signature " ))
463- }
461+ expect(! verifyProc.out.text().contains(s " invalid signature " ))
464462 }
465463 }
466464
@@ -486,40 +484,38 @@ abstract class PublishTestDefinitions(val scalaVersionOpt: Option[String])
486484 " some_email"
487485 ).call(cwd = root, env = extraEnv)
488486
489- TestCase .testInputs.fromRoot { root =>
490- os.proc(
491- TestUtil .cli,
492- " --power" ,
493- " publish" ,
494- extraOptions,
495- " --secret-key" ,
496- " value:INCORRECT_KEY" ,
497- " --signer" ,
498- " none" ,
499- " project" ,
500- " -R" ,
501- " test-repo"
502- ).call(
503- cwd = root,
504- stdin = os.Inherit ,
505- stdout = os.Inherit ,
506- env = extraEnv
507- )
487+ os.proc(
488+ TestUtil .cli,
489+ " --power" ,
490+ " publish" ,
491+ extraOptions,
492+ " --secret-key" ,
493+ " value:INCORRECT_KEY" ,
494+ " --signer" ,
495+ " none" ,
496+ " project" ,
497+ " -R" ,
498+ " test-repo"
499+ ).call(
500+ cwd = root,
501+ stdin = os.Inherit ,
502+ stdout = os.Inherit ,
503+ env = extraEnv
504+ )
508505
509- val files = os.walk(root / " test-repo" )
510- .filter(os.isFile(_))
511- .map(_.relativeTo(root / " test-repo" ))
512- val notInDir = files.filter(! _.startsWith(TestCase .expectedArtifactsDir))
513- expect(notInDir.isEmpty)
506+ val files = os.walk(root / " test-repo" )
507+ .filter(os.isFile(_))
508+ .map(_.relativeTo(root / " test-repo" ))
509+ val notInDir = files.filter(! _.startsWith(TestCase .expectedArtifactsDir))
510+ expect(notInDir.isEmpty)
514511
515- val files0 = files.map(_.relativeTo(TestCase .expectedArtifactsDir)).toSet
512+ val files0 = files.map(_.relativeTo(TestCase .expectedArtifactsDir)).toSet
516513
517- val expectedArtifactsNotSigned = expectedArtifacts.filterNot(_.last.contains(" .asc" ))
514+ val expectedArtifactsNotSigned = expectedArtifacts.filterNot(_.last.contains(" .asc" ))
518515
519- expect((files0 -- expectedArtifactsNotSigned).isEmpty)
520- expect((expectedArtifactsNotSigned -- files0).isEmpty)
521- expect(files0 == expectedArtifactsNotSigned) // just in case…
522- }
516+ expect((files0 -- expectedArtifactsNotSigned).isEmpty)
517+ expect((expectedArtifactsNotSigned -- files0).isEmpty)
518+ expect(files0 == expectedArtifactsNotSigned) // just in case…
523519 }
524520 }
525521}
0 commit comments