Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/0.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-hanna committed Oct 30, 2018
2 parents b68ac4e + c19e1c0 commit 9eb2751
Show file tree
Hide file tree
Showing 428 changed files with 74,360 additions and 2,762 deletions.
157 changes: 148 additions & 9 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
all: test

.PHONY: deps
deps:
@echo "running dep ensure..." && \
dep ensure -v && \
$(MAKE) gxundo

.PHONY: gxundo
gxundo:
@bash scripts/gxundo.sh vendor/

.PHONY: test
test:
@go test -v *.go
99 changes: 99 additions & 0 deletions scripts/gxundo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/bash

#nc="\\033[0m"
red="\\033[31m"
green="\\033[32m"
yellow="\\033[33m"
#blue="\\033[34m"
#purple="\\033[35m"
cyan="\\033[36m"
white="\\033[37m"
bold="$(tput bold)"
normal="$(tput sgr0)"

# function to install `jq`
install_jq() {
if [[ "$OSTYPE" == "linux-gnu" ]]; then
if [ -n "$(command -v apt-get 2> /dev/null)" ]; then
sudo apt-get -y install jq

elif [ -n "$(command -v which dnf 2> /dev/null)" ]; then
sudo dnf -y install jq

elif [ -n "$(command -v yum 2> /dev/null)"]; then
sudo yum -y install jq

elif [ -n "$(command -v portage 2> /dev/null)"]; then
sudo portage -y install jq

elif [ -n "$(command -v pacman 2> /dev/null)"]; then
sudo pacman -y install jq

else
echo "Cannot install jq; No supported package manager installed on system (apt-get dnf, yum, portage, pacman)" >&2
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install jq
fi
}

# check if `gorep` is installed, otherwise install it.
command -v gorep >/dev/null
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
printf "$yellow%s$normal\\n" "gorep is not installed. Installing..."
go get github.com/novalagung/gorep && printf "$green%s$normal\\n" "gorep installed"
fi

# check if `jq` is installed, otherwise install it.
command -v jq >/dev/null
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
printf "$yellow%s$normal\\n" "jq is not installed. Installing..."
install_jq && printf "$green%s$normal\\n" "jq installed"
fi

# the path to search passed an the only argument
dirpath="$1"

if [[ "$dirpath" == "" ]]; then
printf "$red$bold%s$normal\\n" "Error: path is required"
exit 1
fi

printf "$yellow%s$normal\\n" "finding imports recursively under $dirpath"

filter="sed -r 's|/[^/]+$||'"
if [[ "$OSTYPE" == "darwin"* ]]; then
filter="sed -E 's|/[^/]+$||'"
fi

# read all Go imports that contain "gx/ipfs/"
for dir in $(find "$dirpath" -maxdepth 100 -type f -name '*.go' | eval "$filter" | sort -u)
do
for line in $(go list -json "./$dir" | jq '.Imports' | grep 'gx/ipfs/' | sed -e 's/gx\///g' | sed -e 's/"//g' | sed -e 's/,//g' | sed -e 's/ //g')
do
# fetch the gx package.json and read the github url
root="$(echo "$line" | tr "/" "\\n" | awk 'FNR <= 3 {print}' | tr '\n' '/' | sed -e s'/.$//g')"
pkg="$(echo "$line" | tr "/" "\\n" | awk 'FNR > 3 {print}' | tr '\n' '/' | sed -e s'/.$//g')"
jsonurl="https://gateway.ipfs.io/$root/package.json"
printf "$white%s$normal\\n" "fetching $jsonurl"
new="$(curl -s "$jsonurl" | jq '.gx.dvcsimport' | sed -e 's/"//g')"
if [ "$pkg" != "" ]; then
new="$new/$pkg"
fi
old="gx/$line"

printf "$cyan%s => %s$normal\\n" "$old" "$new"

# replace the imports
gorep -path="$dir" \
-from="$old" \
-to="$new"

done
done

printf "$green%s$normal\\n" "complete"

2 changes: 1 addition & 1 deletion sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (c3 *C3) RegisterMethod(methodName string, types []string, ifn interface{})
func (c3 *C3) Serve() {
server.NewServer(&server.Config{
Host: c3config.ServerHost,
Port: c3config.ServerPort,
Port: c3config.DefaultServerPort,
Receiver: c3.receiver,
}).Run()
}
Expand Down
5 changes: 5 additions & 0 deletions vendor/github.com/BurntSushi/toml/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/BurntSushi/toml/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/BurntSushi/toml/COMPATIBLE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions vendor/github.com/BurntSushi/toml/COPYING

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/github.com/BurntSushi/toml/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9eb2751

Please sign in to comment.