472 Commits

Author SHA1 Message Date
Fabien C. Y. Benureau
0f84268ebf Honor custom pubsdoc in config 2016-06-06 00:25:27 +02:00
Fabien C. Y. Benureau
2aad93b526 Simplify, update the testsuite
Replace the in-house stubbing by the facilities offered
by pyfakefs for running tests. We don't use `io.open`
anymore, because pyfakefs does not stub it correctly.
We rely on a patched version of pyfakefs, as a few bug
remain in the official repo.
2016-06-05 21:48:19 +02:00
Fabien Benureau
dcfe429e42 Merge pull request #54 from pubs/feat/cache
Add a cache to speed up commands.
2016-06-01 15:33:19 +02:00
Olivier Mangin
2859e4bc62 More refactoring to remove code duplication. Also adds tests. 2016-02-02 21:21:24 -05:00
Olivier Mangin
57a32e5601 Removes some code duplication. 2016-02-02 19:06:34 -05:00
Fabien Benureau
d9f24052fc Update bs4 code; removes warning 2016-01-31 06:57:04 +01:00
Fabien Benureau
22c7acde99 Rewrite cache in case of any problem 2016-01-23 02:31:20 +01:00
Fabien Benureau
ee3a7cd77d Travis uses tests/requirements.txt 2016-01-23 02:11:08 +01:00
Fabien Benureau
e5b898c5c2 Cache implemented
The implementation is designed to be robust to filesystems having integers
or nanosecond stat time.

Added a requirements.txt file for the tests:
`pip install -r tests/requirements.txt` to install the necessary packages
to run the tests.

Fix #13, Fix #14
2016-01-23 02:03:02 +01:00
Fabien Benureau
9ad6d8db25 Simplified fake_env code
1. Removed the unicode wrapper around fake_env io
2. Overrided pyfakefs cStringIO with StringIO (Python 2.x)
3. copy_dir will copy file in binary file to the fake filesystem
   *unless* they are bib, yaml, txt or md files
4. ui.handle_exception() conserve traceback

Numerous unicode subtelties required diving into pyfakefs and configobj
source code. Unicode on Python 2.x is the worst.
2016-01-21 16:18:16 +01:00
Olivier Mangin
a7012f532d Merge pull request #53 from pubs/feat/skippable_tests
Fix expectedFailure tests
2016-01-17 18:58:31 -05:00
Fabien Benureau
620eef4ace Fix expectedFailure tests 2016-01-17 02:42:56 +01:00
Fabien Benureau
e979aae85b Better rename and error dialogue
info() messages now print on stdout. warning() and error() still
print on stderr.

Fix #50
2016-01-16 21:52:36 +01:00
Olivier Mangin
b4d066e1f9 Merge pull request #52 from pubs/feat/better-exceptions
Better exceptions handling at the ui level.
2016-01-15 19:08:16 -05:00
Olivier Mangin
2d9fa9af94 Comments out failing test from #25. 2016-01-15 19:02:56 -05:00
Olivier Mangin
35214e3012 Fix using str instead of ustr for python2 compatibility. 2016-01-15 19:02:56 -05:00
Olivier Mangin
2720d13049 Moves test of config file creation to its own test. 2016-01-15 19:02:56 -05:00
Olivier Mangin
ecb1910084 Better error message on UnicodeDecodeError for reading text file.
Also renames read_file to read_text_file which is what is implemented.
Fixes #51.
2016-01-15 19:02:56 -05:00
Olivier Mangin
348bd6d64b FIX wrong access to debug configuration value.
Also adds the option to the config spec.
2016-01-15 19:02:56 -05:00
Olivier Mangin
ed2bbb4498 Removes generic handling of errors from commands.
The default behavior for commands is now to only catch exceptions that
must be handled specifically. This includes outputting a context
dependant message, cleaning up, etc. All other exceptions will be
handled by the ui.
2016-01-15 19:02:56 -05:00
Olivier Mangin
df8f0e6d6b FIX error handler.
Also fix alignments.
2016-01-15 19:02:56 -05:00
Olivier Mangin
6366f4bd01 Uses exception __string__, not __repr__ to carry message. 2016-01-15 19:02:56 -05:00
Olivier Mangin
b12c6297f0 Adds exception catching in main command. 2016-01-15 19:02:56 -05:00
Olivier Mangin
7f6dde2f0c Temporary fix ExpectedFailure does not handle SystemExit on python 2.
Actually the test not only is expected to fail but it misses a file
which causes an error instead of a failure on python 2. Should be
addressed by #25.
2016-01-15 19:02:56 -05:00
Olivier Mangin
e3df872e65 Updates for new version of pyfakefs.
Modules should now be imported from the pyfakefs package.
2016-01-15 19:02:43 -05:00
Olivier Mangin
9d0a800d8b Cleans up old imports of ConfigParser. 2016-01-15 16:45:06 -05:00
Fabien Benureau
3e3a671837 Remove bibtexparser unicode conversion
It was transforming "\&" into "&", rendering the output of
pubs export unsuitable for latex rendering.
2016-01-10 23:00:44 +01:00
Fabien Benureau
a5a653becd Support old bibtexparser keywords
So previous commit 666941d471 broke the current pip version
of bibtexparser (0.6.2), which does not have a
homegeneize_fields keyword. My bad and fixed!
2016-01-10 22:15:24 +01:00
Fabien Benureau
2db80c66ae Add volume to field ordering
Fix #40, which was annoying.
Any implementation of #33 should watch out for this.
2016-01-10 22:08:23 +01:00
Fabien Benureau
666941d471 Set bibtexparser homogenize_fields to True
The default changed from True to False. It is not explicitly set.
2016-01-10 22:04:58 +01:00
Fabien Benureau
98a2f1d646 Fix quadratic output in export 2016-01-10 19:40:01 +01:00
Fabien Benureau
a702d86a74 Make pubs doc subparsers required
Before, `pubs doc` alone would just exit without printing any help
2016-01-07 14:09:22 +01:00
Fabien Benureau
82c93cf695 Predefined themes and a color bash script
Fix: #44
2016-01-07 14:02:43 +01:00
Fabien Benureau
78c562d640 256 colors support
+ The colors name's are the number 0 through 255.
+ Old names still work.
+ Add `magenta` color, wrongly named `purple` before.
+ Adds `white`, `darkgrey`.
+ grey/gray spelling

Also removed italics as a default option for publisher.

Related: #44
2016-01-07 14:02:43 +01:00
Olivier Mangin
87346707be FIX discrepancy in readme. 2016-01-06 23:56:55 -05:00
Fabien Benureau
ec98221d1c Sanitize one-liner strings
Fixes #26
2015-12-26 17:23:26 +01:00
Fabien Benureau
b6e8139bc3 Remove extraneous doc message 2015-12-20 22:22:11 +01:00
Fabien Benureau
b2ebc67f5e Handle Unicode BOM in bibfile
In particular, xml2bib file created without the `-nb` options would trip bibtexparser.

Fixes #23
2015-12-20 22:20:01 +01:00
Fabien Benureau
220e5ad9a8 Fix tests for python 3 2015-12-20 19:26:33 +01:00
Fabien Benureau
69dc3a1690 Parsing error displays bibdata 2015-12-20 18:55:23 +01:00
Fabien Benureau
3b0ba0bb3c Test for leading space in citekeys
This test is expected to fail. Nose does not handle that yet (treats it as false).
As such, changes have been made to make tests discoverable by unittest.
You may want to uninstall nose and do something like:
alias nosetests="python -m unittest discover"
in your bashrc

Related: #25
2015-12-20 18:51:43 +01:00
Fabien Benureau
0ab8310089 Fix color in test_oneliner 2015-12-20 18:51:00 +01:00
Fabien Benureau
48e7658b8c Update readme.md
Precise that the alias plugin should be activated. (see #47)
Section on document management, and clues where to find more help.
Remove outdated requirements, automatically installed anyway.
2015-12-20 16:02:00 +01:00
Fabien Benureau
5ca090668f Handle IOError: [Errno 32] Broken pipe
Will happen if piping through a pager like less, that closes
stdout before everything has been printed.

Related: #47
2015-12-18 22:36:41 +01:00
Fabien Benureau
2ba435126d Add --force-colors option
Useful when piping to a pager that supports color.
Improved and cleaned up a bit the ui functions too.

Related #44, #47
2015-12-18 22:35:19 +01:00
Fabien Benureau
a291114900 Remove duplicated edit_cmd code
Makes nano the default editor.

Fixes #46
2015-12-17 12:54:18 +01:00
Olivier Mangin
854702488c Fixes #46: editor command behaviors with the new config.
- Fix the previous default to 'None' (the string 'None', not None)
in the config.
- Adds support for using the $EDITOR when none is defined in the condif.
- Use ui.editor instead of content.editor in the add commnand.
2015-12-16 15:45:45 -05:00
Fabien Benureau
aa521576f5 More robust plugin list in conf
A single plugin name or an absence of it, with or without comma,
is now properly handled.

Related: #18
2015-12-16 17:02:38 +01:00
Fabien Benureau
f843aebcbd Better handle utf-8 citekeys
Utf-8 citekeys generate errors in bibtexparser. Until this is fixed,
this commit replace the stack-trace by a clear error message.

related: #28
2015-12-16 16:38:40 +01:00
Fabien Benureau
402cf62db0 Merge pull request #42 from 73/master
`doc`, `info` command & prefix completion

+ Prefix completion, see #34 
+ Add `doc` command, closes #41 
+ Add `info` ui command, closes #43
2015-12-16 15:26:39 +01:00