VFS in external crate (#297)

* vroom

* Port dir middleware

* Filter rules

* Directory metadata

* Project support

* Enable Lua support

* StringValue support

* CSV

* rbxm, rbxmx, and rbxlx

* JSON models

* Clean up some warnings

* Strip out PathMap

* Unwatch paths when they're reported as removed

* Fix 'rojo upload' behavior

* Upgrade to Insta 0.13.1

* Update dependencies

* Release 0.6.0-alpha.2

* Fix bad merge

* Replace MemoryBackend with InMemoryFs

* Sledgehammer tests into passing for now

* Txt middleware

* Update easy snapshot tests

* Lua tests

* Project middleware tests

* Try to fix test failures by sorting

* Port first set of serve session tests

* Add InMemoryFs::raise_event

* Finish porting serve session tests

* Remove UI code for introspecting VFS for now

* VFS docs
This commit is contained in:
Lucien Greathouse
2020-03-10 17:38:49 -07:00
committed by GitHub
parent a884f693ae
commit 477e0ada32
38 changed files with 846 additions and 2509 deletions

View File

@@ -5,13 +5,10 @@ use std::{
use snafu::{ResultExt, Snafu};
use tokio::runtime::Runtime;
use vfs::Vfs;
use crate::{
cli::BuildCommand,
project::ProjectError,
serve_session::ServeSession,
snapshot::RojoTree,
vfs::{RealFetcher, Vfs, WatchMode},
cli::BuildCommand, project::ProjectError, serve_session::ServeSession, snapshot::RojoTree,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -75,13 +72,7 @@ pub fn build(options: BuildCommand) -> Result<(), BuildError> {
fn build_inner(options: BuildCommand) -> Result<(), Error> {
log::trace!("Constructing in-memory filesystem");
let watch_mode = if options.watch {
WatchMode::Enabled
} else {
WatchMode::Disabled
};
let vfs = Vfs::new(RealFetcher::new(watch_mode));
let vfs = Vfs::new_default();
let session = ServeSession::new(vfs, &options.absolute_project());
let mut cursor = session.message_queue().cursor();

View File

@@ -5,13 +5,9 @@ use std::{
use snafu::Snafu;
use termcolor::{BufferWriter, Color, ColorChoice, ColorSpec, WriteColor};
use vfs::Vfs;
use crate::{
cli::ServeCommand,
serve_session::ServeSession,
vfs::{RealFetcher, Vfs, WatchMode},
web::LiveServer,
};
use crate::{cli::ServeCommand, serve_session::ServeSession, web::LiveServer};
const DEFAULT_PORT: u16 = 34872;
@@ -26,7 +22,7 @@ pub fn serve(options: ServeCommand) -> Result<(), ServeError> {
}
fn serve_inner(options: ServeCommand) -> Result<(), Error> {
let vfs = Vfs::new(RealFetcher::new(WatchMode::Enabled));
let vfs = Vfs::new_default();
let session = Arc::new(ServeSession::new(vfs, &options.absolute_project()));

View File

@@ -1,12 +1,8 @@
use reqwest::header::{ACCEPT, CONTENT_TYPE, COOKIE, USER_AGENT};
use snafu::{ResultExt, Snafu};
use vfs::Vfs;
use crate::{
auth_cookie::get_auth_cookie,
cli::UploadCommand,
common_setup,
vfs::{RealFetcher, Vfs, WatchMode},
};
use crate::{auth_cookie::get_auth_cookie, cli::UploadCommand, common_setup};
#[derive(Debug, Snafu)]
pub struct UploadError(Error);
@@ -40,7 +36,7 @@ fn upload_inner(options: UploadCommand) -> Result<(), Error> {
.ok_or(Error::NeedAuthCookie)?;
log::trace!("Constructing in-memory filesystem");
let vfs = Vfs::new(RealFetcher::new(WatchMode::Disabled));
let vfs = Vfs::new_default();
let (_maybe_project, tree) = common_setup::start(&options.absolute_project(), &vfs);