Package day-care manager on macOS.
Project description
- Platform:
OS X Yosemite, OS X El Capitan, macOS Sierra macOS High Sierra, macOS Mojave
- Language:
Python (version ≥ 3.4)
- Environment:
Console / Terminal
MacDaily
About
Package day-care manager on macOS.
MacDaily is a mediate collection of console scripts written in Python with support of PTY. Originally works as an automatic housekeeper for Mac to update all packages outdated, MacDaily is now fully functioned and end-user oriented. Without being aware of everything about your Mac, one can easily work around and manage packages out of no pain using MacDaily.
Installation
Just as many Python packages, MacDaily can be installed through pip using the following command, which will get you the latest version from PyPI.
pip install macdaily
Or if you prefer the real-latest version and fetch from this Git repository, then the script below should be used.
git clone https://github.com/JarryShaw/MacDaily.git
cd MacDaily
pip install -e .
# and to update at any time
git pull
And for tree format support in dependency command, you may need pipdeptree, then implicitly you can use the following script to do so.
pip install macdaily[pipdeptree]
# or explicitly...
pip install macdaily pipdeptree
Do please NOTE that, MacDaily runs only with support of Python from version 3.4 and on. And it shall only work ideally on macOS.
Also, for best performance of MacDaily, the notable automation tool expect is expected to be installed on your Mac. Recommended installation approach is from Homebrew, as shown below.
brew install expect
Configuration
This part might be kind of garrulous, for some may not know what’s going on here. 😉
Since robust enough, MacDaily now supports configuration upon user’s own wish. One may set up log path, hard disk path, archive path and many other things, other than the default settings.
NOTA BENE – MacDaily now supports configuration commands, see manual of config command for more information.
The configuration file should lie under ~/.dailyrc, which is hidden from Finder by macOS. To review or edit it, you may use text editors like vim and/or nano, or other graphic editors, such as Sublime Text and/or Virtual Studio Code, or whatever you find favourable.
[Path]
# In this section, paths for log files are specified.
# Please, under any circumstances, make sure they are valid.
logdir = ~/Library/Logs/MacDaily ; path where logs will be stored
dskdir = /Volumes/Your Disk ; path where your hard disk lies
arcdir = ${dskdir}/Developers ; path where ancient logs archive
[Mode]
# In this section, flags for modes are configured.
# If you would like to disable the mode, set it to "false".
apm = true ; Atom plug-ins
app = true ; macOS Applications
brew = true ; Homebrew Formulae
cask = true ; Homebrew Casks
cleanup = true ; cleanup caches
gem = true ; Ruby gems
mas = true ; Mac App Store applications
npm = true ; Node.js modules
pip = true ; Python packages
system = true ; macOS software
[Daemon]
# In this section, scheduled tasks are set up.
# You may append and/or remove the time intervals.
archive = false ; archive logs
bundle = false ; bundle packages
cleanup = false ; cleanup caches
config = false ; config MacDaily
dependency = false ; show dependencies
launch = false ; launch daemons
logging = true ; log installed packages
postinstall = false ; postinstall packages
reinstall = false ; reinstall packages
uninstall = false ; uninstall packages
update = true ; update packages
schedule = ; scheduled timing (in 24 hours)
8:00 ; update & logging at 8:00
22:30-update ; update at 22:30
23:00-logging ; logging at 23:00
[Command]
# In this section, command options are picked.
# Do make sure these options are available for commands.
update = --all --yes --pre --quiet --show-log --no-cask
logging = --all --quiet --show-log
[Miscellanea]
# In this section, miscellaneous specifications are assigned.
# Please, under any circumstances, make sure all fields are valid.
askpass = /usr/local/bin/macdaily-askpass ; SUDO_ASKPASS utility for Homebrew Casks
timeout = 300 ; timeout limit for shell commands in seconds
Above is the default content of .dailyrc, following the grammar of INI files. Lines and words after number sign (#) and semicolon (;) are comments, whose main purpose is to help understanding the contents of this file.
In section Path, there are path names where logs and some other things to be stored. In section Mode, there are ten different modes to indicate if they are enabled or disabled.
You may wish to set the dskdir – path where your hard disk lies, which allows MacDaily to archive your ancient logs and caches into somewhere never bothers.
Please NOTE that, under all circumstances, of section Path, all values would better be a valid path name without blank characters (' \t\n\r\f\v'), except your hard disk dskdir.
Besides, in section Daemon, you can decide which command is scheduled and when to run such command, with the format of HH:MM[-CMD]. The CMD is optional, which will be any if omits. And you may set up which command(s) will be registered as daemons and run with schedule through booleans above. These boolean values help MacDaily indicate which is to be launched when commands in schedule omit. That is to say, when CMD omits in schedule, MacDaily will register all commands that set true in the above boolean values.
Also, in section Option, you may set up optional arguments for the daemons above. Do please make sure these commands are valid. And if omit, an empty arguments will be given.
Last but no least, in section Miscellanea, you should NEVER modify any contents under this section in order to keep MacDaily working. However, you may set up this part with config command.
Usage Manual
Start-Up
Before we dive into the detailed usage of MacDaily, let’s firstly get our hands dirty with some simple commands.
NOTE – all acronyms and aliases are left out for a quick and clear view of MacDaily
How to use MacDaily?
# call from $PATH
$ macdaily [command ...] [flag ...]
# or call as Python module
$ python -m macdaily [command ...] [flag ...]
How to set up my disks and daemons?
$ macdaily config
How to relaunch daemons after I manually modified ~/.dailyrc?
$ macdaily launch
How to archive ancient logs without running any commands?
$ macdaily archive
How to update all outdated packages?
$ macdaily update --all
How to update a certain package (eg: hello from Homebrew)?
$ macdaily update brew --package=hello
How to update without a certain package (eg: update all packages except Python package ptyng)?
$ macdaily update --all --pip='!ptyng'
How to uninstall a certain package along with its dependencies (eg: pytest from brewed CPython version 3.6)?
$ macdaily uninstall pip --brew --cpython --python=3.6 --package pytest
How to reinstall all packages but do not cleanup caches?
$ macdaily reinstall --all --no-cleanup
How to postinstall packages whose name ranges between “start” and “stop” alphabetically?
$ macdaily postinstall --all --start=start --end=stop
How to show dependency of a certain package as a tree (eg: gnupg from Homebrew) ?
$ macdaily dependency brew --tree --package=gnupg
How to log all applications on my Mac, a.k.a. *.app files?
$ macdaily logging dotapp
How to dump a Macfile to keep track of all packages?
$ macdaily bundle dump
Commands
MacDaily supports several different commands. Of all commands, there are corresponding aliases for which to be reckoned as valid.
Command |
Aliases |
---|---|
cfg |
|
init |
|
up, upgrade |
|
un, remove, rm, r, un |
|
re |
|
post, ps, |
|
deps, dp |
|
log |
Generals
The man page of MacDaily shows as below.
$ macdaily --help
usage: macdaily [-h] command
Package Day Care Manager
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
Commands:
macdaily provides a friendly CLI workflow for the administrator of macOS to
manipulate packages
Commands for macdaily is shown as above and they are mandatory. For more detailed usage information, please refer to manuals of corresponding commands. For developers, internal details can be found in miscellanea manual. And here is a brief catalogue for the manuals.
Troubleshooting
- Where can I find the log files?
It depends. Since the path where logs go can be modified through ~/.dailyrc, it may vary as your settings. In default, you may find them under ~/Library/Logs/Scripts. And with every command, logs can be found in its corresponding folder. Logs are named after its running time, in the fold with corresponding date as its name.
Note that, normally, you can only find today’s logs in the folder, since macdaily automatically archive ancient logs into ${logdir}/archive folder. And every week, ${logdir}/archive folder will be tape-archived into ${logdir}/tarfile. Then after a month, and your hard disk available, they will be moved into /Volumes/Your Disk/Developers/archive.zip.
- What if my hard disk ain’t plugged-in when running the scripts?
Then the archiving and removing procedure will NOT perform. In case there might be some useful resources of yours.
- Which directory should I set in the configuration file?
First and foremost, I highly recommend you NOT to modify the paths in ~/.dailyrc manually, EXCEPT your disk path dskdir.
But if you insist to do so, then make sure they are VALID and available with permission granted, and most importantly, have NO blank characters (' \t\n\r\f\v') in the path, except dskdir.
TODO
✔️ support configuration
✔️ support command aliases
❌ reconstruct archiving procedure
❌ support gem and npm in all commands
❌ considering support more versions of Python
✔️ optimise KeyboardInterrupt handling procedure
✔️ review pip implementation and version indication
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file macdaily-2018.11.3.dev11.tar.gz
.
File metadata
- Download URL: macdaily-2018.11.3.dev11.tar.gz
- Upload date:
- Size: 38.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc2c8238f03dd0ea7392fa9a3ae401924f3750de334910599a7ccf1c7259644d |
|
MD5 | 627732031d80528e4c3bd4341ef32902 |
|
BLAKE2b-256 | bf85b996c216de56a88005058839adaa2a990c9eb66769b0e9e2d3fcd2d620fb |
File details
Details for the file macdaily-2018.11.3.dev11-py3-none-any.whl
.
File metadata
- Download URL: macdaily-2018.11.3.dev11-py3-none-any.whl
- Upload date:
- Size: 65.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e38a41118a655ea55dbc1e407dbe68095111ac75d9c9d7cda147c2e2b0440e4c |
|
MD5 | f28d779bc1dd14b2012aca751c64138e |
|
BLAKE2b-256 | 81a5e19ae01924c40f2c42c60512a40923fc884af710e9834ea135c45d672c70 |
File details
Details for the file macdaily-2018.11.3.dev11-py2-none-any.whl
.
File metadata
- Download URL: macdaily-2018.11.3.dev11-py2-none-any.whl
- Upload date:
- Size: 65.1 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94f88816ec211876b40c3b97bac14b8725868b53bd10a9df4b4fc4b6942a5c22 |
|
MD5 | 3a7ade8b88fc354e197a9dac0e6a9865 |
|
BLAKE2b-256 | b837befd1c85aafbe3a37ed07add072e8cd1c67e48796a17eb46ee9861367a27 |