Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \

Expand Down
23 changes: 0 additions & 23 deletions pkg/com.sheagcraig.yo.cleanup.plist

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/com.sheagcraig.yo.login_once.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</array>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/yo</string>
<string>/usr/local/bin/yo_scheduler</string>
<string>--cached</string>
</array>
<key>RunAtLoad</key>
Expand Down
2 changes: 1 addition & 1 deletion pkg/com.sheagcraig.yo.on_demand.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</array>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/yo</string>
<string>/usr/local/bin/yo_scheduler</string>
<string>--cached</string>
</array>
<key>KeepAlive</key>
Expand Down
19 changes: 18 additions & 1 deletion pkg/yo_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()