Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

get docker fixes into master #82

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
services:
- docker

dist: trusty
dist: xenial

jobs:
include:
- stage: "All"
name: "Tests"
install: docker pull holochain/holochain-cmd:latest
install: docker pull holochain/holochain-cmd:develop
script:
- . docker/run-ci
- . docker/run-ci
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ authors = ["Holochain Core Dev Team <[email protected]>"]

[dependencies]
holochain_core = { git = "https://github.com/holochain/holochain-rust", branch = "develop" }
holochain_core_types = { git = "https://github.com/holochain/holochain-rust", branch = "develop" }
holochain_dna = { git = "https://github.com/holochain/holochain-rust", branch = "develop" }
holochain_agent = { git = "https://github.com/holochain/holochain-rust", branch = "develop" }
holochain_cas_implementations = { git = "https://github.com/holochain/holochain-rust", branch = "develop" }
structopt = "0.2"
failure = "^0.1"
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Holochain Command Line Tools

## Repo Contents Moved!

NOTE: This repo has now been merged into [holochain-rust](https://github.com/holochain/holochain-rust/tree/develop/cmd)

[![Project](https://img.shields.io/badge/project-holochain-blue.svg?style=flat-square)](http://holochain.org/)
[![PM](https://img.shields.io/badge/pm-waffle-blue.svg?style=flat-square)](https://waffle.io/holochain/org)
[![Chat](https://img.shields.io/badge/chat-chat%2eholochain%2enet-blue.svg?style=flat-square)](https://chat.holochain.net)
Expand All @@ -8,6 +12,10 @@ This repo provides a set of tools for building and running Holochain DNA from th

## Install

Our recommended pattern for the installation of `hc` command line tools is to use the Developer Preview release that you can find here, along with its instructions: https://github.com/holochain/app-spec-rust/releases/tag/v0.0.1-dev-preview. Otherwise, you can proceed with the more complex instructions for building from source, below.

### Building From Source

These dependencies need to be installed in order to compile, and use `holochain-cmd`:

- [Rust](https://www.rust-lang.org/en-US/install.html)
Expand Down Expand Up @@ -59,10 +67,10 @@ $ cd your_app_name
We now have the empty shell of a Holochain app. From here, we will want to generate at least one Zome.
To do this, run the following, replacing `your_zome_name` with a name related to the functionality you wish to develop. For example: `users`.
```shell
$ hc generate zomes/your_zome_name rust
$ hc generate zomes/your_zome_name
```

Currently, Zomes can be generated as `rust`. In the future, you may be able to generate zomes in another language. `hc generate` scaffolds the files and config you need to get started.
Currently, only Zomes written in Rust can be generated. In the future, you may be able to generate Zomes in another language. `hc generate` scaffolds the files and config you need to get started.

What this did is generate a new folder under `zomes` called `users`. Here is the folder structure of it.
- users
Expand Down
10 changes: 7 additions & 3 deletions docker/Dockerfile.holochain-cmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
FROM holochain/holochain-rust:develop

RUN apt-get update && apt-get install --yes \
qtdeclarative5-dev \
libqt5websockets5-dev
libreadline6-dev \
software-properties-common

USER root
# Install latest version of QT needed for hcshell
RUN add-apt-repository ppa:beineri/opt-qt-5.11.1-xenial
RUN apt-get update
RUN apt-get --yes install qt511-meta-full
RUN printf "/opt/qt511/bin\n/opt/qt511/lib" > /etc/xdg/qtchooser/default.conf

RUN rustup toolchain install nightly-x86_64-unknown-linux-gnu
RUN rustup toolchain install nightly-2018-07-17-x86_64-unknown-linux-gnu
Expand Down
2 changes: 1 addition & 1 deletion docker/build
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker build -f docker/Dockerfile.holochain-cmd -t holochain/holochain-cmd:latest "$@" .
docker build -f docker/Dockerfile.holochain-cmd -t holochain/holochain-cmd:develop "$@" .
2 changes: 1 addition & 1 deletion docker/entry
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ -n "$HOST_UID" ]; then
groupmod -g "$HOST_UID" holochain
usermod -g "$HOST_UID" holochain
chown -R -h "$HOST_UID":"$HOST_UID" /home/holochain
chown -R -h "$HOST_UID":"$HOST_UID" /home/holochain/*
chown -R -h "$HOST_UID":"$HOST_UID" /home/holochain/*
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion docker/run
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ docker run -h holochain \
-v `pwd`:/holochain/holochain-cmd \
-u root:root \
-v $HOME/.cargo/registry:/home/holochain/.cargo/registry \
--rm -it holochain/holochain-cmd:latest ./holochain-cmd/docker/entry "$@"
--rm -it holochain/holochain-cmd:develop ./holochain-cmd/docker/entry "$@"
9 changes: 7 additions & 2 deletions docker/update
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
#rustup default nightly

cd /holochain/holochain-cmd
git reset --hard
git pull
git submodule init
git submodule update
cargo update

cd /holochain/holosqape
git reset --hard
git pull
git submodule init
git submodule update
Expand All @@ -18,13 +22,14 @@ cd /holochain/holosqape/holochain-rust
cargo update
cargo +$TOOLS_NIGHTLY build --release


echo "COMPILING HOLOSQAPE BINDINGS"
cd /holochain/holosqape/bindings
qmake
make clean
qmake CONFIG+=release
make

echo "COMPILING hcshell"
cd /holochain/holosqape/hcshell
make clean
qmake CONFIG+=release
make
13 changes: 7 additions & 6 deletions src/cli/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ mod tests {
.assert()
.success();

Command::main_binary()
.unwrap()
.current_dir(&tmp.path())
.args(&["g", "zomes/zubblebat", "assemblyscript"])
.assert()
.success();
// TODO: We cannot test this since there is no complete implementation of hdk-assemblyscript
// Command::main_binary()
// .unwrap()
// .current_dir(&tmp.path())
// .args(&["g", "zomes/zubblebat", "assemblyscript"])
// .assert()
// .success();

}
}
41 changes: 21 additions & 20 deletions src/cli/package.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use base64;
use cli::test_context::test_context;
use colored::*;
use config_files::Build;
use error::DefaultResult;
use holochain_core::nucleus::{ribosome, ZomeFnCall};
use ignore::WalkBuilder;
use holochain_core::{
nucleus::{
ribosome, ZomeFnCall,
},
};
use cli::test_context::test_context;
use serde_json::{self, Map, Value};
use std::{
fs::{self, File},
Expand Down Expand Up @@ -147,23 +143,24 @@ impl Packager {
// We need to setup a shallow test context which actually is not needed
// here so it doesn't matter what is in there.
// TODO: extract core of run_dna() into a function that does not need a context
let context= test_context("HC");
let context = test_context("HC");
// We just call into __hdk_get_json_definition() without any arguments.
// What we get back is a JSON string with all the entry types and zome functions
// defined in that WASM code, constructed through our Rust macros define_zome!
// and entry!.
let call_result = ribosome::run_dna(
&"HC",
"HC",
context,
wasm_binary,
&ZomeFnCall::new(&"", &"", &"__hdk_get_json_definition", &""),
Some("{}".as_bytes().to_vec())
&ZomeFnCall::new("", "", "__hdk_get_json_definition", ""),
Some("{}".as_bytes().to_vec()),
)?;
let json_from_wasm: Map<String, Value> = serde_json::from_str(&call_result)?;
let json_from_wasm: Map<String, Value> = serde_json::from_str(&call_result.to_string())?;

let mut sub_tree_content = self.bundle_recurse(&node)?;
for key in json_from_wasm.keys() {
sub_tree_content.insert(key.clone(), json_from_wasm.get(key).unwrap().clone());
sub_tree_content
.insert(key.clone(), json_from_wasm.get(key).unwrap().clone());
}

// here insert json generated by the wasm, alongside the rest of the sub-tree
Expand Down Expand Up @@ -340,7 +337,8 @@ mod tests {
"unpack",
DEFAULT_BUNDLE_FILE_NAME,
temp_dir_path.to_str().unwrap(),
]).assert()
])
.assert()
.success();
}

Expand Down Expand Up @@ -394,7 +392,8 @@ mod tests {
"unpack",
bundle_file_path.to_str().unwrap(),
dest_path.to_str().unwrap(),
]).assert()
])
.assert()
.success();

// Assert for equality
Expand All @@ -421,12 +420,14 @@ mod tests {
.assert()
.success();

Command::main_binary()
.unwrap()
.current_dir(&tmp.path())
.args(&["g", "zomes/zubblebat", "assemblyscript"])
.assert()
.success();
// TODO: We cannot test this since there is no complete implementation of hdk-assemblyscript
//
// Command::main_binary()
// .unwrap()
// .current_dir(&tmp.path())
// .args(&["g", "zomes/zubblebat", "assemblyscript"])
// .assert()
// .success();

Command::main_binary()
.unwrap()
Expand Down
24 changes: 13 additions & 11 deletions src/cli/scaffold/rust/Cargo.template.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
[package]
name = <<NAME>>
version = "0.1.0"
authors = <<AUTHORS>>
edition = <<EDITION>>
name = <<NAME>>
version = "0.1.0"
authors = <<AUTHORS>>
edition = <<EDITION>>

[dependencies]
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
hdk = { git = "https://github.com/holochain/holochain-rust" , branch = "master" }
holochain_wasm_utils = { git = "https://github.com/holochain/holochain-rust" , branch = "master" }
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
hdk = { git = "https://github.com/holochain/holochain-rust" , branch = "develop" }
holochain_wasm_utils = { git = "https://github.com/holochain/holochain-rust" , branch = "develop" }

[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]
path = "src/lib.rs"
crate-type = ["cdylib"]
9 changes: 9 additions & 0 deletions src/cli/scaffold/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#[macro_use]
extern crate hdk;
#[macro_use]
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;

// see https://holochain.github.io/rust-api/0.0.1/hdk/ for info on using the hdk library

define_zome! {
entries: []

genesis: || { Ok(()) }

functions: {}
}
Loading