Skip to content

Commit

Permalink
Merge pull request #190 from mathstuf/xdg-support
Browse files Browse the repository at this point in the history
XDG support
  • Loading branch information
ralphbean committed Feb 7, 2015
2 parents 063d03d + 07148bc commit ce5b8ff
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bugwarrior/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _get_section_name(flavor):
def pull(dry_run, flavor):
""" Pull down tasks from forges and add them to your taskwarrior tasks.
Relies on configuration in ~/.bugwarriorrc
Relies on configuration in bugwarriorrc
"""
twiggy.quickSetup()
try:
Expand Down Expand Up @@ -103,7 +103,7 @@ def targets():
@vault.command()
def list():
pws = lst(targets())
print "%i @oracle:use_keyring passwords in .bugwarriorrc" % len(pws)
print "%i @oracle:use_keyring passwords in bugwarriorrc" % len(pws)
for section in pws:
print "-", section

Expand Down
15 changes: 13 additions & 2 deletions bugwarrior/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import twiggy
from twiggy import log
from twiggy.levels import name2level
from xdg import BaseDirectory


def asbool(some_value):
Expand Down Expand Up @@ -81,7 +82,7 @@ def load_example_rc():

error_template = """
*************************************************
* There was a problem with your ~/.bugwarriorrc *
* There was a problem with your bugwarriorrc *
* {msg}
* Here's an example template to help: *
*************************************************
Expand Down Expand Up @@ -131,9 +132,19 @@ def validate_config(config, main_section):

def load_config(main_section):
config = ConfigParser({'log.level': "DEBUG", 'log.file': None})
path = None
first_path = BaseDirectory.load_first_config('bugwarrior')
if first_path is not None:
path = os.path.join(first_path, 'bugwarriorrc')
old_path = os.path.expanduser("~/.bugwarriorrc")
if path is None or not os.path.exists(path):
if os.path.exists(old_path):
path = old_path
else:
path = os.path.join(BaseDirectory.save_config_path('bugwarrior'), 'bugwarriorrc')
config.readfp(
codecs.open(
os.path.expanduser("~/.bugwarriorrc"),
path,
"r",
"utf-8",
)
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/docs/common_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ regardless of what project was assigned by the service itself::
Password Management
-------------------

You need not store your password in plain text in your `~/.bugwarriorrc` file;
You need not store your password in plain text in your `bugwarriorrc` file;
you can enter the following values to control where to gather your password
from:

Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Example Configuration
::

# Example ~/.bugwarriorrc
# Example bugwarriorrc
# General stuff.
[general]
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/docs/using.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It's ideal to create a cron task like::
*/15 * * * * /usr/bin/bugwarrior-pull

Bugwarrior can emit desktop notifications when it adds or completes issues
to and from your local ``~/.task/`` db. If your ``~/.bugwarriorrc`` file has
to and from your local ``~/.task/`` db. If your ``bugwarriorrc`` file has
notifications turned on, you'll also need to tell cron which display to use by
adding the following to your crontab::

Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/services/activecollab2.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_issue_generator(self, user_id, project_id, project_name):
"""
Approach:
1. Get user ID from .bugwarriorrc file
1. Get user ID from bugwarriorrc file
2. Get list of tickets from /user-tasks for a given project
3. For each ticket/task returned from #2, get ticket/task info and
check if logged-in user is primary (look at `is_owner` and
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"dogpile.cache>=0.5.3",
"lockfile>=0.9.1",
"click",
"pyxdg",
],
tests_require=[
"Mock",
Expand Down

0 comments on commit ce5b8ff

Please sign in to comment.