From 97ae49460228b34814983d9f3d9f65e42f9467d2 Mon Sep 17 00:00:00 2001 From: Dmitry Danilson Date: Tue, 13 Oct 2015 23:17:02 +0500 Subject: [PATCH 1/4] Create test_cache --- tests/test_cache | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/test_cache diff --git a/tests/test_cache b/tests/test_cache new file mode 100644 index 000000000..55a17ec32 --- /dev/null +++ b/tests/test_cache @@ -0,0 +1,5 @@ +"""Check cache saving.""" + +import subprocess + +subprocess.call("proselint /usr/local/lib/python2.7/dist-packages/proselint/demo.md", shell=True) From 8a0f88d3cd437c0dddde8076aa14a8c36d49c8a9 Mon Sep 17 00:00:00 2001 From: Dmitry Danilson Date: Tue, 13 Oct 2015 23:29:22 +0500 Subject: [PATCH 2/4] Update command_line.py --- proselint/command_line.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proselint/command_line.py b/proselint/command_line.py index 73f040182..857fadb5f 100644 --- a/proselint/command_line.py +++ b/proselint/command_line.py @@ -118,11 +118,10 @@ def timing_test(corpus="0.1.0"): def clear_cache(): """Delete the contents of the cache.""" print("Deleting the cache...") - path_of_this_file = os.path.dirname(os.path.realpath(__file__)) subprocess.call("find . -name '*.pyc' -delete", shell=True) subprocess.call( "rm -rfv proselint/cache > /dev/null && mkdir -p {}".format( - os.path.join(path_of_this_file, "cache")), + os.path.join(os.path.expanduser("~"), ".proselint")), shell=True) From 36614261dbd3c9edcf56aa923b576b8c28210f51 Mon Sep 17 00:00:00 2001 From: Dmitry Danilson Date: Tue, 13 Oct 2015 23:32:47 +0500 Subject: [PATCH 3/4] Update tools.py --- proselint/tools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proselint/tools.py b/proselint/tools.py index ef3bfffea..69239a2ca 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -14,10 +14,9 @@ def memoize(f): """Cache results of computations on disk.""" - path_of_this_file = os.path.dirname(os.path.realpath(__file__)) # Determine the location of the cache. - cache_dirname = os.path.join(path_of_this_file, "cache") + cache_dirname = os.path.join(os.path.expanduser("~"), ".proselint") # Create the cache if it does not already exist. if not os.path.isdir(cache_dirname): From e42972a71f4649ef86ecc4c0dc41cc7676b72ba4 Mon Sep 17 00:00:00 2001 From: Dmitry Danilson Date: Tue, 13 Oct 2015 23:35:18 +0500 Subject: [PATCH 4/4] Update tools.py --- proselint/tools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/proselint/tools.py b/proselint/tools.py index 69239a2ca..ed6df2ed5 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -14,7 +14,6 @@ def memoize(f): """Cache results of computations on disk.""" - # Determine the location of the cache. cache_dirname = os.path.join(os.path.expanduser("~"), ".proselint")