refactor: create fixtures module
Prepare for adding a second radically different fixture by creating a module to hold the different fixtures. When I only had one fixture it was ok to have the module be a single file.
This commit is contained in:
parent
401aec67d0
commit
6790eec12c
5 changed files with 5 additions and 14 deletions
1
src/exec/fixtures/mod.rs
Normal file
1
src/exec/fixtures/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod scripting;
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::elm;
|
||||
use crate::fixture;
|
||||
use crate::reporting::{CompilerError, InterpreterError, Problem, SetupError, TypeError};
|
||||
use crate::PortableHash;
|
||||
use deno_core::futures::StreamExt;
|
||||
|
|
@ -19,6 +18,8 @@ use std::time::Instant;
|
|||
use tokio;
|
||||
use tracing::{info_span, Instrument};
|
||||
|
||||
mod fixtures;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(tag = "$")]
|
||||
pub(crate) enum ElmResult<T, E> {
|
||||
|
|
@ -104,7 +105,7 @@ pub(crate) fn exec(
|
|||
// step 7 create an Elm fixture file to run our function
|
||||
let span = info_span!("create Elm fixture files");
|
||||
let timing_guard = span.enter();
|
||||
let (gen_module_name, source) = fixture::generate(
|
||||
let (gen_module_name, source) = fixtures::scripting::generate(
|
||||
source_checksum,
|
||||
entrypoint.0.module.clone(),
|
||||
entrypoint.1.clone(),
|
||||
|
|
@ -194,7 +195,7 @@ pub(crate) fn exec(
|
|||
final_script = final_script
|
||||
.replace(
|
||||
"var $author$project$Astrid$Query$execute = function (query) {\n\treturn $author$project$Astrid$Query$dummyExecute;\n};",
|
||||
include_str!("../fixture/query.js"),
|
||||
include_str!("fixtures/sql-client-integration.js"),
|
||||
)
|
||||
.replace(
|
||||
"var $author$project$Astrid$Query$fetch = F3(\n\tfunction (sql, parameters, decoder) {\n\t\treturn $author$project$Astrid$Query$Dummy;\n\t});",
|
||||
|
|
|
|||
11
src/main.rs
11
src/main.rs
|
|
@ -1,7 +1,6 @@
|
|||
extern crate naive_wadler_prettier as pretty;
|
||||
use crate::timings::Timings;
|
||||
use pretty::pretty;
|
||||
use sqlx::Row;
|
||||
use std::hash::Hasher;
|
||||
use std::io::{self, Write};
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -11,7 +10,6 @@ use tracing::info_span;
|
|||
|
||||
mod elm;
|
||||
mod exec;
|
||||
mod fixture;
|
||||
mod reporting;
|
||||
mod timings;
|
||||
mod transpile;
|
||||
|
|
@ -23,7 +21,6 @@ fn main() {
|
|||
tracing::subscriber::set_global_default(span_subscriber).unwrap();
|
||||
|
||||
match args {
|
||||
// Arguments::Make { file, debug, output } => {
|
||||
Arguments::Exec {
|
||||
file,
|
||||
debug,
|
||||
|
|
@ -108,14 +105,6 @@ impl ::core::hash::Hasher for PortableHash {
|
|||
|
||||
#[derive(Debug, StructOpt)]
|
||||
enum Arguments {
|
||||
//Make {
|
||||
// #[structopt(parse(from_os_str))]
|
||||
// file: PathBuf,
|
||||
// #[structopt(long)]
|
||||
// debug: bool,
|
||||
// #[structopt(long)]
|
||||
// output: Option<PathBuf>,
|
||||
//},
|
||||
Exec {
|
||||
#[structopt(parse(from_os_str))]
|
||||
file: PathBuf,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue