Coder Social home page Coder Social logo

Comments (7)

anaisbetts avatar anaisbetts commented on May 11, 2024

Maybe? Send a PR :)

from squirrel.windows.

christianrondeau avatar christianrondeau commented on May 11, 2024

I can do that :) The only thing that still bothers me is where to put that code. I'm still uncomfortable with putting everything in UpdateManager. It's lifetime (and .Dispose() expected call) differs from a "runtime" API such as this one (and #47). Therefore, I'd create a SquirrelApplicationContext. What do you think?

from squirrel.windows.

anaisbetts avatar anaisbetts commented on May 11, 2024

I would put this in a separate class, yeah - it's not a context though, just make a simple static class + method that will parse arguments and return an Enum

from squirrel.windows.

christianrondeau avatar christianrondeau commented on May 11, 2024

Well, I thought of something like this, since first-run and install both require startup arguments:

var squirrelContext = new SquirrelApplicationContext(args);

if(squirrel.HandleInstall(handler));

if(squirrelContext.IsFirstRun)
  ShowSomeMessage();

So if we're to have such a class, why not make it so that it also handles creating the data directories (since that's the typical job of --squirrel-install), and if it knows the data directories, then it should be the main point of access.

But my main reason is that I'm a TDD-maniac, and if I'm to introduce a dependency in my app, I'd like to be able to mock it. Static methods just make my life harder :)

Anyway, I can just send a PR and let you decide what to do with it :)

from squirrel.windows.

anaisbetts avatar anaisbetts commented on May 11, 2024

So if we're to have such a class, why not make it so that it also handles creating the data directories

I'm not super excited about that, let's leave that in UpdateManager.

But my main reason is that I'm a TDD-maniac, and if I'm to introduce a dependency in my app, I'd like to be able to mock it

This method has no state though, what is there to mock? You pass in arguments, it does a thing

from squirrel.windows.

christianrondeau avatar christianrondeau commented on May 11, 2024

It's your project :) As for TDD, I'll end up wrapping it in a class anyway since I don't want to simulate Squirrel's logic in my app, I just want to simulate a state. My test would then look something like:

squirrelContextMock.SetupGet(m => m.IsFirstRun).Returns(true);

rather than passing the actual squirrel arguments. But that's just my own way of working, I won't push it on you!

from squirrel.windows.

anaisbetts avatar anaisbetts commented on May 11, 2024

#72 should cover this

from squirrel.windows.

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.