├── .gitignore ├── CONTRIBUTING.md ├── CHANGELOG.md ├── LICENSE.txt ├── README.md └── bin └── datomic-free /.gitignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | active 3 | data 4 | versions 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Thanks for trying out this project! [See here for contribution guidelines.](http://tagaholic.me/contributing.html) 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.3.0 2 | * start takes an optional properties file 3 | 4 | ## 0.2.1 5 | * Fix maven-install to not fail on systems without mvn 6 | 7 | ## 0.2.0 8 | * Modify install to also install jar with maven-install 9 | * Bug fix to support linux distros 10 | 11 | ## 0.1.0 12 | * Initial release! 13 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT LICENSE 2 | 3 | Copyright (c) 2012 Gabriel Horner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | A wrapper around [Datomic Free](https://my.datomic.com/downloads/free) that makes it easy to 3 | start Datomic Free transactors and upgrade to newer versions. 4 | 5 | ## Usage 6 | 7 | For first time users: 8 | 9 | ```sh 10 | $ git clone https://github.com/cldwalker/datomic-free.git ~/.datomic-free 11 | $ ~/.datomic-free/bin/datomic-free start 12 | 13 | # To make it easy to use `datomic-free` add an alias to your bashrc/zshrc 14 | $ echo 'alias datomic-free=$HOME/.datomic-free/bin/datomic-free' >> ~/.zshrc 15 | $ . ~/.zshrc 16 | $ datomic-free start 17 | 18 | # To specify transactor.properties (Absolute path only) 19 | $ datomic-free start /absolute/path/to/transactor.properties 20 | 21 | # To migrate existing data/ to datomic-free 22 | $ rm -rf ~/.datomic-free/data 23 | $ cp -R $OLD_DATOMIC_REPO/data ~/.datomic-free/ 24 | ``` 25 | 26 | Whenever you'd like to update to the latest Datomic Free: 27 | 28 | ```sh 29 | $ datomic-free update 30 | ``` 31 | 32 | This new version is now the active datomic-free version. Since datomic-free keeps data outside 33 | of versions in ~/.datomic-free/data, you use the same data across versions *by default*. 34 | 35 | To update to a specific version, pass a version: 36 | 37 | ```sh 38 | $ datomic-free update 0.8.3627 39 | ``` 40 | 41 | To use another version you've already installed: 42 | 43 | ```sh 44 | $ datomic-free use 0.8.3646 45 | ``` 46 | 47 | ## License 48 | See LICENSE.txt. This project is in no way affiliated with Datomic (Metadata Partners, LLC). 49 | 50 | ## Credits 51 | * Thanks to @richhickey and @stuarthalloway for datomic 52 | * Thanks to @rkneufeld for the downloading function of the shell script 53 | * Bug fixes: @sherbondy 54 | 55 | ## TODO 56 | * Allow other config and args to bin/transactor 57 | * rest command to execute bin/rest 58 | * better help 59 | * better exit codes 60 | * better error checking for use 61 | * convert this readme to a man page 62 | -------------------------------------------------------------------------------- /bin/datomic-free: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | DATOMIC_FREE_HOME=$HOME/.datomic-free 5 | DATOMIC_FREE_VERSIONS=$DATOMIC_FREE_HOME/versions 6 | DATOMIC_FREE_ACTIVE=$DATOMIC_FREE_HOME/active 7 | DATOMIC_FREE_DATA=$DATOMIC_FREE_HOME/data 8 | 9 | get-latest-datomic-version () { 10 | curl -s https://my.datomic.com/downloads/free | grep 'latest' | 11 | sed 's/.*datomic-free-\(.*\)\.zip.*$/\1/g' 12 | } 13 | 14 | # mostly from https://github.com/relevance/diametric/blob/master/script/vendor-datomic-free 15 | download-and-use-datomic () { 16 | version="$1" 17 | 18 | echo "Downloading Datomic Free $version..." 19 | mkdir -p $DATOMIC_FREE_VERSIONS 20 | cd $DATOMIC_FREE_VERSIONS 21 | curl -L --progress-bar -o datomic-free.zip "https://my.datomic.com/downloads/free/$version" 22 | unzip datomic-free.zip > /dev/null 23 | rm datomic-free.zip 24 | 25 | if command -v mvn > /dev/null 2>&1; then 26 | echo "Installing datomic-free-$version in local maven repository..." 27 | cd $DATOMIC_FREE_VERSIONS/datomic-free-$version 28 | $DATOMIC_FREE_VERSIONS/datomic-free-$version/bin/maven-install > /dev/null 29 | fi 30 | 31 | use-datomic $version 32 | echo "Done. Datomic Free $version is now available." 33 | } 34 | 35 | use-datomic () { 36 | version="$1" 37 | rm -f $DATOMIC_FREE_ACTIVE 38 | ln -s "$DATOMIC_FREE_VERSIONS/datomic-free-$version" $DATOMIC_FREE_ACTIVE 39 | } 40 | 41 | update-data-dir () { 42 | version="$1" 43 | datomic_free_data="$DATOMIC_FREE_VERSIONS/datomic-free-$version/data" 44 | 45 | if [ -d "$datomic_free_data" ]; then 46 | rm -r $datomic_free_data 47 | fi 48 | mkdir -p $DATOMIC_FREE_DATA 49 | ln -s $DATOMIC_FREE_DATA $datomic_free_data 50 | } 51 | 52 | download-datomic () { 53 | version="$1" 54 | 55 | if [ ! -d "$DATOMIC_FREE_VERSIONS/datomic-free-$version" ]; then 56 | set +e 57 | curl -s -i "https://my.datomic.com/downloads/free/$version" | head -n 1 | grep -q 302 58 | grep_exit_status=$? 59 | set -e 60 | 61 | if [ "$grep_exit_status" = "0" ]; then 62 | download-and-use-datomic $version 63 | update-data-dir $version 64 | else 65 | echo \"$version\" is not a valid version. See https://my.datomic.com/downloads/free for a list of versions. 66 | fi 67 | 68 | else 69 | echo "Datomic Free $version is already present." 70 | fi 71 | 72 | } 73 | 74 | download-latest-datomic () { 75 | echo "Finding latest datomic version..." 76 | version=$(get-latest-datomic-version) 77 | 78 | if [ "$version" = "" ]; then 79 | echo "The latest version could not be found. Install a specific version with \"datomic update VERSION\"." 80 | else 81 | download-datomic $version 82 | fi 83 | } 84 | 85 | command="$1" 86 | case "$command" in 87 | "" | "-h" | "--help") 88 | echo "datomic-free [-h|--help] [start|update|use]" 89 | ;; 90 | "start") 91 | if [ ! -d $DATOMIC_FREE_ACTIVE ]; then 92 | echo datomic-free has not been activated yet. datomicizing... 93 | mkdir -p $DATOMIC_FREE_HOME 94 | download-latest-datomic 95 | fi 96 | 97 | cd $DATOMIC_FREE_ACTIVE 98 | echo "Starting $(basename $(readlink $DATOMIC_FREE_ACTIVE))..." 99 | bin/transactor "${2:-config/samples/free-transactor-template.properties}" 100 | ;; 101 | "update") 102 | if [ "$2" != "" ]; then 103 | download-datomic $2 104 | else 105 | download-latest-datomic 106 | fi 107 | ;; 108 | "use") 109 | if [ "$2" = "" ]; then 110 | echo "No version given." 111 | else 112 | use-datomic $2 113 | fi 114 | ;; 115 | esac 116 | --------------------------------------------------------------------------------