mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
Add README and License information.
This commit is contained in:
parent
8a5c121f26
commit
4f18686fb8
@ -2,6 +2,11 @@
|
|||||||
name = "ucg"
|
name = "ucg"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Jeremy Wall <jeremy@marzhillstudios.com>"]
|
authors = ["Jeremy Wall <jeremy@marzhillstudios.com>"]
|
||||||
|
description = "Runs a command on user specified triggers."
|
||||||
|
repository = "https://github.com/zaphar/ucg"
|
||||||
|
readme = "README.md"
|
||||||
|
keywords = ["compiler", "config"]
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nom = "^2.2"
|
nom = "^2.2"
|
||||||
|
45
README.md
Normal file
45
README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Universal Configuration Generator. - A working title.
|
||||||
|
|
||||||
|
This is an experiment in configuration management. The approach is not
|
||||||
|
to create a "parsable" config file format. We have plenty of
|
||||||
|
those. Instead we try to specify a grammar for describing
|
||||||
|
configuration values that can then target various configuration
|
||||||
|
formats to output to.
|
||||||
|
|
||||||
|
In theory this could support anything from command line flags to json
|
||||||
|
to yaml or toml or even xml.
|
||||||
|
|
||||||
|
The goal is to allow a global shared configuration repository that can
|
||||||
|
be version controlled, enforce some typesafety, and output
|
||||||
|
configuration for any application regardless of that applications
|
||||||
|
preferred format.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Let statements introduce a new name in a ucg file. Most configurations
|
||||||
|
will be a tuple like below. Tuples are delimited by braces and have a list
|
||||||
|
of named fields in them.
|
||||||
|
|
||||||
|
let mysql_conn_base = {
|
||||||
|
host = "db1.local.net",
|
||||||
|
port = 3306, // knows the difference between strings and numbers.
|
||||||
|
database = "place-holder",
|
||||||
|
};
|
||||||
|
|
||||||
|
You can use a previously defined tuple as the basis for a new tuple. Doing
|
||||||
|
this will make a copy of the source tuple and allow you to add new fields
|
||||||
|
or override an already existing field.
|
||||||
|
|
||||||
|
let mysql_app_conn = mysql_conn_base{
|
||||||
|
database = "appdb",
|
||||||
|
timeout = 30,
|
||||||
|
};
|
||||||
|
|
||||||
|
Types are inferred for tuple fields. We enforce type consistency when
|
||||||
|
overriding a field in a base tuple. The port field below expects a
|
||||||
|
number not a string so you will get a TypeFail error.
|
||||||
|
|
||||||
|
|
||||||
|
let bad_mysql_conn = mysql_conn_base{
|
||||||
|
port = "3307",
|
||||||
|
}
|
13
src/build.rs
13
src/build.rs
@ -1,3 +1,16 @@
|
|||||||
|
// Copyright 2017 Jeremy Wall <jeremy@marzhillstudios.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
use parse::{parse, Statement, Expression, Value, FieldList, SelectorList};
|
use parse::{parse, Statement, Expression, Value, FieldList, SelectorList};
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
13
src/lib.rs
13
src/lib.rs
@ -1,3 +1,16 @@
|
|||||||
|
// Copyright 2017 Jeremy Wall <jeremy@marzhillstudios.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate nom;
|
extern crate nom;
|
||||||
|
|
||||||
|
13
src/main.rs
13
src/main.rs
@ -1,3 +1,16 @@
|
|||||||
|
// Copyright 2017 Jeremy Wall <jeremy@marzhillstudios.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
extern crate ucglib;
|
extern crate ucglib;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
13
src/parse.rs
13
src/parse.rs
@ -1,3 +1,16 @@
|
|||||||
|
// Copyright 2017 Jeremy Wall <jeremy@marzhillstudios.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
quick_error! {
|
quick_error! {
|
||||||
#[derive(Debug,PartialEq)]
|
#[derive(Debug,PartialEq)]
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user