Commit Graph

263 Commits

Author SHA1 Message Date
Kare Morstol 280f9e631e Change flatmap to map. Because ‘open’ doesn't return an optional. 2015-11-12 23:29:43 +01:00
Kare Morstol 53feebe0e2 Readme: add example. 2015-11-12 02:20:48 +01:00
Kare Morstol d9ff7a5884 Simplify main.arguments. 2015-11-11 20:55:32 +01:00
Kare Morstol 8b6e6f1ed6 Exchange main.name with main.path. 2015-11-11 20:38:58 +01:00
Kare Morstol b5448f485a Cleanup code with guard. 2015-11-11 03:41:38 +01:00
Kare Morstol 3554bb4ef8 Simplify SwiftShellTests/Scripts/print_linenumbers.swift . 2015-11-10 21:06:47 +01:00
Kare Morstol a7b7033383 Remove a couple of double spaces.
I do not like double spaces.
2015-11-09 23:53:12 +01:00
Kare Morstol 869eb69963 Readme: fill out ‘Usage' section. 2015-11-09 23:51:39 +01:00
Kare Morstol 4da7c5b668 Use $SWIFTSHELL_FRAMEWORK_PATH instead of $DYLD_FRAMEWORK_PATH in the swiftshell launcher script.
Because of this change in El Capitan:

	"Spawning children processes of processes restricted by System Integrity Protection, such as by launching a helper process in a bundle with NSTask or calling the exec(2) command, resets the Mach special ports of that child process. Any dynamic linker (dyld) environment variables, such as DYLD_LIBRARY_PATH, are purged when launching protected processes."

https://developer.apple.com/library/prerelease/mac/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
2015-11-09 21:45:54 +01:00
Kare Morstol 78d8492c66 Enable testability and only build active architecture.
As suggested by Xcode 7.1.
2015-11-09 20:11:55 +01:00
Kare Morstol 1f07d40f04 Make error messages more concise and to the point. 2015-10-29 00:21:31 +01:00
Kare Morstol 6065d0226f Add a trailing / to ‘main.currentdirectory’ too.
I should probably be using NSURLs for file paths, but they are just so cumbersome to work with in Swift. Besides many file operations in Foundation require strings, not NSURLs.
2015-10-19 02:24:45 +02:00
Kare Morstol cab35b4078 Add a trailing / to ‘main.tempdirectory’. 2015-10-18 23:44:22 +02:00
Kare Morstol 70319b54db Update test scripts for SwiftShell 2.0.
Finally.
2015-10-16 03:52:47 +02:00
Kare Morstol b447059e3e Add ‘open’ functions for writing to files. 2015-10-16 03:30:44 +02:00
Kare Morstol 1d07e1db41 Add main.tempdirectory . 2015-10-16 02:10:21 +02:00
Kare Morstol 796af16d1a Add 'open' functions for reading files. 2015-10-15 23:05:20 +02:00
Kare Morstol f1ef868d96 Set deployment target to OS X 10.9.
Might as well, we are not using any new APIs from Foundation.
2015-10-14 19:04:19 +02:00
Kare Morstol 2de04312b5 Test using streams with ‘print’. 2015-10-07 20:09:13 +02:00
Kare Morstol 93809fa694 Enable strings to run commands using themselves as standard input. 2015-10-07 18:48:04 +02:00
Kare Morstol 99df0ddf19 Enable ReadableStream to run commands using itself as stdin. 2015-10-07 18:42:19 +02:00
Kare Morstol 236a424190 Make AsyncShellTask's stdin and stderror ReadableStreams too. 2015-10-07 17:31:04 +02:00
Kare Morstol 2ea2c5ccce Make shellcontext's stdin and stderror be ReadableStream and WriteableStream. 2015-10-07 16:37:18 +02:00
Kare Morstol 31508d338c Create ReadableStream and streams() . 2015-10-07 15:33:06 +02:00
Kare Morstol a521828ddb Create WriteableStream, make shellcontext.stdout into one. 2015-10-07 15:09:43 +02:00
Kare Morstol c3484d626f Test effects of context.currentdirectory on NSURL.baseURL . 2015-10-06 18:59:03 +02:00
Kare Morstol 1a6fdc7f2c Clean up documentation indentation.
Looks nicer on GitHub now, but documentation looks awful in Xcode Quick Help Inspector. It apparently demands I use spaces for indentation. I have some grumbling and reiteration of the virtues of tabs for indentation left to do before I give in.
2015-10-06 18:30:10 +02:00
Kare Morstol 6ff91b2b57 Make pathForExecutable an inner function. 2015-10-06 18:25:08 +02:00
Kare Morstol b7dab5666e Remove completely unnecessary double spaces. 2015-10-04 20:25:39 +02:00
Kare Morstol 560ea1e8ec Let 'pathForExecutable' use its context's environment. 2015-10-04 20:22:39 +02:00
Kare Morstol 171ba23f0b Move 'run*' commands over to protocol ShellRunnable. 2015-10-04 19:50:13 +02:00
Kare Morstol d4c2bbed89 Add unit tests for running commands from custom context. 2015-10-04 19:22:23 +02:00
Kare Morstol 604756f5b3 Add file and linenr to error messages from 'runAsync'. 2015-10-02 23:37:58 +02:00
Kare Morstol a9d6197aee Specify what error runAndPrint (bash bashcommand: String) can throw. 2015-09-27 00:55:50 +02:00
Kare Morstol e20717767b Add file and linenr to error messages from 'exit' and 'run'. 2015-09-27 00:53:31 +02:00
Kare Morstol f760841635 Rename setupTask to createTask. 2015-09-27 00:20:17 +02:00
Kare Morstol 325af43d42 Include the command when throwing ShellError.ReturnedErrorCode . 2015-09-26 23:46:39 +02:00
Kare Morstol 19bd97a7b0 Improve documentation and code organization. 2015-09-26 21:07:39 +02:00
Kare Morstol bc4f0d76ca Return exit code 127 on InAccessibleExecutable. 2015-09-25 02:26:37 +02:00
Kare Morstol 89e06acc72 Give 'run' and 'runAsync' much nicer errors when running inaccessible executables.
- add ShellError.InAccessibleExecutable
- add ShellError.errorcode
- add exit(ErrorType)
2015-09-25 02:18:05 +02:00
Kare Morstol e13202ad09 runAndPrint throws error when command is inaccessible. 2015-09-25 00:26:09 +02:00
Kare Morstol a747b13228 Create struct ShellContext:ShellContextType . 2015-09-23 03:33:29 +02:00
Kare Morstol 1bb3b0fcf7 README: Add Carthage badge of compatibility.
Because it is. Compatible that is.
2015-09-23 02:57:24 +02:00
Kare Morstol b253497f07 Let run* commands find path to executable automatically. 2015-09-23 02:27:16 +02:00
Kare Morstol e0a8087a98 Remove references to Carthage from test target build settings. 2015-09-22 02:03:33 +02:00
Kare Morstol acb1fe6cc1 Improve documentation of Context.swift . 2015-09-22 01:57:44 +02:00
Kare Morstol 638fb719df Make more properties of MainShellContext lazy.
Will be important later on if/when I implement truly global standard input/output redirection.
2015-09-22 01:56:25 +02:00
Kare Morstol 1ce3f6e165 Simplify [Any].flatten() . 2015-09-22 01:44:00 +02:00
Kare Morstol 8c227b8fae Let run* commands take shell arguments of any type. 2015-09-21 23:21:00 +02:00
Kare Morstol 3f09e7498d Add [Any].flatten() . 2015-09-20 20:12:42 +02:00