Skip to content

Commit

Permalink
ProvenDBShell wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
gharriso committed Jun 12, 2019
1 parent 337bd1c commit 0bb0845
Show file tree
Hide file tree
Showing 5 changed files with 684 additions and 0 deletions.
44 changes: 44 additions & 0 deletions provenDbShell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ProvenDB shell helpers

The ProvenDB shell helpers are wrappers around the mongo shell executable which provide easier access to ProvenDB commands.

The shell helpers add methods to the default `db` connection object that correspond to ProvenDB commands that would otherwise need to be invoked via `db.runCommand()` calls.

Without the shell helper:

```javascript
> db.runCommand({getProof:'8f606be0-8364-11e9-a57b-01ee7d1a26c0',format:'binary'})
{
"ok" : 1,
"proofs" : [
{
"proofId" : "8f606be0-8364-11e9-a57b-01ee7d1a26c0",
"version" : NumberLong(7745),
"submitted" : ISODate("2019-05-31T05:25:53Z"),
```
With the shell helper:
```javascript
ProvenDB v7753 (current)> db.getProof('8f606be0-8364-11e9-a57b-01ee7d1a26c0')
{
"ok" : 1,
"proofs" : [
{
"proofId" : "8f606be0-8364-11e9-a57b-01ee7d1a26c0",
"version" : NumberLong(7745),
"submitted" : ISODate("2019-05-31T05:25:53Z"),
```
## Requirements
There must be a mongo shell binary in the path. The mongo binary should be version 3.6 at least.
## Installation
1. Unpack the contents of `provendbShell.zip` and copy all the files to a directory in the path.
2. On Windows invoke `provendbShell provendbUri`, where `provendbUri` is the URI for your ProvenDB service.
3. On Linux, make sure `provendbShell.sh` has been made executable. Then invoke `provendbShell provendbUri.sh`, where `provendbUri` is the URI for your ProvenDB service.
## Documentation
Full documentation can be found at [https://provendb.readme.io/docs/shell-helper-commands](https://provendb.readme.io/docs/shell-helper-commands)
Binary file added provenDbShell/provenDbShell.zip
Binary file not shown.
46 changes: 46 additions & 0 deletions provenDbShell/provendbShell.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@echo off
rem
rem provendbShell - wrapper around mongo shell for Provendb

rem Copyright (C) 2019 Southbank Software Ltd.
rem
rem This program is free software: you can redistribute it and/or modify
rem it under the terms of the GNU Affero General Public License as published by
rem the Free Software Foundation, either version 3 of the License, or
rem (at your option) any later version.
rem
rem This program is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
rem GNU Affero General Public License for more details.
rem
rem You should have received a copy of the GNU Affero General Public License
rem along with this program. If not, see <http://www.gnu.org/licenses/>.
rem
rem @Author: Guy Harrison
rem
set PDBJS=provendbShell.js
if "%1"=="" (
@echo Usage: provendbShell ProvenDbUri [mongo shell arguments]
exit /b 1
)

if not defined PROVENDB_HOME (set PROVENDB_HOME=.)
rem Look in current directory
if exist .\%PDBJS% (set SCRIPTLOC=.\%PDBJS%
) else (

rem Look in PROVENDB_HOME
if exist %PROVENDB_HOME%\%PDBJS% (set SCRIPTLOC= %PROVENDB_HOME%\%PDBJS%
) else (

rem Look everywhere in the path
for %%G in ("%path:;=" "%") do if exist %%G\%PDBJS% (set SCRIPTLOC=%%G\%PDBJS% )
)
)
@echo ProvenDB shell helper
if not defined SCRIPTLOC (
@echo Cannot find %PDBJS% in path
) else (
mongo %* --shell --quiet --ssl %SCRIPTLOC%
)
Loading

0 comments on commit 0bb0845

Please sign in to comment.