Commit Graph

123 Commits

Author SHA1 Message Date
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 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 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 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 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 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 d4c2bbed89 Add unit tests for running commands from custom context. 2015-10-04 19:22:23 +02:00
Kare Morstol 325af43d42 Include the command when throwing ShellError.ReturnedErrorCode . 2015-09-26 23:46:39 +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 b253497f07 Let run* commands find path to executable automatically. 2015-09-23 02:27:16 +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
Kare Morstol d6055c6062 Remove CatchingFire framework and add it as a single file.
Carthage 0.9.1 is not compatible with the catching fire framework as it has too many SDKs (5). It seems 2 is the limit. In any case it was a bit too much trouble and overhead just to include the functionality of this one file.
2015-09-19 19:09:30 +02:00
Kare Morstol a222c4d15a Implement "NSURL / String" operator.
Overriding a standard operator for a completely different use case like this is not normally recommended, but I think it is warranted here. It's certainly a lot better than "URLByAppendingPathComponent".
2015-09-08 23:44:09 +02:00
Kare Morstol 91abb8c47c Update test scripts.
The rest are waiting for reading and writing files to be implemented.
2015-09-08 18:06:49 +02:00
Kare Morstol 2d368bf7d6 Remove old Xcode project and unused files. 2015-09-08 18:04:37 +02:00
Kare Morstol 9cfd7e5c39 Add run*(executable: String, _ args: [String]). Make global versions of main.run* .
All unit tests use global functions.
Removed unnecessary testFinishReturnsSelf.
2015-09-07 23:58:50 +02:00
Kare Morstol 93922a4101 Fix main.name .
Now prints the script's name instead of its path.
2015-09-07 22:17:37 +02:00
Kare Morstol bacdbddddc Implement ShellContextType.runAndPrint . 2015-09-06 20:58:31 +02:00
Kare Morstol c6975aefd1 Make AsyncShellTask.finish return self.
For method chaining.
2015-09-03 18:25:28 +02:00
Kare Morstol de708331a8 Add 'ShellError', which may be thrown from completed shell commands. 2015-09-03 17:45:28 +02:00
Kare Morstol 10cf827d8b Add CatchingFire testing framework.
For testing error handling.
2015-09-03 17:27:07 +02:00
Kare Morstol 239d32edfd Rename ‘$’ to ‘run’.
Trying to not repeat the mistakes of bash shell scripting here.
2015-09-02 17:34:40 +02:00
Kare Morstol a8bfc6b1a6 Add 'runAsync' commands for asynchronous shell execution. 2015-09-02 16:55:33 +02:00
Kare Morstol e868d67050 Fix assert message. 2015-08-13 20:09:57 +02:00
Kare Morstol b45ccd814c Add unit tests for everything that doesn't result in printErrorAndExit.
As verified by the wonderful new code coverage feature of Xcode.
2015-08-09 23:07:27 +02:00
Kare Morstol da3a0f5361 Add $(bash:) . Refactor command.swift.
Had to add leading spaces (shudder) to the documentation comment to get Xcode to render it properly. Hopefully this is just a temporary fix.
2015-08-06 03:49:57 +02:00
Kare Morstol 60e98f3ba5 Add assertion via shell command to testCurrentDirectory_CanChange. 2015-08-05 21:12:37 +02:00
Kare Morstol 5252385e35 Add much needed Context and printErrorAndExit. 2015-08-04 04:10:57 +02:00
Kare Morstol 8bec5cf499 Eviscerate pretty much everything.
Will be changing a lot of the API, and do not want to have to change all the unit test and the rest of the code for every single change.
2015-07-19 22:49:39 +02:00
Kare Morstol 0888054ad0 Shell tests use new Xcode project. 2015-07-19 22:14:33 +02:00
Kare Morstol a9dbdcf629 Update to Swift 2.0 .
Wow, lots of changes in Swift 2.0! And all of them great, except for renaming println to print. What's up with that?
This is just to get it to compile, we will be trying and throwing errors in no time.
2015-06-28 00:52:40 +02:00
Kare Morstol e55b2f91f5 Small changes to documentation 2015-03-20 22:02:28 +01:00
Kare Morstol 908a8ecaae Revert "Fix compiler crash - make workdirectory a struct"
This reverts commit e8333f2922.
2015-02-27 23:53:32 +01:00
Kare Morstol 9e2d44682f Revert "Move workdirectory to NSFileManager extension."
This reverts commit f8f7c78de9.
2015-02-27 23:52:56 +01:00