Skip to content

Instantly share code, notes, and snippets.

@izolate
Last active September 15, 2015 02:05
Show Gist options
  • Select an option

  • Save izolate/e36281cbe859608b4988 to your computer and use it in GitHub Desktop.

Select an option

Save izolate/e36281cbe859608b4988 to your computer and use it in GitHub Desktop.

Revisions

  1. izolate renamed this gist May 7, 2015. 1 changed file with 11 additions and 10 deletions.
    21 changes: 11 additions & 10 deletions iojs-ubuntu-install-in-10s.sh → install-iojs-in-10s.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    IOJS_VERSION=v0.0.0
    IOJS_DIR=~/.iojs
    IOJS_DIR=$HOME/.iojs

    iojs_install() {
    iojs_setup
    @@ -9,28 +9,29 @@ iojs_install() {
    }

    iojs_setup() {
    echo '1> Getting latest version'
    echo '[1/3] Getting latest version'
    IOJS_VERSION=v${1:-$(curl -s https://iojs.org/dist/index.json | sed -e 's/^.*"version":"\([^"]*\)".*$/\1/' | head -n 2 | tail -n -1 | cut -c 2-)}

    mkdir -p $IOJS_DIR
    rm -rf $IOJS_DIR/*
    mkdir -p $IOJS_DIR && rm -rf $IOJS_DIR/*
    }

    iojs_download() {
    echo '2> Downloading io.js' ${IOJS_VERSION}
    echo '[2/3] Downloading io.js' ${IOJS_VERSION}
    curl -s https://iojs.org/dist/${IOJS_VERSION}/iojs-${IOJS_VERSION}-linux-x64.tar.gz | tar zx -C $IOJS_DIR --strip-components=1
    }

    iojs_assemble() {
    echo '3> Adding binaries to PATH'
    echo '# io.js environment' >> ~/.bashrc
    echo 'export PATH=$HOME/.iojs/bin:$PATH' >> ~/.bashrc
    echo 'export NODE_PATH=$HOME/.iojs/lib/node_modules' >> ~/.bashrc
    echo '[3/3] Adding binaries to PATH'
    printf '%s\n' '' '# io.js environment' "export PATH=$IOJS_DIR/bin:\$PATH" \
    "export NODE_PATH=$IOJS_DIR/lib/node_modules" >> ~/.bashrc

    . ~/.bashrc
    }

    iojs_teardown() {
    unset -f iojs_install iojs_setup iojs_download iojs_assemble iojs_teardown
    echo '====> Done'
    printf '%s\n' '' "iojs -v: $(iojs -v)" "npm -v: $(npm -v)"
    unset -f iojs_install iojs_setup iojs_download iojs_assemble iojs_teardown IOJS_VERSION IOJS_DIR
    }

    iojs_install
  2. izolate revised this gist May 6, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions iojs-ubuntu-install-in-10s.sh
    Original file line number Diff line number Diff line change
    @@ -26,11 +26,11 @@ iojs_assemble() {
    echo '# io.js environment' >> ~/.bashrc
    echo 'export PATH=$HOME/.iojs/bin:$PATH' >> ~/.bashrc
    echo 'export NODE_PATH=$HOME/.iojs/lib/node_modules' >> ~/.bashrc
    source ~/.bashrc
    . ~/.bashrc
    }

    iojs_teardown() {
    unset -f iojs_install iojs_setup iojs_download iojs_teardown
    unset -f iojs_install iojs_setup iojs_download iojs_assemble iojs_teardown
    }

    iojs_install
  3. izolate created this gist May 6, 2015.
    36 changes: 36 additions & 0 deletions iojs-ubuntu-install-in-10s.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    IOJS_VERSION=v0.0.0
    IOJS_DIR=~/.iojs

    iojs_install() {
    iojs_setup
    iojs_download
    iojs_assemble
    iojs_teardown
    }

    iojs_setup() {
    echo '1> Getting latest version'
    IOJS_VERSION=v${1:-$(curl -s https://iojs.org/dist/index.json | sed -e 's/^.*"version":"\([^"]*\)".*$/\1/' | head -n 2 | tail -n -1 | cut -c 2-)}

    mkdir -p $IOJS_DIR
    rm -rf $IOJS_DIR/*
    }

    iojs_download() {
    echo '2> Downloading io.js' ${IOJS_VERSION}
    curl -s https://iojs.org/dist/${IOJS_VERSION}/iojs-${IOJS_VERSION}-linux-x64.tar.gz | tar zx -C $IOJS_DIR --strip-components=1
    }

    iojs_assemble() {
    echo '3> Adding binaries to PATH'
    echo '# io.js environment' >> ~/.bashrc
    echo 'export PATH=$HOME/.iojs/bin:$PATH' >> ~/.bashrc
    echo 'export NODE_PATH=$HOME/.iojs/lib/node_modules' >> ~/.bashrc
    source ~/.bashrc
    }

    iojs_teardown() {
    unset -f iojs_install iojs_setup iojs_download iojs_teardown
    }

    iojs_install