Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucksus committed Dec 2, 2019
2 parents b510bcc + d71f3c8 commit f216fff
Show file tree
Hide file tree
Showing 13 changed files with 244 additions and 71 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,16 @@ Holoscape needs both binaries ouf the [holochain-rust](https://github.com/holoch

Depending on the OS, it expects to find either `hc-linux` and `holochain-linux` or `hc-darwin` and `holochain-darwin` in the application directory (the root of the repository during development).

For development you can either build those yourself or get them through Holonix like this:
For development you can either build those yourself or get them through nix-shell like this:

``` shell
$ nix-shell https://holochain.love
$ cp `which holochain` holochain-linux
$ cp `which hc` hc-linux
$ nix-shell https://github.com/holochain/holoscape/archive/develop.tar.gz --run holoscape
```
(or `holochain-darwin` for macOS - Windows is currently not support but will follow soon)

Don't forget to install all node dependencies:
``` shell
npm install
```
To flush all holoscape data with the nix shell:

```shell
$ nix-shell https://github.com/holochain/holoscape/archive/develop.tar.gz --run holoscape-flush

## Run for development
```
Expand Down
21 changes: 19 additions & 2 deletions conductor.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ module.exports = {
run = spawn(path.join(__dirname, "./holochain-linux"), ["-c", configPath], {env:{...process.env, RUST_BACKTRACE: 'full'}})
}
else {
log('error', "unsupported platform: "+process.platform)
return
log('error', "unsupported platform: "+process.platform)
return
}
run.stdout.on('data', data => {
log('info', data.toString())
Expand All @@ -85,5 +85,22 @@ module.exports = {
onExit()
})
return run
},

hasBinaries: () => {
let holochain, hc

if (process.platform === "win32") {
holochain = "./holochain.exe"
hc = "./hc.exe"
} else if (process.platform === "darwin") {
holochain = "./holochain-darwin"
hc = "./hc-darwin"
} else if (process.platform === "linux") {
holochain = "./holochain-linux"
hc = "./hc-linux"
}

return fs.existsSync(path.join(__dirname, holochain)) && fs.existsSync(path.join(__dirname, hc))
}
}
4 changes: 2 additions & 2 deletions config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

# can be any github ref
# branch, tag, commit, etc.
ref = "v0.0.39";
ref = "v0.0.47";

# the sha of what is downloaded from the above ref
# note: even if you change the above ref it will not be redownloaded until
# the sha here changes (the sha is the cache key for downloads)
# note: to get a new sha, get nix to try and download a bad sha
# it will complain and tell you the right sha
sha256 = "1c8jk9cmpayjy7bndymx5c7wshwgd7a2xqda4lvp2y7ds72i8jhz";
sha256 = "0fyal8y02abp71y0l3szcbc9d0r89ph5yk3d6maw28as78mw7v23";

# the github owner of the holonix repo
owner = "holochain";
Expand Down
25 changes: 11 additions & 14 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ let
) { config = config; };
# END HOLONIX IMPORT BOILERPLATE

# hopefully this won't be needed someday when holonix updates
newer-pkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/19.09.tar.gz";
sha256 = "0mhqhq21y5vrr1f30qd2bvydv4bbbslvyzclhw0kdxmkgg3z4c92";
}) { };

target-os = if holonix.pkgs.stdenv.isDarwin then "darwin" else "linux";
config-uri = if holonix.pkgs.stdenv.isDarwin then "Library/Application\\ Support" else ".config";

in
with holonix.pkgs;
Expand All @@ -33,27 +28,29 @@ with holonix.pkgs;
name = "dev-shell";

shellHook = holonix.pkgs.lib.concatStrings [''
ln -sf `command -v holochain` holochain-${target-os}
ln -sf `command -v hc` hc-${target-os}
npm install
export PATH="$PATH:$( npm bin )"
ln -sf ${holonix.holochain.holochain}/bin/holochain holochain-${target-os}
ln -sf ${holonix.holochain.hc}/bin/hc hc-${target-os}
${holonix.pkgs.nodejs}/bin/npm install
export PATH="$PATH:$( ${holonix.pkgs.nodejs}/bin/npm bin )"
''
holonix.shell.shellHook
];
HOLOSCAPE_CONFIG_URI = config-uri;

DEV="true";

buildInputs = [
holonix.pkgs.unzip
newer-pkgs.electron_6
holonix.pkgs.electron_6

(holonix.pkgs.writeShellScriptBin "holoscape" ''
electron .
${holonix.pkgs.electron_6}/bin/electron .
'')

(holonix.pkgs.writeShellScriptBin "holoscape-flush" ''
rm -rf $HOME/.config/holoscape
rm -rf $HOME/.config/Holoscape-default
set -euxo pipefail
rm -rf $HOME/${config-uri}/holoscape
rm -rf $HOME/${config-uri}/Holoscape-default
rm -rf ./Holoscape-linux-x64
rm -rf ./Holoscape-darwin-x64
rm -rf ./node_modules
Expand Down
4 changes: 2 additions & 2 deletions example-bundles/holofuel/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ bridges = []
[[instances]]
name = "holofuel"
id = "__holofuel"
dna_hash = "QmcnYu8B54tFnJUv68aB3imPRwLxqJH2DQzjkX9Dvxmsf9"
uri = "https://holo-host.github.io/holofuel/releases/download/v0.11.1-alpha1/holofuel.dna.json"
dna_hash = "QmdRUPDZ3xoZDJj2ciCX3Wk6eRPe9z6pnZpiVHK9cu6R6K"
uri = "https://holo-host.github.io/holofuel/releases/download/v0.13.0-alpha1/holofuel.dna.json"

[[UIs]]
name = "HoloFuel"
Expand Down
11 changes: 10 additions & 1 deletion holoscape.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class Holoscape {
{ type: 'separator' },
{ label: 'Install hApp...', click: ()=>this.installBundleWindow.show() },
{ type: 'separator' },
{ label: 'Quit', click: ()=>{this.shutdownConductor(); this.quitting=true; mb.app.quit()} }
{ label: 'Quit', click: ()=> this.quit() }
])
mb.tray.setToolTip('HoloScape')
mb.tray.setContextMenu(contextMenu)
Expand All @@ -300,6 +300,9 @@ class Holoscape {
if(level == 'error') console.error(message)
else console.log(message)
global.holoscape.logMessages.push({level, message})
while(global.holoscape.logMessages.length > 100) {
global.holoscape.logMessages.shift()
}
if(global.holoscape.logWindow && global.holoscape.logWindow.webContents) {
global.holoscape.logWindow.webContents.send('log', {level,message})
}
Expand Down Expand Up @@ -396,6 +399,12 @@ class Holoscape {
global.holoscape.checkConductorConnection()
})
}

quit() {
this.shutdownConductor()
this.quitting=true
mb.app.quit()
}
}

const systemTrayIconFull = () => {
Expand Down
2 changes: 1 addition & 1 deletion initial_conductor_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ instances = []

[logger]
type = "debug"
state_dump = true
state_dump = false

{{{networkConfigToml}}}

Expand Down
11 changes: 11 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@ app.on('window-all-closed', e => {
if(!global.holoscape.quitting) e.preventDefault()
})

app.on('before-quit', e => {
if(!global.holoscape.quitting) {
global.holoscape.quit()
}
})

mb.on('ready', async () => {
mb.tray.setImage(systemTrayIconEmpty())
global.holoscape = new Holoscape()
await global.holoscape.showSplashScreen()

if(!conductor.hasBinaries()) {
global.holoscape.splash.webContents.send('missing-binaries')
return
}

if(!conductor.hasConfig()) {
console.log("No conductor config found. Initializing...")
await new Promise((resolve)=>setTimeout(resolve, 1000))
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start:dev": "DEV=true electron .",
"build-mac": "electron-packager . Holoscape --platform=darwin --overwrite --icon=./images/HoloScape-hdpi.icns",
"build-linux": "electron-packager . Holoscape --platform=linux --overwrite --icon=./images/HoloScape-hdpi.png",
"delete:app-support": "rm -rf '/Users/philipbeadle/Library/Application Support/holoscape' && rm -rf '/Users/philipbeadle/Library/Application Support/Holoscape-default'"
"delete:app-support": "rm -rf '$HOME/Library/Application Support/holoscape' && rm -rf '$HOME/Library/Application Support/Holoscape-default'"
},
"author": "Holochain Core Dev Team <devcore@holochain.org>",
"license": "GPLv3",
Expand All @@ -33,7 +33,8 @@
"request": "^2.88.0",
"temp": "^0.9.0",
"toml": "^3.0.0",
"vue": "^2.6.10"
"vue": "^2.6.10",
"vue-chat-scroll": "^1.3.6"
},
"build": {
"appId": "org.holochain.holoscape",
Expand Down
3 changes: 3 additions & 0 deletions views/conductor_log.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
let {level, message} = store
message = convert.toHtml(message)
app.logs.push({level, message})
while(app.logs.length > 100) {
app.logs.shift()
}
});

</script>
Expand Down
Loading

0 comments on commit f216fff

Please sign in to comment.