Comments (5)
By the way, while this does technically fulfill the requirements for DI, I'd rather be able to externally inject the dependencies. :/ Yeah, I do want to have my cake and eat it too.
from commandant.
I'll need to think about this, so it will take me a few days to respond.
from commandant.
My personal feelings is that Carthage command should be a thin translation layer between the command-line interface and the API. Because the translation layer is typed and largely handled by Commandant itself, it shouldn't require unit testing.
It's probably most useful to talk concretely about this with CheckoutCommand
. Here's what I would do to simplify things and eliminate the need for testing:
- Add an external function that's called from the
run()
method. This should take all the arguments. Something likecheckout(useSSH: Bool, useSubmodules: Bool, useBinaries: Bool, projectDirectory: String, dependencies: [String])
. (I'd like to do that anyway, so that all the Carthage commands are available as functions inCarthageKit.framework
.) - Move all the logic from
CheckoutCommand
and its options struct into that function. Logic is what requires testing. At that point,CheckoutCommand
is basically a mapping from the command-line representation onto the function. Data doesn't require testing. - The default value for
project-directory
could be changed to benil
, and then thecheckout
function could handle the default value. But I don't think that's necessary ifCheckoutCommand
is a thin mapping. And there are benefits to having the actual default there (e.g., try runningcarthage help checkout
and look at theproject-directory
option.)
That's my feelings. I'm not sure how that will sit with you.
from commandant.
I agree, actually. (It also helps that I wrote this issue before I began my current refactor-spree in Carthage).
Ideally, I'd like to reach 100% test coverage. However, that's not possible for something as complex as Carthage. Even if it were, testing carthage.app isn't that high a priority for me. If we can refactor carthage.app to just be a simple translation from Commandant to CarthageKit, then I'd tolerate not testing carthage.app.
from commandant.
👍
Gonna close this issue then. Feel free to reopen if there's more to discuss!
from commandant.
Related Issues (20)
- Detect --help, and run help HOT 2
- Dont mangle key typos. HOT 4
- Can't run tests on Linux HOT 6
- Any objections to cutting a release? HOT 2
- One `OrderedSet` test fails HOT 3
- Help message for Argument could be improved HOT 2
- Add owners to pod on CocoaPod trunk HOT 1
- Subcommand feature does not work on Ubuntu
- Drop Result dependency and implement Swift 5 Result
- 🍫 Podspec: Unrecognized `swift_version` key. HOT 1
- Aliases
- Cannot install using SPM
- `carthage checkout ` fails on using Commandant v0.8.3 HOT 3
- How can we declare consuming variadic arguments including `-` prefixed one in `OptionsType` HOT 3
- Recursive commands HOT 2
- The version 0.11 is not recognized with SPM. HOT 7
- swift build on Linux fails
- Release configuration build fails on Linux HOT 2
- Passing a Switch key is ignored if the Switch contains a flag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commandant.