Skip to content

Commit

Permalink
fix: setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Apr 27, 2020
1 parent 9bed0d4 commit da3671c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: Release Cycle

on:
schedule:
- cron: "55 15 * * 5"

#on:
# push:
# branches:
# - master
# schedule:
# - cron: "55 15 * * 5"

on:
push:
branches:
- master

jobs:
regular-release:
if: "!startsWith(github.event.head_commit.message, 'chore')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion jina/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# do not change this line manually
# this is managed by git tag and updated on every release
__version__ = '0.0.10'
__version__ = '0.1.0'

# do not change this line manually
# this is managed by proto/build-proto.sh and updated on every execution
Expand Down
1 change: 1 addition & 0 deletions jina/resources/completions/jina.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Jina CLI Autocomplete

_jina() {
COMPREPLY=()
Expand Down
2 changes: 2 additions & 0 deletions jina/resources/completions/jina.fish
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Jina CLI Autocomplete

function __fish_jina_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'jina' ]
Expand Down
2 changes: 2 additions & 0 deletions jina/resources/completions/jina.zsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Jina CLI Autocomplete

if [[ ! -o interactive ]]; then
return
fi
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,28 @@ def get_extra_requires(path, add_all=True):
def register_ac():
from pathlib import Path
import os
from pkg_resources import resource_filename
from pkg_resources import resource_stream

home = str(Path.home())
_check = [{'sh': os.path.join(home, '.zshrc'),
'ac': resource_filename('jina', '/'.join(('resources', 'completions', 'jina.zsh')))},
'ac': resource_stream('jina', '/'.join(('resources', 'completions', 'jina.zsh'))).read()},
{'sh': os.path.join(home, '.bashrc'),
'ac': resource_filename('jina', '/'.join(('resources', 'completions', 'jina.bash')))},
'ac': resource_stream('jina', '/'.join(('resources', 'completions', 'jina.bash'))).read()},
{'sh': os.path.join(home, '.config', 'fish', 'config.fish'),
'ac': resource_filename('jina', '/'.join(('resources', 'completions', 'jina.fish')))}]
'ac': resource_stream('jina', '/'.join(('resources', 'completions', 'jina.fish'))).read()}]

def add_ac(f):
if os.path.exists(f['sh']):
# zsh installed:
already_in = False
with open(f['sh']) as fp:
for v in fp:
if f['ac'] in v:
if '# Jina CLI Autocomplete' in v:
already_in = True
break
if not already_in:
with open(f['sh'], 'a') as fp:
fp.write('\nsource %s\n' % f['ac'])
fp.write(f['ac'].decode())

try:
for k in _check:
Expand Down

0 comments on commit da3671c

Please sign in to comment.