Skip to content

Commit

Permalink
merge from upstream
Browse files Browse the repository at this point in the history
Add pypi links for documentation, issue tracking, and funding (jrnl-org#1204)

Update changelog [ci skip]

Fix bug that prevented --format pretty and --format short from working (jrnl-org#1177)

Update changelog [ci skip]

Fix broken brew release process (jrnl-org#1211)

* Add homebrew symlink for releases
* Fix indentation problem
* Fix bad env var name
* Change filename to formula name
* Fix formula name
* Attempt tap instead of symlink
* Fix formula repo referece
* add tracer
* Attempt working directory fix
* Remove --unshallow
* Use token for remote
* Move set tap directory step
* Remove tracer
* Clean up spacing and wrap quotes to tap directory

Remove global flag from git config

Add --local flag in git config calls

Increment version to v2.7.2-beta

Bump keyring from 22.3.0 to 23.0.0 (jrnl-org#1213)

Bumps [keyring](https://github.com/jaraco/keyring) from 22.3.0 to 23.0.0.
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/CHANGES.rst)
- [Commits](jaraco/keyring@v22.3.0...v23.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Increment version to v2.8-beta

Changelog generator fixes

There were several problems that this fixes:
- shallow fetch broke merging to release branch
- bad changelog was only outputting error msg (not exiting)
- latest version being on first line deleted itself and broke the
  changelog updates

This also has manual fixes to the changelog to bring it up to date.

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>

Bump pyflakes from 2.2.0 to 2.3.0 (jrnl-org#1215)

Bumps [pyflakes](https://github.com/PyCQA/pyflakes) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/PyCQA/pyflakes/releases)
- [Changelog](https://github.com/PyCQA/pyflakes/blob/master/NEWS.rst)
- [Commits](PyCQA/pyflakes@2.2.0...2.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Change PR steps for brew release

The hub cli tool wasn't working anymore, so we took it out.

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>

Update changelog [ci skip]
  • Loading branch information
sriniv27 committed Mar 26, 2021
1 parent 5a44385 commit 5e0e611
Show file tree
Hide file tree
Showing 13 changed files with 183 additions and 59 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ jobs:
exit 1
fi
if [[ $tagline == 1 ]]; then
echo "::error::Something is wrong."
echo "::error::The latest release ${SINCE_TAG} is the first line in the changelog,"
echo "::error::but the h1 '# Changelog' should always be the first line."
exit 1
fi
sed -i "1,$(expr $tagline - 1)d" "$FILENAME"
# delete generated line (or it will be added multiple times)
sed -i '/This Changelog was automatically generated by/d' "$FILENAME"
Expand Down Expand Up @@ -124,6 +131,7 @@ jobs:
git diff
if [[ $(grep -c '^# Changelog$' "$FILENAME") != 1 ]]; then
echo '::error::Something is wrong with the changelog.'
exit 1
fi
SOMETHING_CHANGED=false
git diff --exit-code || SOMETHING_CHANGED=true
Expand All @@ -142,6 +150,7 @@ jobs:
- name: Merge to Release branch
if: env.FULL_RELEASE == 'true'
run: |
git fetch --unshallow origin
git checkout release
git merge --ff-only $BRANCH
git push origin release
Expand Down
68 changes: 29 additions & 39 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ jobs:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOME_REPO: ${{ secrets.HOME_REPO }}
steps:

- name: Get version
run: |
JRNL_VERSION="${{ github.event.inputs.version }}"
Expand All @@ -128,7 +127,7 @@ jobs:
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV
echo "PYPI_VERSION=$PYPI_VERSION" >> $GITHUB_ENV
- name: Determine type of release
- name: Set env variables
env:
REPO_OWNER: ${{ github.repository_owner }}
run: |
Expand All @@ -153,26 +152,17 @@ jobs:
} >> $GITHUB_ENV
fi
- name: Checkout homebrew repo
uses: actions/checkout@v2
with:
token: ${{ secrets.JRNL_BOT_TOKEN }}
repository: ${{ env.FORMULA_REPO }}

- name: Config git user
- name: Tap formula
run: |
git config --global user.name "${{ secrets.JRNL_BOT_NAME }}"
git config --global user.email "${{ secrets.JRNL_BOT_EMAIL }}"
brew tap ${FORMULA_REPO}
echo '::debug::Set tap directory'
echo "BREW_TAP_DIRECTORY='$(brew --repository)/Library/Taps/${FORMULA_REPO}'" >> $GITHUB_ENV
- name: Create branch
- name: Config git user
working-directory: ${{ env.BREW_TAP_DIRECTORY }}
run: |
BRANCH_NAME="jrnl-${JRNL_VERSION}--${RANDOM}"
git remote rename origin upstream
git remote add origin "https://github.com/${BOT_REPO}.git"
git fetch --unshallow upstream
git fetch origin
git checkout -b $BRANCH_NAME
git push -u origin $BRANCH_NAME
git config --local user.name "${{ secrets.JRNL_BOT_NAME }}"
git config --local user.email "${{ secrets.JRNL_BOT_EMAIL }}"
- name: Install dependencies
run: brew install pipgrip
Expand Down Expand Up @@ -202,32 +192,32 @@ jobs:
max_attempts: 6
retry_wait_seconds: 30
command: >
brew bump-formula-pr "Formula/${FORMULA_NAME}.rb"
brew bump-formula-pr "${FORMULA_NAME}"
--url $(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)
--sha256 $(jq ".releases[\"${PYPI_VERSION}\"][1].digests.sha256" -r api_response.json)
--version=$PYPI_VERSION
--no-audit
--write
--commit
--force
--verbose
- name: Update commit message
run: |
git commit --amend \
-m "jrnl ${JRNL_VERSION}" \
-m "Update jrnl to ${JRNL_VERSION}" \
-m '${{ secrets.RELEASE_COAUTHORS }}'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
path: ${{ env.BREW_TAP_DIRECTORY }}
token: ${{ secrets.JRNL_BOT_TOKEN }}
push-to-fork: ${{ env.BOT_REPO }}

- name: Push commit
run: |
git show head
git push
committer: ${{ secrets.JRNL_BOT_NAME }} <${{ secrets.JRNL_BOT_EMAIL }}>
author: ${{ secrets.JRNL_BOT_NAME }} <${{ secrets.JRNL_BOT_EMAIL }}>

- name: Open pull request
env:
GH_TOKEN: ${{ secrets.JRNL_BOT_TOKEN }}
run: >
gh pr create
--title "jrnl ${JRNL_VERSION}"
--body 'Created with `brew bump-formula-pr`.'
title: jrnl ${{ env.JRNL_VERSION }}
body: Created with `brew bump-formula-pr`

branch: jrnl-${{ env.JRNL_VERSION }}--
branch-suffix: random
commit-message: |
jrnl ${{ env.JRNL_VERSION }}
Update jrnl to ${{ env.JRNL_VERSION }}
${{ secrets.RELEASE_COAUTHORS }}
40 changes: 37 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,58 @@

## [Unreleased](https://github.com/jrnl-org/jrnl/)

[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7.1...HEAD)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8-beta...HEAD)

**Implemented enhancements:**

- Assigning a number to each entry when viewing [\#1218](https://github.com/jrnl-org/jrnl/issues/1218)

**Packaging:**

- Bump pyflakes from 2.2.0 to 2.3.0 [\#1215](https://github.com/jrnl-org/jrnl/pull/1215) ([dependabot[bot]](https://github.com/apps/dependabot))

## [v2.8-beta](https://pypi.org/project/jrnl/v2.8-beta/) (2021-03-13)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7.2-beta...HEAD)

**Implemented enhancements:**

- Add pypi project links [\#1197](https://github.com/jrnl-org/jrnl/issues/1197)
- Add `--config-override` feature [\#1169](https://github.com/jrnl-org/jrnl/pull/1169) ([sriniv27](https://github.com/sriniv27))

**Fixed bugs:**

- bash: syntax error near unexpected token `newline' at input \>\_\> [\#1208](https://github.com/jrnl-org/jrnl/issues/1208)
- `jrnl --format short` returns an error [\#1173](https://github.com/jrnl-org/jrnl/issues/1173)
- `jrnl --format pretty` returns an error [\#1172](https://github.com/jrnl-org/jrnl/issues/1172)
- Fix bug that prevented --format pretty and --format short from working [\#1177](https://github.com/jrnl-org/jrnl/pull/1177) ([sriniv27](https://github.com/sriniv27))

**Packaging:**

- Bump keyring from 22.0.1 to 22.3.0 [\#1210](https://github.com/jrnl-org/jrnl/pull/1210) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump asteval from 0.9.22 to 0.9.23 [\#1209](https://github.com/jrnl-org/jrnl/pull/1209) ([dependabot[bot]](https://github.com/apps/dependabot))

## [v2.7.1](https://pypi.org/project/jrnl/v2.7.1/) (2021-02-27)
## [v2.7.2-beta](https://pypi.org/project/jrnl/v2.7.2-beta/) (2021-03-06)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7.1...v2.7.2-beta)

**Implemented enhancements:**

- Add pypi project links [\#1197](https://github.com/jrnl-org/jrnl/issues/1197)
- Add `--config-override` feature [\#1169](https://github.com/jrnl-org/jrnl/pull/1169) ([sriniv27](https://github.com/sriniv27))

**Fixed bugs:**

[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7.1-beta...v2.7.1)
- bash: syntax error near unexpected token `newline' at input \>\_\> [\#1208](https://github.com/jrnl-org/jrnl/issues/1208)
- `jrnl --format short` returns an error [\#1173](https://github.com/jrnl-org/jrnl/issues/1173)
- `jrnl --format pretty` returns an error [\#1172](https://github.com/jrnl-org/jrnl/issues/1172)
- Fix bug that prevented --format pretty and --format short from working [\#1177](https://github.com/jrnl-org/jrnl/pull/1177) ([sriniv27](https://github.com/sriniv27))

**Packaging:**

- Bump keyring from 22.0.1 to 22.3.0 [\#1210](https://github.com/jrnl-org/jrnl/pull/1210) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump asteval from 0.9.22 to 0.9.23 [\#1209](https://github.com/jrnl-org/jrnl/pull/1209) ([dependabot[bot]](https://github.com/apps/dependabot))

## [v2.7.1](https://pypi.org/project/jrnl/v2.7.1/) (2021-02-27)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.7...v2.7.1)

**Fixed bugs:**

Expand Down
26 changes: 26 additions & 0 deletions features/format.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
Feature: Custom formats

Scenario Outline: Short printing via --format flag
Given We use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --format short -3"
Then we should get no error

Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |

Scenario Outline: Pretty Printing aka the Default
Given We use the config "<config>.yaml"
And we use the password "test" if prompted
When we run "jrnl --format pretty -3"
Then we should get no error

Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |

Scenario Outline: JSON format
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
Expand Down
6 changes: 6 additions & 0 deletions features/steps/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ def all_input_was_used(context):
def run(context, command, text=""):
text = text or context.text or ""

if "config_path" in context and context.config_path is not None:
with open(context.config_path) as f:
context.jrnl_config = yaml.load(f, Loader=yaml.FullLoader)
else:
context.jrnl_config = None

if "cache_dir" in context and context.cache_dir is not None:
cache_dir = os.path.join("features", "cache", context.cache_dir)
command = command.format(cache_dir=cache_dir)
Expand Down
2 changes: 1 addition & 1 deletion features/steps/export_steps.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html


import json
import os
import shutil
import random
import string
from xml.etree import ElementTree

from behave import given
from behave import then

Expand Down
2 changes: 1 addition & 1 deletion jrnl/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v2.7.1"
__version__ = "v2.8-beta"
5 changes: 4 additions & 1 deletion jrnl/jrnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,12 @@ def _delete_search_results(journal, old_entries, **kwargs):


def _display_search_results(args, journal, **kwargs):
if args.short:
if args.short or args.export == "short":
print(journal.pprint(short=True))

elif args.export == "pretty":
print(journal.pprint())

elif args.tags:
print(plugins.get_exporter("tags").export(journal))

Expand Down
2 changes: 2 additions & 0 deletions jrnl/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
__importers = [JRNLImporter]

__exporter_types = {name: plugin for plugin in __exporters for name in plugin.names}
__exporter_types["pretty"] = None
__exporter_types["short"] = None
__importer_types = {name: plugin for plugin in __importers for name in plugin.names}

EXPORT_FORMATS = sorted(__exporter_types.keys())
Expand Down
Loading

0 comments on commit 5e0e611

Please sign in to comment.