Skip to content

Commit

Permalink
Merge pull request #53 from jacebrowning/release/v0.4.1
Browse files Browse the repository at this point in the history
Release v0.4.1
  • Loading branch information
jacebrowning committed Feb 23, 2016
2 parents 7c099d7 + c05ec78 commit f467668
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 60 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,5 +1,9 @@
# Version History

## 0.4.1 (2016/02/23)

- Updated to YORM v0.6.

## 0.4 (2015/12/30)

- Added file watching to update program state faster.
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Expand Up @@ -5,8 +5,10 @@ SOURCES := Makefile setup.py $(shell find $(PACKAGE) -name '*.py')
EGG_INFO := $(subst -,_,$(PROJECT)).egg-info

# Python settings
PYTHON_MAJOR ?= 3
PYTHON_MINOR ?= 4
ifndef TRAVIS
PYTHON_MAJOR ?= 3
PYTHON_MINOR ?= 5
endif

# Test settings
UNIT_TEST_COVERAGE := 79
Expand Down
5 changes: 0 additions & 5 deletions README.md
Expand Up @@ -86,11 +86,6 @@ Include the applications you would like `mine` to manage. Computers are added au

The `versions` dictionary identifies the name of the executable on each platform. The `properties.auto_queue` setting indicates `mine` should attempt to launch the application automatically when switching computers. The `properties.single_instance` setting indicates the application must be closed on other computers before another instance can start.

For remote application management, `mine` needs to be started automatically on each of your computers. Cron is good for this:

1. Find the full path to `mine` with `$ which mine`
2. Add a `crontab` schedule with `$ crontab -e`: `@reboot /path/to/mine --daemon --verbose >> /tmp/mine.log 2>&1 &`

# Basic Usage

To synchronize the current computer's state:
Expand Down
2 changes: 1 addition & 1 deletion mine/__init__.py
Expand Up @@ -3,7 +3,7 @@
import sys

__project__ = 'mine'
__version__ = '0.4'
__version__ = '0.4.1'

CLI = 'mine'
VERSION = "{0} v{1}".format(__project__, __version__)
Expand Down
20 changes: 10 additions & 10 deletions mine/application.py
Expand Up @@ -10,23 +10,23 @@
log = logging.getLogger(__name__)


@yorm.attr(mac=yorm.converters.NullableString)
@yorm.attr(windows=yorm.converters.NullableString)
@yorm.attr(linux=yorm.converters.NullableString)
class Versions(yorm.converters.AttributeDictionary):
@yorm.attr(mac=yorm.types.NullableString)
@yorm.attr(windows=yorm.types.NullableString)
@yorm.attr(linux=yorm.types.NullableString)
class Versions(yorm.types.AttributeDictionary):
"""Dictionary of OS-specific application filenames."""


@yorm.attr(auto_queue=yorm.converters.Boolean)
@yorm.attr(single_instance=yorm.converters.Boolean)
class Properties(yorm.converters.AttributeDictionary):
@yorm.attr(auto_queue=yorm.types.Boolean)
@yorm.attr(single_instance=yorm.types.Boolean)
class Properties(yorm.types.AttributeDictionary):
"""Dictionary of application management settings."""


@yorm.attr(name=yorm.converters.String)
@yorm.attr(name=yorm.types.String)
@yorm.attr(properties=Properties)
@yorm.attr(versions=Versions)
class Application(NameMixin, yorm.converters.AttributeDictionary):
class Application(NameMixin, yorm.types.AttributeDictionary):
"""Dictionary of application information."""

# pylint: disable=E1101
Expand All @@ -46,7 +46,7 @@ def no_wait(self):


@yorm.attr(all=Application)
class Applications(yorm.converters.SortedList):
class Applications(yorm.types.SortedList):
"""List of monitored applications."""

def get(self, name):
Expand Down
10 changes: 5 additions & 5 deletions mine/computer.py
Expand Up @@ -12,10 +12,10 @@
log = logging.getLogger(__name__)


@yorm.attr(name=yorm.converters.String)
@yorm.attr(hostname=yorm.converters.String)
@yorm.attr(address=yorm.converters.String)
class Computer(NameMixin, yorm.converters.AttributeDictionary):
@yorm.attr(name=yorm.types.String)
@yorm.attr(hostname=yorm.types.String)
@yorm.attr(address=yorm.types.String)
class Computer(NameMixin, yorm.types.AttributeDictionary):
"""A dictionary of identifying computer information."""

def __init__(self, name, hostname=None, address=None):
Expand All @@ -38,7 +38,7 @@ def get_hostname():


@yorm.attr(all=Computer)
class Computers(yorm.converters.SortedList):
class Computers(yorm.types.SortedList):
"""A list of computers."""

@property
Expand Down
2 changes: 1 addition & 1 deletion mine/config.py
Expand Up @@ -13,7 +13,7 @@

@yorm.attr(applications=Applications)
@yorm.attr(computers=Computers)
class ProgramConfig(yorm.converters.AttributeDictionary):
class ProgramConfig(yorm.types.AttributeDictionary):
"""Dictionary of program configuration settings."""

def __init__(self):
Expand Down
18 changes: 2 additions & 16 deletions mine/services.py
Expand Up @@ -2,7 +2,6 @@

import os
import re
import getpass
import logging


Expand All @@ -26,7 +25,7 @@

def find_root(top=None):
"""Get the root of the shared directory."""
top = top or _default_top()
top = top or os.path.expanduser('~')

log.debug("Looking for sharing service in '%s'...", top)
for directory in os.listdir(top):
Expand All @@ -46,7 +45,7 @@ def find_root(top=None):
def find_config_path(top=None, root=None):
"""Get the path to the settings file."""
log.info("Looking for settings file...")
top = top or _default_top()
top = top or os.path.expanduser('~')
root = root or find_root(top=top)

log.debug("Looking for '%s' in '%s'...", CONFIG, root)
Expand All @@ -64,19 +63,6 @@ def find_config_path(top=None, root=None):
raise EnvironmentError("No '{}' file found".format(CONFIG))


def _default_top():
"""Get the default search path."""
username = getpass.getuser()
log.debug("Looking for home directory...")
for root in ROOTS:
dirpath = os.path.join(root, username)
if os.path.isdir(dirpath): # pragma: no cover - manual test
log.debug("Found home directory: %s", dirpath)
return dirpath

raise EnvironmentError("No home directory found for '{}'".format(username))


def delete_conflicts(root=None, config_only=False, force=False):
"""Delete all files with conflicted filenames."""
root = root or find_root()
Expand Down
18 changes: 9 additions & 9 deletions mine/status.py
Expand Up @@ -46,9 +46,9 @@ def wrapped(self, application, computer):
return wrapped


@yorm.attr(computer=yorm.converters.String)
@yorm.attr(computer=yorm.types.String)
@yorm.attr(timestamp=Timestamp)
class State(yorm.converters.AttributeDictionary):
class State(yorm.types.AttributeDictionary):
"""Dictionary of computer state."""

def __init__(self, name):
Expand All @@ -64,14 +64,14 @@ def __lt__(self, other):


@yorm.attr(all=State)
class StateList(yorm.converters.SortedList):
class StateList(yorm.types.SortedList):
"""List of computer states for an application."""


@yorm.attr(application=yorm.converters.String)
@yorm.attr(application=yorm.types.String)
@yorm.attr(computers=StateList)
@yorm.attr(next=yorm.converters.NullableString)
class Status(yorm.converters.AttributeDictionary):
@yorm.attr(next=yorm.types.NullableString)
class Status(yorm.types.AttributeDictionary):
"""Dictionary of computers using an application."""

def __init__(self, name):
Expand All @@ -88,13 +88,13 @@ def __lt__(self, other):


@yorm.attr(all=Status)
class StatusList(yorm.converters.SortedList):
class StatusList(yorm.types.SortedList):
"""List of application statuses."""


@yorm.attr(applications=StatusList)
@yorm.attr(counter=yorm.converters.Integer)
class ProgramStatus(yorm.converters.AttributeDictionary):
@yorm.attr(counter=yorm.types.Integer)
class ProgramStatus(yorm.types.AttributeDictionary):
"""Dictionary of current program status."""

def __init__(self):
Expand Down
6 changes: 0 additions & 6 deletions mine/test/test_services.py
Expand Up @@ -54,12 +54,6 @@ def test_find_depth(self, tmpdir):
with pytest.raises(OSError):
services.find_config_path(tmpdir.strpath)

@patch('os.path.isdir', Mock(return_value=False))
def test_find_no_home(self):
"""Verify an error occurs when no home directory is found."""
with pytest.raises(EnvironmentError):
services.find_config_path()

def test_find_no_share(self):
"""Verify an error occurs when no service directory is found."""
with pytest.raises(EnvironmentError):
Expand Down
6 changes: 3 additions & 3 deletions mine/timestamp.py
Expand Up @@ -8,9 +8,9 @@
log = logging.getLogger(__name__)


@yorm.attr(started=yorm.converters.Integer)
@yorm.attr(stopped=yorm.converters.Integer)
class Timestamp(yorm.converters.AttributeDictionary):
@yorm.attr(started=yorm.types.Integer)
@yorm.attr(stopped=yorm.types.Integer)
class Timestamp(yorm.types.AttributeDictionary):
"""Dictionary of last start and stop times."""

def __init__(self, started=0, stopped=0):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,2 +1,2 @@
YORM ~= 0.6.dev1
YORM ~= 0.6.1
psutil ~= 2.1
2 changes: 1 addition & 1 deletion scent.py
Expand Up @@ -39,7 +39,7 @@ def python(*_):

GROUP = int(time.time()) # unique per run

_show_coverage = True
_show_coverage = False
_rerun_args = None


Expand Down

0 comments on commit f467668

Please sign in to comment.