summaryrefslogtreecommitdiffstats
path: root/imag-store
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-03-13 20:49:26 +0100
committerMatthias Beyer <mail@beyermatthias.de>2016-03-19 14:47:45 +0100
commitb8b49b32408ba34db2102ebd2d2462879b04dd08 (patch)
treed8fb15df93660300ce7ceefb182fdbf516872428 /imag-store
parent8c0c53124b71b206b923c5bfe30a3e82d231a58d (diff)
Move: build_entry_path() from imag-store to libimagstore
Diffstat (limited to 'imag-store')
-rw-r--r--imag-store/src/create.rs2
-rw-r--r--imag-store/src/delete.rs3
-rw-r--r--imag-store/src/retrieve.rs3
-rw-r--r--imag-store/src/update.rs2
-rw-r--r--imag-store/src/util.rs30
5 files changed, 4 insertions, 36 deletions
diff --git a/imag-store/src/create.rs b/imag-store/src/create.rs
index 03164581..5306ad62 100644
--- a/imag-store/src/create.rs
+++ b/imag-store/src/create.rs
@@ -13,10 +13,10 @@ use clap::ArgMatches;
use libimagrt::runtime::Runtime;
use libimagstore::store::Entry;
use libimagstore::store::EntryHeader;
+use libimagstore::storeid::build_entry_path;
use error::StoreError;
use error::StoreErrorKind;
-use util::build_entry_path;
use util::build_toml_header;
type Result<T> = RResult<T, StoreError>;
diff --git a/imag-store/src/delete.rs b/imag-store/src/delete.rs
index d645f743..182dad49 100644
--- a/imag-store/src/delete.rs
+++ b/imag-store/src/delete.rs
@@ -1,9 +1,8 @@
use std::path::PathBuf;
+use libimagstore::storeid::build_entry_path;
use libimagrt::runtime::Runtime;
-use util::build_entry_path;
-
pub fn delete(rt: &Runtime) {
use std::process::exit;
diff --git a/imag-store/src/retrieve.rs b/imag-store/src/retrieve.rs
index 2c0d19c5..6a00dfc2 100644
--- a/imag-store/src/retrieve.rs
+++ b/imag-store/src/retrieve.rs
@@ -6,10 +6,9 @@ use clap::ArgMatches;
use toml::Value;
use libimagstore::store::FileLockEntry;
+use libimagstore::storeid::build_entry_path;
use libimagrt::runtime::Runtime;
-use util::build_entry_path;
-
pub fn retrieve(rt: &Runtime) {
rt.cli()
.subcommand_matches("retrieve")
diff --git a/imag-store/src/update.rs b/imag-store/src/update.rs
index 25f1cd92..2a017c94 100644
--- a/imag-store/src/update.rs
+++ b/imag-store/src/update.rs
@@ -2,8 +2,8 @@ use std::path::PathBuf;
use std::ops::DerefMut;
use libimagrt::runtime::Runtime;
-use util::build_toml_header;
use util::build_entry_path;
+use util::build_toml_header;
pub fn update(rt: &Runtime) {
rt.cli()
diff --git a/imag-store/src/util.rs b/imag-store/src/util.rs
index 9fb01720..61832e3a 100644
--- a/imag-store/src/util.rs
+++ b/imag-store/src/util.rs
@@ -10,36 +10,6 @@ use libimagstore::store::EntryHeader;
use libimagrt::runtime::Runtime;
use libimagutil::key_value_split::IntoKeyValue;
-pub fn build_entry_path(rt: &Runtime, path_elem: &str) -> PathBuf {
- debug!("Checking path element for version");
- {
- let contains_version = {
- path_elem.split("~")
- .last()
- .map(|version| Version::parse(version).is_ok())
- .unwrap_or(false)
- };
-
- if !contains_version {
- debug!("Version cannot be parsed inside {:?}", path_elem);
- warn!("Path does not contain version. Will panic now!");
- panic!("No version in path");
- }
- }
- debug!("Version checking succeeded");
-
- debug!("Building path from {:?}", path_elem);
- let mut path = rt.store().path().clone();
-
- if path_elem.chars().next() == Some('/') {
- path.push(&path_elem[1..path_elem.len()]);
- } else {
- path.push(path_elem);
- }
-
- path
-}
-
pub fn build_toml_header(matches: &ArgMatches, mut header: EntryHeader) -> EntryHeader {
debug!("Building header from cli spec");
if let Some(headerspecs) = matches.values_of("header") {