List of commits:
Subject Hash Author Date (UTC)
Fix `dep_config::scan`. ed8759345a07e93b30bd802b1e6ecb8d5eeb3b85 Jan Allersma 2019-01-18 14:53:50
Fix fetching with single-file-modules. d1a2173433bf45648da9a85cda04d7ace9148439 Jan Allersma 2019-01-15 16:24:27
Add feature: initialize hidden dependencies. fc99666c48da1653b3097a0251d8219bc49886cb Jan Allersma 2019-01-12 15:52:45
Revise `hide` command. 482bad08f949eaedbd61e2cb7c53870271d47997 Jan Allersma 2019-01-11 15:45:26
Rename project to 'Ambassade'. 4f9c0e27ca25042a97acebc9f3282e4f941706fe Jan Allersma 2019-01-10 15:01:39
Git integration. 0ebc5b3769e50c3463bdc39af0160c7db0d3f00b Jan Allersma 2019-01-03 17:34:18
Implement `hide` command. ab693b8fd91c93dfd7ee7b82cbae75b2a6043b0f Jan Allersma 2018-12-29 15:13:25
Resolve missing/erroneous build/run commands. e81d57882036a6475718b0653169c609d23b1c30 Jan Allersma 2018-12-25 13:06:00
Show working directory in status. ab188603dda062de4b2ea76c5bc1d2d41d98b8c2 Jan Allersma 2018-12-25 10:36:35
Add shell fallthrough. 02078135791fb3889152c11defaa2df21d0ae597 Jan Allersma 2018-12-22 19:47:36
Show dependencies when using `delete` command. cfa9779714d5e6d46ab5b4eeb84a915a15f23f54 Jan Allersma 2018-12-20 15:46:05
Resolve dep-tree by building project recursively. f53e38d790ec67d99ec8204af97273a53b73a9dc Jan Allersma 2018-12-19 14:54:07
Improve `dep-tree` command. 90bfa0340b7b874d65c08dc05c3d711abda1c469 Jan Allersma 2018-12-17 20:10:14
Implement experimental `dep-tree` command. 45d9dfdbfc99c59174e7c587621276b78ab7a4e9 Jan Allersma 2018-12-14 16:11:53
Implement `add` command. bbb2544bd06f29866465d651c32ca4d6e017f5e9 Jan Allersma 2018-12-11 15:43:10
Implement `exe` command. 1eaa36242201cf7ade5f23a14340e630c267db07 Jan Allersma 2018-12-11 13:23:32
Implement `run` and `build` commands. 14e9e25b6a06f587c1a50829e72c829ae59a87c2 Jan Allersma 2018-12-10 20:57:08
Implement non-recursive dependency check. 5ffd40604755d1c2dde9353c74f06a006deea33c Jan Allersma 2018-12-07 20:50:42
Restructure project. c2d98caf7897e87284fb2891e1d4b92d14cf37e1 Jan Allersma 2018-12-06 16:20:46
Initial commit. 4c152d55edc20ac55fd749a2b32b204134a664e3 Jan Allersma 2018-12-05 17:03:08
Commit ed8759345a07e93b30bd802b1e6ecb8d5eeb3b85 - Fix `dep_config::scan`.
* Remove obsolete functions.
* Use names instead of paths to refer to dependencies.
* Add function to build from path.
Author: Jan Allersma
Author date (UTC): 2019-01-18 14:53
Committer name: Jan Allersma
Committer date (UTC): 2019-01-18 14:56
Parent(s): d1a2173433bf45648da9a85cda04d7ace9148439
Signing key:
Tree: 6cf5b7dea6edd703b568db25a14919a00c6d1dbf
File Lines added Lines deleted
README.md 2 0
src/backend/build.rs 8 13
src/backend/dep.rs 2 2
src/backend/dep_config.rs 20 6
src/backend/fetch.rs 12 4
src/backend/filesystem.rs 1 24
src/backend/project.rs 1 1
File README.md changed (mode: 100644) (index 5b5fa7c..d8d7c61)
5 5 `backend::fetch::update_module()` kan wellicht met `backend::add::update_module()` samengevoegd worden. `backend::fetch::update_module()` kan wellicht met `backend::add::update_module()` samengevoegd worden.
6 6
7 7 Missing feature in `backend::git::ignore` (see [related file](src/backend/git/ignore.rs)). Missing feature in `backend::git::ignore` (see [related file](src/backend/git/ignore.rs)).
8
9 Een threadpool om iedere dep apart mee te runnen.
File src/backend/build.rs changed (mode: 100644) (index 41102be..0181652)
... ... use std::result::Result;
4 4 use std::path::PathBuf; use std::path::PathBuf;
5 5
6 6 pub fn build(dep_name: String) -> Result<String, String> { pub fn build(dep_name: String) -> Result<String, String> {
7 let dep_path = match super::filesystem::search_current_module_root(dep_name.clone()) {
8 Ok(path) => path,
9 Err(e) => return Err(e.to_string())
10 };
11
12 let config_path = match super::dep_config::scan(dep_name) {
7 let config_path = match super::dep_config::scan(dep_name.clone()) {
13 8 Ok(path) => path, Ok(path) => path,
14 9 Err(e) => return Err(e) Err(e) => return Err(e)
15 10 }; };
 
... ... pub fn build(dep_name: String) -> Result<String, String> {
24 19 Err(e) => return Err(e) Err(e) => return Err(e)
25 20 } }
26 21
27 match build_module(dep_path, config) {
22 match build_module(dep_name, config) {
28 23 Ok(result) => println!("{}", result), Ok(result) => println!("{}", result),
29 24 Err(e) => return Err(e) Err(e) => return Err(e)
30 25 } }
 
... ... pub fn build_rec(config_file: PathBuf) -> Result<String, String> {
61 56 } }
62 57
63 58 #[cfg(target_os="linux")] #[cfg(target_os="linux")]
64 fn build_module(config_path: PathBuf, config_value: serde_json::Value) -> Result<String, String> {
59 fn build_module(dep_name: String, config_value: serde_json::Value) -> Result<String, String> {
65 60 println!("Building module.."); println!("Building module..");
66 61
67 62 let build_cmd = &config_value["build"]["linux"]; let build_cmd = &config_value["build"]["linux"];
 
... ... fn build_module(config_path: PathBuf, config_value: serde_json::Value) -> Result
70 65 return Err(String::from("ambassade.json: 'build->linux' should be a string.")); return Err(String::from("ambassade.json: 'build->linux' should be a string."));
71 66 } }
72 67
73 super::fetch::build(config_path, String::from(build_cmd.as_str().unwrap()))
68 super::fetch::build(dep_name, String::from(build_cmd.as_str().unwrap()))
74 69 } }
75 70
76 71 #[cfg(target_os="macos")] #[cfg(target_os="macos")]
77 fn build_module(config_path: PathBuf, config_value: serde_json::Value) -> Result<String, String> {
72 fn build_module(dep_name: String, config_value: serde_json::Value) -> Result<String, String> {
78 73 println!("Building module.."); println!("Building module..");
79 74
80 75 let build_cmd = &config_value["build"]["os-x"]; let build_cmd = &config_value["build"]["os-x"];
 
... ... fn build_module(config_path: PathBuf, config_value: serde_json::Value) -> Result
83 78 return Err(String::from("ambassade.json: 'build->os-x' should be a string.")); return Err(String::from("ambassade.json: 'build->os-x' should be a string."));
84 79 } }
85 80
86 super::fetch::build(config_path, String::from(build_cmd.as_str().unwrap()))
81 super::fetch::build(dep_name, String::from(build_cmd.as_str().unwrap()))
87 82 } }
88 83
89 84 #[cfg(target_os="windows")] #[cfg(target_os="windows")]
90 fn build_module(config_path: PathBuf, config_value: serde_json::Value) -> Result<String, String> {
85 fn build_module(dep_name: String, config_value: serde_json::Value) -> Result<String, String> {
91 86 println!("Building module.."); println!("Building module..");
92 87
93 88 let build_cmd = &config_value["build"]["windows"]; let build_cmd = &config_value["build"]["windows"];
 
... ... fn build_module(config_path: PathBuf, config_value: serde_json::Value) -> Result
96 91 return Err(String::from("ambassade.json: 'build->windows' should be a string.")); return Err(String::from("ambassade.json: 'build->windows' should be a string."));
97 92 } }
98 93
99 super::fetch::build(config_path, String::from(build_cmd.as_str().unwrap()))
94 super::fetch::build(dep_name, String::from(build_cmd.as_str().unwrap()))
100 95 } }
File src/backend/dep.rs changed (mode: 100644) (index 530863b..89d0e3b)
... ... fn dir_check(dependency: String, command: String) -> Result<String, String> {
192 192
193 193 match dir { match dir {
194 194 Ok(mut dep_dir) => { Ok(mut dep_dir) => {
195 dep_dir.push(dependency);
195 dep_dir.push(dependency.clone());
196 196 if !dep_dir.exists() { if !dep_dir.exists() {
197 197 dep_dir.pop(); dep_dir.pop();
198 return super::fetch::build(dep_dir, command);
198 return super::fetch::build_from_path(dependency, command, dep_dir);
199 199 } }
200 200 Ok(String::from("Dependency found.")) Ok(String::from("Dependency found."))
201 201 }, },
File src/backend/dep_config.rs changed (mode: 100644) (index 23b9f70..c8ea53b)
... ... pub fn scan(dep_name: String) -> Result<PathBuf, String> {
31 31 return Ok(config_path); return Ok(config_path);
32 32 } }
33 33
34 match super::filesystem::get_current_project_root() {
34 let project_path = match super::filesystem::get_current_project_root() {
35 35 Some(mut path) => { Some(mut path) => {
36 36 if String::from(path.file_name().unwrap().to_str().unwrap()) == dep_name { if String::from(path.file_name().unwrap().to_str().unwrap()) == dep_name {
37 37 println!("Project name equals dep name. Taking project's configfile..."); println!("Project name equals dep name. Taking project's configfile...");
38 38 path.push("ambassade.json"); path.push("ambassade.json");
39 39 return Ok(path); return Ok(path);
40 } else {
41 path
40 42 } }
41 43 }, },
42 None => println!("Couldn't find current project root. Skipped in scan.")
43 }
44 None => return Err(String::from("Not in a project (sub)directory."))
45 };
44 46
45 47 match super::filesystem::get_current_dep_root() { match super::filesystem::get_current_dep_root() {
46 48 Ok(mut path) => { Ok(mut path) => {
47 path.push(dep_name);
48 match super::config::get_json_from_dir(path.clone()) { // Inconventient, should be changed later
49 path.push(dep_name.clone());
50 path.push("ambassade.json");
51 match super::config::get_json(&path) { // Inconventient, should be changed later
49 52 Ok(_) => Ok(path), Ok(_) => Ok(path),
50 Err(e) => Err(e)
53 _ => {
54 match super::config::get_json_from_dir(project_path) {
55 Ok(json) => match super::dep::check(json) {
56 Ok(result) => {
57 println!("{}", result);
58 return scan(dep_name);
59 },
60 Err(e) => return Err(e)
61 },
62 Err(e) => return Err(e)
63 }
64 }
51 65 } }
52 66 }, },
53 67 Err(e) => Err(e.to_string()) Err(e) => Err(e.to_string())
File src/backend/fetch.rs changed (mode: 100644) (index eb413a0..fc1b9c6)
... ... use std::process::{Command, Stdio};
5 5 use std::path::PathBuf; use std::path::PathBuf;
6 6 use std::result::Result; use std::result::Result;
7 7
8 pub fn build(dep: PathBuf, mut command: String) -> Result<String, String> {
9 let dep_name = String::from(dep.file_name().unwrap().to_str().unwrap());
10
8 pub fn build_from_path(dep_name: String, mut command: String, path: PathBuf) -> Result<String, String> {
11 9 if command == String::new() { if command == String::new() {
12 10 match set_command(&dep_name, true) { match set_command(&dep_name, true) {
13 11 Some(cmd) => command = cmd, Some(cmd) => command = cmd,
14 12 None => return Err(String::from("Fetching failed: no appropriate command set.")) None => return Err(String::from("Fetching failed: no appropriate command set."))
15 13 } }
16 14 } }
17 fetch(dep_name, dep, command)
15
16 fetch(dep_name, path, command)
17 }
18
19 pub fn build(dep_name: String, command: String) -> Result<String, String> {
20 match super::filesystem::get_current_project_root() {
21 Some(dir) => build_from_path(dep_name, command, dir),
22 None => return Err(String::from("Not in a project (sub)directory."))
23 }
18 24 } }
19 25
20 26 pub fn run(dep: PathBuf, mut command: String) -> Result<String, String> { pub fn run(dep: PathBuf, mut command: String) -> Result<String, String> {
 
... ... fn fetch(dep_name: String, mut path: PathBuf, command: String) -> Result<String,
41 47 } }
42 48 } }
43 49
50 println!("Running from {} ..", path.to_str().unwrap());
51
44 52 let out = Command::new(command) let out = Command::new(command)
45 53 .current_dir(&path) .current_dir(&path)
46 54 .args(args) .args(args)
File src/backend/filesystem.rs changed (mode: 100644) (index e3e8889..5190c5f)
1 use std::{path, env, fs, result};
1 use std::{path, env, fs};
2 2 use std::io::{Result, Error, ErrorKind}; use std::io::{Result, Error, ErrorKind};
3 3
4 4 fn get_root(mut path: path::PathBuf) -> Option<path::PathBuf> { fn get_root(mut path: path::PathBuf) -> Option<path::PathBuf> {
 
... ... pub fn get_dep_root(from_dir: path::PathBuf) -> Result<path::PathBuf> {
67 67 } }
68 68 } }
69 69
70 pub fn search_current_module_root(dep_name: String) -> result::Result<path::PathBuf, String> {
71 search_module_root(dep_name, env::current_dir().unwrap())
72 }
73
74 pub fn search_module_root(dep_name: String, from_dir: path::PathBuf) -> result::Result<path::PathBuf, String> {
75 let project_path = match get_project_root(from_dir.clone()) {
76 Some(path) => path,
77 None => return Err(String::from("No project folder found!"))
78 };
79
80 if dep_name == String::from(project_path.file_name().unwrap().to_str().unwrap()) {
81 return Ok(project_path);
82 }
83
84 match get_dep_root(from_dir) {
85 Ok(mut dir) => {
86 dir.push(dep_name);
87 Ok(dir)
88 },
89 Err(e) => Err(e.to_string())
90 }
91 }
92
93 70 pub fn get_dep_config_root() -> Result<path::PathBuf> { pub fn get_dep_config_root() -> Result<path::PathBuf> {
94 71 match get_current_project_root() { match get_current_project_root() {
95 72 Some(mut path) => { Some(mut path) => {
File src/backend/project.rs changed (mode: 100644) (index 22b03b2..d592263)
... ... pub fn build<I>(args: &mut I) -> Result<String, String> where I: Iterator<Item=S
26 26 None => Err(String::from("not in a project (sub)directory.")) None => Err(String::from("not in a project (sub)directory."))
27 27 } }
28 28 }, },
29 Some(_) | None => {
29 _ => {
30 30 match super::filesystem::get_current_project_root() { match super::filesystem::get_current_project_root() {
31 31 Some(dir) => super::build::build_rec(dir), Some(dir) => super::build::build_rec(dir),
32 32 None => Err(String::from("not in a project (sub)directory.")) None => Err(String::from("not in a project (sub)directory."))
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/kapstok/NHL-Beheer

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/kapstok/NHL-Beheer

Clone this repository using git:
git clone git://git.rocketgit.com/user/kapstok/NHL-Beheer

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main