Merge branch 'minor'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
commit
84f2f2c46f
9 changed files with 108 additions and 175 deletions
|
@ -16,7 +16,7 @@ matrix:
|
|||
- bash ./scripts/branch-contains-no-tmp-commits
|
||||
- bash ./scripts/version-updated
|
||||
- language: rust
|
||||
rust: 1.27.2
|
||||
rust: 1.28.0
|
||||
cache:
|
||||
directories:
|
||||
- /home/travis/.cargo
|
||||
|
@ -26,7 +26,7 @@ matrix:
|
|||
- cargo build --all --all-features -j 1 || exit 1
|
||||
- cargo test --all --all-features -j 1 || exit 1
|
||||
- language: rust
|
||||
rust: 1.28.0
|
||||
rust: 1.29.2
|
||||
cache:
|
||||
directories:
|
||||
- /home/travis/.cargo
|
||||
|
|
|
@ -74,29 +74,31 @@ macro_rules! build_subcommand {
|
|||
|
||||
// Actually generates the module.
|
||||
gen_mods_buildui!(
|
||||
("../../../bin/core/imag-annotate/src/ui.rs", imagannotate),
|
||||
("../../../bin/core/imag-diagnostics/src/ui.rs", imagdiagnostics),
|
||||
("../../../bin/core/imag-edit/src/ui.rs", imagedit),
|
||||
("../../../bin/core/imag-git/src/ui.rs", imaggit),
|
||||
("../../../bin/core/imag-gps/src/ui.rs", imaggps),
|
||||
("../../../bin/core/imag-grep/src/ui.rs", imaggrep),
|
||||
("../../../bin/core/imag-ids/src/ui.rs", imagids),
|
||||
("../../../bin/core/imag-init/src/ui.rs", imaginit),
|
||||
("../../../bin/core/imag-link/src/ui.rs", imaglink),
|
||||
("../../../bin/core/imag-mv/src/ui.rs", imagmv),
|
||||
("../../../bin/core/imag-ref/src/ui.rs", imagref),
|
||||
("../../../bin/core/imag-store/src/ui.rs", imagstore),
|
||||
("../../../bin/core/imag-tag/src/ui.rs", imagtag),
|
||||
("../../../bin/core/imag-view/src/ui.rs", imagview)
|
||||
("../../../bin/domain/imag-bookmark/src/ui.rs", imagbookmark),
|
||||
("../../../bin/domain/imag-contact/src/ui.rs", imagcontact),
|
||||
("../../../bin/domain/imag-diary/src/ui.rs", imagdiary),
|
||||
("../../../bin/domain/imag-habit/src/ui.rs", imaghabit),
|
||||
("../../../bin/domain/imag-log/src/ui.rs", imaglog),
|
||||
("../../../bin/domain/imag-mail/src/ui.rs", imagmail),
|
||||
("../../../bin/domain/imag-notes/src/ui.rs", imagnotes),
|
||||
("../../../bin/domain/imag-timetrack/src/ui.rs", imagtimetrack),
|
||||
("../../../bin/domain/imag-todo/src/ui.rs", imagtodo),
|
||||
("../../../bin/core/imag-annotate/src/ui.rs" , imagannotate) ,
|
||||
("../../../bin/core/imag-category/src/ui.rs" , imagcategory) ,
|
||||
("../../../bin/core/imag-diagnostics/src/ui.rs" , imagdiagnostics) ,
|
||||
("../../../bin/core/imag-edit/src/ui.rs" , imagedit) ,
|
||||
("../../../bin/core/imag-git/src/ui.rs" , imaggit) ,
|
||||
("../../../bin/core/imag-gps/src/ui.rs" , imaggps) ,
|
||||
("../../../bin/core/imag-grep/src/ui.rs" , imaggrep) ,
|
||||
("../../../bin/core/imag-ids/src/ui.rs" , imagids) ,
|
||||
("../../../bin/core/imag-init/src/ui.rs" , imaginit) ,
|
||||
("../../../bin/core/imag-link/src/ui.rs" , imaglink) ,
|
||||
("../../../bin/core/imag-mv/src/ui.rs" , imagmv) ,
|
||||
("../../../bin/core/imag-ref/src/ui.rs" , imagref) ,
|
||||
("../../../bin/core/imag-store/src/ui.rs" , imagstore) ,
|
||||
("../../../bin/core/imag-tag/src/ui.rs" , imagtag) ,
|
||||
("../../../bin/core/imag-view/src/ui.rs" , imagview) ,
|
||||
("../../../bin/domain/imag-bookmark/src/ui.rs" , imagbookmark) ,
|
||||
("../../../bin/domain/imag-contact/src/ui.rs" , imagcontact) ,
|
||||
("../../../bin/domain/imag-diary/src/ui.rs" , imagdiary) ,
|
||||
("../../../bin/domain/imag-habit/src/ui.rs" , imaghabit) ,
|
||||
("../../../bin/domain/imag-log/src/ui.rs" , imaglog) ,
|
||||
("../../../bin/domain/imag-mail/src/ui.rs" , imagmail) ,
|
||||
("../../../bin/domain/imag-notes/src/ui.rs" , imagnotes) ,
|
||||
("../../../bin/domain/imag-timetrack/src/ui.rs" , imagtimetrack) ,
|
||||
("../../../bin/domain/imag-todo/src/ui.rs" , imagtodo) ,
|
||||
("../../../bin/domain/imag-wiki/src/ui.rs" , imagwiki) ,
|
||||
);
|
||||
|
||||
fn main() {
|
||||
|
@ -107,29 +109,31 @@ fn main() {
|
|||
&version[..],
|
||||
"imag")
|
||||
// and add all the subapps as subcommands.
|
||||
.subcommand(build_subcommand!("annotate", imagannotate, version))
|
||||
.subcommand(build_subcommand!("diagnostics", imagdiagnostics, version))
|
||||
.subcommand(build_subcommand!("edit", imagedit, version))
|
||||
.subcommand(build_subcommand!("git", imaggit, version))
|
||||
.subcommand(build_subcommand!("gps", imaggps, version))
|
||||
.subcommand(build_subcommand!("grep", imaggrep, version))
|
||||
.subcommand(build_subcommand!("ids", imagids, version))
|
||||
.subcommand(build_subcommand!("init", imaginit, version))
|
||||
.subcommand(build_subcommand!("link", imaglink, version))
|
||||
.subcommand(build_subcommand!("mv", imagmv, version))
|
||||
.subcommand(build_subcommand!("ref", imagref, version))
|
||||
.subcommand(build_subcommand!("store", imagstore, version))
|
||||
.subcommand(build_subcommand!("tag", imagtag, version))
|
||||
.subcommand(build_subcommand!("view", imagview, version))
|
||||
.subcommand(build_subcommand!("bookmark", imagbookmark, version))
|
||||
.subcommand(build_subcommand!("contact", imagcontact, version))
|
||||
.subcommand(build_subcommand!("diary", imagdiary, version))
|
||||
.subcommand(build_subcommand!("habit", imaghabit, version))
|
||||
.subcommand(build_subcommand!("log", imaglog, version))
|
||||
.subcommand(build_subcommand!("mail", imagmail, version))
|
||||
.subcommand(build_subcommand!("notes", imagnotes, version))
|
||||
.subcommand(build_subcommand!("timetrack", imagtimetrack, version))
|
||||
.subcommand(build_subcommand!("todo", imagtodo, version));
|
||||
.subcommand(build_subcommand!("annotate" , imagannotate , version))
|
||||
.subcommand(build_subcommand!("bookmark" , imagbookmark , version))
|
||||
.subcommand(build_subcommand!("category" , imagcategory , version))
|
||||
.subcommand(build_subcommand!("contact" , imagcontact , version))
|
||||
.subcommand(build_subcommand!("diagnostics" , imagdiagnostics , version))
|
||||
.subcommand(build_subcommand!("diary" , imagdiary , version))
|
||||
.subcommand(build_subcommand!("edit" , imagedit , version))
|
||||
.subcommand(build_subcommand!("git" , imaggit , version))
|
||||
.subcommand(build_subcommand!("gps" , imaggps , version))
|
||||
.subcommand(build_subcommand!("grep" , imaggrep , version))
|
||||
.subcommand(build_subcommand!("habit" , imaghabit , version))
|
||||
.subcommand(build_subcommand!("ids" , imagids , version))
|
||||
.subcommand(build_subcommand!("init" , imaginit , version))
|
||||
.subcommand(build_subcommand!("link" , imaglink , version))
|
||||
.subcommand(build_subcommand!("log" , imaglog , version))
|
||||
.subcommand(build_subcommand!("mail" , imagmail , version))
|
||||
.subcommand(build_subcommand!("mv" , imagmv , version))
|
||||
.subcommand(build_subcommand!("notes" , imagnotes , version))
|
||||
.subcommand(build_subcommand!("ref" , imagref , version))
|
||||
.subcommand(build_subcommand!("store" , imagstore , version))
|
||||
.subcommand(build_subcommand!("tag" , imagtag , version))
|
||||
.subcommand(build_subcommand!("timetrack" , imagtimetrack , version))
|
||||
.subcommand(build_subcommand!("todo" , imagtodo , version))
|
||||
.subcommand(build_subcommand!("view" , imagview , version))
|
||||
.subcommand(build_subcommand!("wiki" , imagwiki , version));
|
||||
|
||||
// Actually generates the completion files
|
||||
app.gen_completions("imag", Shell::Bash, "../../../target/");
|
||||
|
@ -139,3 +143,4 @@ fn main() {
|
|||
toplevelbuildscript::build();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs ? (import <nixpkgs> {}) }:
|
||||
|
||||
let
|
||||
env = with pkgs.latest.rustChannels.stable; [
|
||||
env = with pkgs.rustChannels.stable; [
|
||||
rust
|
||||
cargo
|
||||
];
|
||||
|
|
|
@ -30,7 +30,7 @@ libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore"
|
|||
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
||||
libimagentryedit = { version = "0.9.0", path = "../../../lib/entry/libimagentryedit" }
|
||||
|
||||
mdcat = { version = "0.8", optional = true }
|
||||
mdcat = { version = "0.11", optional = true }
|
||||
|
||||
[dependencies.pulldown-cmark]
|
||||
version = "^0.1"
|
||||
|
|
|
@ -22,10 +22,9 @@ use std::io::Write;
|
|||
use libimagstore::store::Entry;
|
||||
use libimagrt::runtime::Runtime;
|
||||
|
||||
use mdcat::{ResourceAccess, Terminal, TerminalSize};
|
||||
use mdcat::{AnsiTerminal, ResourceAccess, TerminalSize};
|
||||
use pulldown_cmark::Parser;
|
||||
use syntect::parsing::SyntaxSet;
|
||||
use mdcat;
|
||||
|
||||
use viewer::Viewer;
|
||||
use failure::Fallible as Result;
|
||||
|
@ -34,7 +33,6 @@ use failure::Error;
|
|||
pub struct MarkdownViewer<'a> {
|
||||
rt: &'a Runtime<'a>,
|
||||
resource_access: ResourceAccess,
|
||||
terminal: Terminal,
|
||||
termsize: TerminalSize,
|
||||
}
|
||||
|
||||
|
@ -43,7 +41,6 @@ impl<'a> MarkdownViewer<'a> {
|
|||
MarkdownViewer {
|
||||
rt,
|
||||
resource_access: ResourceAccess::LocalOnly,
|
||||
terminal: Terminal::detect(),
|
||||
termsize: TerminalSize::detect().unwrap_or(TerminalSize {
|
||||
width: 80,
|
||||
height: 20,
|
||||
|
@ -60,13 +57,15 @@ impl<'a> Viewer for MarkdownViewer<'a> {
|
|||
let base_dir = self.rt.rtp();
|
||||
let syntax_set = SyntaxSet::load_defaults_newlines();
|
||||
|
||||
mdcat::push_tty(sink,
|
||||
self.terminal.clone(),
|
||||
let mut term = AnsiTerminal::new(sink);
|
||||
|
||||
::mdcat::push_tty(&mut term,
|
||||
self.termsize.clone(),
|
||||
parser,
|
||||
base_dir,
|
||||
self.resource_access.clone(),
|
||||
syntax_set)
|
||||
.map_err(|e| e.compat())
|
||||
.map_err(Error::from)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,20 @@ pub fn is_integer<A: AsRef<str>>(s: A) -> Result<(), String> {
|
|||
i.map(|_| ()).map_err(|_| format!("Not an integer: {}", s.as_ref()))
|
||||
}
|
||||
|
||||
pub fn is_float<A: AsRef<str>>(s: A) -> Result<(), String> {
|
||||
use std::str::FromStr;
|
||||
|
||||
let i : Result<f64, _> = FromStr::from_str(s.as_ref());
|
||||
i.map(|_| ()).map_err(|_| format!("Not an float: {}", s.as_ref()))
|
||||
}
|
||||
|
||||
pub fn is_bool<A: AsRef<str>>(s: A) -> Result<(), String> {
|
||||
use std::str::FromStr;
|
||||
|
||||
let i : Result<bool, _> = FromStr::from_str(s.as_ref());
|
||||
i.map(|_| ()).map_err(|_| format!("Not an bool: {}", s.as_ref()))
|
||||
}
|
||||
|
||||
pub fn is_url<A: AsRef<str>>(s: A) -> Result<(), String> {
|
||||
use url::Url;
|
||||
Url::parse(s.as_ref()).map(|_| ()).map_err(|_| format!("Not a URL: {}", s.as_ref()))
|
||||
|
|
|
@ -9,7 +9,7 @@ RED='\e[0;31m' # Red
|
|||
NORMAL='\e[0m' # Text Reset
|
||||
|
||||
if [ "1" != "$(grep -c '^Signed-off-by: ' "$1")" ]; then
|
||||
printf >&2 "%sMissing Signed-off-by line.%s\n" "$RED" "$NORMAL"
|
||||
echo -e >&2 "${RED}Missing Signed-off-by line.${NORMAL}\n"
|
||||
|
||||
# To not only warn, but abort the commit, uncomment the next line
|
||||
# exit 1
|
28
scripts/hooks/sendemail-validate.signoffby-missing-warn.sh
Normal file
28
scripts/hooks/sendemail-validate.signoffby-missing-warn.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# The following snippet can be used to _WARN_ if a Signed-off-by line is missing
|
||||
# in the commit message of the patch
|
||||
#
|
||||
# Use
|
||||
#
|
||||
# git config sendemail.validate true
|
||||
#
|
||||
# and link this script to your git hooks folder to enable.
|
||||
#
|
||||
|
||||
GREEN='\e[0;32m' # Green
|
||||
RED='\e[0;31m' # Red
|
||||
NORMAL='\e[0m' # Text Reset
|
||||
|
||||
GREPLINE="^Signed-off-by: $(git config user.name) <$(git config user.email)>"
|
||||
|
||||
if [ "$(grep -c "$GREPLINE" "$1")" -lt 1 ]; then
|
||||
echo -e >&2 "${RED}Missing Signed-off-by line.${NORMAL}\n"
|
||||
|
||||
# To not only warn, but abort the patch sending, uncomment the next line
|
||||
# exit 1
|
||||
else
|
||||
echo -e >&2 "${GREEN}Signed-off-by line found.${NORMAL}\n"
|
||||
fi
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Helper script to create a new crate in the imag workspace
|
||||
|
||||
# 1. Creates a new crate
|
||||
# 2. Adds the required crate meta information
|
||||
# 3. Sets the version of the crate to the same version as libimagstore
|
||||
# 4. Adds the crate to the top-level workspace
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]];
|
||||
then
|
||||
echo "$0 [bin|lib] ./path/to/new/crate"
|
||||
echo
|
||||
echo "Execute _only_ from the top level of the repository"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
crate_type="$1"
|
||||
crate_location="$2"
|
||||
|
||||
exit_if_empty() {
|
||||
[[ -z "$1" ]] && { echo "$2 not passed"; exit 1; }
|
||||
}
|
||||
|
||||
exit_if_empty "$crate_type" "crate type"
|
||||
exit_if_empty "$crate_location" "crate location"
|
||||
|
||||
exists_cmd() {
|
||||
command -v $1 || { echo "No $1 found"; exit 1; }
|
||||
}
|
||||
|
||||
exists_cmd "git"
|
||||
exists_cmd "cargo"
|
||||
|
||||
{ cat ./Cargo.toml 2>/dev/null | head -n 1 | grep -q "[workspace]"; } || {
|
||||
echo "Not in root of repository as it seems. Exiting";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
[[ "$crate_type" == "lib" || "$crate_type" == "bin" ]] || {
|
||||
echo "Invalid crate type, use 'lib' or 'bin'";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if [[ -e "$crate_location" ]]; then
|
||||
echo "Crate exists: $crate_location"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
IFS=/ read -ra crate_name_parts <<< "$crate_location"
|
||||
crate_name="${crate_name_parts[-1]}"
|
||||
|
||||
if [[ "$crate_type" == "lib" ]];
|
||||
then
|
||||
crate_description="Library for the imag core distribution"
|
||||
else if [[ "$crate_type" == "bin" ]]; then
|
||||
crate_description="Part of the imag core distribution: $crate_name command"
|
||||
fi
|
||||
|
||||
git_name="$(git config user.name)"
|
||||
git_email="$(git config user.email)"
|
||||
|
||||
store="lib/core/libimagstore/Cargo.toml"
|
||||
crate_version=$(grep -m 1 version $store | cut -d '"' -f 2)
|
||||
|
||||
echo "Crate type: $crate_type"
|
||||
echo "Crate location: $crate_location"
|
||||
echo "Crate name: $crate_name"
|
||||
echo "Crate version: $crate_version"
|
||||
echo "Crate description: $crate_description"
|
||||
echo "Crate author: $git_name <$git_email>"
|
||||
|
||||
echo "Not doing anything as this script is not ready yet."
|
||||
echo "Exiting now"
|
||||
exit 1
|
||||
|
||||
pushd "$(dirname $crate_location)"
|
||||
crate new --${crate_type} $crate_name
|
||||
|
||||
cat <<EOS > ./$crate_name/Cargo.toml
|
||||
[package]
|
||||
name = "$crate_name"
|
||||
version = "$crate_version"
|
||||
authors = ["$git_name <$git_email>"]
|
||||
|
||||
description = "$crate_description"
|
||||
|
||||
keywords = ["imag", "PIM", "personal", "information", "management"]
|
||||
readme = "../../../README.md"
|
||||
license = "LGPL-2.1"
|
||||
|
||||
documentation = "https://imag-pim.org/doc/"
|
||||
repository = "https://github.com/matthiasbeyer/imag"
|
||||
homepage = "http://imag-pim.org"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "matthiasbeyer/imag" }
|
||||
is-it-maintained-issue-resolution = { repository = "matthiasbeyer/imag" }
|
||||
is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
|
||||
maintenance = { status = "actively-developed" }
|
||||
|
||||
[dependencies]
|
||||
|
||||
EOS
|
||||
|
||||
echo "Cargo.toml written. Please make sure that the README has the right path!"
|
||||
popd
|
||||
|
||||
git add ${crate_location}/*
|
||||
|
||||
sed -i "$ s/]/ \"${crate_location}\",\n]/" Cargo.toml
|
||||
echo "Top-level Cargo.toml modified. Please sort crate list manually!"
|
||||
|
Loading…
Reference in a new issue