Skip to content

Commit

Permalink
feat(dotnet): replace dnx/dnvm with dotnet-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
dmccaffery authored and Deavon McCaffery committed Aug 19, 2016
1 parent 7db9321 commit bd6b182
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
8 changes: 6 additions & 2 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if [ "$(uname)" == "Darwin" ]; then

rm -rRf "$LOCAL_PREFIX/etc/bash_completion.d/git-prompt.sh" 1>/dev/null 2>&1

for pkg in ffmpeg gettext gifsicle git git-extras git-flow-avh gnu-getopt lame libvo-aacenc mono node x264 xvid; do
for pkg in ffmpeg gettext gifsicle git git-extras git-flow-avh gnu-getopt lame libvo-aacenc mono node x264 xvid openssl; do
if brew list -1 | grep -q "^${pkg}\$"; then
echo "Upgrading $pkg..."
brew upgrade ${pkg} 1>/dev/null 2>&1
Expand Down Expand Up @@ -103,4 +103,8 @@ result=$(curl -L -D - "$gitprompturi" -o "$gitpromptname" -# | grep "^HTTP/1.1"

echo "Downloading git-flow completion..."
result=$(curl -L -D - "$gitcompleteuri" -o "$gitcompletename" -# | grep "^HTTP/1.1" | head -n 1 | sed "s/HTTP.1.1 \([0-9]*\).*/\1/")
[[ $result == "200" ]] && cp $gitcompletename "$gitprompt" && rm -rRf $gitcompletename
[[ $result == "200" ]] && cp $gitcompletename "$gitprompt" && rm -rRf $gitcompletename

source ~/.bash_profile

install-dotnet
52 changes: 21 additions & 31 deletions src/scripts/dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,34 @@ if [ -n "${UBER_DEBUG+1}" ]; then
echo 'dotnet'
fi

function install-dnvm() {
local dnvmpath=~/.dnx/dnvm
local dnvmuri="https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.sh"
local dnvmsh=$dnvmpath/dnvm.sh

# determine if the dnvm folder exists
if test ! -d "$dnvmpath"; then
# create the dnvm folder
mkdir -p "$dnvmpath"
function install-dotnet() {
local dotnetpath=$HOME/.dotnet
local dotneturi="https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh"
local dotnetsh=$dotnetpath/dotnet-install.sh

# determine if the dotnet folder exists
if test ! -d "$dotnetpath"; then
# create the dotnet folder
mkdir -p "$dotnetpath"
fi

# determine if the dnvm script file does not exist
if test ! -f "$dnvmsh"; then
# determine if the dotnet script file does not exist
if test ! -f "$dotnetsh"; then
# attempt to download it from curl
local result=$(curl -L -D - "$dnvmuri" -o "$dnvmsh" -# | grep "^HTTP/1.1" | head -n 1 | sed "s/HTTP.1.1 \([0-9]*\).*/\1/")
local result=$(curl -L -D - "$dotneturi" -o "$dotnetsh" -# | grep "^HTTP/1.1" | head -n 1 | sed "s/HTTP.1.1 \([0-9]*\).*/\1/")

# source it if it was successfully retrieved
[[ $result == "200" ]] && chmod ugo+x "$dnvmsh"
[[ $result == "200" ]] && chmod ugo+x "$dotnetsh"
fi
}

function update-dnvm() {
(dnvm update-self &) 1>/dev/null 2>&1
}

# determine if dnvm is avialable
if ! type dnvm >/dev/null 2>&1; then
# install dnvm
install-dnvm 1>/dev/null 2>&1
# determine if dotnet now exists in the expected place
if test -f "$dotnetsh"; then
# add the dotnet folder to path
PATH=$PATH:$dotnetpath

# determine if dnvm now exists in the expected place
if test -f ~/.dnx/dnvm/dnvm.sh; then
# add the dnvm folder to path
PATH=$PATH:~/.dnx/dnvm

# source dnvm
source ~/.dnx/dnvm/dnvm.sh
# source dotnet
source $dotnetsh
fi
fi
}

update-dnvm
install-dotnet

0 comments on commit bd6b182

Please sign in to comment.