mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
Add README and License information.
This commit is contained in:
parent
8a5c121f26
commit
4f18686fb8
@ -2,6 +2,11 @@
|
||||
name = "ucg"
|
||||
version = "0.0.1"
|
||||
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]
|
||||
nom = "^2.2"
|
||||
@ -13,4 +18,4 @@ path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "ucg"
|
||||
path = "src/main.rs"
|
||||
path = "src/main.rs"
|
||||
|
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 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]
|
||||
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;
|
||||
|
||||
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! {
|
||||
#[derive(Debug,PartialEq)]
|
||||
pub enum ParseError {
|
||||
|
Loading…
x
Reference in New Issue
Block a user