mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-12 17:38:32 +02:00
Merge branch 'develop' into encryption-rework
This commit is contained in:
commit
a9f57a0ce9
9 changed files with 49 additions and 19 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -17,10 +17,12 @@ sdist/
|
||||||
.tox/
|
.tox/
|
||||||
var/
|
var/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
__pycache__/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
# Versioning
|
# Versioning
|
||||||
.python-version
|
.python-version
|
||||||
.tool-version
|
.tool-versions
|
||||||
|
|
||||||
# Installer logs
|
# Installer logs
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,18 +1,26 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [Unreleased](https://github.com/jrnl-org/jrnl/)
|
## [v3.3-beta](https://pypi.org/project/jrnl/v3.3-beta/) (2022-10-08)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.2...HEAD)
|
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.2...v3.3-beta)
|
||||||
|
|
||||||
**Implemented enhancements:**
|
**Implemented enhancements:**
|
||||||
|
|
||||||
- Add dependency security checks in CI [\#1488](https://github.com/jrnl-org/jrnl/issues/1488)
|
- Add dependency security checks in CI [\#1488](https://github.com/jrnl-org/jrnl/issues/1488)
|
||||||
- Add machine-readable format for --list [\#1445](https://github.com/jrnl-org/jrnl/issues/1445)
|
- Add machine-readable format for --list [\#1445](https://github.com/jrnl-org/jrnl/issues/1445)
|
||||||
|
- Change default config to use journal key [\#1594](https://github.com/jrnl-org/jrnl/pull/1594) ([micahellison](https://github.com/micahellison))
|
||||||
- Add machine readable --list output [\#1592](https://github.com/jrnl-org/jrnl/pull/1592) ([apainintheneck](https://github.com/apainintheneck))
|
- Add machine readable --list output [\#1592](https://github.com/jrnl-org/jrnl/pull/1592) ([apainintheneck](https://github.com/apainintheneck))
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Bug Report - Sometimes jrnl crashes and truncates journal file [\#1599](https://github.com/jrnl-org/jrnl/issues/1599)
|
||||||
|
- Zero-length file created when attempting to export YAML to a directory that does not exist [\#1593](https://github.com/jrnl-org/jrnl/issues/1593)
|
||||||
|
- Don't create empty file when attempting a YAML export to a non-existing folder [\#1600](https://github.com/jrnl-org/jrnl/pull/1600) ([outa](https://github.com/outa))
|
||||||
|
|
||||||
**Build:**
|
**Build:**
|
||||||
|
|
||||||
- Replace Dependabot [\#1560](https://github.com/jrnl-org/jrnl/issues/1560)
|
- Replace Dependabot [\#1560](https://github.com/jrnl-org/jrnl/issues/1560)
|
||||||
|
- Update `.gitignore` [\#1604](https://github.com/jrnl-org/jrnl/pull/1604) ([wren](https://github.com/wren))
|
||||||
- Fix Docs Accessibility Testing [\#1588](https://github.com/jrnl-org/jrnl/pull/1588) ([wren](https://github.com/wren))
|
- Fix Docs Accessibility Testing [\#1588](https://github.com/jrnl-org/jrnl/pull/1588) ([wren](https://github.com/wren))
|
||||||
- Update to use renamed flag for `brew bump-formula-pr` [\#1587](https://github.com/jrnl-org/jrnl/pull/1587) ([wren](https://github.com/wren))
|
- Update to use renamed flag for `brew bump-formula-pr` [\#1587](https://github.com/jrnl-org/jrnl/pull/1587) ([wren](https://github.com/wren))
|
||||||
- Update peter-evans/create-pull-request action to v4 [\#1585](https://github.com/jrnl-org/jrnl/pull/1585) ([renovate[bot]](https://github.com/apps/renovate))
|
- Update peter-evans/create-pull-request action to v4 [\#1585](https://github.com/jrnl-org/jrnl/pull/1585) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
|
@ -23,6 +31,7 @@
|
||||||
|
|
||||||
**Documentation:**
|
**Documentation:**
|
||||||
|
|
||||||
|
- \[Documentation\] Edit on Github link broken [\#1601](https://github.com/jrnl-org/jrnl/issues/1601)
|
||||||
- Update `--format yaml` example in docs [\#1525](https://github.com/jrnl-org/jrnl/issues/1525)
|
- Update `--format yaml` example in docs [\#1525](https://github.com/jrnl-org/jrnl/issues/1525)
|
||||||
- Update YAML export description in docs [\#1591](https://github.com/jrnl-org/jrnl/pull/1591) ([apainintheneck](https://github.com/apainintheneck))
|
- Update YAML export description in docs [\#1591](https://github.com/jrnl-org/jrnl/pull/1591) ([apainintheneck](https://github.com/apainintheneck))
|
||||||
- Update dependency jinja2 to v3.1.2 [\#1579](https://github.com/jrnl-org/jrnl/pull/1579) ([renovate[bot]](https://github.com/apps/renovate))
|
- Update dependency jinja2 to v3.1.2 [\#1579](https://github.com/jrnl-org/jrnl/pull/1579) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "v3.2"
|
__version__ = "v3.3-beta"
|
||||||
|
|
|
@ -91,7 +91,7 @@ def get_config_path():
|
||||||
def get_default_config():
|
def get_default_config():
|
||||||
return {
|
return {
|
||||||
"version": __version__,
|
"version": __version__,
|
||||||
"journals": {"default": get_default_journal_path()},
|
"journals": {"default": {"journal": get_default_journal_path()}},
|
||||||
"editor": os.getenv("VISUAL") or os.getenv("EDITOR") or "",
|
"editor": os.getenv("VISUAL") or os.getenv("EDITOR") or "",
|
||||||
"encrypt": False,
|
"encrypt": False,
|
||||||
"template": False,
|
"template": False,
|
||||||
|
|
|
@ -122,10 +122,10 @@ def install():
|
||||||
)
|
)
|
||||||
journal_path = absolute_path(user_given_path or default_journal_path)
|
journal_path = absolute_path(user_given_path or default_journal_path)
|
||||||
default_config = get_default_config()
|
default_config = get_default_config()
|
||||||
default_config["journals"][DEFAULT_JOURNAL_KEY] = journal_path
|
default_config["journals"][DEFAULT_JOURNAL_KEY]["journal"] = journal_path
|
||||||
|
|
||||||
# If the folder doesn't exist, create it
|
# If the folder doesn't exist, create it
|
||||||
path = os.path.split(default_config["journals"][DEFAULT_JOURNAL_KEY])[0]
|
path = os.path.split(journal_path)[0]
|
||||||
try:
|
try:
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
|
@ -31,18 +31,19 @@ class TextExporter:
|
||||||
@classmethod
|
@classmethod
|
||||||
def write_file(cls, journal, path):
|
def write_file(cls, journal, path):
|
||||||
"""Exports a journal into a single file."""
|
"""Exports a journal into a single file."""
|
||||||
|
export_str = cls.export_journal(journal)
|
||||||
with open(path, "w", encoding="utf-8") as f:
|
with open(path, "w", encoding="utf-8") as f:
|
||||||
f.write(cls.export_journal(journal))
|
f.write(export_str)
|
||||||
print_msg(
|
print_msg(
|
||||||
Message(
|
Message(
|
||||||
MsgText.JournalExportedTo,
|
MsgText.JournalExportedTo,
|
||||||
MsgStyle.NORMAL,
|
MsgStyle.NORMAL,
|
||||||
{
|
{
|
||||||
"path": path,
|
"path": path,
|
||||||
},
|
},
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return ""
|
)
|
||||||
|
return ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def make_filename(cls, entry):
|
def make_filename(cls, entry):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "jrnl"
|
name = "jrnl"
|
||||||
version = "v3.2"
|
version = "v3.3-beta"
|
||||||
description = "Collect your thoughts and notes without leaving the command line."
|
description = "Collect your thoughts and notes without leaving the command line."
|
||||||
authors = [
|
authors = [
|
||||||
"jrnl contributors <maintainers@jrnl.sh>",
|
"jrnl contributors <maintainers@jrnl.sh>",
|
||||||
|
|
|
@ -118,7 +118,7 @@ def output_should_be_columns_wide(cli_run, width):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir):
|
def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir):
|
||||||
default_journal_path = config_on_disk["journals"]["default"]
|
default_journal_path = config_on_disk["journals"]["default"]["journal"]
|
||||||
expected_journal_path = (
|
expected_journal_path = (
|
||||||
os.path.join(temp_dir.name, journal_file)
|
os.path.join(temp_dir.name, journal_file)
|
||||||
if journal_dir == "."
|
if journal_dir == "."
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from jrnl.exception import JrnlException
|
from jrnl.exception import JrnlException
|
||||||
|
from jrnl.messages import Message
|
||||||
|
from jrnl.messages import MsgStyle
|
||||||
|
from jrnl.messages import MsgText
|
||||||
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
|
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
|
||||||
|
from jrnl.plugins.yaml_exporter import YAMLExporter
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
|
@ -28,3 +34,15 @@ class TestFancy:
|
||||||
|
|
||||||
with pytest.raises(JrnlException):
|
with pytest.raises(JrnlException):
|
||||||
check_provided_linewrap_viability(total_linewrap, [content], journal)
|
check_provided_linewrap_viability(total_linewrap, [content], journal)
|
||||||
|
|
||||||
|
|
||||||
|
class TestYaml:
|
||||||
|
@mock.patch("jrnl.plugins.yaml_exporter.YAMLExporter.export_journal")
|
||||||
|
@mock.patch("builtins.open")
|
||||||
|
def test_export_to_nonexisting_folder(self, mock_open, mock_export_journal):
|
||||||
|
mock_export_journal.side_effect = JrnlException(
|
||||||
|
Message(MsgText.YamlMustBeDirectory, MsgStyle.ERROR)
|
||||||
|
)
|
||||||
|
with pytest.raises(JrnlException):
|
||||||
|
YAMLExporter.write_file("journal", "non-existing-path")
|
||||||
|
mock_open.assert_not_called()
|
||||||
|
|
Loading…
Add table
Reference in a new issue