Commit Graph

98 Commits

Author SHA1 Message Date
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
Kare Morstol 65625bbc75 Remove "listallexecutablesinpath.swift" and turn it into a Gist. List it as an example in the README.
It was way too wordy to use as a test.
2014-11-26 00:00:15 +01:00
Kare Morstol f60f6ae083 Add script for testing reading and writing files. 2014-11-25 20:45:38 +01:00
Kare Morstol b33bfb9a5f Move "temporaryDirectory" to new file Files.swift and rename it "tempdirectory".
Because it could be useful in scripts too.
2014-11-25 20:38:32 +01:00
Kare Morstol 90d10292c8 Add function "open(forWriting:, overwrite:)" for writing and appending to files.
Also added func "temporaryDirectory" to XCTestCase_Additions.
2014-11-25 01:15:36 +01:00
Kare Morstol a377eb18fd Add better error reporting to “open” function. Add public function "printErrorAndExit". 2014-11-23 23:31:06 +01:00
Kare Morstol cd5abf31d8 Add version of replace method with limit.
Also rename parameters in original version.
2014-11-06 00:04:51 +01:00
Kare Morstol 4254364b74 This indentation was brought to you by Xcode (6.1). 2014-11-06 00:02:24 +01:00
Kare Morstol d557f6a5fd Add take function. 2014-11-05 20:41:33 +01:00
Kare Morstol b870c209e8 Add findAllmethod to String. 2014-11-05 19:57:13 +01:00
Kare Morstol e67f465457 Add "countOccurrencesOf" to String. 2014-11-05 17:40:13 +01:00
Kare Morstol 548e0740d4 Tidy up the code some more. 2014-10-30 00:28:20 +01:00
Kare Morstol 977888c03b Rename "write" functions to "writeTo".
Because it makes more sense.
2014-10-25 19:17:07 +02:00
Kare Morstol c04cd0d84b Add function “drop” for discarding elements from a sequence. 2014-10-24 20:26:00 +02:00
Kare Morstol 1b78cab9fd Add a space before result of the parameters function.
So you don't have to remember to add it after the command.
2014-10-24 20:24:07 +02:00