Skip to content
Permalink
Browse files

Problem: `cfg` module doesn't really belong to sit-core

The main thought here is that `cfg` defines structures
that are used by code outside of `sit-core` (namely, `sit` crate).

Solution: move `cfg` to the `sit` crate
  • Loading branch information...
yrashk committed Jul 26, 2018
1 parent be1ec55 commit d142a1a556cde9119ecf1b5ca4aa57d1fc6a3549

Some generated files are not rendered by default. Learn more.

@@ -1,3 +1,6 @@
[workspace]

members = ["sit-core", "sit"]

[profile.release]
lto = true
@@ -26,7 +26,6 @@ sha-1 = { version = "0.7", optional = true }
uuid = { version = "0.5", features = ["v4"], optional = true }
memmap = { version = "0.6", optional = true}
cesu8 = { version = "1.1", optional = true }
git2 = { version = "0.7", optional = true, default-features = false }
relative-path = "0.3"

[dev-dependencies]
@@ -45,5 +44,4 @@ duktape-reducers = ["duktape", "cesu8"]
duktape = []
duktape-mmap = ["memmap"]
windows7 = []
git = ["git2"]
deprecated-item-api = []
@@ -63,4 +63,3 @@ pub mod reducers;
pub use reducers::Reducer;
#[cfg(feature = "duktape")]
pub mod duktape;
pub mod cfg;
@@ -35,7 +35,8 @@ blake2 = { version = "0.7", optional = true }
hex = { version = "0.3", optional = true }
lazy_static = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
sit-core = { path = "../sit-core", version = "0.5.0-pre", features = ["git"] }
git2 = { version = "0.7", optional = true, default-features = false }
sit-core = { path = "../sit-core", version = "0.5.0-pre" }

[dev-dependencies]
cli_test_dir = "0.1.5"
@@ -47,7 +48,8 @@ include_dir = "0.1"
fs_extra = "1.1"

[features]
default = ["deprecated-items", "web"]
default = ["deprecated-items", "web", "git"]
windows7 = ["sit-core/windows7"]
deprecated-items = ["sit-core/deprecated-item-api"]
web = ["rouille", "mime_guess", "digest", "blake2", "hex", "lazy_static", "serde_derive" ]
git = ["git2"]
@@ -1,4 +1,5 @@
//! Client configuration
#[cfg(feature = "git")]
use std::path::PathBuf;

#[derive(Clone, Serialize, Deserialize)]
@@ -1,5 +1,6 @@
use clap::ArgMatches;
use sit_core::{self, reducers::duktape::DuktapeReducer, Repository, record::RecordContainerReduction, cfg::Configuration};
use sit_core::{self, reducers::duktape::DuktapeReducer, Repository, record::RecordContainerReduction};
use cfg::Configuration;
use serde_json;
use rayon::prelude::*;
use super::get_named_expression;
@@ -3,7 +3,7 @@ use chrono::prelude::*;
use clap::{self, ArgMatches};
use dunce;
use serde_json;
use sit_core::cfg::{self, Configuration};
use cfg::{self, Configuration};
use sit_core::{
record::{BoxedOrderedFiles, OrderedFiles, RecordOwningContainer},
Record, Repository
@@ -1,5 +1,6 @@
use clap::ArgMatches;
use sit_core::{Repository, Record, cfg::Configuration, record::RecordContainer, record::OrderedFiles, path::HasPath};
use sit_core::{Repository, Record, record::RecordContainer, record::OrderedFiles, path::HasPath};
use cfg::Configuration;
use serde_json;
use super::get_named_expression;
use jmespath;
@@ -1,7 +1,7 @@
use clap::{ArgMatches, Values};
use sit_core::{self, Repository, record::RecordContainerReduction, repository, cfg::Configuration,
use sit_core::{self, Repository, record::RecordContainerReduction, repository,
reducers::duktape, path::{HasPath, ResolvePath}};

use cfg::Configuration;
use serde_json;
use super::get_named_expression;
use jmespath;
@@ -1,5 +1,6 @@
use clap::{self, ArgMatches};
use sit_core::{Repository, cfg::Configuration, repository};
use sit_core::{Repository, repository};
use cfg::Configuration;
use std::path::PathBuf;

pub fn command<MI: 'static + Send + Sync >(repo: Repository<MI>, matches: &ArgMatches, main_matches: ArgMatches<'static>, config: Configuration) -> i32
@@ -13,6 +14,7 @@ pub fn command<MI: 'static + Send + Sync >(repo: Repository<MI>, matches: &ArgMa
}

mod webapp {
use cfg;
#[allow(dead_code)]
mod assets {
include!(concat!(env!("OUT_DIR"), "/web_assets.rs"));
@@ -140,7 +142,7 @@ mod webapp {
}


fn new_record<C: RecordOwningContainer, MI>(container: &C, request: &Request, repo: &Repository<MI>, config: &sit_core::cfg::Configuration, matches: &ArgMatches) -> Result<C::Record, String> {
fn new_record<C: RecordOwningContainer, MI>(container: &C, request: &Request, repo: &Repository<MI>, config: &cfg::Configuration, matches: &ArgMatches) -> Result<C::Record, String> {
let mut multipart = get_multipart_input(request).expect("multipart request");
let mut link = true;
let mut used_files = vec![];
@@ -274,7 +276,7 @@ mod webapp {
}


pub fn start<A: ToSocketAddrs, MI: 'static + Send + Sync>(addr: A, config: sit_core::cfg::Configuration, repo: Repository<MI>, readonly: bool, overlays: Vec<&str>, matches: ArgMatches<'static>)
pub fn start<A: ToSocketAddrs, MI: 'static + Send + Sync>(addr: A, config: cfg::Configuration, repo: Repository<MI>, readonly: bool, overlays: Vec<&str>, matches: ArgMatches<'static>)
where MI: sit_core::repository::ModuleIterator<PathBuf, sit_core::repository::Error> {
let mut overlays: Vec<_> = overlays.iter().map(|o| PathBuf::from(o)).collect();
let assets: PathBuf = repo.path().join("web").into();
@@ -1,7 +1,10 @@
extern crate sit_core;
extern crate which;
#[cfg(feature = "git")] extern crate git2;
#[macro_use] extern crate serde_derive;
extern crate serde_json;
#[macro_use] extern crate derive_error;
mod cli;
mod module_iter;

pub mod cfg;
pub use module_iter::{ScriptModuleIterator, ScriptModule};
@@ -17,8 +17,8 @@ extern crate walkdir;
extern crate yaml_rust;

extern crate config;
use sit_core::cfg;

mod cfg;
mod rebuild;
use rebuild::rebuild_repository;
mod command_config;
@@ -75,9 +75,9 @@ extern crate hex;
#[cfg(feature="web")]
#[macro_use]
extern crate lazy_static;
#[cfg(feature="web")]
#[macro_use]
extern crate serde_derive;

#[cfg(feature = "git")] extern crate git2;
#[macro_use] extern crate serde_derive;

use std::collections::HashMap;
pub fn get_named_expression<S: AsRef<str>, MI>(name: S, repo: &sit_core::Repository<MI>,

0 comments on commit d142a1a

Please sign in to comment.
You can’t perform that action at this time.