-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto create the root folder if not present. (#10444)
Adds `filesystem-exists` to Project Manager CLI. If the root folder isn't present will add it at start up. (cherry picked from commit 891f176)
- Loading branch information
1 parent
e7bc071
commit 468e60e
Showing
11 changed files
with
209 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
.../main/scala/org/enso/projectmanager/boot/command/filesystem/FileSystemExistsCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.enso.projectmanager.boot.command.filesystem | ||
|
||
import org.enso.projectmanager.boot.configuration.ProjectManagerConfig | ||
import org.enso.projectmanager.control.core.syntax._ | ||
import org.enso.projectmanager.control.core.{Applicative, CovariantFlatMap} | ||
import org.enso.projectmanager.control.effect.{ErrorChannel, Sync} | ||
import org.enso.projectmanager.infrastructure.file.BlockingFileSystem | ||
import org.enso.projectmanager.infrastructure.random.SystemGenerator | ||
import org.enso.projectmanager.infrastructure.repository.ProjectFileRepositoryFactory | ||
import org.enso.projectmanager.infrastructure.time.RealClock | ||
import org.enso.projectmanager.protocol.FileSystemManagementApi.FileSystemExists | ||
import org.enso.projectmanager.service.filesystem.{ | ||
FileSystemService, | ||
FileSystemServiceApi, | ||
FileSystemServiceFailure | ||
} | ||
|
||
import java.io.File | ||
|
||
final class FileSystemExistsCommand[ | ||
F[+_, +_]: CovariantFlatMap | ||
](service: FileSystemServiceApi[F], path: File) { | ||
|
||
def run: F[FileSystemServiceFailure, FileSystemExists.Result] = | ||
service | ||
.exists(path) | ||
.map(FileSystemExists.Result) | ||
} | ||
|
||
object FileSystemExistsCommand { | ||
|
||
def apply[F[+_, +_]: Applicative: CovariantFlatMap: ErrorChannel: Sync]( | ||
config: ProjectManagerConfig, | ||
path: File | ||
): FileSystemExistsCommand[F] = { | ||
val clock = new RealClock[F] | ||
val fileSystem = new BlockingFileSystem[F](config.timeout.ioTimeout) | ||
val gen = new SystemGenerator[F] | ||
val projectRepositoryFactory = new ProjectFileRepositoryFactory[F]( | ||
config.storage, | ||
clock, | ||
fileSystem, | ||
gen | ||
) | ||
|
||
val service = new FileSystemService[F](fileSystem, projectRepositoryFactory) | ||
|
||
new FileSystemExistsCommand[F](service, path) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters