Code Monkey home page Code Monkey logo

Comments (5)

younata avatar younata commented on August 19, 2024

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.

mdiep avatar mdiep commented on August 19, 2024

I'll need to think about this, so it will take me a few days to respond.

from commandant.

mdiep avatar mdiep commented on August 19, 2024

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:

  1. Add an external function that's called from the run() method. This should take all the arguments. Something like checkout(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 in CarthageKit.framework.)
  2. 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.
  3. The default value for project-directory could be changed to be nil, and then the checkout function could handle the default value. But I don't think that's necessary if CheckoutCommand is a thin mapping. And there are benefits to having the actual default there (e.g., try running carthage help checkout and look at the project-directory option.)

That's my feelings. I'm not sure how that will sit with you.

from commandant.

younata avatar younata commented on August 19, 2024

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.

mdiep avatar mdiep commented on August 19, 2024

👍

Gonna close this issue then. Feel free to reopen if there's more to discuss!

from commandant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.