Skip to content

Commit

Permalink
Improve highlight (#174)
Browse files Browse the repository at this point in the history
* Prefix releases for cli

* Allow editors to highlight markdown

* Fix dev script
  • Loading branch information
Sung Won Cho committed May 10, 2019
1 parent 1b61f26 commit e8d9200
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cli/core/core.go
Expand Up @@ -41,7 +41,7 @@ var (
// ConfigFilename is the name of the config file
ConfigFilename = "dnoterc"
// TmpContentFilename is the name of the temporary file that holds editor input
TmpContentFilename = "DNOTE_TMPCONTENT"
TmpContentFilename = "DNOTE_TMPCONTENT.md"
)

// RunEFunc is a function type of dnote commands
Expand Down
15 changes: 8 additions & 7 deletions cli/install.sh
Expand Up @@ -135,7 +135,7 @@ install_dnote() {

if ! check_platform "$os" "$arch"; then
print_error "System not supported: $os/$arch"
print_error "Please compile manually from https://github.com/dnote/dnote/cli"
print_error "Please compile manually from https://github.com/dnote/dnote"
exit 1
fi

Expand All @@ -149,21 +149,21 @@ install_dnote() {

# get the latest version
resp=$(http_get "https://api.github.com/repos/$owner/$repo/tags")
version=$(echo "$resp" | tr ',' '\n' | grep -m 1 "\"name\":" | cut -f4 -d'"')
version=$(echo "$resp" | tr ',' '\n' | grep -m 1 "\"name\": \"cli" | cut -f4 -d'"')

if [ -z "$version" ]; then
print_error "Error fetching latest version. Please try again."
exit 1
fi

# remove the preceding 'v'
version="${version#v}"
# remove the preceding 'cli-v'
version="${version#cli-v}"

checksum=${binary}_${version}_checksums.txt
filename=${binary}_${version}_${os}_${arch}
tarball="${filename}.tar.gz"
binary_url="${github_download}/v${version}/${tarball}"
checksum_url="${github_download}/v${version}/${checksum}"
binary_url="${github_download}/cli-v${version}/${tarball}"
checksum_url="${github_download}/cli-v${version}/${checksum}"

print_step "Latest release version is v$version."

Expand All @@ -188,8 +188,9 @@ install_dnote() {


exit_error() {
# shellcheck disable=SC2181
if [ "$?" -ne 0 ]; then
print_error "A problem occurred while installing Dnote. Please report it on https://github.com/dnote/dnote/cli/issues so that we can help you."
print_error "A problem occurred while installing Dnote. Please report it on https://github.com/dnote/dnote/issues so that we can help you."
fi
}

Expand Down
7 changes: 4 additions & 3 deletions cli/scripts/dev.sh
@@ -1,10 +1,11 @@
#!/bin/bash
set -eux

# dev.sh builds a new binary and replaces the old one in the PATH with it

sudo rm "$(which dnote)" $GOPATH/bin/cli
sudo rm -rf "$(which dnote)" "$GOPATH/bin/cli"

# change tags to darwin if on macos
go install -ldflags "-X main.apiEndpoint=http://127.0.0.1:5000" --tags "linux fts5" .
go install -ldflags "-X main.apiEndpoint=http://127.0.0.1:5000" --tags "linux fts5" "$GOPATH/src/github.com/dnote/dnote/cli/."

sudo ln -s $GOPATH/bin/cli /usr/local/bin/dnote
sudo ln -s "$GOPATH/bin/cli" /usr/local/bin/dnote
6 changes: 3 additions & 3 deletions cli/scripts/release.sh
Expand Up @@ -26,14 +26,14 @@ if ! command_exists hub; then
exit 1
fi

if [ ! -d $homebrewRepoDir ]; then
if [ ! -d "$homebrewRepoDir" ]; then
echo "homebrew-dnote not found locally. did you clone it?"
exit 1
fi

# 1. push tag
version=$1
version_tag="v$version"
version_tag="cli-v$version"

echo "* tagging and pushing the tag"
git tag -a "$version_tag" -m "Release $version_tag"
Expand All @@ -55,4 +55,4 @@ hub release create \

# 3. Release on Homebrew
homebrew_sha256=$(shasum -a 256 "./build/dnote_${version}_darwin_amd64.tar.gz" | cut -d ' ' -f 1)
(cd $homebrewRepoDir && ./release.sh "$version" "$homebrew_sha256")
(cd "$homebrewRepoDir" && ./release.sh "$version" "$homebrew_sha256")

0 comments on commit e8d9200

Please sign in to comment.