Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
added HC_SCAFFOLD_VERSION env var
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Feb 14, 2019
1 parent 6f1f581 commit 11faf75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
10 changes: 8 additions & 2 deletions cli/src/cli/scaffold/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
error::DefaultResult,
util,
};
use holochain_common::env_vars::EnvVar;
use holochain_wasm_utils::wasm_target_dir;
use std::{
fs::{self, OpenOptions},
Expand All @@ -27,8 +28,13 @@ fn generate_cargo_toml(name: &str, contents: &str) -> DefaultResult<String> {

let authors_default = Value::from("[\"TODO\"]");
let edition_default = Value::from("\"TODO\"");
// does this need changing? maybe a tag instead?
let version_default = String::from("branch = \"develop\"");

let maybe_version = EnvVar::ScaffoldVersion.value().ok();
let version_default = if maybe_version.is_some() {
maybe_version.unwrap()
} else {
String::from("tag = \"v0.0.4-alpha\"")
};
let maybe_package = config.get("package");

let name = Value::from(name);
Expand Down
6 changes: 2 additions & 4 deletions cli/src/cli/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ pub mod tests {
#[test]
// flagged as broken for:
// 1. taking 60+ seconds
// 2. because `generate_cargo_toml` in cli/src/scaffold/rust.rs sets the
// branch to a fixed value rather than develop and currently there's no way to
// adjust that on the fly.
// 3. because holochain-nodejs version doesn't exist yet
// NOTE, before re-enabling make sure to add an environment variable
// HC_SCAFFOLD_VERSION='branch="develop"' when you run the test.
#[cfg(feature = "broken-tests")]
fn test_command_basic_test() {
let temp_dir = gen_dir();
Expand Down
5 changes: 5 additions & 0 deletions common/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
//! - **NETWORKING_CONFIG_FILE** *string* Path to a JSON file containing configuration for the n3h networking module. More on this soon. Recommended to
//! not use this as this time.
//!
//! ### `hc generate`
//! - HC_SCAFFOLD_VERSION allows you to set a string value to be used in the generated Cargo.toml. We use this override the default which points to the current version tag, which a pointer to the develop branch for our CI tests, so for example in CI we can run our tests with: `HC_SCAFFOLD_VERSION='branch="develop"'` and that overrides the default.
//!
//! ### Other
//! - **HC_SIMPLE_LOGGER_MUTE** *int* Setting this value to 1 will silence the log output of a SimpleLogger. Use with any Conductor.

Expand All @@ -36,6 +39,7 @@ pub enum EnvVar {
N3hBootstrapNode,
NetworkingConfigFile,
SimpleLoggerMute,
ScaffoldVersion,
}

impl EnvVar {
Expand All @@ -49,6 +53,7 @@ impl EnvVar {
EnvVar::N3hBootstrapNode => "HC_N3H_BOOTSTRAP_NODE",
EnvVar::NetworkingConfigFile => "NETWORKING_CONFIG_FILE",
EnvVar::SimpleLoggerMute => "HC_SIMPLE_LOGGER_MUTE",
EnvVar::ScaffoldVersion => "HC_SCAFFOLD_VERSION",
}
}

Expand Down

0 comments on commit 11faf75

Please sign in to comment.