Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bootstrapping from iCloud Drive #1163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Support for RubyMine 2018.01 (via @kibitan)
- Support for IntelliJ Idea 2017.1, 2017.2, 2017.3, and 2018.1 (via @cool00geek)
- Remove references to OpenSSH private key syncing - removed in dcb26ba (via @njdancer)
- Add logic to detect mackup config in iCloud (via @njdancer)

## Mackup 0.8.18

Expand Down
10 changes: 9 additions & 1 deletion mackup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ def _parse_engine(self):
if self._parser.has_option('storage', 'engine'):
engine = str(self._parser.get('storage', 'engine'))
else:
engine = ENGINE_DROPBOX
icloud_config_path = os.path.expanduser(os.path.join(
'~/Library/Mobile Documents/com~apple~CloudDocs',
MACKUP_BACKUP_PATH,
MACKUP_CONFIG_FILE))

if os.path.exists(icloud_config_path):
engine = ENGINE_ICLOUD
else:
engine = ENGINE_DROPBOX

assert isinstance(engine, str)

Expand Down
20 changes: 20 additions & 0 deletions tests/config_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ def test_config_no_config(self):
assert cfg.apps_to_ignore == set()
assert cfg.apps_to_sync == set()

def test_config_icloud_config_present(self):
realpath = os.path.dirname(os.path.realpath(__file__))
os.environ['HOME'] = os.path.join(realpath, 'fixtures/default-to-icloud')

cfg = Config()

# Should should do the same as the a standard iCloud configuration
assert isinstance(cfg.engine, str)
assert cfg.engine == ENGINE_ICLOUD

assert isinstance(cfg.path, str)
assert cfg.path == os.path.expanduser(
'~/Library/Mobile Documents/com~apple~CloudDocs/')

assert isinstance(cfg.directory, str)
assert cfg.directory == u'Mackup'

assert isinstance(cfg.fullpath, str)
assert cfg.fullpath.endswith(u'/com~apple~CloudDocs/Mackup')

def test_config_empty(self):
cfg = Config('mackup-empty.cfg')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[storage]
engine = icloud