Commit Graph

112 Commits

Author SHA1 Message Date
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
Kare Morstol f8f7c78de9 Move workdirectory to NSFileManager extension.
To work around compiler crash in Xcode 6.3 beta 1 on public global
variables with default value. Wanted to move tempdirectory there too
but extensions can’t have stored properties.
Close #8.
Close #9 (pull request from @beltex)
2015-02-14 00:34:52 +01:00
beltex e8333f2922 Fix compiler crash - make workdirectory a struct 2015-02-13 12:33:15 -05:00
Kare Morstol 9555306183 Close #3: Make sure runtests.bash is using an up to date _release_ build. 2015-01-06 18:34:40 +01:00
Kare Morstol a1e26bfcc8 Tidy up / nitpick. 2014-12-09 18:07:04 +01:00
Kare Morstol 4d2fca7b74 Add operator |>> for printing anything to a writable stream.
Replaced all uses of writeTo with the new operator in unit tests, test scripts and readme.
2014-12-04 20:05:15 +01:00
Kare Morstol 1f96ffa770 Enable "/" as file path concatenation operator.
Now you can do `let filepath = tempdirectory / "newfile.txt"`.
2014-12-02 02:06:21 +01:00
Kare Morstol e74189d008 Make tempdirectory a String instead of a NSURL.
The fact that NSURLs cannot be created with string literals makes them too cumbersome to use.
2014-12-02 00:17:39 +01:00
Kare Morstol bf19e4241b Add global variable "workdirectory". 2014-12-01 23:43:39 +01:00
Kare Morstol fcd7eba2a4 Fix horrendous use of spaces for indentation. 2014-12-01 22:43:03 +01:00
Kare Morstol a2985b049d Add shell unit tests and update test scripts.
Run SwiftShellTests/Scripts/runtests.bash to perform all unit tests.
2014-11-26 20:58:22 +01:00
Kare Morstol c65e029811 Include assert.sh from http://github.com/lehmannro/assert.sh for shell unit testing.
Also included the required licenses.
2014-11-26 20:36:43 +01:00