question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Reusing script utils?

See original GitHub issue

Hey guys, what would be the best way to extract some common utils (things like extension methods, helpers, etc.) for reuse without having to build a true add-in?

I’m trying to refactor a Cake script that’s getting a bit too complex for my comfort, so I’m looking for ways to pull common behavior out into other “util” script files that I can reference from my main Cake script.

It looks like #load ./utils/MyHelpers.cake seems to work, and I can define classes and methods there, so that’s nice. Unfortunately it doesn’t work for extension methods, which is what I’d really prefer for a lot of these kinds of things, for fluency’s sake.

Any ideas? Might it be possible to pull in other referenced files as CakeAliases?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:18 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
kibiz0rcommented, Aug 8, 2018

@MiguelAlho: My memory is a little hazy on where my team really landed with this. I think we just used the .Init() approach for a while since we already had it working, but we ultimately moved to React Native so Cake became irrelevant. Sorry I’m not more help.

You might also be interested to check out FAKE.

1reaction
pascalbergercommented, Jul 27, 2018

@MiguelAlho Checkout Cake.Recipe. You can create a similar approach for an internal shared script library, which can be reused across multiple repositories.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Postman:how to set up library of (semi-)complicated ...
The test script will successfully print to console "I am a utility function". I've seen people do more complicated things where, if they...
Read more >
How to write a reusable script Library
1) Define a new TestSuite in the root of your project called Library. · 2) Disable the Library TestSuite so that it doesn't...
Read more >
Grumpy chronicles: The question of utils - tonsky.me
Grumpy chronicles: The question of utils. This is an ongoing mini-series of lessons learned from writing a tiny blog engine in Clojure.
Read more >
apex - ANY documentation on writing reusable code?
Updated Answer: What you have described in your updated question is indeed behaviour or process around your Equipement object, ...
Read more >
Create reusable tests and scripts with OpenAPI ...
Learn a creative way to store reusable scripts and tests in an OpenAPI definition, which can be retrieved on demand with the Postman...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found