Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from heck to ident_case (closes #100) #124

Merged
merged 1 commit into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 76 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,26 @@ default set of features in the application:
| 3 | [cc] | [@alexcrichton] | Apache-2.0/MIT | C/C++ compiler wrapper |
| 4 | [cfg-if] | [@alexcrichton] | Apache-2.0/MIT | If-like `#[cfg]` macros |
| 5 | [darling] | [@TedDriggs] | MIT | Nifty attribute parser |
| 6 | [failure_derive] | [@withoutboats] | Apache-2.0/MIT | failure custom derive |
| 7 | [gumdrop_derive] | [@Murarth] | Apache-2.0/MIT | Command-line options |
| 8 | [heck] | [@withoutboats] | Apache-2.0/MIT | Case conversion utils |
| 9 | [memchr] | [@BurntSushi] | MIT/Unlicense | Optimize byte search |
| 10 | [proc-macro2] | [@alexcrichton] | Apache-2.0/MIT | Shim for Macros 2.0 API |
| 11 | [quote] | [@dtolnay] | Apache-2.0/MIT | Rust AST to token macro |
| 12 | [regex] | [rust-lang] | Apache-2.0/MIT | Regular expressions |
| 13 | [regex-syntax] | [rust-lang] | Apache-2.0/MIT | Regex syntax impl |
| 14 | [serde_derive] | [serde-rs] | Apache-2.0/MIT | `serde` custom derive |
| 15 | [syn] | [@dtolnay] | Apache-2.0/MIT | Rust source code parser |
| 16 | [synstructure] | [@mystor] | Apache-2.0/MIT | `syn` structure macros |
| 17 | [thread_local] | [@Amanieu] | Apache-2.0/MIT | Per-object thread local |
| 18 | [ucd-util] | [@BurntSushi] | Apache-2.0/MIT | Unicode utilities |
| 19 | [unicode-xid] | [unicode-rs] | Apache-2.0/MIT | Identify valid Unicode |
| 20 | [utf8-ranges] | [@BurntSushi] | MIT/Unlicense | UTF-8 codepoint ranges |
| 21 | [wait-timeout] | [@alexcrichton] | Apache-2.0/MIT | Timeouts for waitpid |
| 6 | [darling_core] | [@TedDriggs] | MIT | Attribute parser core |
| 7 | [darling_macro] | [@TedDriggs] | MIT | Attribute parser macros |
| 8 | [failure_derive] | [@withoutboats] | Apache-2.0/MIT | `failure` custom derive |
| 9 | [fnv] | [@alexcrichton] | Apache-2.0/MIT | Fast hash function |
| 10 | [gumdrop_derive] | [@Murarth] | Apache-2.0/MIT | Command-line options |
| 11 | [ident_case] | [@TedDriggs] | Apache-2.0/MIT | Case conversion utils |
| 12 | [memchr] | [@BurntSushi] | MIT/Unlicense | Optimized byte search |
| 13 | [proc-macro2] | [@alexcrichton] | Apache-2.0/MIT | Shim for Macros 2.0 API |
| 14 | [quote] | [@dtolnay] | Apache-2.0/MIT | Rust AST to token macro |
| 15 | [regex] | [rust-lang] | Apache-2.0/MIT | Regular expressions |
| 16 | [regex-syntax] | [rust-lang] | Apache-2.0/MIT | Regex syntax impl |
| 17 | [serde_derive] | [serde-rs] | Apache-2.0/MIT | `serde` custom derive |
| 18 | [strsim] | [@dguo] | MIT | String similarity utils |
| 19 | [syn] | [@dtolnay] | Apache-2.0/MIT | Rust source code parser |
| 20 | [synstructure] | [@mystor] | Apache-2.0/MIT | `syn` structure macros |
| 21 | [thread_local] | [@Amanieu] | Apache-2.0/MIT | Per-object thread local |
| 22 | [ucd-util] | [@BurntSushi] | Apache-2.0/MIT | Unicode utilities |
| 23 | [unicode-xid] | [unicode-rs] | Apache-2.0/MIT | Identify valid Unicode |
| 24 | [utf8-ranges] | [@BurntSushi] | MIT/Unlicense | UTF-8 codepoint ranges |
| 25 | [wait-timeout] | [@alexcrichton] | Apache-2.0/MIT | Timeouts for waitpid |

### Dependency Relationships

Expand All @@ -143,52 +147,59 @@ an Abscissa dependency and whether or not it is optional. Abscissa uses
[cargo features] to allow parts of it you aren't using to be easily disabled,
so you only compile the parts you need.

| Crate Name | [Cargo Features] | Required By |
|------------------------|------------------|-----------------|
| [abscissa] | - | ⊤ |
| [abscissa_derive] | - | [abscissa] |
| [aho-corasick] | `testing` | [regex] |
| Crate Name | [Cargo Features] | Required By |
|------------------------|------------------|-------------------|
| [abscissa] | - | ⊤ |
| [abscissa_derive] | - | [abscissa] |
| [aho-corasick] | `testing` | [regex] |
| [arc-swap] | `signals` | [signal-hook-registry] |
| [autocfg] | `time` | [num-integer] |
| [backtrace] | - | [failure] |
| [backtrace-sys] | - | [backtrace] |
| [canonical-path] | - | [abscissa] |
| [cc] | - | [backtrace-sys] |
| [autocfg] | `time` | [num-integer] |
| [backtrace] | - | [failure] |
| [backtrace-sys] | - | [backtrace] |
| [canonical-path] | - | [abscissa] |
| [cc] | - | [backtrace-sys] |
| [cfg-if] | - | [backtrace], [log] |
| [chrono] | `time` | [abscissa] |
| [failure] | - | [abscissa] |
| [failure_derive] | - | [failure] |
| [generational-arena] | `application` | [abscissa] |
| [gumdrop] | `options` | [abscissa] |
| [gumdrop_derive] | `options` | [gumdrop] |
| [heck] | `inflector` | [abscissa] |
| [lazy_static] | - | [abscissa] |
| [libc] | `signals` | [abscissa] |
| [log] | `logging` | [abscissa] |
| [memchr] | `testing` | [aho-corasick] |
| [num-integer] | `time` | [chrono] |
| [chrono] | `time` | [abscissa] |
| [darling] | - | [abscissa_derive] |
| [darling_core] | - | [darling], [darling_macro] |
| [darling_macro] | - | [darling] |
| [failure] | - | [abscissa] |
| [failure_derive] | - | [failure] |
| [fnv] | - | [darling_core] |
| [generational-arena] | `application` | [abscissa] |
| [gumdrop] | `options` | [abscissa] |
| [gumdrop_derive] | `options` | [gumdrop] |
| [ident_case] | - | [abscissa_derive], [darling_core] |
| [lazy_static] | - | [abscissa] |
| [libc] | `signals` | [abscissa] |
| [log] | `logging` | [abscissa] |
| [memchr] | `testing` | [aho-corasick] |
| [num-integer] | `time` | [chrono] |
| [num-traits] | `time` | [chrono], [num-integer] |
| [proc-macro2] | - | [abscissa_derive], [failure_derive], [quote], [serde_derive] |
| [redox_syscall] | `time` | [time] |
| [regex] | `testing` | [abscissa] |
| [rustc-demangle] | - | [backtrace] |
| [secrecy] | `secrets` | [abscissa] |
| [semver] | `application` | [abscissa] |
| [semver-parser] | `application` | [abscissa] |
| [serde] | `config` | [abscissa] |
| [serde_derive] | `config` | [serde] |
| [signal-hook] | `signals` | [abscissa] |
| [signal-hook-registry] | `signals` | [signal-hook] |
| [termcolor] | `terminal` | [abscissa] |
| [thread_local] | `testing` | [regex] |
| [time] | `logging` | [chrono] |
| [ucd-util] | `testing` | [regex-syntax] |
| [unicode-xid] | - | [proc-macro2] |
| [utf8-ranges] | `testing` | [regex] |
| [wait-timeout] | `testing` | [abscissa] |
| [proc-macro2] | - | [abscissa_derive], [darling], [failure_derive], [quote], [serde_derive], [syn] |
| [quote] | - | [abscissa_derive], [darling], [failure_derive], [gumdrop_derive], [serde_derive] |
| [redox_syscall] | `time` | [time] |
| [regex] | `testing` | [abscissa] |
| [rustc-demangle] | - | [backtrace] |
| [secrecy] | `secrets` | [abscissa] |
| [semver] | `application` | [abscissa] |
| [semver-parser] | `application` | [abscissa] |
| [serde] | `config` | [abscissa] |
| [serde_derive] | `config` | [serde] |
| [signal-hook] | `signals` | [abscissa] |
| [signal-hook-registry] | `signals` | [signal-hook] |
| [strsim] | - | [darling_core] |
| [syn] | - | [abscissa_derive], [darling], [failure_derive], [gumdrop_derive], [serde_derive] |
| [termcolor] | `terminal` | [abscissa] |
| [thread_local] | `testing` | [regex] |
| [time] | `logging` | [chrono] |
| [ucd-util] | `testing` | [regex-syntax] |
| [unicode-xid] | - | [proc-macro2], [syn] |
| [utf8-ranges] | `testing` | [regex] |
| [wait-timeout] | `testing` | [abscissa] |
| [winapi]§ | - | [termcolor], [time], [winapi-util] |
| [winapi-util] | - | [termcolor] |
| [zeroize] | - | [abscissa] |
| [winapi-util] | - | [termcolor] |
| [zeroize] | - | [abscissa] |

* § `winapi` is a facade for either [winapi-i686-pc-windows-gnu] or
[winapi-x86_64-pc-windows-gnu] which aren't explicitly listed for brevity
Expand Down Expand Up @@ -320,13 +331,16 @@ read the [CONTRIBUTING.md] and [CODE_OF_CONDUCT.md] files first.
[cc]: https://crates.io/crates/cc
[cfg-if]: https://crates.io/crates/cfg-if
[chrono]: https://crates.io/crates/chrono
[darling]: https://github.com/TedDriggs/darling
[darling]: https://crates.io/crates/darling
[darling_core]: https://crates.io/crates/darling_core
[darling_macro]: https://crates.io/crates/darling_macro
[failure]: https://crates.io/crates/failure
[failure_derive]: https://crates.io/crates/failure_derive
[fnv]: https://crates.io/crates/fnv
[generational-arena]: https://github.com/fitzgen/generational-arena
[gumdrop]: https://crates.io/crates/gumdrop
[gumdrop_derive]: https://crates.io/crates/gumdrop_derive
[heck]: https://crates.io/crates/heck
[ident_case]: https://crates.io/crates/ident_case
[lazy_static]: https://crates.io/crates/lazy_static
[libc]: https://crates.io/crates/libc
[log]: https://crates.io/crates/log
Expand All @@ -346,6 +360,7 @@ read the [CONTRIBUTING.md] and [CODE_OF_CONDUCT.md] files first.
[serde_derive]: https://crates.io/crates/serde_derive
[signal-hook]: https://crates.io/crates/signal-hook
[signal-hook-registry]: https://crates.io/crates/signal-hook
[strsim]: https://crates.io/crates/darling
[syn]: https://crates.io/crates/syn
[synstructure]: https://crates.io/crates/
[termcolor]: https://crates.io/crates/termcolor
Expand All @@ -369,6 +384,7 @@ read the [CONTRIBUTING.md] and [CODE_OF_CONDUCT.md] files first.
[@Amanieu]: https://github.com/Amanieu
[@BurntSushi]: https://github.com/BurntSushi
[@cuviper]: https://github.com/cuviper
[@dguo]: https://github.com/dtolnay
[@dtolnay]: https://github.com/dtolnay
[@fitzgen]: https://github.com/fitzgen
[@Murarth]: https://github.com/Murarth
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" }
failure = "0.1"
gumdrop = "0.6"
handlebars = "2"
heck = "0.3"
ident_case = "1"
lazy_static = "1"
serde = { version = "1", features = ["serde_derive"] }

Expand Down
12 changes: 6 additions & 6 deletions cli/src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
};
use abscissa_core::{status_err, status_info, status_ok, status_warn, Command, Options, Runnable};
use failure::{bail, format_err, Error};
use heck::TitleCase;
use ident_case::RenameRule;
use std::{
fs, io,
path::{Path, PathBuf},
Expand Down Expand Up @@ -186,12 +186,13 @@ impl NewCommand {
let app_name = app_path
.file_name()
.expect("no filename?")
.to_string_lossy();
.to_string_lossy()
.replace("-", "_");

let name: properties::name::App = app_name.parse().expect("no app name");

// TODO(tarcieri): configurable title
let title = name.to_string().to_title_case();
let title = RenameRule::PascalCase.apply_to_field(&name);

// TODO(tarcieri): configurable description
let description = title.clone();
Expand All @@ -202,11 +203,10 @@ impl NewCommand {
let patch_crates_io = self.patch_crates_io.clone();

// TODO(tarcieri): configurable application type
let application_type =
properties::name::Type::from_snake_case(app_name.clone() + "_application");
let application_type = properties::name::Type::from_snake_case(app_name.clone() + "_app");

// TODO(tarcieri): configurable command type
let command_type = properties::name::Type::from_snake_case(app_name.clone() + "_command");
let command_type = properties::name::Type::from_snake_case(app_name.clone() + "_cmd");

// TODO(tarcieri): configurable config type
let config_type = properties::name::Type::from_snake_case(app_name.clone() + "_config");
Expand Down
4 changes: 2 additions & 2 deletions cli/src/properties/name.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Names used within an Abscissa application

use heck::CamelCase;
use ident_case::RenameRule;
use serde::{Deserialize, Serialize};
use std::{fmt, str};

Expand Down Expand Up @@ -68,6 +68,6 @@ impl Type {
where
S: AsRef<str>,
{
Type(s.as_ref().to_camel_case())
Type(RenameRule::PascalCase.apply_to_field(s))
}
}
4 changes: 1 addition & 3 deletions cli/template/Cargo.toml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ version = "{{version}}"
edition = "{{edition}}"

[dependencies]
abscissa_core = "{{abscissa.version}}"
failure = "0.1"
gumdrop = "0.6"
lazy_static = "1"
serde = { version = "1", features = ["serde_derive"] }

[dependencies.abscissa_core]
version = "{{abscissa.version}}"

[dev-dependencies.abscissa_core]
version = "{{abscissa.version}}"
features = ["testing"]
Expand Down
6 changes: 3 additions & 3 deletions cli/template/src/commands.rs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
mod start;
mod version;

use self::{start::StartCommand, version::VersionCommand};
use self::{start::StartCmd, version::VersionCmd};
use crate::config::{{~config_type~}};
use abscissa_core::{
config::Override, Command, Configurable, FrameworkError, Help, Options, Runnable,
Expand All @@ -32,11 +32,11 @@ pub enum {{command_type}} {

/// The `start` subcommand
#[options(help = "start the application")]
Start(StartCommand),
Start(StartCmd),

/// The `version` subcommand
#[options(help = "display version information")]
Version(VersionCommand),
Version(VersionCmd),
}

/// This trait allows you to define how application configuration is loaded.
Expand Down
Loading