diff --git a/CHANGELOG.md b/CHANGELOG.md index ed8c1a9..6f3fdef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased][unreleased] -## [2.0.0]- 2017-06-06 - Kurt Russel's Hair in Big Trouble in Little China +## [2.0.1]- 2017-06-12 - Roddy Piper's Hair in They Live + +### Fixed +- Fixed paths to `yo_scheduler` in LaunchAgents. + +## [2.0.0]- 2017-06-06 - Kurt Russell's Hair in Big Trouble in Little China ### Changed - Updated to Swift 3 syntax. @@ -47,7 +52,8 @@ All notable changes to this project will be documented in this file. This projec ### Added - Initial commit. -[unreleased]: https://github.com/sheagcraig/yo/compare/2.0.0...HEAD +[unreleased]: https://github.com/sheagcraig/yo/compare/2.0.1...HEAD +[2.0.1]: https://github.com/sheagcraig/yo/compare/2.0.1...2.0.0 [2.0.0]: https://github.com/sheagcraig/yo/compare/2.0.0...1.0.3 [1.0.3]: https://github.com/sheagcraig/yo/compare/1.0.2...1.0.3 [1.0.2]: https://github.com/sheagcraig/yo/compare/1.0.1...1.0.2 diff --git a/pkg/Makefile b/pkg/Makefile index 8a0e1ef..ac60053 100644 --- a/pkg/Makefile +++ b/pkg/Makefile @@ -7,7 +7,6 @@ PAYLOAD=\ pack-usr-local-bin-yo_scheduler.py \ pack-Library-LaunchAgents-com.sheagcraig.yo.on_demand.plist \ pack-Library-LaunchAgents-com.sheagcraig.yo.login_once.plist \ - pack-Library-LaunchDaemons-com.sheagcraig.yo.cleanup.plist \ pack-script-postinstall \ pack-script-preinstall \ diff --git a/pkg/com.sheagcraig.yo.cleanup.plist b/pkg/com.sheagcraig.yo.cleanup.plist deleted file mode 100644 index 927b535..0000000 --- a/pkg/com.sheagcraig.yo.cleanup.plist +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Label - com.sheagcraig.yo.cleanup - ProgramArguments - - /usr/local/bin/yo - --cleanup - - KeepAlive - - PathState - - /private/tmp/.com.sheagcraig.yo.cleanup.launchd - - - - OnDemand - - - diff --git a/pkg/com.sheagcraig.yo.login_once.plist b/pkg/com.sheagcraig.yo.login_once.plist index cd99b90..1e78065 100644 --- a/pkg/com.sheagcraig.yo.login_once.plist +++ b/pkg/com.sheagcraig.yo.login_once.plist @@ -10,7 +10,7 @@ ProgramArguments - /usr/local/bin/yo + /usr/local/bin/yo_scheduler --cached RunAtLoad diff --git a/pkg/com.sheagcraig.yo.on_demand.plist b/pkg/com.sheagcraig.yo.on_demand.plist index 8875a2d..36d50a4 100644 --- a/pkg/com.sheagcraig.yo.on_demand.plist +++ b/pkg/com.sheagcraig.yo.on_demand.plist @@ -10,7 +10,7 @@ ProgramArguments - /usr/local/bin/yo + /usr/local/bin/yo_scheduler --cached KeepAlive diff --git a/pkg/yo_scheduler.py b/pkg/yo_scheduler.py index d8a7374..8674cf0 100755 --- a/pkg/yo_scheduler.py +++ b/pkg/yo_scheduler.py @@ -63,7 +63,6 @@ __version__ = "2.0.0" BUNDLE_ID = "com.sheagcraig.yo" -CLEANUP_PATH = "/private/tmp/.com.sheagcraig.yo.cleanup.launchd" WATCH_PATH = "/private/tmp/.com.sheagcraig.yo.on_demand.launchd" YO_BINARY = "/Applications/Utilities/yo.app/Contents/MacOS/yo" # This is captured straight from running the Yo binary and must be @@ -121,6 +120,14 @@ def main(): # yo_scheduler (this script) args from the yo app's args. launcher_args, yo_args = parser.parse_known_args() + # Check if Yo is installed in the expected binary path + if os.path.isfile(YO_BINARY) == False: + exit_if_no_binary() + + # If no args passed, print help and exit + if len(yo_args) == 0 : + exit_if_no_args() + if any(flag in yo_args for flag in ("--version", "-v")): # Skip further checks if version is requested. run_yo_with_args(yo_args) @@ -291,5 +298,15 @@ def exit_if_not_root(): sys.exit("Only the root user may schedule notifications.") +def exit_if_no_args(): + """Exit if no args passed""" + sys.exit(YO_HELP) + + +def exit_if_no_binary(): + """Exit if the binary could be located""" + sys.exit("Could not locate {}".format(YO_BINARY)) + + if __name__ == "__main__": main()